-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: testloop stub for resharding v3 (#12156)
### Goal Write stub for test for resharding v3 switch. For this, I want the chain to switch between shard layouts. And for that, I switch to `EpochConfigStore` as much as I can, which implies skipping `use_production_config`, overrides like `AllEpochConfig::config_max_kickout_stake`, `EpochConfig` generations from `GenesisConfig`. This is a big step towards #11265. The most visible changes are: Now TestLoop generates `genesis_and_epoch_config_store` instead of just `genesis`. Later we should have a separate `EpochConfigStoreBuilder` which may accept some data shared between genesis and epoch configs, e.g. validators set. This is done to minimise changes. `EpochManager::new_arc_handle` is the way how epoch manager is constructed on production nodes. Its logic is changed as follows: * if chain = mainnet/testnet, only `EpochConfigStore::for_chain_id` is used for getting epoch configs. * if `chain_id.starts_with("test-chain-")`, we use only `EpochConfig::from(genesis_config)` (see below!) * otherwise, we use only `Genesis::test_epoch_config`. **It doesn't use any genesis data**, just stays in this crate for now for convenience. This is for simple tests in single module. ### Achievements * `test_fix_min_stake_ratio` tests exactly what we want - we take `EpochConfigStore::for_chain_id("mainnet")` and see that it allows to include small validator after protocol upgrade. * In `test_resharding_v3` we define old and new shard layouts, and test the switch explicitly without hidden overrides. * Usage of hacky overrides is reduced. For example, `EpochManager::new_from_genesis_config_with_test_overrides` is removed. * If we want to launch forknet with custom epoch config, the behaviour will be more straightforward. For example, one can copy latest epoch config from mainnet to mocknet/ folder and add new condition to `for_epoch_id` for custom mocknet chain name. ### Failures Nayduck often configures epoch config through genesis, e.g. by setting `block_producer_kickout_threshold` to 0. It is much more work to change this configuration, so I add a hack: if chain_id starts with `test-chain-` - name which nayduck uses - epoch config is derived from genesis. Many old integration tests use this chain id as well. However, the improvement here is that we generate only **one** epoch config, without any overrides. epoch_length is sometimes taken from `ChainGenesis`, not from `EpochConfig`. To be safe, I set epoch length in both genesis and epoch configs. This still lacks testing on live node. Using this on canary or forknet could be insightful.
- Loading branch information
1 parent
359564c
commit 810e820
Showing
32 changed files
with
574 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.