Skip to content
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(resharding): add test case for state sync the epoch after resharding #12691

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 38 additions & 5 deletions integration-tests/src/test_loop/tests/resharding_v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,13 @@ fn test_resharding_v3_base(params: TestReshardingParameters) {
print_and_assert_shard_accounts(&clients, &tip);
}

check_state_shard_uid_mapping_after_resharding(
&client,
parent_shard_uid,
params.allow_negative_refcount,
);
for client in clients.iter() {
check_state_shard_uid_mapping_after_resharding(
client,
parent_shard_uid,
params.allow_negative_refcount,
);
}

// Return false if garbage collection window has not passed yet since resharding.
if epoch_height <= new_layout_epoch_height.get().unwrap() + GC_NUM_EPOCHS_TO_KEEP {
Expand Down Expand Up @@ -557,6 +559,37 @@ fn shard_sequence_to_schedule(mut shard_sequence: Vec<ShardId>) -> Vec<Vec<Shard
shard_sequence.iter().map(|shard_id| vec![*shard_id]).collect()
}

// Sets up an extra node that doesn't track the parent, doesn't track the child in the first post-resharding
// epoch, and then tracks a child in the epoch after that. This checks that state sync works in that case.
// TODO(resharding): fix nearcore and un-ignore this test. This will currently fail because apply_state_part()
// sets the state of the child after state sync with no state mapping, and then
// check_state_shard_uid_mapping_after_resharding() fails because that was expected.
#[test]
#[ignore]
fn test_resharding_v3_sync_child() {
let account_in_stable_shard: AccountId = "account0".parse().unwrap();
let split_boundary_account: AccountId = NEW_BOUNDARY_ACCOUNT.parse().unwrap();
let base_shard_layout = get_base_shard_layout(DEFAULT_SHARD_LAYOUT_VERSION);
let new_shard_layout =
ShardLayout::derive_shard_layout(&base_shard_layout, split_boundary_account.clone());
let child_shard_id = new_shard_layout.account_id_to_shard_id(&split_boundary_account);
let unrelated_shard_id = new_shard_layout.account_id_to_shard_id(&account_in_stable_shard);

let tracked_shard_sequence =
vec![unrelated_shard_id, unrelated_shard_id, unrelated_shard_id, child_shard_id];
let num_clients = 8;
let tracked_shard_schedule = TrackedShardSchedule {
client_index: (num_clients - 1) as usize,
schedule: shard_sequence_to_schedule(tracked_shard_sequence),
};
test_resharding_v3_base(
TestReshardingParametersBuilder::default()
.num_clients(num_clients)
.tracked_shard_schedule(Some(tracked_shard_schedule.clone()))
.build(),
);
}

#[test]
// TODO(resharding): fix nearcore and un-ignore this test
#[ignore]
Expand Down
Loading