From 0c076baa0a44025ffc4b3dd5db66b233c96ab3ed Mon Sep 17 00:00:00 2001 From: Dori Medini Date: Tue, 12 Nov 2024 09:58:08 +0200 Subject: [PATCH] refactor(blockifier_reexecution): add chain ID to SerializableOfflineReexecutionData --- .../src/state_reader/test_state_reader.rs | 4 +++- crates/blockifier_reexecution/src/state_reader/utils.rs | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/blockifier_reexecution/src/state_reader/test_state_reader.rs b/crates/blockifier_reexecution/src/state_reader/test_state_reader.rs index 42c6c2c7a7..8ffa38be53 100644 --- a/crates/blockifier_reexecution/src/state_reader/test_state_reader.rs +++ b/crates/blockifier_reexecution/src/state_reader/test_state_reader.rs @@ -85,6 +85,7 @@ pub struct SerializableDataPrevBlock { pub struct SerializableOfflineReexecutionData { pub serializable_data_prev_block: SerializableDataPrevBlock, pub serializable_data_next_block: SerializableDataNextBlock, + pub chain_id: ChainId, pub old_block_hash: BlockHash, } @@ -119,6 +120,7 @@ impl From for OfflineReexecutionData { state_diff_next_block, declared_classes, }, + chain_id, old_block_hash, } = value; @@ -138,7 +140,7 @@ impl From for OfflineReexecutionData { offline_state_reader_prev_block, block_context_next_block: BlockContext::new( block_info_next_block, - get_chain_info(&ChainId::Mainnet), + get_chain_info(&chain_id), VersionedConstants::get(&starknet_version).unwrap().clone(), BouncerConfig::max(), ), diff --git a/crates/blockifier_reexecution/src/state_reader/utils.rs b/crates/blockifier_reexecution/src/state_reader/utils.rs index 5ff18e9d75..40c94eb945 100644 --- a/crates/blockifier_reexecution/src/state_reader/utils.rs +++ b/crates/blockifier_reexecution/src/state_reader/utils.rs @@ -247,7 +247,7 @@ pub fn write_block_reexecution_data_to_file( let consecutive_state_readers = ConsecutiveTestStateReaders::new( block_number.prev().expect("Should not run with block 0"), Some(config), - chain_id, + chain_id.clone(), true, ); @@ -267,6 +267,7 @@ pub fn write_block_reexecution_data_to_file( SerializableOfflineReexecutionData { serializable_data_prev_block, serializable_data_next_block, + chain_id, old_block_hash, } .write_to_file(full_file_path)