Skip to content

Commit

Permalink
Add evm simulator to aux protocol version used for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IAvecilla committed Aug 31, 2024
1 parent 00f2325 commit c248a71
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions core/lib/types/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ pub struct ProtocolVersion {
/// Verifier configuration
#[deprecated]
pub verification_keys_hashes: Option<L1VerifierConfig>,
/// 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<BaseSystemContractsHashes>,
/// Bootloader code hash
Expand Down Expand Up @@ -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<H256> {
pub fn evm_simulator_code_hash(&self) -> Option<H256> {
self.evm_simulator_code_hash.or_else(|| {
self.base_system_contracts
.map(|hashes| hashes.evm_simulator)
Expand Down
2 changes: 1 addition & 1 deletion core/node/node_sync/src/external_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions core/node/node_sync/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions core/node/vm_runner/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit c248a71

Please sign in to comment.