diff --git a/core/lib/multivm/src/versions/testonly.rs b/core/lib/multivm/src/versions/testonly.rs index 16c3ea322f3..2ac2a4f7453 100644 --- a/core/lib/multivm/src/versions/testonly.rs +++ b/core/lib/multivm/src/versions/testonly.rs @@ -3,7 +3,7 @@ use zksync_test_account::Account; use zksync_types::{ block::L2BlockHasher, fee_model::BatchFeeInput, get_code_key, get_is_account_key, utils::storage_key_for_eth_balance, Address, L1BatchNumber, L2BlockNumber, L2ChainId, - ProtocolVersionId, U256, + ProtocolVersionId, H160, U256, }; use zksync_utils::{bytecode::hash_bytecode, u256_to_h256}; @@ -34,7 +34,9 @@ pub(super) fn default_l1_batch(number: L1BatchNumber) -> L1BatchEnv { 50_000_000_000, // 50 gwei 250_000_000, // 0.25 gwei ), - fee_account: Address::random(), + fee_account: Address::from(H160::from([ + 171, 255, 100, 126, 1, 76, 255, 237, 78, 76, 161, 0, 18, 6, 192, 49, 17, 18, 232, 29, + ])), enforced_base_fee: None, first_l2_block: L2BlockEnv { number: 1, diff --git a/core/lib/multivm/src/versions/vm_latest/tests/block_tip.rs b/core/lib/multivm/src/versions/vm_latest/tests/block_tip.rs index 9909ca24937..a67998a1d4e 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/block_tip.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/block_tip.rs @@ -16,15 +16,14 @@ use zksync_utils::{bytecode::hash_bytecode, bytes_to_be_words, h256_to_u256, u25 use super::utils::{get_complex_upgrade_abi, read_complex_upgrade}; use crate::{ interface::{L1BatchEnv, TxExecutionMode, VmExecutionMode, VmInterface, VmInterfaceExt}, + versions::testonly::default_l1_batch, vm_latest::{ constants::{ BOOTLOADER_BATCH_TIP_CIRCUIT_STATISTICS_OVERHEAD, BOOTLOADER_BATCH_TIP_METRICS_SIZE_OVERHEAD, BOOTLOADER_BATCH_TIP_OVERHEAD, MAX_VM_PUBDATA_PER_BATCH, }, - tests::tester::{ - default_l1_batch, get_empty_storage, InMemoryStorageView, VmTesterBuilder, - }, + tests::tester::{get_empty_storage, InMemoryStorageView, VmTesterBuilder}, tracers::PubdataTracer, HistoryEnabled, TracerDispatcher, }, diff --git a/core/lib/multivm/src/versions/vm_latest/tests/l2_blocks.rs b/core/lib/multivm/src/versions/vm_latest/tests/l2_blocks.rs index 1b5c3db59f7..271bdeec077 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/l2_blocks.rs @@ -19,12 +19,13 @@ use crate::{ storage::WriteStorage, ExecutionResult, Halt, L2BlockEnv, TxExecutionMode, VmExecutionMode, VmInterface, VmInterfaceExt, }, + versions::testonly::default_l1_batch, vm_latest::{ constants::{ BOOTLOADER_HEAP_PAGE, TX_OPERATOR_L2_BLOCK_INFO_OFFSET, TX_OPERATOR_SLOTS_PER_L2_BLOCK_INFO, }, - tests::tester::{default_l1_batch, VmTesterBuilder}, + tests::tester::VmTesterBuilder, utils::l2_blocks::get_l2_block_hash_key, HistoryEnabled, Vm, }, diff --git a/core/lib/multivm/src/versions/vm_latest/tests/tester/mod.rs b/core/lib/multivm/src/versions/vm_latest/tests/tester/mod.rs index c3cc5d8d980..0620d065e20 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/tester/mod.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/tester/mod.rs @@ -1,7 +1,5 @@ pub(crate) use transaction_test_info::{ExpectedError, TransactionTestInfo, TxModifier}; -pub(crate) use vm_tester::{ - default_l1_batch, get_empty_storage, InMemoryStorageView, VmTester, VmTesterBuilder, -}; +pub(crate) use vm_tester::{get_empty_storage, InMemoryStorageView, VmTester, VmTesterBuilder}; pub(crate) use zksync_test_account::{Account, DeployContractsTx, TxType}; mod inner_state; diff --git a/core/lib/multivm/src/versions/vm_latest/tests/tester/vm_tester.rs b/core/lib/multivm/src/versions/vm_latest/tests/tester/vm_tester.rs index 0f1339b5152..4762aa1e99e 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/tester/vm_tester.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/tester/vm_tester.rs @@ -3,10 +3,10 @@ use std::marker::PhantomData; use zksync_contracts::BaseSystemContracts; use zksync_types::{ block::L2BlockHasher, - fee_model::BatchFeeInput, get_code_key, get_is_account_key, utils::{deployed_address_create, storage_key_for_eth_balance}, - Address, L1BatchNumber, L2BlockNumber, L2ChainId, Nonce, ProtocolVersionId, U256, + Address, K256PrivateKey, L1BatchNumber, L2BlockNumber, L2ChainId, Nonce, ProtocolVersionId, + H256, U256, }; use zksync_utils::{bytecode::hash_bytecode, u256_to_h256}; @@ -16,6 +16,7 @@ use crate::{ L1BatchEnv, L2Block, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode, VmFactory, VmInterface, VmInterfaceExt, }, + versions::testonly::default_l1_batch, vm_latest::{ constants::BATCH_COMPUTATIONAL_GAS_LIMIT, tests::{ @@ -205,7 +206,13 @@ impl VmTesterBuilder { } pub(crate) fn with_deployer(mut self) -> Self { - let deployer = Account::random(); + let deployer = Account::new( + K256PrivateKey::from_bytes(H256::from([ + 166, 213, 235, 115, 15, 141, 58, 10, 160, 63, 84, 199, 169, 24, 185, 226, 57, 199, + 123, 116, 220, 99, 23, 83, 227, 247, 27, 37, 165, 2, 47, 222, + ])) + .unwrap(), + ); self.deployer = Some(deployer); self } @@ -246,27 +253,6 @@ impl VmTesterBuilder { } } -pub(crate) fn default_l1_batch(number: L1BatchNumber) -> L1BatchEnv { - let timestamp = 0xdeedf00daaaabbbb; - L1BatchEnv { - previous_batch_hash: None, - number, - timestamp, - fee_input: BatchFeeInput::l1_pegged( - 50_000_000_000, // 50 gwei - 250_000_000, // 0.25 gwei - ), - fee_account: Address::random(), - enforced_base_fee: None, - first_l2_block: L2BlockEnv { - number: 1, - timestamp, - prev_block_hash: L2BlockHasher::legacy_hash(L2BlockNumber(0)), - max_virtual_blocks_to_create: 100, - }, - } -} - pub(crate) fn make_account_rich(storage: StoragePtr, account: &Account) { let key = storage_key_for_eth_balance(&account.address); storage