From 8f6341bb5b09ba9c84df4a4fe7b2142866a5c238 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 10:56:09 +0300 Subject: [PATCH 01/17] Add `vm_interfaces` crate --- Cargo.lock | 4 ++++ Cargo.toml | 2 ++ core/lib/multivm/README.md | 4 ++-- core/lib/vm_interface/Cargo.toml | 12 ++++++++++++ core/lib/vm_interface/README.md | 8 ++++++++ 5 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 core/lib/vm_interface/Cargo.toml create mode 100644 core/lib/vm_interface/README.md diff --git a/Cargo.lock b/Cargo.lock index ce20580b3856..878a78d126ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9756,6 +9756,10 @@ dependencies = [ "zksync_utils", ] +[[package]] +name = "zksync_vm_interfaces" +version = "0.1.0" + [[package]] name = "zksync_vm_runner" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 06bd6669b679..f83d358b2397 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,6 +68,7 @@ members = [ "core/lib/utils", "core/lib/vlog", "core/lib/multivm", + "core/lib/vm_interface", "core/lib/vm_utils", "core/lib/web3_decl", "core/lib/snapshots_applier", @@ -234,6 +235,7 @@ zksync_protobuf_build = "=0.1.0-rc.9" zksync_multivm = { version = "0.1.0", path = "core/lib/multivm" } zksync_prover_dal = { version = "0.1.0", path = "prover/crates/lib/prover_dal" } zksync_vlog = { version = "0.1.0", path = "core/lib/vlog" } +zksync_vm_interface = { version = "0.1.0", path = "core/lib/vm_interface" } zksync_vm_utils = { version = "0.1.0", path = "core/lib/vm_utils" } zksync_vm_benchmark_harness = { version = "0.1.0", path = "core/tests/vm-benchmark/harness" } zksync_basic_types = { version = "0.1.0", path = "core/lib/basic_types" } diff --git a/core/lib/multivm/README.md b/core/lib/multivm/README.md index c117a4b3b9b4..8d99029b711d 100644 --- a/core/lib/multivm/README.md +++ b/core/lib/multivm/README.md @@ -1,6 +1,6 @@ -# External node's VM +# ZKsync Era VM Wrapper -This crate represents a wrapper over several versions of VM that have been used by the main node. It contains the glue +This crate represents a wrapper over several versions of VM that have been used by the ZKsync Era node. It contains the glue code that allows switching the VM version based on the externally provided marker while preserving the public interface. This crate exists to enable the external node to process breaking upgrades and re-execute all the transactions from the genesis block. diff --git a/core/lib/vm_interface/Cargo.toml b/core/lib/vm_interface/Cargo.toml new file mode 100644 index 000000000000..7c32b973c9be --- /dev/null +++ b/core/lib/vm_interface/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "zksync_vm_interfaces" +description = "ZKsync Era VM interfaces" +version.workspace = true +edition.workspace = true +authors.workspace = true +homepage.workspace = true +repository.workspace = true +license.workspace = true +keywords.workspace = true +categories.workspace = true + diff --git a/core/lib/vm_interface/README.md b/core/lib/vm_interface/README.md new file mode 100644 index 000000000000..fad9c8fd9890 --- /dev/null +++ b/core/lib/vm_interface/README.md @@ -0,0 +1,8 @@ +# ZKsync Era VM Interfaces + +This crate declares interfaces used by all version of the ZKsync Era VM. + +## See also + +- [`zksync_multivm`](https://crates.io/crates/zksync_multivm): crate with ZKsync Era VM implementations. +- [`zksync_state`](https://crates.io/crates/zksync_state): crate with VM state implementations. From 12a5f24b2ff6d4f1efb09c5e184598ec42eacd48 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 10:57:30 +0300 Subject: [PATCH 02/17] Move `types` module to `vm_interface` --- core/lib/multivm/src/interface/mod.rs | 21 +++---------------- core/lib/vm_interface/src/lib.rs | 15 +++++++++++++ .../src}/types/errors/bootloader_error.rs | 0 .../src}/types/errors/bytecode_compression.rs | 4 +--- .../src}/types/errors/halt.rs | 0 .../src}/types/errors/mod.rs | 0 .../src}/types/errors/tx_revert_reason.rs | 0 .../src}/types/errors/vm_revert_reason.rs | 0 .../src}/types/inputs/execution_mode.rs | 0 .../src}/types/inputs/l1_batch_env.rs | 0 .../src}/types/inputs/l2_block.rs | 0 .../src}/types/inputs/mod.rs | 0 .../src}/types/inputs/system_env.rs | 0 .../src}/types/mod.rs | 0 .../src}/types/outputs/execution_result.rs | 0 .../src}/types/outputs/execution_state.rs | 0 .../src}/types/outputs/finished_l1batch.rs | 0 .../src}/types/outputs/l2_block.rs | 0 .../src}/types/outputs/mod.rs | 0 .../src}/types/outputs/statistic.rs | 0 .../src}/types/tracer.rs | 0 21 files changed, 19 insertions(+), 21 deletions(-) create mode 100644 core/lib/vm_interface/src/lib.rs rename core/lib/{multivm/src/interface => vm_interface/src}/types/errors/bootloader_error.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/errors/bytecode_compression.rs (76%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/errors/halt.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/errors/mod.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/errors/tx_revert_reason.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/errors/vm_revert_reason.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/inputs/execution_mode.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/inputs/l1_batch_env.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/inputs/l2_block.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/inputs/mod.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/inputs/system_env.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/mod.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/outputs/execution_result.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/outputs/execution_state.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/outputs/finished_l1batch.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/outputs/l2_block.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/outputs/mod.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/outputs/statistic.rs (100%) rename core/lib/{multivm/src/interface => vm_interface/src}/types/tracer.rs (100%) diff --git a/core/lib/multivm/src/interface/mod.rs b/core/lib/multivm/src/interface/mod.rs index 360d53df52a7..8cc6ebacd2d2 100644 --- a/core/lib/multivm/src/interface/mod.rs +++ b/core/lib/multivm/src/interface/mod.rs @@ -1,21 +1,6 @@ pub(crate) mod traits; -pub mod types; -pub use self::{ - traits::{ - tracers::dyn_tracers, - vm::{VmFactory, VmInterface, VmInterfaceHistoryEnabled}, - }, - types::{ - errors::{ - BytecodeCompressionError, Halt, TxRevertReason, VmRevertReason, - VmRevertReasonParsingError, - }, - inputs::{L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode}, - outputs::{ - BootloaderMemory, CurrentExecutionState, ExecutionResult, FinishedL1Batch, L2Block, - Refunds, VmExecutionResultAndLogs, VmExecutionStatistics, VmMemoryMetrics, - }, - tracer, - }, +pub use self::traits::{ + tracers::dyn_tracers, + vm::{VmFactory, VmInterface, VmInterfaceHistoryEnabled}, }; diff --git a/core/lib/vm_interface/src/lib.rs b/core/lib/vm_interface/src/lib.rs new file mode 100644 index 000000000000..c9e7d21cc4cc --- /dev/null +++ b/core/lib/vm_interface/src/lib.rs @@ -0,0 +1,15 @@ +//! ZKsync Era VM interfaces. + +pub use crate::types::{ + errors::{ + BytecodeCompressionError, Halt, TxRevertReason, VmRevertReason, VmRevertReasonParsingError, + }, + inputs::{L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode}, + outputs::{ + BootloaderMemory, CurrentExecutionState, ExecutionResult, FinishedL1Batch, L2Block, + Refunds, VmExecutionResultAndLogs, VmExecutionStatistics, VmMemoryMetrics, + }, + tracer, +}; + +mod types; diff --git a/core/lib/multivm/src/interface/types/errors/bootloader_error.rs b/core/lib/vm_interface/src/types/errors/bootloader_error.rs similarity index 100% rename from core/lib/multivm/src/interface/types/errors/bootloader_error.rs rename to core/lib/vm_interface/src/types/errors/bootloader_error.rs diff --git a/core/lib/multivm/src/interface/types/errors/bytecode_compression.rs b/core/lib/vm_interface/src/types/errors/bytecode_compression.rs similarity index 76% rename from core/lib/multivm/src/interface/types/errors/bytecode_compression.rs rename to core/lib/vm_interface/src/types/errors/bytecode_compression.rs index c6cd094ae948..a5680afd684c 100644 --- a/core/lib/multivm/src/interface/types/errors/bytecode_compression.rs +++ b/core/lib/vm_interface/src/types/errors/bytecode_compression.rs @@ -1,7 +1,5 @@ -use thiserror::Error; - /// Errors related to bytecode compression. -#[derive(Debug, Error)] +#[derive(Debug, thiserror::Error)] pub enum BytecodeCompressionError { #[error("Bytecode compression failed")] BytecodeCompressionFailed, diff --git a/core/lib/multivm/src/interface/types/errors/halt.rs b/core/lib/vm_interface/src/types/errors/halt.rs similarity index 100% rename from core/lib/multivm/src/interface/types/errors/halt.rs rename to core/lib/vm_interface/src/types/errors/halt.rs diff --git a/core/lib/multivm/src/interface/types/errors/mod.rs b/core/lib/vm_interface/src/types/errors/mod.rs similarity index 100% rename from core/lib/multivm/src/interface/types/errors/mod.rs rename to core/lib/vm_interface/src/types/errors/mod.rs diff --git a/core/lib/multivm/src/interface/types/errors/tx_revert_reason.rs b/core/lib/vm_interface/src/types/errors/tx_revert_reason.rs similarity index 100% rename from core/lib/multivm/src/interface/types/errors/tx_revert_reason.rs rename to core/lib/vm_interface/src/types/errors/tx_revert_reason.rs diff --git a/core/lib/multivm/src/interface/types/errors/vm_revert_reason.rs b/core/lib/vm_interface/src/types/errors/vm_revert_reason.rs similarity index 100% rename from core/lib/multivm/src/interface/types/errors/vm_revert_reason.rs rename to core/lib/vm_interface/src/types/errors/vm_revert_reason.rs diff --git a/core/lib/multivm/src/interface/types/inputs/execution_mode.rs b/core/lib/vm_interface/src/types/inputs/execution_mode.rs similarity index 100% rename from core/lib/multivm/src/interface/types/inputs/execution_mode.rs rename to core/lib/vm_interface/src/types/inputs/execution_mode.rs diff --git a/core/lib/multivm/src/interface/types/inputs/l1_batch_env.rs b/core/lib/vm_interface/src/types/inputs/l1_batch_env.rs similarity index 100% rename from core/lib/multivm/src/interface/types/inputs/l1_batch_env.rs rename to core/lib/vm_interface/src/types/inputs/l1_batch_env.rs diff --git a/core/lib/multivm/src/interface/types/inputs/l2_block.rs b/core/lib/vm_interface/src/types/inputs/l2_block.rs similarity index 100% rename from core/lib/multivm/src/interface/types/inputs/l2_block.rs rename to core/lib/vm_interface/src/types/inputs/l2_block.rs diff --git a/core/lib/multivm/src/interface/types/inputs/mod.rs b/core/lib/vm_interface/src/types/inputs/mod.rs similarity index 100% rename from core/lib/multivm/src/interface/types/inputs/mod.rs rename to core/lib/vm_interface/src/types/inputs/mod.rs diff --git a/core/lib/multivm/src/interface/types/inputs/system_env.rs b/core/lib/vm_interface/src/types/inputs/system_env.rs similarity index 100% rename from core/lib/multivm/src/interface/types/inputs/system_env.rs rename to core/lib/vm_interface/src/types/inputs/system_env.rs diff --git a/core/lib/multivm/src/interface/types/mod.rs b/core/lib/vm_interface/src/types/mod.rs similarity index 100% rename from core/lib/multivm/src/interface/types/mod.rs rename to core/lib/vm_interface/src/types/mod.rs diff --git a/core/lib/multivm/src/interface/types/outputs/execution_result.rs b/core/lib/vm_interface/src/types/outputs/execution_result.rs similarity index 100% rename from core/lib/multivm/src/interface/types/outputs/execution_result.rs rename to core/lib/vm_interface/src/types/outputs/execution_result.rs diff --git a/core/lib/multivm/src/interface/types/outputs/execution_state.rs b/core/lib/vm_interface/src/types/outputs/execution_state.rs similarity index 100% rename from core/lib/multivm/src/interface/types/outputs/execution_state.rs rename to core/lib/vm_interface/src/types/outputs/execution_state.rs diff --git a/core/lib/multivm/src/interface/types/outputs/finished_l1batch.rs b/core/lib/vm_interface/src/types/outputs/finished_l1batch.rs similarity index 100% rename from core/lib/multivm/src/interface/types/outputs/finished_l1batch.rs rename to core/lib/vm_interface/src/types/outputs/finished_l1batch.rs diff --git a/core/lib/multivm/src/interface/types/outputs/l2_block.rs b/core/lib/vm_interface/src/types/outputs/l2_block.rs similarity index 100% rename from core/lib/multivm/src/interface/types/outputs/l2_block.rs rename to core/lib/vm_interface/src/types/outputs/l2_block.rs diff --git a/core/lib/multivm/src/interface/types/outputs/mod.rs b/core/lib/vm_interface/src/types/outputs/mod.rs similarity index 100% rename from core/lib/multivm/src/interface/types/outputs/mod.rs rename to core/lib/vm_interface/src/types/outputs/mod.rs diff --git a/core/lib/multivm/src/interface/types/outputs/statistic.rs b/core/lib/vm_interface/src/types/outputs/statistic.rs similarity index 100% rename from core/lib/multivm/src/interface/types/outputs/statistic.rs rename to core/lib/vm_interface/src/types/outputs/statistic.rs diff --git a/core/lib/multivm/src/interface/types/tracer.rs b/core/lib/vm_interface/src/types/tracer.rs similarity index 100% rename from core/lib/multivm/src/interface/types/tracer.rs rename to core/lib/vm_interface/src/types/tracer.rs From 6393e7d73381e0d231684a59506858a91a6532ae Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 12:29:39 +0300 Subject: [PATCH 03/17] Brush up interface types --- Cargo.lock | 12 ++++++++++-- core/lib/multivm/Cargo.toml | 5 ++--- core/lib/vm_interface/Cargo.toml | 10 +++++++++- core/lib/vm_interface/src/lib.rs | 2 +- .../src/types/errors/bootloader_error.rs | 2 +- core/lib/vm_interface/src/types/errors/halt.rs | 6 +++--- core/lib/vm_interface/src/types/errors/mod.rs | 14 +++++++++----- .../src/types/errors/tx_revert_reason.rs | 6 +++--- .../src/types/errors/vm_revert_reason.rs | 8 ++++---- core/lib/vm_interface/src/types/inputs/mod.rs | 18 ++++++++++-------- core/lib/vm_interface/src/types/mod.rs | 2 +- .../src/types/outputs/execution_result.rs | 9 ++++++--- core/lib/vm_interface/src/types/tracer.rs | 2 +- 13 files changed, 60 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 878a78d126ab..1be54fdbb261 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8927,7 +8927,6 @@ dependencies = [ "itertools 0.10.5", "once_cell", "pretty_assertions", - "serde", "thiserror", "tokio", "tracing", @@ -8945,6 +8944,7 @@ dependencies = [ "zksync_test_account", "zksync_types", "zksync_utils", + "zksync_vm_interface", ] [[package]] @@ -9757,8 +9757,16 @@ dependencies = [ ] [[package]] -name = "zksync_vm_interfaces" +name = "zksync_vm_interface" version = "0.1.0" +dependencies = [ + "hex", + "serde", + "thiserror", + "zksync_contracts", + "zksync_system_constants", + "zksync_types", +] [[package]] name = "zksync_vm_runner" diff --git a/core/lib/multivm/Cargo.toml b/core/lib/multivm/Cargo.toml index fc35f152ae19..eb2b60433aa5 100644 --- a/core/lib/multivm/Cargo.toml +++ b/core/lib/multivm/Cargo.toml @@ -10,7 +10,7 @@ license.workspace = true keywords.workspace = true categories.workspace = true -[dependencies] +[dependencies] # FIXME: revise zk_evm_1_5_0.workspace = true zk_evm_1_4_1.workspace = true zk_evm_1_4_0.workspace = true @@ -29,14 +29,13 @@ zksync_state.workspace = true zksync_contracts.workspace = true zksync_utils.workspace = true zksync_system_constants.workspace = true - +zksync_vm_interface.workspace = true anyhow.workspace = true hex.workspace = true itertools.workspace = true once_cell.workspace = true pretty_assertions.workspace = true -serde.workspace = true thiserror.workspace = true tracing.workspace = true vise.workspace = true diff --git a/core/lib/vm_interface/Cargo.toml b/core/lib/vm_interface/Cargo.toml index 7c32b973c9be..c1f3a3db4b4f 100644 --- a/core/lib/vm_interface/Cargo.toml +++ b/core/lib/vm_interface/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "zksync_vm_interfaces" +name = "zksync_vm_interface" description = "ZKsync Era VM interfaces" version.workspace = true edition.workspace = true @@ -10,3 +10,11 @@ license.workspace = true keywords.workspace = true categories.workspace = true +[dependencies] +zksync_contracts.workspace = true +zksync_system_constants.workspace = true +zksync_types.workspace = true # FIXME: move VM-related types? (e.g., VM events, circuit stats) + +hex.workspace = true +serde.workspace = true +thiserror.workspace = true diff --git a/core/lib/vm_interface/src/lib.rs b/core/lib/vm_interface/src/lib.rs index c9e7d21cc4cc..96d4b53dcb9b 100644 --- a/core/lib/vm_interface/src/lib.rs +++ b/core/lib/vm_interface/src/lib.rs @@ -7,7 +7,7 @@ pub use crate::types::{ inputs::{L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode}, outputs::{ BootloaderMemory, CurrentExecutionState, ExecutionResult, FinishedL1Batch, L2Block, - Refunds, VmExecutionResultAndLogs, VmExecutionStatistics, VmMemoryMetrics, + Refunds, VmExecutionLogs, VmExecutionResultAndLogs, VmExecutionStatistics, VmMemoryMetrics, }, tracer, }; diff --git a/core/lib/vm_interface/src/types/errors/bootloader_error.rs b/core/lib/vm_interface/src/types/errors/bootloader_error.rs index 0f0e14408669..914a598a1577 100644 --- a/core/lib/vm_interface/src/types/errors/bootloader_error.rs +++ b/core/lib/vm_interface/src/types/errors/bootloader_error.rs @@ -1,6 +1,6 @@ /// Error codes returned by the bootloader. #[derive(Debug)] -pub(crate) enum BootloaderErrorCode { +pub enum BootloaderErrorCode { EthCall, AccountTxValidationFailed, FailedToChargeFee, diff --git a/core/lib/vm_interface/src/types/errors/halt.rs b/core/lib/vm_interface/src/types/errors/halt.rs index 70de7548f14e..88328e42b812 100644 --- a/core/lib/vm_interface/src/types/errors/halt.rs +++ b/core/lib/vm_interface/src/types/errors/halt.rs @@ -1,4 +1,4 @@ -use std::fmt::{Display, Formatter}; +use std::fmt; use super::VmRevertReason; @@ -44,8 +44,8 @@ pub enum Halt { FailedToPublishCompressedBytecodes, } -impl Display for Halt { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { +impl fmt::Display for Halt { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Halt::ValidationFailed(reason) => { write!(f, "Account validation error: {}", reason) diff --git a/core/lib/vm_interface/src/types/errors/mod.rs b/core/lib/vm_interface/src/types/errors/mod.rs index 43aecf796013..95cfab435157 100644 --- a/core/lib/vm_interface/src/types/errors/mod.rs +++ b/core/lib/vm_interface/src/types/errors/mod.rs @@ -1,11 +1,15 @@ -pub(crate) use bootloader_error::BootloaderErrorCode; -pub use bytecode_compression::BytecodeCompressionError; -pub use halt::Halt; -pub use tx_revert_reason::TxRevertReason; -pub use vm_revert_reason::{VmRevertReason, VmRevertReasonParsingError}; +pub use self::{ + bootloader_error::BootloaderErrorCode, + bytecode_compression::BytecodeCompressionError, + halt::Halt, + tx_revert_reason::TxRevertReason, + vm_revert_reason::{VmRevertReason, VmRevertReasonParsingError}, +}; mod bootloader_error; mod bytecode_compression; mod halt; mod tx_revert_reason; mod vm_revert_reason; + +// FIXME: make errors non-exhaustive? diff --git a/core/lib/vm_interface/src/types/errors/tx_revert_reason.rs b/core/lib/vm_interface/src/types/errors/tx_revert_reason.rs index d863e387e019..9660c898f4a3 100644 --- a/core/lib/vm_interface/src/types/errors/tx_revert_reason.rs +++ b/core/lib/vm_interface/src/types/errors/tx_revert_reason.rs @@ -1,4 +1,4 @@ -use std::fmt::Display; +use std::fmt; use super::{halt::Halt, BootloaderErrorCode, VmRevertReason}; @@ -135,8 +135,8 @@ impl TxRevertReason { } } -impl Display for TxRevertReason { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl fmt::Display for TxRevertReason { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match &self { TxRevertReason::TxReverted(reason) => write!(f, "{}", reason), TxRevertReason::Halt(reason) => write!(f, "{}", reason), diff --git a/core/lib/vm_interface/src/types/errors/vm_revert_reason.rs b/core/lib/vm_interface/src/types/errors/vm_revert_reason.rs index 6b211d543a92..31b68ada2e84 100644 --- a/core/lib/vm_interface/src/types/errors/vm_revert_reason.rs +++ b/core/lib/vm_interface/src/types/errors/vm_revert_reason.rs @@ -1,4 +1,4 @@ -use std::fmt::{Debug, Display}; +use std::fmt; use zksync_types::U256; @@ -29,6 +29,7 @@ pub enum VmRevertReason { impl VmRevertReason { const GENERAL_ERROR_SELECTOR: &'static [u8] = &[0x08, 0xc3, 0x79, 0xa0]; + fn parse_general_error(raw_bytes: &[u8]) -> Result { let bytes = &raw_bytes[4..]; if bytes.len() < 32 { @@ -111,7 +112,6 @@ impl VmRevertReason { function_selector: function_selector.to_vec(), data: bytes.to_vec(), }; - tracing::debug!("Unsupported error type: {}", result); Ok(result) } } @@ -144,8 +144,8 @@ impl From<&[u8]> for VmRevertReason { } } -impl Display for VmRevertReason { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl fmt::Display for VmRevertReason { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use VmRevertReason::{General, InnerTxError, Unknown, VmError}; match self { diff --git a/core/lib/vm_interface/src/types/inputs/mod.rs b/core/lib/vm_interface/src/types/inputs/mod.rs index f88d40def4bf..1d2c49cdfa11 100644 --- a/core/lib/vm_interface/src/types/inputs/mod.rs +++ b/core/lib/vm_interface/src/types/inputs/mod.rs @@ -1,9 +1,11 @@ -pub use execution_mode::VmExecutionMode; -pub use l1_batch_env::L1BatchEnv; -pub use l2_block::L2BlockEnv; -pub use system_env::{SystemEnv, TxExecutionMode}; +pub use self::{ + execution_mode::VmExecutionMode, + l1_batch_env::L1BatchEnv, + l2_block::L2BlockEnv, + system_env::{SystemEnv, TxExecutionMode}, +}; -pub(crate) mod execution_mode; -pub(crate) mod l1_batch_env; -pub(crate) mod l2_block; -pub(crate) mod system_env; +mod execution_mode; +mod l1_batch_env; +mod l2_block; +mod system_env; diff --git a/core/lib/vm_interface/src/types/mod.rs b/core/lib/vm_interface/src/types/mod.rs index a70d0a59ead7..6d874f75efe6 100644 --- a/core/lib/vm_interface/src/types/mod.rs +++ b/core/lib/vm_interface/src/types/mod.rs @@ -1,4 +1,4 @@ -pub mod errors; +pub(crate) mod errors; pub(crate) mod inputs; pub(crate) mod outputs; pub mod tracer; diff --git a/core/lib/vm_interface/src/types/outputs/execution_result.rs b/core/lib/vm_interface/src/types/outputs/execution_result.rs index 35d14524e0a8..1037cc1d6e8e 100644 --- a/core/lib/vm_interface/src/types/outputs/execution_result.rs +++ b/core/lib/vm_interface/src/types/outputs/execution_result.rs @@ -3,11 +3,14 @@ use zksync_types::{ event::{extract_long_l2_to_l1_messages, extract_published_bytecodes}, l2_to_l1_log::{SystemL2ToL1Log, UserL2ToL1Log}, tx::ExecutionMetrics, - StorageLogWithPreviousValue, Transaction, VmEvent, + StorageLogWithPreviousValue, Transaction, VmEvent, H256, }; -use zksync_utils::bytecode::bytecode_len_in_bytes; -use crate::interface::{Halt, VmExecutionStatistics, VmRevertReason}; +use crate::{Halt, VmExecutionStatistics, VmRevertReason}; + +pub fn bytecode_len_in_bytes(bytecodehash: H256) -> usize { + usize::from(u16::from_be_bytes([bytecodehash[2], bytecodehash[3]])) * 32 +} /// Refunds produced for the user. #[derive(Debug, Clone, Default, PartialEq)] diff --git a/core/lib/vm_interface/src/types/tracer.rs b/core/lib/vm_interface/src/types/tracer.rs index 4221eddaf7a7..1b42b2eabbb3 100644 --- a/core/lib/vm_interface/src/types/tracer.rs +++ b/core/lib/vm_interface/src/types/tracer.rs @@ -1,4 +1,4 @@ -use crate::interface::Halt; +use crate::Halt; #[derive(Debug, Clone, PartialEq)] pub enum TracerExecutionStopReason { From be8cb95bc8ff2087e2a3f18bade8ec4e318e8fde Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 12:42:19 +0300 Subject: [PATCH 04/17] Update interface type uses --- .../lib/multivm/src/glue/types/vm/vm_block_result.rs | 4 ++-- core/lib/multivm/src/interface/mod.rs | 4 +++- core/lib/multivm/src/interface/traits/vm.rs | 8 ++------ .../multivm/src/tracers/validator/vm_1_4_1/mod.rs | 2 +- .../multivm/src/tracers/validator/vm_1_4_2/mod.rs | 2 +- .../tracers/validator/vm_boojum_integration/mod.rs | 2 +- .../multivm/src/tracers/validator/vm_latest/mod.rs | 2 +- .../tracers/validator/vm_refunds_enhancement/mod.rs | 2 +- core/lib/multivm/src/utils.rs | 2 +- .../lib/multivm/src/versions/vm_1_3_2/vm_instance.rs | 2 +- .../src/versions/vm_1_3_2/vm_with_bootloader.rs | 2 +- .../versions/vm_1_4_1/implementation/execution.rs | 2 +- .../src/versions/vm_1_4_1/implementation/logs.rs | 2 +- core/lib/multivm/src/versions/vm_1_4_1/mod.rs | 7 ------- .../src/versions/vm_1_4_1/tracers/default_tracers.rs | 3 +-- .../src/versions/vm_1_4_1/tracers/pubdata_tracer.rs | 3 +-- .../multivm/src/versions/vm_1_4_1/tracers/refunds.rs | 2 +- .../src/versions/vm_1_4_1/tracers/result_tracer.rs | 6 +++--- core/lib/multivm/src/versions/vm_1_4_1/utils/fee.rs | 2 +- .../versions/vm_1_4_2/implementation/execution.rs | 2 +- .../src/versions/vm_1_4_2/implementation/logs.rs | 2 +- core/lib/multivm/src/versions/vm_1_4_2/mod.rs | 7 ------- .../src/versions/vm_1_4_2/tracers/default_tracers.rs | 3 +-- .../src/versions/vm_1_4_2/tracers/pubdata_tracer.rs | 3 +-- .../multivm/src/versions/vm_1_4_2/tracers/refunds.rs | 2 +- .../src/versions/vm_1_4_2/tracers/result_tracer.rs | 6 +++--- core/lib/multivm/src/versions/vm_1_4_2/utils/fee.rs | 2 +- .../implementation/execution.rs | 2 +- .../vm_boojum_integration/implementation/logs.rs | 2 +- .../src/versions/vm_boojum_integration/mod.rs | 7 ------- .../vm_boojum_integration/tracers/default_tracers.rs | 3 +-- .../vm_boojum_integration/tracers/pubdata_tracer.rs | 3 +-- .../vm_boojum_integration/tracers/refunds.rs | 2 +- .../vm_boojum_integration/tracers/result_tracer.rs | 6 +++--- .../src/versions/vm_boojum_integration/utils/fee.rs | 2 +- core/lib/multivm/src/versions/vm_fast/refund.rs | 2 +- .../multivm/src/versions/vm_fast/tests/sekp256r1.rs | 3 +-- core/lib/multivm/src/versions/vm_fast/vm.rs | 12 ++++++------ .../versions/vm_latest/implementation/execution.rs | 2 +- .../src/versions/vm_latest/implementation/logs.rs | 2 +- core/lib/multivm/src/versions/vm_latest/mod.rs | 7 ------- .../src/versions/vm_latest/tests/block_tip.rs | 4 ++-- .../src/versions/vm_latest/tests/sekp256r1.rs | 4 ++-- .../versions/vm_latest/tracers/default_tracers.rs | 3 +-- .../src/versions/vm_latest/tracers/pubdata_tracer.rs | 3 +-- .../src/versions/vm_latest/tracers/refunds.rs | 2 +- .../src/versions/vm_latest/tracers/result_tracer.rs | 6 +++--- core/lib/multivm/src/versions/vm_latest/utils/fee.rs | 2 +- core/lib/multivm/src/versions/vm_m5/vm_instance.rs | 2 +- .../multivm/src/versions/vm_m5/vm_with_bootloader.rs | 2 +- core/lib/multivm/src/versions/vm_m6/vm_instance.rs | 2 +- .../multivm/src/versions/vm_m6/vm_with_bootloader.rs | 2 +- .../vm_refunds_enhancement/implementation/logs.rs | 2 +- .../src/versions/vm_refunds_enhancement/utils/fee.rs | 2 +- .../vm_virtual_blocks/implementation/logs.rs | 2 +- .../src/versions/vm_virtual_blocks/utils/fee.rs | 2 +- core/node/api_server/src/web3/tests/vm.rs | 5 ++--- core/node/state_keeper/src/testonly/mod.rs | 9 +++------ core/node/state_keeper/src/tests/mod.rs | 4 ++-- core/node/vm_runner/src/storage.rs | 2 +- 60 files changed, 79 insertions(+), 122 deletions(-) diff --git a/core/lib/multivm/src/glue/types/vm/vm_block_result.rs b/core/lib/multivm/src/glue/types/vm/vm_block_result.rs index 2bf320aeb140..ce928e652d76 100644 --- a/core/lib/multivm/src/glue/types/vm/vm_block_result.rs +++ b/core/lib/multivm/src/glue/types/vm/vm_block_result.rs @@ -6,8 +6,8 @@ use zksync_types::l2_to_l1_log::UserL2ToL1Log; use crate::{ glue::{GlueFrom, GlueInto}, interface::{ - types::outputs::VmExecutionLogs, CurrentExecutionState, ExecutionResult, Refunds, - VmExecutionResultAndLogs, VmExecutionStatistics, + CurrentExecutionState, ExecutionResult, Refunds, VmExecutionLogs, VmExecutionResultAndLogs, + VmExecutionStatistics, }, }; diff --git a/core/lib/multivm/src/interface/mod.rs b/core/lib/multivm/src/interface/mod.rs index 8cc6ebacd2d2..2dc577e3a1ac 100644 --- a/core/lib/multivm/src/interface/mod.rs +++ b/core/lib/multivm/src/interface/mod.rs @@ -1,6 +1,8 @@ pub(crate) mod traits; +pub use zksync_vm_interface::*; + pub use self::traits::{ tracers::dyn_tracers, vm::{VmFactory, VmInterface, VmInterfaceHistoryEnabled}, -}; +}; // FIXME: re-export from root instead diff --git a/core/lib/multivm/src/interface/traits/vm.rs b/core/lib/multivm/src/interface/traits/vm.rs index 0fd41934cc61..736c00fd2d39 100644 --- a/core/lib/multivm/src/interface/traits/vm.rs +++ b/core/lib/multivm/src/interface/traits/vm.rs @@ -52,12 +52,8 @@ use zksync_types::Transaction; use zksync_utils::bytecode::CompressedBytecodeInfo; use crate::interface::{ - types::{ - errors::BytecodeCompressionError, - inputs::{L1BatchEnv, L2BlockEnv, SystemEnv, VmExecutionMode}, - outputs::{BootloaderMemory, CurrentExecutionState, VmExecutionResultAndLogs}, - }, - FinishedL1Batch, VmMemoryMetrics, + BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, FinishedL1Batch, L1BatchEnv, + L2BlockEnv, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmMemoryMetrics, }; pub trait VmInterface { diff --git a/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs b/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs index 81d885fa788e..ffbe0e6e51d1 100644 --- a/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs @@ -11,8 +11,8 @@ use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h25 use crate::{ interface::{ + tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, - types::tracer::{TracerExecutionStatus, TracerExecutionStopReason}, Halt, }, tracers::validator::{ diff --git a/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs b/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs index 657b621c2c4a..548677fff4db 100644 --- a/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs @@ -11,8 +11,8 @@ use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h25 use crate::{ interface::{ + tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, - types::tracer::{TracerExecutionStatus, TracerExecutionStopReason}, Halt, }, tracers::validator::{ diff --git a/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs b/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs index 2c9a708abcaa..058f63e7b9fc 100644 --- a/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs @@ -11,8 +11,8 @@ use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h25 use crate::{ interface::{ + tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, - types::tracer::{TracerExecutionStatus, TracerExecutionStopReason}, Halt, }, tracers::validator::{ diff --git a/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs b/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs index 3cd4e88a409c..1e90e247d4a3 100644 --- a/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs @@ -11,8 +11,8 @@ use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h25 use crate::{ interface::{ + tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, - types::tracer::{TracerExecutionStatus, TracerExecutionStopReason}, Halt, }, tracers::validator::{ diff --git a/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs b/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs index ab3a16c4b901..0ef8011fc948 100644 --- a/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs @@ -11,8 +11,8 @@ use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h25 use crate::{ interface::{ + tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_3_3::DynTracer, - types::tracer::{TracerExecutionStatus, TracerExecutionStopReason}, Halt, }, tracers::validator::{ diff --git a/core/lib/multivm/src/utils.rs b/core/lib/multivm/src/utils.rs index 96ae580a5f73..4ea613252d0b 100644 --- a/core/lib/multivm/src/utils.rs +++ b/core/lib/multivm/src/utils.rs @@ -4,7 +4,7 @@ use zksync_types::{ U256, }; -use crate::vm_latest::L1BatchEnv; +use crate::interface::L1BatchEnv; /// Calculates the base fee and gas per pubdata for the given L1 gas price. pub fn derive_base_fee_and_gas_per_pubdata( diff --git a/core/lib/multivm/src/versions/vm_1_3_2/vm_instance.rs b/core/lib/multivm/src/versions/vm_1_3_2/vm_instance.rs index 1a33f5cb7bb3..4cfd080ab7e0 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/vm_instance.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/vm_instance.rs @@ -20,7 +20,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::types::outputs::VmExecutionLogs, + interface::VmExecutionLogs, vm_1_3_2::{ bootloader_state::BootloaderState, errors::{TxRevertReason, VmRevertReason, VmRevertReasonParsingResult}, diff --git a/core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs b/core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs index 9e4eaf4a1a5b..39a4bbdea15f 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs @@ -27,6 +27,7 @@ use zksync_utils::{ }; use crate::{ + interface::L1BatchEnv, vm_1_3_2::{ bootloader_state::BootloaderState, history_recorder::HistoryMode, @@ -37,7 +38,6 @@ use crate::{ vm_instance::ZkSyncVmState, OracleTools, VmInstance, }, - vm_latest::L1BatchEnv, }; // TODO (SMA-1703): move these to config and make them programmatically generable. diff --git a/core/lib/multivm/src/versions/vm_1_4_1/implementation/execution.rs b/core/lib/multivm/src/versions/vm_1_4_1/implementation/execution.rs index 2378bb905d4a..2bb57041e55f 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/implementation/execution.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/implementation/execution.rs @@ -3,7 +3,7 @@ use zksync_state::WriteStorage; use crate::{ interface::{ - types::tracer::{TracerExecutionStatus, VmExecutionStopReason}, + tracer::{TracerExecutionStatus, VmExecutionStopReason}, VmExecutionMode, VmExecutionResultAndLogs, VmInterface, }, vm_1_4_1::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_1/implementation/logs.rs b/core/lib/multivm/src/versions/vm_1_4_1/implementation/logs.rs index fb1b6f3625db..c61c5c38cf99 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/implementation/logs.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/implementation/logs.rs @@ -8,7 +8,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::types::outputs::VmExecutionLogs, + interface::VmExecutionLogs, vm_1_4_1::{old_vm::utils::precompile_calls_count_after_timestamp, utils::logs, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_1_4_1/mod.rs b/core/lib/multivm/src/versions/vm_1_4_1/mod.rs index 83693e4b24e9..81267701b5cd 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/mod.rs @@ -15,13 +15,6 @@ pub use self::{ utils::transaction_encoding::TransactionVmExt, vm::Vm, }; -pub use crate::interface::types::{ - inputs::{L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode}, - outputs::{ - BootloaderMemory, CurrentExecutionState, ExecutionResult, FinishedL1Batch, L2Block, - Refunds, VmExecutionLogs, VmExecutionResultAndLogs, VmExecutionStatistics, VmMemoryMetrics, - }, -}; mod bootloader_state; pub mod constants; diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs index 05da8f60248a..1e495e07f8cc 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs @@ -18,9 +18,8 @@ use super::PubdataTracer; use crate::{ glue::GlueInto, interface::{ - tracer::{TracerExecutionStopReason, VmExecutionStopReason}, + tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, - types::tracer::TracerExecutionStatus, Halt, VmExecutionMode, }, vm_1_4_1::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs index e4e6c1dd4936..3a967f69dd16 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs @@ -20,8 +20,7 @@ use crate::{ interface::{ dyn_tracers::vm_1_4_1::DynTracer, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, - types::inputs::L1BatchEnv, - VmExecutionMode, + L1BatchEnv, VmExecutionMode, }, vm_1_4_1::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs index bfb06deb28a4..815463052cbe 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs @@ -18,7 +18,7 @@ use zksync_utils::{bytecode::bytecode_len_in_bytes, ceil_div_u256, u256_to_h256} use crate::{ interface::{ - traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, types::tracer::TracerExecutionStatus, + tracer::TracerExecutionStatus, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, L1BatchEnv, Refunds, }, vm_1_4_1::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs index a0090393b889..80204620fd0d 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs @@ -10,9 +10,9 @@ use zksync_types::U256; use crate::{ interface::{ - tracer::VmExecutionStopReason, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, - types::tracer::TracerExecutionStopReason, ExecutionResult, Halt, TxRevertReason, - VmExecutionMode, VmRevertReason, + tracer::{TracerExecutionStopReason, VmExecutionStopReason}, + traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, + ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, vm_1_4_1::{ constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/utils/fee.rs b/core/lib/multivm/src/versions/vm_1_4_1/utils/fee.rs index 6498a86d3536..b5d4cc971b9e 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/utils/fee.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/utils/fee.rs @@ -2,7 +2,7 @@ use zksync_types::fee_model::PubdataIndependentBatchFeeModelInput; use zksync_utils::ceil_div; -use crate::vm_1_4_1::{constants::MAX_GAS_PER_PUBDATA_BYTE, L1BatchEnv}; +use crate::{interface::L1BatchEnv, vm_1_4_1::constants::MAX_GAS_PER_PUBDATA_BYTE}; /// Calculates the base fee and gas per pubdata for the given L1 gas price. pub(crate) fn derive_base_fee_and_gas_per_pubdata( diff --git a/core/lib/multivm/src/versions/vm_1_4_2/implementation/execution.rs b/core/lib/multivm/src/versions/vm_1_4_2/implementation/execution.rs index 006d0ac12837..f81d5de9e5ed 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/implementation/execution.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/implementation/execution.rs @@ -3,7 +3,7 @@ use zksync_state::WriteStorage; use crate::{ interface::{ - types::tracer::{TracerExecutionStatus, VmExecutionStopReason}, + tracer::{TracerExecutionStatus, VmExecutionStopReason}, VmExecutionMode, VmExecutionResultAndLogs, VmInterface, }, vm_1_4_2::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_2/implementation/logs.rs b/core/lib/multivm/src/versions/vm_1_4_2/implementation/logs.rs index c307b7aa8099..73c0b8c428f8 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/implementation/logs.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/implementation/logs.rs @@ -8,7 +8,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::types::outputs::VmExecutionLogs, + interface::VmExecutionLogs, vm_1_4_2::{old_vm::utils::precompile_calls_count_after_timestamp, utils::logs, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_1_4_2/mod.rs b/core/lib/multivm/src/versions/vm_1_4_2/mod.rs index c23fc7076b29..40d720379b72 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/mod.rs @@ -15,13 +15,6 @@ pub use self::{ utils::transaction_encoding::TransactionVmExt, vm::Vm, }; -pub use crate::interface::types::{ - inputs::{L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode}, - outputs::{ - BootloaderMemory, CurrentExecutionState, ExecutionResult, FinishedL1Batch, L2Block, - Refunds, VmExecutionLogs, VmExecutionResultAndLogs, VmExecutionStatistics, VmMemoryMetrics, - }, -}; mod bootloader_state; pub mod constants; diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs index dbf02d0d8d60..1b225b35f52d 100755 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs @@ -18,9 +18,8 @@ use super::PubdataTracer; use crate::{ glue::GlueInto, interface::{ - tracer::{TracerExecutionStopReason, VmExecutionStopReason}, + tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, - types::tracer::TracerExecutionStatus, Halt, VmExecutionMode, }, vm_1_4_2::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs index 579213be248a..f22e323cbbac 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs @@ -20,8 +20,7 @@ use crate::{ interface::{ dyn_tracers::vm_1_4_1::DynTracer, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, - types::inputs::L1BatchEnv, - VmExecutionMode, + L1BatchEnv, VmExecutionMode, }, vm_1_4_2::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs index 503aad00c68e..82f2bba02731 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs @@ -18,7 +18,7 @@ use zksync_utils::{bytecode::bytecode_len_in_bytes, ceil_div_u256, u256_to_h256} use crate::{ interface::{ - traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, types::tracer::TracerExecutionStatus, + tracer::TracerExecutionStatus, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, L1BatchEnv, Refunds, }, vm_1_4_2::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs index 775ed69838cb..32b890389d27 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs @@ -10,9 +10,9 @@ use zksync_types::U256; use crate::{ interface::{ - tracer::VmExecutionStopReason, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, - types::tracer::TracerExecutionStopReason, ExecutionResult, Halt, TxRevertReason, - VmExecutionMode, VmRevertReason, + tracer::{TracerExecutionStopReason, VmExecutionStopReason}, + traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, + ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, vm_1_4_2::{ constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/utils/fee.rs b/core/lib/multivm/src/versions/vm_1_4_2/utils/fee.rs index 02d1a3737cec..11f8b6b6c427 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/utils/fee.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/utils/fee.rs @@ -2,7 +2,7 @@ use zksync_types::fee_model::PubdataIndependentBatchFeeModelInput; use zksync_utils::ceil_div; -use crate::vm_1_4_2::{constants::MAX_GAS_PER_PUBDATA_BYTE, L1BatchEnv}; +use crate::{interface::L1BatchEnv, vm_1_4_2::constants::MAX_GAS_PER_PUBDATA_BYTE}; /// Calculates the base fee and gas per pubdata for the given L1 gas price. pub(crate) fn derive_base_fee_and_gas_per_pubdata( diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/execution.rs b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/execution.rs index 22f2a50efde3..085b42c84dbd 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/execution.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/execution.rs @@ -3,7 +3,7 @@ use zksync_state::WriteStorage; use crate::{ interface::{ - types::tracer::{TracerExecutionStatus, VmExecutionStopReason}, + tracer::{TracerExecutionStatus, VmExecutionStopReason}, VmExecutionMode, VmExecutionResultAndLogs, VmInterface, }, vm_boojum_integration::{ diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/logs.rs b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/logs.rs index daf077fcca51..b9f354f835e1 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/logs.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/logs.rs @@ -8,7 +8,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::types::outputs::VmExecutionLogs, + interface::VmExecutionLogs, vm_boojum_integration::{ old_vm::utils::precompile_calls_count_after_timestamp, utils::logs, vm::Vm, }, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/mod.rs b/core/lib/multivm/src/versions/vm_boojum_integration/mod.rs index 83693e4b24e9..81267701b5cd 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/mod.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/mod.rs @@ -15,13 +15,6 @@ pub use self::{ utils::transaction_encoding::TransactionVmExt, vm::Vm, }; -pub use crate::interface::types::{ - inputs::{L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode}, - outputs::{ - BootloaderMemory, CurrentExecutionState, ExecutionResult, FinishedL1Batch, L2Block, - Refunds, VmExecutionLogs, VmExecutionResultAndLogs, VmExecutionStatistics, VmMemoryMetrics, - }, -}; mod bootloader_state; pub mod constants; diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs index 01b21d809509..abe14a184e78 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs @@ -17,9 +17,8 @@ use zksync_state::{StoragePtr, WriteStorage}; use super::PubdataTracer; use crate::{ interface::{ - tracer::{TracerExecutionStopReason, VmExecutionStopReason}, + tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, - types::tracer::TracerExecutionStatus, Halt, VmExecutionMode, }, vm_boojum_integration::{ diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs index c74f4f4bd16d..20ae7ca965c7 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs @@ -20,8 +20,7 @@ use crate::{ interface::{ dyn_tracers::vm_1_4_0::DynTracer, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, - types::inputs::L1BatchEnv, - VmExecutionMode, + L1BatchEnv, VmExecutionMode, }, vm_boojum_integration::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs index c23ddf47acd4..ed6dc79986e9 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs @@ -17,7 +17,7 @@ use zksync_utils::{bytecode::bytecode_len_in_bytes, ceil_div_u256, u256_to_h256} use crate::{ interface::{ - traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, types::tracer::TracerExecutionStatus, + tracer::TracerExecutionStatus, traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, L1BatchEnv, Refunds, }, vm_boojum_integration::{ diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs index 2293273228b1..11b77bd5b0a8 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs @@ -10,9 +10,9 @@ use zksync_types::U256; use crate::{ interface::{ - tracer::VmExecutionStopReason, traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, - types::tracer::TracerExecutionStopReason, ExecutionResult, Halt, TxRevertReason, - VmExecutionMode, VmRevertReason, + tracer::{TracerExecutionStopReason, VmExecutionStopReason}, + traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, + ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, vm_boojum_integration::{ constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/utils/fee.rs b/core/lib/multivm/src/versions/vm_boojum_integration/utils/fee.rs index 55c7d0894598..8e785775697a 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/utils/fee.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/utils/fee.rs @@ -3,10 +3,10 @@ use zksync_types::fee_model::L1PeggedBatchFeeModelInput; use zksync_utils::ceil_div; use crate::{ + interface::L1BatchEnv, vm_boojum_integration::{ constants::MAX_GAS_PER_PUBDATA_BYTE, old_vm::utils::eth_price_per_pubdata_byte, }, - vm_latest::L1BatchEnv, }; /// Calculates the amount of gas required to publish one byte of pubdata diff --git a/core/lib/multivm/src/versions/vm_fast/refund.rs b/core/lib/multivm/src/versions/vm_fast/refund.rs index 524a6ca4c3bc..05648acddcfe 100644 --- a/core/lib/multivm/src/versions/vm_fast/refund.rs +++ b/core/lib/multivm/src/versions/vm_fast/refund.rs @@ -1,7 +1,7 @@ use zksync_types::{H256, U256}; use zksync_utils::ceil_div_u256; -use crate::vm_latest::{utils::fee::get_batch_base_fee, L1BatchEnv}; +use crate::{interface::L1BatchEnv, vm_latest::utils::fee::get_batch_base_fee}; pub(crate) fn compute_refund( l1_batch: &L1BatchEnv, diff --git a/core/lib/multivm/src/versions/vm_fast/tests/sekp256r1.rs b/core/lib/multivm/src/versions/vm_fast/tests/sekp256r1.rs index 1e761b30ca62..76357d44cf38 100644 --- a/core/lib/multivm/src/versions/vm_fast/tests/sekp256r1.rs +++ b/core/lib/multivm/src/versions/vm_fast/tests/sekp256r1.rs @@ -4,9 +4,8 @@ use zksync_types::{web3::keccak256, Execute, H256, U256}; use zksync_utils::h256_to_u256; use crate::{ - interface::{TxExecutionMode, VmExecutionMode, VmInterface}, + interface::{ExecutionResult, TxExecutionMode, VmExecutionMode, VmInterface}, vm_fast::tests::tester::VmTesterBuilder, - vm_latest::ExecutionResult, }; #[test] diff --git a/core/lib/multivm/src/versions/vm_fast/vm.rs b/core/lib/multivm/src/versions/vm_fast/vm.rs index a4dad0b324de..db56d878702e 100644 --- a/core/lib/multivm/src/versions/vm_fast/vm.rs +++ b/core/lib/multivm/src/versions/vm_fast/vm.rs @@ -35,8 +35,10 @@ use super::{ use crate::{ glue::GlueInto, interface::{ - BytecodeCompressionError, Halt, TxRevertReason, VmInterface, VmInterfaceHistoryEnabled, - VmRevertReason, + BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, ExecutionResult, + FinishedL1Batch, Halt, L1BatchEnv, L2BlockEnv, Refunds, SystemEnv, TxRevertReason, + VmExecutionLogs, VmExecutionMode, VmExecutionResultAndLogs, VmExecutionStatistics, + VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, VmRevertReason, }, vm_fast::{ bootloader_state::utils::{apply_l2_block, apply_pubdata_to_memory}, @@ -49,9 +51,7 @@ use crate::{ get_vm_hook_params_start_position, get_vm_hook_position, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET, VM_HOOK_PARAMS_COUNT, }, - BootloaderMemory, CurrentExecutionState, ExecutionResult, FinishedL1Batch, L1BatchEnv, - L2BlockEnv, MultiVMSubversion, Refunds, SystemEnv, VmExecutionLogs, VmExecutionMode, - VmExecutionResultAndLogs, VmExecutionStatistics, + MultiVMSubversion, }, }; @@ -575,7 +575,7 @@ impl VmInterface for Vm { } } - fn record_vm_memory_metrics(&self) -> crate::vm_latest::VmMemoryMetrics { + fn record_vm_memory_metrics(&self) -> VmMemoryMetrics { todo!("Unused during batch execution") } diff --git a/core/lib/multivm/src/versions/vm_latest/implementation/execution.rs b/core/lib/multivm/src/versions/vm_latest/implementation/execution.rs index fe984f88acab..5a92a3211c76 100644 --- a/core/lib/multivm/src/versions/vm_latest/implementation/execution.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/execution.rs @@ -3,7 +3,7 @@ use zksync_state::WriteStorage; use crate::{ interface::{ - types::tracer::{TracerExecutionStatus, VmExecutionStopReason}, + tracer::{TracerExecutionStatus, VmExecutionStopReason}, VmExecutionMode, VmExecutionResultAndLogs, VmInterface, }, vm_latest::{ diff --git a/core/lib/multivm/src/versions/vm_latest/implementation/logs.rs b/core/lib/multivm/src/versions/vm_latest/implementation/logs.rs index b42ce16cd0f2..31ab9e1e3862 100644 --- a/core/lib/multivm/src/versions/vm_latest/implementation/logs.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/logs.rs @@ -8,7 +8,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::types::outputs::VmExecutionLogs, + interface::VmExecutionLogs, vm_latest::{old_vm::utils::precompile_calls_count_after_timestamp, utils::logs, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_latest/mod.rs b/core/lib/multivm/src/versions/vm_latest/mod.rs index 850215c77460..211c527c3816 100644 --- a/core/lib/multivm/src/versions/vm_latest/mod.rs +++ b/core/lib/multivm/src/versions/vm_latest/mod.rs @@ -16,13 +16,6 @@ pub use self::{ utils::transaction_encoding::TransactionVmExt, vm::Vm, }; -pub use crate::interface::types::{ - inputs::{L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode}, - outputs::{ - BootloaderMemory, CurrentExecutionState, ExecutionResult, FinishedL1Batch, L2Block, - Refunds, VmExecutionLogs, VmExecutionResultAndLogs, VmExecutionStatistics, VmMemoryMetrics, - }, -}; mod bootloader_state; pub mod constants; 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 78136602dae2..f1851eaae425 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 @@ -15,7 +15,7 @@ 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::{TxExecutionMode, VmExecutionMode, VmInterface}, + interface::{L1BatchEnv, TxExecutionMode, VmExecutionMode, VmInterface}, vm_latest::{ constants::{ BOOTLOADER_BATCH_TIP_CIRCUIT_STATISTICS_OVERHEAD, @@ -26,7 +26,7 @@ use crate::{ default_l1_batch, get_empty_storage, InMemoryStorageView, VmTesterBuilder, }, tracers::PubdataTracer, - HistoryEnabled, L1BatchEnv, TracerDispatcher, + HistoryEnabled, TracerDispatcher, }, }; diff --git a/core/lib/multivm/src/versions/vm_latest/tests/sekp256r1.rs b/core/lib/multivm/src/versions/vm_latest/tests/sekp256r1.rs index 07b25eb0a8b0..3cd50e0eb917 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/sekp256r1.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/sekp256r1.rs @@ -4,8 +4,8 @@ use zksync_types::{web3::keccak256, Execute, H256, U256}; use zksync_utils::h256_to_u256; use crate::{ - interface::{TxExecutionMode, VmExecutionMode, VmInterface}, - vm_latest::{tests::tester::VmTesterBuilder, ExecutionResult, HistoryEnabled}, + interface::{ExecutionResult, TxExecutionMode, VmExecutionMode, VmInterface}, + vm_latest::{tests::tester::VmTesterBuilder, HistoryEnabled}, }; #[test] diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs index 988abec7d156..df13930488b3 100755 --- a/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs @@ -19,8 +19,7 @@ use crate::{ glue::GlueInto, interface::{ dyn_tracers::vm_1_5_0::DynTracer, - tracer::{TracerExecutionStopReason, VmExecutionStopReason}, - types::tracer::TracerExecutionStatus, + tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, Halt, VmExecutionMode, }, vm_latest::{ diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs index ad6b4f238281..63a2fa43e78d 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs @@ -20,8 +20,7 @@ use crate::{ interface::{ dyn_tracers::vm_1_5_0::DynTracer, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, - types::inputs::L1BatchEnv, - VmExecutionMode, + L1BatchEnv, VmExecutionMode, }, vm_latest::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs index 9411b2782a49..f67ddc039bf9 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs @@ -11,7 +11,7 @@ use zksync_utils::ceil_div_u256; use crate::{ interface::{ - traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, types::tracer::TracerExecutionStatus, + tracer::TracerExecutionStatus, traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, L1BatchEnv, Refunds, }, vm_latest::{ diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs index a86210acabfc..8ad64a3d893d 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs @@ -11,9 +11,9 @@ use zksync_types::U256; use crate::{ interface::{ - tracer::VmExecutionStopReason, traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, - types::tracer::TracerExecutionStopReason, ExecutionResult, Halt, TxRevertReason, - VmExecutionMode, VmRevertReason, + tracer::{TracerExecutionStopReason, VmExecutionStopReason}, + traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, + ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, vm_latest::{ constants::{get_result_success_first_slot, BOOTLOADER_HEAP_PAGE}, diff --git a/core/lib/multivm/src/versions/vm_latest/utils/fee.rs b/core/lib/multivm/src/versions/vm_latest/utils/fee.rs index c17e585330c9..666fcca87e12 100644 --- a/core/lib/multivm/src/versions/vm_latest/utils/fee.rs +++ b/core/lib/multivm/src/versions/vm_latest/utils/fee.rs @@ -2,7 +2,7 @@ use zksync_types::fee_model::PubdataIndependentBatchFeeModelInput; use zksync_utils::ceil_div; -use crate::vm_latest::{constants::MAX_GAS_PER_PUBDATA_BYTE, L1BatchEnv}; +use crate::{interface::L1BatchEnv, vm_latest::constants::MAX_GAS_PER_PUBDATA_BYTE}; /// Calculates the base fee and gas per pubdata for the given L1 gas price. pub(crate) fn derive_base_fee_and_gas_per_pubdata( diff --git a/core/lib/multivm/src/versions/vm_m5/vm_instance.rs b/core/lib/multivm/src/versions/vm_m5/vm_instance.rs index 3f708f3470f2..93d42ad006e9 100644 --- a/core/lib/multivm/src/versions/vm_m5/vm_instance.rs +++ b/core/lib/multivm/src/versions/vm_m5/vm_instance.rs @@ -18,7 +18,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::types::outputs::VmExecutionLogs, + interface::VmExecutionLogs, vm_m5::{ bootloader_state::BootloaderState, errors::{TxRevertReason, VmRevertReason, VmRevertReasonParsingResult}, diff --git a/core/lib/multivm/src/versions/vm_m5/vm_with_bootloader.rs b/core/lib/multivm/src/versions/vm_m5/vm_with_bootloader.rs index dde97cdabdc0..cd2979db5e57 100644 --- a/core/lib/multivm/src/versions/vm_m5/vm_with_bootloader.rs +++ b/core/lib/multivm/src/versions/vm_m5/vm_with_bootloader.rs @@ -22,7 +22,7 @@ use zksync_utils::{ }; use crate::{ - vm_latest::L1BatchEnv, + interface::L1BatchEnv, vm_m5::{ bootloader_state::BootloaderState, oracles::OracleWithHistory, diff --git a/core/lib/multivm/src/versions/vm_m6/vm_instance.rs b/core/lib/multivm/src/versions/vm_m6/vm_instance.rs index e7c81dfb2865..a92e58e8e077 100644 --- a/core/lib/multivm/src/versions/vm_m6/vm_instance.rs +++ b/core/lib/multivm/src/versions/vm_m6/vm_instance.rs @@ -18,7 +18,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::types::outputs::VmExecutionLogs, + interface::VmExecutionLogs, vm_m6::{ bootloader_state::BootloaderState, errors::{TxRevertReason, VmRevertReason, VmRevertReasonParsingResult}, diff --git a/core/lib/multivm/src/versions/vm_m6/vm_with_bootloader.rs b/core/lib/multivm/src/versions/vm_m6/vm_with_bootloader.rs index c80eb7df840f..4409a7a89583 100644 --- a/core/lib/multivm/src/versions/vm_m6/vm_with_bootloader.rs +++ b/core/lib/multivm/src/versions/vm_m6/vm_with_bootloader.rs @@ -25,7 +25,7 @@ use zksync_utils::{ }; use crate::{ - vm_latest::L1BatchEnv, + interface::L1BatchEnv, vm_m6::{ bootloader_state::BootloaderState, history_recorder::HistoryMode, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/logs.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/logs.rs index dee06ee6180a..3880412942bd 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/logs.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/logs.rs @@ -7,7 +7,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::types::outputs::VmExecutionLogs, + interface::VmExecutionLogs, vm_refunds_enhancement::{ old_vm::{events::merge_events, utils::precompile_calls_count_after_timestamp}, vm::Vm, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/utils/fee.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/utils/fee.rs index a2fccb596309..f7203b57b4c4 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/utils/fee.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/utils/fee.rs @@ -3,7 +3,7 @@ use zksync_types::fee_model::L1PeggedBatchFeeModelInput; use zksync_utils::ceil_div; use crate::{ - vm_latest::L1BatchEnv, + interface::L1BatchEnv, vm_refunds_enhancement::{ constants::MAX_GAS_PER_PUBDATA_BYTE, old_vm::utils::eth_price_per_pubdata_byte, }, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/logs.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/logs.rs index 6c2b801c1d0f..ebcb4ad0cecc 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/logs.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/logs.rs @@ -7,7 +7,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::types::outputs::VmExecutionLogs, + interface::VmExecutionLogs, vm_virtual_blocks::{ old_vm::{events::merge_events, utils::precompile_calls_count_after_timestamp}, vm::Vm, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/utils/fee.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/utils/fee.rs index 14133553b04b..a53951a851e1 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/utils/fee.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/utils/fee.rs @@ -3,7 +3,7 @@ use zksync_types::fee_model::L1PeggedBatchFeeModelInput; use zksync_utils::ceil_div; use crate::{ - vm_latest::L1BatchEnv, + interface::L1BatchEnv, vm_virtual_blocks::{ constants::MAX_GAS_PER_PUBDATA_BYTE, old_vm::utils::eth_price_per_pubdata_byte, }, diff --git a/core/node/api_server/src/web3/tests/vm.rs b/core/node/api_server/src/web3/tests/vm.rs index 50de027174f3..f9629f6dab91 100644 --- a/core/node/api_server/src/web3/tests/vm.rs +++ b/core/node/api_server/src/web3/tests/vm.rs @@ -4,9 +4,8 @@ use std::sync::atomic::{AtomicU32, Ordering}; use api::state_override::{OverrideAccount, StateOverride}; use itertools::Itertools; -use zksync_multivm::{ - interface::{ExecutionResult, VmRevertReason}, - vm_latest::{VmExecutionLogs, VmExecutionResultAndLogs}, +use zksync_multivm::interface::{ + ExecutionResult, VmExecutionLogs, VmExecutionResultAndLogs, VmRevertReason, }; use zksync_types::{ api::{ApiStorageLog, Log}, diff --git a/core/node/state_keeper/src/testonly/mod.rs b/core/node/state_keeper/src/testonly/mod.rs index e47e1182699d..14785acbbfa8 100644 --- a/core/node/state_keeper/src/testonly/mod.rs +++ b/core/node/state_keeper/src/testonly/mod.rs @@ -5,12 +5,9 @@ use once_cell::sync::Lazy; use tokio::sync::mpsc; use zksync_contracts::BaseSystemContracts; use zksync_dal::{ConnectionPool, Core, CoreDal as _}; -use zksync_multivm::{ - interface::{ - CurrentExecutionState, ExecutionResult, FinishedL1Batch, L1BatchEnv, Refunds, SystemEnv, - VmExecutionResultAndLogs, VmExecutionStatistics, - }, - vm_latest::VmExecutionLogs, +use zksync_multivm::interface::{ + CurrentExecutionState, ExecutionResult, FinishedL1Batch, L1BatchEnv, Refunds, SystemEnv, + VmExecutionLogs, VmExecutionResultAndLogs, VmExecutionStatistics, }; use zksync_state::{OwnedStorage, StorageViewCache}; use zksync_test_account::Account; diff --git a/core/node/state_keeper/src/tests/mod.rs b/core/node/state_keeper/src/tests/mod.rs index 2d0af7dd281b..a5239f444832 100644 --- a/core/node/state_keeper/src/tests/mod.rs +++ b/core/node/state_keeper/src/tests/mod.rs @@ -11,9 +11,9 @@ use zksync_config::configs::chain::StateKeeperConfig; use zksync_multivm::{ interface::{ ExecutionResult, Halt, L1BatchEnv, L2BlockEnv, Refunds, SystemEnv, TxExecutionMode, - VmExecutionResultAndLogs, VmExecutionStatistics, + VmExecutionLogs, VmExecutionResultAndLogs, VmExecutionStatistics, }, - vm_latest::{constants::BATCH_COMPUTATIONAL_GAS_LIMIT, VmExecutionLogs}, + vm_latest::constants::BATCH_COMPUTATIONAL_GAS_LIMIT, }; use zksync_node_test_utils::create_l2_transaction; use zksync_types::{ diff --git a/core/node/vm_runner/src/storage.rs b/core/node/vm_runner/src/storage.rs index 1c83b6525c7b..b7518903cae3 100644 --- a/core/node/vm_runner/src/storage.rs +++ b/core/node/vm_runner/src/storage.rs @@ -9,7 +9,7 @@ use anyhow::Context as _; use async_trait::async_trait; use tokio::sync::{watch, RwLock}; use zksync_dal::{Connection, ConnectionPool, Core, CoreDal}; -use zksync_multivm::{interface::L1BatchEnv, vm_1_4_2::SystemEnv}; +use zksync_multivm::interface::{L1BatchEnv, SystemEnv}; use zksync_state::{ AsyncCatchupTask, BatchDiff, OwnedPostgresStorage, OwnedStorage, PgOrRocksdbStorage, RocksdbCell, RocksdbStorage, RocksdbStorageBuilder, RocksdbWithMemory, From ac1b6867fd43b3be25106925d1f56ca411f6a9df Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 13:38:57 +0300 Subject: [PATCH 05/17] Move VM storage traits --- core/lib/state/Cargo.toml | 1 + core/lib/state/src/lib.rs | 77 +------------------ core/lib/state/src/postgres/mod.rs | 6 +- core/lib/state/src/rocksdb/mod.rs | 14 +++- core/lib/state/src/shadow_storage.rs | 3 +- core/lib/state/src/storage_factory.rs | 5 +- core/lib/state/src/witness.rs | 3 +- core/lib/vm_interface/Cargo.toml | 1 + core/lib/vm_interface/src/lib.rs | 1 + .../src/storage}/in_memory.rs | 13 ++-- core/lib/vm_interface/src/storage/mod.rs | 75 ++++++++++++++++++ .../src/storage/view.rs} | 4 +- 12 files changed, 103 insertions(+), 100 deletions(-) rename core/lib/{state/src => vm_interface/src/storage}/in_memory.rs (95%) create mode 100644 core/lib/vm_interface/src/storage/mod.rs rename core/lib/{state/src/storage_view.rs => vm_interface/src/storage/view.rs} (99%) diff --git a/core/lib/state/Cargo.toml b/core/lib/state/Cargo.toml index 119bc800b800..dd56368f3d2e 100644 --- a/core/lib/state/Cargo.toml +++ b/core/lib/state/Cargo.toml @@ -17,6 +17,7 @@ zksync_types.workspace = true zksync_utils.workspace = true zksync_shared_metrics.workspace = true zksync_storage.workspace = true +zksync_vm_interface.workspace = true anyhow.workspace = true async-trait.workspace = true diff --git a/core/lib/state/src/lib.rs b/core/lib/state/src/lib.rs index 7041b9bc2a6f..30e94e8b52be 100644 --- a/core/lib/state/src/lib.rs +++ b/core/lib/state/src/lib.rs @@ -9,20 +9,11 @@ clippy::doc_markdown // frequent false positive: RocksDB )] -use std::{cell::RefCell, collections::HashMap, fmt, rc::Rc}; - -use zksync_types::{ - get_known_code_key, - storage::{StorageKey, StorageValue}, - H256, -}; +pub use zksync_vm_interface::storage as interface; pub use self::{ cache::sequential_cache::SequentialCache, catchup::{AsyncCatchupTask, RocksdbCell}, - // Note, that `test_infra` of the bootloader tests relies on this value to be exposed - in_memory::InMemoryStorage, - in_memory::IN_MEMORY_STORAGE_DEFAULT_NETWORK_ID, postgres::{PostgresStorage, PostgresStorageCaches, PostgresStorageCachesTask}, rocksdb::{ RocksdbStorage, RocksdbStorageBuilder, RocksdbStorageOptions, StateKeeperColumnFamily, @@ -32,81 +23,15 @@ pub use self::{ BatchDiff, OwnedPostgresStorage, OwnedStorage, PgOrRocksdbStorage, ReadStorageFactory, RocksdbWithMemory, }, - storage_view::{ImmutableStorageView, StorageView, StorageViewCache, StorageViewMetrics}, witness::WitnessStorage, }; mod cache; mod catchup; -mod in_memory; mod postgres; mod rocksdb; mod shadow_storage; mod storage_factory; -mod storage_view; #[cfg(test)] mod test_utils; mod witness; - -/// Functionality to read from the VM storage. -pub trait ReadStorage: fmt::Debug { - /// Read value of the key. - fn read_value(&mut self, key: &StorageKey) -> StorageValue; - - /// Checks whether a write to this storage at the specified `key` would be an initial write. - /// Roughly speaking, this is the case when the storage doesn't contain `key`, although - /// in case of mutable storage, the caveats apply (a write to a key that is present - /// in the storage but was not committed is still an initial write). - fn is_write_initial(&mut self, key: &StorageKey) -> bool; - - /// Load the factory dependency code by its hash. - fn load_factory_dep(&mut self, hash: H256) -> Option>; - - /// Returns whether a bytecode hash is "known" to the system. - fn is_bytecode_known(&mut self, bytecode_hash: &H256) -> bool { - let code_key = get_known_code_key(bytecode_hash); - self.read_value(&code_key) != H256::zero() - } - - /// Retrieves the enumeration index for a given `key`. - fn get_enumeration_index(&mut self, key: &StorageKey) -> Option; -} - -/// Functionality to write to the VM storage in a batch. -/// -/// So far, this trait is implemented only for [`StorageView`]. -pub trait WriteStorage: ReadStorage { - /// Returns the map with the key–value pairs read by this batch. - fn read_storage_keys(&self) -> &HashMap; - - /// Sets the new value under a given key and returns the previous value. - fn set_value(&mut self, key: StorageKey, value: StorageValue) -> StorageValue; - - /// Returns a map with the key–value pairs updated by this batch. - fn modified_storage_keys(&self) -> &HashMap; - - /// Returns the number of read / write ops for which the value was read from the underlying - /// storage. - fn missed_storage_invocations(&self) -> usize; -} - -/// Smart pointer to [`WriteStorage`]. -pub type StoragePtr = Rc>; - -impl ReadStorage for StoragePtr { - fn read_value(&mut self, key: &StorageKey) -> StorageValue { - self.borrow_mut().read_value(key) - } - - fn is_write_initial(&mut self, key: &StorageKey) -> bool { - self.borrow_mut().is_write_initial(key) - } - - fn load_factory_dep(&mut self, hash: H256) -> Option> { - self.borrow_mut().load_factory_dep(hash) - } - - fn get_enumeration_index(&mut self, key: &StorageKey) -> Option { - self.borrow_mut().get_enumeration_index(key) - } -} diff --git a/core/lib/state/src/postgres/mod.rs b/core/lib/state/src/postgres/mod.rs index 9d7f6c3f71fa..67866634ee4b 100644 --- a/core/lib/state/src/postgres/mod.rs +++ b/core/lib/state/src/postgres/mod.rs @@ -15,12 +15,10 @@ use tokio::{ }; use zksync_dal::{Connection, ConnectionPool, Core, CoreDal}; use zksync_types::{L1BatchNumber, L2BlockNumber, StorageKey, StorageValue, H256}; +use zksync_vm_interface::storage::ReadStorage; use self::metrics::{Method, ValuesUpdateStage, CACHE_METRICS, STORAGE_METRICS}; -use crate::{ - cache::{lru_cache::LruCache, CacheValue}, - ReadStorage, -}; +use crate::cache::{lru_cache::LruCache, CacheValue}; mod metrics; #[cfg(test)] diff --git a/core/lib/state/src/rocksdb/mod.rs b/core/lib/state/src/rocksdb/mod.rs index 61a1eb362be1..f866a22a3e52 100644 --- a/core/lib/state/src/rocksdb/mod.rs +++ b/core/lib/state/src/rocksdb/mod.rs @@ -33,11 +33,11 @@ use tokio::sync::watch; use zksync_dal::{Connection, Core, CoreDal, DalError}; use zksync_storage::{db::NamedColumnFamily, RocksDB, RocksDBOptions}; use zksync_types::{L1BatchNumber, StorageKey, StorageValue, H256}; +use zksync_vm_interface::storage::ReadStorage; #[cfg(test)] use self::tests::RocksdbStorageEventListener; use self::{metrics::METRICS, recovery::Strategy}; -use crate::{InMemoryStorage, ReadStorage}; mod metrics; mod recovery; @@ -154,11 +154,17 @@ impl RocksdbStorageOptions { } } +#[derive(Debug, Clone, Default)] +struct PendingPatch { + state: HashMap, + factory_deps: HashMap>, +} + /// [`ReadStorage`] implementation backed by RocksDB. #[derive(Debug, Clone)] pub struct RocksdbStorage { db: RocksDB, - pending_patch: InMemoryStorage, + pending_patch: PendingPatch, /// Test-only listeners to events produced by the storage. #[cfg(test)] listener: RocksdbStorageEventListener, @@ -174,7 +180,7 @@ impl RocksdbStorageBuilder { pub fn from_rocksdb(value: RocksDB) -> Self { RocksdbStorageBuilder(RocksdbStorage { db: value, - pending_patch: InMemoryStorage::default(), + pending_patch: PendingPatch::default(), #[cfg(test)] listener: RocksdbStorageEventListener::default(), }) @@ -309,7 +315,7 @@ impl RocksdbStorage { .context("failed initializing state keeper RocksDB")?; Ok(Self { db, - pending_patch: InMemoryStorage::default(), + pending_patch: PendingPatch::default(), #[cfg(test)] listener: RocksdbStorageEventListener::default(), }) diff --git a/core/lib/state/src/shadow_storage.rs b/core/lib/state/src/shadow_storage.rs index 5e32f9b25e71..28d7b997cd1f 100644 --- a/core/lib/state/src/shadow_storage.rs +++ b/core/lib/state/src/shadow_storage.rs @@ -1,7 +1,6 @@ use vise::{Counter, Metrics}; use zksync_types::{L1BatchNumber, StorageKey, StorageValue, H256}; - -use crate::ReadStorage; +use zksync_vm_interface::storage::ReadStorage; #[allow(clippy::struct_field_names)] #[derive(Debug, Metrics)] diff --git a/core/lib/state/src/storage_factory.rs b/core/lib/state/src/storage_factory.rs index c506bf7042d1..d3b978356a50 100644 --- a/core/lib/state/src/storage_factory.rs +++ b/core/lib/state/src/storage_factory.rs @@ -6,10 +6,9 @@ use tokio::{runtime::Handle, sync::watch}; use zksync_dal::{Connection, ConnectionPool, Core, CoreDal}; use zksync_storage::RocksDB; use zksync_types::{L1BatchNumber, StorageKey, StorageValue, H256}; +use zksync_vm_interface::storage::ReadStorage; -use crate::{ - PostgresStorage, ReadStorage, RocksdbStorage, RocksdbStorageBuilder, StateKeeperColumnFamily, -}; +use crate::{PostgresStorage, RocksdbStorage, RocksdbStorageBuilder, StateKeeperColumnFamily}; /// Factory that can produce [`OwnedStorage`] instances on demand. #[async_trait] diff --git a/core/lib/state/src/witness.rs b/core/lib/state/src/witness.rs index 5965f3c11884..ce0b69264240 100644 --- a/core/lib/state/src/witness.rs +++ b/core/lib/state/src/witness.rs @@ -1,6 +1,5 @@ use zksync_types::{witness_block_state::WitnessStorageState, StorageKey, StorageValue, H256}; - -use crate::ReadStorage; +use zksync_vm_interface::storage::ReadStorage; /// [`ReadStorage`] implementation backed by binary serialized [`WitnessHashBlockState`]. /// Note that `load_factory_deps` is not used. diff --git a/core/lib/vm_interface/Cargo.toml b/core/lib/vm_interface/Cargo.toml index c1f3a3db4b4f..b38ada434462 100644 --- a/core/lib/vm_interface/Cargo.toml +++ b/core/lib/vm_interface/Cargo.toml @@ -18,3 +18,4 @@ zksync_types.workspace = true # FIXME: move VM-related types? (e.g., VM events, hex.workspace = true serde.workspace = true thiserror.workspace = true +tracing.workspace = true diff --git a/core/lib/vm_interface/src/lib.rs b/core/lib/vm_interface/src/lib.rs index 96d4b53dcb9b..710b4a5798ab 100644 --- a/core/lib/vm_interface/src/lib.rs +++ b/core/lib/vm_interface/src/lib.rs @@ -12,4 +12,5 @@ pub use crate::types::{ tracer, }; +pub mod storage; mod types; diff --git a/core/lib/state/src/in_memory.rs b/core/lib/vm_interface/src/storage/in_memory.rs similarity index 95% rename from core/lib/state/src/in_memory.rs rename to core/lib/vm_interface/src/storage/in_memory.rs index 594eae128169..d4b5e57f1fa0 100644 --- a/core/lib/state/src/in_memory.rs +++ b/core/lib/vm_interface/src/storage/in_memory.rs @@ -3,11 +3,10 @@ use std::collections::{hash_map::Entry, BTreeMap, HashMap}; use zksync_types::{ block::DeployedContract, get_code_key, get_known_code_key, get_system_context_init_logs, system_contracts::get_system_smart_contracts, L2ChainId, StorageKey, StorageLog, StorageValue, - H256, U256, + H256, }; -use zksync_utils::u256_to_h256; -use crate::ReadStorage; +use super::ReadStorage; /// Network ID we use by default for in memory storage. pub const IN_MEMORY_STORAGE_DEFAULT_NETWORK_ID: u32 = 270; @@ -15,8 +14,8 @@ pub const IN_MEMORY_STORAGE_DEFAULT_NETWORK_ID: u32 = 270; /// In-memory storage. #[derive(Debug, Default, Clone)] pub struct InMemoryStorage { - pub(crate) state: HashMap, - pub(crate) factory_deps: HashMap>, + state: HashMap, + factory_deps: HashMap>, last_enum_index_set: u64, } @@ -57,9 +56,9 @@ impl InMemoryStorage { let deployer_code_key = get_code_key(contract.account_id.address()); let is_known_code_key = get_known_code_key(&bytecode_hash); - vec![ + [ StorageLog::new_write_log(deployer_code_key, bytecode_hash), - StorageLog::new_write_log(is_known_code_key, u256_to_h256(U256::one())), + StorageLog::new_write_log(is_known_code_key, H256::from_low_u64_be(1)), ] }) .chain(system_context_init_log) diff --git a/core/lib/vm_interface/src/storage/mod.rs b/core/lib/vm_interface/src/storage/mod.rs new file mode 100644 index 000000000000..96cc1f19862c --- /dev/null +++ b/core/lib/vm_interface/src/storage/mod.rs @@ -0,0 +1,75 @@ +use std::{cell::RefCell, collections::HashMap, fmt, rc::Rc}; + +use zksync_types::{get_known_code_key, StorageKey, StorageValue, H256}; + +pub use self::{ + // Note, that `test_infra` of the bootloader tests relies on this value to be exposed + in_memory::{InMemoryStorage, IN_MEMORY_STORAGE_DEFAULT_NETWORK_ID}, + view::{ImmutableStorageView, StorageView, StorageViewCache, StorageViewMetrics}, +}; + +mod in_memory; +mod view; + +/// Functionality to read from the VM storage. +pub trait ReadStorage: fmt::Debug { + /// Read value of the key. + fn read_value(&mut self, key: &StorageKey) -> StorageValue; + + /// Checks whether a write to this storage at the specified `key` would be an initial write. + /// Roughly speaking, this is the case when the storage doesn't contain `key`, although + /// in case of mutable storage, the caveats apply (a write to a key that is present + /// in the storage but was not committed is still an initial write). + fn is_write_initial(&mut self, key: &StorageKey) -> bool; + + /// Load the factory dependency code by its hash. + fn load_factory_dep(&mut self, hash: H256) -> Option>; + + /// Returns whether a bytecode hash is "known" to the system. + fn is_bytecode_known(&mut self, bytecode_hash: &H256) -> bool { + let code_key = get_known_code_key(bytecode_hash); + self.read_value(&code_key) != H256::zero() + } + + /// Retrieves the enumeration index for a given `key`. + fn get_enumeration_index(&mut self, key: &StorageKey) -> Option; +} + +/// Functionality to write to the VM storage in a batch. +/// +/// So far, this trait is implemented only for [`StorageView`]. +pub trait WriteStorage: ReadStorage { + /// Returns the map with the key–value pairs read by this batch. + fn read_storage_keys(&self) -> &HashMap; + + /// Sets the new value under a given key and returns the previous value. + fn set_value(&mut self, key: StorageKey, value: StorageValue) -> StorageValue; + + /// Returns a map with the key–value pairs updated by this batch. + fn modified_storage_keys(&self) -> &HashMap; + + /// Returns the number of read / write ops for which the value was read from the underlying + /// storage. + fn missed_storage_invocations(&self) -> usize; +} + +/// Smart pointer to [`WriteStorage`]. +pub type StoragePtr = Rc>; + +impl ReadStorage for StoragePtr { + fn read_value(&mut self, key: &StorageKey) -> StorageValue { + self.borrow_mut().read_value(key) + } + + fn is_write_initial(&mut self, key: &StorageKey) -> bool { + self.borrow_mut().is_write_initial(key) + } + + fn load_factory_dep(&mut self, hash: H256) -> Option> { + self.borrow_mut().load_factory_dep(hash) + } + + fn get_enumeration_index(&mut self, key: &StorageKey) -> Option { + self.borrow_mut().get_enumeration_index(key) + } +} diff --git a/core/lib/state/src/storage_view.rs b/core/lib/vm_interface/src/storage/view.rs similarity index 99% rename from core/lib/state/src/storage_view.rs rename to core/lib/vm_interface/src/storage/view.rs index b01f423f0787..691a9d442ca8 100644 --- a/core/lib/state/src/storage_view.rs +++ b/core/lib/vm_interface/src/storage/view.rs @@ -8,7 +8,7 @@ use std::{ use zksync_types::{StorageKey, StorageValue, H256}; -use crate::{ReadStorage, StoragePtr, WriteStorage}; +use super::{ReadStorage, StoragePtr, WriteStorage}; /// Metrics for [`StorageView`]. #[derive(Debug, Default, Clone, Copy)] @@ -269,7 +269,7 @@ mod test { use zksync_types::{AccountTreeId, Address, H256}; use super::*; - use crate::InMemoryStorage; + use crate::storage::InMemoryStorage; #[test] fn test_storage_access() { From cbfa2b8bc6796a2df128e123162957add9bd4f9f Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 13:39:20 +0300 Subject: [PATCH 06/17] Update VM storage trait uses in `multivm` --- core/lib/multivm/Cargo.toml | 1 - core/lib/multivm/src/glue/tracers/mod.rs | 4 +--- .../traits/tracers/dyn_tracers/vm_1_3_3.rs | 3 ++- .../traits/tracers/dyn_tracers/vm_1_4_0.rs | 3 ++- .../traits/tracers/dyn_tracers/vm_1_4_1.rs | 3 ++- .../traits/tracers/dyn_tracers/vm_1_5_0.rs | 3 ++- core/lib/multivm/src/interface/traits/vm.rs | 8 ++++---- .../src/tracers/call_tracer/vm_1_4_1/mod.rs | 5 +++-- .../src/tracers/call_tracer/vm_1_4_2/mod.rs | 5 +++-- .../call_tracer/vm_boojum_integration/mod.rs | 5 +++-- .../src/tracers/call_tracer/vm_latest/mod.rs | 5 +++-- .../call_tracer/vm_refunds_enhancement/mod.rs | 5 +++-- .../call_tracer/vm_virtual_blocks/mod.rs | 7 +++++-- .../multivm/src/tracers/multivm_dispatcher.rs | 6 +++--- .../src/tracers/prestate_tracer/mod.rs | 3 ++- .../tracers/prestate_tracer/vm_1_4_1/mod.rs | 9 ++++++--- .../tracers/prestate_tracer/vm_1_4_2/mod.rs | 8 +++++--- .../tracers/prestate_tracer/vm_latest/mod.rs | 8 +++++--- .../vm_refunds_enhancement/mod.rs | 8 +++++--- .../prestate_tracer/vm_virtual_blocks/mod.rs | 8 +++++--- .../storage_invocation/vm_1_4_1/mod.rs | 3 +-- .../storage_invocation/vm_1_4_2/mod.rs | 3 +-- .../vm_boojum_integration/mod.rs | 3 +-- .../storage_invocation/vm_latest/mod.rs | 3 +-- .../vm_refunds_enhancement/mod.rs | 3 +-- .../vm_virtual_blocks/mod.rs | 4 +--- core/lib/multivm/src/tracers/validator/mod.rs | 2 +- .../src/tracers/validator/vm_1_4_1/mod.rs | 2 +- .../src/tracers/validator/vm_1_4_2/mod.rs | 2 +- .../validator/vm_boojum_integration/mod.rs | 2 +- .../src/tracers/validator/vm_latest/mod.rs | 2 +- .../validator/vm_refunds_enhancement/mod.rs | 2 +- .../validator/vm_virtual_blocks/mod.rs | 7 +++++-- core/lib/multivm/src/versions/shadow.rs | 2 +- .../src/versions/vm_1_3_2/history_recorder.rs | 9 +++------ .../src/versions/vm_1_3_2/oracle_tools.rs | 18 +++++++++-------- .../versions/vm_1_3_2/oracles/decommitter.rs | 6 +++--- .../src/versions/vm_1_3_2/oracles/storage.rs | 14 +++++++------ .../vm_1_3_2/oracles/tracer/validation.rs | 20 ++++++++++--------- .../src/versions/vm_1_3_2/pubdata_utils.rs | 6 +++--- .../multivm/src/versions/vm_1_3_2/refunds.rs | 14 ++++++++----- .../src/versions/vm_1_3_2/test_utils.rs | 2 +- .../multivm/src/versions/vm_1_3_2/utils.rs | 10 ++++++---- core/lib/multivm/src/versions/vm_1_3_2/vm.rs | 2 +- .../src/versions/vm_1_3_2/vm_instance.rs | 3 +-- .../versions/vm_1_3_2/vm_with_bootloader.rs | 3 +-- .../vm_1_4_1/implementation/bytecode.rs | 10 ++++++++-- .../vm_1_4_1/implementation/execution.rs | 2 +- .../versions/vm_1_4_1/implementation/gas.rs | 4 +--- .../versions/vm_1_4_1/implementation/logs.rs | 3 +-- .../vm_1_4_1/implementation/snapshots.rs | 6 ++++-- .../vm_1_4_1/implementation/statistics.rs | 3 +-- .../versions/vm_1_4_1/implementation/tx.rs | 2 +- .../vm_1_4_1/old_vm/history_recorder.rs | 3 ++- .../vm_1_4_1/old_vm/oracles/decommitter.rs | 8 +++++--- .../src/versions/vm_1_4_1/old_vm/utils.rs | 6 ++++-- .../src/versions/vm_1_4_1/oracles/storage.rs | 2 +- .../vm_1_4_1/tests/get_used_contracts.rs | 2 +- .../vm_1_4_1/tests/is_write_initial.rs | 2 +- .../src/versions/vm_1_4_1/tests/l2_blocks.rs | 2 +- .../src/versions/vm_1_4_1/tests/rollbacks.rs | 2 +- .../vm_1_4_1/tests/tester/inner_state.rs | 2 +- .../vm_1_4_1/tests/tester/vm_tester.rs | 2 +- .../src/versions/vm_1_4_1/tests/upgrade.rs | 2 +- .../src/versions/vm_1_4_1/tests/utils.rs | 2 +- .../vm_1_4_1/tracers/circuits_tracer.rs | 7 +++++-- .../vm_1_4_1/tracers/default_tracers.rs | 2 +- .../versions/vm_1_4_1/tracers/dispatcher.rs | 2 +- .../vm_1_4_1/tracers/pubdata_tracer.rs | 2 +- .../src/versions/vm_1_4_1/tracers/refunds.rs | 5 +++-- .../vm_1_4_1/tracers/result_tracer.rs | 2 +- .../src/versions/vm_1_4_1/tracers/traits.rs | 3 +-- .../vm_1_4_1/types/internals/vm_state.rs | 6 ++++-- .../src/versions/vm_1_4_1/utils/l2_blocks.rs | 6 ++++-- .../src/versions/vm_1_4_1/utils/logs.rs | 3 +-- core/lib/multivm/src/versions/vm_1_4_1/vm.rs | 2 +- .../vm_1_4_2/implementation/bytecode.rs | 10 ++++++++-- .../vm_1_4_2/implementation/execution.rs | 2 +- .../versions/vm_1_4_2/implementation/gas.rs | 4 +--- .../versions/vm_1_4_2/implementation/logs.rs | 3 +-- .../vm_1_4_2/implementation/snapshots.rs | 6 ++++-- .../vm_1_4_2/implementation/statistics.rs | 3 +-- .../versions/vm_1_4_2/implementation/tx.rs | 2 +- .../vm_1_4_2/old_vm/history_recorder.rs | 3 ++- .../vm_1_4_2/old_vm/oracles/decommitter.rs | 8 +++++--- .../src/versions/vm_1_4_2/old_vm/utils.rs | 6 ++++-- .../src/versions/vm_1_4_2/oracles/storage.rs | 2 +- .../vm_1_4_2/tests/get_used_contracts.rs | 2 +- .../vm_1_4_2/tests/is_write_initial.rs | 2 +- .../src/versions/vm_1_4_2/tests/l2_blocks.rs | 2 +- .../src/versions/vm_1_4_2/tests/rollbacks.rs | 2 +- .../vm_1_4_2/tests/tester/inner_state.rs | 2 +- .../vm_1_4_2/tests/tester/vm_tester.rs | 2 +- .../src/versions/vm_1_4_2/tests/upgrade.rs | 2 +- .../src/versions/vm_1_4_2/tests/utils.rs | 2 +- .../vm_1_4_2/tracers/circuits_tracer.rs | 7 +++++-- .../vm_1_4_2/tracers/default_tracers.rs | 2 +- .../versions/vm_1_4_2/tracers/dispatcher.rs | 2 +- .../vm_1_4_2/tracers/pubdata_tracer.rs | 2 +- .../src/versions/vm_1_4_2/tracers/refunds.rs | 5 +++-- .../vm_1_4_2/tracers/result_tracer.rs | 2 +- .../src/versions/vm_1_4_2/tracers/traits.rs | 3 +-- .../vm_1_4_2/types/internals/vm_state.rs | 6 ++++-- .../src/versions/vm_1_4_2/utils/l2_blocks.rs | 6 ++++-- .../src/versions/vm_1_4_2/utils/logs.rs | 3 +-- core/lib/multivm/src/versions/vm_1_4_2/vm.rs | 2 +- .../implementation/bytecode.rs | 10 ++++++++-- .../implementation/execution.rs | 2 +- .../implementation/gas.rs | 4 +--- .../implementation/logs.rs | 3 +-- .../implementation/snapshots.rs | 8 +++++--- .../implementation/statistics.rs | 3 +-- .../implementation/tx.rs | 2 +- .../old_vm/history_recorder.rs | 3 ++- .../old_vm/oracles/decommitter.rs | 8 +++++--- .../old_vm/oracles/storage.rs | 2 +- .../vm_boojum_integration/old_vm/utils.rs | 8 +++++--- .../vm_boojum_integration/oracles/storage.rs | 18 +++++++++-------- .../tests/get_used_contracts.rs | 2 +- .../tests/is_write_initial.rs | 2 +- .../vm_boojum_integration/tests/l2_blocks.rs | 2 +- .../vm_boojum_integration/tests/rollbacks.rs | 2 +- .../tests/tester/inner_state.rs | 2 +- .../tests/tester/vm_tester.rs | 2 +- .../vm_boojum_integration/tests/upgrade.rs | 2 +- .../vm_boojum_integration/tests/utils.rs | 2 +- .../tracers/circuits_tracer.rs | 7 +++++-- .../tracers/default_tracers.rs | 2 +- .../tracers/dispatcher.rs | 2 +- .../tracers/pubdata_tracer.rs | 2 +- .../vm_boojum_integration/tracers/refunds.rs | 5 +++-- .../tracers/result_tracer.rs | 2 +- .../vm_boojum_integration/tracers/traits.rs | 3 +-- .../types/internals/vm_state.rs | 6 ++++-- .../vm_boojum_integration/utils/l2_blocks.rs | 6 ++++-- .../vm_boojum_integration/utils/logs.rs | 3 +-- .../src/versions/vm_boojum_integration/vm.rs | 2 +- .../multivm/src/versions/vm_fast/bytecode.rs | 2 +- .../vm_fast/tests/get_used_contracts.rs | 3 +-- .../vm_fast/tests/is_write_initial.rs | 3 +-- .../src/versions/vm_fast/tests/l2_blocks.rs | 6 ++++-- .../versions/vm_fast/tests/require_eip712.rs | 3 +-- .../tests/tester/transaction_test_info.rs | 6 +++--- .../vm_fast/tests/tester/vm_tester.rs | 2 +- .../src/versions/vm_fast/tests/utils.rs | 3 ++- core/lib/multivm/src/versions/vm_fast/vm.rs | 10 +++++----- .../vm_latest/implementation/bytecode.rs | 10 ++++++++-- .../vm_latest/implementation/execution.rs | 2 +- .../versions/vm_latest/implementation/gas.rs | 8 +++++--- .../versions/vm_latest/implementation/logs.rs | 3 +-- .../vm_latest/implementation/snapshots.rs | 12 ++++++----- .../vm_latest/implementation/statistics.rs | 3 +-- .../versions/vm_latest/implementation/tx.rs | 2 +- .../vm_latest/old_vm/history_recorder.rs | 3 ++- .../vm_latest/old_vm/oracles/decommitter.rs | 8 +++++--- .../src/versions/vm_latest/old_vm/utils.rs | 6 +++--- .../src/versions/vm_latest/oracles/storage.rs | 4 ++-- .../vm_latest/tests/get_used_contracts.rs | 3 +-- .../vm_latest/tests/is_write_initial.rs | 3 +-- .../src/versions/vm_latest/tests/l2_blocks.rs | 6 ++++-- .../src/versions/vm_latest/tests/rollbacks.rs | 2 +- .../vm_latest/tests/tester/inner_state.rs | 2 +- .../vm_latest/tests/tester/vm_tester.rs | 2 +- .../src/versions/vm_latest/tests/upgrade.rs | 5 ++--- .../src/versions/vm_latest/tests/utils.rs | 6 +++--- .../vm_latest/tracers/circuits_tracer.rs | 7 +++++-- .../vm_latest/tracers/default_tracers.rs | 2 +- .../versions/vm_latest/tracers/dispatcher.rs | 2 +- .../vm_latest/tracers/pubdata_tracer.rs | 2 +- .../src/versions/vm_latest/tracers/refunds.rs | 5 +++-- .../vm_latest/tracers/result_tracer.rs | 2 +- .../src/versions/vm_latest/tracers/traits.rs | 3 +-- .../vm_latest/types/internals/vm_state.rs | 6 ++++-- .../src/versions/vm_latest/utils/l2_blocks.rs | 6 ++++-- .../src/versions/vm_latest/utils/logs.rs | 3 +-- core/lib/multivm/src/versions/vm_latest/vm.rs | 2 +- .../lib/multivm/src/versions/vm_m5/storage.rs | 3 ++- core/lib/multivm/src/versions/vm_m5/vm.rs | 5 ++--- .../lib/multivm/src/versions/vm_m6/storage.rs | 3 ++- core/lib/multivm/src/versions/vm_m6/vm.rs | 5 ++--- .../implementation/bytecode.rs | 10 ++++++++-- .../implementation/execution.rs | 2 +- .../implementation/gas.rs | 4 +--- .../implementation/logs.rs | 3 +-- .../implementation/snapshots.rs | 2 +- .../implementation/statistics.rs | 3 +-- .../implementation/tx.rs | 2 +- .../old_vm/history_recorder.rs | 3 ++- .../old_vm/oracles/decommitter.rs | 8 +++++--- .../old_vm/oracles/storage.rs | 2 +- .../vm_refunds_enhancement/old_vm/utils.rs | 8 +++++--- .../vm_refunds_enhancement/oracles/storage.rs | 2 +- .../tests/get_used_contracts.rs | 2 +- .../tests/is_write_initial.rs | 2 +- .../vm_refunds_enhancement/tests/l2_blocks.rs | 2 +- .../vm_refunds_enhancement/tests/rollbacks.rs | 2 +- .../tests/tester/inner_state.rs | 2 +- .../tests/tester/vm_tester.rs | 2 +- .../vm_refunds_enhancement/tests/upgrade.rs | 2 +- .../vm_refunds_enhancement/tests/utils.rs | 2 +- .../tracers/default_tracers.rs | 2 +- .../tracers/dispatcher.rs | 2 +- .../vm_refunds_enhancement/tracers/refunds.rs | 6 ++++-- .../tracers/result_tracer.rs | 2 +- .../vm_refunds_enhancement/tracers/traits.rs | 3 +-- .../types/internals/vm_state.rs | 6 ++++-- .../vm_refunds_enhancement/utils/l2_blocks.rs | 6 ++++-- .../src/versions/vm_refunds_enhancement/vm.rs | 2 +- .../implementation/bytecode.rs | 10 ++++++++-- .../implementation/execution.rs | 2 +- .../vm_virtual_blocks/implementation/gas.rs | 4 +--- .../vm_virtual_blocks/implementation/logs.rs | 3 +-- .../implementation/snapshots.rs | 2 +- .../implementation/statistics.rs | 3 +-- .../vm_virtual_blocks/implementation/tx.rs | 2 +- .../old_vm/history_recorder.rs | 3 ++- .../old_vm/oracles/decommitter.rs | 8 +++++--- .../old_vm/oracles/storage.rs | 2 +- .../vm_virtual_blocks/old_vm/utils.rs | 8 +++++--- .../tests/get_used_contracts.rs | 2 +- .../tests/is_write_initial.rs | 2 +- .../vm_virtual_blocks/tests/l2_blocks.rs | 2 +- .../tests/tester/inner_state.rs | 2 +- .../tests/tester/vm_tester.rs | 2 +- .../vm_virtual_blocks/tests/upgrade.rs | 2 +- .../versions/vm_virtual_blocks/tests/utils.rs | 2 +- .../tracers/default_tracers.rs | 8 ++++++-- .../vm_virtual_blocks/tracers/dispatcher.rs | 6 ++++-- .../vm_virtual_blocks/tracers/refunds.rs | 7 +++++-- .../tracers/result_tracer.rs | 8 +++++--- .../vm_virtual_blocks/tracers/traits.rs | 5 ++--- .../types/internals/vm_state.rs | 6 ++++-- .../vm_virtual_blocks/utils/l2_blocks.rs | 6 ++++-- .../src/versions/vm_virtual_blocks/vm.rs | 2 +- core/lib/multivm/src/vm_instance.rs | 2 +- 235 files changed, 550 insertions(+), 430 deletions(-) diff --git a/core/lib/multivm/Cargo.toml b/core/lib/multivm/Cargo.toml index eb2b60433aa5..7039ec9a52cd 100644 --- a/core/lib/multivm/Cargo.toml +++ b/core/lib/multivm/Cargo.toml @@ -25,7 +25,6 @@ circuit_sequencer_api_1_4_2.workspace = true circuit_sequencer_api_1_5_0.workspace = true zksync_types.workspace = true -zksync_state.workspace = true zksync_contracts.workspace = true zksync_utils.workspace = true zksync_system_constants.workspace = true diff --git a/core/lib/multivm/src/glue/tracers/mod.rs b/core/lib/multivm/src/glue/tracers/mod.rs index 7aa792ef1f71..c54cb1dcf76d 100644 --- a/core/lib/multivm/src/glue/tracers/mod.rs +++ b/core/lib/multivm/src/glue/tracers/mod.rs @@ -30,9 +30,7 @@ //! - Add this trait as a trait bound for `T` in `MultiVMTracer` implementation. //! - Implement the trait for `T` with a bound to `VmTracer` for a specific version. -use zksync_state::WriteStorage; - -use crate::{tracers::old_tracers::OldTracers, HistoryMode}; +use crate::{interface::storage::WriteStorage, tracers::old_tracers::OldTracers, HistoryMode}; pub type MultiVmTracerPointer = Box>; diff --git a/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_3_3.rs b/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_3_3.rs index c088889aa038..0af3b33eed13 100644 --- a/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_3_3.rs +++ b/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_3_3.rs @@ -2,7 +2,8 @@ use zk_evm_1_3_3::{ abstractions::Memory, tracing::{AfterDecodingData, AfterExecutionData, BeforeExecutionData, VmLocalStateData}, }; -use zksync_state::StoragePtr; + +use crate::interface::storage::StoragePtr; /// Version of zk_evm_1_3_3::Tracer suitable for dynamic dispatch. pub trait DynTracer { diff --git a/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_4_0.rs b/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_4_0.rs index 7237e24cb681..20cbd8fea634 100644 --- a/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_4_0.rs +++ b/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_4_0.rs @@ -2,7 +2,8 @@ use zk_evm_1_4_0::{ abstractions::Memory, tracing::{AfterDecodingData, AfterExecutionData, BeforeExecutionData, VmLocalStateData}, }; -use zksync_state::StoragePtr; + +use crate::interface::storage::StoragePtr; /// Version of `zk_evm_1_4_0::Tracer` suitable for dynamic dispatch. pub trait DynTracer { diff --git a/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_4_1.rs b/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_4_1.rs index 4772d14cd20f..bbd9ea490843 100644 --- a/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_4_1.rs +++ b/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_4_1.rs @@ -2,7 +2,8 @@ use zk_evm_1_4_1::{ abstractions::Memory, tracing::{AfterDecodingData, AfterExecutionData, BeforeExecutionData, VmLocalStateData}, }; -use zksync_state::StoragePtr; + +use crate::interface::storage::StoragePtr; /// Version of `zk_evm_1_4_1::Tracer` suitable for dynamic dispatch. pub trait DynTracer { diff --git a/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_5_0.rs b/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_5_0.rs index f306190184c0..28d7fd361185 100644 --- a/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_5_0.rs +++ b/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_5_0.rs @@ -2,7 +2,8 @@ use zk_evm_1_5_0::{ abstractions::Memory, tracing::{AfterDecodingData, AfterExecutionData, BeforeExecutionData, VmLocalStateData}, }; -use zksync_state::StoragePtr; + +use crate::interface::storage::StoragePtr; /// Version of `zk_evm_1_5_0::Tracer` suitable for dynamic dispatch. pub trait DynTracer { diff --git a/core/lib/multivm/src/interface/traits/vm.rs b/core/lib/multivm/src/interface/traits/vm.rs index 736c00fd2d39..693add70658c 100644 --- a/core/lib/multivm/src/interface/traits/vm.rs +++ b/core/lib/multivm/src/interface/traits/vm.rs @@ -24,7 +24,7 @@ //! tracers::CallTracer , //! vm_latest::ToTracerPointer //! }; -//! use zksync_state::{InMemoryStorage, StorageView}; +//! use crate::interface::storage::{InMemoryStorage, StorageView}; //! use zksync_types::Transaction; //! //! // Prepare the environment for the VM. @@ -47,13 +47,13 @@ //! let result = vm.execute(multivm::interface::VmExecutionMode::Batch); //! ``` -use zksync_state::StoragePtr; use zksync_types::Transaction; use zksync_utils::bytecode::CompressedBytecodeInfo; use crate::interface::{ - BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, FinishedL1Batch, L1BatchEnv, - L2BlockEnv, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmMemoryMetrics, + storage::StoragePtr, BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, + FinishedL1Batch, L1BatchEnv, L2BlockEnv, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, + VmMemoryMetrics, }; pub trait VmInterface { diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_1_4_1/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_1_4_1/mod.rs index 4e1e4deb729f..77618ad3a5c4 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_1_4_1/mod.rs @@ -5,7 +5,6 @@ use zk_evm_1_4_1::{ RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_types::{ vm_trace::{Call, CallType}, @@ -16,7 +15,9 @@ use zksync_types::{ use crate::{ glue::GlueInto, interface::{ - tracer::VmExecutionStopReason, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::VmExecutionStopReason, + traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, VmRevertReason, }, tracers::call_tracer::CallTracer, diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_1_4_2/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_1_4_2/mod.rs index d1ecd25db3ab..5ce2749e6135 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_1_4_2/mod.rs @@ -5,7 +5,6 @@ use zk_evm_1_4_1::{ RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_types::{ vm_trace::{Call, CallType}, @@ -16,7 +15,9 @@ use zksync_types::{ use crate::{ glue::GlueInto, interface::{ - tracer::VmExecutionStopReason, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::VmExecutionStopReason, + traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, VmRevertReason, }, tracers::call_tracer::CallTracer, diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_boojum_integration/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_boojum_integration/mod.rs index 06f24ef9b092..afdab6d1e615 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_boojum_integration/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_boojum_integration/mod.rs @@ -5,7 +5,6 @@ use zk_evm_1_4_0::{ RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_types::{ vm_trace::{Call, CallType}, @@ -16,7 +15,9 @@ use zksync_types::{ use crate::{ glue::GlueInto, interface::{ - tracer::VmExecutionStopReason, traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::VmExecutionStopReason, + traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, VmRevertReason, }, tracers::call_tracer::CallTracer, diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_latest/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_latest/mod.rs index c5e4e0cdded4..14df6ff8c8fe 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_latest/mod.rs @@ -5,7 +5,6 @@ use zk_evm_1_5_0::{ RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_types::{ vm_trace::{Call, CallType}, @@ -16,7 +15,9 @@ use zksync_types::{ use crate::{ glue::GlueInto, interface::{ - tracer::VmExecutionStopReason, traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::VmExecutionStopReason, + traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, VmRevertReason, }, tracers::call_tracer::CallTracer, diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_refunds_enhancement/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_refunds_enhancement/mod.rs index d310e4595083..09b727e367f7 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_refunds_enhancement/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_refunds_enhancement/mod.rs @@ -5,7 +5,6 @@ use zk_evm_1_3_3::{ RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_types::{ vm_trace::{Call, CallType}, @@ -16,7 +15,9 @@ use zksync_types::{ use crate::{ glue::GlueInto, interface::{ - tracer::VmExecutionStopReason, traits::tracers::dyn_tracers::vm_1_3_3::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::VmExecutionStopReason, + traits::tracers::dyn_tracers::vm_1_3_3::DynTracer, VmRevertReason, }, tracers::call_tracer::CallTracer, diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_virtual_blocks/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_virtual_blocks/mod.rs index 43b9b8524e67..27a1cd745b2a 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_virtual_blocks/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_virtual_blocks/mod.rs @@ -5,7 +5,6 @@ use zk_evm_1_3_3::{ RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_types::{ vm_trace::{Call, CallType}, @@ -15,7 +14,11 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::{dyn_tracers::vm_1_3_3::DynTracer, VmExecutionResultAndLogs, VmRevertReason}, + interface::{ + dyn_tracers::vm_1_3_3::DynTracer, + storage::{StoragePtr, WriteStorage}, + VmExecutionResultAndLogs, VmRevertReason, + }, tracers::call_tracer::CallTracer, vm_virtual_blocks::{ ExecutionEndTracer, ExecutionProcessing, HistoryMode, SimpleMemory, VmTracer, diff --git a/core/lib/multivm/src/tracers/multivm_dispatcher.rs b/core/lib/multivm/src/tracers/multivm_dispatcher.rs index 5b0d36b5e793..e23bb7c19f84 100644 --- a/core/lib/multivm/src/tracers/multivm_dispatcher.rs +++ b/core/lib/multivm/src/tracers/multivm_dispatcher.rs @@ -1,6 +1,6 @@ -use zksync_state::WriteStorage; - -use crate::{tracers::old_tracers, HistoryMode, MultiVmTracerPointer}; +use crate::{ + interface::storage::WriteStorage, tracers::old_tracers, HistoryMode, MultiVmTracerPointer, +}; /// Tracer dispatcher is a tracer that can dispatch calls to multiple tracers. pub struct TracerDispatcher { diff --git a/core/lib/multivm/src/tracers/prestate_tracer/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/mod.rs index 81e2acfd4bed..e8a7cc2cc420 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/mod.rs @@ -1,13 +1,14 @@ use std::{collections::HashMap, fmt, sync::Arc}; use once_cell::sync::OnceCell; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ get_code_key, get_nonce_key, web3::keccak256, AccountTreeId, Address, StorageKey, StorageValue, H160, H256, L2_BASE_TOKEN_ADDRESS, U256, }; use zksync_utils::{address_to_h256, h256_to_u256}; +use crate::interface::storage::{StoragePtr, WriteStorage}; + pub mod vm_1_4_1; pub mod vm_1_4_2; pub mod vm_latest; diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_1/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_1/mod.rs index f2080b2740fe..a4d447baf75c 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_1/mod.rs @@ -1,5 +1,4 @@ use zk_evm_1_4_1::tracing::{BeforeExecutionData, VmLocalStateData}; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::StorageKey; use super::{ @@ -7,10 +6,14 @@ use super::{ StorageAccess, }; use crate::{ - interface::dyn_tracers::vm_1_4_1::DynTracer, + interface::{ + dyn_tracers::vm_1_4_1::DynTracer, + storage::{StoragePtr, WriteStorage}, + }, tracers::prestate_tracer::U256, vm_1_4_1::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; + impl DynTracer> for PrestateTracer { fn before_execution( &mut self, @@ -52,7 +55,7 @@ impl VmTracer for PrestateTracer { } } -impl StorageAccess for ZkSyncVmState { +impl StorageAccess for ZkSyncVmState { fn read_from_storage(&self, key: &StorageKey) -> U256 { self.storage.storage.read_from_storage(key) } diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_2/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_2/mod.rs index d51220ab41ff..16ed397a445d 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_2/mod.rs @@ -1,5 +1,4 @@ use zk_evm_1_4_1::tracing::{BeforeExecutionData, VmLocalStateData}; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::StorageKey; use super::{ @@ -7,7 +6,10 @@ use super::{ StorageAccess, }; use crate::{ - interface::dyn_tracers::vm_1_4_1::DynTracer, + interface::{ + dyn_tracers::vm_1_4_1::DynTracer, + storage::{StoragePtr, WriteStorage}, + }, tracers::prestate_tracer::U256, vm_1_4_2::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; @@ -53,7 +55,7 @@ impl VmTracer for PrestateTracer { } } -impl StorageAccess for ZkSyncVmState { +impl StorageAccess for ZkSyncVmState { fn read_from_storage(&self, key: &StorageKey) -> U256 { self.storage.storage.read_from_storage(key) } diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_latest/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_latest/mod.rs index c93974085fe9..1ae364036909 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_latest/mod.rs @@ -1,5 +1,4 @@ use zk_evm_1_5_0::tracing::{BeforeExecutionData, VmLocalStateData}; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::StorageKey; use super::{ @@ -7,7 +6,10 @@ use super::{ StorageAccess, }; use crate::{ - interface::dyn_tracers::vm_1_5_0::DynTracer, + interface::{ + dyn_tracers::vm_1_5_0::DynTracer, + storage::{StoragePtr, WriteStorage}, + }, tracers::prestate_tracer::U256, vm_latest::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; @@ -53,7 +55,7 @@ impl VmTracer for PrestateTracer { } } -impl StorageAccess for ZkSyncVmState { +impl StorageAccess for ZkSyncVmState { fn read_from_storage(&self, key: &StorageKey) -> U256 { self.storage.storage.read_from_storage(key) } diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_refunds_enhancement/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_refunds_enhancement/mod.rs index 970b0a8387ba..9a560450c3e3 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_refunds_enhancement/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_refunds_enhancement/mod.rs @@ -1,7 +1,6 @@ use std::collections::HashMap; use zk_evm_1_3_3::tracing::{BeforeExecutionData, VmLocalStateData}; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{StorageKey, H256}; use super::{ @@ -9,7 +8,10 @@ use super::{ StorageAccess, }; use crate::{ - interface::dyn_tracers::vm_1_3_3::DynTracer, + interface::{ + dyn_tracers::vm_1_3_3::DynTracer, + storage::{StoragePtr, WriteStorage}, + }, tracers::prestate_tracer::U256, vm_refunds_enhancement::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; @@ -63,7 +65,7 @@ impl VmTracer for PrestateTracer { } } -impl StorageAccess for ZkSyncVmState { +impl StorageAccess for ZkSyncVmState { fn read_from_storage(&self, key: &StorageKey) -> U256 { self.storage.storage.read_from_storage(key) } diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_virtual_blocks/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_virtual_blocks/mod.rs index 34c60a6bc07a..7b94f7b5884b 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_virtual_blocks/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_virtual_blocks/mod.rs @@ -1,7 +1,6 @@ use std::collections::HashMap; use zk_evm_1_3_3::tracing::{BeforeExecutionData, VmLocalStateData}; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{StorageKey, H256}; use super::{ @@ -9,7 +8,10 @@ use super::{ StorageAccess, }; use crate::{ - interface::dyn_tracers::vm_1_3_3::DynTracer, + interface::{ + dyn_tracers::vm_1_3_3::DynTracer, + storage::{StoragePtr, WriteStorage}, + }, tracers::prestate_tracer::U256, vm_virtual_blocks::{ BootloaderState, ExecutionEndTracer, ExecutionProcessing, HistoryMode, SimpleMemory, @@ -69,7 +71,7 @@ impl ExecutionProcessing for PrestateTrac } } -impl StorageAccess for ZkSyncVmState { +impl StorageAccess for ZkSyncVmState { fn read_from_storage(&self, key: &StorageKey) -> U256 { self.storage.storage.read_from_storage(key) } diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_1/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_1/mod.rs index be3a30adb1d4..ea60d7ff9e45 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_1/mod.rs @@ -1,7 +1,6 @@ -use zksync_state::WriteStorage; - use crate::{ interface::{ + storage::WriteStorage, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, Halt, diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_2/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_2/mod.rs index 186b3234d009..8c5770d02db3 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_2/mod.rs @@ -1,7 +1,6 @@ -use zksync_state::WriteStorage; - use crate::{ interface::{ + storage::WriteStorage, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, Halt, diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_boojum_integration/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_boojum_integration/mod.rs index 05651485bd79..55c982bc8f22 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_boojum_integration/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_boojum_integration/mod.rs @@ -1,7 +1,6 @@ -use zksync_state::WriteStorage; - use crate::{ interface::{ + storage::WriteStorage, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, Halt, diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_latest/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_latest/mod.rs index 48802a27b495..7220209728ef 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_latest/mod.rs @@ -1,7 +1,6 @@ -use zksync_state::WriteStorage; - use crate::{ interface::{ + storage::WriteStorage, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, Halt, diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_refunds_enhancement/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_refunds_enhancement/mod.rs index 1e562374afd5..7874d7b6afd9 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_refunds_enhancement/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_refunds_enhancement/mod.rs @@ -1,7 +1,6 @@ -use zksync_state::WriteStorage; - use crate::{ interface::{ + storage::WriteStorage, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_3_3::DynTracer, Halt, diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_virtual_blocks/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_virtual_blocks/mod.rs index cd0ab9f4bb54..171a67fdb721 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_virtual_blocks/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_virtual_blocks/mod.rs @@ -1,7 +1,5 @@ -use zksync_state::WriteStorage; - use crate::{ - interface::dyn_tracers::vm_1_3_3::DynTracer, + interface::{dyn_tracers::vm_1_3_3::DynTracer, storage::WriteStorage}, tracers::storage_invocation::StorageInvocations, vm_virtual_blocks::{ BootloaderState, ExecutionEndTracer, ExecutionProcessing, HistoryMode, SimpleMemory, diff --git a/core/lib/multivm/src/tracers/validator/mod.rs b/core/lib/multivm/src/tracers/validator/mod.rs index 635915f95278..1e91df901279 100644 --- a/core/lib/multivm/src/tracers/validator/mod.rs +++ b/core/lib/multivm/src/tracers/validator/mod.rs @@ -1,7 +1,6 @@ use std::{collections::HashSet, marker::PhantomData, sync::Arc}; use once_cell::sync::OnceCell; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::{ ACCOUNT_CODE_STORAGE_ADDRESS, BOOTLOADER_ADDRESS, CONTRACT_DEPLOYER_ADDRESS, L2_BASE_TOKEN_ADDRESS, MSG_VALUE_SIMULATOR_ADDRESS, SYSTEM_CONTEXT_ADDRESS, @@ -15,6 +14,7 @@ use zksync_utils::{be_bytes_to_safe_address, u256_to_account_address, u256_to_h2 pub use crate::tracers::validator::types::{ValidationError, ValidationTracerParams}; use crate::{ glue::tracers::IntoOldVmTracer, + interface::storage::{StoragePtr, WriteStorage}, tracers::validator::types::{NewTrustedValidationItems, ValidationTracerMode}, }; diff --git a/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs b/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs index ffbe0e6e51d1..354429b17bcd 100644 --- a/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs @@ -2,7 +2,6 @@ use zk_evm_1_4_1::{ tracing::{BeforeExecutionData, VmLocalStateData}, zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::KECCAK256_PRECOMPILE_ADDRESS; use zksync_types::{ get_code_key, vm_trace::ViolatedValidationRule, AccountTreeId, StorageKey, H256, @@ -11,6 +10,7 @@ use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h25 use crate::{ interface::{ + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, Halt, diff --git a/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs b/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs index 548677fff4db..a601d1456aa7 100644 --- a/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs @@ -2,7 +2,6 @@ use zk_evm_1_4_1::{ tracing::{BeforeExecutionData, VmLocalStateData}, zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::KECCAK256_PRECOMPILE_ADDRESS; use zksync_types::{ get_code_key, vm_trace::ViolatedValidationRule, AccountTreeId, StorageKey, H256, @@ -11,6 +10,7 @@ use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h25 use crate::{ interface::{ + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, Halt, diff --git a/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs b/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs index 058f63e7b9fc..ac9c6134b84e 100644 --- a/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs @@ -2,7 +2,6 @@ use zk_evm_1_4_0::{ tracing::{BeforeExecutionData, VmLocalStateData}, zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::KECCAK256_PRECOMPILE_ADDRESS; use zksync_types::{ get_code_key, vm_trace::ViolatedValidationRule, AccountTreeId, StorageKey, H256, @@ -11,6 +10,7 @@ use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h25 use crate::{ interface::{ + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, Halt, diff --git a/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs b/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs index 1e90e247d4a3..6a5c26e3181e 100644 --- a/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs @@ -2,7 +2,6 @@ use zk_evm_1_5_0::{ tracing::{BeforeExecutionData, VmLocalStateData}, zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::KECCAK256_PRECOMPILE_ADDRESS; use zksync_types::{ get_code_key, vm_trace::ViolatedValidationRule, AccountTreeId, StorageKey, H256, @@ -11,6 +10,7 @@ use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h25 use crate::{ interface::{ + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, Halt, diff --git a/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs b/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs index 0ef8011fc948..92a26c72e439 100644 --- a/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs @@ -2,7 +2,6 @@ use zk_evm_1_3_3::{ tracing::{BeforeExecutionData, VmLocalStateData}, zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::KECCAK256_PRECOMPILE_ADDRESS; use zksync_types::{ get_code_key, vm_trace::ViolatedValidationRule, AccountTreeId, StorageKey, H256, @@ -11,6 +10,7 @@ use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h25 use crate::{ interface::{ + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_3_3::DynTracer, Halt, diff --git a/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs b/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs index 6fd2955f60b6..b29e25224f7f 100644 --- a/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs @@ -2,7 +2,6 @@ use zk_evm_1_3_3::{ tracing::{BeforeExecutionData, VmLocalStateData}, zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::KECCAK256_PRECOMPILE_ADDRESS; use zksync_types::{ get_code_key, vm_trace::ViolatedValidationRule, AccountTreeId, StorageKey, H256, @@ -10,7 +9,11 @@ use zksync_types::{ use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h256}; use crate::{ - interface::{dyn_tracers::vm_1_3_3::DynTracer, VmExecutionResultAndLogs}, + interface::{ + dyn_tracers::vm_1_3_3::DynTracer, + storage::{StoragePtr, WriteStorage}, + VmExecutionResultAndLogs, + }, tracers::validator::{ types::{NewTrustedValidationItems, ValidationTracerMode}, ValidationRoundResult, ValidationTracer, diff --git a/core/lib/multivm/src/versions/shadow.rs b/core/lib/multivm/src/versions/shadow.rs index 675a95c5ba73..8fe10f833674 100644 --- a/core/lib/multivm/src/versions/shadow.rs +++ b/core/lib/multivm/src/versions/shadow.rs @@ -4,12 +4,12 @@ use std::{ }; use anyhow::Context as _; -use zksync_state::{ImmutableStorageView, ReadStorage, StoragePtr, StorageView}; use zksync_types::{StorageKey, StorageLog, StorageLogWithPreviousValue, Transaction}; use zksync_utils::bytecode::CompressedBytecodeInfo; use crate::{ interface::{ + storage::{ImmutableStorageView, ReadStorage, StoragePtr, StorageView}, BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, FinishedL1Batch, L1BatchEnv, L2BlockEnv, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, diff --git a/core/lib/multivm/src/versions/vm_1_3_2/history_recorder.rs b/core/lib/multivm/src/versions/vm_1_3_2/history_recorder.rs index bb3c12580c4f..2912fad2841d 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/history_recorder.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/history_recorder.rs @@ -1,14 +1,11 @@ use std::{collections::HashMap, fmt::Debug, hash::Hash}; -use zk_evm_1_3_3::{ - aux_structures::Timestamp, - vm_state::PrimitiveValue, - zkevm_opcode_defs::{self}, -}; -use zksync_state::{StoragePtr, WriteStorage}; +use zk_evm_1_3_3::{aux_structures::Timestamp, vm_state::PrimitiveValue, zkevm_opcode_defs}; use zksync_types::{StorageKey, U256}; use zksync_utils::{h256_to_u256, u256_to_h256}; +use crate::interface::storage::{StoragePtr, WriteStorage}; + pub type MemoryWithHistory = HistoryRecorder; pub type IntFrameManagerWithHistory = HistoryRecorder, H>; diff --git a/core/lib/multivm/src/versions/vm_1_3_2/oracle_tools.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracle_tools.rs index f271d86474cb..d215d78361d6 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/oracle_tools.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracle_tools.rs @@ -1,15 +1,17 @@ use std::fmt::Debug; use zk_evm_1_3_3::witness_trace::DummyTracer; -use zksync_state::{StoragePtr, WriteStorage}; -use crate::vm_1_3_2::{ - event_sink::InMemoryEventSink, - history_recorder::HistoryMode, - memory::SimpleMemory, - oracles::{ - decommitter::DecommitterOracle, precompile::PrecompilesProcessorWithHistory, - storage::StorageOracle, +use crate::{ + interface::storage::{StoragePtr, WriteStorage}, + vm_1_3_2::{ + event_sink::InMemoryEventSink, + history_recorder::HistoryMode, + memory::SimpleMemory, + oracles::{ + decommitter::DecommitterOracle, precompile::PrecompilesProcessorWithHistory, + storage::StorageOracle, + }, }, }; diff --git a/core/lib/multivm/src/versions/vm_1_3_2/oracles/decommitter.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracles/decommitter.rs index 8bf0e70026b8..e9a85f8ba4b1 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/oracles/decommitter.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracles/decommitter.rs @@ -6,13 +6,13 @@ use zk_evm_1_3_3::{ DecommittmentQuery, MemoryIndex, MemoryLocation, MemoryPage, MemoryQuery, Timestamp, }, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::U256; use zksync_utils::{bytecode::bytecode_len_in_words, bytes_to_be_words, u256_to_h256}; use super::OracleWithHistory; -use crate::vm_1_3_2::history_recorder::{ - HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, +use crate::{ + interface::storage::{StoragePtr, WriteStorage}, + vm_1_3_2::history_recorder::{HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory}, }; /// The main job of the DecommiterOracle is to implement the DecommitmentProcessor trait - that is diff --git a/core/lib/multivm/src/versions/vm_1_3_2/oracles/storage.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracles/storage.rs index 692a0496751a..ac4cc3df1706 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracles/storage.rs @@ -5,7 +5,6 @@ use zk_evm_1_3_3::{ aux_structures::{LogQuery, Timestamp}, zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ utils::storage_key_for_eth_balance, AccountTreeId, Address, StorageKey, StorageLogKind, BOOTLOADER_ADDRESS, U256, @@ -13,12 +12,15 @@ use zksync_types::{ use zksync_utils::u256_to_h256; use super::OracleWithHistory; -use crate::vm_1_3_2::{ - history_recorder::{ - AppDataFrameManagerWithHistory, HashMapHistoryEvent, HistoryEnabled, HistoryMode, - HistoryRecorder, StorageWrapper, WithHistory, +use crate::{ + interface::storage::{StoragePtr, WriteStorage}, + vm_1_3_2::{ + history_recorder::{ + AppDataFrameManagerWithHistory, HashMapHistoryEvent, HistoryEnabled, HistoryMode, + HistoryRecorder, StorageWrapper, WithHistory, + }, + utils::StorageLogQuery, }, - utils::StorageLogQuery, }; // While the storage does not support different shards, it was decided to write the diff --git a/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/validation.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/validation.rs index 1681bf63a2ba..f52b6b8940db 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/validation.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/validation.rs @@ -6,7 +6,6 @@ use zk_evm_1_3_3::{ }, zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::{ ACCOUNT_CODE_STORAGE_ADDRESS, BOOTLOADER_ADDRESS, CONTRACT_DEPLOYER_ADDRESS, KECCAK256_PRECOMPILE_ADDRESS, L2_BASE_TOKEN_ADDRESS, MSG_VALUE_SIMULATOR_ADDRESS, @@ -17,15 +16,18 @@ use zksync_utils::{ be_bytes_to_safe_address, h256_to_account_address, u256_to_account_address, u256_to_h256, }; -use crate::vm_1_3_2::{ - errors::VmRevertReasonParsingResult, - history_recorder::HistoryMode, - memory::SimpleMemory, - oracles::tracer::{ - utils::{ - computational_gas_price, get_calldata_page_via_abi, print_debug_if_needed, VmHook, +use crate::{ + interface::storage::{StoragePtr, WriteStorage}, + vm_1_3_2::{ + errors::VmRevertReasonParsingResult, + history_recorder::HistoryMode, + memory::SimpleMemory, + oracles::tracer::{ + utils::{ + computational_gas_price, get_calldata_page_via_abi, print_debug_if_needed, VmHook, + }, + ExecutionEndTracer, PendingRefundTracer, PubdataSpentTracer, StorageInvocationTracer, }, - ExecutionEndTracer, PendingRefundTracer, PubdataSpentTracer, StorageInvocationTracer, }, }; diff --git a/core/lib/multivm/src/versions/vm_1_3_2/pubdata_utils.rs b/core/lib/multivm/src/versions/vm_1_3_2/pubdata_utils.rs index 9e7f43bdb65c..2c16fc6129ee 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/pubdata_utils.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/pubdata_utils.rs @@ -2,15 +2,15 @@ use std::collections::HashMap; use circuit_sequencer_api_1_3_3::sort_storage_access::sort_storage_access_queries; use zk_evm_1_3_3::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{ event::{extract_long_l2_to_l1_messages, extract_published_bytecodes}, StorageKey, PUBLISH_BYTECODE_OVERHEAD, SYSTEM_CONTEXT_ADDRESS, }; use zksync_utils::bytecode::bytecode_len_in_bytes; -use crate::vm_1_3_2::{ - history_recorder::HistoryMode, oracles::storage::storage_key_of_log, VmInstance, +use crate::{ + interface::storage::WriteStorage, + vm_1_3_2::{history_recorder::HistoryMode, oracles::storage::storage_key_of_log, VmInstance}, }; impl VmInstance { diff --git a/core/lib/multivm/src/versions/vm_1_3_2/refunds.rs b/core/lib/multivm/src/versions/vm_1_3_2/refunds.rs index 555dd0f643ea..163992516d27 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/refunds.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/refunds.rs @@ -1,12 +1,16 @@ use zk_evm_1_3_3::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::U256; use zksync_utils::ceil_div_u256; -use crate::vm_1_3_2::{ - history_recorder::HistoryMode, - vm_with_bootloader::{eth_price_per_pubdata_byte, BOOTLOADER_HEAP_PAGE, TX_GAS_LIMIT_OFFSET}, - VmInstance, +use crate::{ + interface::storage::WriteStorage, + vm_1_3_2::{ + history_recorder::HistoryMode, + vm_with_bootloader::{ + eth_price_per_pubdata_byte, BOOTLOADER_HEAP_PAGE, TX_GAS_LIMIT_OFFSET, + }, + VmInstance, + }, }; impl VmInstance { diff --git a/core/lib/multivm/src/versions/vm_1_3_2/test_utils.rs b/core/lib/multivm/src/versions/vm_1_3_2/test_utils.rs index 603725790f8d..a29e1101d520 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/test_utils.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/test_utils.rs @@ -11,7 +11,6 @@ use std::collections::HashMap; use itertools::Itertools; use zk_evm_1_3_3::{aux_structures::Timestamp, vm_state::VmLocalState}; use zksync_contracts::deployer_contract; -use zksync_state::WriteStorage; use zksync_types::{ ethabi::{Address, Token}, web3::keccak256, @@ -21,6 +20,7 @@ use zksync_utils::{ address_to_h256, bytecode::hash_bytecode, h256_to_account_address, u256_to_h256, }; +use crate::interface::storage::WriteStorage; /// The tests here help us with the testing the VM use crate::vm_1_3_2::{ event_sink::InMemoryEventSink, diff --git a/core/lib/multivm/src/versions/vm_1_3_2/utils.rs b/core/lib/multivm/src/versions/vm_1_3_2/utils.rs index 0be7a2837af0..da4e2f5350f9 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/utils.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/utils.rs @@ -6,14 +6,16 @@ use zk_evm_1_3_3::{ zkevm_opcode_defs::FatPointer, }; use zksync_contracts::{read_zbin_bytecode, BaseSystemContracts}; -use zksync_state::WriteStorage; use zksync_system_constants::ZKPORTER_IS_AVAILABLE; use zksync_types::{Address, StorageLogKind, H160, MAX_L2_TX_GAS_LIMIT, U256}; use zksync_utils::h256_to_u256; -use crate::vm_1_3_2::{ - history_recorder::HistoryMode, memory::SimpleMemory, oracles::tracer::PubdataSpentTracer, - vm_with_bootloader::BlockContext, VmInstance, +use crate::{ + interface::storage::WriteStorage, + vm_1_3_2::{ + history_recorder::HistoryMode, memory::SimpleMemory, oracles::tracer::PubdataSpentTracer, + vm_with_bootloader::BlockContext, VmInstance, + }, }; pub const INITIAL_TIMESTAMP: u32 = 1024; diff --git a/core/lib/multivm/src/versions/vm_1_3_2/vm.rs b/core/lib/multivm/src/versions/vm_1_3_2/vm.rs index ff6c7f2f3d08..07aa7be09d42 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/vm.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/vm.rs @@ -1,7 +1,6 @@ use std::collections::HashSet; use circuit_sequencer_api_1_3_3::sort_storage_access::sort_storage_access_queries; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ l2_to_l1_log::{L2ToL1Log, UserL2ToL1Log}, Transaction, @@ -14,6 +13,7 @@ use zksync_utils::{ use crate::{ glue::{history_mode::HistoryMode, GlueInto}, interface::{ + storage::{StoragePtr, WriteStorage}, BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, FinishedL1Batch, L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, diff --git a/core/lib/multivm/src/versions/vm_1_3_2/vm_instance.rs b/core/lib/multivm/src/versions/vm_1_3_2/vm_instance.rs index 4cfd080ab7e0..f3e0fb5e54b3 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/vm_instance.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/vm_instance.rs @@ -10,7 +10,6 @@ use zk_evm_1_3_3::{ definitions::RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }, }; -use zksync_state::WriteStorage; use zksync_types::{ l2_to_l1_log::{L2ToL1Log, UserL2ToL1Log}, tx::tx_execution_info::TxExecutionStatus, @@ -20,7 +19,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::VmExecutionLogs, + interface::{storage::WriteStorage, VmExecutionLogs}, vm_1_3_2::{ bootloader_state::BootloaderState, errors::{TxRevertReason, VmRevertReason, VmRevertReasonParsingResult}, diff --git a/core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs b/core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs index 39a4bbdea15f..aef5b1dc78a2 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs @@ -13,7 +13,6 @@ use zk_evm_1_3_3::{ }, }; use zksync_contracts::BaseSystemContracts; -use zksync_state::WriteStorage; use zksync_system_constants::MAX_L2_TX_GAS_LIMIT; use zksync_types::{ fee_model::L1PeggedBatchFeeModelInput, l1::is_l1_tx_type, Address, Transaction, @@ -27,7 +26,7 @@ use zksync_utils::{ }; use crate::{ - interface::L1BatchEnv, + interface::{storage::WriteStorage, L1BatchEnv}, vm_1_3_2::{ bootloader_state::BootloaderState, history_recorder::HistoryMode, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/implementation/bytecode.rs b/core/lib/multivm/src/versions/vm_1_4_1/implementation/bytecode.rs index 73473e225bd4..cc03b53aa533 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/implementation/bytecode.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/implementation/bytecode.rs @@ -1,12 +1,18 @@ use itertools::Itertools; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::U256; use zksync_utils::{ bytecode::{compress_bytecode, hash_bytecode, CompressedBytecodeInfo}, bytes_to_be_words, }; -use crate::{interface::VmInterface, vm_1_4_1::Vm, HistoryMode}; +use crate::{ + interface::{ + storage::{StoragePtr, WriteStorage}, + VmInterface, + }, + vm_1_4_1::Vm, + HistoryMode, +}; impl Vm { /// Checks the last transaction has successfully published compressed bytecodes and returns `true` if there is at least one is still unknown. diff --git a/core/lib/multivm/src/versions/vm_1_4_1/implementation/execution.rs b/core/lib/multivm/src/versions/vm_1_4_1/implementation/execution.rs index 2bb57041e55f..01ee21f1836f 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/implementation/execution.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/implementation/execution.rs @@ -1,8 +1,8 @@ use zk_evm_1_4_1::aux_structures::Timestamp; -use zksync_state::WriteStorage; use crate::{ interface::{ + storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, VmExecutionMode, VmExecutionResultAndLogs, VmInterface, }, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/implementation/gas.rs b/core/lib/multivm/src/versions/vm_1_4_1/implementation/gas.rs index 2ac365f4a38e..bd30aa6218b1 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/implementation/gas.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/implementation/gas.rs @@ -1,7 +1,5 @@ -use zksync_state::WriteStorage; - use crate::{ - interface::VmInterface, + interface::{storage::WriteStorage, VmInterface}, vm_1_4_1::{tracers::DefaultExecutionTracer, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_1_4_1/implementation/logs.rs b/core/lib/multivm/src/versions/vm_1_4_1/implementation/logs.rs index c61c5c38cf99..3a2321d4d0e7 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/implementation/logs.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/implementation/logs.rs @@ -1,5 +1,4 @@ use zk_evm_1_4_1::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{ event::extract_l2tol1logs_from_l1_messenger, l2_to_l1_log::{L2ToL1Log, SystemL2ToL1Log, UserL2ToL1Log}, @@ -8,7 +7,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::VmExecutionLogs, + interface::{storage::WriteStorage, VmExecutionLogs}, vm_1_4_1::{old_vm::utils::precompile_calls_count_after_timestamp, utils::logs, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_1_4_1/implementation/snapshots.rs b/core/lib/multivm/src/versions/vm_1_4_1/implementation/snapshots.rs index 08e4e1c9e49e..1b1a439ef2ec 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/implementation/snapshots.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/implementation/snapshots.rs @@ -2,9 +2,11 @@ use std::time::Duration; use vise::{Buckets, EncodeLabelSet, EncodeLabelValue, Family, Histogram, Metrics}; use zk_evm_1_4_1::aux_structures::Timestamp; -use zksync_state::WriteStorage; -use crate::vm_1_4_1::{old_vm::oracles::OracleWithHistory, types::internals::VmSnapshot, vm::Vm}; +use crate::{ + interface::storage::WriteStorage, + vm_1_4_1::{old_vm::oracles::OracleWithHistory, types::internals::VmSnapshot, vm::Vm}, +}; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, EncodeLabelSet, EncodeLabelValue)] #[metrics(label = "stage", rename_all = "snake_case")] diff --git a/core/lib/multivm/src/versions/vm_1_4_1/implementation/statistics.rs b/core/lib/multivm/src/versions/vm_1_4_1/implementation/statistics.rs index d71199320688..dfdd42be7181 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/implementation/statistics.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/implementation/statistics.rs @@ -1,9 +1,8 @@ use zk_evm_1_4_1::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{circuit::CircuitStatistic, U256}; use crate::{ - interface::{VmExecutionStatistics, VmMemoryMetrics}, + interface::{storage::WriteStorage, VmExecutionStatistics, VmMemoryMetrics}, vm_1_4_1::{tracers::DefaultExecutionTracer, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_1_4_1/implementation/tx.rs b/core/lib/multivm/src/versions/vm_1_4_1/implementation/tx.rs index 4aea2649c99c..326be7379d6e 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/implementation/tx.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/implementation/tx.rs @@ -1,8 +1,8 @@ use zk_evm_1_4_1::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{l1::is_l1_tx_type, Transaction}; use crate::{ + interface::storage::WriteStorage, vm_1_4_1::{ constants::BOOTLOADER_HEAP_PAGE, implementation::bytecode::{bytecode_to_factory_dep, compress_bytecodes}, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/old_vm/history_recorder.rs b/core/lib/multivm/src/versions/vm_1_4_1/old_vm/history_recorder.rs index e9e2d51632dc..c9d899742202 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/old_vm/history_recorder.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/old_vm/history_recorder.rs @@ -5,10 +5,11 @@ use zk_evm_1_4_1::{ vm_state::PrimitiveValue, zkevm_opcode_defs::{self}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{StorageKey, H256, U256}; use zksync_utils::{h256_to_u256, u256_to_h256}; +use crate::interface::storage::{StoragePtr, WriteStorage}; + pub(crate) type MemoryWithHistory = HistoryRecorder; pub(crate) type IntFrameManagerWithHistory = HistoryRecorder, H>; diff --git a/core/lib/multivm/src/versions/vm_1_4_1/old_vm/oracles/decommitter.rs b/core/lib/multivm/src/versions/vm_1_4_1/old_vm/oracles/decommitter.rs index c301b3cb18b7..636a4058a037 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/old_vm/oracles/decommitter.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/old_vm/oracles/decommitter.rs @@ -6,13 +6,15 @@ use zk_evm_1_4_1::{ DecommittmentQuery, MemoryIndex, MemoryLocation, MemoryPage, MemoryQuery, Timestamp, }, }; -use zksync_state::{ReadStorage, StoragePtr}; use zksync_types::U256; use zksync_utils::{bytecode::bytecode_len_in_words, bytes_to_be_words, u256_to_h256}; use super::OracleWithHistory; -use crate::vm_1_4_1::old_vm::history_recorder::{ - HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, +use crate::{ + interface::storage::{ReadStorage, StoragePtr}, + vm_1_4_1::old_vm::history_recorder::{ + HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, + }, }; /// The main job of the DecommiterOracle is to implement the DecommittmentProcessor trait - that is /// used by the VM to 'load' bytecodes into memory. diff --git a/core/lib/multivm/src/versions/vm_1_4_1/old_vm/utils.rs b/core/lib/multivm/src/versions/vm_1_4_1/old_vm/utils.rs index ef73f9a54c1d..00e04b019f9f 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/old_vm/utils.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/old_vm/utils.rs @@ -6,10 +6,12 @@ use zk_evm_1_4_1::{ FatPointer, RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }, }; -use zksync_state::WriteStorage; use zksync_types::{Address, U256}; -use crate::vm_1_4_1::{old_vm::memory::SimpleMemory, types::internals::ZkSyncVmState, HistoryMode}; +use crate::{ + interface::storage::WriteStorage, + vm_1_4_1::{old_vm::memory::SimpleMemory, types::internals::ZkSyncVmState, HistoryMode}, +}; #[derive(Debug, Clone)] pub(crate) enum VmExecutionResult { diff --git a/core/lib/multivm/src/versions/vm_1_4_1/oracles/storage.rs b/core/lib/multivm/src/versions/vm_1_4_1/oracles/storage.rs index a5ff6b8883a6..3debfd1ca627 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/oracles/storage.rs @@ -5,7 +5,6 @@ use zk_evm_1_4_1::{ aux_structures::{LogQuery, Timestamp}, zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ utils::storage_key_for_eth_balance, writes::{ @@ -18,6 +17,7 @@ use zksync_utils::u256_to_h256; use crate::{ glue::GlueInto, + interface::storage::{StoragePtr, WriteStorage}, vm_1_4_1::{ old_vm::{ history_recorder::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tests/get_used_contracts.rs b/core/lib/multivm/src/versions/vm_1_4_1/tests/get_used_contracts.rs index ab52ac4e1db3..a7cbcd8e2953 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tests/get_used_contracts.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tests/get_used_contracts.rs @@ -1,7 +1,7 @@ use std::collections::{HashMap, HashSet}; use itertools::Itertools; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_test_account::Account; use zksync_types::{Execute, U256}; diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tests/is_write_initial.rs b/core/lib/multivm/src/versions/vm_1_4_1/tests/is_write_initial.rs index fd5813bdf949..7644064f4af6 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tests/is_write_initial.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tests/is_write_initial.rs @@ -1,4 +1,4 @@ -use zksync_state::ReadStorage; +use crate::interface::storage::ReadStorage; use zksync_types::get_nonce_key; use crate::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tests/l2_blocks.rs b/core/lib/multivm/src/versions/vm_1_4_1/tests/l2_blocks.rs index 0aaa1e6a6c5e..073d9ce5800b 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tests/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tests/l2_blocks.rs @@ -4,7 +4,7 @@ //! use zk_evm_1_4_1::aux_structures::Timestamp; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_system_constants::REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_BYTE; use zksync_types::{ block::{pack_block_info, MiniblockHasher}, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tests/rollbacks.rs b/core/lib/multivm/src/versions/vm_1_4_1/tests/rollbacks.rs index 4bee819e90e8..2ae942c26526 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tests/rollbacks.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tests/rollbacks.rs @@ -1,6 +1,6 @@ use ethabi::Token; use zksync_contracts::{get_loadnext_contract, test_contracts::LoadnextContractExecutionParams}; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_types::{get_nonce_key, Execute, U256}; use crate::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tests/tester/inner_state.rs b/core/lib/multivm/src/versions/vm_1_4_1/tests/tester/inner_state.rs index 63e2be6a3620..11e9d7fd6dfe 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tests/tester/inner_state.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tests/tester/inner_state.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use zk_evm_1_4_1::{aux_structures::Timestamp, vm_state::VmLocalState}; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_types::{StorageKey, StorageValue, U256}; use crate::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tests/tester/vm_tester.rs b/core/lib/multivm/src/versions/vm_1_4_1/tests/tester/vm_tester.rs index 4da556114589..24bd0b4d0bcc 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tests/tester/vm_tester.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tests/tester/vm_tester.rs @@ -1,7 +1,7 @@ use std::marker::PhantomData; use zksync_contracts::BaseSystemContracts; -use zksync_state::{InMemoryStorage, StoragePtr, StorageView, WriteStorage}; +use crate::interface::storage::{InMemoryStorage, StoragePtr, StorageView, WriteStorage}; use zksync_types::{ block::MiniblockHasher, fee_model::BatchFeeInput, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tests/upgrade.rs b/core/lib/multivm/src/versions/vm_1_4_1/tests/upgrade.rs index 2c2b341338ae..af3701d919fa 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tests/upgrade.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tests/upgrade.rs @@ -1,6 +1,6 @@ use zk_evm_1_4_1::aux_structures::Timestamp; use zksync_contracts::{deployer_contract, load_sys_contract, read_bytecode}; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_test_account::TxType; use zksync_types::{ ethabi::{Contract, Token}, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tests/utils.rs b/core/lib/multivm/src/versions/vm_1_4_1/tests/utils.rs index f0fc0f07f2b5..da69c107a20b 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tests/utils.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tests/utils.rs @@ -3,7 +3,7 @@ use once_cell::sync::Lazy; use zksync_contracts::{ load_contract, read_bytecode, read_zbin_bytecode, BaseSystemContracts, SystemContractCode, }; -use zksync_state::{StoragePtr, WriteStorage}; +use crate::interface::storage::{StoragePtr, WriteStorage}; use zksync_types::{ utils::storage_key_for_standard_token_balance, AccountTreeId, Address, StorageKey, H256, U256, }; diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_tracer.rs index 06244179aa80..050c9cc849b5 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_tracer.rs @@ -5,12 +5,15 @@ use zk_evm_1_4_1::{ zk_evm_abstractions::precompiles::PrecompileAddress, zkevm_opcode_defs::{LogOpcode, Opcode, UMAOpcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::circuit::CircuitCycleStatistic; use super::circuits_capacity::*; use crate::{ - interface::{dyn_tracers::vm_1_4_1::DynTracer, tracer::TracerExecutionStatus}, + interface::{ + dyn_tracers::vm_1_4_1::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::TracerExecutionStatus, + }, vm_1_4_1::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs index 1e495e07f8cc..19469cf20d98 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs @@ -12,12 +12,12 @@ use zk_evm_1_4_1::{ witness_trace::DummyTracer, zkevm_opcode_defs::{decoding::EncodingModeProduction, Opcode, RetOpcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use super::PubdataTracer; use crate::{ glue::GlueInto, interface::{ + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, Halt, VmExecutionMode, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/dispatcher.rs index feffd6c20f99..b680041fab13 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/dispatcher.rs @@ -1,11 +1,11 @@ use zk_evm_1_4_1::tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, VmLocalStateData, }; -use zksync_state::{StoragePtr, WriteStorage}; use crate::{ interface::{ dyn_tracers::vm_1_4_1::DynTracer, + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, vm_1_4_1::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs index 3a967f69dd16..ee87bc38f5e0 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs @@ -5,7 +5,6 @@ use zk_evm_1_4_1::{ aux_structures::Timestamp, tracing::{BeforeExecutionData, VmLocalStateData}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ event::{ extract_bytecode_publication_requests_from_l1_messenger, @@ -19,6 +18,7 @@ use zksync_utils::{h256_to_u256, u256_to_bytes_be, u256_to_h256}; use crate::{ interface::{ dyn_tracers::vm_1_4_1::DynTracer, + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, L1BatchEnv, VmExecutionMode, }, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs index 815463052cbe..f7d0d9c028da 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs @@ -7,7 +7,6 @@ use zk_evm_1_4_1::{ vm_state::VmLocalState, zkevm_opcode_defs::system_params::L1_MESSAGE_PUBDATA_BYTES, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::{PUBLISH_BYTECODE_OVERHEAD, SYSTEM_CONTEXT_ADDRESS}; use zksync_types::{ event::{extract_long_l2_to_l1_messages, extract_published_bytecodes}, @@ -18,7 +17,9 @@ use zksync_utils::{bytecode::bytecode_len_in_bytes, ceil_div_u256, u256_to_h256} use crate::{ interface::{ - tracer::TracerExecutionStatus, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::TracerExecutionStatus, + traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, L1BatchEnv, Refunds, }, vm_1_4_1::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs index 80204620fd0d..2b9259bff83f 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs @@ -5,11 +5,11 @@ use zk_evm_1_4_1::{ vm_state::{ErrorFlags, VmLocalState}, zkevm_opcode_defs::FatPointer, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::U256; use crate::{ interface::{ + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStopReason, VmExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/traits.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/traits.rs index d738c9484fdc..255b8dcbe072 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/traits.rs @@ -1,8 +1,7 @@ -use zksync_state::WriteStorage; - use crate::{ interface::{ dyn_tracers::vm_1_4_1::DynTracer, + storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, vm_1_4_1::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_1/types/internals/vm_state.rs b/core/lib/multivm/src/versions/vm_1_4_1/types/internals/vm_state.rs index 15830bbfdd55..b91733c7ca14 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/types/internals/vm_state.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/types/internals/vm_state.rs @@ -10,13 +10,15 @@ use zk_evm_1_4_1::{ STARTING_BASE_PAGE, STARTING_TIMESTAMP, }, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::BOOTLOADER_ADDRESS; use zksync_types::{block::L2BlockHasher, Address, L2BlockNumber}; use zksync_utils::h256_to_u256; use crate::{ - interface::{L1BatchEnv, L2Block, SystemEnv}, + interface::{ + storage::{StoragePtr, WriteStorage}, + L1BatchEnv, L2Block, SystemEnv, + }, vm_1_4_1::{ bootloader_state::BootloaderState, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/utils/l2_blocks.rs b/core/lib/multivm/src/versions/vm_1_4_1/utils/l2_blocks.rs index ec30a86013b9..ff5536ae0b97 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/utils/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/utils/l2_blocks.rs @@ -1,4 +1,3 @@ -use zksync_state::{ReadStorage, StoragePtr}; use zksync_system_constants::{ SYSTEM_CONTEXT_ADDRESS, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION, SYSTEM_CONTEXT_CURRENT_TX_ROLLING_HASH_POSITION, @@ -9,7 +8,10 @@ use zksync_types::{ }; use zksync_utils::{h256_to_u256, u256_to_h256}; -use crate::interface::{L2Block, L2BlockEnv}; +use crate::interface::{ + storage::{ReadStorage, StoragePtr}, + L2Block, L2BlockEnv, +}; pub(crate) fn get_l2_block_hash_key(block_number: u32) -> StorageKey { let position = h256_to_u256(SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION) diff --git a/core/lib/multivm/src/versions/vm_1_4_1/utils/logs.rs b/core/lib/multivm/src/versions/vm_1_4_1/utils/logs.rs index fab90d9bee56..48a1b49a4600 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/utils/logs.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/utils/logs.rs @@ -1,10 +1,9 @@ use zk_evm_1_4_1::aux_structures::{LogQuery, Timestamp}; -use zksync_state::WriteStorage; use zksync_types::{l2_to_l1_log::L2ToL1Log, StorageLogKind, VmEvent}; use crate::{ glue::GlueInto, - interface::L1BatchEnv, + interface::{storage::WriteStorage, L1BatchEnv}, vm_1_4_1::{ old_vm::{events::merge_events, history_recorder::HistoryMode}, types::internals::ZkSyncVmState, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/vm.rs b/core/lib/multivm/src/versions/vm_1_4_1/vm.rs index 345948bfdfbb..e37a8757ee19 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/vm.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/vm.rs @@ -1,5 +1,4 @@ use circuit_sequencer_api_1_4_1::sort_storage_access::sort_storage_access_queries; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ event::extract_l2tol1logs_from_l1_messenger, l2_to_l1_log::{SystemL2ToL1Log, UserL2ToL1Log}, @@ -10,6 +9,7 @@ use zksync_utils::bytecode::CompressedBytecodeInfo; use crate::{ glue::GlueInto, interface::{ + storage::{StoragePtr, WriteStorage}, BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, FinishedL1Batch, L1BatchEnv, L2BlockEnv, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/implementation/bytecode.rs b/core/lib/multivm/src/versions/vm_1_4_2/implementation/bytecode.rs index 0358c3f7d2e4..a4bd40110f2d 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/implementation/bytecode.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/implementation/bytecode.rs @@ -1,12 +1,18 @@ use itertools::Itertools; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::U256; use zksync_utils::{ bytecode::{compress_bytecode, hash_bytecode, CompressedBytecodeInfo}, bytes_to_be_words, }; -use crate::{interface::VmInterface, vm_1_4_2::Vm, HistoryMode}; +use crate::{ + interface::{ + storage::{StoragePtr, WriteStorage}, + VmInterface, + }, + vm_1_4_2::Vm, + HistoryMode, +}; impl Vm { /// Checks the last transaction has successfully published compressed bytecodes and returns `true` if there is at least one is still unknown. diff --git a/core/lib/multivm/src/versions/vm_1_4_2/implementation/execution.rs b/core/lib/multivm/src/versions/vm_1_4_2/implementation/execution.rs index f81d5de9e5ed..a04e071fe436 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/implementation/execution.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/implementation/execution.rs @@ -1,8 +1,8 @@ use zk_evm_1_4_1::aux_structures::Timestamp; -use zksync_state::WriteStorage; use crate::{ interface::{ + storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, VmExecutionMode, VmExecutionResultAndLogs, VmInterface, }, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/implementation/gas.rs b/core/lib/multivm/src/versions/vm_1_4_2/implementation/gas.rs index bcc53cc7c391..d5b74de94554 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/implementation/gas.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/implementation/gas.rs @@ -1,7 +1,5 @@ -use zksync_state::WriteStorage; - use crate::{ - interface::VmInterface, + interface::{storage::WriteStorage, VmInterface}, vm_1_4_2::{tracers::DefaultExecutionTracer, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_1_4_2/implementation/logs.rs b/core/lib/multivm/src/versions/vm_1_4_2/implementation/logs.rs index 73c0b8c428f8..04acc26467df 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/implementation/logs.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/implementation/logs.rs @@ -1,5 +1,4 @@ use zk_evm_1_4_1::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{ event::extract_l2tol1logs_from_l1_messenger, l2_to_l1_log::{L2ToL1Log, SystemL2ToL1Log, UserL2ToL1Log}, @@ -8,7 +7,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::VmExecutionLogs, + interface::{storage::WriteStorage, VmExecutionLogs}, vm_1_4_2::{old_vm::utils::precompile_calls_count_after_timestamp, utils::logs, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_1_4_2/implementation/snapshots.rs b/core/lib/multivm/src/versions/vm_1_4_2/implementation/snapshots.rs index 93fbd7f51daf..04d4f958712a 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/implementation/snapshots.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/implementation/snapshots.rs @@ -2,9 +2,11 @@ use std::time::Duration; use vise::{Buckets, EncodeLabelSet, EncodeLabelValue, Family, Histogram, Metrics}; use zk_evm_1_4_1::aux_structures::Timestamp; -use zksync_state::WriteStorage; -use crate::vm_1_4_2::{old_vm::oracles::OracleWithHistory, types::internals::VmSnapshot, vm::Vm}; +use crate::{ + interface::storage::WriteStorage, + vm_1_4_2::{old_vm::oracles::OracleWithHistory, types::internals::VmSnapshot, vm::Vm}, +}; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, EncodeLabelSet, EncodeLabelValue)] #[metrics(label = "stage", rename_all = "snake_case")] diff --git a/core/lib/multivm/src/versions/vm_1_4_2/implementation/statistics.rs b/core/lib/multivm/src/versions/vm_1_4_2/implementation/statistics.rs index 3d3649750e3e..4d1675227fbb 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/implementation/statistics.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/implementation/statistics.rs @@ -1,9 +1,8 @@ use zk_evm_1_4_1::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{circuit::CircuitStatistic, U256}; use crate::{ - interface::{VmExecutionStatistics, VmMemoryMetrics}, + interface::{storage::WriteStorage, VmExecutionStatistics, VmMemoryMetrics}, vm_1_4_2::{tracers::DefaultExecutionTracer, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_1_4_2/implementation/tx.rs b/core/lib/multivm/src/versions/vm_1_4_2/implementation/tx.rs index 587b7e687f66..044941221965 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/implementation/tx.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/implementation/tx.rs @@ -1,8 +1,8 @@ use zk_evm_1_4_1::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{l1::is_l1_tx_type, Transaction}; use crate::{ + interface::storage::WriteStorage, vm_1_4_2::{ constants::BOOTLOADER_HEAP_PAGE, implementation::bytecode::{bytecode_to_factory_dep, compress_bytecodes}, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/old_vm/history_recorder.rs b/core/lib/multivm/src/versions/vm_1_4_2/old_vm/history_recorder.rs index b90953bdeca2..d8d32a2b6c50 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/old_vm/history_recorder.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/old_vm/history_recorder.rs @@ -5,10 +5,11 @@ use zk_evm_1_4_1::{ vm_state::PrimitiveValue, zkevm_opcode_defs::{self}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{StorageKey, H256, U256}; use zksync_utils::{h256_to_u256, u256_to_h256}; +use crate::interface::storage::{StoragePtr, WriteStorage}; + pub(crate) type MemoryWithHistory = HistoryRecorder; pub(crate) type IntFrameManagerWithHistory = HistoryRecorder, H>; diff --git a/core/lib/multivm/src/versions/vm_1_4_2/old_vm/oracles/decommitter.rs b/core/lib/multivm/src/versions/vm_1_4_2/old_vm/oracles/decommitter.rs index 1bec6d6df936..706e70d4b116 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/old_vm/oracles/decommitter.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/old_vm/oracles/decommitter.rs @@ -6,13 +6,15 @@ use zk_evm_1_4_1::{ DecommittmentQuery, MemoryIndex, MemoryLocation, MemoryPage, MemoryQuery, Timestamp, }, }; -use zksync_state::{ReadStorage, StoragePtr}; use zksync_types::U256; use zksync_utils::{bytecode::bytecode_len_in_words, bytes_to_be_words, u256_to_h256}; use super::OracleWithHistory; -use crate::vm_1_4_2::old_vm::history_recorder::{ - HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, +use crate::{ + interface::storage::{ReadStorage, StoragePtr}, + vm_1_4_2::old_vm::history_recorder::{ + HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, + }, }; /// The main job of the DecommiterOracle is to implement the DecommittmentProcessor trait - that is /// used by the VM to 'load' bytecodes into memory. diff --git a/core/lib/multivm/src/versions/vm_1_4_2/old_vm/utils.rs b/core/lib/multivm/src/versions/vm_1_4_2/old_vm/utils.rs index 4ea0a526f6e8..24102513fc1d 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/old_vm/utils.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/old_vm/utils.rs @@ -6,10 +6,12 @@ use zk_evm_1_4_1::{ FatPointer, RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }, }; -use zksync_state::WriteStorage; use zksync_types::{Address, U256}; -use crate::vm_1_4_2::{old_vm::memory::SimpleMemory, types::internals::ZkSyncVmState, HistoryMode}; +use crate::{ + interface::storage::WriteStorage, + vm_1_4_2::{old_vm::memory::SimpleMemory, types::internals::ZkSyncVmState, HistoryMode}, +}; #[derive(Debug, Clone)] pub(crate) enum VmExecutionResult { diff --git a/core/lib/multivm/src/versions/vm_1_4_2/oracles/storage.rs b/core/lib/multivm/src/versions/vm_1_4_2/oracles/storage.rs index 9cc9945f84ff..e8d387621907 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/oracles/storage.rs @@ -5,7 +5,6 @@ use zk_evm_1_4_1::{ aux_structures::{LogQuery, Timestamp}, zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ utils::storage_key_for_eth_balance, writes::{ @@ -18,6 +17,7 @@ use zksync_utils::u256_to_h256; use crate::{ glue::GlueInto, + interface::storage::{StoragePtr, WriteStorage}, vm_1_4_2::{ old_vm::{ history_recorder::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tests/get_used_contracts.rs b/core/lib/multivm/src/versions/vm_1_4_2/tests/get_used_contracts.rs index 2ce3891fda8e..cfe3e1bfc235 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tests/get_used_contracts.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tests/get_used_contracts.rs @@ -1,7 +1,7 @@ use std::collections::{HashMap, HashSet}; use itertools::Itertools; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_test_account::Account; use zksync_types::{Execute, U256}; diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tests/is_write_initial.rs b/core/lib/multivm/src/versions/vm_1_4_2/tests/is_write_initial.rs index 035ae5b9c6b2..7da250ef7a9f 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tests/is_write_initial.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tests/is_write_initial.rs @@ -1,4 +1,4 @@ -use zksync_state::ReadStorage; +use crate::interface::storage::ReadStorage; use zksync_types::get_nonce_key; use crate::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tests/l2_blocks.rs b/core/lib/multivm/src/versions/vm_1_4_2/tests/l2_blocks.rs index 2abc6892d602..f722890f474b 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tests/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tests/l2_blocks.rs @@ -4,7 +4,7 @@ //! use zk_evm_1_4_1::aux_structures::Timestamp; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_system_constants::REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_BYTE; use zksync_types::{ block::{pack_block_info, MiniblockHasher}, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tests/rollbacks.rs b/core/lib/multivm/src/versions/vm_1_4_2/tests/rollbacks.rs index 36a891984b95..2ce18cc01361 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tests/rollbacks.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tests/rollbacks.rs @@ -1,6 +1,6 @@ use ethabi::Token; use zksync_contracts::{get_loadnext_contract, test_contracts::LoadnextContractExecutionParams}; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_types::{get_nonce_key, Execute, U256}; use crate::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tests/tester/inner_state.rs b/core/lib/multivm/src/versions/vm_1_4_2/tests/tester/inner_state.rs index 1553fbfc9f51..d6c072d1b1ed 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tests/tester/inner_state.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tests/tester/inner_state.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use zk_evm_1_4_1::{aux_structures::Timestamp, vm_state::VmLocalState}; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_types::{StorageKey, StorageValue, U256}; use crate::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tests/tester/vm_tester.rs b/core/lib/multivm/src/versions/vm_1_4_2/tests/tester/vm_tester.rs index c27df9148b17..44f861f8d331 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tests/tester/vm_tester.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tests/tester/vm_tester.rs @@ -1,7 +1,7 @@ use std::marker::PhantomData; use zksync_contracts::BaseSystemContracts; -use zksync_state::{InMemoryStorage, StoragePtr, StorageView, WriteStorage}; +use crate::interface::storage::{InMemoryStorage, StoragePtr, StorageView, WriteStorage}; use zksync_types::{ block::MiniblockHasher, fee_model::BatchFeeInput, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tests/upgrade.rs b/core/lib/multivm/src/versions/vm_1_4_2/tests/upgrade.rs index 1c64ee766ed5..2af2928b1c44 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tests/upgrade.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tests/upgrade.rs @@ -1,6 +1,6 @@ use zk_evm_1_4_1::aux_structures::Timestamp; use zksync_contracts::{deployer_contract, load_sys_contract, read_bytecode}; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_test_account::TxType; use zksync_types::{ ethabi::{Contract, Token}, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tests/utils.rs b/core/lib/multivm/src/versions/vm_1_4_2/tests/utils.rs index 306953bab28e..5655e90fb4ee 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tests/utils.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tests/utils.rs @@ -3,7 +3,7 @@ use once_cell::sync::Lazy; use zksync_contracts::{ load_contract, read_bytecode, read_zbin_bytecode, BaseSystemContracts, SystemContractCode, }; -use zksync_state::{StoragePtr, WriteStorage}; +use crate::interface::storage::{StoragePtr, WriteStorage}; use zksync_types::{ utils::storage_key_for_standard_token_balance, AccountTreeId, Address, StorageKey, H256, U256, }; diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_tracer.rs index f4045b53dd87..dfc381016d01 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_tracer.rs @@ -5,12 +5,15 @@ use zk_evm_1_4_1::{ zk_evm_abstractions::precompiles::PrecompileAddress, zkevm_opcode_defs::{LogOpcode, Opcode, UMAOpcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::circuit::CircuitCycleStatistic; use super::circuits_capacity::*; use crate::{ - interface::{dyn_tracers::vm_1_4_1::DynTracer, tracer::TracerExecutionStatus}, + interface::{ + dyn_tracers::vm_1_4_1::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::TracerExecutionStatus, + }, vm_1_4_2::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs index 1b225b35f52d..4fa3e229a674 100755 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs @@ -12,12 +12,12 @@ use zk_evm_1_4_1::{ witness_trace::DummyTracer, zkevm_opcode_defs::{decoding::EncodingModeProduction, Opcode, RetOpcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use super::PubdataTracer; use crate::{ glue::GlueInto, interface::{ + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, Halt, VmExecutionMode, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/dispatcher.rs index 36a8ad954f2a..d4d58d32b685 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/dispatcher.rs @@ -1,11 +1,11 @@ use zk_evm_1_4_1::tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, VmLocalStateData, }; -use zksync_state::{StoragePtr, WriteStorage}; use crate::{ interface::{ dyn_tracers::vm_1_4_1::DynTracer, + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, vm_1_4_2::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs index f22e323cbbac..8e0f7b740584 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs @@ -5,7 +5,6 @@ use zk_evm_1_4_1::{ aux_structures::Timestamp, tracing::{BeforeExecutionData, VmLocalStateData}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ event::{ extract_bytecode_publication_requests_from_l1_messenger, @@ -19,6 +18,7 @@ use zksync_utils::{h256_to_u256, u256_to_bytes_be, u256_to_h256}; use crate::{ interface::{ dyn_tracers::vm_1_4_1::DynTracer, + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, L1BatchEnv, VmExecutionMode, }, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs index 82f2bba02731..950ac0be9748 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs @@ -7,7 +7,6 @@ use zk_evm_1_4_1::{ vm_state::VmLocalState, zkevm_opcode_defs::system_params::L1_MESSAGE_PUBDATA_BYTES, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::{PUBLISH_BYTECODE_OVERHEAD, SYSTEM_CONTEXT_ADDRESS}; use zksync_types::{ event::{extract_long_l2_to_l1_messages, extract_published_bytecodes}, @@ -18,7 +17,9 @@ use zksync_utils::{bytecode::bytecode_len_in_bytes, ceil_div_u256, u256_to_h256} use crate::{ interface::{ - tracer::TracerExecutionStatus, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::TracerExecutionStatus, + traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, L1BatchEnv, Refunds, }, vm_1_4_2::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs index 32b890389d27..6fff033533d6 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs @@ -5,11 +5,11 @@ use zk_evm_1_4_1::{ vm_state::{ErrorFlags, VmLocalState}, zkevm_opcode_defs::FatPointer, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::U256; use crate::{ interface::{ + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStopReason, VmExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/traits.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/traits.rs index 156cfa04f9fc..02e2848eeb7e 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/traits.rs @@ -1,8 +1,7 @@ -use zksync_state::WriteStorage; - use crate::{ interface::{ dyn_tracers::vm_1_4_1::DynTracer, + storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, vm_1_4_2::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_2/types/internals/vm_state.rs b/core/lib/multivm/src/versions/vm_1_4_2/types/internals/vm_state.rs index 3190687fa683..87630a1ff372 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/types/internals/vm_state.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/types/internals/vm_state.rs @@ -10,13 +10,15 @@ use zk_evm_1_4_1::{ STARTING_BASE_PAGE, STARTING_TIMESTAMP, }, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::BOOTLOADER_ADDRESS; use zksync_types::{block::L2BlockHasher, Address, L2BlockNumber}; use zksync_utils::h256_to_u256; use crate::{ - interface::{L1BatchEnv, L2Block, SystemEnv}, + interface::{ + storage::{StoragePtr, WriteStorage}, + L1BatchEnv, L2Block, SystemEnv, + }, vm_1_4_2::{ bootloader_state::BootloaderState, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/utils/l2_blocks.rs b/core/lib/multivm/src/versions/vm_1_4_2/utils/l2_blocks.rs index ec30a86013b9..ff5536ae0b97 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/utils/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/utils/l2_blocks.rs @@ -1,4 +1,3 @@ -use zksync_state::{ReadStorage, StoragePtr}; use zksync_system_constants::{ SYSTEM_CONTEXT_ADDRESS, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION, SYSTEM_CONTEXT_CURRENT_TX_ROLLING_HASH_POSITION, @@ -9,7 +8,10 @@ use zksync_types::{ }; use zksync_utils::{h256_to_u256, u256_to_h256}; -use crate::interface::{L2Block, L2BlockEnv}; +use crate::interface::{ + storage::{ReadStorage, StoragePtr}, + L2Block, L2BlockEnv, +}; pub(crate) fn get_l2_block_hash_key(block_number: u32) -> StorageKey { let position = h256_to_u256(SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION) diff --git a/core/lib/multivm/src/versions/vm_1_4_2/utils/logs.rs b/core/lib/multivm/src/versions/vm_1_4_2/utils/logs.rs index ef9f124773be..48832f0ecf2a 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/utils/logs.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/utils/logs.rs @@ -1,10 +1,9 @@ use zk_evm_1_4_1::aux_structures::{LogQuery, Timestamp}; -use zksync_state::WriteStorage; use zksync_types::{l2_to_l1_log::L2ToL1Log, StorageLogKind, VmEvent}; use crate::{ glue::GlueInto, - interface::L1BatchEnv, + interface::{storage::WriteStorage, L1BatchEnv}, vm_1_4_2::{ old_vm::{events::merge_events, history_recorder::HistoryMode}, types::internals::ZkSyncVmState, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/vm.rs b/core/lib/multivm/src/versions/vm_1_4_2/vm.rs index 264ebde5611d..434e8ea1c42c 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/vm.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/vm.rs @@ -1,5 +1,4 @@ use circuit_sequencer_api_1_4_2::sort_storage_access::sort_storage_access_queries; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ event::extract_l2tol1logs_from_l1_messenger, l2_to_l1_log::{SystemL2ToL1Log, UserL2ToL1Log}, @@ -10,6 +9,7 @@ use zksync_utils::bytecode::CompressedBytecodeInfo; use crate::{ glue::GlueInto, interface::{ + storage::{StoragePtr, WriteStorage}, BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, FinishedL1Batch, L1BatchEnv, L2BlockEnv, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/bytecode.rs b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/bytecode.rs index 2e3770a9c52e..00ff620727b6 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/bytecode.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/bytecode.rs @@ -1,12 +1,18 @@ use itertools::Itertools; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::U256; use zksync_utils::{ bytecode::{compress_bytecode, hash_bytecode, CompressedBytecodeInfo}, bytes_to_be_words, }; -use crate::{interface::VmInterface, vm_boojum_integration::Vm, HistoryMode}; +use crate::{ + interface::{ + storage::{StoragePtr, WriteStorage}, + VmInterface, + }, + vm_boojum_integration::Vm, + HistoryMode, +}; impl Vm { /// Checks the last transaction has successfully published compressed bytecodes and returns `true` if there is at least one is still unknown. diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/execution.rs b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/execution.rs index 085b42c84dbd..664cb90531e4 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/execution.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/execution.rs @@ -1,8 +1,8 @@ use zk_evm_1_4_0::aux_structures::Timestamp; -use zksync_state::WriteStorage; use crate::{ interface::{ + storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, VmExecutionMode, VmExecutionResultAndLogs, VmInterface, }, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/gas.rs b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/gas.rs index 304b7a3b7564..b31e4c3536bc 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/gas.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/gas.rs @@ -1,7 +1,5 @@ -use zksync_state::WriteStorage; - use crate::{ - interface::VmInterface, + interface::{storage::WriteStorage, VmInterface}, vm_boojum_integration::{tracers::DefaultExecutionTracer, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/logs.rs b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/logs.rs index b9f354f835e1..fa4600893021 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/logs.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/logs.rs @@ -1,5 +1,4 @@ use zk_evm_1_4_0::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{ event::extract_l2tol1logs_from_l1_messenger, l2_to_l1_log::{L2ToL1Log, SystemL2ToL1Log, UserL2ToL1Log}, @@ -8,7 +7,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::VmExecutionLogs, + interface::{storage::WriteStorage, VmExecutionLogs}, vm_boojum_integration::{ old_vm::utils::precompile_calls_count_after_timestamp, utils::logs, vm::Vm, }, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/snapshots.rs b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/snapshots.rs index b5b09c0fd6d2..b581cea558b2 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/snapshots.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/snapshots.rs @@ -2,10 +2,12 @@ use std::time::Duration; use vise::{Buckets, EncodeLabelSet, EncodeLabelValue, Family, Histogram, Metrics}; use zk_evm_1_4_0::aux_structures::Timestamp; -use zksync_state::WriteStorage; -use crate::vm_boojum_integration::{ - old_vm::oracles::OracleWithHistory, types::internals::VmSnapshot, vm::Vm, +use crate::{ + interface::storage::WriteStorage, + vm_boojum_integration::{ + old_vm::oracles::OracleWithHistory, types::internals::VmSnapshot, vm::Vm, + }, }; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, EncodeLabelSet, EncodeLabelValue)] diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/statistics.rs b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/statistics.rs index 744ac6d40978..fe5b8abd6834 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/statistics.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/statistics.rs @@ -1,9 +1,8 @@ use zk_evm_1_4_0::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{circuit::CircuitStatistic, U256}; use crate::{ - interface::{VmExecutionStatistics, VmMemoryMetrics}, + interface::{storage::WriteStorage, VmExecutionStatistics, VmMemoryMetrics}, vm_boojum_integration::{tracers::DefaultExecutionTracer, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/tx.rs b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/tx.rs index 9eac3e749837..73d689e089e5 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/implementation/tx.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/implementation/tx.rs @@ -1,8 +1,8 @@ use zk_evm_1_4_0::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{l1::is_l1_tx_type, Transaction}; use crate::{ + interface::storage::WriteStorage, vm_boojum_integration::{ constants::BOOTLOADER_HEAP_PAGE, implementation::bytecode::{bytecode_to_factory_dep, compress_bytecodes}, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/history_recorder.rs b/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/history_recorder.rs index 90d0c868ea33..704a774893d3 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/history_recorder.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/history_recorder.rs @@ -5,10 +5,11 @@ use zk_evm_1_4_0::{ vm_state::PrimitiveValue, zkevm_opcode_defs::{self}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{StorageKey, U256}; use zksync_utils::{h256_to_u256, u256_to_h256}; +use crate::interface::storage::{StoragePtr, WriteStorage}; + pub(crate) type MemoryWithHistory = HistoryRecorder; pub(crate) type IntFrameManagerWithHistory = HistoryRecorder, H>; diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/oracles/decommitter.rs b/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/oracles/decommitter.rs index 6ff63e17ce00..eb7db7097920 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/oracles/decommitter.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/oracles/decommitter.rs @@ -6,13 +6,15 @@ use zk_evm_1_4_0::{ DecommittmentQuery, MemoryIndex, MemoryLocation, MemoryPage, MemoryQuery, Timestamp, }, }; -use zksync_state::{ReadStorage, StoragePtr}; use zksync_types::U256; use zksync_utils::{bytecode::bytecode_len_in_words, bytes_to_be_words, u256_to_h256}; use super::OracleWithHistory; -use crate::vm_boojum_integration::old_vm::history_recorder::{ - HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, +use crate::{ + interface::storage::{ReadStorage, StoragePtr}, + vm_boojum_integration::old_vm::history_recorder::{ + HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, + }, }; /// The main job of the DecommiterOracle is to implement the DecommitmentProcessor trait - that is diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/oracles/storage.rs b/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/oracles/storage.rs index 1c14706de87a..db99273076ed 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/oracles/storage.rs @@ -12,7 +12,7 @@ use zk_evm_1_4_0::{ aux_structures::{LogQuery, Timestamp}, }; -use zksync_state::{StoragePtr, WriteStorage}; +use crate::interface::storage::{StoragePtr, WriteStorage}; use zksync_types::utils::storage_key_for_eth_balance; use zksync_types::{ AccountTreeId, Address, StorageKey, StorageLogQuery, StorageLogQueryType, BOOTLOADER_ADDRESS, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/utils.rs b/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/utils.rs index 130bad49e38a..2dcbe3284639 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/utils.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/old_vm/utils.rs @@ -6,12 +6,14 @@ use zk_evm_1_4_0::{ FatPointer, RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }, }; -use zksync_state::WriteStorage; use zksync_system_constants::L1_GAS_PER_PUBDATA_BYTE; use zksync_types::{Address, U256}; -use crate::vm_boojum_integration::{ - old_vm::memory::SimpleMemory, types::internals::ZkSyncVmState, HistoryMode, +use crate::{ + interface::storage::WriteStorage, + vm_boojum_integration::{ + old_vm::memory::SimpleMemory, types::internals::ZkSyncVmState, HistoryMode, + }, }; #[derive(Debug, Clone)] diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/oracles/storage.rs b/core/lib/multivm/src/versions/vm_boojum_integration/oracles/storage.rs index e505c2d9630c..acdfbaaa42e0 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/oracles/storage.rs @@ -5,7 +5,6 @@ use zk_evm_1_4_0::{ aux_structures::{LogQuery, Timestamp}, zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ utils::storage_key_for_eth_balance, writes::{ @@ -16,15 +15,18 @@ use zksync_types::{ }; use zksync_utils::u256_to_h256; -use crate::vm_boojum_integration::{ - old_vm::{ - history_recorder::{ - AppDataFrameManagerWithHistory, HashMapHistoryEvent, HistoryEnabled, HistoryMode, - HistoryRecorder, StorageWrapper, VectorHistoryEvent, WithHistory, +use crate::{ + interface::storage::{StoragePtr, WriteStorage}, + vm_boojum_integration::{ + old_vm::{ + history_recorder::{ + AppDataFrameManagerWithHistory, HashMapHistoryEvent, HistoryEnabled, HistoryMode, + HistoryRecorder, StorageWrapper, VectorHistoryEvent, WithHistory, + }, + oracles::OracleWithHistory, }, - oracles::OracleWithHistory, + utils::logs::StorageLogQuery, }, - utils::logs::StorageLogQuery, }; // While the storage does not support different shards, it was decided to write the diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tests/get_used_contracts.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tests/get_used_contracts.rs index 25aab0871f14..658bcd75b059 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tests/get_used_contracts.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tests/get_used_contracts.rs @@ -1,7 +1,7 @@ use std::collections::{HashMap, HashSet}; use itertools::Itertools; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_test_account::Account; use zksync_types::{Execute, U256}; diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tests/is_write_initial.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tests/is_write_initial.rs index bf56aa2b816d..67901490edfa 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tests/is_write_initial.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tests/is_write_initial.rs @@ -1,4 +1,4 @@ -use zksync_state::ReadStorage; +use crate::interface::storage::ReadStorage; use zksync_types::get_nonce_key; use crate::{ diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tests/l2_blocks.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tests/l2_blocks.rs index b26cc09e0577..d637d583c0ec 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tests/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tests/l2_blocks.rs @@ -4,7 +4,7 @@ //! use zk_evm_1_4_0::aux_structures::Timestamp; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_system_constants::REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_BYTE; use zksync_types::{ block::{pack_block_info, MiniblockHasher}, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tests/rollbacks.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tests/rollbacks.rs index 3d3127f8428b..cfaf1952c702 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tests/rollbacks.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tests/rollbacks.rs @@ -1,6 +1,6 @@ use ethabi::Token; use zksync_contracts::{get_loadnext_contract, test_contracts::LoadnextContractExecutionParams}; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_types::{get_nonce_key, Execute, U256}; use crate::{ diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tests/tester/inner_state.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tests/tester/inner_state.rs index 24f31c5a9393..078a971e4bf1 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tests/tester/inner_state.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tests/tester/inner_state.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use zk_evm_1_4_0::{aux_structures::Timestamp, vm_state::VmLocalState}; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_types::{StorageKey, StorageLogQuery, StorageValue, U256}; use crate::{ diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tests/tester/vm_tester.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tests/tester/vm_tester.rs index 30bf9535eb8b..fcea03e12cc8 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tests/tester/vm_tester.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tests/tester/vm_tester.rs @@ -1,7 +1,7 @@ use std::marker::PhantomData; use zksync_contracts::BaseSystemContracts; -use zksync_state::{InMemoryStorage, StoragePtr, StorageView, WriteStorage}; +use crate::interface::storage::{InMemoryStorage, StoragePtr, StorageView, WriteStorage}; use zksync_types::{ block::MiniblockHasher, get_code_key, get_is_account_key, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tests/upgrade.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tests/upgrade.rs index 4442d7c4082d..bc3d62f62a19 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tests/upgrade.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tests/upgrade.rs @@ -1,6 +1,6 @@ use zk_evm_1_4_0::aux_structures::Timestamp; use zksync_contracts::{deployer_contract, load_contract, load_sys_contract, read_bytecode}; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_test_account::TxType; use zksync_types::{ ethabi::{Contract, Token}, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tests/utils.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tests/utils.rs index 2dd8e2350eb4..4fba188ac5b7 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tests/utils.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tests/utils.rs @@ -3,7 +3,7 @@ use once_cell::sync::Lazy; use zksync_contracts::{ load_contract, read_bytecode, read_zbin_bytecode, BaseSystemContracts, SystemContractCode, }; -use zksync_state::{StoragePtr, WriteStorage}; +use crate::interface::storage::{StoragePtr, WriteStorage}; use zksync_types::{ utils::storage_key_for_standard_token_balance, AccountTreeId, Address, StorageKey, H256, U256, }; diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_tracer.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_tracer.rs index 27f4cc6db00f..396bbb50769c 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_tracer.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_tracer.rs @@ -5,12 +5,15 @@ use zk_evm_1_4_0::{ zk_evm_abstractions::precompiles::PrecompileAddress, zkevm_opcode_defs::{LogOpcode, Opcode, UMAOpcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::circuit::CircuitCycleStatistic; use super::circuits_capacity::*; use crate::{ - interface::{dyn_tracers::vm_1_4_0::DynTracer, tracer::TracerExecutionStatus}, + interface::{ + dyn_tracers::vm_1_4_0::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::TracerExecutionStatus, + }, vm_boojum_integration::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs index abe14a184e78..4fb3ab3841e5 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs @@ -12,11 +12,11 @@ use zk_evm_1_4_0::{ witness_trace::DummyTracer, zkevm_opcode_defs::{decoding::EncodingModeProduction, Opcode, RetOpcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use super::PubdataTracer; use crate::{ interface::{ + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, Halt, VmExecutionMode, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/dispatcher.rs index 11262c4d7665..268c3c7c6899 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/dispatcher.rs @@ -1,11 +1,11 @@ use zk_evm_1_4_0::tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, VmLocalStateData, }; -use zksync_state::{StoragePtr, WriteStorage}; use crate::{ interface::{ dyn_tracers::vm_1_4_0::DynTracer, + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, vm_boojum_integration::{ diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs index 20ae7ca965c7..8c259cfa546c 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs @@ -5,7 +5,6 @@ use zk_evm_1_4_0::{ aux_structures::Timestamp, tracing::{BeforeExecutionData, VmLocalStateData}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ event::{ extract_bytecode_publication_requests_from_l1_messenger, @@ -19,6 +18,7 @@ use zksync_utils::{h256_to_u256, u256_to_bytes_be, u256_to_h256}; use crate::{ interface::{ dyn_tracers::vm_1_4_0::DynTracer, + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, L1BatchEnv, VmExecutionMode, }, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs index ed6dc79986e9..bd65aa9df796 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs @@ -6,7 +6,6 @@ use zk_evm_1_4_0::{ tracing::{BeforeExecutionData, VmLocalStateData}, vm_state::VmLocalState, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::{PUBLISH_BYTECODE_OVERHEAD, SYSTEM_CONTEXT_ADDRESS}; use zksync_types::{ event::{extract_long_l2_to_l1_messages, extract_published_bytecodes}, @@ -17,7 +16,9 @@ use zksync_utils::{bytecode::bytecode_len_in_bytes, ceil_div_u256, u256_to_h256} use crate::{ interface::{ - tracer::TracerExecutionStatus, traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::TracerExecutionStatus, + traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, L1BatchEnv, Refunds, }, vm_boojum_integration::{ diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs index 11b77bd5b0a8..5ee123d7084d 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs @@ -5,11 +5,11 @@ use zk_evm_1_4_0::{ vm_state::{ErrorFlags, VmLocalState}, zkevm_opcode_defs::FatPointer, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::U256; use crate::{ interface::{ + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStopReason, VmExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/traits.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/traits.rs index 767f45c6050a..0a7788573047 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/traits.rs @@ -1,8 +1,7 @@ -use zksync_state::WriteStorage; - use crate::{ interface::{ dyn_tracers::vm_1_4_0::DynTracer, + storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, vm_boojum_integration::{ diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/types/internals/vm_state.rs b/core/lib/multivm/src/versions/vm_boojum_integration/types/internals/vm_state.rs index 75c6e89ee7d8..5b6b9b2eca17 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/types/internals/vm_state.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/types/internals/vm_state.rs @@ -10,13 +10,15 @@ use zk_evm_1_4_0::{ STARTING_BASE_PAGE, STARTING_TIMESTAMP, }, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::BOOTLOADER_ADDRESS; use zksync_types::{block::L2BlockHasher, Address, L2BlockNumber}; use zksync_utils::h256_to_u256; use crate::{ - interface::{L1BatchEnv, L2Block, SystemEnv}, + interface::{ + storage::{StoragePtr, WriteStorage}, + L1BatchEnv, L2Block, SystemEnv, + }, vm_boojum_integration::{ bootloader_state::BootloaderState, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/utils/l2_blocks.rs b/core/lib/multivm/src/versions/vm_boojum_integration/utils/l2_blocks.rs index ec30a86013b9..ff5536ae0b97 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/utils/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/utils/l2_blocks.rs @@ -1,4 +1,3 @@ -use zksync_state::{ReadStorage, StoragePtr}; use zksync_system_constants::{ SYSTEM_CONTEXT_ADDRESS, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION, SYSTEM_CONTEXT_CURRENT_TX_ROLLING_HASH_POSITION, @@ -9,7 +8,10 @@ use zksync_types::{ }; use zksync_utils::{h256_to_u256, u256_to_h256}; -use crate::interface::{L2Block, L2BlockEnv}; +use crate::interface::{ + storage::{ReadStorage, StoragePtr}, + L2Block, L2BlockEnv, +}; pub(crate) fn get_l2_block_hash_key(block_number: u32) -> StorageKey { let position = h256_to_u256(SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION) diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/utils/logs.rs b/core/lib/multivm/src/versions/vm_boojum_integration/utils/logs.rs index bc15f88c5437..f26cea2f2f53 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/utils/logs.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/utils/logs.rs @@ -1,11 +1,10 @@ use zk_evm_1_3_3::aux_structures::LogQuery; use zk_evm_1_4_0::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{l2_to_l1_log::L2ToL1Log, StorageLogKind, VmEvent}; use crate::{ glue::GlueInto, - interface::L1BatchEnv, + interface::{storage::WriteStorage, L1BatchEnv}, vm_boojum_integration::{ old_vm::{events::merge_events, history_recorder::HistoryMode}, types::internals::ZkSyncVmState, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/vm.rs b/core/lib/multivm/src/versions/vm_boojum_integration/vm.rs index 90cea403084c..1e9f73be5987 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/vm.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/vm.rs @@ -1,5 +1,4 @@ use circuit_sequencer_api_1_4_0::sort_storage_access::sort_storage_access_queries; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ event::extract_l2tol1logs_from_l1_messenger, l2_to_l1_log::{SystemL2ToL1Log, UserL2ToL1Log}, @@ -10,6 +9,7 @@ use zksync_utils::bytecode::CompressedBytecodeInfo; use crate::{ glue::GlueInto, interface::{ + storage::{StoragePtr, WriteStorage}, BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, FinishedL1Batch, L1BatchEnv, L2BlockEnv, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, diff --git a/core/lib/multivm/src/versions/vm_fast/bytecode.rs b/core/lib/multivm/src/versions/vm_fast/bytecode.rs index 7a16b5940df6..3507b84840e8 100644 --- a/core/lib/multivm/src/versions/vm_fast/bytecode.rs +++ b/core/lib/multivm/src/versions/vm_fast/bytecode.rs @@ -1,5 +1,4 @@ use itertools::Itertools; -use zksync_state::ReadStorage; use zksync_types::H256; use zksync_utils::{ bytecode::{compress_bytecode, hash_bytecode, CompressedBytecodeInfo}, @@ -7,6 +6,7 @@ use zksync_utils::{ }; use super::Vm; +use crate::interface::storage::ReadStorage; impl Vm { /// Checks the last transaction has successfully published compressed bytecodes and returns `true` if there is at least one is still unknown. diff --git a/core/lib/multivm/src/versions/vm_fast/tests/get_used_contracts.rs b/core/lib/multivm/src/versions/vm_fast/tests/get_used_contracts.rs index af90566671ee..1bfc2f8ff11f 100644 --- a/core/lib/multivm/src/versions/vm_fast/tests/get_used_contracts.rs +++ b/core/lib/multivm/src/versions/vm_fast/tests/get_used_contracts.rs @@ -1,14 +1,13 @@ use std::collections::HashSet; use itertools::Itertools; -use zksync_state::ReadStorage; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_test_account::Account; use zksync_types::{Execute, U256}; use zksync_utils::{bytecode::hash_bytecode, h256_to_u256}; use crate::{ - interface::{TxExecutionMode, VmExecutionMode, VmInterface}, + interface::{storage::ReadStorage, TxExecutionMode, VmExecutionMode, VmInterface}, vm_fast::{ tests::{ tester::{TxType, VmTesterBuilder}, diff --git a/core/lib/multivm/src/versions/vm_fast/tests/is_write_initial.rs b/core/lib/multivm/src/versions/vm_fast/tests/is_write_initial.rs index 0bbf633254eb..ff97c0389aa9 100644 --- a/core/lib/multivm/src/versions/vm_fast/tests/is_write_initial.rs +++ b/core/lib/multivm/src/versions/vm_fast/tests/is_write_initial.rs @@ -1,8 +1,7 @@ -use zksync_state::ReadStorage; use zksync_types::get_nonce_key; use crate::{ - interface::{TxExecutionMode, VmExecutionMode, VmInterface}, + interface::{storage::ReadStorage, TxExecutionMode, VmExecutionMode, VmInterface}, vm_fast::tests::{ tester::{Account, TxType, VmTesterBuilder}, utils::read_test_contract, diff --git a/core/lib/multivm/src/versions/vm_fast/tests/l2_blocks.rs b/core/lib/multivm/src/versions/vm_fast/tests/l2_blocks.rs index 1f9d0aaff091..6ff5ed426cba 100644 --- a/core/lib/multivm/src/versions/vm_fast/tests/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_fast/tests/l2_blocks.rs @@ -3,7 +3,6 @@ //! The description for each of the tests can be found in the corresponding `.yul` file. //! -use zksync_state::ReadStorage; use zksync_system_constants::REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_BYTE; use zksync_types::{ block::{pack_block_info, L2BlockHasher}, @@ -15,7 +14,10 @@ use zksync_types::{ use zksync_utils::{h256_to_u256, u256_to_h256}; use crate::{ - interface::{ExecutionResult, Halt, L2BlockEnv, TxExecutionMode, VmExecutionMode, VmInterface}, + interface::{ + storage::ReadStorage, ExecutionResult, Halt, L2BlockEnv, TxExecutionMode, VmExecutionMode, + VmInterface, + }, vm_fast::{ tests::tester::{default_l1_batch, VmTesterBuilder}, vm::Vm, diff --git a/core/lib/multivm/src/versions/vm_fast/tests/require_eip712.rs b/core/lib/multivm/src/versions/vm_fast/tests/require_eip712.rs index 7e378a2b62c4..352e709b7043 100644 --- a/core/lib/multivm/src/versions/vm_fast/tests/require_eip712.rs +++ b/core/lib/multivm/src/versions/vm_fast/tests/require_eip712.rs @@ -1,6 +1,5 @@ use ethabi::Token; use zksync_eth_signer::{EthereumSigner, TransactionParameters}; -use zksync_state::ReadStorage; use zksync_system_constants::L2_BASE_TOKEN_ADDRESS; use zksync_types::{ fee::Fee, l2::L2Tx, transaction_request::TransactionRequest, @@ -10,7 +9,7 @@ use zksync_types::{ use zksync_utils::h256_to_u256; use crate::{ - interface::{TxExecutionMode, VmExecutionMode, VmInterface}, + interface::{storage::ReadStorage, TxExecutionMode, VmExecutionMode, VmInterface}, vm_fast::tests::{ tester::{Account, VmTester, VmTesterBuilder}, utils::read_many_owners_custom_account_contract, diff --git a/core/lib/multivm/src/versions/vm_fast/tests/tester/transaction_test_info.rs b/core/lib/multivm/src/versions/vm_fast/tests/tester/transaction_test_info.rs index 9bb013542c7d..562a8a6a6bdd 100644 --- a/core/lib/multivm/src/versions/vm_fast/tests/tester/transaction_test_info.rs +++ b/core/lib/multivm/src/versions/vm_fast/tests/tester/transaction_test_info.rs @@ -1,11 +1,11 @@ -use zksync_state::ReadStorage; use zksync_types::{ExecuteTransactionCommon, Transaction, H160, U256}; use super::VmTester; use crate::{ interface::{ - CurrentExecutionState, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, - VmExecutionResultAndLogs, VmInterface, VmInterfaceHistoryEnabled, VmRevertReason, + storage::ReadStorage, CurrentExecutionState, ExecutionResult, Halt, TxRevertReason, + VmExecutionMode, VmExecutionResultAndLogs, VmInterface, VmInterfaceHistoryEnabled, + VmRevertReason, }, vm_fast::Vm, }; diff --git a/core/lib/multivm/src/versions/vm_fast/tests/tester/vm_tester.rs b/core/lib/multivm/src/versions/vm_fast/tests/tester/vm_tester.rs index 7715dd0a6d49..efab73aed1df 100644 --- a/core/lib/multivm/src/versions/vm_fast/tests/tester/vm_tester.rs +++ b/core/lib/multivm/src/versions/vm_fast/tests/tester/vm_tester.rs @@ -2,7 +2,6 @@ use std::{cell::RefCell, rc::Rc}; use vm2::WorldDiff; use zksync_contracts::BaseSystemContracts; -use zksync_state::{InMemoryStorage, StoragePtr}; use zksync_test_account::{Account, TxType}; use zksync_types::{ block::L2BlockHasher, @@ -17,6 +16,7 @@ use zksync_utils::{bytecode::hash_bytecode, u256_to_h256}; use crate::{ interface::{ + storage::{InMemoryStorage, StoragePtr}, L1BatchEnv, L2Block, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode, VmInterface, }, versions::vm_fast::{tests::utils::read_test_contract, vm::Vm}, diff --git a/core/lib/multivm/src/versions/vm_fast/tests/utils.rs b/core/lib/multivm/src/versions/vm_fast/tests/utils.rs index 0a72667bd80e..6b17e66f2616 100644 --- a/core/lib/multivm/src/versions/vm_fast/tests/utils.rs +++ b/core/lib/multivm/src/versions/vm_fast/tests/utils.rs @@ -6,13 +6,14 @@ use vm2::{instruction_handlers::HeapInterface, HeapId, State}; use zksync_contracts::{ load_contract, read_bytecode, read_zbin_bytecode, BaseSystemContracts, SystemContractCode, }; -use zksync_state::ReadStorage; use zksync_types::{ utils::storage_key_for_standard_token_balance, AccountTreeId, Address, StorageKey, H160, H256, U256, }; use zksync_utils::{bytecode::hash_bytecode, bytes_to_be_words, h256_to_u256, u256_to_h256}; +use crate::interface::storage::ReadStorage; + pub(crate) static BASE_SYSTEM_CONTRACTS: Lazy = Lazy::new(BaseSystemContracts::load_from_disk); diff --git a/core/lib/multivm/src/versions/vm_fast/vm.rs b/core/lib/multivm/src/versions/vm_fast/vm.rs index db56d878702e..56d98a537bf5 100644 --- a/core/lib/multivm/src/versions/vm_fast/vm.rs +++ b/core/lib/multivm/src/versions/vm_fast/vm.rs @@ -6,7 +6,6 @@ use vm2::{ }; use zk_evm_1_5_0::zkevm_opcode_defs::system_params::INITIAL_FRAME_FORMAL_EH_LOCATION; use zksync_contracts::SystemContractCode; -use zksync_state::ReadStorage; use zksync_types::{ event::{ extract_l2tol1logs_from_l1_messenger, extract_long_l2_to_l1_messages, @@ -35,10 +34,11 @@ use super::{ use crate::{ glue::GlueInto, interface::{ - BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, ExecutionResult, - FinishedL1Batch, Halt, L1BatchEnv, L2BlockEnv, Refunds, SystemEnv, TxRevertReason, - VmExecutionLogs, VmExecutionMode, VmExecutionResultAndLogs, VmExecutionStatistics, - VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, VmRevertReason, + storage::ReadStorage, BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, + ExecutionResult, FinishedL1Batch, Halt, L1BatchEnv, L2BlockEnv, Refunds, SystemEnv, + TxRevertReason, VmExecutionLogs, VmExecutionMode, VmExecutionResultAndLogs, + VmExecutionStatistics, VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, + VmRevertReason, }, vm_fast::{ bootloader_state::utils::{apply_l2_block, apply_pubdata_to_memory}, diff --git a/core/lib/multivm/src/versions/vm_latest/implementation/bytecode.rs b/core/lib/multivm/src/versions/vm_latest/implementation/bytecode.rs index bda1803067fb..30a428bb834e 100644 --- a/core/lib/multivm/src/versions/vm_latest/implementation/bytecode.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/bytecode.rs @@ -1,12 +1,18 @@ use itertools::Itertools; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::U256; use zksync_utils::{ bytecode::{compress_bytecode, hash_bytecode, CompressedBytecodeInfo}, bytes_to_be_words, }; -use crate::{interface::VmInterface, vm_latest::Vm, HistoryMode}; +use crate::{ + interface::{ + storage::{StoragePtr, WriteStorage}, + VmInterface, + }, + vm_latest::Vm, + HistoryMode, +}; impl Vm { /// Checks the last transaction has successfully published compressed bytecodes and returns `true` if there is at least one is still unknown. diff --git a/core/lib/multivm/src/versions/vm_latest/implementation/execution.rs b/core/lib/multivm/src/versions/vm_latest/implementation/execution.rs index 5a92a3211c76..4676fd82d5e2 100644 --- a/core/lib/multivm/src/versions/vm_latest/implementation/execution.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/execution.rs @@ -1,8 +1,8 @@ use zk_evm_1_5_0::aux_structures::Timestamp; -use zksync_state::WriteStorage; use crate::{ interface::{ + storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, VmExecutionMode, VmExecutionResultAndLogs, VmInterface, }, diff --git a/core/lib/multivm/src/versions/vm_latest/implementation/gas.rs b/core/lib/multivm/src/versions/vm_latest/implementation/gas.rs index 40cedb60a394..1e33eecf6325 100644 --- a/core/lib/multivm/src/versions/vm_latest/implementation/gas.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/gas.rs @@ -1,6 +1,8 @@ -use zksync_state::WriteStorage; - -use crate::{interface::VmInterface, vm_latest::vm::Vm, HistoryMode}; +use crate::{ + interface::{storage::WriteStorage, VmInterface}, + vm_latest::vm::Vm, + HistoryMode, +}; impl Vm { pub(crate) fn calculate_computational_gas_used(&self, gas_remaining_before: u32) -> u32 { diff --git a/core/lib/multivm/src/versions/vm_latest/implementation/logs.rs b/core/lib/multivm/src/versions/vm_latest/implementation/logs.rs index 31ab9e1e3862..4417bf7a3ff1 100644 --- a/core/lib/multivm/src/versions/vm_latest/implementation/logs.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/logs.rs @@ -1,5 +1,4 @@ use zk_evm_1_5_0::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{ event::extract_l2tol1logs_from_l1_messenger, l2_to_l1_log::{L2ToL1Log, SystemL2ToL1Log, UserL2ToL1Log}, @@ -8,7 +7,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::VmExecutionLogs, + interface::{storage::WriteStorage, VmExecutionLogs}, vm_latest::{old_vm::utils::precompile_calls_count_after_timestamp, utils::logs, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_latest/implementation/snapshots.rs b/core/lib/multivm/src/versions/vm_latest/implementation/snapshots.rs index d226e3af5724..377c4f548b06 100644 --- a/core/lib/multivm/src/versions/vm_latest/implementation/snapshots.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/snapshots.rs @@ -2,12 +2,14 @@ use std::time::Duration; use vise::{Buckets, EncodeLabelSet, EncodeLabelValue, Family, Histogram, Metrics}; use zk_evm_1_5_0::aux_structures::Timestamp; -use zksync_state::WriteStorage; -use crate::vm_latest::{ - old_vm::{history_recorder::HistoryEnabled, oracles::OracleWithHistory}, - types::internals::VmSnapshot, - vm::Vm, +use crate::{ + interface::storage::WriteStorage, + vm_latest::{ + old_vm::{history_recorder::HistoryEnabled, oracles::OracleWithHistory}, + types::internals::VmSnapshot, + vm::Vm, + }, }; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, EncodeLabelSet, EncodeLabelValue)] diff --git a/core/lib/multivm/src/versions/vm_latest/implementation/statistics.rs b/core/lib/multivm/src/versions/vm_latest/implementation/statistics.rs index 7fbd6fb2be02..ed61962648a7 100644 --- a/core/lib/multivm/src/versions/vm_latest/implementation/statistics.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/statistics.rs @@ -1,9 +1,8 @@ use zk_evm_1_5_0::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{circuit::CircuitStatistic, U256}; use crate::{ - interface::{VmExecutionStatistics, VmMemoryMetrics}, + interface::{storage::WriteStorage, VmExecutionStatistics, VmMemoryMetrics}, vm_latest::vm::Vm, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_latest/implementation/tx.rs b/core/lib/multivm/src/versions/vm_latest/implementation/tx.rs index bcfc72934913..98d71efa00f3 100644 --- a/core/lib/multivm/src/versions/vm_latest/implementation/tx.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/tx.rs @@ -1,8 +1,8 @@ use zk_evm_1_5_0::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{l1::is_l1_tx_type, Transaction}; use crate::{ + interface::storage::WriteStorage, vm_latest::{ constants::BOOTLOADER_HEAP_PAGE, implementation::bytecode::{bytecode_to_factory_dep, compress_bytecodes}, diff --git a/core/lib/multivm/src/versions/vm_latest/old_vm/history_recorder.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/history_recorder.rs index 650c0217ca65..e7277f38289d 100644 --- a/core/lib/multivm/src/versions/vm_latest/old_vm/history_recorder.rs +++ b/core/lib/multivm/src/versions/vm_latest/old_vm/history_recorder.rs @@ -5,10 +5,11 @@ use zk_evm_1_5_0::{ vm_state::PrimitiveValue, zkevm_opcode_defs::{self}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{StorageKey, H256, U256}; use zksync_utils::{h256_to_u256, u256_to_h256}; +use crate::interface::storage::{StoragePtr, WriteStorage}; + pub(crate) type MemoryWithHistory = HistoryRecorder; pub(crate) type IntFrameManagerWithHistory = HistoryRecorder, H>; diff --git a/core/lib/multivm/src/versions/vm_latest/old_vm/oracles/decommitter.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/oracles/decommitter.rs index f5cd38779217..0315aa38327d 100644 --- a/core/lib/multivm/src/versions/vm_latest/old_vm/oracles/decommitter.rs +++ b/core/lib/multivm/src/versions/vm_latest/old_vm/oracles/decommitter.rs @@ -9,13 +9,15 @@ use zk_evm_1_5_0::{ ContractCodeSha256, VersionedHashDef, VersionedHashHeader, VersionedHashNormalizedPreimage, }, }; -use zksync_state::{ReadStorage, StoragePtr}; use zksync_types::{H256, U256}; use zksync_utils::{bytes_to_be_words, h256_to_u256, u256_to_h256}; use super::OracleWithHistory; -use crate::vm_latest::old_vm::history_recorder::{ - HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, +use crate::{ + interface::storage::{ReadStorage, StoragePtr}, + vm_latest::old_vm::history_recorder::{ + HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, + }, }; /// The main job of the DecommiterOracle is to implement the DecommittmentProcessor trait - that is diff --git a/core/lib/multivm/src/versions/vm_latest/old_vm/utils.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/utils.rs index f7933b4f603f..c020d1db000a 100644 --- a/core/lib/multivm/src/versions/vm_latest/old_vm/utils.rs +++ b/core/lib/multivm/src/versions/vm_latest/old_vm/utils.rs @@ -6,11 +6,11 @@ use zk_evm_1_5_0::{ FatPointer, RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }, }; -use zksync_state::WriteStorage; use zksync_types::{Address, U256}; -use crate::vm_latest::{ - old_vm::memory::SimpleMemory, types::internals::ZkSyncVmState, HistoryMode, +use crate::{ + interface::storage::WriteStorage, + vm_latest::{old_vm::memory::SimpleMemory, types::internals::ZkSyncVmState, HistoryMode}, }; #[derive(Debug, Clone)] diff --git a/core/lib/multivm/src/versions/vm_latest/oracles/storage.rs b/core/lib/multivm/src/versions/vm_latest/oracles/storage.rs index 075660ad58aa..9c7b68c1ad51 100644 --- a/core/lib/multivm/src/versions/vm_latest/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_latest/oracles/storage.rs @@ -9,7 +9,6 @@ use zk_evm_1_5_0::{ TRANSIENT_STORAGE_AUX_BYTE, }, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ utils::storage_key_for_eth_balance, writes::{ @@ -22,6 +21,7 @@ use zksync_utils::{h256_to_u256, u256_to_h256}; use crate::{ glue::GlueInto, + interface::storage::{StoragePtr, WriteStorage}, vm_latest::{ old_vm::{ history_recorder::{ @@ -620,11 +620,11 @@ fn get_pubdata_price_bytes(initial_value: U256, final_value: U256, is_initial: b #[cfg(test)] mod tests { - use zksync_state::{InMemoryStorage, StorageView}; use zksync_types::H256; use zksync_utils::h256_to_u256; use super::*; + use crate::interface::storage::{InMemoryStorage, StorageView}; #[test] fn test_get_pubdata_price_bytes() { diff --git a/core/lib/multivm/src/versions/vm_latest/tests/get_used_contracts.rs b/core/lib/multivm/src/versions/vm_latest/tests/get_used_contracts.rs index 1798c700ea2d..752fd1a9087d 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/get_used_contracts.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/get_used_contracts.rs @@ -9,14 +9,13 @@ use zk_evm_1_5_0::{ aux_structures::{DecommittmentQuery, MemoryPage, Timestamp}, zkevm_opcode_defs::{VersionedHashHeader, VersionedHashNormalizedPreimage}, }; -use zksync_state::WriteStorage; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_test_account::Account; use zksync_types::{Execute, U256}; use zksync_utils::{bytecode::hash_bytecode, h256_to_u256}; use crate::{ - interface::{TxExecutionMode, VmExecutionMode, VmInterface}, + interface::{storage::WriteStorage, TxExecutionMode, VmExecutionMode, VmInterface}, vm_latest::{ tests::{ tester::{TxType, VmTesterBuilder}, diff --git a/core/lib/multivm/src/versions/vm_latest/tests/is_write_initial.rs b/core/lib/multivm/src/versions/vm_latest/tests/is_write_initial.rs index d5a6679502b5..900f322bc3f3 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/is_write_initial.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/is_write_initial.rs @@ -1,8 +1,7 @@ -use zksync_state::ReadStorage; use zksync_types::get_nonce_key; use crate::{ - interface::{TxExecutionMode, VmExecutionMode, VmInterface}, + interface::{storage::ReadStorage, TxExecutionMode, VmExecutionMode, VmInterface}, vm_latest::{ tests::{ tester::{Account, TxType, VmTesterBuilder}, 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 e62786bb55ef..1f4c36bb25b7 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 @@ -4,7 +4,6 @@ //! use zk_evm_1_5_0::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_system_constants::REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_BYTE; use zksync_types::{ block::{pack_block_info, L2BlockHasher}, @@ -16,7 +15,10 @@ use zksync_types::{ use zksync_utils::{h256_to_u256, u256_to_h256}; use crate::{ - interface::{ExecutionResult, Halt, L2BlockEnv, TxExecutionMode, VmExecutionMode, VmInterface}, + interface::{ + storage::WriteStorage, ExecutionResult, Halt, L2BlockEnv, TxExecutionMode, VmExecutionMode, + VmInterface, + }, vm_latest::{ constants::{ BOOTLOADER_HEAP_PAGE, TX_OPERATOR_L2_BLOCK_INFO_OFFSET, diff --git a/core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs b/core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs index e0c3ec4157dc..ebc0a57dc59a 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs @@ -1,11 +1,11 @@ use ethabi::Token; use zksync_contracts::{get_loadnext_contract, test_contracts::LoadnextContractExecutionParams}; -use zksync_state::WriteStorage; use zksync_types::{get_nonce_key, Execute, U256}; use crate::{ interface::{ dyn_tracers::vm_1_5_0::DynTracer, + storage::WriteStorage, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, TxExecutionMode, VmExecutionMode, VmInterface, VmInterfaceHistoryEnabled, }, diff --git a/core/lib/multivm/src/versions/vm_latest/tests/tester/inner_state.rs b/core/lib/multivm/src/versions/vm_latest/tests/tester/inner_state.rs index 2a6fead8cf9c..c0ef52afaa52 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/tester/inner_state.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/tester/inner_state.rs @@ -1,10 +1,10 @@ use std::collections::HashMap; use zk_evm_1_5_0::{aux_structures::Timestamp, vm_state::VmLocalState}; -use zksync_state::WriteStorage; use zksync_types::{StorageKey, StorageValue, U256}; use crate::{ + interface::storage::WriteStorage, vm_latest::{ old_vm::{ event_sink::InMemoryEventSink, 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 28d853486485..9aba2539e001 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 @@ -1,7 +1,6 @@ use std::marker::PhantomData; use zksync_contracts::BaseSystemContracts; -use zksync_state::{InMemoryStorage, StoragePtr, StorageView, WriteStorage}; use zksync_types::{ block::L2BlockHasher, fee_model::BatchFeeInput, @@ -14,6 +13,7 @@ use zksync_utils::{bytecode::hash_bytecode, u256_to_h256}; use crate::{ interface::{ + storage::{InMemoryStorage, StoragePtr, StorageView, WriteStorage}, L1BatchEnv, L2Block, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode, VmFactory, VmInterface, }, diff --git a/core/lib/multivm/src/versions/vm_latest/tests/upgrade.rs b/core/lib/multivm/src/versions/vm_latest/tests/upgrade.rs index 80e16248fb2d..020b12a7a6e9 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/upgrade.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/upgrade.rs @@ -1,6 +1,5 @@ use zk_evm_1_5_0::aux_structures::Timestamp; use zksync_contracts::{deployer_contract, load_sys_contract, read_bytecode}; -use zksync_state::WriteStorage; use zksync_test_account::TxType; use zksync_types::{ ethabi::{Contract, Token}, @@ -15,8 +14,8 @@ use zksync_utils::{bytecode::hash_bytecode, bytes_to_be_words, h256_to_u256, u25 use super::utils::{get_complex_upgrade_abi, read_test_contract}; use crate::{ interface::{ - ExecutionResult, Halt, TxExecutionMode, VmExecutionMode, VmInterface, - VmInterfaceHistoryEnabled, + storage::WriteStorage, ExecutionResult, Halt, TxExecutionMode, VmExecutionMode, + VmInterface, VmInterfaceHistoryEnabled, }, vm_latest::{ tests::{ diff --git a/core/lib/multivm/src/versions/vm_latest/tests/utils.rs b/core/lib/multivm/src/versions/vm_latest/tests/utils.rs index 2482df0d0e89..cfa7ba1c7e2c 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/utils.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/utils.rs @@ -3,14 +3,14 @@ use once_cell::sync::Lazy; use zksync_contracts::{ load_contract, read_bytecode, read_zbin_bytecode, BaseSystemContracts, SystemContractCode, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ utils::storage_key_for_standard_token_balance, AccountTreeId, Address, StorageKey, H256, U256, }; use zksync_utils::{bytecode::hash_bytecode, bytes_to_be_words, h256_to_u256, u256_to_h256}; -use crate::vm_latest::{ - tests::tester::InMemoryStorageView, types::internals::ZkSyncVmState, HistoryMode, +use crate::{ + interface::storage::{StoragePtr, WriteStorage}, + vm_latest::{tests::tester::InMemoryStorageView, types::internals::ZkSyncVmState, HistoryMode}, }; pub(crate) static BASE_SYSTEM_CONTRACTS: Lazy = diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/circuits_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tracers/circuits_tracer.rs index 4d5dc0b13273..ba59b5067996 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/circuits_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/circuits_tracer.rs @@ -5,12 +5,15 @@ use zk_evm_1_5_0::{ zk_evm_abstractions::precompiles::PrecompileAddress, zkevm_opcode_defs::{LogOpcode, Opcode, UMAOpcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::circuit::CircuitCycleStatistic; use super::circuits_capacity::*; use crate::{ - interface::{dyn_tracers::vm_1_5_0::DynTracer, tracer::TracerExecutionStatus}, + interface::{ + dyn_tracers::vm_1_5_0::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::TracerExecutionStatus, + }, vm_latest::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs index df13930488b3..6d710223b80c 100755 --- a/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs @@ -12,13 +12,13 @@ use zk_evm_1_5_0::{ witness_trace::DummyTracer, zkevm_opcode_defs::{decoding::EncodingModeProduction, Opcode, RetOpcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use super::PubdataTracer; use crate::{ glue::GlueInto, interface::{ dyn_tracers::vm_1_5_0::DynTracer, + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, Halt, VmExecutionMode, }, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_latest/tracers/dispatcher.rs index 7949f73bc20c..af52de40c3d3 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/dispatcher.rs @@ -1,11 +1,11 @@ use zk_evm_1_5_0::tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, VmLocalStateData, }; -use zksync_state::{StoragePtr, WriteStorage}; use crate::{ interface::{ dyn_tracers::vm_1_5_0::DynTracer, + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, vm_latest::{ diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs index 63a2fa43e78d..62a66abaf872 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs @@ -5,7 +5,6 @@ use zk_evm_1_5_0::{ aux_structures::Timestamp, tracing::{BeforeExecutionData, VmLocalStateData}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ event::{ extract_bytecode_publication_requests_from_l1_messenger, @@ -19,6 +18,7 @@ use zksync_utils::{h256_to_u256, u256_to_bytes_be, u256_to_h256}; use crate::{ interface::{ dyn_tracers::vm_1_5_0::DynTracer, + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, L1BatchEnv, VmExecutionMode, }, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs index f67ddc039bf9..e19e235a259b 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs @@ -5,13 +5,14 @@ use zk_evm_1_5_0::{ aux_structures::Timestamp, tracing::{BeforeExecutionData, VmLocalStateData}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{H256, U256}; use zksync_utils::ceil_div_u256; use crate::{ interface::{ - tracer::TracerExecutionStatus, traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::TracerExecutionStatus, + traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, L1BatchEnv, Refunds, }, vm_latest::{ diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs index 8ad64a3d893d..7d0a21669282 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs @@ -5,12 +5,12 @@ use zk_evm_1_5_0::{ vm_state::{ErrorFlags, VmLocalState}, zkevm_opcode_defs::{FatPointer, Opcode, RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::BOOTLOADER_ADDRESS; use zksync_types::U256; use crate::{ interface::{ + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStopReason, VmExecutionStopReason}, traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/traits.rs b/core/lib/multivm/src/versions/vm_latest/tracers/traits.rs index 5800ff4a3bcf..501a0848da8b 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/traits.rs @@ -1,8 +1,7 @@ -use zksync_state::WriteStorage; - use crate::{ interface::{ dyn_tracers::vm_1_5_0::DynTracer, + storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, vm_latest::{ diff --git a/core/lib/multivm/src/versions/vm_latest/types/internals/vm_state.rs b/core/lib/multivm/src/versions/vm_latest/types/internals/vm_state.rs index b9ac0bfad229..6f9522572ad8 100644 --- a/core/lib/multivm/src/versions/vm_latest/types/internals/vm_state.rs +++ b/core/lib/multivm/src/versions/vm_latest/types/internals/vm_state.rs @@ -10,13 +10,15 @@ use zk_evm_1_5_0::{ STARTING_BASE_PAGE, STARTING_TIMESTAMP, }, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::BOOTLOADER_ADDRESS; use zksync_types::{block::L2BlockHasher, Address, L2BlockNumber}; use zksync_utils::h256_to_u256; use crate::{ - interface::{L1BatchEnv, L2Block, SystemEnv}, + interface::{ + storage::{StoragePtr, WriteStorage}, + L1BatchEnv, L2Block, SystemEnv, + }, vm_latest::{ bootloader_state::BootloaderState, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_latest/utils/l2_blocks.rs b/core/lib/multivm/src/versions/vm_latest/utils/l2_blocks.rs index d3253ffd7fb3..59d3eb0ef0fc 100644 --- a/core/lib/multivm/src/versions/vm_latest/utils/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_latest/utils/l2_blocks.rs @@ -1,4 +1,3 @@ -use zksync_state::{ReadStorage, StoragePtr}; use zksync_system_constants::{ SYSTEM_CONTEXT_ADDRESS, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION, SYSTEM_CONTEXT_CURRENT_TX_ROLLING_HASH_POSITION, @@ -9,7 +8,10 @@ use zksync_types::{ }; use zksync_utils::{h256_to_u256, u256_to_h256}; -use crate::interface::{L2Block, L2BlockEnv}; +use crate::interface::{ + storage::{ReadStorage, StoragePtr}, + L2Block, L2BlockEnv, +}; pub(crate) fn get_l2_block_hash_key(block_number: u32) -> StorageKey { let position = h256_to_u256(SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION) diff --git a/core/lib/multivm/src/versions/vm_latest/utils/logs.rs b/core/lib/multivm/src/versions/vm_latest/utils/logs.rs index 82e096cd3e7f..67d202657f6b 100644 --- a/core/lib/multivm/src/versions/vm_latest/utils/logs.rs +++ b/core/lib/multivm/src/versions/vm_latest/utils/logs.rs @@ -1,10 +1,9 @@ use zk_evm_1_5_0::aux_structures::{LogQuery, Timestamp}; -use zksync_state::WriteStorage; use zksync_types::{l2_to_l1_log::L2ToL1Log, StorageLogKind, VmEvent}; use crate::{ glue::GlueInto, - interface::L1BatchEnv, + interface::{storage::WriteStorage, L1BatchEnv}, vm_latest::{ old_vm::{events::merge_events, history_recorder::HistoryMode}, types::internals::ZkSyncVmState, diff --git a/core/lib/multivm/src/versions/vm_latest/vm.rs b/core/lib/multivm/src/versions/vm_latest/vm.rs index f11431f01546..a5e7d8ef8be3 100644 --- a/core/lib/multivm/src/versions/vm_latest/vm.rs +++ b/core/lib/multivm/src/versions/vm_latest/vm.rs @@ -1,5 +1,4 @@ use circuit_sequencer_api_1_5_0::sort_storage_access::sort_storage_access_queries; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ event::extract_l2tol1logs_from_l1_messenger, l2_to_l1_log::{SystemL2ToL1Log, UserL2ToL1Log}, @@ -11,6 +10,7 @@ use zksync_utils::bytecode::CompressedBytecodeInfo; use crate::{ glue::GlueInto, interface::{ + storage::{StoragePtr, WriteStorage}, BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, FinishedL1Batch, L1BatchEnv, L2BlockEnv, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, diff --git a/core/lib/multivm/src/versions/vm_m5/storage.rs b/core/lib/multivm/src/versions/vm_m5/storage.rs index deb3501b4160..e65122a0a4b5 100644 --- a/core/lib/multivm/src/versions/vm_m5/storage.rs +++ b/core/lib/multivm/src/versions/vm_m5/storage.rs @@ -1,8 +1,9 @@ use std::{cell::RefCell, collections::HashMap, fmt::Debug, rc::Rc}; -use zksync_state::{ReadStorage, WriteStorage}; use zksync_types::{StorageKey, StorageValue, H256}; +use crate::interface::storage::{ReadStorage, WriteStorage}; + pub trait Storage: Debug { fn get_value(&mut self, key: &StorageKey) -> StorageValue; // Returns the original value. diff --git a/core/lib/multivm/src/versions/vm_m5/vm.rs b/core/lib/multivm/src/versions/vm_m5/vm.rs index 53189dbcfef5..a0d6ea39ceaa 100644 --- a/core/lib/multivm/src/versions/vm_m5/vm.rs +++ b/core/lib/multivm/src/versions/vm_m5/vm.rs @@ -1,7 +1,6 @@ use circuit_sequencer_api_1_3_3::sort_storage_access::sort_storage_access_queries; use itertools::Itertools; use zk_evm_1_3_1::aux_structures::LogQuery; -use zksync_state::StoragePtr; use zksync_types::{ l2_to_l1_log::{L2ToL1Log, UserL2ToL1Log}, vm::VmVersion, @@ -12,8 +11,8 @@ use zksync_utils::{bytecode::CompressedBytecodeInfo, h256_to_u256, u256_to_h256} use crate::{ glue::{history_mode::HistoryMode, GlueInto}, interface::{ - BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, FinishedL1Batch, - L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode, + storage::StoragePtr, BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, + FinishedL1Batch, L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, }, diff --git a/core/lib/multivm/src/versions/vm_m6/storage.rs b/core/lib/multivm/src/versions/vm_m6/storage.rs index 80f7e0160108..7878c48c3560 100644 --- a/core/lib/multivm/src/versions/vm_m6/storage.rs +++ b/core/lib/multivm/src/versions/vm_m6/storage.rs @@ -1,8 +1,9 @@ use std::{cell::RefCell, collections::HashMap, fmt::Debug, rc::Rc}; -use zksync_state::{ReadStorage, WriteStorage}; use zksync_types::{get_known_code_key, StorageKey, StorageValue, H256}; +use crate::interface::storage::{ReadStorage, WriteStorage}; + pub trait Storage: Debug { /// Returns a value from a given key. If value never existed, returns 0. fn get_value(&mut self, key: &StorageKey) -> StorageValue; diff --git a/core/lib/multivm/src/versions/vm_m6/vm.rs b/core/lib/multivm/src/versions/vm_m6/vm.rs index 634867697a92..9a57869fea37 100644 --- a/core/lib/multivm/src/versions/vm_m6/vm.rs +++ b/core/lib/multivm/src/versions/vm_m6/vm.rs @@ -3,7 +3,6 @@ use std::collections::HashSet; use circuit_sequencer_api_1_3_3::sort_storage_access::sort_storage_access_queries; use itertools::Itertools; use zk_evm_1_3_1::aux_structures::LogQuery; -use zksync_state::StoragePtr; use zksync_types::{ l2_to_l1_log::{L2ToL1Log, UserL2ToL1Log}, vm::VmVersion, @@ -17,8 +16,8 @@ use zksync_utils::{ use crate::{ glue::{history_mode::HistoryMode, GlueInto}, interface::{ - BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, FinishedL1Batch, - L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode, + storage::StoragePtr, BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, + FinishedL1Batch, L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, }, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/bytecode.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/bytecode.rs index 69670f9682b0..b3f578302c07 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/bytecode.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/bytecode.rs @@ -1,12 +1,18 @@ use itertools::Itertools; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::U256; use zksync_utils::{ bytecode::{compress_bytecode, hash_bytecode, CompressedBytecodeInfo}, bytes_to_be_words, }; -use crate::{interface::VmInterface, vm_refunds_enhancement::Vm, HistoryMode}; +use crate::{ + interface::{ + storage::{StoragePtr, WriteStorage}, + VmInterface, + }, + vm_refunds_enhancement::Vm, + HistoryMode, +}; impl Vm { /// Checks the last transaction has successfully published compressed bytecodes and returns `true` if there is at least one is still unknown. diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/execution.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/execution.rs index f1de2afd8b76..3f6dd7e0e9e5 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/execution.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/execution.rs @@ -1,8 +1,8 @@ use zk_evm_1_3_3::aux_structures::Timestamp; -use zksync_state::WriteStorage; use crate::{ interface::{ + storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, VmExecutionMode, VmExecutionResultAndLogs, VmInterface, }, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/gas.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/gas.rs index bc5913fdf319..0f4b5c6b6b0e 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/gas.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/gas.rs @@ -1,7 +1,5 @@ -use zksync_state::WriteStorage; - use crate::{ - interface::VmInterface, + interface::{storage::WriteStorage, VmInterface}, vm_refunds_enhancement::{tracers::DefaultExecutionTracer, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/logs.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/logs.rs index 3880412942bd..91f502eafd72 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/logs.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/logs.rs @@ -1,5 +1,4 @@ use zk_evm_1_3_3::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{ l2_to_l1_log::{L2ToL1Log, UserL2ToL1Log}, VmEvent, @@ -7,7 +6,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::VmExecutionLogs, + interface::{storage::WriteStorage, VmExecutionLogs}, vm_refunds_enhancement::{ old_vm::{events::merge_events, utils::precompile_calls_count_after_timestamp}, vm::Vm, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/snapshots.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/snapshots.rs index 56c219fffa4b..c5559eed57c2 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/snapshots.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/snapshots.rs @@ -2,9 +2,9 @@ use std::time::Duration; use vise::{Buckets, EncodeLabelSet, EncodeLabelValue, Family, Histogram, Metrics}; use zk_evm_1_3_3::aux_structures::Timestamp; -use zksync_state::WriteStorage; use crate::{ + interface::storage::WriteStorage, vm_latest::HistoryEnabled, vm_refunds_enhancement::{ old_vm::oracles::OracleWithHistory, types::internals::VmSnapshot, vm::Vm, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/statistics.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/statistics.rs index 1feae1f72e2b..dcda1457b765 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/statistics.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/statistics.rs @@ -1,9 +1,8 @@ use zk_evm_1_3_3::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::U256; use crate::{ - interface::{VmExecutionStatistics, VmMemoryMetrics}, + interface::{storage::WriteStorage, VmExecutionStatistics, VmMemoryMetrics}, vm_refunds_enhancement::{tracers::DefaultExecutionTracer, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/tx.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/tx.rs index 6dc4772d095a..d06e92a3c59f 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/tx.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/implementation/tx.rs @@ -1,8 +1,8 @@ use zk_evm_1_3_3::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{l1::is_l1_tx_type, Transaction}; use crate::{ + interface::storage::WriteStorage, vm_refunds_enhancement::{ constants::BOOTLOADER_HEAP_PAGE, implementation::bytecode::{bytecode_to_factory_dep, compress_bytecodes}, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/history_recorder.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/history_recorder.rs index 682a8264faee..8af2c42db957 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/history_recorder.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/history_recorder.rs @@ -5,10 +5,11 @@ use zk_evm_1_3_3::{ vm_state::PrimitiveValue, zkevm_opcode_defs::{self}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{StorageKey, H256, U256}; use zksync_utils::{h256_to_u256, u256_to_h256}; +use crate::interface::storage::{StoragePtr, WriteStorage}; + pub(crate) type MemoryWithHistory = HistoryRecorder; pub(crate) type IntFrameManagerWithHistory = HistoryRecorder, H>; diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/oracles/decommitter.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/oracles/decommitter.rs index 9a7addc97e11..ccc8d9052b7e 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/oracles/decommitter.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/oracles/decommitter.rs @@ -6,13 +6,15 @@ use zk_evm_1_3_3::{ DecommittmentQuery, MemoryIndex, MemoryLocation, MemoryPage, MemoryQuery, Timestamp, }, }; -use zksync_state::{ReadStorage, StoragePtr}; use zksync_types::U256; use zksync_utils::{bytecode::bytecode_len_in_words, bytes_to_be_words, u256_to_h256}; use super::OracleWithHistory; -use crate::vm_refunds_enhancement::old_vm::history_recorder::{ - HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, +use crate::{ + interface::storage::{ReadStorage, StoragePtr}, + vm_refunds_enhancement::old_vm::history_recorder::{ + HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, + }, }; /// The main job of the DecommiterOracle is to implement the DecommitmentProcessor trait - that is diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/oracles/storage.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/oracles/storage.rs index bf1871c9b682..526ad357e520 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/oracles/storage.rs @@ -12,7 +12,7 @@ use zk_evm_1_3_3::{ aux_structures::{LogQuery, Timestamp}, }; -use zksync_state::{StoragePtr, WriteStorage}; +use crate::interface::storage::{StoragePtr, WriteStorage}; use zksync_types::utils::storage_key_for_eth_balance; use zksync_types::{ AccountTreeId, Address, StorageKey, StorageLogQuery, StorageLogQueryType, BOOTLOADER_ADDRESS, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/utils.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/utils.rs index 6d7ab7e7a2d9..5838cbb31ea4 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/utils.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/old_vm/utils.rs @@ -6,12 +6,14 @@ use zk_evm_1_3_3::{ FatPointer, RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }, }; -use zksync_state::WriteStorage; use zksync_system_constants::L1_GAS_PER_PUBDATA_BYTE; use zksync_types::{Address, U256}; -use crate::vm_refunds_enhancement::{ - old_vm::memory::SimpleMemory, types::internals::ZkSyncVmState, HistoryMode, +use crate::{ + interface::storage::WriteStorage, + vm_refunds_enhancement::{ + old_vm::memory::SimpleMemory, types::internals::ZkSyncVmState, HistoryMode, + }, }; #[derive(Debug, Clone)] diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/oracles/storage.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/oracles/storage.rs index 7b2cd8c61588..a9c5b71e782e 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/oracles/storage.rs @@ -5,7 +5,6 @@ use zk_evm_1_3_3::{ aux_structures::{LogQuery, Timestamp}, zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ utils::storage_key_for_eth_balance, AccountTreeId, Address, StorageKey, StorageLogKind, BOOTLOADER_ADDRESS, U256, @@ -14,6 +13,7 @@ use zksync_utils::u256_to_h256; use crate::{ glue::GlueInto, + interface::storage::{StoragePtr, WriteStorage}, vm_refunds_enhancement::{ old_vm::{ history_recorder::{ diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/get_used_contracts.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/get_used_contracts.rs index a798a3178f5d..8c121db3e43e 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/get_used_contracts.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/get_used_contracts.rs @@ -2,7 +2,7 @@ use std::collections::{HashMap, HashSet}; use itertools::Itertools; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_test_account::Account; use zksync_types::{Execute, U256}; diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/is_write_initial.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/is_write_initial.rs index ca7ff595e193..d7b961330002 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/is_write_initial.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/is_write_initial.rs @@ -1,4 +1,4 @@ -use zksync_state::ReadStorage; +use crate::interface::storage::ReadStorage; use zksync_types::get_nonce_key; use crate::interface::{TxExecutionMode, VmExecutionMode}; diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/l2_blocks.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/l2_blocks.rs index 9130b6627ca2..269b6cf396c6 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/l2_blocks.rs @@ -12,7 +12,7 @@ use crate::vm_refunds_enhancement::tests::tester::VmTesterBuilder; use crate::vm_refunds_enhancement::utils::l2_blocks::get_l2_block_hash_key; use crate::vm_refunds_enhancement::{HistoryEnabled, HistoryMode, Vm}; use zk_evm_1_3_3::aux_structures::Timestamp; -use zksync_state::{ReadStorage, WriteStorage}; +use crate::interface::storage::{ReadStorage, WriteStorage}; use zksync_system_constants::{ CURRENT_VIRTUAL_BLOCK_INFO_POSITION, REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_BYTE, }; diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/rollbacks.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/rollbacks.rs index 84c5a61c10df..8107ddcdabf6 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/rollbacks.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/rollbacks.rs @@ -3,7 +3,7 @@ use ethabi::Token; use zksync_contracts::get_loadnext_contract; use zksync_contracts::test_contracts::LoadnextContractExecutionParams; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_types::{get_nonce_key, Execute, U256}; use crate::interface::{TxExecutionMode, VmExecutionMode}; diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/tester/inner_state.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/tester/inner_state.rs index 5af50ee0d91f..3158fc494441 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/tester/inner_state.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/tester/inner_state.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use zk_evm_1_3_3::aux_structures::Timestamp; use zk_evm_1_3_3::vm_state::VmLocalState; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_types::{StorageKey, StorageLogQuery, StorageValue, U256}; diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/tester/vm_tester.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/tester/vm_tester.rs index 9c2478a4dbe7..800af517ed3c 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/tester/vm_tester.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/tester/vm_tester.rs @@ -1,5 +1,5 @@ use zksync_contracts::BaseSystemContracts; -use zksync_state::{InMemoryStorage, StoragePtr, StorageView, WriteStorage}; +use crate::interface::storage::{InMemoryStorage, StoragePtr, StorageView, WriteStorage}; use zksync_types::block::legacy_miniblock_hash; use zksync_types::helpers::unix_timestamp_ms; diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/upgrade.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/upgrade.rs index 9a7eaa084681..cbbec9a83d5e 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/upgrade.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/upgrade.rs @@ -11,7 +11,7 @@ use zksync_types::{ use zksync_utils::{bytecode::hash_bytecode, bytes_to_be_words, h256_to_u256, u256_to_h256}; use zksync_contracts::{deployer_contract, load_contract, load_sys_contract, read_bytecode}; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_test_account::TxType; use crate::interface::{ExecutionResult, Halt, TxExecutionMode, VmExecutionMode}; diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/utils.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/utils.rs index 3a936f95681d..ffbb9d892607 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/utils.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tests/utils.rs @@ -5,7 +5,7 @@ use crate::vm_refunds_enhancement::tests::tester::InMemoryStorageView; use zksync_contracts::{ load_contract, read_bytecode, read_zbin_bytecode, BaseSystemContracts, SystemContractCode, }; -use zksync_state::{StoragePtr, WriteStorage}; +use crate::interface::storage::{StoragePtr, WriteStorage}; use zksync_types::utils::storage_key_for_standard_token_balance; use zksync_types::{AccountTreeId, Address, StorageKey, H256, U256}; use zksync_utils::bytecode::hash_bytecode; diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/default_tracers.rs index b5787a6ec47f..8a33835e1b72 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/default_tracers.rs @@ -9,11 +9,11 @@ use zk_evm_1_3_3::{ witness_trace::DummyTracer, zkevm_opcode_defs::{decoding::EncodingModeProduction, Opcode, RetOpcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use crate::{ interface::{ dyn_tracers::vm_1_3_3::DynTracer, + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, Halt, VmExecutionMode, }, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/dispatcher.rs index 2392c3e51afa..e2168b55187c 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/dispatcher.rs @@ -1,11 +1,11 @@ use zk_evm_1_3_3::tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, VmLocalStateData, }; -use zksync_state::{StoragePtr, WriteStorage}; use crate::{ interface::{ dyn_tracers::vm_1_3_3::DynTracer, + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, vm_refunds_enhancement::{ diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/refunds.rs index ca99e862b2d8..2e352da199a5 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/refunds.rs @@ -4,7 +4,6 @@ use zk_evm_1_3_3::{ tracing::{BeforeExecutionData, VmLocalStateData}, vm_state::VmLocalState, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::{PUBLISH_BYTECODE_OVERHEAD, SYSTEM_CONTEXT_ADDRESS}; use zksync_types::{ event::{extract_long_l2_to_l1_messages, extract_published_bytecodes}, @@ -15,7 +14,10 @@ use zksync_utils::{bytecode::bytecode_len_in_bytes, ceil_div_u256, u256_to_h256} use crate::{ interface::{ - dyn_tracers::vm_1_3_3::DynTracer, tracer::TracerExecutionStatus, L1BatchEnv, Refunds, + dyn_tracers::vm_1_3_3::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::TracerExecutionStatus, + L1BatchEnv, Refunds, }, vm_refunds_enhancement::{ bootloader_state::BootloaderState, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/result_tracer.rs index 22cf08c8ef93..4e6f7ce94d69 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/result_tracer.rs @@ -3,12 +3,12 @@ use zk_evm_1_3_3::{ vm_state::{ErrorFlags, VmLocalState}, zkevm_opcode_defs::FatPointer, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::U256; use crate::{ interface::{ dyn_tracers::vm_1_3_3::DynTracer, + storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStopReason, VmExecutionStopReason}, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/traits.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/traits.rs index b54819148fad..a0474233268f 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/traits.rs @@ -1,8 +1,7 @@ -use zksync_state::WriteStorage; - use crate::{ interface::{ dyn_tracers::vm_1_3_3::DynTracer, + storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, vm_refunds_enhancement::{ diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/types/internals/vm_state.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/types/internals/vm_state.rs index 58c352c4c6cb..22f92891e40a 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/types/internals/vm_state.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/types/internals/vm_state.rs @@ -10,13 +10,15 @@ use zk_evm_1_3_3::{ STARTING_BASE_PAGE, STARTING_TIMESTAMP, }, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::BOOTLOADER_ADDRESS; use zksync_types::{block::L2BlockHasher, Address, L2BlockNumber}; use zksync_utils::h256_to_u256; use crate::{ - interface::{L1BatchEnv, L2Block, SystemEnv}, + interface::{ + storage::{StoragePtr, WriteStorage}, + L1BatchEnv, L2Block, SystemEnv, + }, vm_refunds_enhancement::{ bootloader_state::BootloaderState, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/utils/l2_blocks.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/utils/l2_blocks.rs index ec30a86013b9..ff5536ae0b97 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/utils/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/utils/l2_blocks.rs @@ -1,4 +1,3 @@ -use zksync_state::{ReadStorage, StoragePtr}; use zksync_system_constants::{ SYSTEM_CONTEXT_ADDRESS, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION, SYSTEM_CONTEXT_CURRENT_TX_ROLLING_HASH_POSITION, @@ -9,7 +8,10 @@ use zksync_types::{ }; use zksync_utils::{h256_to_u256, u256_to_h256}; -use crate::interface::{L2Block, L2BlockEnv}; +use crate::interface::{ + storage::{ReadStorage, StoragePtr}, + L2Block, L2BlockEnv, +}; pub(crate) fn get_l2_block_hash_key(block_number: u32) -> StorageKey { let position = h256_to_u256(SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION) diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/vm.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/vm.rs index c580b84e2022..599387884666 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/vm.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/vm.rs @@ -1,11 +1,11 @@ use circuit_sequencer_api_1_3_3::sort_storage_access::sort_storage_access_queries; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{l2_to_l1_log::UserL2ToL1Log, Transaction}; use zksync_utils::bytecode::CompressedBytecodeInfo; use crate::{ glue::GlueInto, interface::{ + storage::{StoragePtr, WriteStorage}, BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, L1BatchEnv, L2BlockEnv, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/bytecode.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/bytecode.rs index 570581740ef6..7c1b15027b4a 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/bytecode.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/bytecode.rs @@ -1,12 +1,18 @@ use itertools::Itertools; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::U256; use zksync_utils::{ bytecode::{compress_bytecode, hash_bytecode, CompressedBytecodeInfo}, bytes_to_be_words, }; -use crate::{interface::VmInterface, vm_virtual_blocks::Vm, HistoryMode}; +use crate::{ + interface::{ + storage::{StoragePtr, WriteStorage}, + VmInterface, + }, + vm_virtual_blocks::Vm, + HistoryMode, +}; impl Vm { /// Checks the last transaction has successfully published compressed bytecodes and returns `true` if there is at least one is still unknown. diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/execution.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/execution.rs index 78a817f647ce..aafcca3821be 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/execution.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/execution.rs @@ -1,8 +1,8 @@ use zk_evm_1_3_3::aux_structures::Timestamp; -use zksync_state::WriteStorage; use crate::{ interface::{ + storage::WriteStorage, tracer::{TracerExecutionStopReason, VmExecutionStopReason}, VmExecutionMode, VmExecutionResultAndLogs, VmInterface, }, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/gas.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/gas.rs index ea8df4cd7e18..28f0ec6df4a9 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/gas.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/gas.rs @@ -1,7 +1,5 @@ -use zksync_state::WriteStorage; - use crate::{ - interface::VmInterface, + interface::{storage::WriteStorage, VmInterface}, vm_virtual_blocks::{tracers::DefaultExecutionTracer, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/logs.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/logs.rs index ebcb4ad0cecc..8b60953c8341 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/logs.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/logs.rs @@ -1,5 +1,4 @@ use zk_evm_1_3_3::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{ l2_to_l1_log::{L2ToL1Log, UserL2ToL1Log}, VmEvent, @@ -7,7 +6,7 @@ use zksync_types::{ use crate::{ glue::GlueInto, - interface::VmExecutionLogs, + interface::{storage::WriteStorage, VmExecutionLogs}, vm_virtual_blocks::{ old_vm::{events::merge_events, utils::precompile_calls_count_after_timestamp}, vm::Vm, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/snapshots.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/snapshots.rs index 2b653333a5c1..70d58b8315b8 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/snapshots.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/snapshots.rs @@ -2,9 +2,9 @@ use std::time::Duration; use vise::{Buckets, EncodeLabelSet, EncodeLabelValue, Family, Histogram, Metrics}; use zk_evm_1_3_3::aux_structures::Timestamp; -use zksync_state::WriteStorage; use crate::{ + interface::storage::WriteStorage, vm_latest::HistoryEnabled, vm_virtual_blocks::{old_vm::oracles::OracleWithHistory, types::internals::VmSnapshot, vm::Vm}, }; diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/statistics.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/statistics.rs index 4a15b07530fa..d082085a1550 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/statistics.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/statistics.rs @@ -1,9 +1,8 @@ use zk_evm_1_3_3::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::U256; use crate::{ - interface::{VmExecutionStatistics, VmMemoryMetrics}, + interface::{storage::WriteStorage, VmExecutionStatistics, VmMemoryMetrics}, vm_virtual_blocks::{tracers::DefaultExecutionTracer, vm::Vm}, HistoryMode, }; diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/tx.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/tx.rs index 0f4705a633f2..ddb7267eab7a 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/tx.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/tx.rs @@ -1,8 +1,8 @@ use zk_evm_1_3_3::aux_structures::Timestamp; -use zksync_state::WriteStorage; use zksync_types::{l1::is_l1_tx_type, Transaction}; use crate::{ + interface::storage::WriteStorage, vm_virtual_blocks::{ constants::BOOTLOADER_HEAP_PAGE, implementation::bytecode::{bytecode_to_factory_dep, compress_bytecodes}, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/history_recorder.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/history_recorder.rs index 664de3a90037..cbd4dc0ed738 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/history_recorder.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/history_recorder.rs @@ -5,10 +5,11 @@ use zk_evm_1_3_3::{ vm_state::PrimitiveValue, zkevm_opcode_defs::{self}, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{StorageKey, H256, U256}; use zksync_utils::{h256_to_u256, u256_to_h256}; +use crate::interface::storage::{StoragePtr, WriteStorage}; + pub(crate) type MemoryWithHistory = HistoryRecorder; pub(crate) type IntFrameManagerWithHistory = HistoryRecorder, H>; diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/decommitter.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/decommitter.rs index f01394cebb52..3c8d72b0b33a 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/decommitter.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/decommitter.rs @@ -6,13 +6,15 @@ use zk_evm_1_3_3::{ DecommittmentQuery, MemoryIndex, MemoryLocation, MemoryPage, MemoryQuery, Timestamp, }, }; -use zksync_state::{ReadStorage, StoragePtr}; use zksync_types::U256; use zksync_utils::{bytecode::bytecode_len_in_words, bytes_to_be_words, u256_to_h256}; use super::OracleWithHistory; -use crate::vm_virtual_blocks::old_vm::history_recorder::{ - HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, +use crate::{ + interface::storage::{ReadStorage, StoragePtr}, + vm_virtual_blocks::old_vm::history_recorder::{ + HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, + }, }; /// The main job of the DecommiterOracle is to implement the DecommitmentProcessor trait - that is diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/storage.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/storage.rs index 682814b8d512..defbad70f1a9 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/storage.rs @@ -5,7 +5,6 @@ use zk_evm_1_3_3::{ aux_structures::{LogQuery, Timestamp}, zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{ utils::storage_key_for_eth_balance, AccountTreeId, Address, StorageKey, StorageLogKind, BOOTLOADER_ADDRESS, U256, @@ -15,6 +14,7 @@ use zksync_utils::u256_to_h256; use super::OracleWithHistory; use crate::{ glue::GlueInto, + interface::storage::{StoragePtr, WriteStorage}, vm_virtual_blocks::{ old_vm::history_recorder::{ AppDataFrameManagerWithHistory, HashMapHistoryEvent, HistoryEnabled, HistoryMode, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/utils.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/utils.rs index 834b9988f693..07757bc5a3ef 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/utils.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/utils.rs @@ -6,12 +6,14 @@ use zk_evm_1_3_3::{ FatPointer, RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }, }; -use zksync_state::WriteStorage; use zksync_system_constants::L1_GAS_PER_PUBDATA_BYTE; use zksync_types::{Address, U256}; -use crate::vm_virtual_blocks::{ - old_vm::memory::SimpleMemory, types::internals::ZkSyncVmState, HistoryMode, +use crate::{ + interface::storage::WriteStorage, + vm_virtual_blocks::{ + old_vm::memory::SimpleMemory, types::internals::ZkSyncVmState, HistoryMode, + }, }; #[derive(Debug, Clone)] diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/get_used_contracts.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/get_used_contracts.rs index 496b7a847eda..06d8191310bc 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/get_used_contracts.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/get_used_contracts.rs @@ -3,7 +3,7 @@ use std::collections::{HashMap, HashSet}; use itertools::Itertools; use crate::HistoryMode; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_test_account::Account; use zksync_types::{Execute, U256}; diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/is_write_initial.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/is_write_initial.rs index 8ac932687744..2c7ef4a8d11a 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/is_write_initial.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/is_write_initial.rs @@ -1,4 +1,4 @@ -use zksync_state::ReadStorage; +use crate::interface::storage::ReadStorage; use zksync_types::get_nonce_key; use crate::interface::{TxExecutionMode, VmExecutionMode, VmInterface}; diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/l2_blocks.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/l2_blocks.rs index aebb389ebaf3..cba534deeaf6 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/l2_blocks.rs @@ -16,7 +16,7 @@ use crate::vm_virtual_blocks::utils::l2_blocks::get_l2_block_hash_key; use crate::vm_virtual_blocks::Vm; use crate::HistoryMode; use zk_evm_1_3_3::aux_structures::Timestamp; -use zksync_state::{ReadStorage, WriteStorage}; +use crate::interface::storage::{ReadStorage, WriteStorage}; use zksync_system_constants::{ CURRENT_VIRTUAL_BLOCK_INFO_POSITION, REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_BYTE, }; diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/inner_state.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/inner_state.rs index 83ad0b9044b5..a5c0db9468b0 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/inner_state.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/inner_state.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use zk_evm_1_3_3::aux_structures::Timestamp; use zk_evm_1_3_3::vm_state::VmLocalState; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_types::{StorageKey, StorageLogQuery, StorageValue, U256}; diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/vm_tester.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/vm_tester.rs index adae9a4cc8db..9fe0635eba39 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/vm_tester.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/vm_tester.rs @@ -1,6 +1,6 @@ use std::marker::PhantomData; use zksync_contracts::BaseSystemContracts; -use zksync_state::{InMemoryStorage, StoragePtr, StorageView, WriteStorage}; +use crate::interface::storage::{InMemoryStorage, StoragePtr, StorageView, WriteStorage}; use crate::HistoryMode; use zksync_types::block::legacy_miniblock_hash; diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/upgrade.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/upgrade.rs index 7ba8ec6dfc0c..8b3fa0ea2910 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/upgrade.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/upgrade.rs @@ -11,7 +11,7 @@ use zksync_types::{ use zksync_utils::{bytecode::hash_bytecode, bytes_to_be_words, h256_to_u256, u256_to_h256}; use zksync_contracts::{deployer_contract, load_contract, load_sys_contract, read_bytecode}; -use zksync_state::WriteStorage; +use crate::interface::storage::WriteStorage; use zksync_test_account::TxType; use crate::interface::{ diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/utils.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/utils.rs index ca04d2fedf55..e3db232ffceb 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tests/utils.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/utils.rs @@ -5,7 +5,7 @@ use crate::vm_virtual_blocks::tests::tester::InMemoryStorageView; use zksync_contracts::{ load_contract, read_bytecode, read_zbin_bytecode, BaseSystemContracts, SystemContractCode, }; -use zksync_state::{StoragePtr, WriteStorage}; +use crate::interface::storage::{StoragePtr, WriteStorage}; use zksync_types::utils::storage_key_for_standard_token_balance; use zksync_types::{AccountTreeId, Address, StorageKey, H256, U256}; use zksync_utils::bytecode::hash_bytecode; diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs index 1e7780edda24..660550624e2c 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs @@ -12,10 +12,14 @@ use zk_evm_1_3_3::{ witness_trace::DummyTracer, zkevm_opcode_defs::{Opcode, RetOpcode}, }; -use zksync_state::{StoragePtr, WriteStorage}; use crate::{ - interface::{dyn_tracers::vm_1_3_3::DynTracer, tracer::VmExecutionStopReason, VmExecutionMode}, + interface::{ + dyn_tracers::vm_1_3_3::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::VmExecutionStopReason, + VmExecutionMode, + }, vm_virtual_blocks::{ bootloader_state::{utils::apply_l2_block, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/dispatcher.rs index b1b5ef418eeb..b290f6a0e7f4 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/dispatcher.rs @@ -1,11 +1,13 @@ use zk_evm_1_3_3::tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, VmLocalStateData, }; -use zksync_state::{StoragePtr, WriteStorage}; use crate::{ interface::{ - dyn_tracers::vm_1_3_3::DynTracer, tracer::VmExecutionStopReason, VmExecutionResultAndLogs, + dyn_tracers::vm_1_3_3::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::VmExecutionStopReason, + VmExecutionResultAndLogs, }, vm_virtual_blocks::{ BootloaderState, ExecutionEndTracer, ExecutionProcessing, HistoryMode, SimpleMemory, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs index 7b687536da59..040e3c746483 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs @@ -7,7 +7,6 @@ use zk_evm_1_3_3::{ tracing::{BeforeExecutionData, VmLocalStateData}, vm_state::VmLocalState, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::{PUBLISH_BYTECODE_OVERHEAD, SYSTEM_CONTEXT_ADDRESS}; use zksync_types::{ event::{extract_long_l2_to_l1_messages, extract_published_bytecodes}, @@ -17,7 +16,11 @@ use zksync_types::{ use zksync_utils::{bytecode::bytecode_len_in_bytes, ceil_div_u256, u256_to_h256}; use crate::{ - interface::{dyn_tracers::vm_1_3_3::DynTracer, L1BatchEnv, Refunds, VmExecutionResultAndLogs}, + interface::{ + dyn_tracers::vm_1_3_3::DynTracer, + storage::{StoragePtr, WriteStorage}, + L1BatchEnv, Refunds, VmExecutionResultAndLogs, + }, vm_virtual_blocks::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs index 3ba396fd0c4c..fdafa4bb8a8b 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs @@ -3,13 +3,15 @@ use zk_evm_1_3_3::{ vm_state::{ErrorFlags, VmLocalState}, zkevm_opcode_defs::FatPointer, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::U256; use crate::{ interface::{ - dyn_tracers::vm_1_3_3::DynTracer, tracer::VmExecutionStopReason, ExecutionResult, Halt, - TxRevertReason, VmExecutionMode, VmExecutionResultAndLogs, VmRevertReason, + dyn_tracers::vm_1_3_3::DynTracer, + storage::{StoragePtr, WriteStorage}, + tracer::VmExecutionStopReason, + ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmExecutionResultAndLogs, + VmRevertReason, }, vm_virtual_blocks::{ bootloader_state::BootloaderState, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs index ed6ad67b5dcd..733db21c23a2 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs @@ -1,8 +1,7 @@ -use zksync_state::WriteStorage; - use crate::{ interface::{ - dyn_tracers::vm_1_3_3::DynTracer, tracer::VmExecutionStopReason, VmExecutionResultAndLogs, + dyn_tracers::vm_1_3_3::DynTracer, storage::WriteStorage, tracer::VmExecutionStopReason, + VmExecutionResultAndLogs, }, vm_virtual_blocks::{ bootloader_state::BootloaderState, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/vm_state.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/vm_state.rs index fc28e49de503..d26acc4e9301 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/vm_state.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/vm_state.rs @@ -10,13 +10,15 @@ use zk_evm_1_3_3::{ STARTING_BASE_PAGE, STARTING_TIMESTAMP, }, }; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_system_constants::BOOTLOADER_ADDRESS; use zksync_types::{block::L2BlockHasher, Address, L2BlockNumber}; use zksync_utils::h256_to_u256; use crate::{ - interface::{L1BatchEnv, L2Block, SystemEnv}, + interface::{ + storage::{StoragePtr, WriteStorage}, + L1BatchEnv, L2Block, SystemEnv, + }, vm_virtual_blocks::{ bootloader_state::BootloaderState, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/utils/l2_blocks.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/utils/l2_blocks.rs index ec30a86013b9..ff5536ae0b97 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/utils/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/utils/l2_blocks.rs @@ -1,4 +1,3 @@ -use zksync_state::{ReadStorage, StoragePtr}; use zksync_system_constants::{ SYSTEM_CONTEXT_ADDRESS, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION, SYSTEM_CONTEXT_CURRENT_TX_ROLLING_HASH_POSITION, @@ -9,7 +8,10 @@ use zksync_types::{ }; use zksync_utils::{h256_to_u256, u256_to_h256}; -use crate::interface::{L2Block, L2BlockEnv}; +use crate::interface::{ + storage::{ReadStorage, StoragePtr}, + L2Block, L2BlockEnv, +}; pub(crate) fn get_l2_block_hash_key(block_number: u32) -> StorageKey { let position = h256_to_u256(SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION) diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/vm.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/vm.rs index a7cef17591ad..9d234ec117ac 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/vm.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/vm.rs @@ -1,11 +1,11 @@ use circuit_sequencer_api_1_3_3::sort_storage_access::sort_storage_access_queries; -use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::{l2_to_l1_log::UserL2ToL1Log, Transaction}; use zksync_utils::bytecode::CompressedBytecodeInfo; use crate::{ glue::GlueInto, interface::{ + storage::{StoragePtr, WriteStorage}, BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, L1BatchEnv, L2BlockEnv, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, diff --git a/core/lib/multivm/src/vm_instance.rs b/core/lib/multivm/src/vm_instance.rs index c8a7ce837991..0cc8916a104b 100644 --- a/core/lib/multivm/src/vm_instance.rs +++ b/core/lib/multivm/src/vm_instance.rs @@ -1,10 +1,10 @@ -use zksync_state::{ImmutableStorageView, ReadStorage, StoragePtr, StorageView}; use zksync_types::vm::{FastVmMode, VmVersion}; use zksync_utils::bytecode::CompressedBytecodeInfo; use crate::{ glue::history_mode::HistoryMode, interface::{ + storage::{ImmutableStorageView, ReadStorage, StoragePtr, StorageView}, BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, FinishedL1Batch, L1BatchEnv, L2BlockEnv, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, From 84be88de57f7b7be16d290b10d04b38732cc43dc Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 13:39:42 +0300 Subject: [PATCH 07/17] Update VM storage trait uses elsewhere --- Cargo.lock | 3 ++- core/bin/system-constants-generator/src/utils.rs | 8 +++++--- core/lib/tee_verifier/src/lib.rs | 6 ++++-- core/lib/vm_utils/src/lib.rs | 7 +++++-- core/node/api_server/src/execution_sandbox/apply.rs | 7 +++++-- core/node/api_server/src/execution_sandbox/storage.rs | 4 ++-- core/node/api_server/src/execution_sandbox/tracers.rs | 4 ++-- core/node/api_server/src/execution_sandbox/vm_metrics.rs | 5 +++-- core/node/block_reverter/src/tests.rs | 2 +- .../node/state_keeper/src/batch_executor/main_executor.rs | 3 ++- core/node/state_keeper/src/batch_executor/mod.rs | 5 +++-- core/node/state_keeper/src/testonly/mod.rs | 6 +++--- core/node/state_keeper/src/updates/mod.rs | 5 +++-- core/node/vm_runner/src/tests/storage.rs | 2 +- .../tests/vm-benchmark/harness/src/instruction_counter.rs | 5 +++-- core/tests/vm-benchmark/harness/src/lib.rs | 4 ++-- 16 files changed, 46 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1be54fdbb261..552f68ba7138 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8939,7 +8939,6 @@ dependencies = [ "zk_evm 0.150.0", "zksync_contracts", "zksync_eth_signer", - "zksync_state", "zksync_system_constants", "zksync_test_account", "zksync_types", @@ -9515,6 +9514,7 @@ dependencies = [ "zksync_storage", "zksync_types", "zksync_utils", + "zksync_vm_interface", ] [[package]] @@ -9763,6 +9763,7 @@ dependencies = [ "hex", "serde", "thiserror", + "tracing", "zksync_contracts", "zksync_system_constants", "zksync_types", diff --git a/core/bin/system-constants-generator/src/utils.rs b/core/bin/system-constants-generator/src/utils.rs index f2e73028e6e4..5b2abd0082eb 100644 --- a/core/bin/system-constants-generator/src/utils.rs +++ b/core/bin/system-constants-generator/src/utils.rs @@ -7,8 +7,11 @@ use zksync_contracts::{ }; use zksync_multivm::{ interface::{ - dyn_tracers::vm_1_5_0::DynTracer, tracer::VmExecutionStopReason, L1BatchEnv, L2BlockEnv, - SystemEnv, TxExecutionMode, VmExecutionMode, VmFactory, VmInterface, + dyn_tracers::vm_1_5_0::DynTracer, + storage::{InMemoryStorage, StorageView, WriteStorage}, + tracer::VmExecutionStopReason, + L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode, VmFactory, + VmInterface, }, vm_latest::{ constants::{BATCH_COMPUTATIONAL_GAS_LIMIT, BOOTLOADER_HEAP_PAGE}, @@ -17,7 +20,6 @@ use zksync_multivm::{ }, zk_evm_latest::aux_structures::Timestamp, }; -use zksync_state::{InMemoryStorage, StorageView, WriteStorage}; use zksync_types::{ block::L2BlockHasher, ethabi::Token, fee::Fee, fee_model::BatchFeeInput, l1::L1Tx, l2::L2Tx, utils::storage_key_for_eth_balance, AccountTreeId, Address, Execute, K256PrivateKey, diff --git a/core/lib/tee_verifier/src/lib.rs b/core/lib/tee_verifier/src/lib.rs index 32443b60c8ca..686cab37b892 100644 --- a/core/lib/tee_verifier/src/lib.rs +++ b/core/lib/tee_verifier/src/lib.rs @@ -12,14 +12,16 @@ use zksync_merkle_tree::{ BlockOutputWithProofs, TreeInstruction, TreeLogEntry, TreeLogEntryWithProof, ValueHash, }; use zksync_multivm::{ - interface::{FinishedL1Batch, L2BlockEnv, VmFactory, VmInterface}, + interface::{ + storage::{InMemoryStorage, ReadStorage, StorageView}, + FinishedL1Batch, L2BlockEnv, VmFactory, VmInterface, + }, vm_latest::HistoryEnabled, VmInstance, }; use zksync_prover_interface::inputs::{ StorageLogMetadata, V1TeeVerifierInput, WitnessInputMerklePaths, }; -use zksync_state::{InMemoryStorage, ReadStorage, StorageView}; use zksync_types::{block::L2BlockExecutionData, L1BatchNumber, StorageLog, H256}; use zksync_utils::bytecode::hash_bytecode; use zksync_vm_utils::execute_tx; diff --git a/core/lib/vm_utils/src/lib.rs b/core/lib/vm_utils/src/lib.rs index a3ec715851a4..beef77151acc 100644 --- a/core/lib/vm_utils/src/lib.rs +++ b/core/lib/vm_utils/src/lib.rs @@ -2,11 +2,14 @@ use anyhow::{anyhow, Context}; use tokio::runtime::Handle; use zksync_dal::{Connection, Core}; use zksync_multivm::{ - interface::{VmFactory, VmInterface, VmInterfaceHistoryEnabled}, + interface::{ + storage::{ReadStorage, StoragePtr, StorageView}, + VmFactory, VmInterface, VmInterfaceHistoryEnabled, + }, vm_latest::HistoryEnabled, VmInstance, }; -use zksync_state::{PostgresStorage, ReadStorage, StoragePtr, StorageView}; +use zksync_state::PostgresStorage; use zksync_types::{L1BatchNumber, L2ChainId, Transaction}; use crate::storage::L1BatchParamsProvider; diff --git a/core/node/api_server/src/execution_sandbox/apply.rs b/core/node/api_server/src/execution_sandbox/apply.rs index 99664697b14c..c0c8398f690d 100644 --- a/core/node/api_server/src/execution_sandbox/apply.rs +++ b/core/node/api_server/src/execution_sandbox/apply.rs @@ -12,12 +12,15 @@ use anyhow::Context as _; use tokio::runtime::Handle; use zksync_dal::{Connection, ConnectionPool, Core, CoreDal, DalError}; use zksync_multivm::{ - interface::{L1BatchEnv, L2BlockEnv, SystemEnv, VmInterface}, + interface::{ + storage::{ReadStorage, StoragePtr, StorageView, WriteStorage}, + L1BatchEnv, L2BlockEnv, SystemEnv, VmInterface, + }, utils::adjust_pubdata_price_for_tx, vm_latest::{constants::BATCH_COMPUTATIONAL_GAS_LIMIT, HistoryDisabled}, VmInstance, }; -use zksync_state::{PostgresStorage, ReadStorage, StoragePtr, StorageView, WriteStorage}; +use zksync_state::PostgresStorage; use zksync_system_constants::{ SYSTEM_CONTEXT_ADDRESS, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION, SYSTEM_CONTEXT_CURRENT_TX_ROLLING_HASH_POSITION, ZKPORTER_IS_AVAILABLE, diff --git a/core/node/api_server/src/execution_sandbox/storage.rs b/core/node/api_server/src/execution_sandbox/storage.rs index 749945b4e341..0d4c88d4a0ae 100644 --- a/core/node/api_server/src/execution_sandbox/storage.rs +++ b/core/node/api_server/src/execution_sandbox/storage.rs @@ -5,7 +5,7 @@ use std::{ fmt, }; -use zksync_state::ReadStorage; +use zksync_multivm::interface::storage::ReadStorage; use zksync_types::{ api::state_override::{OverrideState, StateOverride}, get_code_key, get_nonce_key, @@ -119,7 +119,7 @@ impl ReadStorage for StorageWithOverrides { #[cfg(test)] mod tests { - use zksync_state::InMemoryStorage; + use zksync_multivm::interface::storage::InMemoryStorage; use zksync_types::{ api::state_override::{Bytecode, OverrideAccount}, Address, diff --git a/core/node/api_server/src/execution_sandbox/tracers.rs b/core/node/api_server/src/execution_sandbox/tracers.rs index ba258ab7c74a..f03c17a5fa42 100644 --- a/core/node/api_server/src/execution_sandbox/tracers.rs +++ b/core/node/api_server/src/execution_sandbox/tracers.rs @@ -2,9 +2,9 @@ use std::sync::Arc; use once_cell::sync::OnceCell; use zksync_multivm::{ - tracers::CallTracer, vm_latest::HistoryMode, MultiVMTracer, MultiVmTracerPointer, + interface::storage::WriteStorage, tracers::CallTracer, vm_latest::HistoryMode, MultiVMTracer, + MultiVmTracerPointer, }; -use zksync_state::WriteStorage; use zksync_types::vm_trace::Call; /// Custom tracers supported by our API diff --git a/core/node/api_server/src/execution_sandbox/vm_metrics.rs b/core/node/api_server/src/execution_sandbox/vm_metrics.rs index e1e96d8eee5e..27e1c2ab305a 100644 --- a/core/node/api_server/src/execution_sandbox/vm_metrics.rs +++ b/core/node/api_server/src/execution_sandbox/vm_metrics.rs @@ -3,9 +3,10 @@ use std::time::Duration; use vise::{ Buckets, EncodeLabelSet, EncodeLabelValue, Family, Gauge, Histogram, LatencyObserver, Metrics, }; -use zksync_multivm::interface::{VmExecutionResultAndLogs, VmMemoryMetrics}; +use zksync_multivm::interface::{ + storage::StorageViewMetrics, VmExecutionResultAndLogs, VmMemoryMetrics, +}; use zksync_shared_metrics::InteractionType; -use zksync_state::StorageViewMetrics; use zksync_types::{ event::{extract_long_l2_to_l1_messages, extract_published_bytecodes}, fee::TransactionExecutionMetrics, diff --git a/core/node/block_reverter/src/tests.rs b/core/node/block_reverter/src/tests.rs index 5be1af040714..a2dcae1724fe 100644 --- a/core/node/block_reverter/src/tests.rs +++ b/core/node/block_reverter/src/tests.rs @@ -9,7 +9,7 @@ use tokio::sync::watch; use zksync_dal::Connection; use zksync_merkle_tree::TreeInstruction; use zksync_object_store::{Bucket, MockObjectStore}; -use zksync_state::ReadStorage; +use zksync_state::interface::ReadStorage; use zksync_types::{ block::{L1BatchHeader, L2BlockHeader}, snapshots::SnapshotVersion, diff --git a/core/node/state_keeper/src/batch_executor/main_executor.rs b/core/node/state_keeper/src/batch_executor/main_executor.rs index d3595323a9a3..cc05da9235b5 100644 --- a/core/node/state_keeper/src/batch_executor/main_executor.rs +++ b/core/node/state_keeper/src/batch_executor/main_executor.rs @@ -5,6 +5,7 @@ use once_cell::sync::OnceCell; use tokio::{runtime::Handle, sync::mpsc}; use zksync_multivm::{ interface::{ + storage::{ReadStorage, StorageView}, ExecutionResult, FinishedL1Batch, Halt, L1BatchEnv, L2BlockEnv, SystemEnv, VmExecutionResultAndLogs, VmInterface, VmInterfaceHistoryEnabled, }, @@ -13,7 +14,7 @@ use zksync_multivm::{ MultiVMTracer, VmInstance, }; use zksync_shared_metrics::{InteractionType, TxStage, APP_METRICS}; -use zksync_state::{OwnedStorage, ReadStorage, StorageView}; +use zksync_state::OwnedStorage; use zksync_types::{vm::FastVmMode, vm_trace::Call, Transaction}; use zksync_utils::bytecode::CompressedBytecodeInfo; diff --git a/core/node/state_keeper/src/batch_executor/mod.rs b/core/node/state_keeper/src/batch_executor/mod.rs index d4fea2e9dfd5..b6f57694afa0 100644 --- a/core/node/state_keeper/src/batch_executor/mod.rs +++ b/core/node/state_keeper/src/batch_executor/mod.rs @@ -6,9 +6,10 @@ use tokio::{ task::JoinHandle, }; use zksync_multivm::interface::{ - FinishedL1Batch, Halt, L1BatchEnv, L2BlockEnv, SystemEnv, VmExecutionResultAndLogs, + storage::StorageViewCache, FinishedL1Batch, Halt, L1BatchEnv, L2BlockEnv, SystemEnv, + VmExecutionResultAndLogs, }; -use zksync_state::{OwnedStorage, StorageViewCache}; +use zksync_state::OwnedStorage; use zksync_types::{vm_trace::Call, Transaction}; use zksync_utils::bytecode::CompressedBytecodeInfo; diff --git a/core/node/state_keeper/src/testonly/mod.rs b/core/node/state_keeper/src/testonly/mod.rs index 14785acbbfa8..02b0043b97cf 100644 --- a/core/node/state_keeper/src/testonly/mod.rs +++ b/core/node/state_keeper/src/testonly/mod.rs @@ -6,10 +6,10 @@ use tokio::sync::mpsc; use zksync_contracts::BaseSystemContracts; use zksync_dal::{ConnectionPool, Core, CoreDal as _}; use zksync_multivm::interface::{ - CurrentExecutionState, ExecutionResult, FinishedL1Batch, L1BatchEnv, Refunds, SystemEnv, - VmExecutionLogs, VmExecutionResultAndLogs, VmExecutionStatistics, + storage::StorageViewCache, CurrentExecutionState, ExecutionResult, FinishedL1Batch, L1BatchEnv, + Refunds, SystemEnv, VmExecutionLogs, VmExecutionResultAndLogs, VmExecutionStatistics, }; -use zksync_state::{OwnedStorage, StorageViewCache}; +use zksync_state::OwnedStorage; use zksync_test_account::Account; use zksync_types::{ fee::Fee, utils::storage_key_for_standard_token_balance, AccountTreeId, Address, Execute, diff --git a/core/node/state_keeper/src/updates/mod.rs b/core/node/state_keeper/src/updates/mod.rs index e05432c57b21..b1310800d8ac 100644 --- a/core/node/state_keeper/src/updates/mod.rs +++ b/core/node/state_keeper/src/updates/mod.rs @@ -1,9 +1,10 @@ use zksync_contracts::BaseSystemContractsHashes; use zksync_multivm::{ - interface::{FinishedL1Batch, L1BatchEnv, SystemEnv, VmExecutionResultAndLogs}, + interface::{ + storage::StorageViewCache, FinishedL1Batch, L1BatchEnv, SystemEnv, VmExecutionResultAndLogs, + }, utils::get_batch_base_fee, }; -use zksync_state::StorageViewCache; use zksync_types::{ block::BlockGasCount, fee_model::BatchFeeInput, storage_writes_deduplicator::StorageWritesDeduplicator, diff --git a/core/node/vm_runner/src/tests/storage.rs b/core/node/vm_runner/src/tests/storage.rs index 90aeda335e1d..1dfb5a60135a 100644 --- a/core/node/vm_runner/src/tests/storage.rs +++ b/core/node/vm_runner/src/tests/storage.rs @@ -9,7 +9,7 @@ use tokio::{ }; use zksync_dal::{ConnectionPool, Core, CoreDal}; use zksync_node_genesis::{insert_genesis_batch, GenesisParams}; -use zksync_state::{OwnedStorage, PostgresStorage, ReadStorage}; +use zksync_state::{interface::ReadStorage, OwnedStorage, PostgresStorage}; use zksync_test_account::Account; use zksync_types::{AccountTreeId, L1BatchNumber, L2ChainId, StorageKey}; diff --git a/core/tests/vm-benchmark/harness/src/instruction_counter.rs b/core/tests/vm-benchmark/harness/src/instruction_counter.rs index 017b13da44ca..ef21ac95b512 100644 --- a/core/tests/vm-benchmark/harness/src/instruction_counter.rs +++ b/core/tests/vm-benchmark/harness/src/instruction_counter.rs @@ -1,10 +1,11 @@ use std::{cell::RefCell, rc::Rc}; use zksync_multivm::{ - interface::{dyn_tracers::vm_1_5_0::DynTracer, tracer::TracerExecutionStatus}, + interface::{ + dyn_tracers::vm_1_5_0::DynTracer, storage::WriteStorage, tracer::TracerExecutionStatus, + }, vm_latest::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; -use zksync_state::WriteStorage; pub struct InstructionCounter { count: usize, diff --git a/core/tests/vm-benchmark/harness/src/lib.rs b/core/tests/vm-benchmark/harness/src/lib.rs index a30221cfa0be..f206728d40bb 100644 --- a/core/tests/vm-benchmark/harness/src/lib.rs +++ b/core/tests/vm-benchmark/harness/src/lib.rs @@ -4,13 +4,13 @@ use once_cell::sync::Lazy; use zksync_contracts::{deployer_contract, BaseSystemContracts}; use zksync_multivm::{ interface::{ - L2BlockEnv, TxExecutionMode, VmExecutionMode, VmExecutionResultAndLogs, VmInterface, + storage::InMemoryStorage, L2BlockEnv, TxExecutionMode, VmExecutionMode, + VmExecutionResultAndLogs, VmInterface, }, utils::get_max_gas_per_pubdata_byte, vm_fast::Vm, vm_latest::constants::BATCH_COMPUTATIONAL_GAS_LIMIT, }; -use zksync_state::InMemoryStorage; use zksync_types::{ block::L2BlockHasher, ethabi::{encode, Token}, From 4a0b9ed236a8e065081f7b9623cfeba2872eedf1 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 13:45:06 +0300 Subject: [PATCH 08/17] Move VM traits to interfaces --- Cargo.lock | 1 + core/lib/multivm/src/interface/mod.rs | 6 +-- core/lib/multivm/src/interface/traits/mod.rs | 1 - core/lib/vm_interface/Cargo.toml | 1 + core/lib/vm_interface/src/lib.rs | 24 +++++++----- .../traits => vm_interface/src}/vm.rs | 38 +------------------ 6 files changed, 20 insertions(+), 51 deletions(-) rename core/lib/{multivm/src/interface/traits => vm_interface/src}/vm.rs (78%) diff --git a/Cargo.lock b/Cargo.lock index 552f68ba7138..91ce0652ee92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9767,6 +9767,7 @@ dependencies = [ "zksync_contracts", "zksync_system_constants", "zksync_types", + "zksync_utils", ] [[package]] diff --git a/core/lib/multivm/src/interface/mod.rs b/core/lib/multivm/src/interface/mod.rs index 2dc577e3a1ac..e12b96f8aa90 100644 --- a/core/lib/multivm/src/interface/mod.rs +++ b/core/lib/multivm/src/interface/mod.rs @@ -1,8 +1,6 @@ pub(crate) mod traits; +// FIXME: re-export from root instead pub use zksync_vm_interface::*; -pub use self::traits::{ - tracers::dyn_tracers, - vm::{VmFactory, VmInterface, VmInterfaceHistoryEnabled}, -}; // FIXME: re-export from root instead +pub use self::traits::tracers::dyn_tracers; diff --git a/core/lib/multivm/src/interface/traits/mod.rs b/core/lib/multivm/src/interface/traits/mod.rs index a90c1c5281fc..0ce2cfa2a347 100644 --- a/core/lib/multivm/src/interface/traits/mod.rs +++ b/core/lib/multivm/src/interface/traits/mod.rs @@ -1,2 +1 @@ pub mod tracers; -pub mod vm; diff --git a/core/lib/vm_interface/Cargo.toml b/core/lib/vm_interface/Cargo.toml index b38ada434462..d813eefdee68 100644 --- a/core/lib/vm_interface/Cargo.toml +++ b/core/lib/vm_interface/Cargo.toml @@ -14,6 +14,7 @@ categories.workspace = true zksync_contracts.workspace = true zksync_system_constants.workspace = true zksync_types.workspace = true # FIXME: move VM-related types? (e.g., VM events, circuit stats) +zksync_utils.workspace = true # FIXME: move VM-related types? (e.g., compressed bytecodes) hex.workspace = true serde.workspace = true diff --git a/core/lib/vm_interface/src/lib.rs b/core/lib/vm_interface/src/lib.rs index 710b4a5798ab..1837bec4aff9 100644 --- a/core/lib/vm_interface/src/lib.rs +++ b/core/lib/vm_interface/src/lib.rs @@ -1,16 +1,22 @@ //! ZKsync Era VM interfaces. -pub use crate::types::{ - errors::{ - BytecodeCompressionError, Halt, TxRevertReason, VmRevertReason, VmRevertReasonParsingError, +pub use crate::{ + types::{ + errors::{ + BytecodeCompressionError, Halt, TxRevertReason, VmRevertReason, + VmRevertReasonParsingError, + }, + inputs::{L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode}, + outputs::{ + BootloaderMemory, CurrentExecutionState, ExecutionResult, FinishedL1Batch, L2Block, + Refunds, VmExecutionLogs, VmExecutionResultAndLogs, VmExecutionStatistics, + VmMemoryMetrics, + }, + tracer, }, - inputs::{L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode}, - outputs::{ - BootloaderMemory, CurrentExecutionState, ExecutionResult, FinishedL1Batch, L2Block, - Refunds, VmExecutionLogs, VmExecutionResultAndLogs, VmExecutionStatistics, VmMemoryMetrics, - }, - tracer, + vm::{VmFactory, VmInterface, VmInterfaceHistoryEnabled}, }; pub mod storage; mod types; +mod vm; diff --git a/core/lib/multivm/src/interface/traits/vm.rs b/core/lib/vm_interface/src/vm.rs similarity index 78% rename from core/lib/multivm/src/interface/traits/vm.rs rename to core/lib/vm_interface/src/vm.rs index 693add70658c..fd488e5100ca 100644 --- a/core/lib/multivm/src/interface/traits/vm.rs +++ b/core/lib/vm_interface/src/vm.rs @@ -10,47 +10,11 @@ //! //! Generally speaking, in most cases, the tracer dispatcher is a wrapper around `Vec>`, //! where `VmTracer` is a trait implemented for a specific VM version. -//! -//! Example usage: -//! ``` -//! use std::{ -//! cell::RefCell, -//! rc::Rc, -//! sync::Arc -//! }; -//! use once_cell::sync::OnceCell; -//! use zksync_multivm::{ -//! interface::{L1BatchEnv, SystemEnv, VmInterface}, -//! tracers::CallTracer , -//! vm_latest::ToTracerPointer -//! }; -//! use crate::interface::storage::{InMemoryStorage, StorageView}; -//! use zksync_types::Transaction; -//! -//! // Prepare the environment for the VM. -//! let l1_batch_env = L1BatchEnv::new(); -//! let system_env = SystemEnv::default(); -//! // Create storage -//! let storage = Rc::new(RefCell::new(StorageView::new(InMemoryStorage::default()))); -//! // Instantiate VM with the desired version. -//! let mut vm = multivm::vm_latest::Vm::new(l1_batch_env, system_env, storage); -//! // Push a transaction to the VM. -//! let tx = Transaction::default(); -//! vm.push_transaction(tx); -//! // Instantiate a tracer. -//! let result = Arc::new(OnceCell::new()); -//! let call_tracer = CallTracer::new(result.clone()).into_tracer_pointer(); -//! // Inspect the transaction with a tracer. You can use either one tracer or a vector of tracers. -//! let result = vm.inspect(call_tracer.into(), multivm::interface::VmExecutionMode::OneTx); -//! -//! // To obtain the result of the entire batch, you can use the following code: -//! let result = vm.execute(multivm::interface::VmExecutionMode::Batch); -//! ``` use zksync_types::Transaction; use zksync_utils::bytecode::CompressedBytecodeInfo; -use crate::interface::{ +use crate::{ storage::StoragePtr, BootloaderMemory, BytecodeCompressionError, CurrentExecutionState, FinishedL1Batch, L1BatchEnv, L2BlockEnv, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmMemoryMetrics, From c1257ec4f71dff1a239cde76645b770640bf15ad Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 14:00:47 +0300 Subject: [PATCH 09/17] Move tracer traits to `tracers` module --- core/bin/system-constants-generator/src/utils.rs | 2 +- core/lib/multivm/src/interface/mod.rs | 6 ------ core/lib/multivm/src/interface/traits/mod.rs | 1 - core/lib/multivm/src/interface/traits/tracers/mod.rs | 1 - core/lib/multivm/src/lib.rs | 2 +- .../multivm/src/tracers/call_tracer/vm_1_4_1/mod.rs | 3 +-- .../multivm/src/tracers/call_tracer/vm_1_4_2/mod.rs | 3 +-- .../tracers/call_tracer/vm_boojum_integration/mod.rs | 3 +-- .../multivm/src/tracers/call_tracer/vm_latest/mod.rs | 3 +-- .../tracers/call_tracer/vm_refunds_enhancement/mod.rs | 3 +-- .../src/tracers/call_tracer/vm_virtual_blocks/mod.rs | 3 +-- .../{interface/traits => }/tracers/dyn_tracers/mod.rs | 0 .../traits => }/tracers/dyn_tracers/vm_1_3_3.rs | 0 .../traits => }/tracers/dyn_tracers/vm_1_4_0.rs | 0 .../traits => }/tracers/dyn_tracers/vm_1_4_1.rs | 0 .../traits => }/tracers/dyn_tracers/vm_1_5_0.rs | 0 core/lib/multivm/src/tracers/mod.rs | 11 ++++++----- .../src/tracers/prestate_tracer/vm_1_4_1/mod.rs | 9 +++------ .../src/tracers/prestate_tracer/vm_1_4_2/mod.rs | 9 +++------ .../src/tracers/prestate_tracer/vm_latest/mod.rs | 9 +++------ .../prestate_tracer/vm_refunds_enhancement/mod.rs | 9 +++------ .../tracers/prestate_tracer/vm_virtual_blocks/mod.rs | 9 +++------ .../src/tracers/storage_invocation/vm_1_4_1/mod.rs | 3 +-- .../src/tracers/storage_invocation/vm_1_4_2/mod.rs | 3 +-- .../storage_invocation/vm_boojum_integration/mod.rs | 3 +-- .../src/tracers/storage_invocation/vm_latest/mod.rs | 3 +-- .../storage_invocation/vm_refunds_enhancement/mod.rs | 3 +-- .../storage_invocation/vm_virtual_blocks/mod.rs | 4 ++-- .../lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs | 10 ++++++---- .../lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs | 10 ++++++---- .../tracers/validator/vm_boojum_integration/mod.rs | 10 ++++++---- .../multivm/src/tracers/validator/vm_latest/mod.rs | 10 ++++++---- .../tracers/validator/vm_refunds_enhancement/mod.rs | 10 ++++++---- .../src/tracers/validator/vm_virtual_blocks/mod.rs | 10 ++++++---- .../src/versions/vm_1_4_1/tracers/circuits_tracer.rs | 2 +- .../src/versions/vm_1_4_1/tracers/default_tracers.rs | 2 +- .../src/versions/vm_1_4_1/tracers/dispatcher.rs | 2 +- .../src/versions/vm_1_4_1/tracers/pubdata_tracer.rs | 2 +- .../multivm/src/versions/vm_1_4_1/tracers/refunds.rs | 2 +- .../src/versions/vm_1_4_1/tracers/result_tracer.rs | 2 +- .../multivm/src/versions/vm_1_4_1/tracers/traits.rs | 2 +- .../src/versions/vm_1_4_2/tracers/circuits_tracer.rs | 2 +- .../src/versions/vm_1_4_2/tracers/default_tracers.rs | 2 +- .../src/versions/vm_1_4_2/tracers/dispatcher.rs | 2 +- .../src/versions/vm_1_4_2/tracers/pubdata_tracer.rs | 2 +- .../multivm/src/versions/vm_1_4_2/tracers/refunds.rs | 2 +- .../src/versions/vm_1_4_2/tracers/result_tracer.rs | 2 +- .../multivm/src/versions/vm_1_4_2/tracers/traits.rs | 2 +- .../vm_boojum_integration/tracers/circuits_tracer.rs | 2 +- .../vm_boojum_integration/tracers/default_tracers.rs | 2 +- .../vm_boojum_integration/tracers/dispatcher.rs | 2 +- .../vm_boojum_integration/tracers/pubdata_tracer.rs | 2 +- .../versions/vm_boojum_integration/tracers/refunds.rs | 2 +- .../vm_boojum_integration/tracers/result_tracer.rs | 2 +- .../versions/vm_boojum_integration/tracers/traits.rs | 2 +- .../multivm/src/versions/vm_latest/tests/rollbacks.rs | 2 +- .../src/versions/vm_latest/tracers/circuits_tracer.rs | 2 +- .../src/versions/vm_latest/tracers/default_tracers.rs | 2 +- .../src/versions/vm_latest/tracers/dispatcher.rs | 2 +- .../src/versions/vm_latest/tracers/pubdata_tracer.rs | 2 +- .../multivm/src/versions/vm_latest/tracers/refunds.rs | 2 +- .../src/versions/vm_latest/tracers/result_tracer.rs | 2 +- .../multivm/src/versions/vm_latest/tracers/traits.rs | 2 +- .../vm_refunds_enhancement/tracers/default_tracers.rs | 2 +- .../vm_refunds_enhancement/tracers/dispatcher.rs | 2 +- .../vm_refunds_enhancement/tracers/refunds.rs | 2 +- .../vm_refunds_enhancement/tracers/result_tracer.rs | 2 +- .../versions/vm_refunds_enhancement/tracers/traits.rs | 2 +- .../vm_virtual_blocks/tracers/default_tracers.rs | 2 +- .../versions/vm_virtual_blocks/tracers/dispatcher.rs | 2 +- .../src/versions/vm_virtual_blocks/tracers/refunds.rs | 2 +- .../vm_virtual_blocks/tracers/result_tracer.rs | 2 +- .../src/versions/vm_virtual_blocks/tracers/traits.rs | 6 ++---- .../vm-benchmark/harness/src/instruction_counter.rs | 5 ++--- 74 files changed, 114 insertions(+), 138 deletions(-) delete mode 100644 core/lib/multivm/src/interface/mod.rs delete mode 100644 core/lib/multivm/src/interface/traits/mod.rs delete mode 100644 core/lib/multivm/src/interface/traits/tracers/mod.rs rename core/lib/multivm/src/{interface/traits => }/tracers/dyn_tracers/mod.rs (100%) rename core/lib/multivm/src/{interface/traits => }/tracers/dyn_tracers/vm_1_3_3.rs (100%) rename core/lib/multivm/src/{interface/traits => }/tracers/dyn_tracers/vm_1_4_0.rs (100%) rename core/lib/multivm/src/{interface/traits => }/tracers/dyn_tracers/vm_1_4_1.rs (100%) rename core/lib/multivm/src/{interface/traits => }/tracers/dyn_tracers/vm_1_5_0.rs (100%) diff --git a/core/bin/system-constants-generator/src/utils.rs b/core/bin/system-constants-generator/src/utils.rs index 5b2abd0082eb..1ac4e0a8309b 100644 --- a/core/bin/system-constants-generator/src/utils.rs +++ b/core/bin/system-constants-generator/src/utils.rs @@ -7,12 +7,12 @@ use zksync_contracts::{ }; use zksync_multivm::{ interface::{ - dyn_tracers::vm_1_5_0::DynTracer, storage::{InMemoryStorage, StorageView, WriteStorage}, tracer::VmExecutionStopReason, L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode, VmFactory, VmInterface, }, + tracers::dyn_tracers::vm_1_5_0::DynTracer, vm_latest::{ constants::{BATCH_COMPUTATIONAL_GAS_LIMIT, BOOTLOADER_HEAP_PAGE}, BootloaderState, HistoryEnabled, HistoryMode, SimpleMemory, ToTracerPointer, Vm, VmTracer, diff --git a/core/lib/multivm/src/interface/mod.rs b/core/lib/multivm/src/interface/mod.rs deleted file mode 100644 index e12b96f8aa90..000000000000 --- a/core/lib/multivm/src/interface/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub(crate) mod traits; - -// FIXME: re-export from root instead -pub use zksync_vm_interface::*; - -pub use self::traits::tracers::dyn_tracers; diff --git a/core/lib/multivm/src/interface/traits/mod.rs b/core/lib/multivm/src/interface/traits/mod.rs deleted file mode 100644 index 0ce2cfa2a347..000000000000 --- a/core/lib/multivm/src/interface/traits/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod tracers; diff --git a/core/lib/multivm/src/interface/traits/tracers/mod.rs b/core/lib/multivm/src/interface/traits/tracers/mod.rs deleted file mode 100644 index f045674dfcf2..000000000000 --- a/core/lib/multivm/src/interface/traits/tracers/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod dyn_tracers; diff --git a/core/lib/multivm/src/lib.rs b/core/lib/multivm/src/lib.rs index 08b077ce3eab..77851a1df002 100644 --- a/core/lib/multivm/src/lib.rs +++ b/core/lib/multivm/src/lib.rs @@ -5,6 +5,7 @@ pub use circuit_sequencer_api_1_5_0 as circuit_sequencer_api_latest; pub use zk_evm_1_5_0 as zk_evm_latest; pub use zksync_types::vm::VmVersion; +pub use zksync_vm_interface as interface; pub use crate::{ glue::{ @@ -19,7 +20,6 @@ pub use crate::{ }; mod glue; -pub mod interface; pub mod tracers; pub mod utils; pub mod versions; diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_1_4_1/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_1_4_1/mod.rs index 77618ad3a5c4..67324cac31d0 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_1_4_1/mod.rs @@ -17,10 +17,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::VmExecutionStopReason, - traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, VmRevertReason, }, - tracers::call_tracer::CallTracer, + tracers::{call_tracer::CallTracer, dyn_tracers::vm_1_4_1::DynTracer}, vm_1_4_1::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_1_4_2/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_1_4_2/mod.rs index 5ce2749e6135..45a4fb0cf184 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_1_4_2/mod.rs @@ -17,10 +17,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::VmExecutionStopReason, - traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, VmRevertReason, }, - tracers::call_tracer::CallTracer, + tracers::{call_tracer::CallTracer, dyn_tracers::vm_1_4_1::DynTracer}, vm_1_4_2::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_boojum_integration/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_boojum_integration/mod.rs index afdab6d1e615..d82a3a302537 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_boojum_integration/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_boojum_integration/mod.rs @@ -17,10 +17,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::VmExecutionStopReason, - traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, VmRevertReason, }, - tracers::call_tracer::CallTracer, + tracers::{call_tracer::CallTracer, dyn_tracers::vm_1_4_0::DynTracer}, vm_boojum_integration::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_latest/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_latest/mod.rs index 14df6ff8c8fe..4cc537f45ab8 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_latest/mod.rs @@ -17,10 +17,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::VmExecutionStopReason, - traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, VmRevertReason, }, - tracers::call_tracer::CallTracer, + tracers::{call_tracer::CallTracer, dyn_tracers::vm_1_5_0::DynTracer}, vm_latest::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_refunds_enhancement/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_refunds_enhancement/mod.rs index 09b727e367f7..3b6c93a4ff97 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_refunds_enhancement/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_refunds_enhancement/mod.rs @@ -17,10 +17,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::VmExecutionStopReason, - traits::tracers::dyn_tracers::vm_1_3_3::DynTracer, VmRevertReason, }, - tracers::call_tracer::CallTracer, + tracers::{call_tracer::CallTracer, dyn_tracers::vm_1_3_3::DynTracer}, vm_refunds_enhancement::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_virtual_blocks/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_virtual_blocks/mod.rs index 27a1cd745b2a..b441cd38ed39 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_virtual_blocks/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_virtual_blocks/mod.rs @@ -15,11 +15,10 @@ use zksync_types::{ use crate::{ glue::GlueInto, interface::{ - dyn_tracers::vm_1_3_3::DynTracer, storage::{StoragePtr, WriteStorage}, VmExecutionResultAndLogs, VmRevertReason, }, - tracers::call_tracer::CallTracer, + tracers::{call_tracer::CallTracer, dyn_tracers::vm_1_3_3::DynTracer}, vm_virtual_blocks::{ ExecutionEndTracer, ExecutionProcessing, HistoryMode, SimpleMemory, VmTracer, }, diff --git a/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/mod.rs b/core/lib/multivm/src/tracers/dyn_tracers/mod.rs similarity index 100% rename from core/lib/multivm/src/interface/traits/tracers/dyn_tracers/mod.rs rename to core/lib/multivm/src/tracers/dyn_tracers/mod.rs diff --git a/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_3_3.rs b/core/lib/multivm/src/tracers/dyn_tracers/vm_1_3_3.rs similarity index 100% rename from core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_3_3.rs rename to core/lib/multivm/src/tracers/dyn_tracers/vm_1_3_3.rs diff --git a/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_4_0.rs b/core/lib/multivm/src/tracers/dyn_tracers/vm_1_4_0.rs similarity index 100% rename from core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_4_0.rs rename to core/lib/multivm/src/tracers/dyn_tracers/vm_1_4_0.rs diff --git a/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_4_1.rs b/core/lib/multivm/src/tracers/dyn_tracers/vm_1_4_1.rs similarity index 100% rename from core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_4_1.rs rename to core/lib/multivm/src/tracers/dyn_tracers/vm_1_4_1.rs diff --git a/core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_5_0.rs b/core/lib/multivm/src/tracers/dyn_tracers/vm_1_5_0.rs similarity index 100% rename from core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_5_0.rs rename to core/lib/multivm/src/tracers/dyn_tracers/vm_1_5_0.rs diff --git a/core/lib/multivm/src/tracers/mod.rs b/core/lib/multivm/src/tracers/mod.rs index 3090628fcac7..81333a10ab61 100644 --- a/core/lib/multivm/src/tracers/mod.rs +++ b/core/lib/multivm/src/tracers/mod.rs @@ -1,11 +1,12 @@ +pub use self::{ + call_tracer::CallTracer, multivm_dispatcher::TracerDispatcher, prestate_tracer::PrestateTracer, + storage_invocation::StorageInvocations, +}; + pub mod call_tracer; +pub mod dyn_tracers; mod multivm_dispatcher; pub mod old_tracers; pub mod prestate_tracer; pub mod storage_invocation; pub mod validator; - -pub use call_tracer::CallTracer; -pub use multivm_dispatcher::TracerDispatcher; -pub use prestate_tracer::PrestateTracer; -pub use storage_invocation::StorageInvocations; diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_1/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_1/mod.rs index a4d447baf75c..09c88390c7c5 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_1/mod.rs @@ -1,16 +1,13 @@ use zk_evm_1_4_1::tracing::{BeforeExecutionData, VmLocalStateData}; -use zksync_types::StorageKey; +use zksync_types::{StorageKey, U256}; use super::{ get_account_data, process_modified_storage_keys, process_result, PrestateTracer, State, StorageAccess, }; use crate::{ - interface::{ - dyn_tracers::vm_1_4_1::DynTracer, - storage::{StoragePtr, WriteStorage}, - }, - tracers::prestate_tracer::U256, + interface::storage::{StoragePtr, WriteStorage}, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_1::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_2/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_2/mod.rs index 16ed397a445d..71f9a45ad619 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_2/mod.rs @@ -1,16 +1,13 @@ use zk_evm_1_4_1::tracing::{BeforeExecutionData, VmLocalStateData}; -use zksync_types::StorageKey; +use zksync_types::{StorageKey, U256}; use super::{ get_account_data, process_modified_storage_keys, process_result, PrestateTracer, State, StorageAccess, }; use crate::{ - interface::{ - dyn_tracers::vm_1_4_1::DynTracer, - storage::{StoragePtr, WriteStorage}, - }, - tracers::prestate_tracer::U256, + interface::storage::{StoragePtr, WriteStorage}, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_2::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_latest/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_latest/mod.rs index 1ae364036909..2b9f40ccabe6 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_latest/mod.rs @@ -1,16 +1,13 @@ use zk_evm_1_5_0::tracing::{BeforeExecutionData, VmLocalStateData}; -use zksync_types::StorageKey; +use zksync_types::{StorageKey, U256}; use super::{ get_account_data, process_modified_storage_keys, process_result, PrestateTracer, State, StorageAccess, }; use crate::{ - interface::{ - dyn_tracers::vm_1_5_0::DynTracer, - storage::{StoragePtr, WriteStorage}, - }, - tracers::prestate_tracer::U256, + interface::storage::{StoragePtr, WriteStorage}, + tracers::dyn_tracers::vm_1_5_0::DynTracer, vm_latest::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_refunds_enhancement/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_refunds_enhancement/mod.rs index 9a560450c3e3..b88f45410a65 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_refunds_enhancement/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_refunds_enhancement/mod.rs @@ -1,18 +1,15 @@ use std::collections::HashMap; use zk_evm_1_3_3::tracing::{BeforeExecutionData, VmLocalStateData}; -use zksync_types::{StorageKey, H256}; +use zksync_types::{StorageKey, H256, U256}; use super::{ get_account_data, process_modified_storage_keys, process_result, PrestateTracer, State, StorageAccess, }; use crate::{ - interface::{ - dyn_tracers::vm_1_3_3::DynTracer, - storage::{StoragePtr, WriteStorage}, - }, - tracers::prestate_tracer::U256, + interface::storage::{StoragePtr, WriteStorage}, + tracers::dyn_tracers::vm_1_3_3::DynTracer, vm_refunds_enhancement::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_virtual_blocks/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_virtual_blocks/mod.rs index 7b94f7b5884b..9c7d650d9d0c 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_virtual_blocks/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_virtual_blocks/mod.rs @@ -1,18 +1,15 @@ use std::collections::HashMap; use zk_evm_1_3_3::tracing::{BeforeExecutionData, VmLocalStateData}; -use zksync_types::{StorageKey, H256}; +use zksync_types::{StorageKey, H256, U256}; use super::{ get_account_data, process_modified_storage_keys, process_result, PrestateTracer, State, StorageAccess, }; use crate::{ - interface::{ - dyn_tracers::vm_1_3_3::DynTracer, - storage::{StoragePtr, WriteStorage}, - }, - tracers::prestate_tracer::U256, + interface::storage::{StoragePtr, WriteStorage}, + tracers::dyn_tracers::vm_1_3_3::DynTracer, vm_virtual_blocks::{ BootloaderState, ExecutionEndTracer, ExecutionProcessing, HistoryMode, SimpleMemory, ZkSyncVmState, diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_1/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_1/mod.rs index ea60d7ff9e45..652f6406f0a8 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_1/mod.rs @@ -2,10 +2,9 @@ use crate::{ interface::{ storage::WriteStorage, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, Halt, }, - tracers::storage_invocation::StorageInvocations, + tracers::{dyn_tracers::vm_1_4_1::DynTracer, storage_invocation::StorageInvocations}, vm_1_4_1::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_2/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_2/mod.rs index 8c5770d02db3..6cd9f6b3e240 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_2/mod.rs @@ -2,10 +2,9 @@ use crate::{ interface::{ storage::WriteStorage, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, Halt, }, - tracers::storage_invocation::StorageInvocations, + tracers::{dyn_tracers::vm_1_4_1::DynTracer, storage_invocation::StorageInvocations}, vm_1_4_2::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_boojum_integration/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_boojum_integration/mod.rs index 55c982bc8f22..62890feac544 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_boojum_integration/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_boojum_integration/mod.rs @@ -2,10 +2,9 @@ use crate::{ interface::{ storage::WriteStorage, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, Halt, }, - tracers::storage_invocation::StorageInvocations, + tracers::{dyn_tracers::vm_1_4_0::DynTracer, storage_invocation::StorageInvocations}, vm_boojum_integration::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_latest/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_latest/mod.rs index 7220209728ef..bf8402e2efc9 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_latest/mod.rs @@ -2,10 +2,9 @@ use crate::{ interface::{ storage::WriteStorage, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, Halt, }, - tracers::storage_invocation::StorageInvocations, + tracers::{dyn_tracers::vm_1_5_0::DynTracer, storage_invocation::StorageInvocations}, vm_latest::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_refunds_enhancement/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_refunds_enhancement/mod.rs index 7874d7b6afd9..c682329d3f82 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_refunds_enhancement/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_refunds_enhancement/mod.rs @@ -2,10 +2,9 @@ use crate::{ interface::{ storage::WriteStorage, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_3_3::DynTracer, Halt, }, - tracers::storage_invocation::StorageInvocations, + tracers::{dyn_tracers::vm_1_3_3::DynTracer, storage_invocation::StorageInvocations}, vm_refunds_enhancement::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_virtual_blocks/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_virtual_blocks/mod.rs index 171a67fdb721..8f2645a2ae5a 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_virtual_blocks/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_virtual_blocks/mod.rs @@ -1,6 +1,6 @@ use crate::{ - interface::{dyn_tracers::vm_1_3_3::DynTracer, storage::WriteStorage}, - tracers::storage_invocation::StorageInvocations, + interface::storage::WriteStorage, + tracers::{dyn_tracers::vm_1_3_3::DynTracer, storage_invocation::StorageInvocations}, vm_virtual_blocks::{ BootloaderState, ExecutionEndTracer, ExecutionProcessing, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState, diff --git a/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs b/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs index 354429b17bcd..3b3202193e10 100644 --- a/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs @@ -12,12 +12,14 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, Halt, }, - tracers::validator::{ - types::{NewTrustedValidationItems, ValidationTracerMode}, - ValidationRoundResult, ValidationTracer, + tracers::{ + dyn_tracers::vm_1_4_1::DynTracer, + validator::{ + types::{NewTrustedValidationItems, ValidationTracerMode}, + ValidationRoundResult, ValidationTracer, + }, }, vm_1_4_1::{ tracers::utils::{ diff --git a/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs b/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs index a601d1456aa7..d43d8f221b6e 100644 --- a/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs @@ -12,12 +12,14 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, Halt, }, - tracers::validator::{ - types::{NewTrustedValidationItems, ValidationTracerMode}, - ValidationRoundResult, ValidationTracer, + tracers::{ + dyn_tracers::vm_1_4_1::DynTracer, + validator::{ + types::{NewTrustedValidationItems, ValidationTracerMode}, + ValidationRoundResult, ValidationTracer, + }, }, vm_1_4_2::{ tracers::utils::{ diff --git a/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs b/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs index ac9c6134b84e..fca33126b48b 100644 --- a/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs @@ -12,12 +12,14 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, Halt, }, - tracers::validator::{ - types::{NewTrustedValidationItems, ValidationTracerMode}, - ValidationRoundResult, ValidationTracer, + tracers::{ + dyn_tracers::vm_1_4_0::DynTracer, + validator::{ + types::{NewTrustedValidationItems, ValidationTracerMode}, + ValidationRoundResult, ValidationTracer, + }, }, vm_boojum_integration::{ tracers::utils::{ diff --git a/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs b/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs index 6a5c26e3181e..e893a88d1359 100644 --- a/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs @@ -12,12 +12,14 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, Halt, }, - tracers::validator::{ - types::{NewTrustedValidationItems, ValidationTracerMode}, - ValidationRoundResult, ValidationTracer, + tracers::{ + dyn_tracers::vm_1_5_0::DynTracer, + validator::{ + types::{NewTrustedValidationItems, ValidationTracerMode}, + ValidationRoundResult, ValidationTracer, + }, }, vm_latest::{ tracers::utils::{computational_gas_price, get_calldata_page_via_abi, VmHook}, diff --git a/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs b/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs index 92a26c72e439..178973b2b414 100644 --- a/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs @@ -12,12 +12,14 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_3_3::DynTracer, Halt, }, - tracers::validator::{ - types::{NewTrustedValidationItems, ValidationTracerMode}, - ValidationRoundResult, ValidationTracer, + tracers::{ + dyn_tracers::vm_1_3_3::DynTracer, + validator::{ + types::{NewTrustedValidationItems, ValidationTracerMode}, + ValidationRoundResult, ValidationTracer, + }, }, vm_refunds_enhancement::{ tracers::utils::{ diff --git a/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs b/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs index b29e25224f7f..9ccf11c902f4 100644 --- a/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs @@ -10,13 +10,15 @@ use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h25 use crate::{ interface::{ - dyn_tracers::vm_1_3_3::DynTracer, storage::{StoragePtr, WriteStorage}, VmExecutionResultAndLogs, }, - tracers::validator::{ - types::{NewTrustedValidationItems, ValidationTracerMode}, - ValidationRoundResult, ValidationTracer, + tracers::{ + dyn_tracers::vm_1_3_3::DynTracer, + validator::{ + types::{NewTrustedValidationItems, ValidationTracerMode}, + ValidationRoundResult, ValidationTracer, + }, }, vm_virtual_blocks::{ tracers::utils::{ diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_tracer.rs index 050c9cc849b5..1b47039e6091 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_tracer.rs @@ -10,10 +10,10 @@ use zksync_types::circuit::CircuitCycleStatistic; use super::circuits_capacity::*; use crate::{ interface::{ - dyn_tracers::vm_1_4_1::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::TracerExecutionStatus, }, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_1::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs index 19469cf20d98..b44109577b23 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs @@ -19,9 +19,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, Halt, VmExecutionMode, }, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_1::{ bootloader_state::{utils::apply_l2_block, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/dispatcher.rs index b680041fab13..b8c8f424663d 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/dispatcher.rs @@ -4,10 +4,10 @@ use zk_evm_1_4_1::tracing::{ use crate::{ interface::{ - dyn_tracers::vm_1_4_1::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_1::{ BootloaderState, HistoryMode, SimpleMemory, TracerPointer, VmTracer, ZkSyncVmState, }, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs index ee87bc38f5e0..97793b6540fd 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs @@ -17,11 +17,11 @@ use zksync_utils::{h256_to_u256, u256_to_bytes_be, u256_to_h256}; use crate::{ interface::{ - dyn_tracers::vm_1_4_1::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, L1BatchEnv, VmExecutionMode, }, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_1::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs index f7d0d9c028da..bb2db13e72de 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs @@ -19,9 +19,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::TracerExecutionStatus, - traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, L1BatchEnv, Refunds, }, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_1::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs index 2b9259bff83f..92658461d991 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs @@ -11,9 +11,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStopReason, VmExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_1::{ constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}, old_vm::utils::{vm_may_have_ended_inner, VmExecutionResult}, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/traits.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/traits.rs index 255b8dcbe072..c613c5cc6869 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/traits.rs @@ -1,9 +1,9 @@ use crate::{ interface::{ - dyn_tracers::vm_1_4_1::DynTracer, storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_1::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_tracer.rs index dfc381016d01..e36a74766a85 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_tracer.rs @@ -10,10 +10,10 @@ use zksync_types::circuit::CircuitCycleStatistic; use super::circuits_capacity::*; use crate::{ interface::{ - dyn_tracers::vm_1_4_1::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::TracerExecutionStatus, }, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_2::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs index 4fa3e229a674..1859118e0411 100755 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs @@ -19,9 +19,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, Halt, VmExecutionMode, }, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_2::{ bootloader_state::{utils::apply_l2_block, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/dispatcher.rs index d4d58d32b685..45966f026844 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/dispatcher.rs @@ -4,10 +4,10 @@ use zk_evm_1_4_1::tracing::{ use crate::{ interface::{ - dyn_tracers::vm_1_4_1::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_2::{ BootloaderState, HistoryMode, SimpleMemory, TracerPointer, VmTracer, ZkSyncVmState, }, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs index 8e0f7b740584..c880ca698f9c 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs @@ -17,11 +17,11 @@ use zksync_utils::{h256_to_u256, u256_to_bytes_be, u256_to_h256}; use crate::{ interface::{ - dyn_tracers::vm_1_4_1::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, L1BatchEnv, VmExecutionMode, }, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_2::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs index 950ac0be9748..5c8850095603 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs @@ -19,9 +19,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::TracerExecutionStatus, - traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, L1BatchEnv, Refunds, }, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_2::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs index 6fff033533d6..e95c70a984dd 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs @@ -11,9 +11,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStopReason, VmExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_4_1::DynTracer, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_2::{ constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}, old_vm::utils::{vm_may_have_ended_inner, VmExecutionResult}, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/traits.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/traits.rs index 02e2848eeb7e..28662e2a0eb3 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/traits.rs @@ -1,9 +1,9 @@ use crate::{ interface::{ - dyn_tracers::vm_1_4_1::DynTracer, storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, + tracers::dyn_tracers::vm_1_4_1::DynTracer, vm_1_4_2::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_tracer.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_tracer.rs index 396bbb50769c..54ae06602a70 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_tracer.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_tracer.rs @@ -10,10 +10,10 @@ use zksync_types::circuit::CircuitCycleStatistic; use super::circuits_capacity::*; use crate::{ interface::{ - dyn_tracers::vm_1_4_0::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::TracerExecutionStatus, }, + tracers::dyn_tracers::vm_1_4_0::DynTracer, vm_boojum_integration::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs index 4fb3ab3841e5..fdee7b8c7f19 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs @@ -18,9 +18,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, Halt, VmExecutionMode, }, + tracers::dyn_tracers::vm_1_4_0::DynTracer, vm_boojum_integration::{ bootloader_state::{utils::apply_l2_block, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/dispatcher.rs index 268c3c7c6899..0fb9f9fa11e9 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/dispatcher.rs @@ -4,10 +4,10 @@ use zk_evm_1_4_0::tracing::{ use crate::{ interface::{ - dyn_tracers::vm_1_4_0::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, + tracers::dyn_tracers::vm_1_4_0::DynTracer, vm_boojum_integration::{ BootloaderState, HistoryMode, SimpleMemory, TracerPointer, VmTracer, ZkSyncVmState, }, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs index 8c259cfa546c..19fde2cee2e3 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs @@ -17,11 +17,11 @@ use zksync_utils::{h256_to_u256, u256_to_bytes_be, u256_to_h256}; use crate::{ interface::{ - dyn_tracers::vm_1_4_0::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, L1BatchEnv, VmExecutionMode, }, + tracers::dyn_tracers::vm_1_4_0::DynTracer, vm_boojum_integration::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs index bd65aa9df796..26bd66827655 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs @@ -18,9 +18,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::TracerExecutionStatus, - traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, L1BatchEnv, Refunds, }, + tracers::dyn_tracers::vm_1_4_0::DynTracer, vm_boojum_integration::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs index 5ee123d7084d..5bd2e3ac5f90 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs @@ -11,9 +11,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStopReason, VmExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_4_0::DynTracer, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, + tracers::dyn_tracers::vm_1_4_0::DynTracer, vm_boojum_integration::{ constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}, old_vm::utils::{vm_may_have_ended_inner, VmExecutionResult}, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/traits.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/traits.rs index 0a7788573047..2b0e08a9100f 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/traits.rs @@ -1,9 +1,9 @@ use crate::{ interface::{ - dyn_tracers::vm_1_4_0::DynTracer, storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, + tracers::dyn_tracers::vm_1_4_0::DynTracer, vm_boojum_integration::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs b/core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs index ebc0a57dc59a..538101e1eb2f 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs @@ -4,11 +4,11 @@ use zksync_types::{get_nonce_key, Execute, U256}; use crate::{ interface::{ - dyn_tracers::vm_1_5_0::DynTracer, storage::WriteStorage, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, TxExecutionMode, VmExecutionMode, VmInterface, VmInterfaceHistoryEnabled, }, + tracers::dyn_tracers::vm_1_5_0::DynTracer, vm_latest::{ tests::{ tester::{DeployContractsTx, TransactionTestInfo, TxModifier, TxType, VmTesterBuilder}, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/circuits_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tracers/circuits_tracer.rs index ba59b5067996..d77667808e9e 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/circuits_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/circuits_tracer.rs @@ -10,10 +10,10 @@ use zksync_types::circuit::CircuitCycleStatistic; use super::circuits_capacity::*; use crate::{ interface::{ - dyn_tracers::vm_1_5_0::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::TracerExecutionStatus, }, + tracers::dyn_tracers::vm_1_5_0::DynTracer, vm_latest::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs index 6d710223b80c..1337b33b9cdd 100755 --- a/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs @@ -17,11 +17,11 @@ use super::PubdataTracer; use crate::{ glue::GlueInto, interface::{ - dyn_tracers::vm_1_5_0::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, Halt, VmExecutionMode, }, + tracers::dyn_tracers::vm_1_5_0::DynTracer, vm_latest::{ bootloader_state::{utils::apply_l2_block, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_latest/tracers/dispatcher.rs index af52de40c3d3..3bac924f3445 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/dispatcher.rs @@ -4,10 +4,10 @@ use zk_evm_1_5_0::tracing::{ use crate::{ interface::{ - dyn_tracers::vm_1_5_0::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, + tracers::dyn_tracers::vm_1_5_0::DynTracer, vm_latest::{ BootloaderState, HistoryMode, SimpleMemory, TracerPointer, VmTracer, ZkSyncVmState, }, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs index 62a66abaf872..a0ad29ef8a47 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs @@ -17,11 +17,11 @@ use zksync_utils::{h256_to_u256, u256_to_bytes_be, u256_to_h256}; use crate::{ interface::{ - dyn_tracers::vm_1_5_0::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason}, L1BatchEnv, VmExecutionMode, }, + tracers::dyn_tracers::vm_1_5_0::DynTracer, vm_latest::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs index e19e235a259b..7da9dd45e9c4 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs @@ -12,9 +12,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::TracerExecutionStatus, - traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, L1BatchEnv, Refunds, }, + tracers::dyn_tracers::vm_1_5_0::DynTracer, vm_latest::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs index 7d0a21669282..419c17b40a02 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs @@ -12,9 +12,9 @@ use crate::{ interface::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStopReason, VmExecutionStopReason}, - traits::tracers::dyn_tracers::vm_1_5_0::DynTracer, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, + tracers::dyn_tracers::vm_1_5_0::DynTracer, vm_latest::{ constants::{get_result_success_first_slot, BOOTLOADER_HEAP_PAGE}, old_vm::utils::{vm_may_have_ended_inner, VmExecutionResult}, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/traits.rs b/core/lib/multivm/src/versions/vm_latest/tracers/traits.rs index 501a0848da8b..ff9a3e8743aa 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/traits.rs @@ -1,9 +1,9 @@ use crate::{ interface::{ - dyn_tracers::vm_1_5_0::DynTracer, storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, + tracers::dyn_tracers::vm_1_5_0::DynTracer, vm_latest::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/default_tracers.rs index 8a33835e1b72..8dbeb25f73fd 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/default_tracers.rs @@ -12,11 +12,11 @@ use zk_evm_1_3_3::{ use crate::{ interface::{ - dyn_tracers::vm_1_3_3::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, Halt, VmExecutionMode, }, + tracers::dyn_tracers::vm_1_3_3::DynTracer, vm_refunds_enhancement::{ bootloader_state::{utils::apply_l2_block, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/dispatcher.rs index e2168b55187c..ce43280928fd 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/dispatcher.rs @@ -4,10 +4,10 @@ use zk_evm_1_3_3::tracing::{ use crate::{ interface::{ - dyn_tracers::vm_1_3_3::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, + tracers::dyn_tracers::vm_1_3_3::DynTracer, vm_refunds_enhancement::{ BootloaderState, HistoryMode, SimpleMemory, TracerPointer, VmTracer, ZkSyncVmState, }, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/refunds.rs index 2e352da199a5..629eb4fee591 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/refunds.rs @@ -14,11 +14,11 @@ use zksync_utils::{bytecode::bytecode_len_in_bytes, ceil_div_u256, u256_to_h256} use crate::{ interface::{ - dyn_tracers::vm_1_3_3::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::TracerExecutionStatus, L1BatchEnv, Refunds, }, + tracers::dyn_tracers::vm_1_3_3::DynTracer, vm_refunds_enhancement::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/result_tracer.rs index 4e6f7ce94d69..bb0d7eec4f1d 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/result_tracer.rs @@ -7,11 +7,11 @@ use zksync_types::U256; use crate::{ interface::{ - dyn_tracers::vm_1_3_3::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStopReason, VmExecutionStopReason}, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, + tracers::dyn_tracers::vm_1_3_3::DynTracer, vm_refunds_enhancement::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/traits.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/traits.rs index a0474233268f..4a99a88562a3 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/traits.rs @@ -1,9 +1,9 @@ use crate::{ interface::{ - dyn_tracers::vm_1_3_3::DynTracer, storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, + tracers::dyn_tracers::vm_1_3_3::DynTracer, vm_refunds_enhancement::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs index 660550624e2c..76a64c36020a 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs @@ -15,11 +15,11 @@ use zk_evm_1_3_3::{ use crate::{ interface::{ - dyn_tracers::vm_1_3_3::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::VmExecutionStopReason, VmExecutionMode, }, + tracers::dyn_tracers::vm_1_3_3::DynTracer, vm_virtual_blocks::{ bootloader_state::{utils::apply_l2_block, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/dispatcher.rs index b290f6a0e7f4..aad8d2932380 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/dispatcher.rs @@ -4,11 +4,11 @@ use zk_evm_1_3_3::tracing::{ use crate::{ interface::{ - dyn_tracers::vm_1_3_3::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::VmExecutionStopReason, VmExecutionResultAndLogs, }, + tracers::dyn_tracers::vm_1_3_3::DynTracer, vm_virtual_blocks::{ BootloaderState, ExecutionEndTracer, ExecutionProcessing, HistoryMode, SimpleMemory, TracerPointer, VmTracer, ZkSyncVmState, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs index 040e3c746483..e79185f623b2 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs @@ -17,10 +17,10 @@ use zksync_utils::{bytecode::bytecode_len_in_bytes, ceil_div_u256, u256_to_h256} use crate::{ interface::{ - dyn_tracers::vm_1_3_3::DynTracer, storage::{StoragePtr, WriteStorage}, L1BatchEnv, Refunds, VmExecutionResultAndLogs, }, + tracers::dyn_tracers::vm_1_3_3::DynTracer, vm_virtual_blocks::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs index fdafa4bb8a8b..46a59b6d5071 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs @@ -7,12 +7,12 @@ use zksync_types::U256; use crate::{ interface::{ - dyn_tracers::vm_1_3_3::DynTracer, storage::{StoragePtr, WriteStorage}, tracer::VmExecutionStopReason, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmExecutionResultAndLogs, VmRevertReason, }, + tracers::dyn_tracers::vm_1_3_3::DynTracer, vm_virtual_blocks::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs index 733db21c23a2..959ad19b1a01 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs @@ -1,8 +1,6 @@ use crate::{ - interface::{ - dyn_tracers::vm_1_3_3::DynTracer, storage::WriteStorage, tracer::VmExecutionStopReason, - VmExecutionResultAndLogs, - }, + interface::{storage::WriteStorage, tracer::VmExecutionStopReason, VmExecutionResultAndLogs}, + tracers::dyn_tracers::vm_1_3_3::DynTracer, vm_virtual_blocks::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/tests/vm-benchmark/harness/src/instruction_counter.rs b/core/tests/vm-benchmark/harness/src/instruction_counter.rs index ef21ac95b512..1fffdf08007f 100644 --- a/core/tests/vm-benchmark/harness/src/instruction_counter.rs +++ b/core/tests/vm-benchmark/harness/src/instruction_counter.rs @@ -1,9 +1,8 @@ use std::{cell::RefCell, rc::Rc}; use zksync_multivm::{ - interface::{ - dyn_tracers::vm_1_5_0::DynTracer, storage::WriteStorage, tracer::TracerExecutionStatus, - }, + interface::{storage::WriteStorage, tracer::TracerExecutionStatus}, + tracers::dyn_tracers::vm_1_5_0::DynTracer, vm_latest::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; From 0a2c59fadc6b3b2dd7ee766c5681f48ce58ce9c7 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 14:10:26 +0300 Subject: [PATCH 10/17] Brush up `tracers` module --- .../bin/system-constants-generator/src/utils.rs | 2 +- core/lib/multivm/src/glue/tracers/mod.rs | 2 +- core/lib/multivm/src/tracers/call_tracer/mod.rs | 4 ++-- .../src/tracers/call_tracer/vm_1_4_1/mod.rs | 2 +- .../src/tracers/call_tracer/vm_1_4_2/mod.rs | 2 +- .../call_tracer/vm_boojum_integration/mod.rs | 2 +- .../src/tracers/call_tracer/vm_latest/mod.rs | 2 +- .../call_tracer/vm_refunds_enhancement/mod.rs | 2 +- .../call_tracer/vm_virtual_blocks/mod.rs | 2 +- .../src/tracers/{dyn_tracers => dynamic}/mod.rs | 0 .../{dyn_tracers => dynamic}/vm_1_3_3.rs | 0 .../{dyn_tracers => dynamic}/vm_1_4_0.rs | 0 .../{dyn_tracers => dynamic}/vm_1_4_1.rs | 0 .../{dyn_tracers => dynamic}/vm_1_5_0.rs | 0 core/lib/multivm/src/tracers/mod.rs | 17 ++++++++++------- .../multivm/src/tracers/multivm_dispatcher.rs | 6 ++---- .../src/tracers/{old_tracers.rs => old.rs} | 0 .../src/tracers/prestate_tracer/vm_1_4_1/mod.rs | 2 +- .../src/tracers/prestate_tracer/vm_1_4_2/mod.rs | 2 +- .../tracers/prestate_tracer/vm_latest/mod.rs | 2 +- .../vm_refunds_enhancement/mod.rs | 2 +- .../prestate_tracer/vm_virtual_blocks/mod.rs | 2 +- .../src/tracers/storage_invocation/mod.rs | 2 +- .../tracers/storage_invocation/vm_1_4_1/mod.rs | 2 +- .../tracers/storage_invocation/vm_1_4_2/mod.rs | 2 +- .../vm_boojum_integration/mod.rs | 2 +- .../tracers/storage_invocation/vm_latest/mod.rs | 2 +- .../vm_refunds_enhancement/mod.rs | 2 +- .../storage_invocation/vm_virtual_blocks/mod.rs | 2 +- .../src/tracers/validator/vm_1_4_1/mod.rs | 2 +- .../src/tracers/validator/vm_1_4_2/mod.rs | 2 +- .../validator/vm_boojum_integration/mod.rs | 2 +- .../src/tracers/validator/vm_latest/mod.rs | 2 +- .../validator/vm_refunds_enhancement/mod.rs | 2 +- .../tracers/validator/vm_virtual_blocks/mod.rs | 2 +- core/lib/multivm/src/versions/vm_1_3_2/vm.rs | 2 +- .../vm_1_4_1/tracers/circuits_tracer.rs | 2 +- .../vm_1_4_1/tracers/default_tracers.rs | 2 +- .../src/versions/vm_1_4_1/tracers/dispatcher.rs | 2 +- .../versions/vm_1_4_1/tracers/pubdata_tracer.rs | 2 +- .../src/versions/vm_1_4_1/tracers/refunds.rs | 2 +- .../versions/vm_1_4_1/tracers/result_tracer.rs | 2 +- .../src/versions/vm_1_4_1/tracers/traits.rs | 2 +- .../vm_1_4_2/tracers/circuits_tracer.rs | 2 +- .../vm_1_4_2/tracers/default_tracers.rs | 2 +- .../src/versions/vm_1_4_2/tracers/dispatcher.rs | 2 +- .../versions/vm_1_4_2/tracers/pubdata_tracer.rs | 2 +- .../src/versions/vm_1_4_2/tracers/refunds.rs | 2 +- .../versions/vm_1_4_2/tracers/result_tracer.rs | 2 +- .../src/versions/vm_1_4_2/tracers/traits.rs | 2 +- .../tracers/circuits_tracer.rs | 2 +- .../tracers/default_tracers.rs | 2 +- .../vm_boojum_integration/tracers/dispatcher.rs | 2 +- .../tracers/pubdata_tracer.rs | 2 +- .../vm_boojum_integration/tracers/refunds.rs | 2 +- .../tracers/result_tracer.rs | 2 +- .../vm_boojum_integration/tracers/traits.rs | 2 +- .../src/versions/vm_latest/tests/rollbacks.rs | 2 +- .../vm_latest/tracers/circuits_tracer.rs | 2 +- .../vm_latest/tracers/default_tracers.rs | 2 +- .../versions/vm_latest/tracers/dispatcher.rs | 2 +- .../vm_latest/tracers/pubdata_tracer.rs | 2 +- .../src/versions/vm_latest/tracers/refunds.rs | 2 +- .../versions/vm_latest/tracers/result_tracer.rs | 2 +- .../src/versions/vm_latest/tracers/traits.rs | 2 +- core/lib/multivm/src/versions/vm_m6/vm.rs | 2 +- .../tracers/default_tracers.rs | 2 +- .../tracers/dispatcher.rs | 2 +- .../vm_refunds_enhancement/tracers/refunds.rs | 2 +- .../tracers/result_tracer.rs | 2 +- .../vm_refunds_enhancement/tracers/traits.rs | 2 +- .../tracers/default_tracers.rs | 2 +- .../vm_virtual_blocks/tracers/dispatcher.rs | 2 +- .../vm_virtual_blocks/tracers/refunds.rs | 2 +- .../vm_virtual_blocks/tracers/result_tracer.rs | 2 +- .../vm_virtual_blocks/tracers/traits.rs | 2 +- .../src/execution_sandbox/validate.rs | 12 +++++------- .../harness/src/instruction_counter.rs | 2 +- 78 files changed, 87 insertions(+), 88 deletions(-) rename core/lib/multivm/src/tracers/{dyn_tracers => dynamic}/mod.rs (100%) rename core/lib/multivm/src/tracers/{dyn_tracers => dynamic}/vm_1_3_3.rs (100%) rename core/lib/multivm/src/tracers/{dyn_tracers => dynamic}/vm_1_4_0.rs (100%) rename core/lib/multivm/src/tracers/{dyn_tracers => dynamic}/vm_1_4_1.rs (100%) rename core/lib/multivm/src/tracers/{dyn_tracers => dynamic}/vm_1_5_0.rs (100%) rename core/lib/multivm/src/tracers/{old_tracers.rs => old.rs} (100%) diff --git a/core/bin/system-constants-generator/src/utils.rs b/core/bin/system-constants-generator/src/utils.rs index 1ac4e0a8309b..96de0537d538 100644 --- a/core/bin/system-constants-generator/src/utils.rs +++ b/core/bin/system-constants-generator/src/utils.rs @@ -12,7 +12,7 @@ use zksync_multivm::{ L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode, VmFactory, VmInterface, }, - tracers::dyn_tracers::vm_1_5_0::DynTracer, + tracers::dynamic::vm_1_5_0::DynTracer, vm_latest::{ constants::{BATCH_COMPUTATIONAL_GAS_LIMIT, BOOTLOADER_HEAP_PAGE}, BootloaderState, HistoryEnabled, HistoryMode, SimpleMemory, ToTracerPointer, Vm, VmTracer, diff --git a/core/lib/multivm/src/glue/tracers/mod.rs b/core/lib/multivm/src/glue/tracers/mod.rs index c54cb1dcf76d..bf2f67cae501 100644 --- a/core/lib/multivm/src/glue/tracers/mod.rs +++ b/core/lib/multivm/src/glue/tracers/mod.rs @@ -30,7 +30,7 @@ //! - Add this trait as a trait bound for `T` in `MultiVMTracer` implementation. //! - Implement the trait for `T` with a bound to `VmTracer` for a specific version. -use crate::{interface::storage::WriteStorage, tracers::old_tracers::OldTracers, HistoryMode}; +use crate::{interface::storage::WriteStorage, tracers::old::OldTracers, HistoryMode}; pub type MultiVmTracerPointer = Box>; diff --git a/core/lib/multivm/src/tracers/call_tracer/mod.rs b/core/lib/multivm/src/tracers/call_tracer/mod.rs index 855768067b8a..4013be101e57 100644 --- a/core/lib/multivm/src/tracers/call_tracer/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/mod.rs @@ -92,7 +92,7 @@ impl CallTracer { } impl IntoOldVmTracer for CallTracer { - fn old_tracer(&self) -> crate::tracers::old_tracers::OldTracers { - crate::tracers::old_tracers::OldTracers::CallTracer(self.result.clone()) + fn old_tracer(&self) -> crate::tracers::old::OldTracers { + crate::tracers::old::OldTracers::CallTracer(self.result.clone()) } } diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_1_4_1/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_1_4_1/mod.rs index 67324cac31d0..10ea9ba250ec 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_1_4_1/mod.rs @@ -19,7 +19,7 @@ use crate::{ tracer::VmExecutionStopReason, VmRevertReason, }, - tracers::{call_tracer::CallTracer, dyn_tracers::vm_1_4_1::DynTracer}, + tracers::{dynamic::vm_1_4_1::DynTracer, CallTracer}, vm_1_4_1::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_1_4_2/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_1_4_2/mod.rs index 45a4fb0cf184..0464164a50a7 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_1_4_2/mod.rs @@ -19,7 +19,7 @@ use crate::{ tracer::VmExecutionStopReason, VmRevertReason, }, - tracers::{call_tracer::CallTracer, dyn_tracers::vm_1_4_1::DynTracer}, + tracers::{dynamic::vm_1_4_1::DynTracer, CallTracer}, vm_1_4_2::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_boojum_integration/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_boojum_integration/mod.rs index d82a3a302537..a8d035e6c1cc 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_boojum_integration/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_boojum_integration/mod.rs @@ -19,7 +19,7 @@ use crate::{ tracer::VmExecutionStopReason, VmRevertReason, }, - tracers::{call_tracer::CallTracer, dyn_tracers::vm_1_4_0::DynTracer}, + tracers::{dynamic::vm_1_4_0::DynTracer, CallTracer}, vm_boojum_integration::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_latest/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_latest/mod.rs index 4cc537f45ab8..8b1ccfa5b7af 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_latest/mod.rs @@ -19,7 +19,7 @@ use crate::{ tracer::VmExecutionStopReason, VmRevertReason, }, - tracers::{call_tracer::CallTracer, dyn_tracers::vm_1_5_0::DynTracer}, + tracers::{dynamic::vm_1_5_0::DynTracer, CallTracer}, vm_latest::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_refunds_enhancement/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_refunds_enhancement/mod.rs index 3b6c93a4ff97..30a2effb9f5c 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_refunds_enhancement/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_refunds_enhancement/mod.rs @@ -19,7 +19,7 @@ use crate::{ tracer::VmExecutionStopReason, VmRevertReason, }, - tracers::{call_tracer::CallTracer, dyn_tracers::vm_1_3_3::DynTracer}, + tracers::{dynamic::vm_1_3_3::DynTracer, CallTracer}, vm_refunds_enhancement::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/call_tracer/vm_virtual_blocks/mod.rs b/core/lib/multivm/src/tracers/call_tracer/vm_virtual_blocks/mod.rs index b441cd38ed39..0e3bea139d6f 100644 --- a/core/lib/multivm/src/tracers/call_tracer/vm_virtual_blocks/mod.rs +++ b/core/lib/multivm/src/tracers/call_tracer/vm_virtual_blocks/mod.rs @@ -18,7 +18,7 @@ use crate::{ storage::{StoragePtr, WriteStorage}, VmExecutionResultAndLogs, VmRevertReason, }, - tracers::{call_tracer::CallTracer, dyn_tracers::vm_1_3_3::DynTracer}, + tracers::{dynamic::vm_1_3_3::DynTracer, CallTracer}, vm_virtual_blocks::{ ExecutionEndTracer, ExecutionProcessing, HistoryMode, SimpleMemory, VmTracer, }, diff --git a/core/lib/multivm/src/tracers/dyn_tracers/mod.rs b/core/lib/multivm/src/tracers/dynamic/mod.rs similarity index 100% rename from core/lib/multivm/src/tracers/dyn_tracers/mod.rs rename to core/lib/multivm/src/tracers/dynamic/mod.rs diff --git a/core/lib/multivm/src/tracers/dyn_tracers/vm_1_3_3.rs b/core/lib/multivm/src/tracers/dynamic/vm_1_3_3.rs similarity index 100% rename from core/lib/multivm/src/tracers/dyn_tracers/vm_1_3_3.rs rename to core/lib/multivm/src/tracers/dynamic/vm_1_3_3.rs diff --git a/core/lib/multivm/src/tracers/dyn_tracers/vm_1_4_0.rs b/core/lib/multivm/src/tracers/dynamic/vm_1_4_0.rs similarity index 100% rename from core/lib/multivm/src/tracers/dyn_tracers/vm_1_4_0.rs rename to core/lib/multivm/src/tracers/dynamic/vm_1_4_0.rs diff --git a/core/lib/multivm/src/tracers/dyn_tracers/vm_1_4_1.rs b/core/lib/multivm/src/tracers/dynamic/vm_1_4_1.rs similarity index 100% rename from core/lib/multivm/src/tracers/dyn_tracers/vm_1_4_1.rs rename to core/lib/multivm/src/tracers/dynamic/vm_1_4_1.rs diff --git a/core/lib/multivm/src/tracers/dyn_tracers/vm_1_5_0.rs b/core/lib/multivm/src/tracers/dynamic/vm_1_5_0.rs similarity index 100% rename from core/lib/multivm/src/tracers/dyn_tracers/vm_1_5_0.rs rename to core/lib/multivm/src/tracers/dynamic/vm_1_5_0.rs diff --git a/core/lib/multivm/src/tracers/mod.rs b/core/lib/multivm/src/tracers/mod.rs index 81333a10ab61..0a6517a6cd2f 100644 --- a/core/lib/multivm/src/tracers/mod.rs +++ b/core/lib/multivm/src/tracers/mod.rs @@ -1,12 +1,15 @@ pub use self::{ - call_tracer::CallTracer, multivm_dispatcher::TracerDispatcher, prestate_tracer::PrestateTracer, + call_tracer::CallTracer, + multivm_dispatcher::TracerDispatcher, + prestate_tracer::PrestateTracer, storage_invocation::StorageInvocations, + validator::{ValidationError, ValidationTracer, ValidationTracerParams}, }; -pub mod call_tracer; -pub mod dyn_tracers; +mod call_tracer; +pub mod dynamic; mod multivm_dispatcher; -pub mod old_tracers; -pub mod prestate_tracer; -pub mod storage_invocation; -pub mod validator; +pub mod old; +mod prestate_tracer; +mod storage_invocation; +mod validator; diff --git a/core/lib/multivm/src/tracers/multivm_dispatcher.rs b/core/lib/multivm/src/tracers/multivm_dispatcher.rs index e23bb7c19f84..0a15ece53152 100644 --- a/core/lib/multivm/src/tracers/multivm_dispatcher.rs +++ b/core/lib/multivm/src/tracers/multivm_dispatcher.rs @@ -1,6 +1,4 @@ -use crate::{ - interface::storage::WriteStorage, tracers::old_tracers, HistoryMode, MultiVmTracerPointer, -}; +use crate::{interface::storage::WriteStorage, tracers::old, HistoryMode, MultiVmTracerPointer}; /// Tracer dispatcher is a tracer that can dispatch calls to multiple tracers. pub struct TracerDispatcher { @@ -100,7 +98,7 @@ impl From> for () { fn from(_value: TracerDispatcher) -> Self {} } -impl From> for old_tracers::TracerDispatcher { +impl From> for old::TracerDispatcher { fn from(value: TracerDispatcher) -> Self { Self::new(value.tracers.into_iter().map(|x| x.old_tracer()).collect()) } diff --git a/core/lib/multivm/src/tracers/old_tracers.rs b/core/lib/multivm/src/tracers/old.rs similarity index 100% rename from core/lib/multivm/src/tracers/old_tracers.rs rename to core/lib/multivm/src/tracers/old.rs diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_1/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_1/mod.rs index 09c88390c7c5..2433138e341c 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_1/mod.rs @@ -7,7 +7,7 @@ use super::{ }; use crate::{ interface::storage::{StoragePtr, WriteStorage}, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_1::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_2/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_2/mod.rs index 71f9a45ad619..834b3e2d3540 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_1_4_2/mod.rs @@ -7,7 +7,7 @@ use super::{ }; use crate::{ interface::storage::{StoragePtr, WriteStorage}, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_2::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_latest/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_latest/mod.rs index 2b9f40ccabe6..de9cc20e395a 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_latest/mod.rs @@ -7,7 +7,7 @@ use super::{ }; use crate::{ interface::storage::{StoragePtr, WriteStorage}, - tracers::dyn_tracers::vm_1_5_0::DynTracer, + tracers::dynamic::vm_1_5_0::DynTracer, vm_latest::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_refunds_enhancement/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_refunds_enhancement/mod.rs index b88f45410a65..d236a744b5a7 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_refunds_enhancement/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_refunds_enhancement/mod.rs @@ -9,7 +9,7 @@ use super::{ }; use crate::{ interface::storage::{StoragePtr, WriteStorage}, - tracers::dyn_tracers::vm_1_3_3::DynTracer, + tracers::dynamic::vm_1_3_3::DynTracer, vm_refunds_enhancement::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/prestate_tracer/vm_virtual_blocks/mod.rs b/core/lib/multivm/src/tracers/prestate_tracer/vm_virtual_blocks/mod.rs index 9c7d650d9d0c..13e755bf96b2 100644 --- a/core/lib/multivm/src/tracers/prestate_tracer/vm_virtual_blocks/mod.rs +++ b/core/lib/multivm/src/tracers/prestate_tracer/vm_virtual_blocks/mod.rs @@ -9,7 +9,7 @@ use super::{ }; use crate::{ interface::storage::{StoragePtr, WriteStorage}, - tracers::dyn_tracers::vm_1_3_3::DynTracer, + tracers::dynamic::vm_1_3_3::DynTracer, vm_virtual_blocks::{ BootloaderState, ExecutionEndTracer, ExecutionProcessing, HistoryMode, SimpleMemory, ZkSyncVmState, diff --git a/core/lib/multivm/src/tracers/storage_invocation/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/mod.rs index 8c9677ba8d7c..2b81845a2de1 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/mod.rs @@ -1,4 +1,4 @@ -use crate::{glue::tracers::IntoOldVmTracer, tracers::old_tracers::OldTracers}; +use crate::{glue::tracers::IntoOldVmTracer, tracers::old::OldTracers}; pub mod vm_1_4_1; pub mod vm_1_4_2; diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_1/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_1/mod.rs index 652f6406f0a8..97037014e469 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_1/mod.rs @@ -4,7 +4,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason}, Halt, }, - tracers::{dyn_tracers::vm_1_4_1::DynTracer, storage_invocation::StorageInvocations}, + tracers::{dynamic::vm_1_4_1::DynTracer, StorageInvocations}, vm_1_4_1::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_2/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_2/mod.rs index 6cd9f6b3e240..07c02c5984ca 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_1_4_2/mod.rs @@ -4,7 +4,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason}, Halt, }, - tracers::{dyn_tracers::vm_1_4_1::DynTracer, storage_invocation::StorageInvocations}, + tracers::{dynamic::vm_1_4_1::DynTracer, StorageInvocations}, vm_1_4_2::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_boojum_integration/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_boojum_integration/mod.rs index 62890feac544..4b10ba7cbb4e 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_boojum_integration/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_boojum_integration/mod.rs @@ -4,7 +4,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason}, Halt, }, - tracers::{dyn_tracers::vm_1_4_0::DynTracer, storage_invocation::StorageInvocations}, + tracers::{dynamic::vm_1_4_0::DynTracer, StorageInvocations}, vm_boojum_integration::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_latest/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_latest/mod.rs index bf8402e2efc9..8eb1dac1fdf1 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_latest/mod.rs @@ -4,7 +4,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason}, Halt, }, - tracers::{dyn_tracers::vm_1_5_0::DynTracer, storage_invocation::StorageInvocations}, + tracers::{dynamic::vm_1_5_0::DynTracer, StorageInvocations}, vm_latest::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_refunds_enhancement/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_refunds_enhancement/mod.rs index c682329d3f82..db4bfd299ea5 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_refunds_enhancement/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_refunds_enhancement/mod.rs @@ -4,7 +4,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason}, Halt, }, - tracers::{dyn_tracers::vm_1_3_3::DynTracer, storage_invocation::StorageInvocations}, + tracers::{dynamic::vm_1_3_3::DynTracer, StorageInvocations}, vm_refunds_enhancement::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; diff --git a/core/lib/multivm/src/tracers/storage_invocation/vm_virtual_blocks/mod.rs b/core/lib/multivm/src/tracers/storage_invocation/vm_virtual_blocks/mod.rs index 8f2645a2ae5a..d6f67aa55630 100644 --- a/core/lib/multivm/src/tracers/storage_invocation/vm_virtual_blocks/mod.rs +++ b/core/lib/multivm/src/tracers/storage_invocation/vm_virtual_blocks/mod.rs @@ -1,6 +1,6 @@ use crate::{ interface::storage::WriteStorage, - tracers::{dyn_tracers::vm_1_3_3::DynTracer, storage_invocation::StorageInvocations}, + tracers::{dynamic::vm_1_3_3::DynTracer, StorageInvocations}, vm_virtual_blocks::{ BootloaderState, ExecutionEndTracer, ExecutionProcessing, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState, diff --git a/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs b/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs index 3b3202193e10..4e04ce898b16 100644 --- a/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs @@ -15,7 +15,7 @@ use crate::{ Halt, }, tracers::{ - dyn_tracers::vm_1_4_1::DynTracer, + dynamic::vm_1_4_1::DynTracer, validator::{ types::{NewTrustedValidationItems, ValidationTracerMode}, ValidationRoundResult, ValidationTracer, diff --git a/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs b/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs index d43d8f221b6e..d2e4daccfaaa 100644 --- a/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs @@ -15,7 +15,7 @@ use crate::{ Halt, }, tracers::{ - dyn_tracers::vm_1_4_1::DynTracer, + dynamic::vm_1_4_1::DynTracer, validator::{ types::{NewTrustedValidationItems, ValidationTracerMode}, ValidationRoundResult, ValidationTracer, diff --git a/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs b/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs index fca33126b48b..5b73e143a9d8 100644 --- a/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs @@ -15,7 +15,7 @@ use crate::{ Halt, }, tracers::{ - dyn_tracers::vm_1_4_0::DynTracer, + dynamic::vm_1_4_0::DynTracer, validator::{ types::{NewTrustedValidationItems, ValidationTracerMode}, ValidationRoundResult, ValidationTracer, diff --git a/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs b/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs index e893a88d1359..728cae41ade5 100644 --- a/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs @@ -15,7 +15,7 @@ use crate::{ Halt, }, tracers::{ - dyn_tracers::vm_1_5_0::DynTracer, + dynamic::vm_1_5_0::DynTracer, validator::{ types::{NewTrustedValidationItems, ValidationTracerMode}, ValidationRoundResult, ValidationTracer, diff --git a/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs b/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs index 178973b2b414..795966be23a8 100644 --- a/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs @@ -15,7 +15,7 @@ use crate::{ Halt, }, tracers::{ - dyn_tracers::vm_1_3_3::DynTracer, + dynamic::vm_1_3_3::DynTracer, validator::{ types::{NewTrustedValidationItems, ValidationTracerMode}, ValidationRoundResult, ValidationTracer, diff --git a/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs b/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs index 9ccf11c902f4..30bdc5360717 100644 --- a/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs @@ -14,7 +14,7 @@ use crate::{ VmExecutionResultAndLogs, }, tracers::{ - dyn_tracers::vm_1_3_3::DynTracer, + dynamic::vm_1_3_3::DynTracer, validator::{ types::{NewTrustedValidationItems, ValidationTracerMode}, ValidationRoundResult, ValidationTracer, diff --git a/core/lib/multivm/src/versions/vm_1_3_2/vm.rs b/core/lib/multivm/src/versions/vm_1_3_2/vm.rs index 07aa7be09d42..3bf5ae25e39f 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/vm.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/vm.rs @@ -19,7 +19,7 @@ use crate::{ VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, }, - tracers::old_tracers::TracerDispatcher, + tracers::old::TracerDispatcher, vm_1_3_2::{events::merge_events, VmInstance}, }; diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_tracer.rs index 1b47039e6091..43a41897fddb 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_tracer.rs @@ -13,7 +13,7 @@ use crate::{ storage::{StoragePtr, WriteStorage}, tracer::TracerExecutionStatus, }, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_1::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs index b44109577b23..a4f32df8bc73 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/default_tracers.rs @@ -21,7 +21,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, Halt, VmExecutionMode, }, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_1::{ bootloader_state::{utils::apply_l2_block, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/dispatcher.rs index b8c8f424663d..187731753cdf 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/dispatcher.rs @@ -7,7 +7,7 @@ use crate::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_1::{ BootloaderState, HistoryMode, SimpleMemory, TracerPointer, VmTracer, ZkSyncVmState, }, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs index 97793b6540fd..d32691ebdfb0 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs @@ -21,7 +21,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason}, L1BatchEnv, VmExecutionMode, }, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_1::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs index bb2db13e72de..6de4b170eb1b 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/refunds.rs @@ -21,7 +21,7 @@ use crate::{ tracer::TracerExecutionStatus, L1BatchEnv, Refunds, }, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_1::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs index 92658461d991..ffec3ae9030d 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/result_tracer.rs @@ -13,7 +13,7 @@ use crate::{ tracer::{TracerExecutionStopReason, VmExecutionStopReason}, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_1::{ constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}, old_vm::utils::{vm_may_have_ended_inner, VmExecutionResult}, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/traits.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/traits.rs index c613c5cc6869..abe6c988545b 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/traits.rs @@ -3,7 +3,7 @@ use crate::{ storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_1::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_tracer.rs index e36a74766a85..b781ee186fdd 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_tracer.rs @@ -13,7 +13,7 @@ use crate::{ storage::{StoragePtr, WriteStorage}, tracer::TracerExecutionStatus, }, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_2::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs index 1859118e0411..c7bdf3de3530 100755 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/default_tracers.rs @@ -21,7 +21,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, Halt, VmExecutionMode, }, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_2::{ bootloader_state::{utils::apply_l2_block, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/dispatcher.rs index 45966f026844..1d1c50b615b5 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/dispatcher.rs @@ -7,7 +7,7 @@ use crate::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_2::{ BootloaderState, HistoryMode, SimpleMemory, TracerPointer, VmTracer, ZkSyncVmState, }, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs index c880ca698f9c..fab790ec5727 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs @@ -21,7 +21,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason}, L1BatchEnv, VmExecutionMode, }, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_2::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs index 5c8850095603..6af3a34376c7 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/refunds.rs @@ -21,7 +21,7 @@ use crate::{ tracer::TracerExecutionStatus, L1BatchEnv, Refunds, }, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_2::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs index e95c70a984dd..2936d7663d1b 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/result_tracer.rs @@ -13,7 +13,7 @@ use crate::{ tracer::{TracerExecutionStopReason, VmExecutionStopReason}, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_2::{ constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}, old_vm::utils::{vm_may_have_ended_inner, VmExecutionResult}, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/traits.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/traits.rs index 28662e2a0eb3..ce213b534966 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/traits.rs @@ -3,7 +3,7 @@ use crate::{ storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, - tracers::dyn_tracers::vm_1_4_1::DynTracer, + tracers::dynamic::vm_1_4_1::DynTracer, vm_1_4_2::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_tracer.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_tracer.rs index 54ae06602a70..9bcf2a3783f5 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_tracer.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_tracer.rs @@ -13,7 +13,7 @@ use crate::{ storage::{StoragePtr, WriteStorage}, tracer::TracerExecutionStatus, }, - tracers::dyn_tracers::vm_1_4_0::DynTracer, + tracers::dynamic::vm_1_4_0::DynTracer, vm_boojum_integration::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs index fdee7b8c7f19..2730fb701b1f 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/default_tracers.rs @@ -20,7 +20,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, Halt, VmExecutionMode, }, - tracers::dyn_tracers::vm_1_4_0::DynTracer, + tracers::dynamic::vm_1_4_0::DynTracer, vm_boojum_integration::{ bootloader_state::{utils::apply_l2_block, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/dispatcher.rs index 0fb9f9fa11e9..6825186319ac 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/dispatcher.rs @@ -7,7 +7,7 @@ use crate::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, - tracers::dyn_tracers::vm_1_4_0::DynTracer, + tracers::dynamic::vm_1_4_0::DynTracer, vm_boojum_integration::{ BootloaderState, HistoryMode, SimpleMemory, TracerPointer, VmTracer, ZkSyncVmState, }, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs index 19fde2cee2e3..6727dfd54e8c 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs @@ -21,7 +21,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason}, L1BatchEnv, VmExecutionMode, }, - tracers::dyn_tracers::vm_1_4_0::DynTracer, + tracers::dynamic::vm_1_4_0::DynTracer, vm_boojum_integration::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs index 26bd66827655..5f2ceb105b99 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/refunds.rs @@ -20,7 +20,7 @@ use crate::{ tracer::TracerExecutionStatus, L1BatchEnv, Refunds, }, - tracers::dyn_tracers::vm_1_4_0::DynTracer, + tracers::dynamic::vm_1_4_0::DynTracer, vm_boojum_integration::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs index 5bd2e3ac5f90..d32200bc177d 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/result_tracer.rs @@ -13,7 +13,7 @@ use crate::{ tracer::{TracerExecutionStopReason, VmExecutionStopReason}, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, - tracers::dyn_tracers::vm_1_4_0::DynTracer, + tracers::dynamic::vm_1_4_0::DynTracer, vm_boojum_integration::{ constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}, old_vm::utils::{vm_may_have_ended_inner, VmExecutionResult}, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/traits.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/traits.rs index 2b0e08a9100f..c7b2b66ee262 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/traits.rs @@ -3,7 +3,7 @@ use crate::{ storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, - tracers::dyn_tracers::vm_1_4_0::DynTracer, + tracers::dynamic::vm_1_4_0::DynTracer, vm_boojum_integration::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs b/core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs index 538101e1eb2f..489c762aac4e 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs @@ -8,7 +8,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason}, TxExecutionMode, VmExecutionMode, VmInterface, VmInterfaceHistoryEnabled, }, - tracers::dyn_tracers::vm_1_5_0::DynTracer, + tracers::dynamic::vm_1_5_0::DynTracer, vm_latest::{ tests::{ tester::{DeployContractsTx, TransactionTestInfo, TxModifier, TxType, VmTesterBuilder}, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/circuits_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tracers/circuits_tracer.rs index d77667808e9e..b3a0e2480dcf 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/circuits_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/circuits_tracer.rs @@ -13,7 +13,7 @@ use crate::{ storage::{StoragePtr, WriteStorage}, tracer::TracerExecutionStatus, }, - tracers::dyn_tracers::vm_1_5_0::DynTracer, + tracers::dynamic::vm_1_5_0::DynTracer, vm_latest::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs index 1337b33b9cdd..6a908c2a73ed 100755 --- a/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs @@ -21,7 +21,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, Halt, VmExecutionMode, }, - tracers::dyn_tracers::vm_1_5_0::DynTracer, + tracers::dynamic::vm_1_5_0::DynTracer, vm_latest::{ bootloader_state::{utils::apply_l2_block, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_latest/tracers/dispatcher.rs index 3bac924f3445..3c3ef1173f53 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/dispatcher.rs @@ -7,7 +7,7 @@ use crate::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, - tracers::dyn_tracers::vm_1_5_0::DynTracer, + tracers::dynamic::vm_1_5_0::DynTracer, vm_latest::{ BootloaderState, HistoryMode, SimpleMemory, TracerPointer, VmTracer, ZkSyncVmState, }, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs index a0ad29ef8a47..edd244a2d082 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs @@ -21,7 +21,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason}, L1BatchEnv, VmExecutionMode, }, - tracers::dyn_tracers::vm_1_5_0::DynTracer, + tracers::dynamic::vm_1_5_0::DynTracer, vm_latest::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs index 7da9dd45e9c4..78826a16313d 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs @@ -14,7 +14,7 @@ use crate::{ tracer::TracerExecutionStatus, L1BatchEnv, Refunds, }, - tracers::dyn_tracers::vm_1_5_0::DynTracer, + tracers::dynamic::vm_1_5_0::DynTracer, vm_latest::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs index 419c17b40a02..6ba00f4a0998 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs @@ -14,7 +14,7 @@ use crate::{ tracer::{TracerExecutionStopReason, VmExecutionStopReason}, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, - tracers::dyn_tracers::vm_1_5_0::DynTracer, + tracers::dynamic::vm_1_5_0::DynTracer, vm_latest::{ constants::{get_result_success_first_slot, BOOTLOADER_HEAP_PAGE}, old_vm::utils::{vm_may_have_ended_inner, VmExecutionResult}, diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/traits.rs b/core/lib/multivm/src/versions/vm_latest/tracers/traits.rs index ff9a3e8743aa..76dab3dd70a1 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/traits.rs @@ -3,7 +3,7 @@ use crate::{ storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, - tracers::dyn_tracers::vm_1_5_0::DynTracer, + tracers::dynamic::vm_1_5_0::DynTracer, vm_latest::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_m6/vm.rs b/core/lib/multivm/src/versions/vm_m6/vm.rs index 9a57869fea37..3626378ce59e 100644 --- a/core/lib/multivm/src/versions/vm_m6/vm.rs +++ b/core/lib/multivm/src/versions/vm_m6/vm.rs @@ -21,7 +21,7 @@ use crate::{ VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, VmMemoryMetrics, }, - tracers::old_tracers::TracerDispatcher, + tracers::old::TracerDispatcher, vm_m6::{events::merge_events, storage::Storage, vm_instance::MultiVMSubversion, VmInstance}, }; diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/default_tracers.rs index 8dbeb25f73fd..595f1851f82a 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/default_tracers.rs @@ -16,7 +16,7 @@ use crate::{ tracer::{TracerExecutionStatus, TracerExecutionStopReason, VmExecutionStopReason}, Halt, VmExecutionMode, }, - tracers::dyn_tracers::vm_1_3_3::DynTracer, + tracers::dynamic::vm_1_3_3::DynTracer, vm_refunds_enhancement::{ bootloader_state::{utils::apply_l2_block, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/dispatcher.rs index ce43280928fd..7d3f508383c5 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/dispatcher.rs @@ -7,7 +7,7 @@ use crate::{ storage::{StoragePtr, WriteStorage}, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, - tracers::dyn_tracers::vm_1_3_3::DynTracer, + tracers::dynamic::vm_1_3_3::DynTracer, vm_refunds_enhancement::{ BootloaderState, HistoryMode, SimpleMemory, TracerPointer, VmTracer, ZkSyncVmState, }, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/refunds.rs index 629eb4fee591..cb56acd7e43c 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/refunds.rs @@ -18,7 +18,7 @@ use crate::{ tracer::TracerExecutionStatus, L1BatchEnv, Refunds, }, - tracers::dyn_tracers::vm_1_3_3::DynTracer, + tracers::dynamic::vm_1_3_3::DynTracer, vm_refunds_enhancement::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/result_tracer.rs index bb0d7eec4f1d..cc8dc93b5f9a 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/result_tracer.rs @@ -11,7 +11,7 @@ use crate::{ tracer::{TracerExecutionStopReason, VmExecutionStopReason}, ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmRevertReason, }, - tracers::dyn_tracers::vm_1_3_3::DynTracer, + tracers::dynamic::vm_1_3_3::DynTracer, vm_refunds_enhancement::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/traits.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/traits.rs index 4a99a88562a3..a05043a6d448 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/tracers/traits.rs @@ -3,7 +3,7 @@ use crate::{ storage::WriteStorage, tracer::{TracerExecutionStatus, VmExecutionStopReason}, }, - tracers::dyn_tracers::vm_1_3_3::DynTracer, + tracers::dynamic::vm_1_3_3::DynTracer, vm_refunds_enhancement::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs index 76a64c36020a..d1a4a0932ffa 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs @@ -19,7 +19,7 @@ use crate::{ tracer::VmExecutionStopReason, VmExecutionMode, }, - tracers::dyn_tracers::vm_1_3_3::DynTracer, + tracers::dynamic::vm_1_3_3::DynTracer, vm_virtual_blocks::{ bootloader_state::{utils::apply_l2_block, BootloaderState}, constants::BOOTLOADER_HEAP_PAGE, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/dispatcher.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/dispatcher.rs index aad8d2932380..efd91e3d3c89 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/dispatcher.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/dispatcher.rs @@ -8,7 +8,7 @@ use crate::{ tracer::VmExecutionStopReason, VmExecutionResultAndLogs, }, - tracers::dyn_tracers::vm_1_3_3::DynTracer, + tracers::dynamic::vm_1_3_3::DynTracer, vm_virtual_blocks::{ BootloaderState, ExecutionEndTracer, ExecutionProcessing, HistoryMode, SimpleMemory, TracerPointer, VmTracer, ZkSyncVmState, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs index e79185f623b2..b97d86889c86 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs @@ -20,7 +20,7 @@ use crate::{ storage::{StoragePtr, WriteStorage}, L1BatchEnv, Refunds, VmExecutionResultAndLogs, }, - tracers::dyn_tracers::vm_1_3_3::DynTracer, + tracers::dynamic::vm_1_3_3::DynTracer, vm_virtual_blocks::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs index 46a59b6d5071..5c0e371a9bc4 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs @@ -12,7 +12,7 @@ use crate::{ ExecutionResult, Halt, TxRevertReason, VmExecutionMode, VmExecutionResultAndLogs, VmRevertReason, }, - tracers::dyn_tracers::vm_1_3_3::DynTracer, + tracers::dynamic::vm_1_3_3::DynTracer, vm_virtual_blocks::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs index 959ad19b1a01..aa3b78ed7c5b 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs @@ -1,6 +1,6 @@ use crate::{ interface::{storage::WriteStorage, tracer::VmExecutionStopReason, VmExecutionResultAndLogs}, - tracers::dyn_tracers::vm_1_3_3::DynTracer, + tracers::dynamic::vm_1_3_3::DynTracer, vm_virtual_blocks::{ bootloader_state::BootloaderState, old_vm::{history_recorder::HistoryMode, memory::SimpleMemory}, diff --git a/core/node/api_server/src/execution_sandbox/validate.rs b/core/node/api_server/src/execution_sandbox/validate.rs index 5e958cada66e..a856386b4562 100644 --- a/core/node/api_server/src/execution_sandbox/validate.rs +++ b/core/node/api_server/src/execution_sandbox/validate.rs @@ -5,8 +5,8 @@ use zksync_dal::{Connection, ConnectionPool, Core, CoreDal}; use zksync_multivm::{ interface::{ExecutionResult, VmExecutionMode, VmInterface}, tracers::{ - validator::{self, ValidationTracer, ValidationTracerParams}, - StorageInvocations, + StorageInvocations, ValidationError as RawValidationError, ValidationTracer, + ValidationTracerParams, }, vm_latest::HistoryDisabled, MultiVMTracer, @@ -25,7 +25,7 @@ use super::{ #[derive(Debug, thiserror::Error)] pub(crate) enum ValidationError { #[error("VM validation error: {0}")] - Vm(validator::ValidationError), + Vm(RawValidationError), #[error("Internal error")] Internal(#[from] anyhow::Error), } @@ -94,11 +94,9 @@ impl TransactionExecutor { ); let result = match (result.result, validation_result.get()) { - (_, Some(err)) => { - Err(validator::ValidationError::ViolatedRule(err.clone())) - } + (_, Some(err)) => Err(RawValidationError::ViolatedRule(err.clone())), (ExecutionResult::Halt { reason }, _) => { - Err(validator::ValidationError::FailedTx(reason)) + Err(RawValidationError::FailedTx(reason)) } (_, None) => Ok(()), }; diff --git a/core/tests/vm-benchmark/harness/src/instruction_counter.rs b/core/tests/vm-benchmark/harness/src/instruction_counter.rs index 1fffdf08007f..28e6d1519656 100644 --- a/core/tests/vm-benchmark/harness/src/instruction_counter.rs +++ b/core/tests/vm-benchmark/harness/src/instruction_counter.rs @@ -2,7 +2,7 @@ use std::{cell::RefCell, rc::Rc}; use zksync_multivm::{ interface::{storage::WriteStorage, tracer::TracerExecutionStatus}, - tracers::dyn_tracers::vm_1_5_0::DynTracer, + tracers::dynamic::vm_1_5_0::DynTracer, vm_latest::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, }; From 72b933100ac09141c42d0532083db7cc1ff29224 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 14:41:09 +0300 Subject: [PATCH 11/17] Move types from `zksync_types::vm_trace` --- core/lib/multivm/src/tracers/validator/mod.rs | 7 +- .../multivm/src/tracers/validator/types.rs | 39 +++++++- .../src/tracers/validator/vm_1_4_1/mod.rs | 6 +- .../src/tracers/validator/vm_1_4_2/mod.rs | 6 +- .../validator/vm_boojum_integration/mod.rs | 6 +- .../src/tracers/validator/vm_latest/mod.rs | 6 +- .../validator/vm_refunds_enhancement/mod.rs | 6 +- .../validator/vm_virtual_blocks/mod.rs | 6 +- core/lib/multivm/src/versions/mod.rs | 1 + core/lib/multivm/src/versions/shared.rs | 46 +++++++++ core/lib/multivm/src/versions/vm_1_3_2/mod.rs | 1 - .../src/versions/vm_1_3_2/vm_instance.rs | 3 +- core/lib/multivm/src/versions/vm_m5/mod.rs | 1 - .../multivm/src/versions/vm_m5/vm_instance.rs | 2 +- core/lib/multivm/src/versions/vm_m6/mod.rs | 1 - .../multivm/src/versions/vm_m6/vm_instance.rs | 3 +- core/lib/types/src/vm_trace.rs | 94 +------------------ core/lib/web3_decl/src/types.rs | 1 - 18 files changed, 106 insertions(+), 129 deletions(-) create mode 100644 core/lib/multivm/src/versions/shared.rs diff --git a/core/lib/multivm/src/tracers/validator/mod.rs b/core/lib/multivm/src/tracers/validator/mod.rs index 1e91df901279..a91006368b6a 100644 --- a/core/lib/multivm/src/tracers/validator/mod.rs +++ b/core/lib/multivm/src/tracers/validator/mod.rs @@ -6,8 +6,7 @@ use zksync_system_constants::{ L2_BASE_TOKEN_ADDRESS, MSG_VALUE_SIMULATOR_ADDRESS, SYSTEM_CONTEXT_ADDRESS, }; use zksync_types::{ - vm::VmVersion, vm_trace::ViolatedValidationRule, web3::keccak256, AccountTreeId, Address, - StorageKey, H256, U256, + vm::VmVersion, web3::keccak256, AccountTreeId, Address, StorageKey, H256, U256, }; use zksync_utils::{be_bytes_to_safe_address, u256_to_account_address, u256_to_h256}; @@ -15,7 +14,9 @@ pub use crate::tracers::validator::types::{ValidationError, ValidationTracerPara use crate::{ glue::tracers::IntoOldVmTracer, interface::storage::{StoragePtr, WriteStorage}, - tracers::validator::types::{NewTrustedValidationItems, ValidationTracerMode}, + tracers::validator::types::{ + NewTrustedValidationItems, ValidationTracerMode, ViolatedValidationRule, + }, }; mod types; diff --git a/core/lib/multivm/src/tracers/validator/types.rs b/core/lib/multivm/src/tracers/validator/types.rs index de6217c29889..418d2b893503 100644 --- a/core/lib/multivm/src/tracers/validator/types.rs +++ b/core/lib/multivm/src/tracers/validator/types.rs @@ -1,6 +1,7 @@ -use std::{collections::HashSet, fmt::Display}; +use std::{collections::HashSet, fmt, fmt::Display}; -use zksync_types::{vm_trace::ViolatedValidationRule, Address, H256, U256}; +use zksync_types::{Address, H256, U256}; +use zksync_utils::u256_to_h256; use crate::interface::Halt; @@ -37,6 +38,40 @@ pub struct ValidationTracerParams { pub computational_gas_limit: u32, } +#[derive(Debug, Clone)] +pub enum ViolatedValidationRule { + TouchedUnallowedStorageSlots(Address, U256), + CalledContractWithNoCode(Address), + TouchedUnallowedContext, + TookTooManyComputationalGas(u32), +} + +impl fmt::Display for ViolatedValidationRule { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + ViolatedValidationRule::TouchedUnallowedStorageSlots(contract, key) => write!( + f, + "Touched unallowed storage slots: address {}, key: {}", + hex::encode(contract), + hex::encode(u256_to_h256(*key)) + ), + ViolatedValidationRule::CalledContractWithNoCode(contract) => { + write!(f, "Called contract with no code: {}", hex::encode(contract)) + } + ViolatedValidationRule::TouchedUnallowedContext => { + write!(f, "Touched unallowed context") + } + ViolatedValidationRule::TookTooManyComputationalGas(gas_limit) => { + write!( + f, + "Took too many computational gas, allowed limit: {}", + gas_limit + ) + } + } + } +} + #[derive(Debug, Clone)] pub enum ValidationError { FailedTx(Halt), diff --git a/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs b/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs index 4e04ce898b16..2beca41fb481 100644 --- a/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_1_4_1/mod.rs @@ -3,9 +3,7 @@ use zk_evm_1_4_1::{ zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; use zksync_system_constants::KECCAK256_PRECOMPILE_ADDRESS; -use zksync_types::{ - get_code_key, vm_trace::ViolatedValidationRule, AccountTreeId, StorageKey, H256, -}; +use zksync_types::{get_code_key, AccountTreeId, StorageKey, H256}; use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h256}; use crate::{ @@ -17,7 +15,7 @@ use crate::{ tracers::{ dynamic::vm_1_4_1::DynTracer, validator::{ - types::{NewTrustedValidationItems, ValidationTracerMode}, + types::{NewTrustedValidationItems, ValidationTracerMode, ViolatedValidationRule}, ValidationRoundResult, ValidationTracer, }, }, diff --git a/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs b/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs index d2e4daccfaaa..3394a6c3f2b5 100644 --- a/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_1_4_2/mod.rs @@ -3,9 +3,7 @@ use zk_evm_1_4_1::{ zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; use zksync_system_constants::KECCAK256_PRECOMPILE_ADDRESS; -use zksync_types::{ - get_code_key, vm_trace::ViolatedValidationRule, AccountTreeId, StorageKey, H256, -}; +use zksync_types::{get_code_key, AccountTreeId, StorageKey, H256}; use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h256}; use crate::{ @@ -17,7 +15,7 @@ use crate::{ tracers::{ dynamic::vm_1_4_1::DynTracer, validator::{ - types::{NewTrustedValidationItems, ValidationTracerMode}, + types::{NewTrustedValidationItems, ValidationTracerMode, ViolatedValidationRule}, ValidationRoundResult, ValidationTracer, }, }, diff --git a/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs b/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs index 5b73e143a9d8..53b5bf04d2e7 100644 --- a/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_boojum_integration/mod.rs @@ -3,9 +3,7 @@ use zk_evm_1_4_0::{ zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; use zksync_system_constants::KECCAK256_PRECOMPILE_ADDRESS; -use zksync_types::{ - get_code_key, vm_trace::ViolatedValidationRule, AccountTreeId, StorageKey, H256, -}; +use zksync_types::{get_code_key, AccountTreeId, StorageKey, H256}; use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h256}; use crate::{ @@ -17,7 +15,7 @@ use crate::{ tracers::{ dynamic::vm_1_4_0::DynTracer, validator::{ - types::{NewTrustedValidationItems, ValidationTracerMode}, + types::{NewTrustedValidationItems, ValidationTracerMode, ViolatedValidationRule}, ValidationRoundResult, ValidationTracer, }, }, diff --git a/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs b/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs index 728cae41ade5..e963c79f4e41 100644 --- a/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs @@ -3,9 +3,7 @@ use zk_evm_1_5_0::{ zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; use zksync_system_constants::KECCAK256_PRECOMPILE_ADDRESS; -use zksync_types::{ - get_code_key, vm_trace::ViolatedValidationRule, AccountTreeId, StorageKey, H256, -}; +use zksync_types::{get_code_key, AccountTreeId, StorageKey, H256}; use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h256}; use crate::{ @@ -17,7 +15,7 @@ use crate::{ tracers::{ dynamic::vm_1_5_0::DynTracer, validator::{ - types::{NewTrustedValidationItems, ValidationTracerMode}, + types::{NewTrustedValidationItems, ValidationTracerMode, ViolatedValidationRule}, ValidationRoundResult, ValidationTracer, }, }, diff --git a/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs b/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs index 795966be23a8..6107125d14d0 100644 --- a/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_refunds_enhancement/mod.rs @@ -3,9 +3,7 @@ use zk_evm_1_3_3::{ zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; use zksync_system_constants::KECCAK256_PRECOMPILE_ADDRESS; -use zksync_types::{ - get_code_key, vm_trace::ViolatedValidationRule, AccountTreeId, StorageKey, H256, -}; +use zksync_types::{get_code_key, AccountTreeId, StorageKey, H256}; use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h256}; use crate::{ @@ -17,7 +15,7 @@ use crate::{ tracers::{ dynamic::vm_1_3_3::DynTracer, validator::{ - types::{NewTrustedValidationItems, ValidationTracerMode}, + types::{NewTrustedValidationItems, ValidationTracerMode, ViolatedValidationRule}, ValidationRoundResult, ValidationTracer, }, }, diff --git a/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs b/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs index 30bdc5360717..bb166bedcdad 100644 --- a/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_virtual_blocks/mod.rs @@ -3,9 +3,7 @@ use zk_evm_1_3_3::{ zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; use zksync_system_constants::KECCAK256_PRECOMPILE_ADDRESS; -use zksync_types::{ - get_code_key, vm_trace::ViolatedValidationRule, AccountTreeId, StorageKey, H256, -}; +use zksync_types::{get_code_key, AccountTreeId, StorageKey, H256}; use zksync_utils::{h256_to_account_address, u256_to_account_address, u256_to_h256}; use crate::{ @@ -16,7 +14,7 @@ use crate::{ tracers::{ dynamic::vm_1_3_3::DynTracer, validator::{ - types::{NewTrustedValidationItems, ValidationTracerMode}, + types::{NewTrustedValidationItems, ValidationTracerMode, ViolatedValidationRule}, ValidationRoundResult, ValidationTracer, }, }, diff --git a/core/lib/multivm/src/versions/mod.rs b/core/lib/multivm/src/versions/mod.rs index e9e34c1cda16..81358a482f1a 100644 --- a/core/lib/multivm/src/versions/mod.rs +++ b/core/lib/multivm/src/versions/mod.rs @@ -1,4 +1,5 @@ pub mod shadow; +mod shared; pub mod vm_1_3_2; pub mod vm_1_4_1; pub mod vm_1_4_2; diff --git a/core/lib/multivm/src/versions/shared.rs b/core/lib/multivm/src/versions/shared.rs new file mode 100644 index 000000000000..97954043f426 --- /dev/null +++ b/core/lib/multivm/src/versions/shared.rs @@ -0,0 +1,46 @@ +//! Types shared by multiple (usually old) VMs. + +use std::collections::{HashMap, HashSet}; + +use zksync_types::{vm_trace::Call, Address, U256}; + +#[derive(Debug, Clone, PartialEq)] +pub enum VmTrace { + ExecutionTrace(VmExecutionTrace), + CallTrace(Vec), +} + +#[derive(Debug, Clone, Default, PartialEq)] +pub struct VmExecutionTrace { + pub steps: Vec, + pub contracts: HashSet
, +} + +#[derive(Debug, Clone, PartialEq)] +pub struct VmExecutionStep { + pub contract_address: Address, + pub memory_page_index: usize, + pub child_memory_index: usize, + pub pc: u16, + pub set_flags: Vec, + pub registers: Vec, + pub register_interactions: HashMap, + pub sp: Option, + pub memory_interactions: Vec, + pub error: Option, +} + +#[derive(Debug, Clone, PartialEq)] +pub struct MemoryInteraction { + pub memory_type: String, + pub page: usize, + pub address: u16, + pub value: U256, + pub direction: MemoryDirection, +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum MemoryDirection { + Read, + Write, +} diff --git a/core/lib/multivm/src/versions/vm_1_3_2/mod.rs b/core/lib/multivm/src/versions/vm_1_3_2/mod.rs index 45fb0cfa388f..8feea5f48d7f 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/mod.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/mod.rs @@ -1,7 +1,6 @@ #![allow(clippy::derive_partial_eq_without_eq)] pub use zk_evm_1_3_3::{self, block_properties::BlockProperties}; -pub use zksync_types::vm_trace::VmExecutionTrace; pub(crate) use self::vm_instance::VmInstance; pub use self::{ diff --git a/core/lib/multivm/src/versions/vm_1_3_2/vm_instance.rs b/core/lib/multivm/src/versions/vm_1_3_2/vm_instance.rs index f3e0fb5e54b3..a2bc552e9ec7 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/vm_instance.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/vm_instance.rs @@ -13,13 +13,14 @@ use zk_evm_1_3_3::{ use zksync_types::{ l2_to_l1_log::{L2ToL1Log, UserL2ToL1Log}, tx::tx_execution_info::TxExecutionStatus, - vm_trace::{Call, VmExecutionTrace, VmTrace}, + vm_trace::Call, L1BatchNumber, VmEvent, H256, U256, }; use crate::{ glue::GlueInto, interface::{storage::WriteStorage, VmExecutionLogs}, + versions::shared::{VmExecutionTrace, VmTrace}, vm_1_3_2::{ bootloader_state::BootloaderState, errors::{TxRevertReason, VmRevertReason, VmRevertReasonParsingResult}, diff --git a/core/lib/multivm/src/versions/vm_m5/mod.rs b/core/lib/multivm/src/versions/vm_m5/mod.rs index 946b2e4bf56c..880cac78832e 100644 --- a/core/lib/multivm/src/versions/vm_m5/mod.rs +++ b/core/lib/multivm/src/versions/vm_m5/mod.rs @@ -1,7 +1,6 @@ #![allow(clippy::derive_partial_eq_without_eq)] pub use zk_evm_1_3_1; -pub use zksync_types::vm_trace::VmExecutionTrace; pub use self::{ errors::TxRevertReason, diff --git a/core/lib/multivm/src/versions/vm_m5/vm_instance.rs b/core/lib/multivm/src/versions/vm_m5/vm_instance.rs index 93d42ad006e9..b97b5e047c66 100644 --- a/core/lib/multivm/src/versions/vm_m5/vm_instance.rs +++ b/core/lib/multivm/src/versions/vm_m5/vm_instance.rs @@ -12,13 +12,13 @@ use zk_evm_1_3_1::{ use zksync_types::{ l2_to_l1_log::{L2ToL1Log, UserL2ToL1Log}, tx::tx_execution_info::TxExecutionStatus, - vm_trace::VmExecutionTrace, L1BatchNumber, VmEvent, U256, }; use crate::{ glue::GlueInto, interface::VmExecutionLogs, + versions::shared::VmExecutionTrace, vm_m5::{ bootloader_state::BootloaderState, errors::{TxRevertReason, VmRevertReason, VmRevertReasonParsingResult}, diff --git a/core/lib/multivm/src/versions/vm_m6/mod.rs b/core/lib/multivm/src/versions/vm_m6/mod.rs index 3aeff47dbdcd..e8e8b53dc249 100644 --- a/core/lib/multivm/src/versions/vm_m6/mod.rs +++ b/core/lib/multivm/src/versions/vm_m6/mod.rs @@ -26,7 +26,6 @@ pub use oracles::storage::StorageOracle; pub use vm::Vm; pub use vm_instance::{VmBlockResult, VmExecutionResult, VmInstance}; pub use zk_evm_1_3_1; -pub use zksync_types::vm_trace::VmExecutionTrace; pub type Word = zksync_types::U256; diff --git a/core/lib/multivm/src/versions/vm_m6/vm_instance.rs b/core/lib/multivm/src/versions/vm_m6/vm_instance.rs index a92e58e8e077..5d6a9bf91498 100644 --- a/core/lib/multivm/src/versions/vm_m6/vm_instance.rs +++ b/core/lib/multivm/src/versions/vm_m6/vm_instance.rs @@ -12,13 +12,14 @@ use zk_evm_1_3_1::{ use zksync_types::{ l2_to_l1_log::{L2ToL1Log, UserL2ToL1Log}, tx::tx_execution_info::TxExecutionStatus, - vm_trace::{Call, VmExecutionTrace, VmTrace}, + vm_trace::Call, L1BatchNumber, VmEvent, H256, U256, }; use crate::{ glue::GlueInto, interface::VmExecutionLogs, + versions::shared::{VmExecutionTrace, VmTrace}, vm_m6::{ bootloader_state::BootloaderState, errors::{TxRevertReason, VmRevertReason, VmRevertReasonParsingResult}, diff --git a/core/lib/types/src/vm_trace.rs b/core/lib/types/src/vm_trace.rs index f01cbae77862..80a3eea92f6c 100644 --- a/core/lib/types/src/vm_trace.rs +++ b/core/lib/types/src/vm_trace.rs @@ -1,68 +1,10 @@ -use std::{ - collections::{HashMap, HashSet}, - fmt, - fmt::Display, -}; +use std::fmt; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use zksync_system_constants::BOOTLOADER_ADDRESS; -use zksync_utils::u256_to_h256; use crate::{zk_evm_types::FarCallOpcode, Address, U256}; -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] -pub enum VmTrace { - ExecutionTrace(VmExecutionTrace), - CallTrace(Vec), -} - -#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq)] -pub struct VmExecutionTrace { - pub steps: Vec, - pub contracts: HashSet
, -} - -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] -pub struct VmExecutionStep { - pub contract_address: Address, - pub memory_page_index: usize, - pub child_memory_index: usize, - pub pc: u16, - pub set_flags: Vec, - pub registers: Vec, - pub register_interactions: HashMap, - pub sp: Option, - pub memory_interactions: Vec, - pub error: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] -pub struct MemoryInteraction { - pub memory_type: String, - pub page: usize, - pub address: u16, - pub value: U256, - pub direction: MemoryDirection, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq)] -pub enum MemoryDirection { - Read, - Write, -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -pub struct ContractSourceDebugInfo { - pub assembly_code: String, - pub pc_line_mapping: HashMap, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct VmDebugTrace { - pub steps: Vec, - pub sources: HashMap>, -} - #[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq)] pub enum CallType { #[serde(serialize_with = "far_call_type_to_u8")] @@ -383,40 +325,6 @@ impl fmt::Debug for LegacyCall { } } -#[derive(Debug, Clone)] -pub enum ViolatedValidationRule { - TouchedUnallowedStorageSlots(Address, U256), - CalledContractWithNoCode(Address), - TouchedUnallowedContext, - TookTooManyComputationalGas(u32), -} - -impl Display for ViolatedValidationRule { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - ViolatedValidationRule::TouchedUnallowedStorageSlots(contract, key) => write!( - f, - "Touched unallowed storage slots: address {}, key: {}", - hex::encode(contract), - hex::encode(u256_to_h256(*key)) - ), - ViolatedValidationRule::CalledContractWithNoCode(contract) => { - write!(f, "Called contract with no code: {}", hex::encode(contract)) - } - ViolatedValidationRule::TouchedUnallowedContext => { - write!(f, "Touched unallowed context") - } - ViolatedValidationRule::TookTooManyComputationalGas(gas_limit) => { - write!( - f, - "Took too many computational gas, allowed limit: {}", - gas_limit - ) - } - } - } -} - #[cfg(test)] mod tests { use super::*; diff --git a/core/lib/web3_decl/src/types.rs b/core/lib/web3_decl/src/types.rs index 41902e408e7a..9994d21107be 100644 --- a/core/lib/web3_decl/src/types.rs +++ b/core/lib/web3_decl/src/types.rs @@ -16,7 +16,6 @@ use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; pub use zksync_types::{ api::{Block, BlockNumber, Log, TransactionReceipt, TransactionRequest}, ethabi, - vm_trace::{ContractSourceDebugInfo, VmDebugTrace, VmExecutionStep}, web3::{BlockHeader, Bytes, CallRequest, FeeHistory, Index, SyncState, TraceFilter, Work}, Address, Transaction, H160, H256, H64, U256, U64, }; From 379c8a0e4f8da34aad2884d79918d31c77900f0d Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 15:40:28 +0300 Subject: [PATCH 12/17] Move `execute_tx()` to call site --- core/lib/tee_verifier/Cargo.toml | 10 ++++----- core/lib/tee_verifier/src/lib.rs | 34 +++++++++++++++++++++++++++---- core/lib/vm_utils/src/lib.rs | 35 ++++---------------------------- 3 files changed, 38 insertions(+), 41 deletions(-) diff --git a/core/lib/tee_verifier/Cargo.toml b/core/lib/tee_verifier/Cargo.toml index 0d50684e165d..a56f383bdbad 100644 --- a/core/lib/tee_verifier/Cargo.toml +++ b/core/lib/tee_verifier/Cargo.toml @@ -11,11 +11,7 @@ keywords.workspace = true categories.workspace = true [dependencies] -anyhow.workspace = true zksync_multivm.workspace = true -serde.workspace = true -tracing.workspace = true -zksync_vm_utils.workspace = true zksync_config.workspace = true zksync_crypto_primitives.workspace = true zksync_dal.workspace = true @@ -24,10 +20,12 @@ zksync_merkle_tree.workspace = true zksync_object_store.workspace = true zksync_prover_interface.workspace = true zksync_queued_job_processor.workspace = true -zksync_state.workspace = true zksync_types.workspace = true zksync_utils.workspace = true +anyhow.workspace = true +serde.workspace = true +tracing.workspace = true + [dev-dependencies] zksync_contracts.workspace = true -zksync_basic_types.workspace = true diff --git a/core/lib/tee_verifier/src/lib.rs b/core/lib/tee_verifier/src/lib.rs index 686cab37b892..4234754a75f2 100644 --- a/core/lib/tee_verifier/src/lib.rs +++ b/core/lib/tee_verifier/src/lib.rs @@ -14,7 +14,7 @@ use zksync_merkle_tree::{ use zksync_multivm::{ interface::{ storage::{InMemoryStorage, ReadStorage, StorageView}, - FinishedL1Batch, L2BlockEnv, VmFactory, VmInterface, + FinishedL1Batch, L2BlockEnv, VmFactory, VmInterface, VmInterfaceHistoryEnabled, }, vm_latest::HistoryEnabled, VmInstance, @@ -22,9 +22,8 @@ use zksync_multivm::{ use zksync_prover_interface::inputs::{ StorageLogMetadata, V1TeeVerifierInput, WitnessInputMerklePaths, }; -use zksync_types::{block::L2BlockExecutionData, L1BatchNumber, StorageLog, H256}; +use zksync_types::{block::L2BlockExecutionData, L1BatchNumber, StorageLog, Transaction, H256}; use zksync_utils::bytecode::hash_bytecode; -use zksync_vm_utils::execute_tx; /// A structure to hold the result of verification. pub struct VerificationResult { @@ -238,13 +237,40 @@ fn generate_tree_instructions( .collect::, _>>() } +fn execute_tx( + tx: &Transaction, + vm: &mut VmInstance, +) -> anyhow::Result<()> { + // Attempt to run VM with bytecode compression on. + vm.make_snapshot(); + if vm + .execute_transaction_with_bytecode_compression(tx.clone(), true) + .0 + .is_ok() + { + vm.pop_snapshot_no_rollback(); + return Ok(()); + } + + // If failed with bytecode compression, attempt to run without bytecode compression. + vm.rollback_to_the_latest_snapshot(); + if vm + .execute_transaction_with_bytecode_compression(tx.clone(), false) + .0 + .is_err() + { + anyhow::bail!("compression can't fail if we don't apply it"); + } + Ok(()) +} + #[cfg(test)] mod tests { - use zksync_basic_types::U256; use zksync_contracts::{BaseSystemContracts, SystemContractCode}; use zksync_multivm::interface::{L1BatchEnv, SystemEnv, TxExecutionMode}; use zksync_object_store::StoredObject; use zksync_prover_interface::inputs::TeeVerifierInput; + use zksync_types::U256; use super::*; diff --git a/core/lib/vm_utils/src/lib.rs b/core/lib/vm_utils/src/lib.rs index beef77151acc..a1221deb61c3 100644 --- a/core/lib/vm_utils/src/lib.rs +++ b/core/lib/vm_utils/src/lib.rs @@ -1,16 +1,16 @@ -use anyhow::{anyhow, Context}; +use anyhow::Context; use tokio::runtime::Handle; use zksync_dal::{Connection, Core}; use zksync_multivm::{ interface::{ - storage::{ReadStorage, StoragePtr, StorageView}, - VmFactory, VmInterface, VmInterfaceHistoryEnabled, + storage::{StoragePtr, StorageView}, + VmFactory, }, vm_latest::HistoryEnabled, VmInstance, }; use zksync_state::PostgresStorage; -use zksync_types::{L1BatchNumber, L2ChainId, Transaction}; +use zksync_types::{L1BatchNumber, L2ChainId}; use crate::storage::L1BatchParamsProvider; @@ -60,30 +60,3 @@ pub fn create_vm( Ok((vm, storage_view)) } - -pub fn execute_tx( - tx: &Transaction, - vm: &mut VmInstance, -) -> anyhow::Result<()> { - // Attempt to run VM with bytecode compression on. - vm.make_snapshot(); - if vm - .execute_transaction_with_bytecode_compression(tx.clone(), true) - .0 - .is_ok() - { - vm.pop_snapshot_no_rollback(); - return Ok(()); - } - - // If failed with bytecode compression, attempt to run without bytecode compression. - vm.rollback_to_the_latest_snapshot(); - if vm - .execute_transaction_with_bytecode_compression(tx.clone(), false) - .0 - .is_err() - { - return Err(anyhow!("compression can't fail if we don't apply it")); - } - Ok(()) -} From 30614744dbf2b3da78e8257a2679c9c439d949f7 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 15:49:07 +0300 Subject: [PATCH 13/17] Remove unused code from `vm_utils` --- core/lib/vm_utils/Cargo.toml | 9 +++-- core/lib/vm_utils/src/lib.rs | 61 -------------------------------- core/lib/vm_utils/src/storage.rs | 10 +++--- 3 files changed, 8 insertions(+), 72 deletions(-) diff --git a/core/lib/vm_utils/Cargo.toml b/core/lib/vm_utils/Cargo.toml index c325f0e9db30..cb12e7c8f673 100644 --- a/core/lib/vm_utils/Cargo.toml +++ b/core/lib/vm_utils/Cargo.toml @@ -11,12 +11,11 @@ keywords.workspace = true categories.workspace = true [dependencies] -zksync_multivm.workspace = true -zksync_types.workspace = true +zksync_contracts.workspace = true zksync_dal.workspace = true -zksync_state.workspace = true +zksync_types.workspace = true +zksync_vm_interface.workspace = true + tokio.workspace = true anyhow.workspace = true tracing.workspace = true -zksync_utils.workspace = true -zksync_contracts.workspace = true diff --git a/core/lib/vm_utils/src/lib.rs b/core/lib/vm_utils/src/lib.rs index a1221deb61c3..30f61eb69f21 100644 --- a/core/lib/vm_utils/src/lib.rs +++ b/core/lib/vm_utils/src/lib.rs @@ -1,62 +1 @@ -use anyhow::Context; -use tokio::runtime::Handle; -use zksync_dal::{Connection, Core}; -use zksync_multivm::{ - interface::{ - storage::{StoragePtr, StorageView}, - VmFactory, - }, - vm_latest::HistoryEnabled, - VmInstance, -}; -use zksync_state::PostgresStorage; -use zksync_types::{L1BatchNumber, L2ChainId}; - -use crate::storage::L1BatchParamsProvider; - pub mod storage; - -pub type VmAndStorage<'a> = ( - VmInstance, HistoryEnabled>, - StoragePtr>>, -); - -pub fn create_vm( - rt_handle: Handle, - l1_batch_number: L1BatchNumber, - mut connection: Connection<'_, Core>, - l2_chain_id: L2ChainId, -) -> anyhow::Result { - let mut l1_batch_params_provider = L1BatchParamsProvider::new(); - rt_handle - .block_on(l1_batch_params_provider.initialize(&mut connection)) - .context("failed initializing L1 batch params provider")?; - let first_l2_block_in_batch = rt_handle - .block_on( - l1_batch_params_provider.load_first_l2_block_in_batch(&mut connection, l1_batch_number), - ) - .with_context(|| format!("failed loading first L2 block in L1 batch #{l1_batch_number}"))? - .with_context(|| format!("no L2 blocks persisted for L1 batch #{l1_batch_number}"))?; - - // In the state keeper, this value is used to reject execution. - // All batches ran by BasicWitnessInputProducer have already been executed by State Keeper. - // This means we don't want to reject any execution, therefore we're using MAX as an allow all. - let validation_computational_gas_limit = u32::MAX; - - let (system_env, l1_batch_env) = rt_handle - .block_on(l1_batch_params_provider.load_l1_batch_params( - &mut connection, - &first_l2_block_in_batch, - validation_computational_gas_limit, - l2_chain_id, - )) - .context("expected L2 block to be executed and sealed")?; - - let storage_l2_block_number = first_l2_block_in_batch.number() - 1; - let pg_storage = - PostgresStorage::new(rt_handle.clone(), connection, storage_l2_block_number, true); - let storage_view = StorageView::new(pg_storage).to_rc_ptr(); - let vm = VmInstance::new(l1_batch_env, system_env, storage_view.clone()); - - Ok((vm, storage_view)) -} diff --git a/core/lib/vm_utils/src/storage.rs b/core/lib/vm_utils/src/storage.rs index fbf52a67623d..1e43543bc5aa 100644 --- a/core/lib/vm_utils/src/storage.rs +++ b/core/lib/vm_utils/src/storage.rs @@ -3,15 +3,13 @@ use std::time::{Duration, Instant}; use anyhow::Context; use zksync_contracts::BaseSystemContracts; use zksync_dal::{Connection, Core, CoreDal, DalError}; -use zksync_multivm::{ - interface::{L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode}, - vm_latest::constants::BATCH_COMPUTATIONAL_GAS_LIMIT, - zk_evm_latest::ethereum_types::H256, -}; use zksync_types::{ block::L2BlockHeader, fee_model::BatchFeeInput, snapshots::SnapshotRecoveryStatus, Address, - L1BatchNumber, L2BlockNumber, L2ChainId, ProtocolVersionId, ZKPORTER_IS_AVAILABLE, + L1BatchNumber, L2BlockNumber, L2ChainId, ProtocolVersionId, H256, ZKPORTER_IS_AVAILABLE, }; +use zksync_vm_interface::{L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode}; + +const BATCH_COMPUTATIONAL_GAS_LIMIT: u32 = u32::MAX; /// Typesafe wrapper around [`L2BlockHeader`] returned by [`L1BatchParamsProvider`]. #[derive(Debug)] From f6e4ab873e62184827e946ba2ffbbee5f6f0b34e Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 15:55:06 +0300 Subject: [PATCH 14/17] Remove unused `zksync_state` deps --- Cargo.lock | 10 +--------- core/bin/system-constants-generator/Cargo.toml | 1 - core/lib/prover_interface/Cargo.toml | 1 - core/lib/prover_interface/src/inputs.rs | 1 - core/node/consensus/Cargo.toml | 1 - core/node/consensus/src/testonly.rs | 6 +----- 6 files changed, 2 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 91ce0652ee92..536e2b6cd508 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6463,7 +6463,6 @@ dependencies = [ "serde_json", "zksync_contracts", "zksync_multivm", - "zksync_state", "zksync_types", "zksync_utils", ] @@ -9029,7 +9028,6 @@ dependencies = [ "zksync_node_sync", "zksync_node_test_utils", "zksync_protobuf", - "zksync_state", "zksync_state_keeper", "zksync_system_constants", "zksync_test_account", @@ -9372,7 +9370,6 @@ dependencies = [ "tokio", "zksync_multivm", "zksync_object_store", - "zksync_state", "zksync_types", ] @@ -9608,7 +9605,6 @@ dependencies = [ "anyhow", "serde", "tracing", - "zksync_basic_types", "zksync_config", "zksync_contracts", "zksync_crypto_primitives", @@ -9619,10 +9615,8 @@ dependencies = [ "zksync_object_store", "zksync_prover_interface", "zksync_queued_job_processor", - "zksync_state", "zksync_types", "zksync_utils", - "zksync_vm_utils", ] [[package]] @@ -9813,10 +9807,8 @@ dependencies = [ "tracing", "zksync_contracts", "zksync_dal", - "zksync_multivm", - "zksync_state", "zksync_types", - "zksync_utils", + "zksync_vm_interface", ] [[package]] diff --git a/core/bin/system-constants-generator/Cargo.toml b/core/bin/system-constants-generator/Cargo.toml index 8632b4c554cc..7177d29ca743 100644 --- a/core/bin/system-constants-generator/Cargo.toml +++ b/core/bin/system-constants-generator/Cargo.toml @@ -11,7 +11,6 @@ categories.workspace = true publish = false [dependencies] -zksync_state.workspace = true zksync_types.workspace = true zksync_utils.workspace = true zksync_contracts.workspace = true diff --git a/core/lib/prover_interface/Cargo.toml b/core/lib/prover_interface/Cargo.toml index 89e402b27759..8c73c2c6ac38 100644 --- a/core/lib/prover_interface/Cargo.toml +++ b/core/lib/prover_interface/Cargo.toml @@ -14,7 +14,6 @@ categories.workspace = true zksync_multivm.workspace = true zksync_object_store.workspace = true zksync_types.workspace = true -zksync_state.workspace = true # We can use the newest api to send proofs to L1. circuit_sequencer_api_1_5_0.workspace = true diff --git a/core/lib/prover_interface/src/inputs.rs b/core/lib/prover_interface/src/inputs.rs index 8f2403d3369a..22a20223c8b4 100644 --- a/core/lib/prover_interface/src/inputs.rs +++ b/core/lib/prover_interface/src/inputs.rs @@ -4,7 +4,6 @@ use serde::{Deserialize, Serialize}; use serde_with::{serde_as, Bytes}; use zksync_multivm::interface::{L1BatchEnv, SystemEnv}; use zksync_object_store::{serialize_using_bincode, Bucket, StoredObject}; -pub use zksync_state::WitnessStorage; use zksync_types::{ basic_fri_types::Eip4844Blobs, block::L2BlockExecutionData, witness_block_state::WitnessStorageState, L1BatchNumber, ProtocolVersionId, H256, U256, diff --git a/core/node/consensus/Cargo.toml b/core/node/consensus/Cargo.toml index 574ae6fdf9f8..e82969dae6c6 100644 --- a/core/node/consensus/Cargo.toml +++ b/core/node/consensus/Cargo.toml @@ -22,7 +22,6 @@ zksync_consensus_bft.workspace = true zksync_consensus_utils.workspace = true zksync_protobuf.workspace = true zksync_dal.workspace = true -zksync_state.workspace = true zksync_l1_contract_interface.workspace = true zksync_metadata_calculator.workspace = true zksync_merkle_tree.workspace = true diff --git a/core/node/consensus/src/testonly.rs b/core/node/consensus/src/testonly.rs index 24e3d73e824e..2c6fdc79a521 100644 --- a/core/node/consensus/src/testonly.rs +++ b/core/node/consensus/src/testonly.rs @@ -29,7 +29,6 @@ use zksync_node_sync::{ ExternalIO, MainNodeClient, SyncState, }; use zksync_node_test_utils::{create_l1_batch_metadata, l1_batch_metadata_to_commitment_artifacts}; -use zksync_state::RocksdbStorageOptions; use zksync_state_keeper::{ io::{IoCursor, L1BatchParams, L2BlockParams}, seal_criteria::NoopSealer, @@ -522,10 +521,7 @@ impl StateKeeperRunner { .join("cache") .to_string_lossy() .into(), - RocksdbStorageOptions { - block_cache_capacity: (1 << 20), // `1MB` - max_open_files: None, - }, + Default::default(), ); s.spawn_bg({ let stop_recv = stop_recv.clone(); From a1658da27b949ff9dda0bf1cd9bd5c96bc0a929f Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 16:09:18 +0300 Subject: [PATCH 15/17] Fix prover workspace --- core/lib/state/src/lib.rs | 2 - prover/Cargo.lock | 178 ++---------------- prover/Cargo.toml | 1 - .../crates/bin/witness_generator/Cargo.toml | 1 - .../witness_generator/src/basic_circuits.rs | 7 +- .../crates/bin/witness_generator/src/lib.rs | 7 +- .../crates/bin/witness_generator/src/main.rs | 18 +- .../bin/witness_generator}/src/witness.rs | 2 +- .../bin/witness_generator/tests/basic_test.rs | 3 +- 9 files changed, 27 insertions(+), 192 deletions(-) rename {core/lib/state => prover/crates/bin/witness_generator}/src/witness.rs (96%) diff --git a/core/lib/state/src/lib.rs b/core/lib/state/src/lib.rs index 30e94e8b52be..c386426d0669 100644 --- a/core/lib/state/src/lib.rs +++ b/core/lib/state/src/lib.rs @@ -23,7 +23,6 @@ pub use self::{ BatchDiff, OwnedPostgresStorage, OwnedStorage, PgOrRocksdbStorage, ReadStorageFactory, RocksdbWithMemory, }, - witness::WitnessStorage, }; mod cache; @@ -34,4 +33,3 @@ mod shadow_storage; mod storage_factory; #[cfg(test)] mod test_utils; -mod witness; diff --git a/prover/Cargo.lock b/prover/Cargo.lock index e6ef7fd95f83..45a489fb9181 100644 --- a/prover/Cargo.lock +++ b/prover/Cargo.lock @@ -332,18 +332,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "backon" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d67782c3f868daa71d3533538e98a8e13713231969def7536e8039606fc46bf0" -dependencies = [ - "fastrand", - "futures-core", - "pin-project", - "tokio", -] - [[package]] name = "backtrace" version = "0.3.72" @@ -800,12 +788,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "bytecount" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" - [[package]] name = "byteorder" version = "1.5.0" @@ -829,37 +811,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "camino" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", -] - [[package]] name = "cc" version = "1.0.98" @@ -1570,19 +1521,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if 1.0.0", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", -] - [[package]] name = "debugid" version = "0.8.0" @@ -1929,15 +1867,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "error-chain" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" -dependencies = [ - "version_check", -] - [[package]] name = "etcetera" version = "0.8.0" @@ -3517,21 +3446,6 @@ dependencies = [ "unicase", ] -[[package]] -name = "mini-moka" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c325dfab65f261f386debee8b0969da215b3fa0037e74c8a1234db7ba986d803" -dependencies = [ - "crossbeam-channel 0.5.13", - "crossbeam-utils 0.8.20", - "dashmap", - "skeptic", - "smallvec", - "tagptr", - "triomphe", -] - [[package]] name = "minimal-lexical" version = "0.2.1" @@ -4577,17 +4491,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "pulldown-cmark" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" -dependencies = [ - "bitflags 2.6.0", - "memchr", - "unicase", -] - [[package]] name = "quick-error" version = "1.2.3" @@ -5313,9 +5216,6 @@ name = "semver" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" -dependencies = [ - "serde", -] [[package]] name = "send_wrapper" @@ -5694,21 +5594,6 @@ dependencies = [ "time", ] -[[package]] -name = "skeptic" -version = "0.13.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8" -dependencies = [ - "bytecount", - "cargo_metadata", - "error-chain", - "glob", - "pulldown-cmark", - "tempfile", - "walkdir", -] - [[package]] name = "slab" version = "0.4.9" @@ -6188,12 +6073,6 @@ dependencies = [ "libc", ] -[[package]] -name = "tagptr" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" - [[package]] name = "tap" version = "1.0.1" @@ -6637,12 +6516,6 @@ dependencies = [ "tracing-serde", ] -[[package]] -name = "triomphe" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b2cb4fbb9995eeb36ac86fadf24031ccd58f99d6b4b2d7b911db70bddb80d90" - [[package]] name = "try-lock" version = "0.2.5" @@ -8073,7 +7946,6 @@ dependencies = [ "itertools 0.10.5", "once_cell", "pretty_assertions", - "serde", "thiserror", "tracing", "vise", @@ -8084,10 +7956,10 @@ dependencies = [ "zk_evm 0.141.0", "zk_evm 0.150.0", "zksync_contracts", - "zksync_state", "zksync_system_constants", "zksync_types", "zksync_utils", + "zksync_vm_interface", ] [[package]] @@ -8333,7 +8205,6 @@ dependencies = [ "strum", "zksync_multivm", "zksync_object_store", - "zksync_state", "zksync_types", ] @@ -8349,38 +8220,6 @@ dependencies = [ "zksync_utils", ] -[[package]] -name = "zksync_shared_metrics" -version = "0.1.0" -dependencies = [ - "rustc_version", - "tracing", - "vise", - "zksync_dal", - "zksync_types", -] - -[[package]] -name = "zksync_state" -version = "0.1.0" -dependencies = [ - "anyhow", - "async-trait", - "backon", - "chrono", - "itertools 0.10.5", - "mini-moka", - "once_cell", - "tokio", - "tracing", - "vise", - "zksync_dal", - "zksync_shared_metrics", - "zksync_storage", - "zksync_types", - "zksync_utils", -] - [[package]] name = "zksync_storage" version = "0.1.0" @@ -8482,6 +8321,20 @@ dependencies = [ "vise-exporter", ] +[[package]] +name = "zksync_vm_interface" +version = "0.1.0" +dependencies = [ + "hex", + "serde", + "thiserror", + "tracing", + "zksync_contracts", + "zksync_system_constants", + "zksync_types", + "zksync_utils", +] + [[package]] name = "zksync_web3_decl" version = "0.1.0" @@ -8535,7 +8388,6 @@ dependencies = [ "zksync_prover_fri_utils", "zksync_prover_interface", "zksync_queued_job_processor", - "zksync_state", "zksync_system_constants", "zksync_types", "zksync_utils", diff --git a/prover/Cargo.toml b/prover/Cargo.toml index 7ab6dd16b99b..a3358fb6917c 100644 --- a/prover/Cargo.toml +++ b/prover/Cargo.toml @@ -75,7 +75,6 @@ zksync_env_config = { path = "../core/lib/env_config" } zksync_object_store = { path = "../core/lib/object_store" } zksync_prover_interface = { path = "../core/lib/prover_interface" } zksync_queued_job_processor = { path = "../core/lib/queued_job_processor" } -zksync_state = { path = "../core/lib/state" } zksync_system_constants = { path = "../core/lib/constants" } zksync_types = { path = "../core/lib/types" } zksync_utils = { path = "../core/lib/utils" } diff --git a/prover/crates/bin/witness_generator/Cargo.toml b/prover/crates/bin/witness_generator/Cargo.toml index 7eb75bb3d82f..cffb55906065 100644 --- a/prover/crates/bin/witness_generator/Cargo.toml +++ b/prover/crates/bin/witness_generator/Cargo.toml @@ -21,7 +21,6 @@ zksync_queued_job_processor.workspace = true zksync_multivm.workspace = true zksync_object_store.workspace = true zksync_types.workspace = true -zksync_state.workspace = true zksync_utils.workspace = true vk_setup_data_generator_server_fri.workspace = true zksync_prover_fri_types.workspace = true diff --git a/prover/crates/bin/witness_generator/src/basic_circuits.rs b/prover/crates/bin/witness_generator/src/basic_circuits.rs index dc2506446418..75326ace7f6b 100644 --- a/prover/crates/bin/witness_generator/src/basic_circuits.rs +++ b/prover/crates/bin/witness_generator/src/basic_circuits.rs @@ -16,8 +16,9 @@ use tokio::sync::Semaphore; use tracing::Instrument; use zkevm_test_harness::geometry_config::get_geometry_config; use zksync_config::configs::FriWitnessGeneratorConfig; -use zksync_multivm::vm_latest::{ - constants::MAX_CYCLES_FOR_TX, HistoryDisabled, StorageOracle as VmStorageOracle, +use zksync_multivm::{ + interface::storage::StorageView, + vm_latest::{constants::MAX_CYCLES_FOR_TX, HistoryDisabled, StorageOracle as VmStorageOracle}, }; use zksync_object_store::ObjectStore; use zksync_prover_dal::{ConnectionPool, Prover, ProverDal}; @@ -38,7 +39,6 @@ use zksync_prover_fri_types::{ use zksync_prover_fri_utils::get_recursive_layer_circuit_id_for_base_layer; use zksync_prover_interface::inputs::WitnessInputData; use zksync_queued_job_processor::JobProcessor; -use zksync_state::{StorageView, WitnessStorage}; use zksync_types::{ basic_fri_types::AggregationRound, protocol_version::ProtocolSemanticVersion, Address, L1BatchNumber, BOOTLOADER_ADDRESS, @@ -52,6 +52,7 @@ use crate::{ expand_bootloader_contents, save_circuit, ClosedFormInputWrapper, SchedulerPartialInputWrapper, KZG_TRUSTED_SETUP_FILE, }, + witness::WitnessStorage, }; pub struct BasicCircuitArtifacts { diff --git a/prover/crates/bin/witness_generator/src/lib.rs b/prover/crates/bin/witness_generator/src/lib.rs index a80f06312d12..00d2ebf2bb3d 100644 --- a/prover/crates/bin/witness_generator/src/lib.rs +++ b/prover/crates/bin/witness_generator/src/lib.rs @@ -3,14 +3,13 @@ pub mod basic_circuits; pub mod leaf_aggregation; +pub mod metrics; pub mod node_aggregation; pub mod precalculated_merkle_paths_provider; pub mod recursion_tip; pub mod scheduler; mod storage_oracle; -pub mod utils; - -pub mod metrics; - #[cfg(test)] mod tests; +pub mod utils; +mod witness; diff --git a/prover/crates/bin/witness_generator/src/main.rs b/prover/crates/bin/witness_generator/src/main.rs index d3b828b06558..e914d3742b5b 100644 --- a/prover/crates/bin/witness_generator/src/main.rs +++ b/prover/crates/bin/witness_generator/src/main.rs @@ -5,6 +5,8 @@ use std::time::{Duration, Instant}; use anyhow::{anyhow, Context as _}; use futures::{channel::mpsc, executor::block_on, SinkExt, StreamExt}; +#[cfg(not(target_env = "msvc"))] +use jemallocator::Jemalloc; use structopt::StructOpt; use tokio::sync::watch; use zksync_core_leftovers::temp_config_store::{load_database_secrets, load_general_config}; @@ -17,26 +19,12 @@ use zksync_types::basic_fri_types::AggregationRound; use zksync_utils::wait_for_tasks::ManagedTasks; use zksync_vk_setup_data_server_fri::commitment_utils::get_cached_commitments; use zksync_vlog::prometheus::PrometheusExporterConfig; - -use crate::{ +use zksync_witness_generator::{ basic_circuits::BasicWitnessGenerator, leaf_aggregation::LeafAggregationWitnessGenerator, metrics::SERVER_METRICS, node_aggregation::NodeAggregationWitnessGenerator, recursion_tip::RecursionTipWitnessGenerator, scheduler::SchedulerWitnessGenerator, }; -mod basic_circuits; -mod leaf_aggregation; -mod metrics; -mod node_aggregation; -mod precalculated_merkle_paths_provider; -mod recursion_tip; -mod scheduler; -mod storage_oracle; -mod utils; - -#[cfg(not(target_env = "msvc"))] -use jemallocator::Jemalloc; - #[cfg(not(target_env = "msvc"))] #[global_allocator] static GLOBAL: Jemalloc = Jemalloc; diff --git a/core/lib/state/src/witness.rs b/prover/crates/bin/witness_generator/src/witness.rs similarity index 96% rename from core/lib/state/src/witness.rs rename to prover/crates/bin/witness_generator/src/witness.rs index ce0b69264240..8bedf5657e09 100644 --- a/core/lib/state/src/witness.rs +++ b/prover/crates/bin/witness_generator/src/witness.rs @@ -1,5 +1,5 @@ +use zksync_multivm::interface::storage::ReadStorage; use zksync_types::{witness_block_state::WitnessStorageState, StorageKey, StorageValue, H256}; -use zksync_vm_interface::storage::ReadStorage; /// [`ReadStorage`] implementation backed by binary serialized [`WitnessHashBlockState`]. /// Note that `load_factory_deps` is not used. diff --git a/prover/crates/bin/witness_generator/tests/basic_test.rs b/prover/crates/bin/witness_generator/tests/basic_test.rs index d9ac679ab647..f8a21179adb7 100644 --- a/prover/crates/bin/witness_generator/tests/basic_test.rs +++ b/prover/crates/bin/witness_generator/tests/basic_test.rs @@ -15,8 +15,7 @@ use zksync_types::{ }; use zksync_witness_generator::{ leaf_aggregation::{prepare_leaf_aggregation_job, LeafAggregationWitnessGenerator}, - node_aggregation, - node_aggregation::NodeAggregationWitnessGenerator, + node_aggregation::{self, NodeAggregationWitnessGenerator}, utils::AggregationWrapper, }; From e11bafd439a00f52b5c3c1989f8879e322243850 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 16:14:31 +0300 Subject: [PATCH 16/17] Format readme --- core/lib/multivm/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/lib/multivm/README.md b/core/lib/multivm/README.md index 8d99029b711d..5e2af426ae5b 100644 --- a/core/lib/multivm/README.md +++ b/core/lib/multivm/README.md @@ -1,6 +1,6 @@ # ZKsync Era VM Wrapper -This crate represents a wrapper over several versions of VM that have been used by the ZKsync Era node. It contains the glue -code that allows switching the VM version based on the externally provided marker while preserving the public interface. -This crate exists to enable the external node to process breaking upgrades and re-execute all the transactions from the -genesis block. +This crate represents a wrapper over several versions of VM that have been used by the ZKsync Era node. It contains the +glue code that allows switching the VM version based on the externally provided marker while preserving the public +interface. This crate exists to enable the external node to process breaking upgrades and re-execute all the +transactions from the genesis block. From b86a6bf13ac2c596d303e2f0a74e9e59dcec0e70 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 12 Aug 2024 16:29:07 +0300 Subject: [PATCH 17/17] Make some VM errors non-exhaustive --- core/lib/multivm/Cargo.toml | 2 +- core/lib/vm_interface/Cargo.toml | 4 ++-- core/lib/vm_interface/src/types/errors/bootloader_error.rs | 1 + .../vm_interface/src/types/errors/bytecode_compression.rs | 1 + core/lib/vm_interface/src/types/errors/mod.rs | 2 -- core/lib/vm_interface/src/types/errors/tx_revert_reason.rs | 5 ++--- core/lib/vm_interface/src/types/errors/vm_revert_reason.rs | 2 ++ core/node/state_keeper/src/metrics.rs | 2 +- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/core/lib/multivm/Cargo.toml b/core/lib/multivm/Cargo.toml index 7039ec9a52cd..a245acdfacf6 100644 --- a/core/lib/multivm/Cargo.toml +++ b/core/lib/multivm/Cargo.toml @@ -10,7 +10,7 @@ license.workspace = true keywords.workspace = true categories.workspace = true -[dependencies] # FIXME: revise +[dependencies] zk_evm_1_5_0.workspace = true zk_evm_1_4_1.workspace = true zk_evm_1_4_0.workspace = true diff --git a/core/lib/vm_interface/Cargo.toml b/core/lib/vm_interface/Cargo.toml index d813eefdee68..75362d7da3f6 100644 --- a/core/lib/vm_interface/Cargo.toml +++ b/core/lib/vm_interface/Cargo.toml @@ -13,8 +13,8 @@ categories.workspace = true [dependencies] zksync_contracts.workspace = true zksync_system_constants.workspace = true -zksync_types.workspace = true # FIXME: move VM-related types? (e.g., VM events, circuit stats) -zksync_utils.workspace = true # FIXME: move VM-related types? (e.g., compressed bytecodes) +zksync_types.workspace = true +zksync_utils.workspace = true hex.workspace = true serde.workspace = true diff --git a/core/lib/vm_interface/src/types/errors/bootloader_error.rs b/core/lib/vm_interface/src/types/errors/bootloader_error.rs index 914a598a1577..f06da7aa14ea 100644 --- a/core/lib/vm_interface/src/types/errors/bootloader_error.rs +++ b/core/lib/vm_interface/src/types/errors/bootloader_error.rs @@ -1,5 +1,6 @@ /// Error codes returned by the bootloader. #[derive(Debug)] +#[non_exhaustive] pub enum BootloaderErrorCode { EthCall, AccountTxValidationFailed, diff --git a/core/lib/vm_interface/src/types/errors/bytecode_compression.rs b/core/lib/vm_interface/src/types/errors/bytecode_compression.rs index a5680afd684c..418be6b85733 100644 --- a/core/lib/vm_interface/src/types/errors/bytecode_compression.rs +++ b/core/lib/vm_interface/src/types/errors/bytecode_compression.rs @@ -1,5 +1,6 @@ /// Errors related to bytecode compression. #[derive(Debug, thiserror::Error)] +#[non_exhaustive] pub enum BytecodeCompressionError { #[error("Bytecode compression failed")] BytecodeCompressionFailed, diff --git a/core/lib/vm_interface/src/types/errors/mod.rs b/core/lib/vm_interface/src/types/errors/mod.rs index 95cfab435157..070e7aa28427 100644 --- a/core/lib/vm_interface/src/types/errors/mod.rs +++ b/core/lib/vm_interface/src/types/errors/mod.rs @@ -11,5 +11,3 @@ mod bytecode_compression; mod halt; mod tx_revert_reason; mod vm_revert_reason; - -// FIXME: make errors non-exhaustive? diff --git a/core/lib/vm_interface/src/types/errors/tx_revert_reason.rs b/core/lib/vm_interface/src/types/errors/tx_revert_reason.rs index 9660c898f4a3..793565e054ca 100644 --- a/core/lib/vm_interface/src/types/errors/tx_revert_reason.rs +++ b/core/lib/vm_interface/src/types/errors/tx_revert_reason.rs @@ -4,10 +4,9 @@ use super::{halt::Halt, BootloaderErrorCode, VmRevertReason}; #[derive(Debug, Clone, PartialEq)] pub enum TxRevertReason { - // Returned when the execution of an L2 transaction has failed - // Or EthCall has failed + /// Returned when the execution of an L2 transaction or a call has failed. TxReverted(VmRevertReason), - // Returned when some validation has failed or some internal errors + /// Returned when some validation has failed or some internal errors. Halt(Halt), } diff --git a/core/lib/vm_interface/src/types/errors/vm_revert_reason.rs b/core/lib/vm_interface/src/types/errors/vm_revert_reason.rs index 31b68ada2e84..d76b7d4ddb9f 100644 --- a/core/lib/vm_interface/src/types/errors/vm_revert_reason.rs +++ b/core/lib/vm_interface/src/types/errors/vm_revert_reason.rs @@ -3,6 +3,7 @@ use std::fmt; use zksync_types::U256; #[derive(Debug, thiserror::Error)] +#[non_exhaustive] pub enum VmRevertReasonParsingError { #[error("Incorrect data offset. Data: {0:?}")] IncorrectDataOffset(Vec), @@ -14,6 +15,7 @@ pub enum VmRevertReasonParsingError { /// Rich Revert Reasons `https://github.com/0xProject/ZEIPs/issues/32` #[derive(Debug, Clone, PartialEq)] +#[non_exhaustive] pub enum VmRevertReason { General { msg: String, diff --git a/core/node/state_keeper/src/metrics.rs b/core/node/state_keeper/src/metrics.rs index c154719e3900..0f9650881b2b 100644 --- a/core/node/state_keeper/src/metrics.rs +++ b/core/node/state_keeper/src/metrics.rs @@ -111,7 +111,7 @@ fn vm_revert_reason_as_metric_label(reason: &VmRevertReason) -> &'static str { VmRevertReason::General { .. } => "General", VmRevertReason::InnerTxError => "InnerTxError", VmRevertReason::VmError => "VmError", - VmRevertReason::Unknown { .. } => "Unknown", + _ => "Unknown", } }