From 85d8837b4e64b81e6d975497536c5d3dd5a89c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Chuda=C5=9B?= Date: Mon, 23 Dec 2024 15:01:01 +0100 Subject: [PATCH 1/2] Set epoch length in testloop --- chain/chunks/src/client.rs | 2 +- chain/client/src/client.rs | 2 +- integration-tests/src/test_loop/builder.rs | 1 + .../src/test_loop/tests/resharding_v3.rs | 13 ++++--------- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/chain/chunks/src/client.rs b/chain/chunks/src/client.rs index 0a334e89cf2..efccebb3a36 100644 --- a/chain/chunks/src/client.rs +++ b/chain/chunks/src/client.rs @@ -122,7 +122,7 @@ impl ShardedTransactionPool { /// the new shard layout. /// It works by emptying the pools for old shard uids and re-inserting the /// transactions back to the pool with the new shard uids. - /// TODO check if this logic works in resharding V3 + /// TODO(resharding) check if this logic works in resharding V3 pub fn reshard(&mut self, old_shard_layout: &ShardLayout, new_shard_layout: &ShardLayout) { tracing::debug!( target: "resharding", diff --git a/chain/client/src/client.rs b/chain/client/src/client.rs index 57bb66497f4..00dc12711ac 100644 --- a/chain/client/src/client.rs +++ b/chain/client/src/client.rs @@ -1684,7 +1684,7 @@ impl Client { // layout is changing we need to reshard the transaction pool. // TODO make sure transactions don't get added for the old shard // layout after the pool resharding - // TODO check if this logic works in resharding V3 + // TODO(resharding) check if this logic works in resharding V3 if self.epoch_manager.is_next_block_epoch_start(&block_hash).unwrap_or(false) { let new_shard_layout = self.epoch_manager.get_shard_layout_from_prev_block(&block_hash); diff --git a/integration-tests/src/test_loop/builder.rs b/integration-tests/src/test_loop/builder.rs index ae89b2eb31b..436eb230501 100644 --- a/integration-tests/src/test_loop/builder.rs +++ b/integration-tests/src/test_loop/builder.rs @@ -503,6 +503,7 @@ impl TestLoopBuilder { let genesis = self.genesis.as_ref().unwrap(); let epoch_config_store = self.epoch_config_store.as_ref().unwrap(); let mut client_config = ClientConfig::test(true, 600, 2000, 4, is_archival, true, false); + client_config.epoch_length = genesis.config.epoch_length; client_config.max_block_wait_delay = Duration::seconds(6); client_config.state_sync_enabled = true; client_config.state_sync_external_timeout = Duration::milliseconds(100); diff --git a/integration-tests/src/test_loop/tests/resharding_v3.rs b/integration-tests/src/test_loop/tests/resharding_v3.rs index 2f4e2045c87..66fd91a0af0 100644 --- a/integration-tests/src/test_loop/tests/resharding_v3.rs +++ b/integration-tests/src/test_loop/tests/resharding_v3.rs @@ -316,6 +316,7 @@ fn call_burn_gas_contract( receiver_ids: Vec, gas_burnt_per_call: Gas, ) -> LoopActionFn { + // Must be less than epoch length, otherwise transactions won't be checked. const TX_CHECK_BLOCKS_AFTER_RESHARDING: u64 = 5; const CALLS_PER_BLOCK_HEIGHT: usize = 5; @@ -952,8 +953,7 @@ fn test_resharding_v3_delayed_receipts_right_child() { ReceiptKind::Delayed, )) .allow_negative_refcount(true) - // TODO(resharding): test should work without changes to num_rpcs and track_all_shards - .num_rpcs(0) + // TODO(resharding): test should work without changes to track_all_shards .track_all_shards(true) .build(); test_resharding_v3_base(params); @@ -981,9 +981,6 @@ fn test_resharding_v3_split_parent_buffered_receipts_base(base_shard_layout_vers vec![account_in_left_child], ReceiptKind::Buffered, )) - // TODO(resharding): test should work without changes to num_rpcs and track_all_shards - .num_rpcs(0) - .track_all_shards(true) .build(); test_resharding_v3_base(params); } @@ -1071,8 +1068,7 @@ fn test_resharding_v3_outgoing_receipts_from_splitted_shard() { vec![receiver_account], 5 * TGAS, )) - // TODO(resharding): test should work without changes to num_rpcs and track_all_shards - .num_rpcs(0) + // TODO(resharding): test should work without changes to track_all_shards .track_all_shards(true) .build(); test_resharding_v3_base(params); @@ -1146,8 +1142,7 @@ fn test_resharding_v3_yield_resume() { vec![account_in_left_child, account_in_right_child], ReceiptKind::PromiseYield, )) - // TODO(resharding): test should work without changes to num_rpcs and track_all_shards - .num_rpcs(0) + // TODO(resharding): test should work without changes to track_all_shards .track_all_shards(true) .build(); test_resharding_v3_base(params); From de5aaa750aeb2c700a881d5f0c0ed33cd53e98af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Chuda=C5=9B?= Date: Mon, 23 Dec 2024 16:19:19 +0100 Subject: [PATCH 2/2] back --- integration-tests/src/test_loop/tests/resharding_v3.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/integration-tests/src/test_loop/tests/resharding_v3.rs b/integration-tests/src/test_loop/tests/resharding_v3.rs index 66fd91a0af0..d806861532c 100644 --- a/integration-tests/src/test_loop/tests/resharding_v3.rs +++ b/integration-tests/src/test_loop/tests/resharding_v3.rs @@ -981,6 +981,8 @@ fn test_resharding_v3_split_parent_buffered_receipts_base(base_shard_layout_vers vec![account_in_left_child], ReceiptKind::Buffered, )) + // TODO(resharding): test should work without changes to track_all_shards + .track_all_shards(true) .build(); test_resharding_v3_base(params); }