diff --git a/core/lib/multivm/src/versions/testonly/l1_tx_execution.rs b/core/lib/multivm/src/versions/testonly/l1_tx_execution.rs index e614eb03468..3536210a710 100644 --- a/core/lib/multivm/src/versions/testonly/l1_tx_execution.rs +++ b/core/lib/multivm/src/versions/testonly/l1_tx_execution.rs @@ -102,9 +102,8 @@ pub(crate) fn test_l1_tx_execution() { let res = vm.vm.execute(VmExecutionMode::OneTx); let storage_logs = res.logs.storage_logs; let res = StorageWritesDeduplicator::apply_on_empty_state(&storage_logs); - // We changed one slot inside contract. However, the rewrite of the `basePubdataSpent` didn't happen, since it was the same - // as the start of the previous tx. Thus we have `+1` slot for the changed counter and `-1` slot for base pubdata spent - assert_eq!(res.initial_storage_writes, basic_initial_writes); + // We changed one slot inside contract. + assert_eq!(res.initial_storage_writes - basic_initial_writes, 1); // No repeated writes let repeated_writes = res.repeated_storage_writes; @@ -131,7 +130,7 @@ pub(crate) fn test_l1_tx_execution() { assert!(result.result.is_failed(), "The transaction should fail"); let res = StorageWritesDeduplicator::apply_on_empty_state(&result.logs.storage_logs); - assert_eq!(res.initial_storage_writes, basic_initial_writes); + assert_eq!(res.initial_storage_writes, basic_initial_writes + 1); assert_eq!(res.repeated_storage_writes, 1); } diff --git a/core/lib/multivm/src/versions/testonly/migration.rs b/core/lib/multivm/src/versions/testonly/migration.rs deleted file mode 100644 index a7764af2264..00000000000 --- a/core/lib/multivm/src/versions/testonly/migration.rs +++ /dev/null @@ -1,43 +0,0 @@ -use zksync_test_account::TxType; -use zksync_types::{get_code_key, H256, SYSTEM_CONTEXT_ADDRESS}; - -use super::{get_empty_storage, read_test_contract, tester::VmTesterBuilder, TestedVm}; -use crate::interface::{TxExecutionMode, VmExecutionMode, VmInterfaceExt}; - -/// This test checks that the new bootloader will work fine even if the previous system context contract is not -/// compatible with it, i.e. the bootloader will upgrade it before starting any transaction. -pub(crate) fn test_migration_for_system_context_aa_interaction() { - let mut storage = get_empty_storage(); - // We will set the system context bytecode to zero. - storage.set_value(get_code_key(&SYSTEM_CONTEXT_ADDRESS), H256::zero()); - - // In this test, we aim to test whether a simple account interaction (without any fee logic) - // will work. The account will try to deploy a simple contract from integration tests. - let mut vm = VmTesterBuilder::new() - .with_storage(storage) - .with_execution_mode(TxExecutionMode::VerifyExecute) - .with_random_rich_accounts(1) - .build::(); - - // Now, we will just proceed with standard transaction execution. - // The bootloader should be able to update system context regardless of whether - // the upgrade transaction is there or not. - let account = &mut vm.rich_accounts[0]; - let counter = read_test_contract(); - let tx = account.get_deploy_tx(&counter, None, TxType::L2).tx; - - vm.vm.push_transaction(tx); - let result = vm.vm.execute(VmExecutionMode::OneTx); - assert!( - !result.result.is_failed(), - "Transaction wasn't successful {:#?}", - result.result - ); - - let batch_result = vm.vm.execute(VmExecutionMode::Batch); - assert!( - !batch_result.result.is_failed(), - "Batch transaction wasn't successful {:#?}", - batch_result.result - ); -} diff --git a/core/lib/multivm/src/versions/testonly/mod.rs b/core/lib/multivm/src/versions/testonly/mod.rs index 50744d97753..50c48ff0de8 100644 --- a/core/lib/multivm/src/versions/testonly/mod.rs +++ b/core/lib/multivm/src/versions/testonly/mod.rs @@ -10,7 +10,7 @@ use ethabi::Contract; use once_cell::sync::Lazy; use zksync_contracts::{ - load_contract, read_bytecode, read_yul_bytecode, read_zbin_bytecode, BaseSystemContracts, + load_contract, read_bootloader_code, read_bytecode, read_zbin_bytecode, BaseSystemContracts, SystemContractCode, }; use zksync_test_account::Account; @@ -38,7 +38,6 @@ pub(super) mod get_used_contracts; pub(super) mod is_write_initial; pub(super) mod l1_tx_execution; pub(super) mod l2_blocks; -pub(super) mod migration; pub(super) mod nonce_holder; pub(super) mod precompiles; pub(super) mod refunds; @@ -125,9 +124,7 @@ pub(crate) fn read_simple_transfer_contract() -> Vec { } pub(crate) fn get_bootloader(test: &str) -> SystemContractCode { - let artifacts_path = "contracts/system-contracts/bootloader/tests/artifacts/"; - let bootloader_code = read_yul_bytecode(artifacts_path, test); - + let bootloader_code = read_bootloader_code(test); let bootloader_hash = hash_bytecode(&bootloader_code); SystemContractCode { code: bytes_to_be_words(bootloader_code), diff --git a/core/lib/multivm/src/versions/testonly/nonce_holder.rs b/core/lib/multivm/src/versions/testonly/nonce_holder.rs index 8c7c01ddbdc..5e20e3eef3c 100644 --- a/core/lib/multivm/src/versions/testonly/nonce_holder.rs +++ b/core/lib/multivm/src/versions/testonly/nonce_holder.rs @@ -74,6 +74,7 @@ fn run_nonce_test( pub(crate) fn test_nonce_holder() { let mut account = Account::random(); + let hex_addr = hex::encode(account.address.to_fixed_bytes()); let mut vm = VmTesterBuilder::new() .with_empty_in_memory_storage() .with_execution_mode(TxExecutionMode::VerifyExecute) @@ -90,7 +91,7 @@ pub(crate) fn test_nonce_holder() { &mut account, 1u32, NonceHolderTestMode::SetValueUnderNonce, - Some("Previous nonce has not been used".to_string()), + Some("Error function_selector = 0x13595475, data = 0x13595475".to_string()), "Allowed to set value under non sequential value", ); @@ -141,7 +142,7 @@ pub(crate) fn test_nonce_holder() { &mut account, 10u32, NonceHolderTestMode::IncreaseMinNonceBy5, - Some("Reusing the same nonce twice".to_string()), + Some(format!("Error function_selector = 0xe90aded4, data = 0xe90aded4000000000000000000000000{hex_addr}000000000000000000000000000000000000000000000000000000000000000a")), "Allowed to reuse nonce below the minimal one", ); @@ -161,7 +162,7 @@ pub(crate) fn test_nonce_holder() { &mut account, 13u32, NonceHolderTestMode::IncreaseMinNonceBy5, - Some("Reusing the same nonce twice".to_string()), + Some(format!("Error function_selector = 0xe90aded4, data = 0xe90aded4000000000000000000000000{hex_addr}000000000000000000000000000000000000000000000000000000000000000d")), "Allowed to reuse the same nonce twice", ); @@ -181,7 +182,7 @@ pub(crate) fn test_nonce_holder() { &mut account, 16u32, NonceHolderTestMode::IncreaseMinNonceTooMuch, - Some("The value for incrementing the nonce is too high".to_string()), + Some("Error function_selector = 0x45ac24a6, data = 0x45ac24a600000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000040000000000000000000000".to_string()), "Allowed for incrementing min nonce too much", ); @@ -191,7 +192,7 @@ pub(crate) fn test_nonce_holder() { &mut account, 16u32, NonceHolderTestMode::LeaveNonceUnused, - Some("The nonce was not set as used".to_string()), + Some(format!("Error function_selector = 0x1f2f8478, data = 0x1f2f8478000000000000000000000000{hex_addr}0000000000000000000000000000000000000000000000000000000000000010")), "Allowed to leave nonce as unused", ); }