-
Notifications
You must be signed in to change notification settings - Fork 622
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Introduce mechanism to load EpochConfigs for production chains …
…from JSON files per version (#11896) Issue: #11265 We introduce a mechanism for storing `EpochConfigs` for mainnet/testnet/mocknet (forknet) in JSON files for various protocol versions and retrieving them from a new library called `EpochConfigStore`. The library parses JSON files containing the epoch configs and loads them in a map from (chain-id x version) to `EpochConfig`. The library is accessed from `AllEpochConfig` when `use_production_config` is set to true AND outside of tests (for this we explicitly set test overrides to default even if there is no explicit override to distinguish cases where a test uses a mainnet/testnet chanin id with a custom `EpochConfig`). We change the existing `for_protocol_version` method of `AllEpochConfig` to `generate_epoch_config` to indicate that it generates a config in code. The new version of `for_protocol_version` internall calls the config store or `generate_epoch_config` based on whether the config store is initialized. We will need to follow-up with more changes to this PR since there are tests that use mainnet/testnet chain id with custom `EpochConfig` which conflicts with the config store (which is supposed to use production configs for these chains). Our eventual goal is to remove `generate_epoch_config` and only have (1) explicitly documented production configs in JSON files or (2) custom-built configs in test but not using the hard-coded changes.
- Loading branch information
1 parent
fd0af1b
commit 3cc6691
Showing
37 changed files
with
2,600 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{ | ||
"epoch_length": 43200, | ||
"num_block_producer_seats": 100, | ||
"num_block_producer_seats_per_shard": [ | ||
100, | ||
100, | ||
100, | ||
100, | ||
100, | ||
100, | ||
100 | ||
], | ||
"avg_hidden_validator_seats_per_shard": [ | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0 | ||
], | ||
"block_producer_kickout_threshold": 80, | ||
"chunk_producer_kickout_threshold": 80, | ||
"chunk_validator_only_kickout_threshold": 80, | ||
"target_validator_mandates_per_shard": 68, | ||
"validator_max_kickout_stake_perc": 30, | ||
"online_min_threshold": [ | ||
90, | ||
100 | ||
], | ||
"online_max_threshold": [ | ||
99, | ||
100 | ||
], | ||
"fishermen_threshold": 340282366920938463463374607431768211455, | ||
"minimum_stake_divisor": 10, | ||
"protocol_upgrade_stake_threshold": [ | ||
4, | ||
5 | ||
], | ||
"shard_layout": { | ||
"V1": { | ||
"boundary_accounts": [ | ||
"aurora", | ||
"aurora-0", | ||
"game.hot.tg", | ||
"kkuuue2akv_1630967379.near", | ||
"nightly", | ||
"tge-lockup.sweat" | ||
], | ||
"shards_split_map": [ | ||
[ | ||
0 | ||
], | ||
[ | ||
1 | ||
], | ||
[ | ||
2 | ||
], | ||
[ | ||
3 | ||
], | ||
[ | ||
4, | ||
5 | ||
], | ||
[ | ||
6 | ||
] | ||
], | ||
"to_parent_shard_map": [ | ||
0, | ||
1, | ||
2, | ||
3, | ||
4, | ||
4, | ||
5 | ||
], | ||
"version": 4 | ||
} | ||
}, | ||
"validator_selection_config": { | ||
"num_chunk_producer_seats": 100, | ||
"num_chunk_validator_seats": 300, | ||
"num_chunk_only_producer_seats": 0, | ||
"minimum_validators_per_shard": 1, | ||
"minimum_stake_ratio": [ | ||
1, | ||
6250 | ||
], | ||
"chunk_producer_assignment_changes_limit": 5, | ||
"shuffle_shard_assignment_for_chunk_producers": false | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"epoch_length": 43200, | ||
"num_block_producer_seats": 100, | ||
"num_block_producer_seats_per_shard": [ | ||
100, | ||
100, | ||
100, | ||
100, | ||
100, | ||
100 | ||
], | ||
"avg_hidden_validator_seats_per_shard": [ | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0 | ||
], | ||
"block_producer_kickout_threshold": 80, | ||
"chunk_producer_kickout_threshold": 80, | ||
"chunk_validator_only_kickout_threshold": 80, | ||
"target_validator_mandates_per_shard": 68, | ||
"validator_max_kickout_stake_perc": 30, | ||
"online_min_threshold": [ | ||
90, | ||
100 | ||
], | ||
"online_max_threshold": [ | ||
99, | ||
100 | ||
], | ||
"fishermen_threshold": 340282366920938463463374607431768211455, | ||
"minimum_stake_divisor": 10, | ||
"protocol_upgrade_stake_threshold": [ | ||
4, | ||
5 | ||
], | ||
"shard_layout": { | ||
"V1": { | ||
"boundary_accounts": [ | ||
"aurora", | ||
"aurora-0", | ||
"game.hot.tg", | ||
"kkuuue2akv_1630967379.near", | ||
"tge-lockup.sweat" | ||
], | ||
"shards_split_map": [ | ||
[ | ||
0 | ||
], | ||
[ | ||
1 | ||
], | ||
[ | ||
2, | ||
3 | ||
], | ||
[ | ||
4 | ||
], | ||
[ | ||
5 | ||
] | ||
], | ||
"to_parent_shard_map": [ | ||
0, | ||
1, | ||
2, | ||
2, | ||
3, | ||
4 | ||
], | ||
"version": 3 | ||
} | ||
}, | ||
"validator_selection_config": { | ||
"num_chunk_producer_seats": 100, | ||
"num_chunk_validator_seats": 300, | ||
"num_chunk_only_producer_seats": 0, | ||
"minimum_validators_per_shard": 1, | ||
"minimum_stake_ratio": [ | ||
1, | ||
6250 | ||
], | ||
"chunk_producer_assignment_changes_limit": 5, | ||
"shuffle_shard_assignment_for_chunk_producers": false | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"epoch_length": 43200, | ||
"num_block_producer_seats": 100, | ||
"num_block_producer_seats_per_shard": [ | ||
100, | ||
100, | ||
100, | ||
100, | ||
100, | ||
100 | ||
], | ||
"avg_hidden_validator_seats_per_shard": [ | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0 | ||
], | ||
"block_producer_kickout_threshold": 80, | ||
"chunk_producer_kickout_threshold": 80, | ||
"chunk_validator_only_kickout_threshold": 80, | ||
"target_validator_mandates_per_shard": 68, | ||
"validator_max_kickout_stake_perc": 30, | ||
"online_min_threshold": [ | ||
90, | ||
100 | ||
], | ||
"online_max_threshold": [ | ||
99, | ||
100 | ||
], | ||
"fishermen_threshold": 340282366920938463463374607431768211455, | ||
"minimum_stake_divisor": 10, | ||
"protocol_upgrade_stake_threshold": [ | ||
4, | ||
5 | ||
], | ||
"shard_layout": { | ||
"V1": { | ||
"boundary_accounts": [ | ||
"aurora", | ||
"aurora-0", | ||
"game.hot.tg", | ||
"kkuuue2akv_1630967379.near", | ||
"tge-lockup.sweat" | ||
], | ||
"shards_split_map": [ | ||
[ | ||
0 | ||
], | ||
[ | ||
1 | ||
], | ||
[ | ||
2, | ||
3 | ||
], | ||
[ | ||
4 | ||
], | ||
[ | ||
5 | ||
] | ||
], | ||
"to_parent_shard_map": [ | ||
0, | ||
1, | ||
2, | ||
2, | ||
3, | ||
4 | ||
], | ||
"version": 3 | ||
} | ||
}, | ||
"validator_selection_config": { | ||
"num_chunk_producer_seats": 100, | ||
"num_chunk_validator_seats": 300, | ||
"num_chunk_only_producer_seats": 0, | ||
"minimum_validators_per_shard": 1, | ||
"minimum_stake_ratio": [ | ||
1, | ||
6250 | ||
], | ||
"chunk_producer_assignment_changes_limit": 5, | ||
"shuffle_shard_assignment_for_chunk_producers": true | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"epoch_length": 43200, | ||
"num_block_producer_seats": 100, | ||
"num_block_producer_seats_per_shard": [ | ||
100 | ||
], | ||
"avg_hidden_validator_seats_per_shard": [ | ||
0 | ||
], | ||
"block_producer_kickout_threshold": 90, | ||
"chunk_producer_kickout_threshold": 90, | ||
"chunk_validator_only_kickout_threshold": 80, | ||
"target_validator_mandates_per_shard": 68, | ||
"validator_max_kickout_stake_perc": 100, | ||
"online_min_threshold": [ | ||
90, | ||
100 | ||
], | ||
"online_max_threshold": [ | ||
99, | ||
100 | ||
], | ||
"fishermen_threshold": 340282366920938463463374607431768211455, | ||
"minimum_stake_divisor": 10, | ||
"protocol_upgrade_stake_threshold": [ | ||
4, | ||
5 | ||
], | ||
"shard_layout": { | ||
"V0": { | ||
"num_shards": 1, | ||
"version": 0 | ||
} | ||
}, | ||
"validator_selection_config": { | ||
"num_chunk_producer_seats": 100, | ||
"num_chunk_validator_seats": 300, | ||
"num_chunk_only_producer_seats": 300, | ||
"minimum_validators_per_shard": 1, | ||
"minimum_stake_ratio": [ | ||
1, | ||
6250 | ||
], | ||
"chunk_producer_assignment_changes_limit": 5, | ||
"shuffle_shard_assignment_for_chunk_producers": false | ||
} | ||
} |
Oops, something went wrong.