-
Notifications
You must be signed in to change notification settings - Fork 622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: enable simple resharding v3 test #12191
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #12191 +/- ##
==========================================
+ Coverage 71.61% 71.68% +0.07%
==========================================
Files 824 824
Lines 165513 165526 +13
Branches 165513 165526 +13
==========================================
+ Hits 118524 118650 +126
+ Misses 41858 41740 -118
- Partials 5131 5136 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -2347,7 +2347,12 @@ impl Chain { | |||
) -> bool { | |||
let result = epoch_manager.will_shard_layout_change(parent_hash); | |||
let will_shard_layout_change = match result { | |||
Ok(will_shard_layout_change) => will_shard_layout_change, | |||
Ok(_will_shard_layout_change) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could we add a todo here to enable this later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
chain/chain/src/chain.rs
Outdated
// Before state sync is fixed, we don't catch up split shards. | ||
// Assume that all needed shards are tracked already. | ||
// will_shard_layout_change, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a TODO(resharding) here?
cc @marcelo-gonzalez you will likely need fix that as part of state sync & resharding integration
if idx < validator_num { | ||
client_config.tracked_shards = Vec::new(); | ||
} else { | ||
let not_a_validator = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It's better to use positive statements ( is_validator ) - it makes it more readable
mini-nit: maybe worth moving to a helper method
let clients = accounts.iter().cloned().collect_vec(); | ||
let block_and_chunk_producers = (0..8).map(|idx| accounts[idx].as_str()).collect_vec(); | ||
// TODO: set up chunk validator-only nodes. | ||
let clients = vec![accounts[0].clone(), accounts[3].clone(), accounts[6].clone()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you only pick a few accounts here? Can you add a comment?
base_epoch_config.block_producer_kickout_threshold = 0; | ||
base_epoch_config.chunk_producer_kickout_threshold = 0; | ||
base_epoch_config.chunk_validator_only_kickout_threshold = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why no kickouts? Is it temporary until all is implemented? If so can you add a todo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
/// which is incorrect!!! | ||
/// - Nodes must not track all shards. State sync must succeed. | ||
/// - Set up chunk validator-only nodes. State witness must pass validation. | ||
/// - Tx load must be consistent. Txs and receipts must cross resharding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better if test cross shard receipts in a separate test, but yes tx should be consistent
base_epoch_config.block_producer_kickout_threshold = 0; | ||
base_epoch_config.chunk_producer_kickout_threshold = 0; | ||
base_epoch_config.chunk_validator_only_kickout_threshold = 0; | ||
base_epoch_config.shard_layout = ShardLayout::v1(vec!["account3".parse().unwrap()], None, 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should test also the case where we go from ShardLayout::v2
to ShardLayout::v2
. Maybe in following PRs we can have a common setup method
shards_split_map.insert(last_shard_id, vec![max_shard_id + 1, max_shard_id + 2]); | ||
boundary_accounts.push(AccountId::try_from("x.near".to_string()).unwrap()); | ||
// Keep this way until non-contiguous shard ids are supported. | ||
// let new_shards = vec![max_shard_id + 1, max_shard_id + 2]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add todo?
Do minimal changes to the code allowing to check that number of shards in the new epoch increased.
This code can be reused to test each separate component for resharding v3:
To make the test pass, nodes must track all shards for now, because state sync is not implemented yet. So every node must think that it has enough state to skip state sync.
Note that it doesn't mean at all that resharding works already. State is also not properly constructed yet, so tx processing will either be incorrect or crash the node.