From c248a714aaa027e48f738676e7c25a8a4be290d6 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Sat, 31 Aug 2024 00:35:53 -0300 Subject: [PATCH] Add evm simulator to aux protocol version used for tests --- core/lib/types/src/api/mod.rs | 4 ++-- core/node/node_sync/src/external_io.rs | 2 +- core/node/node_sync/src/tests.rs | 7 +++++++ core/node/vm_runner/src/tests/mod.rs | 4 ++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/core/lib/types/src/api/mod.rs b/core/lib/types/src/api/mod.rs index 4c0b1e69439c..e72884340252 100644 --- a/core/lib/types/src/api/mod.rs +++ b/core/lib/types/src/api/mod.rs @@ -638,7 +638,7 @@ pub struct ProtocolVersion { /// Verifier configuration #[deprecated] pub verification_keys_hashes: Option, - /// Hashes of base system contracts (bootloader and default account) + /// Hashes of base system contracts (bootloader, default account and evm simulator) #[deprecated] pub base_system_contracts: Option, /// Bootloader code hash @@ -696,7 +696,7 @@ impl ProtocolVersion { .or_else(|| self.base_system_contracts.map(|hashes| hashes.default_aa)) } - pub fn default_evm_simulator_code_hash(&self) -> Option { + pub fn evm_simulator_code_hash(&self) -> Option { self.evm_simulator_code_hash.or_else(|| { self.base_system_contracts .map(|hashes| hashes.evm_simulator) diff --git a/core/node/node_sync/src/external_io.rs b/core/node/node_sync/src/external_io.rs index 2fc04ba60bba..d05c011da4ef 100644 --- a/core/node/node_sync/src/external_io.rs +++ b/core/node/node_sync/src/external_io.rs @@ -346,7 +346,7 @@ impl StateKeeperIO for ExternalIO { .default_account_code_hash() .context("Missing default account code hash")?; let evm_simulator_code_hash = protocol_version - .default_evm_simulator_code_hash() + .evm_simulator_code_hash() .context("Missing evm simulator code hash")?; let l2_system_upgrade_tx_hash = protocol_version.l2_system_upgrade_tx_hash(); self.pool diff --git a/core/node/node_sync/src/tests.rs b/core/node/node_sync/src/tests.rs index edd8306e72e0..fc6fd292c091 100644 --- a/core/node/node_sync/src/tests.rs +++ b/core/node/node_sync/src/tests.rs @@ -304,6 +304,7 @@ async fn external_io_works_without_local_protocol_version(snapshot_recovery: boo timestamp: snapshot.l2_block_timestamp + 1, bootloader_code_hash: Some(H256::repeat_byte(1)), default_account_code_hash: Some(H256::repeat_byte(1)), + evm_simulator_code_hash: Some(H256::repeat_byte(1)), ..api::ProtocolVersion::default() }; client.insert_protocol_version(next_protocol_version.clone()); @@ -344,6 +345,12 @@ async fn external_io_works_without_local_protocol_version(snapshot_recovery: boo .default_aa, next_protocol_version.default_account_code_hash.unwrap() ); + assert_eq!( + persisted_protocol_version + .base_system_contracts_hashes + .evm_simulator, + next_protocol_version.evm_simulator_code_hash.unwrap() + ); let l2_block = storage .blocks_dal() diff --git a/core/node/vm_runner/src/tests/mod.rs b/core/node/vm_runner/src/tests/mod.rs index 30061954c180..cd225c0725bc 100644 --- a/core/node/vm_runner/src/tests/mod.rs +++ b/core/node/vm_runner/src/tests/mod.rs @@ -321,6 +321,10 @@ async fn store_l1_batches( .iter() .map(|contract| hash_bytecode(&contract.bytecode)) .chain([genesis_params.base_system_contracts().hashes().default_aa]) + .chain([genesis_params + .base_system_contracts() + .hashes() + .evm_simulator]) .map(h256_to_u256) .collect();