From e3fb4894d08aa98a84e64eaa95b51001055cf911 Mon Sep 17 00:00:00 2001 From: Danil Date: Wed, 18 Oct 2023 10:14:28 +0200 Subject: [PATCH] feat(vm): Move all vm versions to the one crate (#249) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # What ❔ Move all vm versions to the one crate. p.s. You will see a lot of `multivm::vm_latest` in the public interface. It's temporary. In the next PR it will be a common interface and we won't reference to the concrete vm ## Why ❔ In the future, i'm going to unify all vms by one interface and this interface will be used for Multivm and for one Vm. There will be no more difference between them. This pr is a preparation step. We need it for mitigating circular dependencies in the future ## Checklist - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zk fmt` and `zk lint`. Signed-off-by: Danil --- Cargo.lock | 263 ++++++------------ Cargo.toml | 5 - .../bin/system-constants-generator/Cargo.toml | 2 +- .../src/intrinsic_costs.rs | 2 +- .../system-constants-generator/src/main.rs | 2 +- .../system-constants-generator/src/utils.rs | 10 +- core/lib/multivm/Cargo.toml | 24 +- core/lib/multivm/src/glue/block_properties.rs | 14 +- core/lib/multivm/src/glue/history_mode.rs | 52 ++-- core/lib/multivm/src/glue/init_vm.rs | 52 ++-- core/lib/multivm/src/glue/oracle_tools.rs | 16 +- core/lib/multivm/src/glue/tracer.rs | 16 +- .../src/glue/tracer/implementations.rs | 24 +- .../src/glue/types/vm/block_context_mode.rs | 26 +- .../glue/types/vm/bytecompression_result.rs | 16 +- .../glue/types/vm/current_execution_state.rs | 6 +- .../src/glue/types/vm/execution_result.rs | 18 +- core/lib/multivm/src/glue/types/vm/halt.rs | 42 +-- .../lib/multivm/src/glue/types/vm/l1_batch.rs | 4 +- .../lib/multivm/src/glue/types/vm/l2_block.rs | 4 +- core/lib/multivm/src/glue/types/vm/refunds.rs | 6 +- .../multivm/src/glue/types/vm/system_env.rs | 4 +- .../src/glue/types/vm/tx_execution_mode.rs | 46 +-- .../src/glue/types/vm/tx_revert_reason.rs | 194 +++++++------ .../src/glue/types/vm/validation_error.rs | 74 ++--- .../glue/types/vm/validation_tracer_params.rs | 18 +- .../src/glue/types/vm/vm_block_result.rs | 32 +-- .../src/glue/types/vm/vm_execution_mode.rs | 10 +- .../src/glue/types/vm/vm_execution_result.rs | 12 +- .../types/vm/vm_execution_result_and_logs.rs | 6 +- .../glue/types/vm/vm_execution_statistics.rs | 6 +- .../src/glue/types/vm/vm_memory_metrics.rs | 6 +- .../types/vm/vm_partial_execution_result.rs | 66 +++-- .../src/glue/types/vm/vm_revert_reason.rs | 54 ++-- .../glue/types/vm/vm_tx_execution_result.rs | 36 +-- core/lib/multivm/src/lib.rs | 12 + .../multivm/src/versions}/README.md | 0 core/lib/multivm/src/versions/mod.rs | 5 + .../multivm/src/versions}/vm_1_3_2/README.md | 0 .../versions/vm_1_3_2}/bootloader_state.rs | 2 +- .../vm_1_3_2}/errors/bootloader_error.rs | 0 .../src/versions/vm_1_3_2}/errors/mod.rs | 0 .../vm_1_3_2}/errors/tx_revert_reason.rs | 0 .../vm_1_3_2}/errors/vm_revert_reason.rs | 2 +- .../src/versions/vm_1_3_2}/event_sink.rs | 4 +- .../multivm/src/versions/vm_1_3_2}/events.rs | 2 +- .../versions/vm_1_3_2}/history_recorder.rs | 6 +- .../multivm/src/versions/vm_1_3_2}/memory.rs | 14 +- .../multivm/src/versions/vm_1_3_2/mod.rs} | 14 +- .../src/versions/vm_1_3_2}/oracle_tools.rs | 10 +- .../versions/vm_1_3_2}/oracles/decommitter.rs | 12 +- .../src/versions/vm_1_3_2}/oracles/mod.rs | 8 +- .../versions/vm_1_3_2}/oracles/precompile.rs | 4 +- .../src/versions/vm_1_3_2}/oracles/storage.rs | 12 +- .../vm_1_3_2}/oracles/tracer/bootloader.rs | 16 +- .../versions/vm_1_3_2}/oracles/tracer/call.rs | 16 +- .../versions/vm_1_3_2}/oracles/tracer/mod.rs | 8 +- .../vm_1_3_2}/oracles/tracer/one_tx.rs | 6 +- .../oracles/tracer/transaction_result.rs | 10 +- .../vm_1_3_2}/oracles/tracer/utils.rs | 18 +- .../vm_1_3_2}/oracles/tracer/validation.rs | 8 +- .../src/versions/vm_1_3_2}/pubdata_utils.rs | 10 +- .../multivm/src/versions/vm_1_3_2}/refunds.rs | 8 +- .../src/versions/vm_1_3_2}/test_utils.rs | 4 +- .../versions/vm_1_3_2}/tests/bootloader.rs | 2 +- .../src/versions/vm_1_3_2}/tests/mod.rs | 0 .../src/versions/vm_1_3_2}/tests/upgrades.rs | 2 +- .../src/versions/vm_1_3_2}/tests/utils.rs | 0 .../versions/vm_1_3_2}/transaction_data.rs | 4 +- .../multivm/src/versions/vm_1_3_2}/utils.rs | 11 +- .../multivm/src/versions/vm_1_3_2}/vm.rs | 40 +-- .../versions/vm_1_3_2}/vm_with_bootloader.rs | 4 +- .../src/versions/vm_latest}/README.md | 0 .../vm_latest}/bootloader_state/l2_block.rs | 8 +- .../vm_latest}/bootloader_state/mod.rs | 0 .../vm_latest}/bootloader_state/snapshot.rs | 0 .../vm_latest}/bootloader_state/state.rs | 18 +- .../vm_latest}/bootloader_state/tx.rs | 2 +- .../vm_latest}/bootloader_state/utils.rs | 6 +- .../src/versions/vm_latest}/constants.rs | 9 +- .../vm_latest}/errors/bootloader_error.rs | 0 .../vm_latest}/errors/bytecode_compression.rs | 0 .../src/versions/vm_latest}/errors/halt.rs | 2 +- .../src/versions/vm_latest}/errors/mod.rs | 0 .../vm_latest}/errors/tx_revert_reason.rs | 2 +- .../vm_latest}/errors/vm_revert_reason.rs | 0 .../vm_latest}/implementation/bytecode.rs | 2 +- .../vm_latest}/implementation/execution.rs | 12 +- .../versions/vm_latest}/implementation/gas.rs | 6 +- .../vm_latest}/implementation/logs.rs | 10 +- .../versions/vm_latest}/implementation/mod.rs | 0 .../vm_latest}/implementation/snapshots.rs | 4 +- .../vm_latest}/implementation/statistics.rs | 12 +- .../versions/vm_latest}/implementation/tx.rs | 12 +- .../src/versions/vm_latest/mod.rs} | 7 +- .../versions/vm_latest}/old_vm/event_sink.rs | 4 +- .../src/versions/vm_latest}/old_vm/events.rs | 2 +- .../vm_latest}/old_vm/history_recorder.rs | 8 +- .../src/versions/vm_latest}/old_vm/memory.rs | 16 +- .../src/versions/vm_latest}/old_vm/mod.rs | 0 .../vm_latest}/old_vm/oracles/decommitter.rs | 12 +- .../versions/vm_latest}/old_vm/oracles/mod.rs | 2 +- .../vm_latest}/old_vm/oracles/precompile.rs | 4 +- .../vm_latest}/old_vm/oracles/storage.rs | 12 +- .../src/versions/vm_latest}/old_vm/utils.rs | 14 +- .../src/versions/vm_latest}/oracles/mod.rs | 0 .../versions/vm_latest}/oracles/storage.rs | 14 +- .../versions/vm_latest}/tests/bootloader.rs | 18 +- .../vm_latest}/tests/bytecode_publishing.rs | 8 +- .../versions/vm_latest}/tests/call_tracer.rs | 8 +- .../versions/vm_latest}/tests/default_aa.rs | 8 +- .../versions/vm_latest}/tests/gas_limit.rs | 10 +- .../vm_latest}/tests/get_used_contracts.rs | 8 +- .../vm_latest}/tests/invalid_bytecode.rs | 6 +- .../vm_latest}/tests/is_write_initial.rs | 8 +- .../vm_latest}/tests/l1_tx_execution.rs | 12 +- .../versions/vm_latest}/tests/l2_blocks.rs | 12 +- .../src/versions/vm_latest}/tests/mod.rs | 0 .../versions/vm_latest}/tests/nonce_holder.rs | 12 +- .../src/versions/vm_latest}/tests/refunds.rs | 10 +- .../vm_latest}/tests/require_eip712.rs | 8 +- .../versions/vm_latest}/tests/rollbacks.rs | 8 +- .../vm_latest}/tests/simple_execution.rs | 6 +- .../vm_latest}/tests/tester/inner_state.rs | 10 +- .../versions/vm_latest}/tests/tester/mod.rs | 0 .../tests/tester/transaction_test_info.rs | 6 +- .../vm_latest}/tests/tester/vm_tester.rs | 18 +- .../tests/tracing_execution_error.rs | 12 +- .../src/versions/vm_latest}/tests/upgrade.rs | 8 +- .../src/versions/vm_latest}/tests/utils.rs | 6 +- .../src/versions/vm_latest}/tracers/call.rs | 14 +- .../vm_latest}/tracers/default_tracers.rs | 24 +- .../src/versions/vm_latest}/tracers/mod.rs | 0 .../versions/vm_latest}/tracers/refunds.rs | 20 +- .../vm_latest}/tracers/result_tracer.rs | 20 +- .../vm_latest}/tracers/storage_invocations.rs | 10 +- .../src/versions/vm_latest}/tracers/traits.rs | 14 +- .../src/versions/vm_latest}/tracers/utils.rs | 16 +- .../vm_latest}/tracers/validation/error.rs | 2 +- .../vm_latest}/tracers/validation/mod.rs | 12 +- .../vm_latest}/tracers/validation/params.rs | 0 .../vm_latest}/tracers/validation/types.rs | 0 .../vm_latest}/types/inputs/execution_mode.rs | 0 .../vm_latest}/types/inputs/l1_batch_env.rs | 6 +- .../vm_latest}/types/inputs/l2_block.rs | 0 .../versions/vm_latest}/types/inputs/mod.rs | 0 .../vm_latest}/types/inputs/system_env.rs | 0 .../vm_latest}/types/internals/mod.rs | 0 .../vm_latest}/types/internals/snapshot.rs | 4 +- .../types/internals/transaction_data.rs | 2 +- .../vm_latest}/types/internals/vm_state.rs | 18 +- .../src/versions/vm_latest}/types/mod.rs | 0 .../types/outputs/execution_result.rs | 2 +- .../types/outputs/execution_state.rs | 0 .../types/outputs/finished_l1batch.rs | 2 +- .../vm_latest}/types/outputs/l2_block.rs | 0 .../versions/vm_latest}/types/outputs/mod.rs | 0 .../vm_latest}/types/outputs/statistic.rs | 0 .../src/versions/vm_latest}/utils/fee.rs | 2 +- .../versions/vm_latest}/utils/l2_blocks.rs | 2 +- .../src/versions/vm_latest}/utils/mod.rs | 0 .../src/versions/vm_latest}/utils/overhead.rs | 6 +- .../vm_latest}/utils/transaction_encoding.rs | 2 +- .../src/versions/vm_latest}/vm.rs | 14 +- .../src/versions/vm_m5}/bootloader_state.rs | 2 +- .../vm_m5}/errors/bootloader_error.rs | 0 .../multivm/src/versions/vm_m5}/errors/mod.rs | 0 .../vm_m5}/errors/tx_revert_reason.rs | 0 .../vm_m5}/errors/vm_revert_reason.rs | 2 +- .../multivm/src/versions/vm_m5}/event_sink.rs | 6 +- .../multivm/src/versions/vm_m5}/events.rs | 2 +- .../multivm/src/versions/vm_m5}/glue.rs | 22 +- .../src/versions/vm_m5}/history_recorder.rs | 4 +- .../multivm/src/versions/vm_m5}/memory.rs | 14 +- .../multivm/src/versions/vm_m5/mod.rs} | 14 +- .../src/versions/vm_m5}/oracle_tools.rs | 16 +- .../versions/vm_m5}/oracles/decommitter.rs | 10 +- .../src/versions/vm_m5}/oracles/mod.rs | 8 +- .../src/versions/vm_m5}/oracles/precompile.rs | 4 +- .../src/versions/vm_m5}/oracles/storage.rs | 18 +- .../src/versions/vm_m5}/oracles/tracer.rs | 16 +- .../src/versions/vm_m5}/pubdata_utils.rs | 14 +- .../multivm/src/versions/vm_m5}/refunds.rs | 8 +- .../multivm/src/versions/vm_m5}/storage.rs | 0 .../multivm/src/versions/vm_m5}/test_utils.rs | 6 +- .../src/versions/vm_m5}/tests/bootloader.rs | 14 +- .../multivm/src/versions/vm_m5}/tests/mod.rs | 0 .../src/versions/vm_m5}/transaction_data.rs | 6 +- .../multivm/src/versions/vm_m5}/utils.rs | 11 +- .../multivm/src/versions/vm_m5}/vm.rs | 42 +-- .../src/versions/vm_m5}/vm_with_bootloader.rs | 6 +- .../multivm/src/versions}/vm_m6/README.md | 0 .../src/versions/vm_m6}/bootloader_state.rs | 2 +- .../vm_m6}/errors/bootloader_error.rs | 0 .../multivm/src/versions/vm_m6}/errors/mod.rs | 0 .../vm_m6}/errors/tx_revert_reason.rs | 0 .../vm_m6}/errors/vm_revert_reason.rs | 2 +- .../multivm/src/versions/vm_m6}/event_sink.rs | 4 +- .../multivm/src/versions/vm_m6}/events.rs | 2 +- .../src/versions}/vm_m6/fuzz/.gitignore | 0 .../src/versions}/vm_m6/fuzz/Cargo.toml | 4 +- .../src/versions}/vm_m6/fuzz/compare.sh | 0 .../multivm/src/versions}/vm_m6/fuzz/fuzz.sh | 0 .../fuzz/fuzz_targets/deploy_transaction.rs | 0 .../src/versions}/vm_m6/fuzz/show_cycle.gdb | 0 .../multivm/src/versions/vm_m6}/glue.rs | 34 +-- .../src/versions/vm_m6}/history_recorder.rs | 4 +- .../multivm/src/versions/vm_m6}/memory.rs | 14 +- .../multivm/src/versions/vm_m6/mod.rs} | 12 +- .../src/versions/vm_m6}/oracle_tools.rs | 12 +- .../versions/vm_m6}/oracles/decommitter.rs | 10 +- .../src/versions/vm_m6}/oracles/mod.rs | 8 +- .../src/versions/vm_m6}/oracles/precompile.rs | 4 +- .../src/versions/vm_m6}/oracles/storage.rs | 16 +- .../vm_m6}/oracles/tracer/bootloader.rs | 16 +- .../versions/vm_m6}/oracles/tracer/call.rs | 18 +- .../src/versions/vm_m6}/oracles/tracer/mod.rs | 8 +- .../versions/vm_m6}/oracles/tracer/one_tx.rs | 6 +- .../oracles/tracer/transaction_result.rs | 10 +- .../versions/vm_m6}/oracles/tracer/utils.rs | 18 +- .../vm_m6}/oracles/tracer/validation.rs | 8 +- .../src/versions/vm_m6}/pubdata_utils.rs | 16 +- .../multivm/src/versions/vm_m6}/refunds.rs | 10 +- .../multivm/src/versions/vm_m6}/storage.rs | 0 .../multivm/src/versions/vm_m6}/test_utils.rs | 6 +- .../src/versions/vm_m6}/tests/bootloader.rs | 2 +- .../multivm/src/versions/vm_m6}/tests/mod.rs | 0 .../src/versions/vm_m6}/transaction_data.rs | 4 +- .../multivm/src/versions/vm_m6}/utils.rs | 15 +- .../multivm/src/versions/vm_m6}/vm.rs | 44 +-- .../src/versions/vm_m6}/vm_with_bootloader.rs | 6 +- .../src/versions}/vm_virtual_blocks/README.md | 0 .../bootloader_state/l2_block.rs | 8 +- .../bootloader_state/mod.rs | 0 .../bootloader_state/snapshot.rs | 0 .../bootloader_state/state.rs | 18 +- .../vm_virtual_blocks}/bootloader_state/tx.rs | 2 +- .../bootloader_state/utils.rs | 6 +- .../versions/vm_virtual_blocks}/constants.rs | 9 +- .../errors/bootloader_error.rs | 0 .../errors/bytecode_compression.rs | 0 .../vm_virtual_blocks}/errors/halt.rs | 2 +- .../versions/vm_virtual_blocks}/errors/mod.rs | 0 .../errors/tx_revert_reason.rs | 2 +- .../errors/vm_revert_reason.rs | 0 .../implementation/bytecode.rs | 2 +- .../implementation/execution.rs | 12 +- .../vm_virtual_blocks}/implementation/gas.rs | 6 +- .../vm_virtual_blocks}/implementation/logs.rs | 10 +- .../vm_virtual_blocks}/implementation/mod.rs | 0 .../implementation/snapshots.rs | 4 +- .../implementation/statistics.rs | 12 +- .../vm_virtual_blocks}/implementation/tx.rs | 14 +- .../src/versions/vm_virtual_blocks/mod.rs} | 7 +- .../vm_virtual_blocks}/old_vm/event_sink.rs | 4 +- .../vm_virtual_blocks}/old_vm/events.rs | 2 +- .../old_vm/history_recorder.rs | 8 +- .../vm_virtual_blocks}/old_vm/memory.rs | 16 +- .../versions/vm_virtual_blocks}/old_vm/mod.rs | 0 .../old_vm/oracles/decommitter.rs | 12 +- .../vm_virtual_blocks}/old_vm/oracles/mod.rs | 2 +- .../old_vm}/oracles/precompile.rs | 6 +- .../old_vm/oracles/storage.rs | 12 +- .../vm_virtual_blocks}/old_vm/utils.rs | 14 +- .../vm_virtual_blocks}/tests/bootloader.rs | 18 +- .../tests/bytecode_publishing.rs | 8 +- .../vm_virtual_blocks}/tests/call_tracer.rs | 8 +- .../vm_virtual_blocks}/tests/default_aa.rs | 10 +- .../vm_virtual_blocks}/tests/gas_limit.rs | 10 +- .../tests/get_used_contracts.rs | 8 +- .../tests/invalid_bytecode.rs | 6 +- .../tests/is_write_initial.rs | 8 +- .../tests/l1_tx_execution.rs | 12 +- .../vm_virtual_blocks}/tests/l2_blocks.rs | 12 +- .../versions/vm_virtual_blocks}/tests/mod.rs | 0 .../vm_virtual_blocks}/tests/nonce_holder.rs | 14 +- .../vm_virtual_blocks}/tests/refunds.rs | 10 +- .../tests/require_eip712.rs | 8 +- .../vm_virtual_blocks}/tests/rollbacks.rs | 8 +- .../tests/simple_execution.rs | 6 +- .../tests/tester/inner_state.rs | 12 +- .../vm_virtual_blocks}/tests/tester/mod.rs | 0 .../tests/tester/transaction_test_info.rs | 6 +- .../tests/tester/vm_tester.rs | 18 +- .../tests/tracing_execution_error.rs | 14 +- .../vm_virtual_blocks}/tests/upgrade.rs | 10 +- .../vm_virtual_blocks}/tests/utils.rs | 6 +- .../vm_virtual_blocks}/tracers/call.rs | 16 +- .../tracers/default_tracers.rs | 30 +- .../vm_virtual_blocks}/tracers/mod.rs | 0 .../vm_virtual_blocks}/tracers/refunds.rs | 18 +- .../tracers/result_tracer.rs | 18 +- .../tracers/storage_invocations.rs | 10 +- .../vm_virtual_blocks}/tracers/traits.rs | 16 +- .../vm_virtual_blocks}/tracers/utils.rs | 14 +- .../tracers/validation/error.rs | 2 +- .../tracers/validation/mod.rs | 14 +- .../tracers/validation/params.rs | 0 .../tracers/validation/types.rs | 0 .../types/inputs/execution_mode.rs | 0 .../types/inputs/l1_batch_env.rs | 6 +- .../types/inputs/l2_block.rs | 0 .../vm_virtual_blocks}/types/inputs/mod.rs | 0 .../types/inputs/system_env.rs | 0 .../vm_virtual_blocks}/types/internals/mod.rs | 0 .../types/internals/snapshot.rs | 4 +- .../types/internals/transaction_data.rs | 2 +- .../types/internals/vm_state.rs | 16 +- .../versions/vm_virtual_blocks}/types/mod.rs | 0 .../types/outputs/execution_result.rs | 2 +- .../types/outputs/execution_state.rs | 0 .../types/outputs/finished_l1batch.rs | 2 +- .../types/outputs/l2_block.rs | 0 .../vm_virtual_blocks}/types/outputs/mod.rs | 0 .../types/outputs/statistic.rs | 0 .../versions/vm_virtual_blocks}/utils/fee.rs | 2 +- .../vm_virtual_blocks}/utils/l2_blocks.rs | 2 +- .../versions/vm_virtual_blocks}/utils/mod.rs | 0 .../vm_virtual_blocks}/utils/overhead.rs | 6 +- .../utils/transaction_encoding.rs | 2 +- .../src/versions/vm_virtual_blocks}/vm.rs | 14 +- core/lib/multivm/src/vm_instance.rs | 68 ++--- core/lib/types/Cargo.toml | 2 +- core/lib/utils/Cargo.toml | 2 +- core/lib/vm/Cargo.toml | 32 --- core/lib/zksync_core/Cargo.toml | 1 - .../src/api_server/execution_sandbox/apply.rs | 4 +- .../src/api_server/execution_sandbox/error.rs | 2 +- .../api_server/execution_sandbox/execute.rs | 4 +- .../src/api_server/execution_sandbox/mod.rs | 2 +- .../api_server/execution_sandbox/tracers.rs | 2 +- .../api_server/execution_sandbox/validate.rs | 4 +- .../execution_sandbox/vm_metrics.rs | 2 +- .../src/api_server/tx_sender/mod.rs | 2 +- .../src/api_server/tx_sender/result.rs | 2 +- .../src/api_server/web3/namespaces/debug.rs | 4 +- core/lib/zksync_core/src/fee_ticker/mod.rs | 2 +- .../src/state_keeper/batch_executor/mod.rs | 4 +- .../batch_executor/tests/tester.rs | 2 +- .../zksync_core/src/state_keeper/io/common.rs | 4 +- .../src/state_keeper/io/mempool.rs | 4 +- .../zksync_core/src/state_keeper/io/mod.rs | 2 +- .../src/state_keeper/io/seal_logic.rs | 2 +- .../src/state_keeper/io/tests/mod.rs | 2 +- .../src/state_keeper/io/tests/tester.rs | 2 +- .../zksync_core/src/state_keeper/keeper.rs | 2 +- .../src/state_keeper/mempool_actor.rs | 2 +- .../criteria/geometry_seal_criteria.rs | 2 +- .../criteria/tx_encoding_size.rs | 2 +- .../src/state_keeper/seal_criteria/mod.rs | 2 +- .../zksync_core/src/state_keeper/tests/mod.rs | 2 +- .../src/state_keeper/tests/tester.rs | 4 +- .../state_keeper/updates/l1_batch_updates.rs | 2 +- .../state_keeper/updates/miniblock_updates.rs | 4 +- .../src/state_keeper/updates/mod.rs | 2 +- .../zksync_core/src/sync_layer/external_io.rs | 2 +- .../src/witness_generator/basic_circuits.rs | 4 +- core/multivm_deps/vm_1_3_2/Cargo.toml | 33 --- core/multivm_deps/vm_m5/Cargo.toml | 34 --- core/multivm_deps/vm_m6/Cargo.toml | 35 --- .../multivm_deps/vm_virtual_blocks/Cargo.toml | 33 --- core/tests/vm-benchmark/harness/Cargo.toml | 4 +- core/tests/vm-benchmark/harness/src/lib.rs | 15 +- prover/witness_generator/Cargo.toml | 2 +- .../witness_generator/src/basic_circuits.rs | 2 +- 365 files changed, 1737 insertions(+), 1802 deletions(-) rename core/{multivm_deps => lib/multivm/src/versions}/README.md (100%) create mode 100644 core/lib/multivm/src/versions/mod.rs rename core/{multivm_deps => lib/multivm/src/versions}/vm_1_3_2/README.md (100%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/bootloader_state.rs (98%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/errors/bootloader_error.rs (100%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/errors/mod.rs (100%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/errors/tx_revert_reason.rs (100%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/errors/vm_revert_reason.rs (99%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/event_sink.rs (99%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_1_3_2}/events.rs (98%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/history_recorder.rs (99%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/memory.rs (96%) rename core/{multivm_deps/vm_1_3_2/src/lib.rs => lib/multivm/src/versions/vm_1_3_2/mod.rs} (64%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/oracle_tools.rs (87%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/oracles/decommitter.rs (97%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/oracles/mod.rs (59%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_1_3_2}/oracles/precompile.rs (96%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/oracles/storage.rs (97%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/oracles/tracer/bootloader.rs (91%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/oracles/tracer/call.rs (96%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_1_3_2}/oracles/tracer/mod.rs (89%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/oracles/tracer/one_tx.rs (97%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/oracles/tracer/transaction_result.rs (96%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/oracles/tracer/utils.rs (93%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/oracles/tracer/validation.rs (99%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/pubdata_utils.rs (93%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/refunds.rs (97%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/test_utils.rs (99%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/tests/bootloader.rs (99%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/tests/mod.rs (100%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/tests/upgrades.rs (99%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/tests/utils.rs (100%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/transaction_data.rs (99%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/utils.rs (96%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/vm.rs (97%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_1_3_2}/vm_with_bootloader.rs (99%) rename core/lib/{vm => multivm/src/versions/vm_latest}/README.md (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/bootloader_state/l2_block.rs (91%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/bootloader_state/mod.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/bootloader_state/snapshot.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/bootloader_state/state.rs (94%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/bootloader_state/tx.rs (96%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/bootloader_state/utils.rs (96%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/constants.rs (94%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/errors/bootloader_error.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/errors/bytecode_compression.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/errors/halt.rs (99%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/errors/mod.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/errors/tx_revert_reason.rs (99%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/errors/vm_revert_reason.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/implementation/bytecode.rs (97%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/implementation/execution.rs (94%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/implementation/gas.rs (91%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/implementation/logs.rs (87%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/implementation/mod.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/implementation/snapshots.rs (97%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/implementation/statistics.rs (90%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/implementation/tx.rs (84%) rename core/lib/{vm/src/lib.rs => multivm/src/versions/vm_latest/mod.rs} (88%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/old_vm/event_sink.rs (99%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/old_vm/events.rs (98%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/old_vm/history_recorder.rs (99%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/old_vm/memory.rs (95%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/old_vm/mod.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/old_vm/oracles/decommitter.rs (97%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/old_vm/oracles/mod.rs (77%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/old_vm/oracles/precompile.rs (95%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/old_vm/oracles/storage.rs (96%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/old_vm/utils.rs (94%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/oracles/mod.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/oracles/storage.rs (97%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/tests/bootloader.rs (76%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/bytecode_publishing.rs (81%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/tests/call_tracer.rs (90%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/default_aa.rs (88%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/gas_limit.rs (79%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/get_used_contracts.rs (91%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/tests/invalid_bytecode.rs (96%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/is_write_initial.rs (83%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/l1_tx_execution.rs (92%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/l2_blocks.rs (98%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/mod.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/tests/nonce_holder.rs (93%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/refunds.rs (94%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/require_eip712.rs (95%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/rollbacks.rs (97%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/simple_execution.rs (92%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/tester/inner_state.rs (93%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/tester/mod.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/tests/tester/transaction_test_info.rs (98%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/tester/vm_tester.rs (95%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/tests/tracing_execution_error.rs (80%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/upgrade.rs (97%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tests/utils.rs (95%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tracers/call.rs (95%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tracers/default_tracers.rs (94%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tracers/mod.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tracers/refunds.rs (95%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tracers/result_tracer.rs (93%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tracers/storage_invocations.rs (82%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tracers/traits.rs (88%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tracers/utils.rs (94%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/tracers/validation/error.rs (95%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tracers/validation/mod.rs (98%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tracers/validation/params.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/tracers/validation/types.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/types/inputs/execution_mode.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/types/inputs/l1_batch_env.rs (94%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/types/inputs/l2_block.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/types/inputs/mod.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/types/inputs/system_env.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/types/internals/mod.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/types/internals/snapshot.rs (71%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/types/internals/transaction_data.rs (99%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/types/internals/vm_state.rs (93%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/types/mod.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/types/outputs/execution_result.rs (97%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/types/outputs/execution_state.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/types/outputs/finished_l1batch.rs (85%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/types/outputs/l2_block.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/types/outputs/mod.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/types/outputs/statistic.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/utils/fee.rs (94%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/utils/l2_blocks.rs (98%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/utils/mod.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_latest}/utils/overhead.rs (98%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/utils/transaction_encoding.rs (89%) rename core/lib/{vm/src => multivm/src/versions/vm_latest}/vm.rs (94%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/bootloader_state.rs (98%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/errors/bootloader_error.rs (100%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/errors/mod.rs (100%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/errors/tx_revert_reason.rs (100%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/errors/vm_revert_reason.rs (99%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/event_sink.rs (97%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_m5}/events.rs (98%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/glue.rs (70%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/history_recorder.rs (99%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/memory.rs (95%) rename core/{multivm_deps/vm_m5/src/lib.rs => lib/multivm/src/versions/vm_m5/mod.rs} (73%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/oracle_tools.rs (70%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/oracles/decommitter.rs (96%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/oracles/mod.rs (61%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/oracles/precompile.rs (97%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/oracles/storage.rs (95%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/oracles/tracer.rs (98%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/pubdata_utils.rs (91%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/refunds.rs (98%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/storage.rs (100%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/test_utils.rs (99%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/tests/bootloader.rs (99%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/tests/mod.rs (100%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/transaction_data.rs (99%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/utils.rs (96%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/vm.rs (96%) rename core/{multivm_deps/vm_m5/src => lib/multivm/src/versions/vm_m5}/vm_with_bootloader.rs (99%) rename core/{multivm_deps => lib/multivm/src/versions}/vm_m6/README.md (100%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/bootloader_state.rs (98%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/errors/bootloader_error.rs (100%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/errors/mod.rs (100%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/errors/tx_revert_reason.rs (100%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/errors/vm_revert_reason.rs (99%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/event_sink.rs (99%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/events.rs (98%) rename core/{multivm_deps => lib/multivm/src/versions}/vm_m6/fuzz/.gitignore (100%) rename core/{multivm_deps => lib/multivm/src/versions}/vm_m6/fuzz/Cargo.toml (76%) rename core/{multivm_deps => lib/multivm/src/versions}/vm_m6/fuzz/compare.sh (100%) rename core/{multivm_deps => lib/multivm/src/versions}/vm_m6/fuzz/fuzz.sh (100%) rename core/{multivm_deps => lib/multivm/src/versions}/vm_m6/fuzz/fuzz_targets/deploy_transaction.rs (100%) rename core/{multivm_deps => lib/multivm/src/versions}/vm_m6/fuzz/show_cycle.gdb (100%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/glue.rs (63%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/history_recorder.rs (99%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/memory.rs (95%) rename core/{multivm_deps/vm_m6/src/lib.rs => lib/multivm/src/versions/vm_m6/mod.rs} (69%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/oracle_tools.rs (84%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/oracles/decommitter.rs (97%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/oracles/mod.rs (59%) rename core/lib/{vm/src/old_vm => multivm/src/versions/vm_m6}/oracles/precompile.rs (96%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/oracles/storage.rs (96%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/oracles/tracer/bootloader.rs (91%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/oracles/tracer/call.rs (96%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_m6}/oracles/tracer/mod.rs (90%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/oracles/tracer/one_tx.rs (97%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/oracles/tracer/transaction_result.rs (96%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/oracles/tracer/utils.rs (94%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/oracles/tracer/validation.rs (99%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/pubdata_utils.rs (90%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/refunds.rs (97%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/storage.rs (100%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/test_utils.rs (98%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/tests/bootloader.rs (99%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/tests/mod.rs (100%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/transaction_data.rs (99%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/utils.rs (96%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/vm.rs (97%) rename core/{multivm_deps/vm_m6/src => lib/multivm/src/versions/vm_m6}/vm_with_bootloader.rs (99%) rename core/{multivm_deps => lib/multivm/src/versions}/vm_virtual_blocks/README.md (100%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/bootloader_state/l2_block.rs (90%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/bootloader_state/mod.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/bootloader_state/snapshot.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/bootloader_state/state.rs (93%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/bootloader_state/tx.rs (95%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/bootloader_state/utils.rs (96%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/constants.rs (94%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/errors/bootloader_error.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/errors/bytecode_compression.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/errors/halt.rs (98%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/errors/mod.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/errors/tx_revert_reason.rs (99%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/errors/vm_revert_reason.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/implementation/bytecode.rs (97%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/implementation/execution.rs (93%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/implementation/gas.rs (90%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/implementation/logs.rs (86%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/implementation/mod.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/implementation/snapshots.rs (97%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/implementation/statistics.rs (89%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/implementation/tx.rs (82%) rename core/{multivm_deps/vm_virtual_blocks/src/lib.rs => lib/multivm/src/versions/vm_virtual_blocks/mod.rs} (88%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/old_vm/event_sink.rs (99%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/old_vm/events.rs (98%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/old_vm/history_recorder.rs (98%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/old_vm/memory.rs (95%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/old_vm/mod.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/old_vm/oracles/decommitter.rs (96%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/old_vm/oracles/mod.rs (80%) rename core/{multivm_deps/vm_1_3_2/src => lib/multivm/src/versions/vm_virtual_blocks/old_vm}/oracles/precompile.rs (95%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/old_vm/oracles/storage.rs (96%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/old_vm/utils.rs (94%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/tests/bootloader.rs (73%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/bytecode_publishing.rs (80%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/tests/call_tracer.rs (89%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/default_aa.rs (87%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/gas_limit.rs (77%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/get_used_contracts.rs (90%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/tests/invalid_bytecode.rs (95%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/is_write_initial.rs (81%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/l1_tx_execution.rs (91%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/l2_blocks.rs (98%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/mod.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/tests/nonce_holder.rs (92%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/refunds.rs (93%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/require_eip712.rs (95%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/rollbacks.rs (95%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/simple_execution.rs (91%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/tester/inner_state.rs (92%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/tester/mod.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/tests/tester/transaction_test_info.rs (98%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/tester/vm_tester.rs (95%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/tests/tracing_execution_error.rs (78%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/upgrade.rs (97%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tests/utils.rs (95%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tracers/call.rs (94%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tracers/default_tracers.rs (90%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tracers/mod.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tracers/refunds.rs (96%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tracers/result_tracer.rs (94%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tracers/storage_invocations.rs (77%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tracers/traits.rs (82%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tracers/utils.rs (94%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/tracers/validation/error.rs (94%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tracers/validation/mod.rs (97%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tracers/validation/params.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/tracers/validation/types.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/types/inputs/execution_mode.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/types/inputs/l1_batch_env.rs (94%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/types/inputs/l2_block.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/types/inputs/mod.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/types/inputs/system_env.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/types/internals/mod.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/types/internals/snapshot.rs (69%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/types/internals/transaction_data.rs (99%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/types/internals/vm_state.rs (93%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/types/mod.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/types/outputs/execution_result.rs (97%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/types/outputs/execution_state.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/types/outputs/finished_l1batch.rs (84%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/types/outputs/l2_block.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/types/outputs/mod.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/types/outputs/statistic.rs (100%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/utils/fee.rs (93%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/utils/l2_blocks.rs (98%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/utils/mod.rs (100%) rename core/lib/{vm/src => multivm/src/versions/vm_virtual_blocks}/utils/overhead.rs (98%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/utils/transaction_encoding.rs (87%) rename core/{multivm_deps/vm_virtual_blocks/src => lib/multivm/src/versions/vm_virtual_blocks}/vm.rs (93%) delete mode 100644 core/lib/vm/Cargo.toml delete mode 100644 core/multivm_deps/vm_1_3_2/Cargo.toml delete mode 100644 core/multivm_deps/vm_m5/Cargo.toml delete mode 100644 core/multivm_deps/vm_m6/Cargo.toml delete mode 100644 core/multivm_deps/vm_virtual_blocks/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index 08d0f3e39e9b..36e7025cd55d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -823,6 +823,14 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "blake2" +version = "0.10.6" +source = "git+https://github.com/RustCrypto/hashes.git?rev=1f727ce37ff40fa0cce84eb8543a45bdd3ca4a4e#1f727ce37ff40fa0cce84eb8543a45bdd3ca4a4e" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "blake2-rfc_bellman_edition" version = "0.0.1" @@ -943,7 +951,7 @@ source = "git+https://github.com/matter-labs/era-boojum.git?branch=main#2771569b dependencies = [ "arrayvec 0.7.3", "bincode", - "blake2 0.10.6", + "blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", "const_format", "convert_case 0.4.0", "crossbeam 0.7.3", @@ -961,8 +969,8 @@ dependencies = [ "rand 0.8.5", "rayon", "serde", - "sha2 0.10.6", - "sha3 0.10.6", + "sha2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec", "unroll", ] @@ -2074,7 +2082,7 @@ dependencies = [ "regex", "serde", "serde_json", - "sha3 0.10.6", + "sha3 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", "uint", ] @@ -2655,7 +2663,7 @@ dependencies = [ "rsa", "serde", "serde_json", - "sha2 0.10.6", + "sha2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", "time", "tokio", @@ -3524,7 +3532,7 @@ dependencies = [ "cfg-if 1.0.0", "ecdsa", "elliptic-curve", - "sha2 0.10.6", + "sha2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3981,14 +3989,22 @@ dependencies = [ name = "multivm" version = "0.1.0" dependencies = [ - "vlog", - "vm", - "vm_1_3_2", - "vm_m5", - "vm_m6", - "vm_virtual_blocks", + "anyhow", + "ethabi", + "hex", + "itertools", + "once_cell", + "thiserror", + "tokio", + "tracing", + "vise", + "zk_evm 1.3.1", + "zk_evm 1.3.3 (git+https://github.com/matter-labs/era-zk_evm.git?tag=v1.3.3-rc1)", "zksync_contracts", + "zksync_eth_signer", "zksync_state", + "zksync_system_constants", + "zksync_test_account", "zksync_types", "zksync_utils", ] @@ -4665,7 +4681,7 @@ checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411" dependencies = [ "once_cell", "pest", - "sha2 0.10.6", + "sha2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5353,7 +5369,7 @@ source = "git+https://github.com/matter-labs/rescue-poseidon.git?branch=poseidon dependencies = [ "addchain", "arrayvec 0.7.3", - "blake2 0.10.6", + "blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", "boojum", "byteorder", "derivative", @@ -5376,7 +5392,7 @@ source = "git+https://github.com/matter-labs/rescue-poseidon#d059b5042df5ed80e15 dependencies = [ "addchain", "arrayvec 0.7.3", - "blake2 0.10.6", + "blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder", "franklin-crypto 0.0.5 (git+https://github.com/matter-labs/franklin-crypto?branch=dev)", "num-bigint 0.3.3", @@ -5987,6 +6003,16 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "sha2" +version = "0.10.6" +source = "git+https://github.com/RustCrypto/hashes.git?rev=1731ced4a116d61ba9dc6ee6d0f38fb8102e357a#1731ced4a116d61ba9dc6ee6d0f38fb8102e357a" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.7", +] + [[package]] name = "sha3" version = "0.9.1" @@ -6009,6 +6035,15 @@ dependencies = [ "keccak", ] +[[package]] +name = "sha3" +version = "0.10.6" +source = "git+https://github.com/RustCrypto/hashes.git?rev=7a187e934c1f6c68e4b4e5cf37541b7a0d64d303#7a187e934c1f6c68e4b4e5cf37541b7a0d64d303" +dependencies = [ + "digest 0.10.7", + "keccak", +] + [[package]] name = "sharded-slab" version = "0.1.4" @@ -6233,7 +6268,7 @@ dependencies = [ "serde", "serde_json", "sha-1 0.10.1", - "sha2 0.10.6", + "sha2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec", "sqlformat", "sqlx-rt", @@ -6259,7 +6294,7 @@ dependencies = [ "quote 1.0.33", "serde", "serde_json", - "sha2 0.10.6", + "sha2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", "sqlx-core", "sqlx-rt", "syn 1.0.109", @@ -6426,10 +6461,10 @@ dependencies = [ "rand 0.4.6", "rescue_poseidon 0.4.1 (git+https://github.com/matter-labs/rescue-poseidon)", "serde", - "sha2 0.10.6", - "sha3 0.10.6", + "sha2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec", - "zk_evm 1.3.3", + "zk_evm 1.3.3 (git+https://github.com/matter-labs/era-zk_evm.git?branch=v1.3.3)", "zkevm_opcode_defs 1.3.2", ] @@ -6444,10 +6479,10 @@ name = "system-constants-generator" version = "0.1.0" dependencies = [ "codegen 0.2.0", + "multivm", "once_cell", "serde", "serde_json", - "vm", "zksync_contracts", "zksync_state", "zksync_types", @@ -7161,29 +7196,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "vm" -version = "0.1.0" -dependencies = [ - "anyhow", - "ethabi", - "hex", - "itertools", - "once_cell", - "thiserror", - "tokio", - "tracing", - "vise", - "zk_evm 1.3.3", - "zksync_contracts", - "zksync_eth_signer", - "zksync_state", - "zksync_system_constants", - "zksync_test_account", - "zksync_types", - "zksync_utils", -] - [[package]] name = "vm-benchmark" version = "0.1.0" @@ -7200,104 +7212,12 @@ dependencies = [ name = "vm-benchmark-harness" version = "0.1.0" dependencies = [ + "multivm", "once_cell", - "vm", - "zk_evm 1.3.3", - "zksync_contracts", - "zksync_state", - "zksync_system_constants", - "zksync_types", - "zksync_utils", -] - -[[package]] -name = "vm_1_3_2" -version = "0.1.0" -dependencies = [ - "anyhow", - "ethabi", - "hex", - "itertools", - "once_cell", - "thiserror", - "tokio", - "tracing", - "zk_evm 1.3.3", - "zkevm-assembly 1.3.2", - "zksync_contracts", - "zksync_eth_signer", - "zksync_state", - "zksync_system_constants", - "zksync_types", - "zksync_utils", -] - -[[package]] -name = "vm_m5" -version = "0.1.0" -dependencies = [ - "hex", - "itertools", - "once_cell", - "serde", - "serde_json", - "tempfile", - "thiserror", - "tracing", - "vlog", - "zk_evm 1.3.1", - "zksync_contracts", - "zksync_crypto", - "zksync_state", - "zksync_storage", - "zksync_system_constants", - "zksync_types", - "zksync_utils", -] - -[[package]] -name = "vm_m6" -version = "0.1.0" -dependencies = [ - "hex", - "itertools", - "once_cell", - "serde", - "serde_json", - "tempfile", - "thiserror", - "tracing", - "vlog", - "zk_evm 1.3.1", - "zkevm-assembly 1.3.1", - "zksync_contracts", - "zksync_crypto", - "zksync_state", - "zksync_storage", - "zksync_system_constants", - "zksync_types", - "zksync_utils", -] - -[[package]] -name = "vm_virtual_blocks" -version = "0.1.0" -dependencies = [ - "anyhow", - "ethabi", - "hex", - "itertools", - "once_cell", - "thiserror", - "tokio", - "tracing", - "vise", - "zk_evm 1.3.3", + "zk_evm 1.3.3 (git+https://github.com/matter-labs/era-zk_evm.git?tag=v1.3.3-rc1)", "zksync_contracts", - "zksync_eth_signer", "zksync_state", "zksync_system_constants", - "zksync_test_account", "zksync_types", "zksync_utils", ] @@ -7757,20 +7677,35 @@ checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" [[package]] name = "zk_evm" version = "1.3.1" -source = "git+https://github.com/matter-labs/era-zk_evm.git?tag=v1.3.1-rc1#cec6535e2bcb1e8f0bad1befaaddec8da7f11b24" +source = "git+https://github.com/matter-labs/era-zk_evm.git?tag=v1.3.1-rc2#0a7c775932db4839ff6b7fb0db9bdb3583ab54c0" dependencies = [ - "blake2 0.10.6", + "blake2 0.10.6 (git+https://github.com/RustCrypto/hashes.git?rev=1f727ce37ff40fa0cce84eb8543a45bdd3ca4a4e)", "k256", "lazy_static", "num 0.4.0", "serde", "serde_json", - "sha2 0.10.6", - "sha3 0.10.6", + "sha2 0.10.6 (git+https://github.com/RustCrypto/hashes.git?rev=1731ced4a116d61ba9dc6ee6d0f38fb8102e357a)", + "sha3 0.10.6 (git+https://github.com/RustCrypto/hashes.git?rev=7a187e934c1f6c68e4b4e5cf37541b7a0d64d303)", "static_assertions", "zkevm_opcode_defs 1.3.1", ] +[[package]] +name = "zk_evm" +version = "1.3.3" +source = "git+https://github.com/matter-labs/era-zk_evm.git?tag=v1.3.3-rc1#fe8215a7047d24430ad470cf15a19bedb4d6ba0b" +dependencies = [ + "anyhow", + "lazy_static", + "num 0.4.0", + "serde", + "serde_json", + "static_assertions", + "zk_evm_abstractions", + "zkevm_opcode_defs 1.3.2", +] + [[package]] name = "zk_evm" version = "1.3.3" @@ -7812,25 +7747,6 @@ dependencies = [ "zkevm_opcode_defs 1.3.2", ] -[[package]] -name = "zkevm-assembly" -version = "1.3.1" -source = "git+https://github.com/matter-labs/era-zkEVM-assembly.git?tag=v1.3.1-rc0#dabbb07e84dd886ee90dde2b5dde0acbf9b0123a" -dependencies = [ - "env_logger", - "hex", - "lazy_static", - "log", - "nom", - "num-bigint 0.4.3", - "num-traits", - "sha3 0.10.6", - "smallvec", - "structopt", - "thiserror", - "zkevm_opcode_defs 1.3.1", -] - [[package]] name = "zkevm-assembly" version = "1.3.2" @@ -7843,7 +7759,7 @@ dependencies = [ "nom", "num-bigint 0.4.3", "num-traits", - "sha3 0.10.6", + "sha3 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec", "structopt", "thiserror", @@ -7878,7 +7794,7 @@ dependencies = [ "bitflags 1.3.2", "ethereum-types 0.14.1", "lazy_static", - "sha2 0.10.6", + "sha2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -7887,12 +7803,12 @@ version = "1.3.2" source = "git+https://github.com/matter-labs/era-zkevm_opcode_defs.git?branch=v1.3.2#c7ab62f4c60b27dfc690c3ab3efb5fff1ded1a25" dependencies = [ "bitflags 2.3.2", - "blake2 0.10.6", + "blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", "ethereum-types 0.14.1", "k256", "lazy_static", - "sha2 0.10.6", - "sha3 0.10.6", + "sha2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -7918,8 +7834,8 @@ dependencies = [ "sync_vm", "test-log", "tracing", - "zk_evm 1.3.3", - "zkevm-assembly 1.3.2", + "zk_evm 1.3.3 (git+https://github.com/matter-labs/era-zk_evm.git?branch=v1.3.3)", + "zkevm-assembly", ] [[package]] @@ -7944,7 +7860,7 @@ dependencies = [ "structopt", "test-log", "tracing", - "zkevm-assembly 1.3.2", + "zkevm-assembly", ] [[package]] @@ -8110,7 +8026,6 @@ dependencies = [ "tracing", "vise", "vlog", - "vm", "zksync_circuit_breaker", "zksync_commitment_utils", "zksync_config", @@ -8140,7 +8055,7 @@ name = "zksync_crypto" version = "0.1.0" dependencies = [ "base64 0.13.1", - "blake2 0.10.6", + "blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", "hex", "once_cell", "serde", @@ -8432,7 +8347,7 @@ dependencies = [ name = "zksync_types" version = "0.1.0" dependencies = [ - "blake2 0.10.6", + "blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", "chrono", "codegen 0.1.0", "ethereum-types 0.12.1", @@ -8449,7 +8364,7 @@ dependencies = [ "strum", "thiserror", "tokio", - "zk_evm 1.3.3", + "zk_evm 1.3.3 (git+https://github.com/matter-labs/era-zk_evm.git?tag=v1.3.3-rc1)", "zkevm_test_harness 1.3.3", "zksync_basic_types", "zksync_contracts", @@ -8476,7 +8391,7 @@ dependencies = [ "tokio", "tracing", "vlog", - "zk_evm 1.3.3", + "zk_evm 1.3.3 (git+https://github.com/matter-labs/era-zk_evm.git?tag=v1.3.3-rc1)", "zksync_basic_types", ] diff --git a/Cargo.toml b/Cargo.toml index 5edfc60b4b0f..ad23eeac9c9f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,14 +37,9 @@ members = [ "core/lib/utils", "core/lib/vlog", "core/lib/multivm", - "core/lib/vm", "core/lib/web3_decl", "core/lib/test_account", - # MultiVM dependencies - "core/multivm_deps/vm_m5", - "core/multivm_deps/vm_m6", - # Test infrastructure "core/tests/cross_external_nodes_checker", "core/tests/loadnext", diff --git a/core/bin/system-constants-generator/Cargo.toml b/core/bin/system-constants-generator/Cargo.toml index 561ac5167385..c80ee49cc215 100644 --- a/core/bin/system-constants-generator/Cargo.toml +++ b/core/bin/system-constants-generator/Cargo.toml @@ -15,7 +15,7 @@ zksync_state = { path = "../../lib/state" } zksync_types = { path = "../../lib/types" } zksync_utils = { path = "../../lib/utils" } zksync_contracts = { path = "../../lib/contracts" } -vm = { path = "../../lib/vm" } +multivm = { path = "../../lib/multivm" } codegen = "0.2.0" diff --git a/core/bin/system-constants-generator/src/intrinsic_costs.rs b/core/bin/system-constants-generator/src/intrinsic_costs.rs index 0491be494ab8..e15abf7d1345 100644 --- a/core/bin/system-constants-generator/src/intrinsic_costs.rs +++ b/core/bin/system-constants-generator/src/intrinsic_costs.rs @@ -9,7 +9,7 @@ use crate::utils::{ get_l2_txs, }; use crate::utils::{metrics_from_txs, TransactionGenerator}; -use vm::constants::BOOTLOADER_TX_ENCODING_SPACE; +use multivm::vm_latest::constants::BOOTLOADER_TX_ENCODING_SPACE; use zksync_types::{ethabi::Address, IntrinsicSystemGasConstants, U256}; #[derive(Debug, Clone, Copy, PartialEq)] diff --git a/core/bin/system-constants-generator/src/main.rs b/core/bin/system-constants-generator/src/main.rs index f076eadd8c8d..52d714762e6a 100644 --- a/core/bin/system-constants-generator/src/main.rs +++ b/core/bin/system-constants-generator/src/main.rs @@ -11,7 +11,7 @@ mod utils; use codegen::Block; use codegen::Scope; -use vm::constants::{ +use multivm::vm_latest::constants::{ BLOCK_OVERHEAD_GAS, BLOCK_OVERHEAD_L1_GAS, BOOTLOADER_TX_ENCODING_SPACE, MAX_PUBDATA_PER_BLOCK, }; use zksync_types::zkevm_test_harness::zk_evm::zkevm_opcode_defs::circuit_prices::{ diff --git a/core/bin/system-constants-generator/src/utils.rs b/core/bin/system-constants-generator/src/utils.rs index 2fe29be662c8..d00ef804e4a7 100644 --- a/core/bin/system-constants-generator/src/utils.rs +++ b/core/bin/system-constants-generator/src/utils.rs @@ -1,12 +1,12 @@ -use once_cell::sync::Lazy; -use std::cell::RefCell; -use std::rc::Rc; -use vm::constants::{BLOCK_GAS_LIMIT, BOOTLOADER_HEAP_PAGE}; -use vm::{ +use multivm::vm_latest::constants::{BLOCK_GAS_LIMIT, BOOTLOADER_HEAP_PAGE}; +use multivm::vm_latest::{ BootloaderState, BoxedTracer, DynTracer, HistoryEnabled, HistoryMode, L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, Vm, VmExecutionMode, VmExecutionStopReason, VmTracer, ZkSyncVmState, }; +use once_cell::sync::Lazy; +use std::cell::RefCell; +use std::rc::Rc; use zksync_contracts::{ load_sys_contract, read_bootloader_code, read_sys_contract_bytecode, read_zbin_bytecode, BaseSystemContracts, ContractLanguage, SystemContractCode, diff --git a/core/lib/multivm/Cargo.toml b/core/lib/multivm/Cargo.toml index b2dd8396f157..c6921d0d2718 100644 --- a/core/lib/multivm/Cargo.toml +++ b/core/lib/multivm/Cargo.toml @@ -10,15 +10,27 @@ keywords = ["blockchain", "zksync"] categories = ["cryptography"] [dependencies] -vm_m5 = { path = "../../multivm_deps/vm_m5" } -vm_m6 = { path = "../../multivm_deps/vm_m6" } -vm_1_3_2 = { path = "../../multivm_deps/vm_1_3_2" } -vm_virtual_blocks= { path = "../../multivm_deps/vm_virtual_blocks" } -vm_latest = { path = "../vm", package = "vm" } +zk_evm_1_3_3 = { package = "zk_evm", git = "https://github.com/matter-labs/era-zk_evm.git", tag= "v1.3.3-rc1" } +zk_evm_1_3_1 = { package = "zk_evm", git = "https://github.com/matter-labs/era-zk_evm.git", tag= "v1.3.1-rc2" } zksync_types = { path = "../types" } zksync_state = { path = "../state" } zksync_contracts = { path = "../contracts" } zksync_utils = { path = "../utils" } +zksync_system_constants = { path = "../constants" } -vlog = { path = "../../lib/vlog" } + +anyhow = "1.0" +hex = "0.4" +itertools = "0.10" +once_cell = "1.7" +thiserror = "1.0" +tracing = "0.1" +vise = { git = "https://github.com/matter-labs/vise.git", version = "0.1.0", rev = "dd05139b76ab0843443ab3ff730174942c825dae" } + + +[dev-dependencies] +tokio = { version = "1", features = ["time"] } +zksync_test_account = { path = "../test_account" } +ethabi = "18.0.0" +zksync_eth_signer = { path = "../eth_signer" } diff --git a/core/lib/multivm/src/glue/block_properties.rs b/core/lib/multivm/src/glue/block_properties.rs index 6dea6dddb1cc..00c7d3e160c4 100644 --- a/core/lib/multivm/src/glue/block_properties.rs +++ b/core/lib/multivm/src/glue/block_properties.rs @@ -9,8 +9,8 @@ use zksync_types::{VmVersion, U256}; /// boilerplate leaving the necessary wrappers only. pub enum BlockProperties { // M5 & M6 are covered by this variant. - Vm1_3_1(vm_m6::zk_evm::block_properties::BlockProperties), - Vm1_3_2(vm_1_3_2::zk_evm::block_properties::BlockProperties), + Vm1_3_1(zk_evm_1_3_1::block_properties::BlockProperties), + Vm1_3_2(zk_evm_1_3_3::block_properties::BlockProperties), } impl BlockProperties { @@ -20,14 +20,14 @@ impl BlockProperties { | VmVersion::M5WithRefunds | VmVersion::M6Initial | VmVersion::M6BugWithCompressionFixed => { - let inner = vm_m6::zk_evm::block_properties::BlockProperties { + let inner = zk_evm_1_3_1::block_properties::BlockProperties { zkporter_is_available: false, default_aa_code_hash, }; Self::Vm1_3_1(inner) } VmVersion::Vm1_3_2 => { - let inner = vm_1_3_2::zk_evm::block_properties::BlockProperties { + let inner = zk_evm_1_3_3::block_properties::BlockProperties { zkporter_is_available: false, default_aa_code_hash, }; @@ -42,7 +42,7 @@ impl BlockProperties { } } - pub fn m5(&self) -> &vm_m5::zk_evm::block_properties::BlockProperties { + pub fn m5(&self) -> &zk_evm_1_3_1::block_properties::BlockProperties { // This is not a typo, M5 is covered by this variant. See doc-comment for the enum. if let BlockProperties::Vm1_3_1(inner) = self { inner @@ -51,7 +51,7 @@ impl BlockProperties { } } - pub fn m6(&self) -> &vm_m6::zk_evm::block_properties::BlockProperties { + pub fn m6(&self) -> &zk_evm_1_3_1::block_properties::BlockProperties { // This is not a typo, M6 is covered by this variant. See doc-comment for the enum. if let BlockProperties::Vm1_3_1(inner) = self { inner @@ -60,7 +60,7 @@ impl BlockProperties { } } - pub fn vm1_3_2(&self) -> &vm_1_3_2::zk_evm::block_properties::BlockProperties { + pub fn vm1_3_2(&self) -> &zk_evm_1_3_3::block_properties::BlockProperties { if let BlockProperties::Vm1_3_2(inner) = self { inner } else { diff --git a/core/lib/multivm/src/glue/history_mode.rs b/core/lib/multivm/src/glue/history_mode.rs index b40eec4f0898..66a0c15e6688 100644 --- a/core/lib/multivm/src/glue/history_mode.rs +++ b/core/lib/multivm/src/glue/history_mode.rs @@ -7,58 +7,58 @@ pub trait HistoryMode: + GlueInto + GlueInto { - type VmM6Mode: vm_m6::HistoryMode; - type Vm1_3_2Mode: vm_1_3_2::HistoryMode; - type VmVirtualBlocksMode: vm_virtual_blocks::HistoryMode; - type VmVirtualBlocksRefundsEnhancement: vm_latest::HistoryMode; + type VmM6Mode: crate::vm_m6::HistoryMode; + type Vm1_3_2Mode: crate::vm_1_3_2::HistoryMode; + type VmVirtualBlocksMode: crate::vm_virtual_blocks::HistoryMode; + type VmVirtualBlocksRefundsEnhancement: crate::vm_latest::HistoryMode; } -impl GlueFrom for vm_m6::HistoryEnabled { - fn glue_from(_: vm_latest::HistoryEnabled) -> Self { +impl GlueFrom for crate::vm_m6::HistoryEnabled { + fn glue_from(_: crate::vm_latest::HistoryEnabled) -> Self { Self } } -impl GlueFrom for vm_1_3_2::HistoryEnabled { - fn glue_from(_: vm_latest::HistoryEnabled) -> Self { +impl GlueFrom for crate::vm_1_3_2::HistoryEnabled { + fn glue_from(_: crate::vm_latest::HistoryEnabled) -> Self { Self } } -impl GlueFrom for vm_virtual_blocks::HistoryEnabled { - fn glue_from(_: vm_latest::HistoryEnabled) -> Self { +impl GlueFrom for crate::vm_virtual_blocks::HistoryEnabled { + fn glue_from(_: crate::vm_latest::HistoryEnabled) -> Self { Self } } -impl GlueFrom for vm_m6::HistoryDisabled { - fn glue_from(_: vm_latest::HistoryDisabled) -> Self { +impl GlueFrom for crate::vm_m6::HistoryDisabled { + fn glue_from(_: crate::vm_latest::HistoryDisabled) -> Self { Self } } -impl GlueFrom for vm_1_3_2::HistoryDisabled { - fn glue_from(_: vm_latest::HistoryDisabled) -> Self { +impl GlueFrom for crate::vm_1_3_2::HistoryDisabled { + fn glue_from(_: crate::vm_latest::HistoryDisabled) -> Self { Self } } -impl GlueFrom for vm_virtual_blocks::HistoryDisabled { - fn glue_from(_: vm_latest::HistoryDisabled) -> Self { +impl GlueFrom for crate::vm_virtual_blocks::HistoryDisabled { + fn glue_from(_: crate::vm_latest::HistoryDisabled) -> Self { Self } } -impl HistoryMode for vm_latest::HistoryEnabled { - type VmM6Mode = vm_m6::HistoryEnabled; - type Vm1_3_2Mode = vm_1_3_2::HistoryEnabled; - type VmVirtualBlocksMode = vm_virtual_blocks::HistoryEnabled; - type VmVirtualBlocksRefundsEnhancement = vm_latest::HistoryEnabled; +impl HistoryMode for crate::vm_latest::HistoryEnabled { + type VmM6Mode = crate::vm_m6::HistoryEnabled; + type Vm1_3_2Mode = crate::vm_1_3_2::HistoryEnabled; + type VmVirtualBlocksMode = crate::vm_virtual_blocks::HistoryEnabled; + type VmVirtualBlocksRefundsEnhancement = crate::vm_latest::HistoryEnabled; } -impl HistoryMode for vm_latest::HistoryDisabled { - type VmM6Mode = vm_m6::HistoryDisabled; - type Vm1_3_2Mode = vm_1_3_2::HistoryDisabled; - type VmVirtualBlocksMode = vm_virtual_blocks::HistoryDisabled; - type VmVirtualBlocksRefundsEnhancement = vm_latest::HistoryDisabled; +impl HistoryMode for crate::vm_latest::HistoryDisabled { + type VmM6Mode = crate::vm_m6::HistoryDisabled; + type Vm1_3_2Mode = crate::vm_1_3_2::HistoryDisabled; + type VmVirtualBlocksMode = crate::vm_virtual_blocks::HistoryDisabled; + type VmVirtualBlocksRefundsEnhancement = crate::vm_latest::HistoryDisabled; } diff --git a/core/lib/multivm/src/glue/init_vm.rs b/core/lib/multivm/src/glue/init_vm.rs index a27ea7e84b32..4ebad4c6ca33 100644 --- a/core/lib/multivm/src/glue/init_vm.rs +++ b/core/lib/multivm/src/glue/init_vm.rs @@ -1,8 +1,8 @@ use super::GlueInto; use crate::glue::history_mode::HistoryMode; use crate::vm_instance::VmInstanceVersion; +use crate::vm_latest::{L1BatchEnv, SystemEnv}; use crate::VmInstance; -use vm_latest::{L1BatchEnv, SystemEnv}; use zksync_state::{ReadStorage, StoragePtr, StorageView}; use zksync_types::VmVersion; use zksync_utils::h256_to_u256; @@ -26,16 +26,18 @@ impl VmInstance { ) -> Self { match vm_version { VmVersion::M5WithoutRefunds => { - let oracle_tools = - vm_m5::OracleTools::new(storage_view.clone(), vm_m5::vm::MultiVMSubversion::V1); - let block_properties = vm_m5::zk_evm::block_properties::BlockProperties { + let oracle_tools = crate::vm_m5::OracleTools::new( + storage_view.clone(), + crate::vm_m5::vm::MultiVMSubversion::V1, + ); + let block_properties = zk_evm_1_3_1::block_properties::BlockProperties { default_aa_code_hash: h256_to_u256( system_env.base_system_smart_contracts.default_aa.hash, ), zkporter_is_available: false, }; - let inner_vm = vm_m5::vm_with_bootloader::init_vm_with_gas_limit( - vm_m5::vm::MultiVMSubversion::V1, + let inner_vm = crate::vm_m5::vm_with_bootloader::init_vm_with_gas_limit( + crate::vm_m5::vm::MultiVMSubversion::V1, oracle_tools, l1_batch_env.glue_into(), block_properties, @@ -50,16 +52,18 @@ impl VmInstance { } } VmVersion::M5WithRefunds => { - let oracle_tools = - vm_m5::OracleTools::new(storage_view.clone(), vm_m5::vm::MultiVMSubversion::V2); - let block_properties = vm_m5::zk_evm::block_properties::BlockProperties { + let oracle_tools = crate::vm_m5::OracleTools::new( + storage_view.clone(), + crate::vm_m5::vm::MultiVMSubversion::V2, + ); + let block_properties = zk_evm_1_3_1::block_properties::BlockProperties { default_aa_code_hash: h256_to_u256( system_env.base_system_smart_contracts.default_aa.hash, ), zkporter_is_available: false, }; - let inner_vm = vm_m5::vm_with_bootloader::init_vm_with_gas_limit( - vm_m5::vm::MultiVMSubversion::V2, + let inner_vm = crate::vm_m5::vm_with_bootloader::init_vm_with_gas_limit( + crate::vm_m5::vm::MultiVMSubversion::V2, oracle_tools, l1_batch_env.glue_into(), block_properties, @@ -75,16 +79,16 @@ impl VmInstance { } VmVersion::M6Initial => { let oracle_tools = - vm_m6::OracleTools::new(storage_view.clone(), H::VmM6Mode::default()); - let block_properties = vm_m6::zk_evm::block_properties::BlockProperties { + crate::vm_m6::OracleTools::new(storage_view.clone(), H::VmM6Mode::default()); + let block_properties = zk_evm_1_3_1::block_properties::BlockProperties { default_aa_code_hash: h256_to_u256( system_env.base_system_smart_contracts.default_aa.hash, ), zkporter_is_available: false, }; - let inner_vm = vm_m6::vm_with_bootloader::init_vm_with_gas_limit( - vm_m6::vm::MultiVMSubversion::V1, + let inner_vm = crate::vm_m6::vm_with_bootloader::init_vm_with_gas_limit( + crate::vm_m6::vm::MultiVMSubversion::V1, oracle_tools, l1_batch_env.glue_into(), block_properties, @@ -100,16 +104,16 @@ impl VmInstance { } VmVersion::M6BugWithCompressionFixed => { let oracle_tools = - vm_m6::OracleTools::new(storage_view.clone(), H::VmM6Mode::default()); - let block_properties = vm_m6::zk_evm::block_properties::BlockProperties { + crate::vm_m6::OracleTools::new(storage_view.clone(), H::VmM6Mode::default()); + let block_properties = zk_evm_1_3_1::block_properties::BlockProperties { default_aa_code_hash: h256_to_u256( system_env.base_system_smart_contracts.default_aa.hash, ), zkporter_is_available: false, }; - let inner_vm = vm_m6::vm_with_bootloader::init_vm_with_gas_limit( - vm_m6::vm::MultiVMSubversion::V2, + let inner_vm = crate::vm_m6::vm_with_bootloader::init_vm_with_gas_limit( + crate::vm_m6::vm::MultiVMSubversion::V2, oracle_tools, l1_batch_env.glue_into(), block_properties, @@ -124,14 +128,14 @@ impl VmInstance { } } VmVersion::Vm1_3_2 => { - let oracle_tools = vm_1_3_2::OracleTools::new(storage_view.clone()); - let block_properties = vm_1_3_2::BlockProperties { + let oracle_tools = crate::vm_1_3_2::OracleTools::new(storage_view.clone()); + let block_properties = crate::vm_1_3_2::BlockProperties { default_aa_code_hash: h256_to_u256( system_env.base_system_smart_contracts.default_aa.hash, ), zkporter_is_available: false, }; - let inner_vm = vm_1_3_2::vm_with_bootloader::init_vm_with_gas_limit( + let inner_vm = crate::vm_1_3_2::vm_with_bootloader::init_vm_with_gas_limit( oracle_tools, l1_batch_env.glue_into(), block_properties, @@ -146,7 +150,7 @@ impl VmInstance { } } VmVersion::VmVirtualBlocks => { - let vm = vm_virtual_blocks::Vm::new( + let vm = crate::vm_virtual_blocks::Vm::new( l1_batch_env.glue_into(), system_env.clone().glue_into(), storage_view.clone(), @@ -160,7 +164,7 @@ impl VmInstance { } } VmVersion::VmVirtualBlocksRefundsEnhancement => { - let vm = vm_latest::Vm::new( + let vm = crate::vm_latest::Vm::new( l1_batch_env.glue_into(), system_env.clone(), storage_view.clone(), diff --git a/core/lib/multivm/src/glue/oracle_tools.rs b/core/lib/multivm/src/glue/oracle_tools.rs index 1cd46d17692a..368beb909b8c 100644 --- a/core/lib/multivm/src/glue/oracle_tools.rs +++ b/core/lib/multivm/src/glue/oracle_tools.rs @@ -5,8 +5,8 @@ use zksync_types::VmVersion; #[allow(clippy::large_enum_variant)] #[derive(Debug)] pub enum OracleTools { - M5(vm_m5::OracleTools>), - M6(vm_m6::OracleTools, H::VmM6Mode>), + M5(crate::vm_m5::OracleTools>), + M6(crate::vm_m6::OracleTools, H::VmM6Mode>), } impl OracleTools @@ -16,15 +16,17 @@ where pub fn new(version: VmVersion, state: StoragePtr>, history: H) -> Self { match version { VmVersion::M5WithoutRefunds => { - let oracle_tools = vm_m5::OracleTools::new(state, vm_m5::vm::MultiVMSubversion::V1); + let oracle_tools = + crate::vm_m5::OracleTools::new(state, crate::vm_m5::vm::MultiVMSubversion::V1); OracleTools::M5(oracle_tools) } VmVersion::M5WithRefunds => { - let oracle_tools = vm_m5::OracleTools::new(state, vm_m5::vm::MultiVMSubversion::V2); + let oracle_tools = + crate::vm_m5::OracleTools::new(state, crate::vm_m5::vm::MultiVMSubversion::V2); OracleTools::M5(oracle_tools) } VmVersion::M6Initial | VmVersion::M6BugWithCompressionFixed => { - let oracle_tools = vm_m6::OracleTools::new(state, history.glue_into()); + let oracle_tools = crate::vm_m6::OracleTools::new(state, history.glue_into()); OracleTools::M6(oracle_tools) } VmVersion::VmVirtualBlocks @@ -35,14 +37,14 @@ where } } - pub fn m6(&mut self) -> &mut vm_m6::OracleTools, H::VmM6Mode> { + pub fn m6(&mut self) -> &mut crate::vm_m6::OracleTools, H::VmM6Mode> { let OracleTools::M6(oracle_tools) = self else { panic!("OracleTools::m6() called on non-m6 version") }; oracle_tools } - pub fn m5(&mut self) -> &mut vm_m5::OracleTools> { + pub fn m5(&mut self) -> &mut crate::vm_m5::OracleTools> { let OracleTools::M5(oracle_tools) = self else { panic!("OracleTools::m5() called on non-m5 version") }; diff --git a/core/lib/multivm/src/glue/tracer.rs b/core/lib/multivm/src/glue/tracer.rs index 78d991b29a47..158a0689d10f 100644 --- a/core/lib/multivm/src/glue/tracer.rs +++ b/core/lib/multivm/src/glue/tracer.rs @@ -53,20 +53,26 @@ pub trait MultivmTracer: } pub trait IntoLatestTracer { - fn latest(&self) -> Box>; + fn latest( + &self, + ) -> Box>; } pub trait IntoVmVirtualBlocksTracer { - fn vm_virtual_blocks(&self) -> Box>; + fn vm_virtual_blocks( + &self, + ) -> Box>; } impl IntoLatestTracer for T where S: WriteStorage, H: HistoryMode, - T: vm_latest::VmTracer + Clone + 'static, + T: crate::vm_latest::VmTracer + Clone + 'static, { - fn latest(&self) -> Box> { + fn latest( + &self, + ) -> Box> { Box::new(self.clone()) } } @@ -75,7 +81,7 @@ impl MultivmTracer for T where S: WriteStorage, H: HistoryMode, - T: vm_latest::VmTracer + T: crate::vm_latest::VmTracer + IntoLatestTracer + IntoVmVirtualBlocksTracer + Clone diff --git a/core/lib/multivm/src/glue/tracer/implementations.rs b/core/lib/multivm/src/glue/tracer/implementations.rs index d8f7056728bc..bf6f99b65324 100644 --- a/core/lib/multivm/src/glue/tracer/implementations.rs +++ b/core/lib/multivm/src/glue/tracer/implementations.rs @@ -1,5 +1,5 @@ use crate::glue::tracer::IntoVmVirtualBlocksTracer; -use vm_latest::{CallTracer, StorageInvocations, ValidationTracer}; +use crate::vm_latest::{CallTracer, StorageInvocations, ValidationTracer}; use zksync_state::WriteStorage; impl IntoVmVirtualBlocksTracer for StorageInvocations @@ -7,8 +7,12 @@ where H: crate::HistoryMode, S: WriteStorage, { - fn vm_virtual_blocks(&self) -> Box> { - Box::new(vm_virtual_blocks::StorageInvocations::new(self.limit)) + fn vm_virtual_blocks( + &self, + ) -> Box> { + Box::new(crate::vm_virtual_blocks::StorageInvocations::new( + self.limit, + )) } } @@ -17,8 +21,10 @@ where H: crate::HistoryMode + 'static, S: WriteStorage, { - fn vm_virtual_blocks(&self) -> Box> { - Box::new(vm_virtual_blocks::CallTracer::new( + fn vm_virtual_blocks( + &self, + ) -> Box> { + Box::new(crate::vm_virtual_blocks::CallTracer::new( self.result.clone(), H::VmVirtualBlocksMode::default(), )) @@ -31,10 +37,12 @@ where H: crate::HistoryMode + 'static, S: WriteStorage, { - fn vm_virtual_blocks(&self) -> Box> { + fn vm_virtual_blocks( + &self, + ) -> Box> { let params = self.params(); - Box::new(vm_virtual_blocks::ValidationTracer::new( - vm_virtual_blocks::ValidationTracerParams { + Box::new(crate::vm_virtual_blocks::ValidationTracer::new( + crate::vm_virtual_blocks::ValidationTracerParams { user_address: params.user_address, paymaster_address: params.paymaster_address, trusted_slots: params.trusted_slots, diff --git a/core/lib/multivm/src/glue/types/vm/block_context_mode.rs b/core/lib/multivm/src/glue/types/vm/block_context_mode.rs index 739b4886478b..9cfe6d297af3 100644 --- a/core/lib/multivm/src/glue/types/vm/block_context_mode.rs +++ b/core/lib/multivm/src/glue/types/vm/block_context_mode.rs @@ -1,10 +1,10 @@ use crate::glue::GlueFrom; use zksync_utils::h256_to_u256; -impl GlueFrom for vm_m5::vm_with_bootloader::BlockContextMode { - fn glue_from(value: vm_latest::L1BatchEnv) -> Self { - let derived = vm_m5::vm_with_bootloader::DerivedBlockContext { - context: vm_m5::vm_with_bootloader::BlockContext { +impl GlueFrom for crate::vm_m5::vm_with_bootloader::BlockContextMode { + fn glue_from(value: crate::vm_latest::L1BatchEnv) -> Self { + let derived = crate::vm_m5::vm_with_bootloader::DerivedBlockContext { + context: crate::vm_m5::vm_with_bootloader::BlockContext { block_number: value.number.0, block_timestamp: value.timestamp, operator_address: value.fee_account, @@ -20,10 +20,10 @@ impl GlueFrom for vm_m5::vm_with_bootloader::BlockContext } } -impl GlueFrom for vm_m6::vm_with_bootloader::BlockContextMode { - fn glue_from(value: vm_latest::L1BatchEnv) -> Self { - let derived = vm_m6::vm_with_bootloader::DerivedBlockContext { - context: vm_m6::vm_with_bootloader::BlockContext { +impl GlueFrom for crate::vm_m6::vm_with_bootloader::BlockContextMode { + fn glue_from(value: crate::vm_latest::L1BatchEnv) -> Self { + let derived = crate::vm_m6::vm_with_bootloader::DerivedBlockContext { + context: crate::vm_m6::vm_with_bootloader::BlockContext { block_number: value.number.0, block_timestamp: value.timestamp, operator_address: value.fee_account, @@ -39,10 +39,12 @@ impl GlueFrom for vm_m6::vm_with_bootloader::BlockContext } } -impl GlueFrom for vm_1_3_2::vm_with_bootloader::BlockContextMode { - fn glue_from(value: vm_latest::L1BatchEnv) -> Self { - let derived = vm_1_3_2::vm_with_bootloader::DerivedBlockContext { - context: vm_1_3_2::vm_with_bootloader::BlockContext { +impl GlueFrom + for crate::vm_1_3_2::vm_with_bootloader::BlockContextMode +{ + fn glue_from(value: crate::vm_latest::L1BatchEnv) -> Self { + let derived = crate::vm_1_3_2::vm_with_bootloader::DerivedBlockContext { + context: crate::vm_1_3_2::vm_with_bootloader::BlockContext { block_number: value.number.0, block_timestamp: value.timestamp, operator_address: value.fee_account, diff --git a/core/lib/multivm/src/glue/types/vm/bytecompression_result.rs b/core/lib/multivm/src/glue/types/vm/bytecompression_result.rs index 53e65a36cdf5..4f016fa93618 100644 --- a/core/lib/multivm/src/glue/types/vm/bytecompression_result.rs +++ b/core/lib/multivm/src/glue/types/vm/bytecompression_result.rs @@ -1,10 +1,10 @@ use crate::glue::{GlueFrom, GlueInto}; -use vm_latest::{BytecodeCompressionError, VmExecutionResultAndLogs}; +use crate::vm_latest::{BytecodeCompressionError, VmExecutionResultAndLogs}; -impl GlueFrom for BytecodeCompressionError { - fn glue_from(value: vm_virtual_blocks::BytecodeCompressionError) -> Self { +impl GlueFrom for BytecodeCompressionError { + fn glue_from(value: crate::vm_virtual_blocks::BytecodeCompressionError) -> Self { match value { - vm_virtual_blocks::BytecodeCompressionError::BytecodeCompressionFailed => { + crate::vm_virtual_blocks::BytecodeCompressionError::BytecodeCompressionFailed => { Self::BytecodeCompressionFailed } } @@ -14,15 +14,15 @@ impl GlueFrom for BytecodeCompressi impl GlueFrom< Result< - vm_virtual_blocks::VmExecutionResultAndLogs, - vm_virtual_blocks::BytecodeCompressionError, + crate::vm_virtual_blocks::VmExecutionResultAndLogs, + crate::vm_virtual_blocks::BytecodeCompressionError, >, > for Result { fn glue_from( value: Result< - vm_virtual_blocks::VmExecutionResultAndLogs, - vm_virtual_blocks::BytecodeCompressionError, + crate::vm_virtual_blocks::VmExecutionResultAndLogs, + crate::vm_virtual_blocks::BytecodeCompressionError, >, ) -> Self { match value { diff --git a/core/lib/multivm/src/glue/types/vm/current_execution_state.rs b/core/lib/multivm/src/glue/types/vm/current_execution_state.rs index 41e77344da25..db114f13daff 100644 --- a/core/lib/multivm/src/glue/types/vm/current_execution_state.rs +++ b/core/lib/multivm/src/glue/types/vm/current_execution_state.rs @@ -1,8 +1,8 @@ use crate::glue::GlueFrom; -use vm_latest::CurrentExecutionState; +use crate::vm_latest::CurrentExecutionState; -impl GlueFrom for CurrentExecutionState { - fn glue_from(value: vm_virtual_blocks::CurrentExecutionState) -> Self { +impl GlueFrom for CurrentExecutionState { + fn glue_from(value: crate::vm_virtual_blocks::CurrentExecutionState) -> Self { Self { events: value.events, storage_log_queries: value.storage_log_queries, diff --git a/core/lib/multivm/src/glue/types/vm/execution_result.rs b/core/lib/multivm/src/glue/types/vm/execution_result.rs index 7dd4b361ffc9..5abf84a133bb 100644 --- a/core/lib/multivm/src/glue/types/vm/execution_result.rs +++ b/core/lib/multivm/src/glue/types/vm/execution_result.rs @@ -1,16 +1,18 @@ use crate::glue::{GlueFrom, GlueInto}; -use vm_latest::ExecutionResult; +use crate::vm_latest::ExecutionResult; -impl GlueFrom for ExecutionResult { - fn glue_from(value: vm_virtual_blocks::ExecutionResult) -> Self { +impl GlueFrom for ExecutionResult { + fn glue_from(value: crate::vm_virtual_blocks::ExecutionResult) -> Self { match value { - vm_virtual_blocks::ExecutionResult::Success { output } => { + crate::vm_virtual_blocks::ExecutionResult::Success { output } => { ExecutionResult::Success { output } } - vm_virtual_blocks::ExecutionResult::Revert { output } => ExecutionResult::Revert { - output: output.glue_into(), - }, - vm_virtual_blocks::ExecutionResult::Halt { reason } => ExecutionResult::Halt { + crate::vm_virtual_blocks::ExecutionResult::Revert { output } => { + ExecutionResult::Revert { + output: output.glue_into(), + } + } + crate::vm_virtual_blocks::ExecutionResult::Halt { reason } => ExecutionResult::Halt { reason: reason.glue_into(), }, } diff --git a/core/lib/multivm/src/glue/types/vm/halt.rs b/core/lib/multivm/src/glue/types/vm/halt.rs index d08f143f80e8..16ab58b043ca 100644 --- a/core/lib/multivm/src/glue/types/vm/halt.rs +++ b/core/lib/multivm/src/glue/types/vm/halt.rs @@ -1,44 +1,46 @@ use crate::glue::{GlueFrom, GlueInto}; -use vm_latest::Halt; +use crate::vm_latest::Halt; -impl GlueFrom for Halt { - fn glue_from(value: vm_virtual_blocks::Halt) -> Self { +impl GlueFrom for Halt { + fn glue_from(value: crate::vm_virtual_blocks::Halt) -> Self { match value { - vm_virtual_blocks::Halt::ValidationFailed(reason) => { + crate::vm_virtual_blocks::Halt::ValidationFailed(reason) => { Self::ValidationFailed(reason.glue_into()) } - vm_virtual_blocks::Halt::PaymasterValidationFailed(reason) => { + crate::vm_virtual_blocks::Halt::PaymasterValidationFailed(reason) => { Self::PaymasterValidationFailed(reason.glue_into()) } - vm_virtual_blocks::Halt::PrePaymasterPreparationFailed(reason) => { + crate::vm_virtual_blocks::Halt::PrePaymasterPreparationFailed(reason) => { Self::PrePaymasterPreparationFailed(reason.glue_into()) } - vm_virtual_blocks::Halt::PayForTxFailed(reason) => { + crate::vm_virtual_blocks::Halt::PayForTxFailed(reason) => { Self::PayForTxFailed(reason.glue_into()) } - vm_virtual_blocks::Halt::FailedToMarkFactoryDependencies(reason) => { + crate::vm_virtual_blocks::Halt::FailedToMarkFactoryDependencies(reason) => { Self::FailedToMarkFactoryDependencies(reason.glue_into()) } - vm_virtual_blocks::Halt::FailedToChargeFee(reason) => { + crate::vm_virtual_blocks::Halt::FailedToChargeFee(reason) => { Self::FailedToChargeFee(reason.glue_into()) } - vm_virtual_blocks::Halt::FromIsNotAnAccount => Self::FromIsNotAnAccount, - vm_virtual_blocks::Halt::InnerTxError => Self::InnerTxError, - vm_virtual_blocks::Halt::Unknown(reason) => Self::Unknown(reason.glue_into()), - vm_virtual_blocks::Halt::UnexpectedVMBehavior(reason) => { + crate::vm_virtual_blocks::Halt::FromIsNotAnAccount => Self::FromIsNotAnAccount, + crate::vm_virtual_blocks::Halt::InnerTxError => Self::InnerTxError, + crate::vm_virtual_blocks::Halt::Unknown(reason) => Self::Unknown(reason.glue_into()), + crate::vm_virtual_blocks::Halt::UnexpectedVMBehavior(reason) => { Self::UnexpectedVMBehavior(reason) } - vm_virtual_blocks::Halt::BootloaderOutOfGas => Self::BootloaderOutOfGas, - vm_virtual_blocks::Halt::TooBigGasLimit => Self::TooBigGasLimit, - vm_virtual_blocks::Halt::NotEnoughGasProvided => Self::NotEnoughGasProvided, - vm_virtual_blocks::Halt::MissingInvocationLimitReached => { + crate::vm_virtual_blocks::Halt::BootloaderOutOfGas => Self::BootloaderOutOfGas, + crate::vm_virtual_blocks::Halt::TooBigGasLimit => Self::TooBigGasLimit, + crate::vm_virtual_blocks::Halt::NotEnoughGasProvided => Self::NotEnoughGasProvided, + crate::vm_virtual_blocks::Halt::MissingInvocationLimitReached => { Self::MissingInvocationLimitReached } - vm_virtual_blocks::Halt::FailedToSetL2Block(reason) => Self::FailedToSetL2Block(reason), - vm_virtual_blocks::Halt::FailedToAppendTransactionToL2Block(reason) => { + crate::vm_virtual_blocks::Halt::FailedToSetL2Block(reason) => { + Self::FailedToSetL2Block(reason) + } + crate::vm_virtual_blocks::Halt::FailedToAppendTransactionToL2Block(reason) => { Self::FailedToAppendTransactionToL2Block(reason) } - vm_virtual_blocks::Halt::VMPanic => Self::VMPanic, + crate::vm_virtual_blocks::Halt::VMPanic => Self::VMPanic, } } } diff --git a/core/lib/multivm/src/glue/types/vm/l1_batch.rs b/core/lib/multivm/src/glue/types/vm/l1_batch.rs index 7d1cd7584989..5e37f88335fd 100644 --- a/core/lib/multivm/src/glue/types/vm/l1_batch.rs +++ b/core/lib/multivm/src/glue/types/vm/l1_batch.rs @@ -1,7 +1,7 @@ use crate::glue::{GlueFrom, GlueInto}; -impl GlueFrom for vm_virtual_blocks::L1BatchEnv { - fn glue_from(value: vm_latest::L1BatchEnv) -> Self { +impl GlueFrom for crate::vm_virtual_blocks::L1BatchEnv { + fn glue_from(value: crate::vm_latest::L1BatchEnv) -> Self { Self { previous_batch_hash: value.previous_batch_hash, number: value.number, diff --git a/core/lib/multivm/src/glue/types/vm/l2_block.rs b/core/lib/multivm/src/glue/types/vm/l2_block.rs index a12e5ec816b8..396ab6046280 100644 --- a/core/lib/multivm/src/glue/types/vm/l2_block.rs +++ b/core/lib/multivm/src/glue/types/vm/l2_block.rs @@ -1,7 +1,7 @@ use crate::glue::GlueFrom; -impl GlueFrom for vm_virtual_blocks::L2BlockEnv { - fn glue_from(value: vm_latest::L2BlockEnv) -> Self { +impl GlueFrom for crate::vm_virtual_blocks::L2BlockEnv { + fn glue_from(value: crate::vm_latest::L2BlockEnv) -> Self { Self { number: value.number, timestamp: value.timestamp, diff --git a/core/lib/multivm/src/glue/types/vm/refunds.rs b/core/lib/multivm/src/glue/types/vm/refunds.rs index 3127efbf6612..a061584f94cc 100644 --- a/core/lib/multivm/src/glue/types/vm/refunds.rs +++ b/core/lib/multivm/src/glue/types/vm/refunds.rs @@ -1,8 +1,8 @@ use crate::glue::GlueFrom; -use vm_latest::Refunds; +use crate::vm_latest::Refunds; -impl GlueFrom for Refunds { - fn glue_from(value: vm_virtual_blocks::Refunds) -> Self { +impl GlueFrom for Refunds { + fn glue_from(value: crate::vm_virtual_blocks::Refunds) -> Self { Self { gas_refunded: value.gas_refunded, operator_suggested_refund: value.operator_suggested_refund, diff --git a/core/lib/multivm/src/glue/types/vm/system_env.rs b/core/lib/multivm/src/glue/types/vm/system_env.rs index 0f3012287bfb..744ba652a6a0 100644 --- a/core/lib/multivm/src/glue/types/vm/system_env.rs +++ b/core/lib/multivm/src/glue/types/vm/system_env.rs @@ -1,7 +1,7 @@ use crate::glue::{GlueFrom, GlueInto}; -impl GlueFrom for vm_virtual_blocks::SystemEnv { - fn glue_from(value: vm_latest::SystemEnv) -> Self { +impl GlueFrom for crate::vm_virtual_blocks::SystemEnv { + fn glue_from(value: crate::vm_latest::SystemEnv) -> Self { Self { zk_porter_available: value.zk_porter_available, version: value.version, diff --git a/core/lib/multivm/src/glue/types/vm/tx_execution_mode.rs b/core/lib/multivm/src/glue/types/vm/tx_execution_mode.rs index 2f68ed5edc70..32ffb2f84215 100644 --- a/core/lib/multivm/src/glue/types/vm/tx_execution_mode.rs +++ b/core/lib/multivm/src/glue/types/vm/tx_execution_mode.rs @@ -1,25 +1,29 @@ use crate::glue::GlueFrom; -impl GlueFrom for vm_m5::vm_with_bootloader::TxExecutionMode { - fn glue_from(value: vm_latest::TxExecutionMode) -> Self { +impl GlueFrom + for crate::vm_m5::vm_with_bootloader::TxExecutionMode +{ + fn glue_from(value: crate::vm_latest::TxExecutionMode) -> Self { match value { - vm_latest::TxExecutionMode::VerifyExecute => Self::VerifyExecute, - vm_latest::TxExecutionMode::EstimateFee => Self::EstimateFee, - vm_latest::TxExecutionMode::EthCall => Self::EthCall, + crate::vm_latest::TxExecutionMode::VerifyExecute => Self::VerifyExecute, + crate::vm_latest::TxExecutionMode::EstimateFee => Self::EstimateFee, + crate::vm_latest::TxExecutionMode::EthCall => Self::EthCall, } } } -impl GlueFrom for vm_m6::vm_with_bootloader::TxExecutionMode { - fn glue_from(value: vm_latest::TxExecutionMode) -> Self { +impl GlueFrom + for crate::vm_m6::vm_with_bootloader::TxExecutionMode +{ + fn glue_from(value: crate::vm_latest::TxExecutionMode) -> Self { match value { - vm_latest::TxExecutionMode::VerifyExecute => Self::VerifyExecute, - vm_latest::TxExecutionMode::EstimateFee => Self::EstimateFee { + crate::vm_latest::TxExecutionMode::VerifyExecute => Self::VerifyExecute, + crate::vm_latest::TxExecutionMode::EstimateFee => Self::EstimateFee { // We used it only for api services we don't have limit for storage invocation inside statekeeper // It's impossible to recover this value for the vm integration after virtual blocks missed_storage_invocation_limit: usize::MAX, }, - vm_latest::TxExecutionMode::EthCall => Self::EthCall { + crate::vm_latest::TxExecutionMode::EthCall => Self::EthCall { // We used it only for api services we don't have limit for storage invocation inside statekeeper // It's impossible to recover this value for the vm integration after virtual blocks missed_storage_invocation_limit: usize::MAX, @@ -28,16 +32,18 @@ impl GlueFrom for vm_m6::vm_with_bootloader::TxExecu } } -impl GlueFrom for vm_1_3_2::vm_with_bootloader::TxExecutionMode { - fn glue_from(value: vm_latest::TxExecutionMode) -> Self { +impl GlueFrom + for crate::vm_1_3_2::vm_with_bootloader::TxExecutionMode +{ + fn glue_from(value: crate::vm_latest::TxExecutionMode) -> Self { match value { - vm_latest::TxExecutionMode::VerifyExecute => Self::VerifyExecute, - vm_latest::TxExecutionMode::EstimateFee => Self::EstimateFee { + crate::vm_latest::TxExecutionMode::VerifyExecute => Self::VerifyExecute, + crate::vm_latest::TxExecutionMode::EstimateFee => Self::EstimateFee { // We used it only for api services we don't have limit for storage invocation inside statekeeper // It's impossible to recover this value for the vm integration after virtual blocks missed_storage_invocation_limit: usize::MAX, }, - vm_latest::TxExecutionMode::EthCall => Self::EthCall { + crate::vm_latest::TxExecutionMode::EthCall => Self::EthCall { // We used it only for api services we don't have limit for storage invocation inside statekeeper // It's impossible to recover this value for the vm integration after virtual blocks missed_storage_invocation_limit: usize::MAX, @@ -46,12 +52,12 @@ impl GlueFrom for vm_1_3_2::vm_with_bootloader::TxEx } } -impl GlueFrom for vm_virtual_blocks::TxExecutionMode { - fn glue_from(value: vm_latest::TxExecutionMode) -> Self { +impl GlueFrom for crate::vm_virtual_blocks::TxExecutionMode { + fn glue_from(value: crate::vm_latest::TxExecutionMode) -> Self { match value { - vm_latest::TxExecutionMode::VerifyExecute => Self::VerifyExecute, - vm_latest::TxExecutionMode::EstimateFee => Self::EstimateFee, - vm_latest::TxExecutionMode::EthCall => Self::EthCall, + crate::vm_latest::TxExecutionMode::VerifyExecute => Self::VerifyExecute, + crate::vm_latest::TxExecutionMode::EstimateFee => Self::EstimateFee, + crate::vm_latest::TxExecutionMode::EthCall => Self::EthCall, } } } diff --git a/core/lib/multivm/src/glue/types/vm/tx_revert_reason.rs b/core/lib/multivm/src/glue/types/vm/tx_revert_reason.rs index 854575ae2dc6..8f94fa53a697 100644 --- a/core/lib/multivm/src/glue/types/vm/tx_revert_reason.rs +++ b/core/lib/multivm/src/glue/types/vm/tx_revert_reason.rs @@ -1,138 +1,150 @@ use crate::glue::{GlueFrom, GlueInto}; -impl GlueFrom for vm_latest::TxRevertReason { - fn glue_from(value: vm_m5::TxRevertReason) -> Self { +impl GlueFrom for crate::vm_latest::TxRevertReason { + fn glue_from(value: crate::vm_m5::TxRevertReason) -> Self { match value { - vm_m5::TxRevertReason::EthCall(err) => Self::TxReverted(err.glue_into()), - vm_m5::TxRevertReason::TxReverted(err) => Self::TxReverted(err.glue_into()), - vm_m5::TxRevertReason::ValidationFailed(err) => { - Self::Halt(vm_latest::Halt::ValidationFailed(err.glue_into())) + crate::vm_m5::TxRevertReason::EthCall(err) => Self::TxReverted(err.glue_into()), + crate::vm_m5::TxRevertReason::TxReverted(err) => Self::TxReverted(err.glue_into()), + crate::vm_m5::TxRevertReason::ValidationFailed(err) => { + Self::Halt(crate::vm_latest::Halt::ValidationFailed(err.glue_into())) } - vm_m5::TxRevertReason::PaymasterValidationFailed(err) => { - Self::Halt(vm_latest::Halt::PaymasterValidationFailed(err.glue_into())) - } - vm_m5::TxRevertReason::PrePaymasterPreparationFailed(err) => Self::Halt( - vm_latest::Halt::PrePaymasterPreparationFailed(err.glue_into()), + crate::vm_m5::TxRevertReason::PaymasterValidationFailed(err) => Self::Halt( + crate::vm_latest::Halt::PaymasterValidationFailed(err.glue_into()), + ), + crate::vm_m5::TxRevertReason::PrePaymasterPreparationFailed(err) => Self::Halt( + crate::vm_latest::Halt::PrePaymasterPreparationFailed(err.glue_into()), ), - vm_m5::TxRevertReason::PayForTxFailed(err) => { - Self::Halt(vm_latest::Halt::PayForTxFailed(err.glue_into())) + crate::vm_m5::TxRevertReason::PayForTxFailed(err) => { + Self::Halt(crate::vm_latest::Halt::PayForTxFailed(err.glue_into())) } - vm_m5::TxRevertReason::FailedToMarkFactoryDependencies(err) => Self::Halt( - vm_latest::Halt::FailedToMarkFactoryDependencies(err.glue_into()), + crate::vm_m5::TxRevertReason::FailedToMarkFactoryDependencies(err) => Self::Halt( + crate::vm_latest::Halt::FailedToMarkFactoryDependencies(err.glue_into()), ), - vm_m5::TxRevertReason::FailedToChargeFee(err) => { - Self::Halt(vm_latest::Halt::FailedToChargeFee(err.glue_into())) + crate::vm_m5::TxRevertReason::FailedToChargeFee(err) => { + Self::Halt(crate::vm_latest::Halt::FailedToChargeFee(err.glue_into())) + } + crate::vm_m5::TxRevertReason::FromIsNotAnAccount => { + Self::Halt(crate::vm_latest::Halt::FromIsNotAnAccount) } - vm_m5::TxRevertReason::FromIsNotAnAccount => { - Self::Halt(vm_latest::Halt::FromIsNotAnAccount) + crate::vm_m5::TxRevertReason::InnerTxError => { + Self::Halt(crate::vm_latest::Halt::InnerTxError) } - vm_m5::TxRevertReason::InnerTxError => Self::Halt(vm_latest::Halt::InnerTxError), - vm_m5::TxRevertReason::Unknown(err) => { - Self::Halt(vm_latest::Halt::Unknown(err.glue_into())) + crate::vm_m5::TxRevertReason::Unknown(err) => { + Self::Halt(crate::vm_latest::Halt::Unknown(err.glue_into())) } - vm_m5::TxRevertReason::UnexpectedVMBehavior(err) => { - Self::Halt(vm_latest::Halt::UnexpectedVMBehavior(err)) + crate::vm_m5::TxRevertReason::UnexpectedVMBehavior(err) => { + Self::Halt(crate::vm_latest::Halt::UnexpectedVMBehavior(err)) } - vm_m5::TxRevertReason::BootloaderOutOfGas => { - Self::Halt(vm_latest::Halt::BootloaderOutOfGas) + crate::vm_m5::TxRevertReason::BootloaderOutOfGas => { + Self::Halt(crate::vm_latest::Halt::BootloaderOutOfGas) } - vm_m5::TxRevertReason::TooBigGasLimit => Self::Halt(vm_latest::Halt::TooBigGasLimit), - vm_m5::TxRevertReason::NotEnoughGasProvided => { - Self::Halt(vm_latest::Halt::NotEnoughGasProvided) + crate::vm_m5::TxRevertReason::TooBigGasLimit => { + Self::Halt(crate::vm_latest::Halt::TooBigGasLimit) + } + crate::vm_m5::TxRevertReason::NotEnoughGasProvided => { + Self::Halt(crate::vm_latest::Halt::NotEnoughGasProvided) } } } } -impl GlueFrom for vm_latest::TxRevertReason { - fn glue_from(value: vm_m6::TxRevertReason) -> Self { +impl GlueFrom for crate::vm_latest::TxRevertReason { + fn glue_from(value: crate::vm_m6::TxRevertReason) -> Self { match value { - vm_m6::TxRevertReason::EthCall(err) => Self::TxReverted(err.glue_into()), - vm_m6::TxRevertReason::TxReverted(err) => Self::TxReverted(err.glue_into()), - vm_m6::TxRevertReason::ValidationFailed(err) => { - Self::Halt(vm_latest::Halt::ValidationFailed(err.glue_into())) - } - vm_m6::TxRevertReason::PaymasterValidationFailed(err) => { - Self::Halt(vm_latest::Halt::PaymasterValidationFailed(err.glue_into())) + crate::vm_m6::TxRevertReason::EthCall(err) => Self::TxReverted(err.glue_into()), + crate::vm_m6::TxRevertReason::TxReverted(err) => Self::TxReverted(err.glue_into()), + crate::vm_m6::TxRevertReason::ValidationFailed(err) => { + Self::Halt(crate::vm_latest::Halt::ValidationFailed(err.glue_into())) } - vm_m6::TxRevertReason::PrePaymasterPreparationFailed(err) => Self::Halt( - vm_latest::Halt::PrePaymasterPreparationFailed(err.glue_into()), + crate::vm_m6::TxRevertReason::PaymasterValidationFailed(err) => Self::Halt( + crate::vm_latest::Halt::PaymasterValidationFailed(err.glue_into()), + ), + crate::vm_m6::TxRevertReason::PrePaymasterPreparationFailed(err) => Self::Halt( + crate::vm_latest::Halt::PrePaymasterPreparationFailed(err.glue_into()), ), - vm_m6::TxRevertReason::PayForTxFailed(err) => { - Self::Halt(vm_latest::Halt::PayForTxFailed(err.glue_into())) + crate::vm_m6::TxRevertReason::PayForTxFailed(err) => { + Self::Halt(crate::vm_latest::Halt::PayForTxFailed(err.glue_into())) } - vm_m6::TxRevertReason::FailedToMarkFactoryDependencies(err) => Self::Halt( - vm_latest::Halt::FailedToMarkFactoryDependencies(err.glue_into()), + crate::vm_m6::TxRevertReason::FailedToMarkFactoryDependencies(err) => Self::Halt( + crate::vm_latest::Halt::FailedToMarkFactoryDependencies(err.glue_into()), ), - vm_m6::TxRevertReason::FailedToChargeFee(err) => { - Self::Halt(vm_latest::Halt::FailedToChargeFee(err.glue_into())) + crate::vm_m6::TxRevertReason::FailedToChargeFee(err) => { + Self::Halt(crate::vm_latest::Halt::FailedToChargeFee(err.glue_into())) } - vm_m6::TxRevertReason::FromIsNotAnAccount => { - Self::Halt(vm_latest::Halt::FromIsNotAnAccount) + crate::vm_m6::TxRevertReason::FromIsNotAnAccount => { + Self::Halt(crate::vm_latest::Halt::FromIsNotAnAccount) } - vm_m6::TxRevertReason::InnerTxError => Self::Halt(vm_latest::Halt::InnerTxError), - vm_m6::TxRevertReason::Unknown(err) => { - Self::Halt(vm_latest::Halt::Unknown(err.glue_into())) + crate::vm_m6::TxRevertReason::InnerTxError => { + Self::Halt(crate::vm_latest::Halt::InnerTxError) } - vm_m6::TxRevertReason::UnexpectedVMBehavior(err) => { - Self::Halt(vm_latest::Halt::UnexpectedVMBehavior(err)) + crate::vm_m6::TxRevertReason::Unknown(err) => { + Self::Halt(crate::vm_latest::Halt::Unknown(err.glue_into())) } - vm_m6::TxRevertReason::BootloaderOutOfGas => { - Self::Halt(vm_latest::Halt::BootloaderOutOfGas) + crate::vm_m6::TxRevertReason::UnexpectedVMBehavior(err) => { + Self::Halt(crate::vm_latest::Halt::UnexpectedVMBehavior(err)) } - vm_m6::TxRevertReason::TooBigGasLimit => Self::Halt(vm_latest::Halt::TooBigGasLimit), - vm_m6::TxRevertReason::NotEnoughGasProvided => { - Self::Halt(vm_latest::Halt::NotEnoughGasProvided) + crate::vm_m6::TxRevertReason::BootloaderOutOfGas => { + Self::Halt(crate::vm_latest::Halt::BootloaderOutOfGas) } - vm_m6::TxRevertReason::MissingInvocationLimitReached => { - Self::Halt(vm_latest::Halt::MissingInvocationLimitReached) + crate::vm_m6::TxRevertReason::TooBigGasLimit => { + Self::Halt(crate::vm_latest::Halt::TooBigGasLimit) + } + crate::vm_m6::TxRevertReason::NotEnoughGasProvided => { + Self::Halt(crate::vm_latest::Halt::NotEnoughGasProvided) + } + crate::vm_m6::TxRevertReason::MissingInvocationLimitReached => { + Self::Halt(crate::vm_latest::Halt::MissingInvocationLimitReached) } } } } -impl GlueFrom for vm_latest::TxRevertReason { - fn glue_from(value: vm_1_3_2::TxRevertReason) -> Self { +impl GlueFrom for crate::vm_latest::TxRevertReason { + fn glue_from(value: crate::vm_1_3_2::TxRevertReason) -> Self { match value { - vm_1_3_2::TxRevertReason::EthCall(err) => Self::TxReverted(err.glue_into()), - vm_1_3_2::TxRevertReason::TxReverted(err) => Self::TxReverted(err.glue_into()), - vm_1_3_2::TxRevertReason::ValidationFailed(err) => { - Self::Halt(vm_latest::Halt::ValidationFailed(err.glue_into())) - } - vm_1_3_2::TxRevertReason::PaymasterValidationFailed(err) => { - Self::Halt(vm_latest::Halt::PaymasterValidationFailed(err.glue_into())) + crate::vm_1_3_2::TxRevertReason::EthCall(err) => Self::TxReverted(err.glue_into()), + crate::vm_1_3_2::TxRevertReason::TxReverted(err) => Self::TxReverted(err.glue_into()), + crate::vm_1_3_2::TxRevertReason::ValidationFailed(err) => { + Self::Halt(crate::vm_latest::Halt::ValidationFailed(err.glue_into())) } - vm_1_3_2::TxRevertReason::PrePaymasterPreparationFailed(err) => Self::Halt( - vm_latest::Halt::PrePaymasterPreparationFailed(err.glue_into()), + crate::vm_1_3_2::TxRevertReason::PaymasterValidationFailed(err) => Self::Halt( + crate::vm_latest::Halt::PaymasterValidationFailed(err.glue_into()), ), - vm_1_3_2::TxRevertReason::PayForTxFailed(err) => { - Self::Halt(vm_latest::Halt::PayForTxFailed(err.glue_into())) + crate::vm_1_3_2::TxRevertReason::PrePaymasterPreparationFailed(err) => Self::Halt( + crate::vm_latest::Halt::PrePaymasterPreparationFailed(err.glue_into()), + ), + crate::vm_1_3_2::TxRevertReason::PayForTxFailed(err) => { + Self::Halt(crate::vm_latest::Halt::PayForTxFailed(err.glue_into())) } - vm_1_3_2::TxRevertReason::FailedToMarkFactoryDependencies(err) => Self::Halt( - vm_latest::Halt::FailedToMarkFactoryDependencies(err.glue_into()), + crate::vm_1_3_2::TxRevertReason::FailedToMarkFactoryDependencies(err) => Self::Halt( + crate::vm_latest::Halt::FailedToMarkFactoryDependencies(err.glue_into()), ), - vm_1_3_2::TxRevertReason::FailedToChargeFee(err) => { - Self::Halt(vm_latest::Halt::FailedToChargeFee(err.glue_into())) + crate::vm_1_3_2::TxRevertReason::FailedToChargeFee(err) => { + Self::Halt(crate::vm_latest::Halt::FailedToChargeFee(err.glue_into())) + } + crate::vm_1_3_2::TxRevertReason::FromIsNotAnAccount => { + Self::Halt(crate::vm_latest::Halt::FromIsNotAnAccount) + } + crate::vm_1_3_2::TxRevertReason::InnerTxError => { + Self::Halt(crate::vm_latest::Halt::InnerTxError) } - vm_1_3_2::TxRevertReason::FromIsNotAnAccount => { - Self::Halt(vm_latest::Halt::FromIsNotAnAccount) + crate::vm_1_3_2::TxRevertReason::Unknown(err) => { + Self::Halt(crate::vm_latest::Halt::Unknown(err.glue_into())) } - vm_1_3_2::TxRevertReason::InnerTxError => Self::Halt(vm_latest::Halt::InnerTxError), - vm_1_3_2::TxRevertReason::Unknown(err) => { - Self::Halt(vm_latest::Halt::Unknown(err.glue_into())) + crate::vm_1_3_2::TxRevertReason::UnexpectedVMBehavior(err) => { + Self::Halt(crate::vm_latest::Halt::UnexpectedVMBehavior(err)) } - vm_1_3_2::TxRevertReason::UnexpectedVMBehavior(err) => { - Self::Halt(vm_latest::Halt::UnexpectedVMBehavior(err)) + crate::vm_1_3_2::TxRevertReason::BootloaderOutOfGas => { + Self::Halt(crate::vm_latest::Halt::BootloaderOutOfGas) } - vm_1_3_2::TxRevertReason::BootloaderOutOfGas => { - Self::Halt(vm_latest::Halt::BootloaderOutOfGas) + crate::vm_1_3_2::TxRevertReason::TooBigGasLimit => { + Self::Halt(crate::vm_latest::Halt::TooBigGasLimit) } - vm_1_3_2::TxRevertReason::TooBigGasLimit => Self::Halt(vm_latest::Halt::TooBigGasLimit), - vm_1_3_2::TxRevertReason::NotEnoughGasProvided => { - Self::Halt(vm_latest::Halt::NotEnoughGasProvided) + crate::vm_1_3_2::TxRevertReason::NotEnoughGasProvided => { + Self::Halt(crate::vm_latest::Halt::NotEnoughGasProvided) } - vm_1_3_2::TxRevertReason::MissingInvocationLimitReached => { - Self::Halt(vm_latest::Halt::MissingInvocationLimitReached) + crate::vm_1_3_2::TxRevertReason::MissingInvocationLimitReached => { + Self::Halt(crate::vm_latest::Halt::MissingInvocationLimitReached) } } } diff --git a/core/lib/multivm/src/glue/types/vm/validation_error.rs b/core/lib/multivm/src/glue/types/vm/validation_error.rs index 7c06ac8e0c6f..79c6c9695383 100644 --- a/core/lib/multivm/src/glue/types/vm/validation_error.rs +++ b/core/lib/multivm/src/glue/types/vm/validation_error.rs @@ -1,21 +1,21 @@ use crate::glue::{GlueFrom, GlueInto}; -impl GlueFrom - for vm_latest::oracles::tracer::ValidationError +impl GlueFrom + for crate::vm_latest::oracles::tracer::ValidationError { - fn glue_from(value: vm_m5::oracles::tracer::ValidationError) -> Self { + fn glue_from(value: crate::vm_m5::oracles::tracer::ValidationError) -> Self { match value { - vm_m5::oracles::tracer::ValidationError::FailedTx(value) => { + crate::vm_m5::oracles::tracer::ValidationError::FailedTx(value) => { Self::FailedTx(value.glue_into()) } - vm_m5::oracles::tracer::ValidationError::VioalatedRule(value) => { + crate::vm_m5::oracles::tracer::ValidationError::VioalatedRule(value) => { let rule = match value { - vm_m5::oracles::tracer::ViolatedValidationRule::TouchedUnallowedStorageSlots(a, b) => - vm_latest::oracles::tracer::ViolatedValidationRule::TouchedUnallowedStorageSlots(a, b), - vm_m5::oracles::tracer::ViolatedValidationRule::CalledContractWithNoCode(a) => - vm_latest::oracles::tracer::ViolatedValidationRule::CalledContractWithNoCode(a), - vm_m5::oracles::tracer::ViolatedValidationRule::TouchedUnallowedContext => - vm_latest::oracles::tracer::ViolatedValidationRule::TouchedUnallowedContext, + crate::vm_m5::oracles::tracer::ViolatedValidationRule::TouchedUnallowedStorageSlots(a, b) => + crate::vm_latest::oracles::tracer::ViolatedValidationRule::TouchedUnallowedStorageSlots(a, b), + crate::vm_m5::oracles::tracer::ViolatedValidationRule::CalledContractWithNoCode(a) => + crate::vm_latest::oracles::tracer::ViolatedValidationRule::CalledContractWithNoCode(a), + crate::vm_m5::oracles::tracer::ViolatedValidationRule::TouchedUnallowedContext => + crate::vm_latest::oracles::tracer::ViolatedValidationRule::TouchedUnallowedContext, }; Self::ViolatedRule(rule) } @@ -23,24 +23,24 @@ impl GlueFrom } } -impl GlueFrom - for vm_latest::oracles::tracer::ValidationError +impl GlueFrom + for crate::vm_latest::oracles::tracer::ValidationError { - fn glue_from(value: vm_m6::oracles::tracer::ValidationError) -> Self { + fn glue_from(value: crate::vm_m6::oracles::tracer::ValidationError) -> Self { match value { - vm_m6::oracles::tracer::ValidationError::FailedTx(value) => { + crate::vm_m6::oracles::tracer::ValidationError::FailedTx(value) => { Self::FailedTx(value.glue_into()) } - vm_m6::oracles::tracer::ValidationError::VioalatedRule(value) => { + crate::vm_m6::oracles::tracer::ValidationError::VioalatedRule(value) => { let rule = match value { - vm_m6::oracles::tracer::ViolatedValidationRule::TouchedUnallowedStorageSlots(a, b) => - vm_latest::oracles::tracer::ViolatedValidationRule::TouchedUnallowedStorageSlots(a, b), - vm_m6::oracles::tracer::ViolatedValidationRule::CalledContractWithNoCode(a) => - vm_latest::oracles::tracer::ViolatedValidationRule::CalledContractWithNoCode(a), - vm_m6::oracles::tracer::ViolatedValidationRule::TouchedUnallowedContext => - vm_latest::oracles::tracer::ViolatedValidationRule::TouchedUnallowedContext, - vm_m6::oracles::tracer::ViolatedValidationRule::TookTooManyComputationalGas(a) => - vm_latest::oracles::tracer::ViolatedValidationRule::TookTooManyComputationalGas(a), + crate::vm_m6::oracles::tracer::ViolatedValidationRule::TouchedUnallowedStorageSlots(a, b) => + crate::vm_latest::oracles::tracer::ViolatedValidationRule::TouchedUnallowedStorageSlots(a, b), + crate::vm_m6::oracles::tracer::ViolatedValidationRule::CalledContractWithNoCode(a) => + crate::vm_latest::oracles::tracer::ViolatedValidationRule::CalledContractWithNoCode(a), + crate::vm_m6::oracles::tracer::ViolatedValidationRule::TouchedUnallowedContext => + crate::vm_latest::oracles::tracer::ViolatedValidationRule::TouchedUnallowedContext, + crate::vm_m6::oracles::tracer::ViolatedValidationRule::TookTooManyComputationalGas(a) => + crate::vm_latest::oracles::tracer::ViolatedValidationRule::TookTooManyComputationalGas(a), }; Self::ViolatedRule(rule) } @@ -48,24 +48,24 @@ impl GlueFrom } } -impl GlueFrom - for vm_latest::oracles::tracer::ValidationError +impl GlueFrom + for crate::vm_latest::oracles::tracer::ValidationError { - fn glue_from(value: vm_1_3_2::oracles::tracer::ValidationError) -> Self { + fn glue_from(value: crate::vm_1_3_2::oracles::tracer::ValidationError) -> Self { match value { - vm_1_3_2::oracles::tracer::ValidationError::FailedTx(value) => { + crate::vm_1_3_2::oracles::tracer::ValidationError::FailedTx(value) => { Self::FailedTx(value.glue_into()) } - vm_1_3_2::oracles::tracer::ValidationError::ViolatedRule(value) => { + crate::vm_1_3_2::oracles::tracer::ValidationError::ViolatedRule(value) => { let rule = match value { - vm_1_3_2::oracles::tracer::ViolatedValidationRule::TouchedUnallowedStorageSlots(a, b) => - vm_latest::oracles::tracer::ViolatedValidationRule::TouchedUnallowedStorageSlots(a, b), - vm_1_3_2::oracles::tracer::ViolatedValidationRule::CalledContractWithNoCode(a) => - vm_latest::oracles::tracer::ViolatedValidationRule::CalledContractWithNoCode(a), - vm_1_3_2::oracles::tracer::ViolatedValidationRule::TouchedUnallowedContext => - vm_latest::oracles::tracer::ViolatedValidationRule::TouchedUnallowedContext, - vm_1_3_2::oracles::tracer::ViolatedValidationRule::TookTooManyComputationalGas(a) => - vm_latest::oracles::tracer::ViolatedValidationRule::TookTooManyComputationalGas(a), + crate::vm_1_3_2::oracles::tracer::ViolatedValidationRule::TouchedUnallowedStorageSlots(a, b) => + crate::vm_latest::oracles::tracer::ViolatedValidationRule::TouchedUnallowedStorageSlots(a, b), + crate::vm_1_3_2::oracles::tracer::ViolatedValidationRule::CalledContractWithNoCode(a) => + crate::vm_latest::oracles::tracer::ViolatedValidationRule::CalledContractWithNoCode(a), + crate::vm_1_3_2::oracles::tracer::ViolatedValidationRule::TouchedUnallowedContext => + crate::vm_latest::oracles::tracer::ViolatedValidationRule::TouchedUnallowedContext, + crate::vm_1_3_2::oracles::tracer::ViolatedValidationRule::TookTooManyComputationalGas(a) => + crate::vm_latest::oracles::tracer::ViolatedValidationRule::TookTooManyComputationalGas(a), }; Self::ViolatedRule(rule) } diff --git a/core/lib/multivm/src/glue/types/vm/validation_tracer_params.rs b/core/lib/multivm/src/glue/types/vm/validation_tracer_params.rs index 5e5fa77f2cde..5d06b715d293 100644 --- a/core/lib/multivm/src/glue/types/vm/validation_tracer_params.rs +++ b/core/lib/multivm/src/glue/types/vm/validation_tracer_params.rs @@ -1,9 +1,9 @@ use crate::glue::GlueFrom; -impl GlueFrom - for vm_m5::oracles::tracer::ValidationTracerParams +impl GlueFrom + for crate::vm_m5::oracles::tracer::ValidationTracerParams { - fn glue_from(value: vm_latest::oracles::tracer::ValidationTracerParams) -> Self { + fn glue_from(value: crate::vm_latest::oracles::tracer::ValidationTracerParams) -> Self { Self { user_address: value.user_address, paymaster_address: value.paymaster_address, @@ -14,10 +14,10 @@ impl GlueFrom } } -impl GlueFrom - for vm_m6::oracles::tracer::ValidationTracerParams +impl GlueFrom + for crate::vm_m6::oracles::tracer::ValidationTracerParams { - fn glue_from(value: vm_latest::oracles::tracer::ValidationTracerParams) -> Self { + fn glue_from(value: crate::vm_latest::oracles::tracer::ValidationTracerParams) -> Self { Self { user_address: value.user_address, paymaster_address: value.paymaster_address, @@ -29,10 +29,10 @@ impl GlueFrom } } -impl GlueFrom - for vm_1_3_2::oracles::tracer::ValidationTracerParams +impl GlueFrom + for crate::vm_1_3_2::oracles::tracer::ValidationTracerParams { - fn glue_from(value: vm_latest::oracles::tracer::ValidationTracerParams) -> Self { + fn glue_from(value: crate::vm_latest::oracles::tracer::ValidationTracerParams) -> Self { Self { user_address: value.user_address, paymaster_address: value.paymaster_address, 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 1c0465855b66..c95eeb5eede3 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 @@ -1,5 +1,5 @@ use crate::glue::{GlueFrom, GlueInto}; -use vm_latest::{ +use crate::vm_latest::{ CurrentExecutionState, ExecutionResult, Refunds, VmExecutionResultAndLogs, VmExecutionStatistics, }; @@ -10,9 +10,9 @@ use zksync_types::tx::tx_execution_info::VmExecutionLogs; // Bootloader memory required only for producing witnesses, // and server doesn't need to generate witnesses for old blocks -impl GlueFrom for vm_latest::FinishedL1Batch { - fn glue_from(value: vm_m5::vm::VmBlockResult) -> Self { - vm_latest::FinishedL1Batch { +impl GlueFrom for crate::vm_latest::FinishedL1Batch { + fn glue_from(value: crate::vm_m5::vm::VmBlockResult) -> Self { + crate::vm_latest::FinishedL1Batch { block_tip_execution_result: VmExecutionResultAndLogs { result: value.block_tip_result.revert_reason.glue_into(), logs: VmExecutionLogs { @@ -43,9 +43,9 @@ impl GlueFrom for vm_latest::FinishedL1Batch { } } -impl GlueFrom for vm_latest::FinishedL1Batch { - fn glue_from(value: vm_m6::vm::VmBlockResult) -> Self { - vm_latest::FinishedL1Batch { +impl GlueFrom for crate::vm_latest::FinishedL1Batch { + fn glue_from(value: crate::vm_m6::vm::VmBlockResult) -> Self { + crate::vm_latest::FinishedL1Batch { block_tip_execution_result: VmExecutionResultAndLogs { result: value.block_tip_result.revert_reason.glue_into(), logs: VmExecutionLogs { @@ -76,9 +76,9 @@ impl GlueFrom for vm_latest::FinishedL1Batch { } } -impl GlueFrom for vm_latest::FinishedL1Batch { - fn glue_from(value: vm_1_3_2::vm::VmBlockResult) -> Self { - vm_latest::FinishedL1Batch { +impl GlueFrom for crate::vm_latest::FinishedL1Batch { + fn glue_from(value: crate::vm_1_3_2::vm::VmBlockResult) -> Self { + crate::vm_latest::FinishedL1Batch { block_tip_execution_result: VmExecutionResultAndLogs { result: value.block_tip_result.revert_reason.glue_into(), logs: VmExecutionLogs { @@ -109,8 +109,8 @@ impl GlueFrom for vm_latest::FinishedL1Batch { } } -impl GlueFrom for vm_latest::VmExecutionResultAndLogs { - fn glue_from(value: vm_1_3_2::vm::VmBlockResult) -> Self { +impl GlueFrom for crate::vm_latest::VmExecutionResultAndLogs { + fn glue_from(value: crate::vm_1_3_2::vm::VmBlockResult) -> Self { let mut result = value .full_result .revert_reason @@ -141,8 +141,8 @@ impl GlueFrom for vm_latest::VmExecutionResultAndLo } } -impl GlueFrom for vm_latest::VmExecutionResultAndLogs { - fn glue_from(value: vm_m5::vm::VmBlockResult) -> Self { +impl GlueFrom for crate::vm_latest::VmExecutionResultAndLogs { + fn glue_from(value: crate::vm_m5::vm::VmBlockResult) -> Self { let mut result = value .full_result .revert_reason @@ -173,8 +173,8 @@ impl GlueFrom for vm_latest::VmExecutionResultAndLogs } } -impl GlueFrom for vm_latest::VmExecutionResultAndLogs { - fn glue_from(value: vm_m6::vm::VmBlockResult) -> Self { +impl GlueFrom for crate::vm_latest::VmExecutionResultAndLogs { + fn glue_from(value: crate::vm_m6::vm::VmBlockResult) -> Self { let mut result = value .full_result .revert_reason diff --git a/core/lib/multivm/src/glue/types/vm/vm_execution_mode.rs b/core/lib/multivm/src/glue/types/vm/vm_execution_mode.rs index d02766c9fce5..7ee1a3966a6c 100644 --- a/core/lib/multivm/src/glue/types/vm/vm_execution_mode.rs +++ b/core/lib/multivm/src/glue/types/vm/vm_execution_mode.rs @@ -1,12 +1,12 @@ use crate::glue::GlueFrom; -use vm_latest::VmExecutionMode; +use crate::vm_latest::VmExecutionMode; -impl GlueFrom for vm_virtual_blocks::VmExecutionMode { +impl GlueFrom for crate::vm_virtual_blocks::VmExecutionMode { fn glue_from(value: VmExecutionMode) -> Self { match value { - VmExecutionMode::OneTx => vm_virtual_blocks::VmExecutionMode::OneTx, - VmExecutionMode::Batch => vm_virtual_blocks::VmExecutionMode::Batch, - VmExecutionMode::Bootloader => vm_virtual_blocks::VmExecutionMode::Bootloader, + VmExecutionMode::OneTx => crate::vm_virtual_blocks::VmExecutionMode::OneTx, + VmExecutionMode::Batch => crate::vm_virtual_blocks::VmExecutionMode::Batch, + VmExecutionMode::Bootloader => crate::vm_virtual_blocks::VmExecutionMode::Bootloader, } } } diff --git a/core/lib/multivm/src/glue/types/vm/vm_execution_result.rs b/core/lib/multivm/src/glue/types/vm/vm_execution_result.rs index ce405df7217f..38a3583835f8 100644 --- a/core/lib/multivm/src/glue/types/vm/vm_execution_result.rs +++ b/core/lib/multivm/src/glue/types/vm/vm_execution_result.rs @@ -1,7 +1,7 @@ use crate::glue::GlueFrom; -impl GlueFrom for vm_latest::CurrentExecutionState { - fn glue_from(value: vm_m5::vm::VmExecutionResult) -> Self { +impl GlueFrom for crate::vm_latest::CurrentExecutionState { + fn glue_from(value: crate::vm_m5::vm::VmExecutionResult) -> Self { Self { events: value.events, storage_log_queries: value.storage_log_queries, @@ -13,8 +13,8 @@ impl GlueFrom for vm_latest::CurrentExecutionState } } -impl GlueFrom for vm_latest::CurrentExecutionState { - fn glue_from(value: vm_m6::vm::VmExecutionResult) -> Self { +impl GlueFrom for crate::vm_latest::CurrentExecutionState { + fn glue_from(value: crate::vm_m6::vm::VmExecutionResult) -> Self { Self { events: value.events, storage_log_queries: value.storage_log_queries, @@ -26,8 +26,8 @@ impl GlueFrom for vm_latest::CurrentExecutionState } } -impl GlueFrom for vm_latest::CurrentExecutionState { - fn glue_from(value: vm_1_3_2::VmExecutionResult) -> Self { +impl GlueFrom for crate::vm_latest::CurrentExecutionState { + fn glue_from(value: crate::vm_1_3_2::VmExecutionResult) -> Self { Self { events: value.events, storage_log_queries: value.storage_log_queries, diff --git a/core/lib/multivm/src/glue/types/vm/vm_execution_result_and_logs.rs b/core/lib/multivm/src/glue/types/vm/vm_execution_result_and_logs.rs index e6e7c411fd64..bb4c83b4288d 100644 --- a/core/lib/multivm/src/glue/types/vm/vm_execution_result_and_logs.rs +++ b/core/lib/multivm/src/glue/types/vm/vm_execution_result_and_logs.rs @@ -1,8 +1,8 @@ use crate::glue::{GlueFrom, GlueInto}; -use vm_latest::VmExecutionResultAndLogs; +use crate::vm_latest::VmExecutionResultAndLogs; -impl GlueFrom for VmExecutionResultAndLogs { - fn glue_from(value: vm_virtual_blocks::VmExecutionResultAndLogs) -> Self { +impl GlueFrom for VmExecutionResultAndLogs { + fn glue_from(value: crate::vm_virtual_blocks::VmExecutionResultAndLogs) -> Self { Self { result: value.result.glue_into(), logs: value.logs, diff --git a/core/lib/multivm/src/glue/types/vm/vm_execution_statistics.rs b/core/lib/multivm/src/glue/types/vm/vm_execution_statistics.rs index 3b4951ca9f61..2b7770077818 100644 --- a/core/lib/multivm/src/glue/types/vm/vm_execution_statistics.rs +++ b/core/lib/multivm/src/glue/types/vm/vm_execution_statistics.rs @@ -1,8 +1,8 @@ use crate::glue::GlueFrom; -use vm_latest::VmExecutionStatistics; +use crate::vm_latest::VmExecutionStatistics; -impl GlueFrom for VmExecutionStatistics { - fn glue_from(value: vm_virtual_blocks::VmExecutionStatistics) -> Self { +impl GlueFrom for VmExecutionStatistics { + fn glue_from(value: crate::vm_virtual_blocks::VmExecutionStatistics) -> Self { Self { contracts_used: value.contracts_used, cycles_used: value.cycles_used, diff --git a/core/lib/multivm/src/glue/types/vm/vm_memory_metrics.rs b/core/lib/multivm/src/glue/types/vm/vm_memory_metrics.rs index d81a67de3213..37ea05cfc82c 100644 --- a/core/lib/multivm/src/glue/types/vm/vm_memory_metrics.rs +++ b/core/lib/multivm/src/glue/types/vm/vm_memory_metrics.rs @@ -1,8 +1,8 @@ use crate::glue::GlueFrom; -use vm_latest::VmMemoryMetrics; +use crate::vm_latest::VmMemoryMetrics; -impl GlueFrom for VmMemoryMetrics { - fn glue_from(value: vm_virtual_blocks::VmMemoryMetrics) -> Self { +impl GlueFrom for VmMemoryMetrics { + fn glue_from(value: crate::vm_virtual_blocks::VmMemoryMetrics) -> Self { Self { event_sink_inner: value.event_sink_inner, event_sink_history: value.event_sink_history, diff --git a/core/lib/multivm/src/glue/types/vm/vm_partial_execution_result.rs b/core/lib/multivm/src/glue/types/vm/vm_partial_execution_result.rs index bdce90777d29..c6c2b71a5bff 100644 --- a/core/lib/multivm/src/glue/types/vm/vm_partial_execution_result.rs +++ b/core/lib/multivm/src/glue/types/vm/vm_partial_execution_result.rs @@ -1,8 +1,10 @@ use crate::glue::{GlueFrom, GlueInto}; use zksync_types::tx::tx_execution_info::VmExecutionLogs; -impl GlueFrom for vm_latest::VmExecutionResultAndLogs { - fn glue_from(value: vm_m5::vm::VmPartialExecutionResult) -> Self { +impl GlueFrom + for crate::vm_latest::VmExecutionResultAndLogs +{ + fn glue_from(value: crate::vm_m5::vm::VmPartialExecutionResult) -> Self { Self { result: value.revert_reason.glue_into(), logs: VmExecutionLogs { @@ -11,7 +13,7 @@ impl GlueFrom for vm_latest::VmExecutionRes storage_logs: value.logs.storage_logs.clone(), total_log_queries_count: value.logs.total_log_queries_count, }, - statistics: vm_latest::VmExecutionStatistics { + statistics: crate::vm_latest::VmExecutionStatistics { contracts_used: value.contracts_used, cycles_used: value.cycles_used, total_log_queries: value.logs.total_log_queries_count, @@ -20,7 +22,7 @@ impl GlueFrom for vm_latest::VmExecutionRes // There are no such fields in m5 computational_gas_used: 0, }, - refunds: vm_latest::Refunds { + refunds: crate::vm_latest::Refunds { gas_refunded: 0, operator_suggested_refund: 0, }, @@ -28,8 +30,10 @@ impl GlueFrom for vm_latest::VmExecutionRes } } -impl GlueFrom for vm_latest::VmExecutionResultAndLogs { - fn glue_from(value: vm_m6::vm::VmPartialExecutionResult) -> Self { +impl GlueFrom + for crate::vm_latest::VmExecutionResultAndLogs +{ + fn glue_from(value: crate::vm_m6::vm::VmPartialExecutionResult) -> Self { Self { result: value.revert_reason.glue_into(), logs: VmExecutionLogs { @@ -38,14 +42,14 @@ impl GlueFrom for vm_latest::VmExecutionRes storage_logs: value.logs.storage_logs.clone(), total_log_queries_count: value.logs.total_log_queries_count, }, - statistics: vm_latest::VmExecutionStatistics { + statistics: crate::vm_latest::VmExecutionStatistics { contracts_used: value.contracts_used, cycles_used: value.cycles_used, gas_used: value.computational_gas_used, computational_gas_used: value.computational_gas_used, total_log_queries: value.logs.total_log_queries_count, }, - refunds: vm_latest::Refunds { + refunds: crate::vm_latest::Refunds { gas_refunded: 0, operator_suggested_refund: 0, }, @@ -53,8 +57,10 @@ impl GlueFrom for vm_latest::VmExecutionRes } } -impl GlueFrom for vm_latest::VmExecutionResultAndLogs { - fn glue_from(value: vm_1_3_2::vm::VmPartialExecutionResult) -> Self { +impl GlueFrom + for crate::vm_latest::VmExecutionResultAndLogs +{ + fn glue_from(value: crate::vm_1_3_2::vm::VmPartialExecutionResult) -> Self { Self { result: value.revert_reason.glue_into(), logs: VmExecutionLogs { @@ -63,14 +69,14 @@ impl GlueFrom for vm_latest::VmExecution storage_logs: value.logs.storage_logs.clone(), total_log_queries_count: value.logs.total_log_queries_count, }, - statistics: vm_latest::VmExecutionStatistics { + statistics: crate::vm_latest::VmExecutionStatistics { contracts_used: value.contracts_used, cycles_used: value.cycles_used, gas_used: value.computational_gas_used, computational_gas_used: value.computational_gas_used, total_log_queries: value.logs.total_log_queries_count, }, - refunds: vm_latest::Refunds { + refunds: crate::vm_latest::Refunds { gas_refunded: 0, operator_suggested_refund: 0, }, @@ -78,13 +84,15 @@ impl GlueFrom for vm_latest::VmExecution } } -impl GlueFrom> for vm_latest::ExecutionResult { - fn glue_from(value: Option) -> Self { +impl GlueFrom> for crate::vm_latest::ExecutionResult { + fn glue_from(value: Option) -> Self { if let Some(error) = value { - let error_reason: vm_latest::TxRevertReason = error.glue_into(); + let error_reason: crate::vm_latest::TxRevertReason = error.glue_into(); match error_reason { - vm_latest::TxRevertReason::TxReverted(reason) => Self::Revert { output: reason }, - vm_latest::TxRevertReason::Halt(halt) => Self::Halt { reason: halt }, + crate::vm_latest::TxRevertReason::TxReverted(reason) => { + Self::Revert { output: reason } + } + crate::vm_latest::TxRevertReason::Halt(halt) => Self::Halt { reason: halt }, } } else { Self::Success { output: vec![] } @@ -92,13 +100,15 @@ impl GlueFrom> for vm_latest::ExecutionResult { } } -impl GlueFrom> for vm_latest::ExecutionResult { - fn glue_from(value: Option) -> Self { +impl GlueFrom> for crate::vm_latest::ExecutionResult { + fn glue_from(value: Option) -> Self { if let Some(error) = value { - let error_reason: vm_latest::TxRevertReason = error.glue_into(); + let error_reason: crate::vm_latest::TxRevertReason = error.glue_into(); match error_reason { - vm_latest::TxRevertReason::TxReverted(reason) => Self::Revert { output: reason }, - vm_latest::TxRevertReason::Halt(halt) => Self::Halt { reason: halt }, + crate::vm_latest::TxRevertReason::TxReverted(reason) => { + Self::Revert { output: reason } + } + crate::vm_latest::TxRevertReason::Halt(halt) => Self::Halt { reason: halt }, } } else { Self::Success { output: vec![] } @@ -106,13 +116,15 @@ impl GlueFrom> for vm_latest::ExecutionResult { } } -impl GlueFrom> for vm_latest::ExecutionResult { - fn glue_from(value: Option) -> Self { +impl GlueFrom> for crate::vm_latest::ExecutionResult { + fn glue_from(value: Option) -> Self { if let Some(error) = value { - let error_reason: vm_latest::TxRevertReason = error.glue_into(); + let error_reason: crate::vm_latest::TxRevertReason = error.glue_into(); match error_reason { - vm_latest::TxRevertReason::TxReverted(reason) => Self::Revert { output: reason }, - vm_latest::TxRevertReason::Halt(halt) => Self::Halt { reason: halt }, + crate::vm_latest::TxRevertReason::TxReverted(reason) => { + Self::Revert { output: reason } + } + crate::vm_latest::TxRevertReason::Halt(halt) => Self::Halt { reason: halt }, } } else { Self::Success { output: vec![] } diff --git a/core/lib/multivm/src/glue/types/vm/vm_revert_reason.rs b/core/lib/multivm/src/glue/types/vm/vm_revert_reason.rs index 691651e2baff..9e5aa1d50c0e 100644 --- a/core/lib/multivm/src/glue/types/vm/vm_revert_reason.rs +++ b/core/lib/multivm/src/glue/types/vm/vm_revert_reason.rs @@ -1,15 +1,15 @@ use crate::glue::GlueFrom; -impl GlueFrom for vm_latest::VmRevertReason { - fn glue_from(value: vm_m5::errors::VmRevertReason) -> Self { +impl GlueFrom for crate::vm_latest::VmRevertReason { + fn glue_from(value: crate::vm_m5::errors::VmRevertReason) -> Self { match value { - vm_m5::errors::VmRevertReason::General { msg } => Self::General { + crate::vm_m5::errors::VmRevertReason::General { msg } => Self::General { msg, data: Vec::new(), }, - vm_m5::errors::VmRevertReason::InnerTxError => Self::InnerTxError, - vm_m5::errors::VmRevertReason::VmError => Self::VmError, - vm_m5::errors::VmRevertReason::Unknown { + crate::vm_m5::errors::VmRevertReason::InnerTxError => Self::InnerTxError, + crate::vm_m5::errors::VmRevertReason::VmError => Self::VmError, + crate::vm_m5::errors::VmRevertReason::Unknown { function_selector, data, } => Self::Unknown { @@ -20,13 +20,15 @@ impl GlueFrom for vm_latest::VmRevertReason { } } -impl GlueFrom for vm_latest::VmRevertReason { - fn glue_from(value: vm_m6::errors::VmRevertReason) -> Self { +impl GlueFrom for crate::vm_latest::VmRevertReason { + fn glue_from(value: crate::vm_m6::errors::VmRevertReason) -> Self { match value { - vm_m6::errors::VmRevertReason::General { msg, data } => Self::General { msg, data }, - vm_m6::errors::VmRevertReason::InnerTxError => Self::InnerTxError, - vm_m6::errors::VmRevertReason::VmError => Self::VmError, - vm_m6::errors::VmRevertReason::Unknown { + crate::vm_m6::errors::VmRevertReason::General { msg, data } => { + Self::General { msg, data } + } + crate::vm_m6::errors::VmRevertReason::InnerTxError => Self::InnerTxError, + crate::vm_m6::errors::VmRevertReason::VmError => Self::VmError, + crate::vm_m6::errors::VmRevertReason::Unknown { function_selector, data, } => Self::Unknown { @@ -37,13 +39,15 @@ impl GlueFrom for vm_latest::VmRevertReason { } } -impl GlueFrom for vm_latest::VmRevertReason { - fn glue_from(value: vm_1_3_2::errors::VmRevertReason) -> Self { +impl GlueFrom for crate::vm_latest::VmRevertReason { + fn glue_from(value: crate::vm_1_3_2::errors::VmRevertReason) -> Self { match value { - vm_1_3_2::errors::VmRevertReason::General { msg, data } => Self::General { msg, data }, - vm_1_3_2::errors::VmRevertReason::InnerTxError => Self::InnerTxError, - vm_1_3_2::errors::VmRevertReason::VmError => Self::VmError, - vm_1_3_2::errors::VmRevertReason::Unknown { + crate::vm_1_3_2::errors::VmRevertReason::General { msg, data } => { + Self::General { msg, data } + } + crate::vm_1_3_2::errors::VmRevertReason::InnerTxError => Self::InnerTxError, + crate::vm_1_3_2::errors::VmRevertReason::VmError => Self::VmError, + crate::vm_1_3_2::errors::VmRevertReason::Unknown { function_selector, data, } => Self::Unknown { @@ -54,13 +58,15 @@ impl GlueFrom for vm_latest::VmRevertReason { } } -impl GlueFrom for vm_latest::VmRevertReason { - fn glue_from(value: vm_virtual_blocks::VmRevertReason) -> Self { +impl GlueFrom for crate::vm_latest::VmRevertReason { + fn glue_from(value: crate::vm_virtual_blocks::VmRevertReason) -> Self { match value { - vm_virtual_blocks::VmRevertReason::General { msg, data } => Self::General { msg, data }, - vm_virtual_blocks::VmRevertReason::InnerTxError => Self::InnerTxError, - vm_virtual_blocks::VmRevertReason::VmError => Self::VmError, - vm_virtual_blocks::VmRevertReason::Unknown { + crate::vm_virtual_blocks::VmRevertReason::General { msg, data } => { + Self::General { msg, data } + } + crate::vm_virtual_blocks::VmRevertReason::InnerTxError => Self::InnerTxError, + crate::vm_virtual_blocks::VmRevertReason::VmError => Self::VmError, + crate::vm_virtual_blocks::VmRevertReason::Unknown { function_selector, data, } => Self::Unknown { diff --git a/core/lib/multivm/src/glue/types/vm/vm_tx_execution_result.rs b/core/lib/multivm/src/glue/types/vm/vm_tx_execution_result.rs index 456f7b46125d..0b64cda4c815 100644 --- a/core/lib/multivm/src/glue/types/vm/vm_tx_execution_result.rs +++ b/core/lib/multivm/src/glue/types/vm/vm_tx_execution_result.rs @@ -1,9 +1,9 @@ use crate::glue::{GlueFrom, GlueInto}; -use vm_latest::{ExecutionResult, Refunds, TxRevertReason, VmExecutionResultAndLogs}; +use crate::vm_latest::{ExecutionResult, Refunds, TxRevertReason, VmExecutionResultAndLogs}; use zksync_types::tx::tx_execution_info::TxExecutionStatus; -impl GlueFrom for VmExecutionResultAndLogs { - fn glue_from(value: vm_m5::vm::VmTxExecutionResult) -> Self { +impl GlueFrom for VmExecutionResultAndLogs { + fn glue_from(value: crate::vm_m5::vm::VmTxExecutionResult) -> Self { let mut result: VmExecutionResultAndLogs = value.result.glue_into(); if result.result.is_failed() { assert_eq!(value.status, TxExecutionStatus::Failure); @@ -17,8 +17,8 @@ impl GlueFrom for VmExecutionResultAndLogs { } } -impl GlueFrom for VmExecutionResultAndLogs { - fn glue_from(value: vm_m6::vm::VmTxExecutionResult) -> Self { +impl GlueFrom for VmExecutionResultAndLogs { + fn glue_from(value: crate::vm_m6::vm::VmTxExecutionResult) -> Self { let mut result: VmExecutionResultAndLogs = value.result.glue_into(); if result.result.is_failed() { assert_eq!(value.status, TxExecutionStatus::Failure); @@ -32,8 +32,8 @@ impl GlueFrom for VmExecutionResultAndLogs { } } -impl GlueFrom for VmExecutionResultAndLogs { - fn glue_from(value: vm_1_3_2::vm::VmTxExecutionResult) -> Self { +impl GlueFrom for VmExecutionResultAndLogs { + fn glue_from(value: crate::vm_1_3_2::vm::VmTxExecutionResult) -> Self { let mut result: VmExecutionResultAndLogs = value.result.glue_into(); if result.result.is_failed() { assert_eq!(value.status, TxExecutionStatus::Failure); @@ -47,14 +47,16 @@ impl GlueFrom for VmExecutionResultAndLogs { } } -impl GlueFrom> +impl GlueFrom> for VmExecutionResultAndLogs { - fn glue_from(value: Result) -> Self { + fn glue_from( + value: Result, + ) -> Self { match value { Ok(result) => result.glue_into(), Err(err) => { - let revert: vm_latest::TxRevertReason = err.glue_into(); + let revert: crate::vm_latest::TxRevertReason = err.glue_into(); match revert { TxRevertReason::TxReverted(err) => VmExecutionResultAndLogs { result: ExecutionResult::Revert { output: err }, @@ -74,16 +76,16 @@ impl GlueFrom> } } -impl GlueFrom> +impl GlueFrom> for VmExecutionResultAndLogs { fn glue_from( - value: Result, + value: Result, ) -> Self { match value { Ok(result) => result.glue_into(), Err(err) => { - let revert: vm_latest::TxRevertReason = err.glue_into(); + let revert: crate::vm_latest::TxRevertReason = err.glue_into(); match revert { TxRevertReason::TxReverted(err) => VmExecutionResultAndLogs { result: ExecutionResult::Revert { output: err }, @@ -103,14 +105,16 @@ impl GlueFrom> +impl GlueFrom> for VmExecutionResultAndLogs { - fn glue_from(value: Result) -> Self { + fn glue_from( + value: Result, + ) -> Self { match value { Ok(result) => result.glue_into(), Err(err) => { - let revert: vm_latest::TxRevertReason = err.glue_into(); + let revert: crate::vm_latest::TxRevertReason = err.glue_into(); match revert { TxRevertReason::Halt(halt) => VmExecutionResultAndLogs { result: ExecutionResult::Halt { reason: halt }, diff --git a/core/lib/multivm/src/lib.rs b/core/lib/multivm/src/lib.rs index 2a3f0e6c6c3e..cab90eb1499a 100644 --- a/core/lib/multivm/src/lib.rs +++ b/core/lib/multivm/src/lib.rs @@ -1,3 +1,8 @@ +// #![deny(unreachable_pub)] +#![deny(unused_crate_dependencies)] +#![warn(unused_extern_crates)] +#![warn(unused_imports)] + pub use crate::{ glue::{ block_properties::BlockProperties, history_mode::HistoryMode, oracle_tools::OracleTools, @@ -9,3 +14,10 @@ pub use zksync_types::vm_version::VmVersion; mod glue; mod vm_instance; + +pub mod versions; +pub use versions::vm_1_3_2; +pub use versions::vm_latest; +pub use versions::vm_m5; +pub use versions::vm_m6; +pub use versions::vm_virtual_blocks; diff --git a/core/multivm_deps/README.md b/core/lib/multivm/src/versions/README.md similarity index 100% rename from core/multivm_deps/README.md rename to core/lib/multivm/src/versions/README.md diff --git a/core/lib/multivm/src/versions/mod.rs b/core/lib/multivm/src/versions/mod.rs new file mode 100644 index 000000000000..cbb918d1a831 --- /dev/null +++ b/core/lib/multivm/src/versions/mod.rs @@ -0,0 +1,5 @@ +pub mod vm_1_3_2; +pub mod vm_latest; +pub mod vm_m5; +pub mod vm_m6; +pub mod vm_virtual_blocks; diff --git a/core/multivm_deps/vm_1_3_2/README.md b/core/lib/multivm/src/versions/vm_1_3_2/README.md similarity index 100% rename from core/multivm_deps/vm_1_3_2/README.md rename to core/lib/multivm/src/versions/vm_1_3_2/README.md diff --git a/core/multivm_deps/vm_1_3_2/src/bootloader_state.rs b/core/lib/multivm/src/versions/vm_1_3_2/bootloader_state.rs similarity index 98% rename from core/multivm_deps/vm_1_3_2/src/bootloader_state.rs rename to core/lib/multivm/src/versions/vm_1_3_2/bootloader_state.rs index 8832a59dc50e..a55846623239 100644 --- a/core/multivm_deps/vm_1_3_2/src/bootloader_state.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/bootloader_state.rs @@ -1,4 +1,4 @@ -use crate::vm_with_bootloader::TX_DESCRIPTION_OFFSET; +use crate::vm_1_3_2::vm_with_bootloader::TX_DESCRIPTION_OFFSET; /// Intermediate bootloader-related VM state. /// diff --git a/core/multivm_deps/vm_1_3_2/src/errors/bootloader_error.rs b/core/lib/multivm/src/versions/vm_1_3_2/errors/bootloader_error.rs similarity index 100% rename from core/multivm_deps/vm_1_3_2/src/errors/bootloader_error.rs rename to core/lib/multivm/src/versions/vm_1_3_2/errors/bootloader_error.rs diff --git a/core/multivm_deps/vm_1_3_2/src/errors/mod.rs b/core/lib/multivm/src/versions/vm_1_3_2/errors/mod.rs similarity index 100% rename from core/multivm_deps/vm_1_3_2/src/errors/mod.rs rename to core/lib/multivm/src/versions/vm_1_3_2/errors/mod.rs diff --git a/core/multivm_deps/vm_1_3_2/src/errors/tx_revert_reason.rs b/core/lib/multivm/src/versions/vm_1_3_2/errors/tx_revert_reason.rs similarity index 100% rename from core/multivm_deps/vm_1_3_2/src/errors/tx_revert_reason.rs rename to core/lib/multivm/src/versions/vm_1_3_2/errors/tx_revert_reason.rs diff --git a/core/multivm_deps/vm_1_3_2/src/errors/vm_revert_reason.rs b/core/lib/multivm/src/versions/vm_1_3_2/errors/vm_revert_reason.rs similarity index 99% rename from core/multivm_deps/vm_1_3_2/src/errors/vm_revert_reason.rs rename to core/lib/multivm/src/versions/vm_1_3_2/errors/vm_revert_reason.rs index f8e9d704ff87..e1d50f724481 100644 --- a/core/multivm_deps/vm_1_3_2/src/errors/vm_revert_reason.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/errors/vm_revert_reason.rs @@ -3,7 +3,7 @@ use std::fmt::{Debug, Display}; use zksync_types::U256; -use crate::TxRevertReason; +use crate::vm_1_3_2::TxRevertReason; #[derive(Debug, thiserror::Error)] pub enum VmRevertReasonParsingError { diff --git a/core/multivm_deps/vm_1_3_2/src/event_sink.rs b/core/lib/multivm/src/versions/vm_1_3_2/event_sink.rs similarity index 99% rename from core/multivm_deps/vm_1_3_2/src/event_sink.rs rename to core/lib/multivm/src/versions/vm_1_3_2/event_sink.rs index 0f1802cbe7b9..db6c5d11aee4 100644 --- a/core/multivm_deps/vm_1_3_2/src/event_sink.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/event_sink.rs @@ -1,9 +1,9 @@ -use crate::{ +use crate::vm_1_3_2::{ history_recorder::{AppDataFrameManagerWithHistory, HistoryEnabled, HistoryMode}, oracles::OracleWithHistory, }; use std::collections::HashMap; -use zk_evm::{ +use zk_evm_1_3_3::{ abstractions::EventSink, aux_structures::{LogQuery, Timestamp}, reference_impls::event_sink::EventMessage, diff --git a/core/multivm_deps/vm_m5/src/events.rs b/core/lib/multivm/src/versions/vm_1_3_2/events.rs similarity index 98% rename from core/multivm_deps/vm_m5/src/events.rs rename to core/lib/multivm/src/versions/vm_1_3_2/events.rs index 0d11d9102ea2..4870b92d351f 100644 --- a/core/multivm_deps/vm_m5/src/events.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/events.rs @@ -1,4 +1,4 @@ -use zk_evm::{ethereum_types::Address, reference_impls::event_sink::EventMessage}; +use zk_evm_1_3_3::{ethereum_types::Address, reference_impls::event_sink::EventMessage}; use zksync_types::{L1BatchNumber, VmEvent, EVENT_WRITER_ADDRESS, H256}; use zksync_utils::{be_chunks_to_h256_words, h256_to_account_address}; diff --git a/core/multivm_deps/vm_1_3_2/src/history_recorder.rs b/core/lib/multivm/src/versions/vm_1_3_2/history_recorder.rs similarity index 99% rename from core/multivm_deps/vm_1_3_2/src/history_recorder.rs rename to core/lib/multivm/src/versions/vm_1_3_2/history_recorder.rs index 16b264d1721d..3c83b68e0a38 100644 --- a/core/multivm_deps/vm_1_3_2/src/history_recorder.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/history_recorder.rs @@ -1,6 +1,6 @@ use std::{collections::HashMap, fmt::Debug, hash::Hash}; -use zk_evm::{ +use zk_evm_1_3_3::{ aux_structures::Timestamp, vm_state::PrimitiveValue, zkevm_opcode_defs::{self}, @@ -765,11 +765,11 @@ impl HistoryRecorder, H> { #[cfg(test)] mod tests { - use crate::{ + use crate::vm_1_3_2::{ history_recorder::{HistoryRecorder, MemoryWrapper}, HistoryDisabled, }; - use zk_evm::{aux_structures::Timestamp, vm_state::PrimitiveValue}; + use zk_evm_1_3_3::{aux_structures::Timestamp, vm_state::PrimitiveValue}; use zksync_types::U256; #[test] diff --git a/core/multivm_deps/vm_1_3_2/src/memory.rs b/core/lib/multivm/src/versions/vm_1_3_2/memory.rs similarity index 96% rename from core/multivm_deps/vm_1_3_2/src/memory.rs rename to core/lib/multivm/src/versions/vm_1_3_2/memory.rs index a54fa124985f..b269ba89b3c7 100644 --- a/core/multivm_deps/vm_1_3_2/src/memory.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/memory.rs @@ -1,15 +1,15 @@ -use zk_evm::abstractions::{Memory, MemoryType}; -use zk_evm::aux_structures::{MemoryPage, MemoryQuery, Timestamp}; -use zk_evm::vm_state::PrimitiveValue; -use zk_evm::zkevm_opcode_defs::FatPointer; +use zk_evm_1_3_3::abstractions::{Memory, MemoryType}; +use zk_evm_1_3_3::aux_structures::{MemoryPage, MemoryQuery, Timestamp}; +use zk_evm_1_3_3::vm_state::PrimitiveValue; +use zk_evm_1_3_3::zkevm_opcode_defs::FatPointer; use zksync_types::U256; -use crate::history_recorder::{ +use crate::vm_1_3_2::history_recorder::{ FramedStack, HistoryEnabled, HistoryMode, IntFrameManagerWithHistory, MemoryWithHistory, MemoryWrapper, WithHistory, }; -use crate::oracles::OracleWithHistory; -use crate::utils::{aux_heap_page_from_base, heap_page_from_base, stack_page_from_base}; +use crate::vm_1_3_2::oracles::OracleWithHistory; +use crate::vm_1_3_2::utils::{aux_heap_page_from_base, heap_page_from_base, stack_page_from_base}; #[derive(Debug, Clone, PartialEq)] pub struct SimpleMemory { diff --git a/core/multivm_deps/vm_1_3_2/src/lib.rs b/core/lib/multivm/src/versions/vm_1_3_2/mod.rs similarity index 64% rename from core/multivm_deps/vm_1_3_2/src/lib.rs rename to core/lib/multivm/src/versions/vm_1_3_2/mod.rs index 39a69776f5a2..4c46b3554a76 100644 --- a/core/multivm_deps/vm_1_3_2/src/lib.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/mod.rs @@ -19,13 +19,13 @@ pub mod vm_with_bootloader; #[cfg(test)] mod tests; -pub use crate::errors::TxRevertReason; -pub use crate::history_recorder::{HistoryDisabled, HistoryEnabled, HistoryMode}; -pub use crate::oracle_tools::OracleTools; -pub use crate::oracles::storage::StorageOracle; -pub use crate::vm::{VmBlockResult, VmExecutionResult, VmInstance}; -pub use zk_evm; -pub use zk_evm::block_properties::BlockProperties; +pub use errors::TxRevertReason; +pub use history_recorder::{HistoryDisabled, HistoryEnabled, HistoryMode}; +pub use oracle_tools::OracleTools; +pub use oracles::storage::StorageOracle; +pub use vm::{VmBlockResult, VmExecutionResult, VmInstance}; +pub use zk_evm_1_3_3; +pub use zk_evm_1_3_3::block_properties::BlockProperties; pub use zksync_types::vm_trace::VmExecutionTrace; pub type Word = zksync_types::U256; diff --git a/core/multivm_deps/vm_1_3_2/src/oracle_tools.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracle_tools.rs similarity index 87% rename from core/multivm_deps/vm_1_3_2/src/oracle_tools.rs rename to core/lib/multivm/src/versions/vm_1_3_2/oracle_tools.rs index bc2b2d9220c0..0f1feef4f94c 100644 --- a/core/multivm_deps/vm_1_3_2/src/oracle_tools.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracle_tools.rs @@ -1,13 +1,13 @@ use std::fmt::Debug; -use crate::event_sink::InMemoryEventSink; -use crate::history_recorder::HistoryMode; -use crate::memory::SimpleMemory; -use crate::oracles::{ +use crate::vm_1_3_2::event_sink::InMemoryEventSink; +use crate::vm_1_3_2::history_recorder::HistoryMode; +use crate::vm_1_3_2::memory::SimpleMemory; +use crate::vm_1_3_2::oracles::{ decommitter::DecommitterOracle, precompile::PrecompilesProcessorWithHistory, storage::StorageOracle, }; -use zk_evm::witness_trace::DummyTracer; +use zk_evm_1_3_3::witness_trace::DummyTracer; use zksync_state::{StoragePtr, WriteStorage}; /// zkEVM requires a bunch of objects implementing given traits to work. diff --git a/core/multivm_deps/vm_1_3_2/src/oracles/decommitter.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracles/decommitter.rs similarity index 97% rename from core/multivm_deps/vm_1_3_2/src/oracles/decommitter.rs rename to core/lib/multivm/src/versions/vm_1_3_2/oracles/decommitter.rs index 4c46843341b6..e5c30c305bc8 100644 --- a/core/multivm_deps/vm_1_3_2/src/oracles/decommitter.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracles/decommitter.rs @@ -1,10 +1,12 @@ use std::collections::HashMap; -use crate::history_recorder::{HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory}; +use crate::vm_1_3_2::history_recorder::{ + HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, +}; -use zk_evm::abstractions::MemoryType; -use zk_evm::aux_structures::Timestamp; -use zk_evm::{ +use zk_evm_1_3_3::abstractions::MemoryType; +use zk_evm_1_3_3::aux_structures::Timestamp; +use zk_evm_1_3_3::{ abstractions::{DecommittmentProcessor, Memory}, aux_structures::{DecommittmentQuery, MemoryIndex, MemoryLocation, MemoryPage, MemoryQuery}, }; @@ -169,7 +171,7 @@ impl DecommittmentProcessor memory: &mut M, ) -> Result< ( - zk_evm::aux_structures::DecommittmentQuery, + zk_evm_1_3_3::aux_structures::DecommittmentQuery, Option>, ), anyhow::Error, diff --git a/core/multivm_deps/vm_1_3_2/src/oracles/mod.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracles/mod.rs similarity index 59% rename from core/multivm_deps/vm_1_3_2/src/oracles/mod.rs rename to core/lib/multivm/src/versions/vm_1_3_2/oracles/mod.rs index d219216b25f8..342fadb554a2 100644 --- a/core/multivm_deps/vm_1_3_2/src/oracles/mod.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracles/mod.rs @@ -1,12 +1,12 @@ -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; // We will discard RAM as soon as the execution of a tx ends, so // it is ok for now to use SimpleMemory -pub use zk_evm::reference_impls::memory::SimpleMemory as RamOracle; +pub use zk_evm_1_3_3::reference_impls::memory::SimpleMemory as RamOracle; // All the changes to the events in the DB will be applied after the tx is executed, // so fow now it is fine. -pub use zk_evm::reference_impls::event_sink::InMemoryEventSink as EventSinkOracle; +pub use zk_evm_1_3_3::reference_impls::event_sink::InMemoryEventSink as EventSinkOracle; -pub use zk_evm::testing::simple_tracer::NoopTracer; +pub use zk_evm_1_3_3::testing::simple_tracer::NoopTracer; pub mod decommitter; pub mod precompile; diff --git a/core/multivm_deps/vm_m6/src/oracles/precompile.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracles/precompile.rs similarity index 96% rename from core/multivm_deps/vm_m6/src/oracles/precompile.rs rename to core/lib/multivm/src/versions/vm_1_3_2/oracles/precompile.rs index c75a8899f8f5..c856df786d88 100644 --- a/core/multivm_deps/vm_m6/src/oracles/precompile.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracles/precompile.rs @@ -1,4 +1,4 @@ -use zk_evm::{ +use zk_evm_1_3_3::{ abstractions::Memory, abstractions::PrecompileCyclesWitness, abstractions::PrecompilesProcessor, @@ -6,7 +6,7 @@ use zk_evm::{ precompiles::DefaultPrecompilesProcessor, }; -use crate::history_recorder::{HistoryEnabled, HistoryMode, HistoryRecorder}; +use crate::vm_1_3_2::history_recorder::{HistoryEnabled, HistoryMode, HistoryRecorder}; use super::OracleWithHistory; diff --git a/core/multivm_deps/vm_1_3_2/src/oracles/storage.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracles/storage.rs similarity index 97% rename from core/multivm_deps/vm_1_3_2/src/oracles/storage.rs rename to core/lib/multivm/src/versions/vm_1_3_2/oracles/storage.rs index fd67fad5c41d..9a4873fe59a6 100644 --- a/core/multivm_deps/vm_1_3_2/src/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracles/storage.rs @@ -1,13 +1,13 @@ use std::collections::HashMap; -use crate::history_recorder::{ +use crate::vm_1_3_2::history_recorder::{ AppDataFrameManagerWithHistory, HashMapHistoryEvent, HistoryEnabled, HistoryMode, HistoryRecorder, StorageWrapper, WithHistory, }; -use zk_evm::abstractions::RefundedAmounts; -use zk_evm::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES; -use zk_evm::{ +use zk_evm_1_3_3::abstractions::RefundedAmounts; +use zk_evm_1_3_3::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES; +use zk_evm_1_3_3::{ abstractions::{RefundType, Storage as VmStorageOracle}, aux_structures::{LogQuery, Timestamp}, }; @@ -330,8 +330,8 @@ fn get_pubdata_price_bytes(_query: &LogQuery, is_initial: bool) -> u32 { // TODO (SMA-1702): take into account the content of the log query, i.e. values that contain mostly zeroes // should cost less. if is_initial { - zk_evm::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES as u32 + zk_evm_1_3_3::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES as u32 } else { - zk_evm::zkevm_opcode_defs::system_params::REPEATED_STORAGE_WRITE_PUBDATA_BYTES as u32 + zk_evm_1_3_3::zkevm_opcode_defs::system_params::REPEATED_STORAGE_WRITE_PUBDATA_BYTES as u32 } } diff --git a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/bootloader.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/bootloader.rs similarity index 91% rename from core/multivm_deps/vm_1_3_2/src/oracles/tracer/bootloader.rs rename to core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/bootloader.rs index e3d627a7565f..20d8621e8291 100644 --- a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/bootloader.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/bootloader.rs @@ -1,13 +1,13 @@ use std::marker::PhantomData; -use crate::history_recorder::HistoryMode; -use crate::memory::SimpleMemory; -use crate::oracles::tracer::{ +use crate::vm_1_3_2::history_recorder::HistoryMode; +use crate::vm_1_3_2::memory::SimpleMemory; +use crate::vm_1_3_2::oracles::tracer::{ utils::gas_spent_on_bytecodes_and_long_messages_this_opcode, ExecutionEndTracer, PendingRefundTracer, PubdataSpentTracer, StorageInvocationTracer, }; -use zk_evm::{ +use zk_evm_1_3_3::{ tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, Tracer, VmLocalStateData, }, @@ -67,8 +67,12 @@ impl Tracer for BootloaderTracer { ) { // Decodes next opcode. // `self` is passed as `tracer`, so `self.after_decoding` will be called and it will catch "out of gas". - let (next_opcode, _, _) = - zk_evm::vm_state::read_and_decode(state.vm_local_state, memory, &mut DummyTracer, self); + let (next_opcode, _, _) = zk_evm_1_3_3::vm_state::read_and_decode( + state.vm_local_state, + memory, + &mut DummyTracer, + self, + ); if Self::current_frame_is_bootloader(state.vm_local_state) { if let Opcode::Ret(ret) = next_opcode.inner.variant.opcode { self.ret_from_the_bootloader = Some(ret); diff --git a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/call.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/call.rs similarity index 96% rename from core/multivm_deps/vm_1_3_2/src/oracles/tracer/call.rs rename to core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/call.rs index 455a8b5bc705..b50ee5f925cf 100644 --- a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/call.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/call.rs @@ -1,17 +1,17 @@ -use crate::errors::VmRevertReason; -use crate::history_recorder::HistoryMode; -use crate::memory::SimpleMemory; +use crate::vm_1_3_2::errors::VmRevertReason; +use crate::vm_1_3_2::history_recorder::HistoryMode; +use crate::vm_1_3_2::memory::SimpleMemory; use std::convert::TryFrom; use std::marker::PhantomData; use std::mem; -use zk_evm::tracing::{ +use zk_evm_1_3_3::tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, Tracer, VmLocalStateData, }; -use zk_evm::zkevm_opcode_defs::{ +use zk_evm_1_3_3::zkevm_opcode_defs::FatPointer; +use zk_evm_1_3_3::zkevm_opcode_defs::{ FarCallABI, FarCallOpcode, Opcode, RetOpcode, CALL_IMPLICIT_CALLDATA_FAT_PTR_REGISTER, RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }; -use zkevm_assembly::zkevm_opcode_defs::FatPointer; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_types::vm_trace::{Call, CallType}; use zksync_types::U256; @@ -282,8 +282,8 @@ fn filter_near_call(mut call: Call) -> Vec { #[cfg(test)] mod tests { - use crate::oracles::tracer::call::{filter_near_call, Call, CallType}; - use zk_evm::zkevm_opcode_defs::FarCallOpcode; + use crate::vm_1_3_2::oracles::tracer::call::{filter_near_call, Call, CallType}; + use zk_evm_1_3_3::zkevm_opcode_defs::FarCallOpcode; #[test] fn test_filter_near_calls() { diff --git a/core/multivm_deps/vm_m6/src/oracles/tracer/mod.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/mod.rs similarity index 89% rename from core/multivm_deps/vm_m6/src/oracles/tracer/mod.rs rename to core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/mod.rs index 39b5bd2fceb0..29121f35c5fe 100644 --- a/core/multivm_deps/vm_m6/src/oracles/tracer/mod.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/mod.rs @@ -1,5 +1,5 @@ -use zk_evm::abstractions::Tracer; -use zk_evm::vm_state::VmLocalState; +use zk_evm_1_3_3::tracing::Tracer; +use zk_evm_1_3_3::vm_state::VmLocalState; mod bootloader; mod call; @@ -17,8 +17,8 @@ pub use validation::{ pub(crate) use transaction_result::TransactionResultTracer; -use crate::history_recorder::HistoryMode; -use crate::memory::SimpleMemory; +use crate::vm_1_3_2::history_recorder::HistoryMode; +use crate::vm_1_3_2::memory::SimpleMemory; pub trait ExecutionEndTracer: Tracer> { // Returns whether the vm execution should stop. diff --git a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/one_tx.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/one_tx.rs similarity index 97% rename from core/multivm_deps/vm_1_3_2/src/oracles/tracer/one_tx.rs rename to core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/one_tx.rs index 53ad469c48e4..81d2bc9142ab 100644 --- a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/one_tx.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/one_tx.rs @@ -1,5 +1,5 @@ use super::utils::{computational_gas_price, print_debug_if_needed}; -use crate::{ +use crate::vm_1_3_2::{ history_recorder::HistoryMode, memory::SimpleMemory, oracles::tracer::{ @@ -9,8 +9,8 @@ use crate::{ vm::get_vm_hook_params, }; -use crate::oracles::tracer::{CallTracer, StorageInvocationTracer}; -use zk_evm::{ +use crate::vm_1_3_2::oracles::tracer::{CallTracer, StorageInvocationTracer}; +use zk_evm_1_3_3::{ tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, Tracer, VmLocalStateData, }, diff --git a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/transaction_result.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/transaction_result.rs similarity index 96% rename from core/multivm_deps/vm_1_3_2/src/oracles/tracer/transaction_result.rs rename to core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/transaction_result.rs index 496a4e766cc3..b5ab33a5ae2a 100644 --- a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/transaction_result.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/transaction_result.rs @@ -1,4 +1,4 @@ -use zk_evm::{ +use zk_evm_1_3_3::{ tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, Tracer, VmLocalStateData, }, @@ -7,13 +7,13 @@ use zk_evm::{ }; use zksync_types::{vm_trace, U256}; -use crate::memory::SimpleMemory; -use crate::oracles::tracer::{ +use crate::vm_1_3_2::memory::SimpleMemory; +use crate::vm_1_3_2::oracles::tracer::{ CallTracer, ExecutionEndTracer, PendingRefundTracer, PubdataSpentTracer, StorageInvocationTracer, }; -use crate::vm::get_vm_hook_params; -use crate::{ +use crate::vm_1_3_2::vm::get_vm_hook_params; +use crate::vm_1_3_2::{ history_recorder::HistoryMode, oracles::tracer::utils::{ gas_spent_on_bytecodes_and_long_messages_this_opcode, print_debug_if_needed, read_pointer, diff --git a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/utils.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/utils.rs similarity index 93% rename from core/multivm_deps/vm_1_3_2/src/oracles/tracer/utils.rs rename to core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/utils.rs index 035b40f30183..ea322c7afdf8 100644 --- a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/utils.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/utils.rs @@ -1,12 +1,12 @@ -use crate::history_recorder::HistoryMode; -use crate::memory::SimpleMemory; -use crate::utils::{aux_heap_page_from_base, heap_page_from_base}; -use crate::vm::{get_vm_hook_params, VM_HOOK_POSITION}; -use crate::vm_with_bootloader::BOOTLOADER_HEAP_PAGE; - -use zk_evm::aux_structures::MemoryPage; -use zk_evm::zkevm_opcode_defs::{FarCallABI, FarCallForwardPageType}; -use zk_evm::{ +use crate::vm_1_3_2::history_recorder::HistoryMode; +use crate::vm_1_3_2::memory::SimpleMemory; +use crate::vm_1_3_2::utils::{aux_heap_page_from_base, heap_page_from_base}; +use crate::vm_1_3_2::vm::{get_vm_hook_params, VM_HOOK_POSITION}; +use crate::vm_1_3_2::vm_with_bootloader::BOOTLOADER_HEAP_PAGE; + +use zk_evm_1_3_3::aux_structures::MemoryPage; +use zk_evm_1_3_3::zkevm_opcode_defs::{FarCallABI, FarCallForwardPageType}; +use zk_evm_1_3_3::{ tracing::{BeforeExecutionData, VmLocalStateData}, zkevm_opcode_defs::{FatPointer, LogOpcode, Opcode, UMAOpcode}, }; diff --git a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/validation.rs b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/validation.rs similarity index 99% rename from core/multivm_deps/vm_1_3_2/src/oracles/tracer/validation.rs rename to core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/validation.rs index 558024ecba09..ee1587df3b06 100644 --- a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/validation.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/oracles/tracer/validation.rs @@ -1,6 +1,6 @@ use std::{collections::HashSet, fmt::Display, marker::PhantomData}; -use crate::{ +use crate::vm_1_3_2::{ errors::VmRevertReasonParsingResult, history_recorder::HistoryMode, memory::SimpleMemory, @@ -10,15 +10,15 @@ use crate::{ }, }; -use zk_evm::{ +use zk_evm_1_3_3::{ tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, Tracer, VmLocalStateData, }, zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; - -use crate::oracles::tracer::{utils::get_calldata_page_via_abi, StorageInvocationTracer}; use zksync_state::{StoragePtr, WriteStorage}; + +use crate::vm_1_3_2::oracles::tracer::{utils::get_calldata_page_via_abi, StorageInvocationTracer}; use zksync_system_constants::{ ACCOUNT_CODE_STORAGE_ADDRESS, BOOTLOADER_ADDRESS, CONTRACT_DEPLOYER_ADDRESS, KECCAK256_PRECOMPILE_ADDRESS, L2_ETH_TOKEN_ADDRESS, MSG_VALUE_SIMULATOR_ADDRESS, diff --git a/core/multivm_deps/vm_1_3_2/src/pubdata_utils.rs b/core/lib/multivm/src/versions/vm_1_3_2/pubdata_utils.rs similarity index 93% rename from core/multivm_deps/vm_1_3_2/src/pubdata_utils.rs rename to core/lib/multivm/src/versions/vm_1_3_2/pubdata_utils.rs index d58450ce51a8..936b85bfc097 100644 --- a/core/multivm_deps/vm_1_3_2/src/pubdata_utils.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/pubdata_utils.rs @@ -1,8 +1,8 @@ -use crate::history_recorder::HistoryMode; -use crate::oracles::storage::storage_key_of_log; -use crate::VmInstance; +use crate::vm_1_3_2::history_recorder::HistoryMode; +use crate::vm_1_3_2::oracles::storage::storage_key_of_log; +use crate::vm_1_3_2::VmInstance; use std::collections::HashMap; -use zk_evm::aux_structures::Timestamp; +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}; use zksync_types::zkevm_test_harness::witness::sort_storage_access::sort_storage_access_queries; @@ -21,7 +21,7 @@ impl VmInstance { .iter() .filter(|log| log.sender != SYSTEM_CONTEXT_ADDRESS) .count() as u32) - * zk_evm::zkevm_opcode_defs::system_params::L1_MESSAGE_PUBDATA_BYTES; + * zk_evm_1_3_3::zkevm_opcode_defs::system_params::L1_MESSAGE_PUBDATA_BYTES; let l2_l1_long_messages_bytes: u32 = extract_long_l2_to_l1_messages(&events) .iter() .map(|event| event.len() as u32) diff --git a/core/multivm_deps/vm_1_3_2/src/refunds.rs b/core/lib/multivm/src/versions/vm_1_3_2/refunds.rs similarity index 97% rename from core/multivm_deps/vm_1_3_2/src/refunds.rs rename to core/lib/multivm/src/versions/vm_1_3_2/refunds.rs index b3aae253a4fd..0277379143ba 100644 --- a/core/multivm_deps/vm_1_3_2/src/refunds.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/refunds.rs @@ -1,9 +1,9 @@ -use crate::history_recorder::HistoryMode; -use crate::vm_with_bootloader::{ +use crate::vm_1_3_2::history_recorder::HistoryMode; +use crate::vm_1_3_2::vm_with_bootloader::{ eth_price_per_pubdata_byte, BOOTLOADER_HEAP_PAGE, TX_GAS_LIMIT_OFFSET, }; -use crate::VmInstance; -use zk_evm::aux_structures::Timestamp; +use crate::vm_1_3_2::VmInstance; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_state::WriteStorage; use zksync_types::U256; use zksync_utils::ceil_div_u256; diff --git a/core/multivm_deps/vm_1_3_2/src/test_utils.rs b/core/lib/multivm/src/versions/vm_1_3_2/test_utils.rs similarity index 99% rename from core/multivm_deps/vm_1_3_2/src/test_utils.rs rename to core/lib/multivm/src/versions/vm_1_3_2/test_utils.rs index 5acefe94a4b3..9a03c6d7da94 100644 --- a/core/multivm_deps/vm_1_3_2/src/test_utils.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/test_utils.rs @@ -9,7 +9,7 @@ use std::collections::HashMap; use itertools::Itertools; -use zk_evm::{aux_structures::Timestamp, vm_state::VmLocalState}; +use zk_evm_1_3_3::{aux_structures::Timestamp, vm_state::VmLocalState}; use zksync_contracts::test_contracts::LoadnextContractExecutionParams; use zksync_contracts::{deployer_contract, get_loadnext_contract, load_contract}; use zksync_state::WriteStorage; @@ -26,7 +26,7 @@ use zksync_utils::{ }; /// The tests here help us with the testing the VM -use crate::{ +use crate::vm_1_3_2::{ event_sink::InMemoryEventSink, history_recorder::{ AppDataFrameManagerWithHistory, HistoryEnabled, HistoryMode, HistoryRecorder, diff --git a/core/multivm_deps/vm_1_3_2/src/tests/bootloader.rs b/core/lib/multivm/src/versions/vm_1_3_2/tests/bootloader.rs similarity index 99% rename from core/multivm_deps/vm_1_3_2/src/tests/bootloader.rs rename to core/lib/multivm/src/versions/vm_1_3_2/tests/bootloader.rs index 34705896a343..10e7620dd4b3 100644 --- a/core/multivm_deps/vm_1_3_2/src/tests/bootloader.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/tests/bootloader.rs @@ -38,7 +38,7 @@ // HistoryEnabled, OracleTools, TxRevertReason, VmBlockResult, VmExecutionResult, VmInstance, // }; -// use zk_evm::{ +// use zk_evm_1_3_3::{ // aux_structures::Timestamp, block_properties::BlockProperties, zkevm_opcode_defs::FarCallOpcode, // }; // use zksync_state::{InMemoryStorage, ReadStorage, StoragePtr, StorageView, WriteStorage}; diff --git a/core/multivm_deps/vm_1_3_2/src/tests/mod.rs b/core/lib/multivm/src/versions/vm_1_3_2/tests/mod.rs similarity index 100% rename from core/multivm_deps/vm_1_3_2/src/tests/mod.rs rename to core/lib/multivm/src/versions/vm_1_3_2/tests/mod.rs diff --git a/core/multivm_deps/vm_1_3_2/src/tests/upgrades.rs b/core/lib/multivm/src/versions/vm_1_3_2/tests/upgrades.rs similarity index 99% rename from core/multivm_deps/vm_1_3_2/src/tests/upgrades.rs rename to core/lib/multivm/src/versions/vm_1_3_2/tests/upgrades.rs index f80fc6325265..47e9ad5d4eb8 100644 --- a/core/multivm_deps/vm_1_3_2/src/tests/upgrades.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/tests/upgrades.rs @@ -8,7 +8,7 @@ // HistoryEnabled, OracleTools, TxRevertReason, // }; -// use zk_evm::aux_structures::Timestamp; +// use zk_evm_1_3_3::aux_structures::Timestamp; // use zksync_types::{ // ethabi::Contract, diff --git a/core/multivm_deps/vm_1_3_2/src/tests/utils.rs b/core/lib/multivm/src/versions/vm_1_3_2/tests/utils.rs similarity index 100% rename from core/multivm_deps/vm_1_3_2/src/tests/utils.rs rename to core/lib/multivm/src/versions/vm_1_3_2/tests/utils.rs diff --git a/core/multivm_deps/vm_1_3_2/src/transaction_data.rs b/core/lib/multivm/src/versions/vm_1_3_2/transaction_data.rs similarity index 99% rename from core/multivm_deps/vm_1_3_2/src/transaction_data.rs rename to core/lib/multivm/src/versions/vm_1_3_2/transaction_data.rs index 204aca4ab460..fc931f2ad9af 100644 --- a/core/multivm_deps/vm_1_3_2/src/transaction_data.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/transaction_data.rs @@ -1,4 +1,4 @@ -use zk_evm::zkevm_opcode_defs::system_params::MAX_TX_ERGS_LIMIT; +use zk_evm_1_3_3::zkevm_opcode_defs::system_params::MAX_TX_ERGS_LIMIT; use zksync_types::ethabi::{encode, Address, Token}; use zksync_types::fee::encoding_len; use zksync_types::{ @@ -8,7 +8,7 @@ use zksync_types::{MAX_L2_TX_GAS_LIMIT, MAX_TXS_IN_BLOCK}; use zksync_utils::{address_to_h256, ceil_div_u256}; use zksync_utils::{bytecode::hash_bytecode, bytes_to_be_words, h256_to_u256}; -use crate::vm_with_bootloader::{ +use crate::vm_1_3_2::vm_with_bootloader::{ BLOCK_OVERHEAD_GAS, BLOCK_OVERHEAD_PUBDATA, BOOTLOADER_TX_ENCODING_SPACE, }; diff --git a/core/multivm_deps/vm_1_3_2/src/utils.rs b/core/lib/multivm/src/versions/vm_1_3_2/utils.rs similarity index 96% rename from core/multivm_deps/vm_1_3_2/src/utils.rs rename to core/lib/multivm/src/versions/vm_1_3_2/utils.rs index 231379568321..44be1b9c8b90 100644 --- a/core/multivm_deps/vm_1_3_2/src/utils.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/utils.rs @@ -1,12 +1,12 @@ -use crate::history_recorder::HistoryMode; -use crate::{ +use crate::vm_1_3_2::history_recorder::HistoryMode; +use crate::vm_1_3_2::{ memory::SimpleMemory, oracles::tracer::PubdataSpentTracer, vm_with_bootloader::BlockContext, VmInstance, }; use once_cell::sync::Lazy; -use zk_evm::block_properties::BlockProperties; -use zk_evm::{ +use zk_evm_1_3_3::block_properties::BlockProperties; +use zk_evm_1_3_3::{ aux_structures::{MemoryPage, Timestamp}, vm_state::PrimitiveValue, zkevm_opcode_defs::FatPointer, @@ -26,7 +26,8 @@ pub const ENTRY_POINT_PAGE: u32 = code_page_candidate_from_base(MemoryPage(INITI /// How many gas bootloader is allowed to spend within one block. /// Note that this value doesn't correspond to the gas limit of any particular transaction /// (except for the fact that, of course, gas limit for each transaction should be <= `BLOCK_GAS_LIMIT`). -pub const BLOCK_GAS_LIMIT: u32 = zk_evm::zkevm_opcode_defs::system_params::VM_INITIAL_FRAME_ERGS; +pub const BLOCK_GAS_LIMIT: u32 = + zk_evm_1_3_3::zkevm_opcode_defs::system_params::VM_INITIAL_FRAME_ERGS; pub const ETH_CALL_GAS_LIMIT: u32 = MAX_L2_TX_GAS_LIMIT as u32; #[derive(Debug, Clone)] diff --git a/core/multivm_deps/vm_1_3_2/src/vm.rs b/core/lib/multivm/src/versions/vm_1_3_2/vm.rs similarity index 97% rename from core/multivm_deps/vm_1_3_2/src/vm.rs rename to core/lib/multivm/src/versions/vm_1_3_2/vm.rs index 3493e28db79d..37e0097e59d6 100644 --- a/core/multivm_deps/vm_1_3_2/src/vm.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/vm.rs @@ -1,11 +1,13 @@ use std::convert::TryFrom; use std::fmt::Debug; -use zk_evm::aux_structures::Timestamp; -use zk_evm::vm_state::{PrimitiveValue, VmLocalState, VmState}; -use zk_evm::witness_trace::DummyTracer; -use zk_evm::zkevm_opcode_defs::decoding::{AllowedPcOrImm, EncodingModeProduction, VmEncodingMode}; -use zk_evm::zkevm_opcode_defs::definitions::RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER; +use zk_evm_1_3_3::aux_structures::Timestamp; +use zk_evm_1_3_3::vm_state::{PrimitiveValue, VmLocalState, VmState}; +use zk_evm_1_3_3::witness_trace::DummyTracer; +use zk_evm_1_3_3::zkevm_opcode_defs::decoding::{ + AllowedPcOrImm, EncodingModeProduction, VmEncodingMode, +}; +use zk_evm_1_3_3::zkevm_opcode_defs::definitions::RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER; use zksync_state::WriteStorage; use zksync_system_constants::MAX_TXS_IN_BLOCK; use zksync_types::l2_to_l1_log::L2ToL1Log; @@ -13,26 +15,26 @@ use zksync_types::tx::tx_execution_info::{TxExecutionStatus, VmExecutionLogs}; use zksync_types::vm_trace::{Call, VmExecutionTrace, VmTrace}; use zksync_types::{L1BatchNumber, StorageLogQuery, VmEvent, U256}; -use crate::bootloader_state::BootloaderState; -use crate::errors::{TxRevertReason, VmRevertReason, VmRevertReasonParsingResult}; -use crate::event_sink::InMemoryEventSink; -use crate::events::merge_events; -use crate::history_recorder::{HistoryEnabled, HistoryMode}; -use crate::memory::SimpleMemory; -use crate::oracles::decommitter::DecommitterOracle; -use crate::oracles::precompile::PrecompilesProcessorWithHistory; -use crate::oracles::storage::StorageOracle; -use crate::oracles::tracer::{ +use crate::vm_1_3_2::bootloader_state::BootloaderState; +use crate::vm_1_3_2::errors::{TxRevertReason, VmRevertReason, VmRevertReasonParsingResult}; +use crate::vm_1_3_2::event_sink::InMemoryEventSink; +use crate::vm_1_3_2::events::merge_events; +use crate::vm_1_3_2::history_recorder::{HistoryEnabled, HistoryMode}; +use crate::vm_1_3_2::memory::SimpleMemory; +use crate::vm_1_3_2::oracles::decommitter::DecommitterOracle; +use crate::vm_1_3_2::oracles::precompile::PrecompilesProcessorWithHistory; +use crate::vm_1_3_2::oracles::storage::StorageOracle; +use crate::vm_1_3_2::oracles::tracer::{ BootloaderTracer, ExecutionEndTracer, OneTxTracer, PendingRefundTracer, PubdataSpentTracer, StorageInvocationTracer, TransactionResultTracer, ValidationError, ValidationTracer, ValidationTracerParams, }; -use crate::oracles::OracleWithHistory; -use crate::utils::{ +use crate::vm_1_3_2::oracles::OracleWithHistory; +use crate::vm_1_3_2::utils::{ calculate_computational_gas_used, dump_memory_page_using_primitive_value, precompile_calls_count_after_timestamp, }; -use crate::vm_with_bootloader::{ +use crate::vm_1_3_2::vm_with_bootloader::{ BootloaderJobType, DerivedBlockContext, TxExecutionMode, BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, }; @@ -150,7 +152,7 @@ pub enum VmExecutionStopReason { TracerRequestedStop, } -use crate::utils::VmExecutionResult as NewVmExecutionResult; +use crate::vm_1_3_2::utils::VmExecutionResult as NewVmExecutionResult; fn vm_may_have_ended_inner( vm: &ZkSyncVmState, diff --git a/core/multivm_deps/vm_1_3_2/src/vm_with_bootloader.rs b/core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs similarity index 99% rename from core/multivm_deps/vm_1_3_2/src/vm_with_bootloader.rs rename to core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs index 26eee135e321..bd15543c9182 100644 --- a/core/multivm_deps/vm_1_3_2/src/vm_with_bootloader.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use zk_evm::{ +use zk_evm_1_3_3::{ aux_structures::{MemoryPage, Timestamp}, block_properties::BlockProperties, vm_state::{CallStackEntry, PrimitiveValue, VmState}, @@ -28,7 +28,7 @@ use zksync_utils::{ use itertools::Itertools; use zksync_state::WriteStorage; -use crate::{ +use crate::vm_1_3_2::{ bootloader_state::BootloaderState, history_recorder::HistoryMode, transaction_data::TransactionData, diff --git a/core/lib/vm/README.md b/core/lib/multivm/src/versions/vm_latest/README.md similarity index 100% rename from core/lib/vm/README.md rename to core/lib/multivm/src/versions/vm_latest/README.md diff --git a/core/multivm_deps/vm_virtual_blocks/src/bootloader_state/l2_block.rs b/core/lib/multivm/src/versions/vm_latest/bootloader_state/l2_block.rs similarity index 91% rename from core/multivm_deps/vm_virtual_blocks/src/bootloader_state/l2_block.rs rename to core/lib/multivm/src/versions/vm_latest/bootloader_state/l2_block.rs index 8b08978a9adb..1d4e3d39ab87 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/bootloader_state/l2_block.rs +++ b/core/lib/multivm/src/versions/vm_latest/bootloader_state/l2_block.rs @@ -2,10 +2,10 @@ use std::cmp::Ordering; use zksync_types::{MiniblockNumber, H256}; use zksync_utils::concat_and_hash; -use crate::bootloader_state::snapshot::L2BlockSnapshot; -use crate::bootloader_state::tx::BootloaderTx; -use crate::utils::l2_blocks::l2_block_hash; -use crate::{L2Block, L2BlockEnv}; +use crate::vm_latest::bootloader_state::snapshot::L2BlockSnapshot; +use crate::vm_latest::bootloader_state::tx::BootloaderTx; +use crate::vm_latest::utils::l2_blocks::l2_block_hash; +use crate::vm_latest::{L2Block, L2BlockEnv}; const EMPTY_TXS_ROLLING_HASH: H256 = H256::zero(); diff --git a/core/lib/vm/src/bootloader_state/mod.rs b/core/lib/multivm/src/versions/vm_latest/bootloader_state/mod.rs similarity index 100% rename from core/lib/vm/src/bootloader_state/mod.rs rename to core/lib/multivm/src/versions/vm_latest/bootloader_state/mod.rs diff --git a/core/lib/vm/src/bootloader_state/snapshot.rs b/core/lib/multivm/src/versions/vm_latest/bootloader_state/snapshot.rs similarity index 100% rename from core/lib/vm/src/bootloader_state/snapshot.rs rename to core/lib/multivm/src/versions/vm_latest/bootloader_state/snapshot.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/bootloader_state/state.rs b/core/lib/multivm/src/versions/vm_latest/bootloader_state/state.rs similarity index 94% rename from core/multivm_deps/vm_virtual_blocks/src/bootloader_state/state.rs rename to core/lib/multivm/src/versions/vm_latest/bootloader_state/state.rs index ca6f54e233eb..9d32e444dd91 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/bootloader_state/state.rs +++ b/core/lib/multivm/src/versions/vm_latest/bootloader_state/state.rs @@ -1,16 +1,16 @@ -use crate::bootloader_state::l2_block::BootloaderL2Block; -use crate::bootloader_state::snapshot::BootloaderStateSnapshot; -use crate::bootloader_state::utils::{apply_l2_block, apply_tx_to_memory}; +use crate::vm_latest::bootloader_state::l2_block::BootloaderL2Block; +use crate::vm_latest::bootloader_state::snapshot::BootloaderStateSnapshot; +use crate::vm_latest::bootloader_state::utils::{apply_l2_block, apply_tx_to_memory}; use std::cmp::Ordering; use zksync_types::{L2ChainId, U256}; use zksync_utils::bytecode::CompressedBytecodeInfo; -use crate::constants::TX_DESCRIPTION_OFFSET; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::types::internals::TransactionData; -use crate::types::outputs::BootloaderMemory; -use crate::utils::l2_blocks::assert_next_block; -use crate::L2BlockEnv; +use crate::vm_latest::constants::TX_DESCRIPTION_OFFSET; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; +use crate::vm_latest::types::internals::TransactionData; +use crate::vm_latest::types::outputs::BootloaderMemory; +use crate::vm_latest::utils::l2_blocks::assert_next_block; +use crate::vm_latest::L2BlockEnv; use super::tx::BootloaderTx; /// Intermediate bootloader-related VM state. diff --git a/core/multivm_deps/vm_virtual_blocks/src/bootloader_state/tx.rs b/core/lib/multivm/src/versions/vm_latest/bootloader_state/tx.rs similarity index 96% rename from core/multivm_deps/vm_virtual_blocks/src/bootloader_state/tx.rs rename to core/lib/multivm/src/versions/vm_latest/bootloader_state/tx.rs index ecf40eca824e..6d322e5877d6 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/bootloader_state/tx.rs +++ b/core/lib/multivm/src/versions/vm_latest/bootloader_state/tx.rs @@ -1,4 +1,4 @@ -use crate::types::internals::TransactionData; +use crate::vm_latest::types::internals::TransactionData; use zksync_types::{L2ChainId, H256, U256}; use zksync_utils::bytecode::CompressedBytecodeInfo; diff --git a/core/lib/vm/src/bootloader_state/utils.rs b/core/lib/multivm/src/versions/vm_latest/bootloader_state/utils.rs similarity index 96% rename from core/lib/vm/src/bootloader_state/utils.rs rename to core/lib/multivm/src/versions/vm_latest/bootloader_state/utils.rs index 31ec2ede5995..801e6e9d11a4 100644 --- a/core/lib/vm/src/bootloader_state/utils.rs +++ b/core/lib/multivm/src/versions/vm_latest/bootloader_state/utils.rs @@ -2,13 +2,13 @@ use zksync_types::U256; use zksync_utils::bytecode::CompressedBytecodeInfo; use zksync_utils::{bytes_to_be_words, h256_to_u256}; -use crate::bootloader_state::l2_block::BootloaderL2Block; -use crate::constants::{ +use crate::vm_latest::bootloader_state::l2_block::BootloaderL2Block; +use crate::vm_latest::constants::{ BOOTLOADER_TX_DESCRIPTION_OFFSET, BOOTLOADER_TX_DESCRIPTION_SIZE, COMPRESSED_BYTECODES_OFFSET, OPERATOR_REFUNDS_OFFSET, TX_DESCRIPTION_OFFSET, TX_OPERATOR_L2_BLOCK_INFO_OFFSET, TX_OPERATOR_SLOTS_PER_L2_BLOCK_INFO, TX_OVERHEAD_OFFSET, TX_TRUSTED_GAS_LIMIT_OFFSET, }; -use crate::{BootloaderMemory, TxExecutionMode}; +use crate::vm_latest::{BootloaderMemory, TxExecutionMode}; use super::tx::BootloaderTx; diff --git a/core/lib/vm/src/constants.rs b/core/lib/multivm/src/versions/vm_latest/constants.rs similarity index 94% rename from core/lib/vm/src/constants.rs rename to core/lib/multivm/src/versions/vm_latest/constants.rs index 0b77bd0d43d5..fe251ba87902 100644 --- a/core/lib/vm/src/constants.rs +++ b/core/lib/multivm/src/versions/vm_latest/constants.rs @@ -1,15 +1,15 @@ -use zk_evm::aux_structures::MemoryPage; +use zk_evm_1_3_3::aux_structures::MemoryPage; use zksync_system_constants::{ L1_GAS_PER_PUBDATA_BYTE, MAX_L2_TX_GAS_LIMIT, MAX_NEW_FACTORY_DEPS, MAX_TXS_IN_BLOCK, USED_BOOTLOADER_MEMORY_WORDS, }; -pub use zk_evm::zkevm_opcode_defs::system_params::{ +pub use zk_evm_1_3_3::zkevm_opcode_defs::system_params::{ ERGS_PER_CIRCUIT, INITIAL_STORAGE_WRITE_PUBDATA_BYTES, MAX_PUBDATA_PER_BLOCK, }; -use crate::old_vm::utils::heap_page_from_base; +use crate::vm_latest::old_vm::utils::heap_page_from_base; /// Max cycles for a single transaction. pub const MAX_CYCLES_FOR_TX: u32 = u32::MAX; @@ -92,7 +92,8 @@ pub const RESULT_SUCCESS_FIRST_SLOT: u32 = /// How many gas bootloader is allowed to spend within one block. /// Note that this value doesn't correspond to the gas limit of any particular transaction /// (except for the fact that, of course, gas limit for each transaction should be <= `BLOCK_GAS_LIMIT`). -pub const BLOCK_GAS_LIMIT: u32 = zk_evm::zkevm_opcode_defs::system_params::VM_INITIAL_FRAME_ERGS; +pub const BLOCK_GAS_LIMIT: u32 = + zk_evm_1_3_3::zkevm_opcode_defs::system_params::VM_INITIAL_FRAME_ERGS; /// How many gas is allowed to spend on a single transaction in eth_call method pub const ETH_CALL_GAS_LIMIT: u32 = MAX_L2_TX_GAS_LIMIT as u32; diff --git a/core/lib/vm/src/errors/bootloader_error.rs b/core/lib/multivm/src/versions/vm_latest/errors/bootloader_error.rs similarity index 100% rename from core/lib/vm/src/errors/bootloader_error.rs rename to core/lib/multivm/src/versions/vm_latest/errors/bootloader_error.rs diff --git a/core/lib/vm/src/errors/bytecode_compression.rs b/core/lib/multivm/src/versions/vm_latest/errors/bytecode_compression.rs similarity index 100% rename from core/lib/vm/src/errors/bytecode_compression.rs rename to core/lib/multivm/src/versions/vm_latest/errors/bytecode_compression.rs diff --git a/core/lib/vm/src/errors/halt.rs b/core/lib/multivm/src/versions/vm_latest/errors/halt.rs similarity index 99% rename from core/lib/vm/src/errors/halt.rs rename to core/lib/multivm/src/versions/vm_latest/errors/halt.rs index 0a5057a0616f..c92572e7e6b2 100644 --- a/core/lib/vm/src/errors/halt.rs +++ b/core/lib/multivm/src/versions/vm_latest/errors/halt.rs @@ -1,4 +1,4 @@ -use crate::errors::VmRevertReason; +use crate::vm_latest::errors::VmRevertReason; use std::fmt::{Display, Formatter}; /// Structure for non-contract errors from the Virtual Machine (EVM). diff --git a/core/lib/vm/src/errors/mod.rs b/core/lib/multivm/src/versions/vm_latest/errors/mod.rs similarity index 100% rename from core/lib/vm/src/errors/mod.rs rename to core/lib/multivm/src/versions/vm_latest/errors/mod.rs diff --git a/core/lib/vm/src/errors/tx_revert_reason.rs b/core/lib/multivm/src/versions/vm_latest/errors/tx_revert_reason.rs similarity index 99% rename from core/lib/vm/src/errors/tx_revert_reason.rs rename to core/lib/multivm/src/versions/vm_latest/errors/tx_revert_reason.rs index 8e65b15a0976..02f426c3f27f 100644 --- a/core/lib/vm/src/errors/tx_revert_reason.rs +++ b/core/lib/multivm/src/versions/vm_latest/errors/tx_revert_reason.rs @@ -1,4 +1,4 @@ -use crate::errors::halt::Halt; +use crate::vm_latest::errors::halt::Halt; use std::fmt::Display; diff --git a/core/lib/vm/src/errors/vm_revert_reason.rs b/core/lib/multivm/src/versions/vm_latest/errors/vm_revert_reason.rs similarity index 100% rename from core/lib/vm/src/errors/vm_revert_reason.rs rename to core/lib/multivm/src/versions/vm_latest/errors/vm_revert_reason.rs diff --git a/core/lib/vm/src/implementation/bytecode.rs b/core/lib/multivm/src/versions/vm_latest/implementation/bytecode.rs similarity index 97% rename from core/lib/vm/src/implementation/bytecode.rs rename to core/lib/multivm/src/versions/vm_latest/implementation/bytecode.rs index 053d980bad73..9a12500cd85a 100644 --- a/core/lib/vm/src/implementation/bytecode.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/bytecode.rs @@ -5,7 +5,7 @@ use zksync_types::U256; use zksync_utils::bytecode::{compress_bytecode, hash_bytecode, CompressedBytecodeInfo}; use zksync_utils::bytes_to_be_words; -use crate::{HistoryMode, Vm}; +use crate::vm_latest::{HistoryMode, Vm}; 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/vm/src/implementation/execution.rs b/core/lib/multivm/src/versions/vm_latest/implementation/execution.rs similarity index 94% rename from core/lib/vm/src/implementation/execution.rs rename to core/lib/multivm/src/versions/vm_latest/implementation/execution.rs index aed11123c7fc..4b1630fbfdc9 100644 --- a/core/lib/vm/src/implementation/execution.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/execution.rs @@ -1,17 +1,17 @@ -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_state::WriteStorage; -use crate::old_vm::{ +use crate::vm_latest::old_vm::{ history_recorder::HistoryMode, utils::{vm_may_have_ended_inner, VmExecutionResult}, }; -use crate::tracers::{ +use crate::vm_latest::tracers::{ traits::{TracerExecutionStatus, VmTracer}, DefaultExecutionTracer, RefundsTracer, }; -use crate::types::{inputs::VmExecutionMode, outputs::VmExecutionResultAndLogs}; -use crate::vm::Vm; -use crate::VmExecutionStopReason; +use crate::vm_latest::types::{inputs::VmExecutionMode, outputs::VmExecutionResultAndLogs}; +use crate::vm_latest::vm::Vm; +use crate::vm_latest::VmExecutionStopReason; impl Vm { pub(crate) fn inspect_inner( diff --git a/core/lib/vm/src/implementation/gas.rs b/core/lib/multivm/src/versions/vm_latest/implementation/gas.rs similarity index 91% rename from core/lib/vm/src/implementation/gas.rs rename to core/lib/multivm/src/versions/vm_latest/implementation/gas.rs index a7938125540e..059485df246a 100644 --- a/core/lib/vm/src/implementation/gas.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/gas.rs @@ -1,8 +1,8 @@ use zksync_state::WriteStorage; -use crate::old_vm::history_recorder::HistoryMode; -use crate::tracers::DefaultExecutionTracer; -use crate::vm::Vm; +use crate::vm_latest::old_vm::history_recorder::HistoryMode; +use crate::vm_latest::tracers::DefaultExecutionTracer; +use crate::vm_latest::vm::Vm; impl Vm { /// Returns the amount of gas remaining to the VM. diff --git a/core/lib/vm/src/implementation/logs.rs b/core/lib/multivm/src/versions/vm_latest/implementation/logs.rs similarity index 87% rename from core/lib/vm/src/implementation/logs.rs rename to core/lib/multivm/src/versions/vm_latest/implementation/logs.rs index 6bc095740ef1..87713d824a6e 100644 --- a/core/lib/vm/src/implementation/logs.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/logs.rs @@ -1,14 +1,14 @@ -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_state::WriteStorage; use zksync_types::l2_to_l1_log::L2ToL1Log; use zksync_types::tx::tx_execution_info::VmExecutionLogs; use zksync_types::VmEvent; -use crate::old_vm::events::merge_events; -use crate::old_vm::history_recorder::HistoryMode; -use crate::old_vm::utils::precompile_calls_count_after_timestamp; -use crate::vm::Vm; +use crate::vm_latest::old_vm::events::merge_events; +use crate::vm_latest::old_vm::history_recorder::HistoryMode; +use crate::vm_latest::old_vm::utils::precompile_calls_count_after_timestamp; +use crate::vm_latest::vm::Vm; impl Vm { pub(crate) fn collect_execution_logs_after_timestamp( diff --git a/core/lib/vm/src/implementation/mod.rs b/core/lib/multivm/src/versions/vm_latest/implementation/mod.rs similarity index 100% rename from core/lib/vm/src/implementation/mod.rs rename to core/lib/multivm/src/versions/vm_latest/implementation/mod.rs diff --git a/core/lib/vm/src/implementation/snapshots.rs b/core/lib/multivm/src/versions/vm_latest/implementation/snapshots.rs similarity index 97% rename from core/lib/vm/src/implementation/snapshots.rs rename to core/lib/multivm/src/versions/vm_latest/implementation/snapshots.rs index 0793be1565a5..97dfea7c998a 100644 --- a/core/lib/vm/src/implementation/snapshots.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/snapshots.rs @@ -2,10 +2,10 @@ use vise::{Buckets, EncodeLabelSet, EncodeLabelValue, Family, Histogram, Metrics use std::time::Duration; -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_state::WriteStorage; -use crate::{ +use crate::vm_latest::{ old_vm::{history_recorder::HistoryEnabled, oracles::OracleWithHistory}, types::internals::VmSnapshot, vm::Vm, diff --git a/core/lib/vm/src/implementation/statistics.rs b/core/lib/multivm/src/versions/vm_latest/implementation/statistics.rs similarity index 90% rename from core/lib/vm/src/implementation/statistics.rs rename to core/lib/multivm/src/versions/vm_latest/implementation/statistics.rs index 54b77d574940..3a11bc6c6e12 100644 --- a/core/lib/vm/src/implementation/statistics.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/statistics.rs @@ -1,14 +1,14 @@ -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_state::WriteStorage; use zksync_types::U256; -use crate::old_vm::history_recorder::HistoryMode; -use crate::tracers::DefaultExecutionTracer; -use crate::types::outputs::VmExecutionStatistics; -use crate::vm::Vm; +use crate::vm_latest::old_vm::history_recorder::HistoryMode; +use crate::vm_latest::tracers::DefaultExecutionTracer; +use crate::vm_latest::types::outputs::VmExecutionStatistics; +use crate::vm_latest::vm::Vm; -use crate::VmMemoryMetrics; +use crate::vm_latest::VmMemoryMetrics; /// Module responsible for observing the VM behavior, i.e. calculating the statistics of the VM runs /// or reporting the VM memory usage. diff --git a/core/lib/vm/src/implementation/tx.rs b/core/lib/multivm/src/versions/vm_latest/implementation/tx.rs similarity index 84% rename from core/lib/vm/src/implementation/tx.rs rename to core/lib/multivm/src/versions/vm_latest/implementation/tx.rs index 8341782d8abf..e6fa2d543ccb 100644 --- a/core/lib/vm/src/implementation/tx.rs +++ b/core/lib/multivm/src/versions/vm_latest/implementation/tx.rs @@ -1,13 +1,13 @@ -use crate::constants::BOOTLOADER_HEAP_PAGE; -use crate::implementation::bytecode::{bytecode_to_factory_dep, compress_bytecodes}; -use zk_evm::aux_structures::Timestamp; +use crate::vm_latest::constants::BOOTLOADER_HEAP_PAGE; +use crate::vm_latest::implementation::bytecode::{bytecode_to_factory_dep, compress_bytecodes}; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_state::WriteStorage; use zksync_types::l1::is_l1_tx_type; use zksync_types::Transaction; -use crate::old_vm::history_recorder::HistoryMode; -use crate::types::internals::TransactionData; -use crate::vm::Vm; +use crate::vm_latest::old_vm::history_recorder::HistoryMode; +use crate::vm_latest::types::internals::TransactionData; +use crate::vm_latest::vm::Vm; impl Vm { pub(crate) fn push_raw_transaction( diff --git a/core/lib/vm/src/lib.rs b/core/lib/multivm/src/versions/vm_latest/mod.rs similarity index 88% rename from core/lib/vm/src/lib.rs rename to core/lib/multivm/src/versions/vm_latest/mod.rs index d77fbab2014e..5be5de774091 100644 --- a/core/lib/vm/src/lib.rs +++ b/core/lib/multivm/src/versions/vm_latest/mod.rs @@ -1,8 +1,3 @@ -#![deny(unreachable_pub)] -#![deny(unused_crate_dependencies)] -#![warn(unused_extern_crates)] -#![warn(unused_imports)] - pub use old_vm::{ history_recorder::{HistoryDisabled, HistoryEnabled, HistoryMode}, memory::SimpleMemory, @@ -33,7 +28,7 @@ pub use utils::transaction_encoding::TransactionVmExt; pub use bootloader_state::BootloaderState; -pub use crate::vm::Vm; +pub use vm::Vm; mod bootloader_state; mod errors; diff --git a/core/lib/vm/src/old_vm/event_sink.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/event_sink.rs similarity index 99% rename from core/lib/vm/src/old_vm/event_sink.rs rename to core/lib/multivm/src/versions/vm_latest/old_vm/event_sink.rs index 03156e83b9fb..25b33ce87c39 100644 --- a/core/lib/vm/src/old_vm/event_sink.rs +++ b/core/lib/multivm/src/versions/vm_latest/old_vm/event_sink.rs @@ -1,9 +1,9 @@ -use crate::old_vm::{ +use crate::vm_latest::old_vm::{ history_recorder::{AppDataFrameManagerWithHistory, HistoryEnabled, HistoryMode}, oracles::OracleWithHistory, }; use std::collections::HashMap; -use zk_evm::{ +use zk_evm_1_3_3::{ abstractions::EventSink, aux_structures::{LogQuery, Timestamp}, reference_impls::event_sink::EventMessage, diff --git a/core/multivm_deps/vm_virtual_blocks/src/old_vm/events.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/events.rs similarity index 98% rename from core/multivm_deps/vm_virtual_blocks/src/old_vm/events.rs rename to core/lib/multivm/src/versions/vm_latest/old_vm/events.rs index 384a0eb86d67..de918e069141 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/old_vm/events.rs +++ b/core/lib/multivm/src/versions/vm_latest/old_vm/events.rs @@ -1,4 +1,4 @@ -use zk_evm::{ethereum_types::Address, reference_impls::event_sink::EventMessage}; +use zk_evm_1_3_3::{ethereum_types::Address, reference_impls::event_sink::EventMessage}; use zksync_types::{L1BatchNumber, VmEvent, EVENT_WRITER_ADDRESS, H256}; use zksync_utils::{be_chunks_to_h256_words, h256_to_account_address}; diff --git a/core/lib/vm/src/old_vm/history_recorder.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/history_recorder.rs similarity index 99% rename from core/lib/vm/src/old_vm/history_recorder.rs rename to core/lib/multivm/src/versions/vm_latest/old_vm/history_recorder.rs index 31431a3cc7a4..bbffd5b4d876 100644 --- a/core/lib/vm/src/old_vm/history_recorder.rs +++ b/core/lib/multivm/src/versions/vm_latest/old_vm/history_recorder.rs @@ -1,6 +1,6 @@ use std::{collections::HashMap, fmt::Debug, hash::Hash}; -use zk_evm::{ +use zk_evm_1_3_3::{ aux_structures::Timestamp, vm_state::PrimitiveValue, zkevm_opcode_defs::{self}, @@ -771,9 +771,9 @@ impl HistoryRecorder, H> { #[cfg(test)] mod tests { - use crate::old_vm::history_recorder::{HistoryRecorder, MemoryWrapper}; - use crate::HistoryDisabled; - use zk_evm::{aux_structures::Timestamp, vm_state::PrimitiveValue}; + use crate::vm_latest::old_vm::history_recorder::{HistoryRecorder, MemoryWrapper}; + use crate::vm_latest::HistoryDisabled; + use zk_evm_1_3_3::{aux_structures::Timestamp, vm_state::PrimitiveValue}; use zksync_types::U256; #[test] diff --git a/core/multivm_deps/vm_virtual_blocks/src/old_vm/memory.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/memory.rs similarity index 95% rename from core/multivm_deps/vm_virtual_blocks/src/old_vm/memory.rs rename to core/lib/multivm/src/versions/vm_latest/old_vm/memory.rs index 8569c135d1e2..2ed85f6a87fb 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/old_vm/memory.rs +++ b/core/lib/multivm/src/versions/vm_latest/old_vm/memory.rs @@ -1,15 +1,17 @@ -use zk_evm::abstractions::{Memory, MemoryType}; -use zk_evm::aux_structures::{MemoryPage, MemoryQuery, Timestamp}; -use zk_evm::vm_state::PrimitiveValue; -use zk_evm::zkevm_opcode_defs::FatPointer; +use zk_evm_1_3_3::abstractions::{Memory, MemoryType}; +use zk_evm_1_3_3::aux_structures::{MemoryPage, MemoryQuery, Timestamp}; +use zk_evm_1_3_3::vm_state::PrimitiveValue; +use zk_evm_1_3_3::zkevm_opcode_defs::FatPointer; use zksync_types::U256; -use crate::old_vm::history_recorder::{ +use crate::vm_latest::old_vm::history_recorder::{ FramedStack, HistoryEnabled, HistoryMode, IntFrameManagerWithHistory, MemoryWithHistory, MemoryWrapper, WithHistory, }; -use crate::old_vm::oracles::OracleWithHistory; -use crate::old_vm::utils::{aux_heap_page_from_base, heap_page_from_base, stack_page_from_base}; +use crate::vm_latest::old_vm::oracles::OracleWithHistory; +use crate::vm_latest::old_vm::utils::{ + aux_heap_page_from_base, heap_page_from_base, stack_page_from_base, +}; #[derive(Debug, Clone, PartialEq)] pub struct SimpleMemory { diff --git a/core/lib/vm/src/old_vm/mod.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/mod.rs similarity index 100% rename from core/lib/vm/src/old_vm/mod.rs rename to core/lib/multivm/src/versions/vm_latest/old_vm/mod.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/old_vm/oracles/decommitter.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/oracles/decommitter.rs similarity index 97% rename from core/multivm_deps/vm_virtual_blocks/src/old_vm/oracles/decommitter.rs rename to core/lib/multivm/src/versions/vm_latest/old_vm/oracles/decommitter.rs index e91380a6d385..f98abd729088 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/old_vm/oracles/decommitter.rs +++ b/core/lib/multivm/src/versions/vm_latest/old_vm/oracles/decommitter.rs @@ -1,11 +1,13 @@ use std::collections::HashMap; use std::fmt::Debug; -use crate::old_vm::history_recorder::{HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory}; +use crate::vm_latest::old_vm::history_recorder::{ + HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, +}; -use zk_evm::abstractions::MemoryType; -use zk_evm::aux_structures::Timestamp; -use zk_evm::{ +use zk_evm_1_3_3::abstractions::MemoryType; +use zk_evm_1_3_3::aux_structures::Timestamp; +use zk_evm_1_3_3::{ abstractions::{DecommittmentProcessor, Memory}, aux_structures::{DecommittmentQuery, MemoryIndex, MemoryLocation, MemoryPage, MemoryQuery}, }; @@ -171,7 +173,7 @@ impl DecommittmentProcess memory: &mut M, ) -> Result< ( - zk_evm::aux_structures::DecommittmentQuery, + zk_evm_1_3_3::aux_structures::DecommittmentQuery, Option>, ), anyhow::Error, diff --git a/core/lib/vm/src/old_vm/oracles/mod.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/oracles/mod.rs similarity index 77% rename from core/lib/vm/src/old_vm/oracles/mod.rs rename to core/lib/multivm/src/versions/vm_latest/old_vm/oracles/mod.rs index 725272e7060a..f9d35c2567b4 100644 --- a/core/lib/vm/src/old_vm/oracles/mod.rs +++ b/core/lib/multivm/src/versions/vm_latest/old_vm/oracles/mod.rs @@ -1,4 +1,4 @@ -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; pub(crate) mod decommitter; pub(crate) mod precompile; diff --git a/core/multivm_deps/vm_virtual_blocks/src/old_vm/oracles/precompile.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/oracles/precompile.rs similarity index 95% rename from core/multivm_deps/vm_virtual_blocks/src/old_vm/oracles/precompile.rs rename to core/lib/multivm/src/versions/vm_latest/old_vm/oracles/precompile.rs index 72b751c75d49..96786cf24e02 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/old_vm/oracles/precompile.rs +++ b/core/lib/multivm/src/versions/vm_latest/old_vm/oracles/precompile.rs @@ -1,4 +1,4 @@ -use zk_evm::{ +use zk_evm_1_3_3::{ abstractions::Memory, abstractions::PrecompileCyclesWitness, abstractions::PrecompilesProcessor, @@ -6,7 +6,7 @@ use zk_evm::{ precompiles::DefaultPrecompilesProcessor, }; -use crate::old_vm::history_recorder::{HistoryEnabled, HistoryMode, HistoryRecorder}; +use crate::vm_latest::old_vm::history_recorder::{HistoryEnabled, HistoryMode, HistoryRecorder}; use super::OracleWithHistory; diff --git a/core/multivm_deps/vm_virtual_blocks/src/old_vm/oracles/storage.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/oracles/storage.rs similarity index 96% rename from core/multivm_deps/vm_virtual_blocks/src/old_vm/oracles/storage.rs rename to core/lib/multivm/src/versions/vm_latest/old_vm/oracles/storage.rs index e1f5467253aa..14a03f864266 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/old_vm/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_latest/old_vm/oracles/storage.rs @@ -1,13 +1,13 @@ use std::collections::HashMap; -use crate::old_vm::history_recorder::{ +use crate::vm_latest::old_vm::history_recorder::{ AppDataFrameManagerWithHistory, HashMapHistoryEvent, HistoryEnabled, HistoryMode, HistoryRecorder, StorageWrapper, WithHistory, }; -use zk_evm::abstractions::RefundedAmounts; -use zk_evm::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES; -use zk_evm::{ +use zk_evm_1_3_3::abstractions::RefundedAmounts; +use zk_evm_1_3_3::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES; +use zk_evm_1_3_3::{ abstractions::{RefundType, Storage as VmStorageOracle}, aux_structures::{LogQuery, Timestamp}, }; @@ -331,8 +331,8 @@ fn get_pubdata_price_bytes(_query: &LogQuery, is_initial: bool) -> u32 { // TODO (SMA-1702): take into account the content of the log query, i.e. values that contain mostly zeroes // should cost less. if is_initial { - zk_evm::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES as u32 + zk_evm_1_3_3::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES as u32 } else { - zk_evm::zkevm_opcode_defs::system_params::REPEATED_STORAGE_WRITE_PUBDATA_BYTES as u32 + zk_evm_1_3_3::zkevm_opcode_defs::system_params::REPEATED_STORAGE_WRITE_PUBDATA_BYTES as u32 } } diff --git a/core/multivm_deps/vm_virtual_blocks/src/old_vm/utils.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/utils.rs similarity index 94% rename from core/multivm_deps/vm_virtual_blocks/src/old_vm/utils.rs rename to core/lib/multivm/src/versions/vm_latest/old_vm/utils.rs index 7ef211aa5407..80156707ae9d 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/old_vm/utils.rs +++ b/core/lib/multivm/src/versions/vm_latest/old_vm/utils.rs @@ -1,11 +1,13 @@ -use crate::old_vm::memory::SimpleMemory; +use crate::vm_latest::old_vm::memory::SimpleMemory; -use crate::types::internals::ZkSyncVmState; -use crate::HistoryMode; +use crate::vm_latest::types::internals::ZkSyncVmState; +use crate::vm_latest::HistoryMode; -use zk_evm::zkevm_opcode_defs::decoding::{AllowedPcOrImm, EncodingModeProduction, VmEncodingMode}; -use zk_evm::zkevm_opcode_defs::RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER; -use zk_evm::{ +use zk_evm_1_3_3::zkevm_opcode_defs::decoding::{ + AllowedPcOrImm, EncodingModeProduction, VmEncodingMode, +}; +use zk_evm_1_3_3::zkevm_opcode_defs::RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER; +use zk_evm_1_3_3::{ aux_structures::{MemoryPage, Timestamp}, vm_state::PrimitiveValue, zkevm_opcode_defs::FatPointer, diff --git a/core/lib/vm/src/oracles/mod.rs b/core/lib/multivm/src/versions/vm_latest/oracles/mod.rs similarity index 100% rename from core/lib/vm/src/oracles/mod.rs rename to core/lib/multivm/src/versions/vm_latest/oracles/mod.rs diff --git a/core/lib/vm/src/oracles/storage.rs b/core/lib/multivm/src/versions/vm_latest/oracles/storage.rs similarity index 97% rename from core/lib/vm/src/oracles/storage.rs rename to core/lib/multivm/src/versions/vm_latest/oracles/storage.rs index 60403556c478..42f856865ffb 100644 --- a/core/lib/vm/src/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_latest/oracles/storage.rs @@ -1,14 +1,14 @@ use std::collections::HashMap; -use crate::old_vm::history_recorder::{ +use crate::vm_latest::old_vm::history_recorder::{ AppDataFrameManagerWithHistory, HashMapHistoryEvent, HistoryEnabled, HistoryMode, HistoryRecorder, StorageWrapper, WithHistory, }; -use crate::old_vm::oracles::OracleWithHistory; +use crate::vm_latest::old_vm::oracles::OracleWithHistory; -use zk_evm::abstractions::RefundedAmounts; -use zk_evm::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES; -use zk_evm::{ +use zk_evm_1_3_3::abstractions::RefundedAmounts; +use zk_evm_1_3_3::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES; +use zk_evm_1_3_3::{ abstractions::{RefundType, Storage as VmStorageOracle}, aux_structures::{LogQuery, Timestamp}, }; @@ -407,8 +407,8 @@ fn get_pubdata_price_bytes(is_initial: bool) -> u32 { // TODO (SMA-1702): take into account the content of the log query, i.e. values that contain mostly zeroes // should cost less. if is_initial { - zk_evm::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES as u32 + zk_evm_1_3_3::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES as u32 } else { - zk_evm::zkevm_opcode_defs::system_params::REPEATED_STORAGE_WRITE_PUBDATA_BYTES as u32 + zk_evm_1_3_3::zkevm_opcode_defs::system_params::REPEATED_STORAGE_WRITE_PUBDATA_BYTES as u32 } } diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/bootloader.rs b/core/lib/multivm/src/versions/vm_latest/tests/bootloader.rs similarity index 76% rename from core/multivm_deps/vm_virtual_blocks/src/tests/bootloader.rs rename to core/lib/multivm/src/versions/vm_latest/tests/bootloader.rs index 0479672a6ef2..cc4157a97e6e 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/bootloader.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/bootloader.rs @@ -1,13 +1,15 @@ use zksync_types::U256; -use crate::constants::BOOTLOADER_HEAP_PAGE; -use crate::errors::Halt; -use crate::tests::tester::VmTesterBuilder; -use crate::tests::utils::{get_bootloader, verify_required_memory, BASE_SYSTEM_CONTRACTS}; -use crate::types::inputs::system_env::TxExecutionMode; - -use crate::types::outputs::ExecutionResult; -use crate::{HistoryEnabled, VmExecutionMode}; +use crate::vm_latest::constants::BOOTLOADER_HEAP_PAGE; +use crate::vm_latest::errors::Halt; +use crate::vm_latest::tests::tester::VmTesterBuilder; +use crate::vm_latest::tests::utils::{ + get_bootloader, verify_required_memory, BASE_SYSTEM_CONTRACTS, +}; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; + +use crate::vm_latest::types::outputs::ExecutionResult; +use crate::vm_latest::{HistoryEnabled, VmExecutionMode}; #[test] fn test_dummy_bootloader() { diff --git a/core/lib/vm/src/tests/bytecode_publishing.rs b/core/lib/multivm/src/versions/vm_latest/tests/bytecode_publishing.rs similarity index 81% rename from core/lib/vm/src/tests/bytecode_publishing.rs rename to core/lib/multivm/src/versions/vm_latest/tests/bytecode_publishing.rs index 60e45e252570..0ea76813d3ec 100644 --- a/core/lib/vm/src/tests/bytecode_publishing.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/bytecode_publishing.rs @@ -1,10 +1,10 @@ use zksync_types::event::extract_long_l2_to_l1_messages; use zksync_utils::bytecode::compress_bytecode; -use crate::tests::tester::{DeployContractsTx, TxType, VmTesterBuilder}; -use crate::tests::utils::read_test_contract; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{HistoryEnabled, VmExecutionMode}; +use crate::vm_latest::tests::tester::{DeployContractsTx, TxType, VmTesterBuilder}; +use crate::vm_latest::tests::utils::read_test_contract; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; +use crate::vm_latest::{HistoryEnabled, VmExecutionMode}; #[test] fn test_bytecode_publishing() { diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/call_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tests/call_tracer.rs similarity index 90% rename from core/multivm_deps/vm_virtual_blocks/src/tests/call_tracer.rs rename to core/lib/multivm/src/versions/vm_latest/tests/call_tracer.rs index d55ba826030f..e2be90420d48 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/call_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/call_tracer.rs @@ -1,7 +1,7 @@ -use crate::constants::BLOCK_GAS_LIMIT; -use crate::tests::tester::VmTesterBuilder; -use crate::tests::utils::{read_max_depth_contract, read_test_contract}; -use crate::{CallTracer, HistoryEnabled, TxExecutionMode, VmExecutionMode}; +use crate::vm_latest::constants::BLOCK_GAS_LIMIT; +use crate::vm_latest::tests::tester::VmTesterBuilder; +use crate::vm_latest::tests::utils::{read_max_depth_contract, read_test_contract}; +use crate::vm_latest::{CallTracer, HistoryEnabled, TxExecutionMode, VmExecutionMode}; use once_cell::sync::OnceCell; use std::sync::Arc; use zksync_types::{Address, Execute}; diff --git a/core/lib/vm/src/tests/default_aa.rs b/core/lib/multivm/src/versions/vm_latest/tests/default_aa.rs similarity index 88% rename from core/lib/vm/src/tests/default_aa.rs rename to core/lib/multivm/src/versions/vm_latest/tests/default_aa.rs index 173a76bf3083..1bc622a9237e 100644 --- a/core/lib/vm/src/tests/default_aa.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/default_aa.rs @@ -4,10 +4,10 @@ use zksync_types::system_contracts::{DEPLOYMENT_NONCE_INCREMENT, TX_NONCE_INCREM use zksync_types::{get_code_key, get_known_code_key, get_nonce_key, AccountTreeId, U256}; use zksync_utils::u256_to_h256; -use crate::tests::tester::{DeployContractsTx, TxType, VmTesterBuilder}; -use crate::tests::utils::{get_balance, read_test_contract, verify_required_storage}; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{HistoryEnabled, VmExecutionMode}; +use crate::vm_latest::tests::tester::{DeployContractsTx, TxType, VmTesterBuilder}; +use crate::vm_latest::tests::utils::{get_balance, read_test_contract, verify_required_storage}; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; +use crate::vm_latest::{HistoryEnabled, VmExecutionMode}; #[test] fn test_default_aa_interaction() { diff --git a/core/lib/vm/src/tests/gas_limit.rs b/core/lib/multivm/src/versions/vm_latest/tests/gas_limit.rs similarity index 79% rename from core/lib/vm/src/tests/gas_limit.rs rename to core/lib/multivm/src/versions/vm_latest/tests/gas_limit.rs index c439b6d89b20..4d6153b03de1 100644 --- a/core/lib/vm/src/tests/gas_limit.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/gas_limit.rs @@ -1,11 +1,13 @@ use zksync_types::fee::Fee; use zksync_types::Execute; -use crate::constants::{BOOTLOADER_HEAP_PAGE, TX_DESCRIPTION_OFFSET, TX_GAS_LIMIT_OFFSET}; -use crate::tests::tester::VmTesterBuilder; +use crate::vm_latest::constants::{ + BOOTLOADER_HEAP_PAGE, TX_DESCRIPTION_OFFSET, TX_GAS_LIMIT_OFFSET, +}; +use crate::vm_latest::tests::tester::VmTesterBuilder; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::HistoryDisabled; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; +use crate::vm_latest::HistoryDisabled; /// Checks that `TX_GAS_LIMIT_OFFSET` constant is correct. #[test] diff --git a/core/lib/vm/src/tests/get_used_contracts.rs b/core/lib/multivm/src/versions/vm_latest/tests/get_used_contracts.rs similarity index 91% rename from core/lib/vm/src/tests/get_used_contracts.rs rename to core/lib/multivm/src/versions/vm_latest/tests/get_used_contracts.rs index 2749d7a79b92..c32b2b7bca96 100644 --- a/core/lib/vm/src/tests/get_used_contracts.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/get_used_contracts.rs @@ -9,10 +9,10 @@ use zksync_types::{Execute, U256}; use zksync_utils::bytecode::hash_bytecode; use zksync_utils::h256_to_u256; -use crate::tests::tester::{TxType, VmTesterBuilder}; -use crate::tests::utils::{read_test_contract, BASE_SYSTEM_CONTRACTS}; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{HistoryDisabled, HistoryMode, Vm, VmExecutionMode}; +use crate::vm_latest::tests::tester::{TxType, VmTesterBuilder}; +use crate::vm_latest::tests::utils::{read_test_contract, BASE_SYSTEM_CONTRACTS}; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; +use crate::vm_latest::{HistoryDisabled, HistoryMode, Vm, VmExecutionMode}; #[test] fn test_get_used_contracts() { diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/invalid_bytecode.rs b/core/lib/multivm/src/versions/vm_latest/tests/invalid_bytecode.rs similarity index 96% rename from core/multivm_deps/vm_virtual_blocks/src/tests/invalid_bytecode.rs rename to core/lib/multivm/src/versions/vm_latest/tests/invalid_bytecode.rs index 6353d445e718..dde83d8a9f36 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/invalid_bytecode.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/invalid_bytecode.rs @@ -1,9 +1,9 @@ use zksync_types::H256; use zksync_utils::h256_to_u256; -use crate::tests::tester::VmTesterBuilder; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{HistoryEnabled, TxRevertReason}; +use crate::vm_latest::tests::tester::VmTesterBuilder; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; +use crate::vm_latest::{HistoryEnabled, TxRevertReason}; // TODO this test requires a lot of hacks for bypassing the bytecode checks in the VM. // Port it later, it's not significant. for now diff --git a/core/lib/vm/src/tests/is_write_initial.rs b/core/lib/multivm/src/versions/vm_latest/tests/is_write_initial.rs similarity index 83% rename from core/lib/vm/src/tests/is_write_initial.rs rename to core/lib/multivm/src/versions/vm_latest/tests/is_write_initial.rs index 7ccdf072744a..053c2077ea93 100644 --- a/core/lib/vm/src/tests/is_write_initial.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/is_write_initial.rs @@ -1,10 +1,10 @@ use zksync_state::ReadStorage; use zksync_types::get_nonce_key; -use crate::tests::tester::{Account, TxType, VmTesterBuilder}; -use crate::tests::utils::read_test_contract; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{HistoryDisabled, VmExecutionMode}; +use crate::vm_latest::tests::tester::{Account, TxType, VmTesterBuilder}; +use crate::vm_latest::tests::utils::read_test_contract; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; +use crate::vm_latest::{HistoryDisabled, VmExecutionMode}; #[test] fn test_is_write_initial_behaviour() { diff --git a/core/lib/vm/src/tests/l1_tx_execution.rs b/core/lib/multivm/src/versions/vm_latest/tests/l1_tx_execution.rs similarity index 92% rename from core/lib/vm/src/tests/l1_tx_execution.rs rename to core/lib/multivm/src/versions/vm_latest/tests/l1_tx_execution.rs index 2f83d8b3f208..e80d7e75f883 100644 --- a/core/lib/vm/src/tests/l1_tx_execution.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/l1_tx_execution.rs @@ -4,11 +4,13 @@ use zksync_types::storage_writes_deduplicator::StorageWritesDeduplicator; use zksync_types::{get_code_key, get_known_code_key, U256}; use zksync_utils::u256_to_h256; -use crate::tests::tester::{TxType, VmTesterBuilder}; -use crate::tests::utils::{read_test_contract, verify_required_storage, BASE_SYSTEM_CONTRACTS}; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::types::internals::TransactionData; -use crate::{HistoryEnabled, VmExecutionMode}; +use crate::vm_latest::tests::tester::{TxType, VmTesterBuilder}; +use crate::vm_latest::tests::utils::{ + read_test_contract, verify_required_storage, BASE_SYSTEM_CONTRACTS, +}; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; +use crate::vm_latest::types::internals::TransactionData; +use crate::vm_latest::{HistoryEnabled, VmExecutionMode}; #[test] fn test_l1_tx_execution() { diff --git a/core/lib/vm/src/tests/l2_blocks.rs b/core/lib/multivm/src/versions/vm_latest/tests/l2_blocks.rs similarity index 98% rename from core/lib/vm/src/tests/l2_blocks.rs rename to core/lib/multivm/src/versions/vm_latest/tests/l2_blocks.rs index 192930d73a47..0e4178edd57f 100644 --- a/core/lib/vm/src/tests/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/l2_blocks.rs @@ -3,17 +3,17 @@ //! The description for each of the tests can be found in the corresponding `.yul` file. //! -use crate::constants::{ +use crate::vm_latest::constants::{ BOOTLOADER_HEAP_PAGE, TX_OPERATOR_L2_BLOCK_INFO_OFFSET, TX_OPERATOR_SLOTS_PER_L2_BLOCK_INFO, }; -use crate::tests::tester::default_l1_batch; -use crate::tests::tester::VmTesterBuilder; -use crate::utils::l2_blocks::get_l2_block_hash_key; -use crate::{ +use crate::vm_latest::tests::tester::default_l1_batch; +use crate::vm_latest::tests::tester::VmTesterBuilder; +use crate::vm_latest::utils::l2_blocks::get_l2_block_hash_key; +use crate::vm_latest::{ ExecutionResult, Halt, HistoryEnabled, HistoryMode, L2BlockEnv, TxExecutionMode, Vm, VmExecutionMode, }; -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_state::{ReadStorage, WriteStorage}; use zksync_system_constants::{ CURRENT_VIRTUAL_BLOCK_INFO_POSITION, REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_BYTE, diff --git a/core/lib/vm/src/tests/mod.rs b/core/lib/multivm/src/versions/vm_latest/tests/mod.rs similarity index 100% rename from core/lib/vm/src/tests/mod.rs rename to core/lib/multivm/src/versions/vm_latest/tests/mod.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/nonce_holder.rs b/core/lib/multivm/src/versions/vm_latest/tests/nonce_holder.rs similarity index 93% rename from core/multivm_deps/vm_virtual_blocks/src/tests/nonce_holder.rs rename to core/lib/multivm/src/versions/vm_latest/tests/nonce_holder.rs index 35af6ad15f43..74c1ae19a74a 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/nonce_holder.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/nonce_holder.rs @@ -1,11 +1,11 @@ use zksync_types::{Execute, Nonce}; -use crate::errors::VmRevertReason; -use crate::tests::tester::{Account, VmTesterBuilder}; -use crate::tests::utils::read_nonce_holder_tester; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::types::internals::TransactionData; -use crate::{ExecutionResult, Halt, HistoryEnabled, TxRevertReason, VmExecutionMode}; +use crate::vm_latest::errors::VmRevertReason; +use crate::vm_latest::tests::tester::{Account, VmTesterBuilder}; +use crate::vm_latest::tests::utils::read_nonce_holder_tester; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; +use crate::vm_latest::types::internals::TransactionData; +use crate::vm_latest::{ExecutionResult, Halt, HistoryEnabled, TxRevertReason, VmExecutionMode}; pub enum NonceHolderTestMode { SetValueUnderNonce, diff --git a/core/lib/vm/src/tests/refunds.rs b/core/lib/multivm/src/versions/vm_latest/tests/refunds.rs similarity index 94% rename from core/lib/vm/src/tests/refunds.rs rename to core/lib/multivm/src/versions/vm_latest/tests/refunds.rs index 4314f57489eb..7c1549b6d831 100644 --- a/core/lib/vm/src/tests/refunds.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/refunds.rs @@ -1,9 +1,9 @@ -use crate::tests::tester::{DeployContractsTx, TxType, VmTesterBuilder}; -use crate::tests::utils::read_test_contract; -use crate::types::inputs::system_env::TxExecutionMode; +use crate::vm_latest::tests::tester::{DeployContractsTx, TxType, VmTesterBuilder}; +use crate::vm_latest::tests::utils::read_test_contract; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; -use crate::types::internals::TransactionData; -use crate::{HistoryEnabled, VmExecutionMode}; +use crate::vm_latest::types::internals::TransactionData; +use crate::vm_latest::{HistoryEnabled, VmExecutionMode}; #[test] fn test_predetermined_refunded_gas() { diff --git a/core/lib/vm/src/tests/require_eip712.rs b/core/lib/multivm/src/versions/vm_latest/tests/require_eip712.rs similarity index 95% rename from core/lib/vm/src/tests/require_eip712.rs rename to core/lib/multivm/src/versions/vm_latest/tests/require_eip712.rs index f3cef309fb84..c694857125cc 100644 --- a/core/lib/vm/src/tests/require_eip712.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/require_eip712.rs @@ -13,10 +13,10 @@ use zksync_types::{ AccountTreeId, Address, Eip712Domain, Execute, L2ChainId, Nonce, Transaction, U256, }; -use crate::tests::tester::{Account, VmTester, VmTesterBuilder}; -use crate::tests::utils::read_many_owners_custom_account_contract; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{HistoryDisabled, VmExecutionMode}; +use crate::vm_latest::tests::tester::{Account, VmTester, VmTesterBuilder}; +use crate::vm_latest::tests::utils::read_many_owners_custom_account_contract; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; +use crate::vm_latest::{HistoryDisabled, VmExecutionMode}; impl VmTester { pub(crate) fn get_eth_balance(&mut self, address: Address) -> U256 { diff --git a/core/lib/vm/src/tests/rollbacks.rs b/core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs similarity index 97% rename from core/lib/vm/src/tests/rollbacks.rs rename to core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs index 387e304e2856..0e5b1be83620 100644 --- a/core/lib/vm/src/tests/rollbacks.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/rollbacks.rs @@ -6,12 +6,12 @@ use zksync_contracts::test_contracts::LoadnextContractExecutionParams; use zksync_state::WriteStorage; use zksync_types::{get_nonce_key, Execute, U256}; -use crate::tests::tester::{ +use crate::vm_latest::tests::tester::{ DeployContractsTx, TransactionTestInfo, TxModifier, TxType, VmTesterBuilder, }; -use crate::tests::utils::read_test_contract; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{ +use crate::vm_latest::tests::utils::read_test_contract; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; +use crate::vm_latest::{ BootloaderState, DynTracer, HistoryEnabled, HistoryMode, TracerExecutionStatus, TracerExecutionStopReason, VmExecutionMode, VmTracer, ZkSyncVmState, }; diff --git a/core/lib/vm/src/tests/simple_execution.rs b/core/lib/multivm/src/versions/vm_latest/tests/simple_execution.rs similarity index 92% rename from core/lib/vm/src/tests/simple_execution.rs rename to core/lib/multivm/src/versions/vm_latest/tests/simple_execution.rs index 40e51739b072..8ba7627d970d 100644 --- a/core/lib/vm/src/tests/simple_execution.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/simple_execution.rs @@ -1,6 +1,6 @@ -use crate::tests::tester::{TxType, VmTesterBuilder}; -use crate::types::outputs::ExecutionResult; -use crate::{HistoryDisabled, VmExecutionMode}; +use crate::vm_latest::tests::tester::{TxType, VmTesterBuilder}; +use crate::vm_latest::types::outputs::ExecutionResult; +use crate::vm_latest::{HistoryDisabled, VmExecutionMode}; #[test] fn estimate_fee() { diff --git a/core/lib/vm/src/tests/tester/inner_state.rs b/core/lib/multivm/src/versions/vm_latest/tests/tester/inner_state.rs similarity index 93% rename from core/lib/vm/src/tests/tester/inner_state.rs rename to core/lib/multivm/src/versions/vm_latest/tests/tester/inner_state.rs index 24363743b9ee..4bc279ddefbf 100644 --- a/core/lib/vm/src/tests/tester/inner_state.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/tester/inner_state.rs @@ -1,14 +1,14 @@ use std::collections::HashMap; -use zk_evm::aux_structures::Timestamp; -use zk_evm::vm_state::VmLocalState; +use zk_evm_1_3_3::aux_structures::Timestamp; +use zk_evm_1_3_3::vm_state::VmLocalState; use zksync_state::WriteStorage; use zksync_types::{StorageKey, StorageLogQuery, StorageValue, U256}; -use crate::old_vm::event_sink::InMemoryEventSink; -use crate::old_vm::history_recorder::{AppDataFrameManagerWithHistory, HistoryRecorder}; -use crate::{HistoryEnabled, HistoryMode, SimpleMemory, Vm}; +use crate::vm_latest::old_vm::event_sink::InMemoryEventSink; +use crate::vm_latest::old_vm::history_recorder::{AppDataFrameManagerWithHistory, HistoryRecorder}; +use crate::vm_latest::{HistoryEnabled, HistoryMode, SimpleMemory, Vm}; #[derive(Clone, Debug)] pub(crate) struct ModifiedKeysMap(HashMap); diff --git a/core/lib/vm/src/tests/tester/mod.rs b/core/lib/multivm/src/versions/vm_latest/tests/tester/mod.rs similarity index 100% rename from core/lib/vm/src/tests/tester/mod.rs rename to core/lib/multivm/src/versions/vm_latest/tests/tester/mod.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/tester/transaction_test_info.rs b/core/lib/multivm/src/versions/vm_latest/tests/tester/transaction_test_info.rs similarity index 98% rename from core/multivm_deps/vm_virtual_blocks/src/tests/tester/transaction_test_info.rs rename to core/lib/multivm/src/versions/vm_latest/tests/tester/transaction_test_info.rs index 65ceb3c5cf3c..3e69b696e584 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/tester/transaction_test_info.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/tester/transaction_test_info.rs @@ -1,8 +1,8 @@ use zksync_types::{ExecuteTransactionCommon, Transaction}; -use crate::errors::VmRevertReason; -use crate::tests::tester::vm_tester::VmTester; -use crate::{ +use crate::vm_latest::errors::VmRevertReason; +use crate::vm_latest::tests::tester::vm_tester::VmTester; +use crate::vm_latest::{ CurrentExecutionState, ExecutionResult, Halt, HistoryEnabled, TxRevertReason, VmExecutionMode, VmExecutionResultAndLogs, }; diff --git a/core/lib/vm/src/tests/tester/vm_tester.rs b/core/lib/multivm/src/versions/vm_latest/tests/tester/vm_tester.rs similarity index 95% rename from core/lib/vm/src/tests/tester/vm_tester.rs rename to core/lib/multivm/src/versions/vm_latest/tests/tester/vm_tester.rs index 07dbf89a8ebb..45603b1709e5 100644 --- a/core/lib/vm/src/tests/tester/vm_tester.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/tester/vm_tester.rs @@ -11,14 +11,16 @@ use zksync_types::{ use zksync_utils::bytecode::hash_bytecode; use zksync_utils::u256_to_h256; -use crate::constants::BLOCK_GAS_LIMIT; - -use crate::tests::tester::Account; -use crate::tests::tester::TxType; -use crate::tests::utils::read_test_contract; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::utils::l2_blocks::load_last_l2_block; -use crate::{HistoryMode, L1BatchEnv, L2Block, L2BlockEnv, SystemEnv, Vm, VmExecutionMode}; +use crate::vm_latest::constants::BLOCK_GAS_LIMIT; + +use crate::vm_latest::tests::tester::Account; +use crate::vm_latest::tests::tester::TxType; +use crate::vm_latest::tests::utils::read_test_contract; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; +use crate::vm_latest::utils::l2_blocks::load_last_l2_block; +use crate::vm_latest::{ + HistoryMode, L1BatchEnv, L2Block, L2BlockEnv, SystemEnv, Vm, VmExecutionMode, +}; pub(crate) type InMemoryStorageView = StorageView; diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/tracing_execution_error.rs b/core/lib/multivm/src/versions/vm_latest/tests/tracing_execution_error.rs similarity index 80% rename from core/multivm_deps/vm_virtual_blocks/src/tests/tracing_execution_error.rs rename to core/lib/multivm/src/versions/vm_latest/tests/tracing_execution_error.rs index dbe9f74a85bd..a3dbac639330 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/tracing_execution_error.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/tracing_execution_error.rs @@ -1,10 +1,12 @@ use zksync_types::{Execute, H160}; -use crate::errors::VmRevertReason; -use crate::tests::tester::{ExpectedError, TransactionTestInfo, VmTesterBuilder}; -use crate::tests::utils::{get_execute_error_calldata, read_error_contract, BASE_SYSTEM_CONTRACTS}; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{HistoryEnabled, TxRevertReason}; +use crate::vm_latest::errors::VmRevertReason; +use crate::vm_latest::tests::tester::{ExpectedError, TransactionTestInfo, VmTesterBuilder}; +use crate::vm_latest::tests::utils::{ + get_execute_error_calldata, read_error_contract, BASE_SYSTEM_CONTRACTS, +}; +use crate::vm_latest::types::inputs::system_env::TxExecutionMode; +use crate::vm_latest::{HistoryEnabled, TxRevertReason}; #[test] fn test_tracing_of_execution_errors() { diff --git a/core/lib/vm/src/tests/upgrade.rs b/core/lib/multivm/src/versions/vm_latest/tests/upgrade.rs similarity index 97% rename from core/lib/vm/src/tests/upgrade.rs rename to core/lib/multivm/src/versions/vm_latest/tests/upgrade.rs index 05646326ffd1..a37714f81ddf 100644 --- a/core/lib/vm/src/tests/upgrade.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/upgrade.rs @@ -1,4 +1,4 @@ -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_types::{ ethabi::Contract, @@ -14,9 +14,9 @@ use zksync_contracts::{deployer_contract, load_contract, load_sys_contract, read use zksync_state::WriteStorage; use zksync_test_account::TxType; -use crate::tests::tester::VmTesterBuilder; -use crate::tests::utils::verify_required_storage; -use crate::{ExecutionResult, Halt, HistoryEnabled, TxExecutionMode, VmExecutionMode}; +use crate::vm_latest::tests::tester::VmTesterBuilder; +use crate::vm_latest::tests::utils::verify_required_storage; +use crate::vm_latest::{ExecutionResult, Halt, HistoryEnabled, TxExecutionMode, VmExecutionMode}; use zksync_types::protocol_version::ProtocolUpgradeTxCommonData; use super::utils::read_test_contract; diff --git a/core/lib/vm/src/tests/utils.rs b/core/lib/multivm/src/versions/vm_latest/tests/utils.rs similarity index 95% rename from core/lib/vm/src/tests/utils.rs rename to core/lib/multivm/src/versions/vm_latest/tests/utils.rs index f709ebdd8ede..e30f0b9f39a4 100644 --- a/core/lib/vm/src/tests/utils.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/utils.rs @@ -1,7 +1,7 @@ use ethabi::Contract; use once_cell::sync::Lazy; -use crate::tests::tester::InMemoryStorageView; +use crate::vm_latest::tests::tester::InMemoryStorageView; use zksync_contracts::{ load_contract, read_bytecode, read_zbin_bytecode, BaseSystemContracts, SystemContractCode, }; @@ -11,8 +11,8 @@ use zksync_types::{AccountTreeId, Address, StorageKey, H256, U256}; use zksync_utils::bytecode::hash_bytecode; use zksync_utils::{bytes_to_be_words, h256_to_u256, u256_to_h256}; -use crate::types::internals::ZkSyncVmState; -use crate::HistoryMode; +use crate::vm_latest::types::internals::ZkSyncVmState; +use crate::vm_latest::HistoryMode; pub(crate) static BASE_SYSTEM_CONTRACTS: Lazy = Lazy::new(BaseSystemContracts::load_from_disk); diff --git a/core/lib/vm/src/tracers/call.rs b/core/lib/multivm/src/versions/vm_latest/tracers/call.rs similarity index 95% rename from core/lib/vm/src/tracers/call.rs rename to core/lib/multivm/src/versions/vm_latest/tracers/call.rs index 5cd7aff789c8..d4dc20f1b7ca 100644 --- a/core/lib/vm/src/tracers/call.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/call.rs @@ -2,8 +2,8 @@ use once_cell::sync::OnceCell; use std::marker::PhantomData; use std::sync::Arc; -use zk_evm::tracing::{AfterExecutionData, VmLocalStateData}; -use zk_evm::zkevm_opcode_defs::{ +use zk_evm_1_3_3::tracing::{AfterExecutionData, VmLocalStateData}; +use zk_evm_1_3_3::zkevm_opcode_defs::{ FarCallABI, FarCallOpcode, FatPointer, Opcode, RetOpcode, CALL_IMPLICIT_CALLDATA_FAT_PTR_REGISTER, RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }; @@ -13,11 +13,11 @@ use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_types::vm_trace::{Call, CallType}; use zksync_types::U256; -use crate::errors::VmRevertReason; -use crate::old_vm::history_recorder::HistoryMode; -use crate::old_vm::memory::SimpleMemory; -use crate::tracers::traits::{DynTracer, VmTracer}; -use crate::{BootloaderState, VmExecutionStopReason, ZkSyncVmState}; +use crate::vm_latest::errors::VmRevertReason; +use crate::vm_latest::old_vm::history_recorder::HistoryMode; +use crate::vm_latest::old_vm::memory::SimpleMemory; +use crate::vm_latest::tracers::traits::{DynTracer, VmTracer}; +use crate::vm_latest::{BootloaderState, VmExecutionStopReason, ZkSyncVmState}; #[derive(Debug, Clone)] pub struct CallTracer { diff --git a/core/lib/vm/src/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs similarity index 94% rename from core/lib/vm/src/tracers/default_tracers.rs rename to core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs index 1278990964a5..778b3d91b4ba 100644 --- a/core/lib/vm/src/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/default_tracers.rs @@ -1,6 +1,6 @@ use std::fmt::{Debug, Formatter}; -use zk_evm::{ +use zk_evm_1_3_3::{ tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, Tracer, VmLocalStateData, }, @@ -11,21 +11,21 @@ use zk_evm::{ use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::Timestamp; -use crate::bootloader_state::utils::apply_l2_block; -use crate::bootloader_state::BootloaderState; -use crate::constants::BOOTLOADER_HEAP_PAGE; -use crate::old_vm::history_recorder::HistoryMode; -use crate::old_vm::memory::SimpleMemory; -use crate::tracers::traits::{ +use crate::vm_latest::bootloader_state::utils::apply_l2_block; +use crate::vm_latest::bootloader_state::BootloaderState; +use crate::vm_latest::constants::BOOTLOADER_HEAP_PAGE; +use crate::vm_latest::old_vm::history_recorder::HistoryMode; +use crate::vm_latest::old_vm::memory::SimpleMemory; +use crate::vm_latest::tracers::traits::{ DynTracer, TracerExecutionStatus, TracerExecutionStopReason, VmTracer, }; -use crate::tracers::utils::{ +use crate::vm_latest::tracers::utils::{ computational_gas_price, gas_spent_on_bytecodes_and_long_messages_this_opcode, print_debug_if_needed, VmHook, }; -use crate::tracers::{RefundsTracer, ResultTracer}; -use crate::types::internals::ZkSyncVmState; -use crate::{Halt, VmExecutionMode, VmExecutionStopReason}; +use crate::vm_latest::tracers::{RefundsTracer, ResultTracer}; +use crate::vm_latest::types::internals::ZkSyncVmState; +use crate::vm_latest::{Halt, VmExecutionMode, VmExecutionStopReason}; /// Default tracer for the VM. It manages the other tracers execution and stop the vm when needed. pub(crate) struct DefaultExecutionTracer { @@ -134,7 +134,7 @@ impl Tracer for DefaultExecutionTracer { memory: &Self::SupportedMemory, ) { if let VmExecutionMode::Bootloader = self.execution_mode { - let (next_opcode, _, _) = zk_evm::vm_state::read_and_decode( + let (next_opcode, _, _) = zk_evm_1_3_3::vm_state::read_and_decode( state.vm_local_state, memory, &mut DummyTracer, diff --git a/core/lib/vm/src/tracers/mod.rs b/core/lib/multivm/src/versions/vm_latest/tracers/mod.rs similarity index 100% rename from core/lib/vm/src/tracers/mod.rs rename to core/lib/multivm/src/versions/vm_latest/tracers/mod.rs diff --git a/core/lib/vm/src/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs similarity index 95% rename from core/lib/vm/src/tracers/refunds.rs rename to core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs index ed4e2c963423..66856d19a402 100644 --- a/core/lib/vm/src/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/refunds.rs @@ -1,6 +1,6 @@ use vise::{Buckets, EncodeLabelSet, EncodeLabelValue, Family, Histogram, Metrics}; -use zk_evm::{ +use zk_evm_1_3_3::{ aux_structures::Timestamp, tracing::{BeforeExecutionData, VmLocalStateData}, vm_state::VmLocalState, @@ -15,20 +15,22 @@ use zksync_types::{ use zksync_utils::bytecode::bytecode_len_in_bytes; use zksync_utils::{ceil_div_u256, u256_to_h256}; -use crate::constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}; -use crate::old_vm::{ +use crate::vm_latest::constants::{ + BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET, +}; +use crate::vm_latest::old_vm::{ events::merge_events, history_recorder::HistoryMode, memory::SimpleMemory, utils::eth_price_per_pubdata_byte, }; -use crate::bootloader_state::BootloaderState; -use crate::tracers::utils::gas_spent_on_bytecodes_and_long_messages_this_opcode; -use crate::tracers::{ +use crate::vm_latest::bootloader_state::BootloaderState; +use crate::vm_latest::tracers::utils::gas_spent_on_bytecodes_and_long_messages_this_opcode; +use crate::vm_latest::tracers::{ traits::{DynTracer, VmTracer}, utils::{get_vm_hook_params, VmHook}, }; -use crate::types::{inputs::L1BatchEnv, internals::ZkSyncVmState, outputs::Refunds}; -use crate::TracerExecutionStatus; +use crate::vm_latest::types::{inputs::L1BatchEnv, internals::ZkSyncVmState, outputs::Refunds}; +use crate::vm_latest::TracerExecutionStatus; /// Tracer responsible for collecting information about refunds. #[derive(Debug, Clone)] @@ -316,7 +318,7 @@ pub(crate) fn pubdata_published( }) .filter(|log| log.sender != SYSTEM_CONTEXT_ADDRESS) .count() as u32) - * zk_evm::zkevm_opcode_defs::system_params::L1_MESSAGE_PUBDATA_BYTES; + * zk_evm_1_3_3::zkevm_opcode_defs::system_params::L1_MESSAGE_PUBDATA_BYTES; let l2_l1_long_messages_bytes: u32 = extract_long_l2_to_l1_messages(&events) .iter() .map(|event| event.len() as u32) diff --git a/core/lib/vm/src/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs similarity index 93% rename from core/lib/vm/src/tracers/result_tracer.rs rename to core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs index 51c0ec4e9c5b..70f6f50e08b3 100644 --- a/core/lib/vm/src/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/result_tracer.rs @@ -1,4 +1,4 @@ -use zk_evm::{ +use zk_evm_1_3_3::{ tracing::{AfterDecodingData, BeforeExecutionData, VmLocalStateData}, vm_state::{ErrorFlags, VmLocalState}, zkevm_opcode_defs::FatPointer, @@ -7,23 +7,23 @@ use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::U256; -use crate::bootloader_state::BootloaderState; -use crate::errors::VmRevertReason; -use crate::old_vm::{ +use crate::vm_latest::bootloader_state::BootloaderState; +use crate::vm_latest::errors::VmRevertReason; +use crate::vm_latest::old_vm::{ history_recorder::HistoryMode, memory::SimpleMemory, utils::{vm_may_have_ended_inner, VmExecutionResult}, }; -use crate::tracers::{ +use crate::vm_latest::tracers::{ traits::{DynTracer, VmTracer}, utils::{get_vm_hook_params, read_pointer, VmHook}, }; -use crate::types::{internals::ZkSyncVmState, outputs::ExecutionResult}; +use crate::vm_latest::types::{internals::ZkSyncVmState, outputs::ExecutionResult}; -use crate::constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}; -use crate::tracers::traits::TracerExecutionStopReason; -use crate::{Halt, TxRevertReason}; -use crate::{VmExecutionMode, VmExecutionStopReason}; +use crate::vm_latest::constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}; +use crate::vm_latest::tracers::traits::TracerExecutionStopReason; +use crate::vm_latest::{Halt, TxRevertReason}; +use crate::vm_latest::{VmExecutionMode, VmExecutionStopReason}; #[derive(Debug, Clone)] enum Result { diff --git a/core/lib/vm/src/tracers/storage_invocations.rs b/core/lib/multivm/src/versions/vm_latest/tracers/storage_invocations.rs similarity index 82% rename from core/lib/vm/src/tracers/storage_invocations.rs rename to core/lib/multivm/src/versions/vm_latest/tracers/storage_invocations.rs index 48195e19d13c..f6982aa5519f 100644 --- a/core/lib/vm/src/tracers/storage_invocations.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/storage_invocations.rs @@ -1,10 +1,10 @@ -use crate::bootloader_state::BootloaderState; -use crate::old_vm::history_recorder::HistoryMode; -use crate::tracers::traits::{ +use crate::vm_latest::bootloader_state::BootloaderState; +use crate::vm_latest::old_vm::history_recorder::HistoryMode; +use crate::vm_latest::tracers::traits::{ DynTracer, TracerExecutionStatus, TracerExecutionStopReason, VmTracer, }; -use crate::types::internals::ZkSyncVmState; -use crate::Halt; +use crate::vm_latest::types::internals::ZkSyncVmState; +use crate::vm_latest::Halt; use zksync_state::WriteStorage; #[derive(Debug, Default, Clone)] diff --git a/core/lib/vm/src/tracers/traits.rs b/core/lib/multivm/src/versions/vm_latest/tracers/traits.rs similarity index 88% rename from core/lib/vm/src/tracers/traits.rs rename to core/lib/multivm/src/versions/vm_latest/tracers/traits.rs index b9aee9e64fa3..44f3b6073f9f 100644 --- a/core/lib/vm/src/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/traits.rs @@ -1,13 +1,13 @@ -use zk_evm::tracing::{ +use zk_evm_1_3_3::tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, VmLocalStateData, }; use zksync_state::{StoragePtr, WriteStorage}; -use crate::bootloader_state::BootloaderState; -use crate::old_vm::history_recorder::HistoryMode; -use crate::old_vm::memory::SimpleMemory; -use crate::types::internals::ZkSyncVmState; -use crate::{Halt, VmExecutionStopReason}; +use crate::vm_latest::bootloader_state::BootloaderState; +use crate::vm_latest::old_vm::history_recorder::HistoryMode; +use crate::vm_latest::old_vm::memory::SimpleMemory; +use crate::vm_latest::types::internals::ZkSyncVmState; +use crate::vm_latest::{Halt, VmExecutionStopReason}; /// Run tracer for collecting data during the vm execution cycles pub trait VmTracer: DynTracer { @@ -31,7 +31,7 @@ pub trait VmTracer: DynTracer { } } -/// Version of zk_evm::Tracer suitable for dynamic dispatch. +/// Version of zk_evm_1_3_3::Tracer suitable for dynamic dispatch. pub trait DynTracer { fn before_decoding(&mut self, _state: VmLocalStateData<'_>, _memory: &SimpleMemory) {} fn after_decoding( diff --git a/core/lib/vm/src/tracers/utils.rs b/core/lib/multivm/src/versions/vm_latest/tracers/utils.rs similarity index 94% rename from core/lib/vm/src/tracers/utils.rs rename to core/lib/multivm/src/versions/vm_latest/tracers/utils.rs index 3d966f03b911..b35e5f6aae89 100644 --- a/core/lib/vm/src/tracers/utils.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/utils.rs @@ -1,6 +1,6 @@ -use zk_evm::aux_structures::MemoryPage; -use zk_evm::zkevm_opcode_defs::{FarCallABI, FarCallForwardPageType}; -use zk_evm::{ +use zk_evm_1_3_3::aux_structures::MemoryPage; +use zk_evm_1_3_3::zkevm_opcode_defs::{FarCallABI, FarCallForwardPageType}; +use zk_evm_1_3_3::{ tracing::{BeforeExecutionData, VmLocalStateData}, zkevm_opcode_defs::{FatPointer, LogOpcode, Opcode, UMAOpcode}, }; @@ -12,13 +12,13 @@ use zksync_system_constants::{ use zksync_types::U256; use zksync_utils::u256_to_h256; -use crate::constants::{ +use crate::vm_latest::constants::{ BOOTLOADER_HEAP_PAGE, VM_HOOK_PARAMS_COUNT, VM_HOOK_PARAMS_START_POSITION, VM_HOOK_POSITION, }; -use crate::old_vm::history_recorder::HistoryMode; -use crate::old_vm::memory::SimpleMemory; -use crate::old_vm::utils::{aux_heap_page_from_base, heap_page_from_base}; -use crate::tracers::traits::TracerExecutionStopReason; +use crate::vm_latest::old_vm::history_recorder::HistoryMode; +use crate::vm_latest::old_vm::memory::SimpleMemory; +use crate::vm_latest::old_vm::utils::{aux_heap_page_from_base, heap_page_from_base}; +use crate::vm_latest::tracers::traits::TracerExecutionStopReason; #[derive(Clone, Debug, Copy)] pub(crate) enum VmHook { diff --git a/core/multivm_deps/vm_virtual_blocks/src/tracers/validation/error.rs b/core/lib/multivm/src/versions/vm_latest/tracers/validation/error.rs similarity index 95% rename from core/multivm_deps/vm_virtual_blocks/src/tracers/validation/error.rs rename to core/lib/multivm/src/versions/vm_latest/tracers/validation/error.rs index 8fb104cb67a3..55d19a99a48a 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tracers/validation/error.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/validation/error.rs @@ -1,4 +1,4 @@ -use crate::Halt; +use crate::vm_latest::Halt; use std::fmt::Display; use zksync_types::vm_trace::ViolatedValidationRule; diff --git a/core/lib/vm/src/tracers/validation/mod.rs b/core/lib/multivm/src/versions/vm_latest/tracers/validation/mod.rs similarity index 98% rename from core/lib/vm/src/tracers/validation/mod.rs rename to core/lib/multivm/src/versions/vm_latest/tracers/validation/mod.rs index bb020b8f59de..644af33b7f6b 100644 --- a/core/lib/vm/src/tracers/validation/mod.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/validation/mod.rs @@ -6,7 +6,7 @@ use std::sync::Arc; use std::{collections::HashSet, marker::PhantomData}; use once_cell::sync::OnceCell; -use zk_evm::{ +use zk_evm_1_3_3::{ tracing::{BeforeExecutionData, VmLocalStateData}, zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; @@ -26,12 +26,12 @@ use zksync_utils::{ be_bytes_to_safe_address, h256_to_account_address, u256_to_account_address, u256_to_h256, }; -use crate::old_vm::history_recorder::HistoryMode; -use crate::old_vm::memory::SimpleMemory; -use crate::tracers::traits::{ +use crate::vm_latest::old_vm::history_recorder::HistoryMode; +use crate::vm_latest::old_vm::memory::SimpleMemory; +use crate::vm_latest::tracers::traits::{ DynTracer, TracerExecutionStatus, TracerExecutionStopReason, VmTracer, }; -use crate::tracers::utils::{ +use crate::vm_latest::tracers::utils::{ computational_gas_price, get_calldata_page_via_abi, print_debug_if_needed, VmHook, }; @@ -41,7 +41,7 @@ pub use params::ValidationTracerParams; use types::NewTrustedValidationItems; use types::ValidationTracerMode; -use crate::{BootloaderState, Halt, ZkSyncVmState}; +use crate::vm_latest::{BootloaderState, Halt, ZkSyncVmState}; /// Tracer that is used to ensure that the validation adheres to all the rules /// to prevent DDoS attacks on the server. diff --git a/core/lib/vm/src/tracers/validation/params.rs b/core/lib/multivm/src/versions/vm_latest/tracers/validation/params.rs similarity index 100% rename from core/lib/vm/src/tracers/validation/params.rs rename to core/lib/multivm/src/versions/vm_latest/tracers/validation/params.rs diff --git a/core/lib/vm/src/tracers/validation/types.rs b/core/lib/multivm/src/versions/vm_latest/tracers/validation/types.rs similarity index 100% rename from core/lib/vm/src/tracers/validation/types.rs rename to core/lib/multivm/src/versions/vm_latest/tracers/validation/types.rs diff --git a/core/lib/vm/src/types/inputs/execution_mode.rs b/core/lib/multivm/src/versions/vm_latest/types/inputs/execution_mode.rs similarity index 100% rename from core/lib/vm/src/types/inputs/execution_mode.rs rename to core/lib/multivm/src/versions/vm_latest/types/inputs/execution_mode.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/inputs/l1_batch_env.rs b/core/lib/multivm/src/versions/vm_latest/types/inputs/l1_batch_env.rs similarity index 94% rename from core/multivm_deps/vm_virtual_blocks/src/types/inputs/l1_batch_env.rs rename to core/lib/multivm/src/versions/vm_latest/types/inputs/l1_batch_env.rs index ff8433257698..c41099cbcd58 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/types/inputs/l1_batch_env.rs +++ b/core/lib/multivm/src/versions/vm_latest/types/inputs/l1_batch_env.rs @@ -1,11 +1,11 @@ use std::collections::HashMap; -use crate::L2BlockEnv; -use zk_evm::address_to_u256; +use crate::vm_latest::L2BlockEnv; +use zk_evm_1_3_3::address_to_u256; use zksync_types::{Address, L1BatchNumber, H256, U256}; use zksync_utils::h256_to_u256; -use crate::utils::fee::derive_base_fee_and_gas_per_pubdata; +use crate::vm_latest::utils::fee::derive_base_fee_and_gas_per_pubdata; /// Unique params for each block #[derive(Debug, Clone)] diff --git a/core/lib/vm/src/types/inputs/l2_block.rs b/core/lib/multivm/src/versions/vm_latest/types/inputs/l2_block.rs similarity index 100% rename from core/lib/vm/src/types/inputs/l2_block.rs rename to core/lib/multivm/src/versions/vm_latest/types/inputs/l2_block.rs diff --git a/core/lib/vm/src/types/inputs/mod.rs b/core/lib/multivm/src/versions/vm_latest/types/inputs/mod.rs similarity index 100% rename from core/lib/vm/src/types/inputs/mod.rs rename to core/lib/multivm/src/versions/vm_latest/types/inputs/mod.rs diff --git a/core/lib/vm/src/types/inputs/system_env.rs b/core/lib/multivm/src/versions/vm_latest/types/inputs/system_env.rs similarity index 100% rename from core/lib/vm/src/types/inputs/system_env.rs rename to core/lib/multivm/src/versions/vm_latest/types/inputs/system_env.rs diff --git a/core/lib/vm/src/types/internals/mod.rs b/core/lib/multivm/src/versions/vm_latest/types/internals/mod.rs similarity index 100% rename from core/lib/vm/src/types/internals/mod.rs rename to core/lib/multivm/src/versions/vm_latest/types/internals/mod.rs diff --git a/core/lib/vm/src/types/internals/snapshot.rs b/core/lib/multivm/src/versions/vm_latest/types/internals/snapshot.rs similarity index 71% rename from core/lib/vm/src/types/internals/snapshot.rs rename to core/lib/multivm/src/versions/vm_latest/types/internals/snapshot.rs index 3b336d5e3541..7391be4e4d59 100644 --- a/core/lib/vm/src/types/internals/snapshot.rs +++ b/core/lib/multivm/src/versions/vm_latest/types/internals/snapshot.rs @@ -1,6 +1,6 @@ -use zk_evm::vm_state::VmLocalState; +use zk_evm_1_3_3::vm_state::VmLocalState; -use crate::bootloader_state::BootloaderStateSnapshot; +use crate::vm_latest::bootloader_state::BootloaderStateSnapshot; /// A snapshot of the VM that holds enough information to /// rollback the VM to some historical state. diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/internals/transaction_data.rs b/core/lib/multivm/src/versions/vm_latest/types/internals/transaction_data.rs similarity index 99% rename from core/multivm_deps/vm_virtual_blocks/src/types/internals/transaction_data.rs rename to core/lib/multivm/src/versions/vm_latest/types/internals/transaction_data.rs index 7d8598842d83..f81741d2a431 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/types/internals/transaction_data.rs +++ b/core/lib/multivm/src/versions/vm_latest/types/internals/transaction_data.rs @@ -11,7 +11,7 @@ use zksync_types::{ use zksync_utils::address_to_h256; use zksync_utils::{bytecode::hash_bytecode, bytes_to_be_words, h256_to_u256}; -use crate::utils::overhead::{get_amortized_overhead, OverheadCoeficients}; +use crate::vm_latest::utils::overhead::{get_amortized_overhead, OverheadCoeficients}; /// This structure represents the data that is used by /// the Bootloader to describe the transaction. diff --git a/core/lib/vm/src/types/internals/vm_state.rs b/core/lib/multivm/src/versions/vm_latest/types/internals/vm_state.rs similarity index 93% rename from core/lib/vm/src/types/internals/vm_state.rs rename to core/lib/multivm/src/versions/vm_latest/types/internals/vm_state.rs index 363408293aa9..66f2b0486b89 100644 --- a/core/lib/vm/src/types/internals/vm_state.rs +++ b/core/lib/multivm/src/versions/vm_latest/types/internals/vm_state.rs @@ -1,4 +1,4 @@ -use zk_evm::{ +use zk_evm_1_3_3::{ aux_structures::MemoryPage, aux_structures::Timestamp, block_properties::BlockProperties, @@ -10,7 +10,7 @@ use zk_evm::{ }, }; -use zk_evm::zkevm_opcode_defs::{ +use zk_evm_1_3_3::zkevm_opcode_defs::{ BOOTLOADER_BASE_PAGE, BOOTLOADER_CODE_PAGE, STARTING_BASE_PAGE, STARTING_TIMESTAMP, }; use zksync_state::{StoragePtr, WriteStorage}; @@ -19,16 +19,16 @@ use zksync_types::block::legacy_miniblock_hash; use zksync_types::{zkevm_test_harness::INITIAL_MONOTONIC_CYCLE_COUNTER, Address, MiniblockNumber}; use zksync_utils::h256_to_u256; -use crate::bootloader_state::BootloaderState; -use crate::constants::BOOTLOADER_HEAP_PAGE; -use crate::old_vm::{ +use crate::vm_latest::bootloader_state::BootloaderState; +use crate::vm_latest::constants::BOOTLOADER_HEAP_PAGE; +use crate::vm_latest::old_vm::{ event_sink::InMemoryEventSink, history_recorder::HistoryMode, memory::SimpleMemory, oracles::decommitter::DecommitterOracle, oracles::precompile::PrecompilesProcessorWithHistory, }; -use crate::oracles::storage::StorageOracle; -use crate::types::inputs::{L1BatchEnv, SystemEnv}; -use crate::utils::l2_blocks::{assert_next_block, load_last_l2_block}; -use crate::L2Block; +use crate::vm_latest::oracles::storage::StorageOracle; +use crate::vm_latest::types::inputs::{L1BatchEnv, SystemEnv}; +use crate::vm_latest::utils::l2_blocks::{assert_next_block, load_last_l2_block}; +use crate::vm_latest::L2Block; pub type ZkSyncVmState = VmState< StorageOracle, diff --git a/core/lib/vm/src/types/mod.rs b/core/lib/multivm/src/versions/vm_latest/types/mod.rs similarity index 100% rename from core/lib/vm/src/types/mod.rs rename to core/lib/multivm/src/versions/vm_latest/types/mod.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/outputs/execution_result.rs b/core/lib/multivm/src/versions/vm_latest/types/outputs/execution_result.rs similarity index 97% rename from core/multivm_deps/vm_virtual_blocks/src/types/outputs/execution_result.rs rename to core/lib/multivm/src/versions/vm_latest/types/outputs/execution_result.rs index 44aa053bfc15..ca7ba39450df 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/types/outputs/execution_result.rs +++ b/core/lib/multivm/src/versions/vm_latest/types/outputs/execution_result.rs @@ -1,4 +1,4 @@ -use crate::{Halt, VmExecutionStatistics, VmRevertReason}; +use crate::vm_latest::{Halt, VmExecutionStatistics, VmRevertReason}; use zksync_system_constants::PUBLISH_BYTECODE_OVERHEAD; use zksync_types::event::{extract_long_l2_to_l1_messages, extract_published_bytecodes}; use zksync_types::tx::tx_execution_info::VmExecutionLogs; diff --git a/core/lib/vm/src/types/outputs/execution_state.rs b/core/lib/multivm/src/versions/vm_latest/types/outputs/execution_state.rs similarity index 100% rename from core/lib/vm/src/types/outputs/execution_state.rs rename to core/lib/multivm/src/versions/vm_latest/types/outputs/execution_state.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/outputs/finished_l1batch.rs b/core/lib/multivm/src/versions/vm_latest/types/outputs/finished_l1batch.rs similarity index 85% rename from core/multivm_deps/vm_virtual_blocks/src/types/outputs/finished_l1batch.rs rename to core/lib/multivm/src/versions/vm_latest/types/outputs/finished_l1batch.rs index 064d4c2d6586..e2e51f15ffe2 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/types/outputs/finished_l1batch.rs +++ b/core/lib/multivm/src/versions/vm_latest/types/outputs/finished_l1batch.rs @@ -1,4 +1,4 @@ -use crate::{BootloaderMemory, CurrentExecutionState, VmExecutionResultAndLogs}; +use crate::vm_latest::{BootloaderMemory, CurrentExecutionState, VmExecutionResultAndLogs}; /// State of the VM after the batch execution. #[derive(Debug, Clone)] diff --git a/core/lib/vm/src/types/outputs/l2_block.rs b/core/lib/multivm/src/versions/vm_latest/types/outputs/l2_block.rs similarity index 100% rename from core/lib/vm/src/types/outputs/l2_block.rs rename to core/lib/multivm/src/versions/vm_latest/types/outputs/l2_block.rs diff --git a/core/lib/vm/src/types/outputs/mod.rs b/core/lib/multivm/src/versions/vm_latest/types/outputs/mod.rs similarity index 100% rename from core/lib/vm/src/types/outputs/mod.rs rename to core/lib/multivm/src/versions/vm_latest/types/outputs/mod.rs diff --git a/core/lib/vm/src/types/outputs/statistic.rs b/core/lib/multivm/src/versions/vm_latest/types/outputs/statistic.rs similarity index 100% rename from core/lib/vm/src/types/outputs/statistic.rs rename to core/lib/multivm/src/versions/vm_latest/types/outputs/statistic.rs diff --git a/core/lib/vm/src/utils/fee.rs b/core/lib/multivm/src/versions/vm_latest/utils/fee.rs similarity index 94% rename from core/lib/vm/src/utils/fee.rs rename to core/lib/multivm/src/versions/vm_latest/utils/fee.rs index b89c996575a2..bbf09a75f3fc 100644 --- a/core/lib/vm/src/utils/fee.rs +++ b/core/lib/multivm/src/versions/vm_latest/utils/fee.rs @@ -2,7 +2,7 @@ use zksync_system_constants::MAX_GAS_PER_PUBDATA_BYTE; use zksync_utils::ceil_div; -use crate::old_vm::utils::eth_price_per_pubdata_byte; +use crate::vm_latest::old_vm::utils::eth_price_per_pubdata_byte; /// Calcluates the amount of gas required to publish one byte of pubdata pub fn base_fee_to_gas_per_pubdata(l1_gas_price: u64, base_fee: u64) -> u64 { diff --git a/core/multivm_deps/vm_virtual_blocks/src/utils/l2_blocks.rs b/core/lib/multivm/src/versions/vm_latest/utils/l2_blocks.rs similarity index 98% rename from core/multivm_deps/vm_virtual_blocks/src/utils/l2_blocks.rs rename to core/lib/multivm/src/versions/vm_latest/utils/l2_blocks.rs index 189ad8e79c5d..2b97cd71df8a 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/utils/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_latest/utils/l2_blocks.rs @@ -1,4 +1,4 @@ -use crate::{L2Block, L2BlockEnv}; +use crate::vm_latest::{L2Block, L2BlockEnv}; use zksync_state::{ReadStorage, StoragePtr}; use zksync_system_constants::{ SYSTEM_CONTEXT_ADDRESS, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION, diff --git a/core/lib/vm/src/utils/mod.rs b/core/lib/multivm/src/versions/vm_latest/utils/mod.rs similarity index 100% rename from core/lib/vm/src/utils/mod.rs rename to core/lib/multivm/src/versions/vm_latest/utils/mod.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/utils/overhead.rs b/core/lib/multivm/src/versions/vm_latest/utils/overhead.rs similarity index 98% rename from core/multivm_deps/vm_virtual_blocks/src/utils/overhead.rs rename to core/lib/multivm/src/versions/vm_latest/utils/overhead.rs index 1d502ef2d152..58506cb1d52d 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/utils/overhead.rs +++ b/core/lib/multivm/src/versions/vm_latest/utils/overhead.rs @@ -1,5 +1,7 @@ -use crate::constants::{BLOCK_OVERHEAD_GAS, BLOCK_OVERHEAD_PUBDATA, BOOTLOADER_TX_ENCODING_SPACE}; -use zk_evm::zkevm_opcode_defs::system_params::MAX_TX_ERGS_LIMIT; +use crate::vm_latest::constants::{ + BLOCK_OVERHEAD_GAS, BLOCK_OVERHEAD_PUBDATA, BOOTLOADER_TX_ENCODING_SPACE, +}; +use zk_evm_1_3_3::zkevm_opcode_defs::system_params::MAX_TX_ERGS_LIMIT; use zksync_system_constants::{MAX_L2_TX_GAS_LIMIT, MAX_TXS_IN_BLOCK}; use zksync_types::l1::is_l1_tx_type; use zksync_types::U256; diff --git a/core/lib/vm/src/utils/transaction_encoding.rs b/core/lib/multivm/src/versions/vm_latest/utils/transaction_encoding.rs similarity index 89% rename from core/lib/vm/src/utils/transaction_encoding.rs rename to core/lib/multivm/src/versions/vm_latest/utils/transaction_encoding.rs index e911a2805d82..9aecef6367ee 100644 --- a/core/lib/vm/src/utils/transaction_encoding.rs +++ b/core/lib/multivm/src/versions/vm_latest/utils/transaction_encoding.rs @@ -1,4 +1,4 @@ -use crate::types::internals::TransactionData; +use crate::vm_latest::types::internals::TransactionData; use zksync_types::Transaction; /// Extension for transactions, specific for VM. Required for bypassing the orphan rule diff --git a/core/lib/vm/src/vm.rs b/core/lib/multivm/src/versions/vm_latest/vm.rs similarity index 94% rename from core/lib/vm/src/vm.rs rename to core/lib/multivm/src/versions/vm_latest/vm.rs index ee196683db37..13efe7741e21 100644 --- a/core/lib/vm/src/vm.rs +++ b/core/lib/multivm/src/versions/vm_latest/vm.rs @@ -2,18 +2,18 @@ use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::Transaction; use zksync_utils::bytecode::CompressedBytecodeInfo; -use crate::old_vm::events::merge_events; -use crate::old_vm::history_recorder::{HistoryEnabled, HistoryMode}; +use crate::vm_latest::old_vm::events::merge_events; +use crate::vm_latest::old_vm::history_recorder::{HistoryEnabled, HistoryMode}; -use crate::bootloader_state::BootloaderState; -use crate::errors::BytecodeCompressionError; -use crate::tracers::traits::VmTracer; -use crate::types::{ +use crate::vm_latest::bootloader_state::BootloaderState; +use crate::vm_latest::errors::BytecodeCompressionError; +use crate::vm_latest::tracers::traits::VmTracer; +use crate::vm_latest::types::{ inputs::{L1BatchEnv, SystemEnv, VmExecutionMode}, internals::{new_vm_state, VmSnapshot, ZkSyncVmState}, outputs::{BootloaderMemory, CurrentExecutionState, VmExecutionResultAndLogs}, }; -use crate::L2BlockEnv; +use crate::vm_latest::L2BlockEnv; /// Main entry point for Virtual Machine integration. /// The instance should process only one l1 batch diff --git a/core/multivm_deps/vm_m5/src/bootloader_state.rs b/core/lib/multivm/src/versions/vm_m5/bootloader_state.rs similarity index 98% rename from core/multivm_deps/vm_m5/src/bootloader_state.rs rename to core/lib/multivm/src/versions/vm_m5/bootloader_state.rs index 33ef26961bfb..518d999b6ea5 100644 --- a/core/multivm_deps/vm_m5/src/bootloader_state.rs +++ b/core/lib/multivm/src/versions/vm_m5/bootloader_state.rs @@ -1,4 +1,4 @@ -use crate::vm_with_bootloader::TX_DESCRIPTION_OFFSET; +use crate::vm_m5::vm_with_bootloader::TX_DESCRIPTION_OFFSET; /// Intermediate bootloader-related VM state. /// diff --git a/core/multivm_deps/vm_m5/src/errors/bootloader_error.rs b/core/lib/multivm/src/versions/vm_m5/errors/bootloader_error.rs similarity index 100% rename from core/multivm_deps/vm_m5/src/errors/bootloader_error.rs rename to core/lib/multivm/src/versions/vm_m5/errors/bootloader_error.rs diff --git a/core/multivm_deps/vm_m5/src/errors/mod.rs b/core/lib/multivm/src/versions/vm_m5/errors/mod.rs similarity index 100% rename from core/multivm_deps/vm_m5/src/errors/mod.rs rename to core/lib/multivm/src/versions/vm_m5/errors/mod.rs diff --git a/core/multivm_deps/vm_m5/src/errors/tx_revert_reason.rs b/core/lib/multivm/src/versions/vm_m5/errors/tx_revert_reason.rs similarity index 100% rename from core/multivm_deps/vm_m5/src/errors/tx_revert_reason.rs rename to core/lib/multivm/src/versions/vm_m5/errors/tx_revert_reason.rs diff --git a/core/multivm_deps/vm_m5/src/errors/vm_revert_reason.rs b/core/lib/multivm/src/versions/vm_m5/errors/vm_revert_reason.rs similarity index 99% rename from core/multivm_deps/vm_m5/src/errors/vm_revert_reason.rs rename to core/lib/multivm/src/versions/vm_m5/errors/vm_revert_reason.rs index e8686cb75f41..1997336c3a4e 100644 --- a/core/multivm_deps/vm_m5/src/errors/vm_revert_reason.rs +++ b/core/lib/multivm/src/versions/vm_m5/errors/vm_revert_reason.rs @@ -3,7 +3,7 @@ use std::fmt::{Debug, Display}; use zksync_types::U256; -use crate::TxRevertReason; +use crate::vm_m5::TxRevertReason; #[derive(Debug, thiserror::Error)] pub enum VmRevertReasonParsingError { diff --git a/core/multivm_deps/vm_m5/src/event_sink.rs b/core/lib/multivm/src/versions/vm_m5/event_sink.rs similarity index 97% rename from core/multivm_deps/vm_m5/src/event_sink.rs rename to core/lib/multivm/src/versions/vm_m5/event_sink.rs index a8d95cbfa3f3..80ceb8baeaa9 100644 --- a/core/multivm_deps/vm_m5/src/event_sink.rs +++ b/core/lib/multivm/src/versions/vm_m5/event_sink.rs @@ -1,6 +1,6 @@ -use crate::{oracles::OracleWithHistory, utils::collect_log_queries_after_timestamp}; +use crate::vm_m5::{oracles::OracleWithHistory, utils::collect_log_queries_after_timestamp}; use std::collections::HashMap; -use zk_evm::{ +use zk_evm_1_3_1::{ abstractions::EventSink, aux_structures::{LogQuery, Timestamp}, reference_impls::event_sink::{ApplicationData, EventMessage}, @@ -9,7 +9,7 @@ use zk_evm::{ }, }; -use crate::history_recorder::AppDataFrameManagerWithHistory; +use crate::vm_m5::history_recorder::AppDataFrameManagerWithHistory; #[derive(Debug, Default, Clone, PartialEq)] pub struct InMemoryEventSink { diff --git a/core/multivm_deps/vm_1_3_2/src/events.rs b/core/lib/multivm/src/versions/vm_m5/events.rs similarity index 98% rename from core/multivm_deps/vm_1_3_2/src/events.rs rename to core/lib/multivm/src/versions/vm_m5/events.rs index 0d11d9102ea2..146c938021a7 100644 --- a/core/multivm_deps/vm_1_3_2/src/events.rs +++ b/core/lib/multivm/src/versions/vm_m5/events.rs @@ -1,4 +1,4 @@ -use zk_evm::{ethereum_types::Address, reference_impls::event_sink::EventMessage}; +use zk_evm_1_3_1::{ethereum_types::Address, reference_impls::event_sink::EventMessage}; use zksync_types::{L1BatchNumber, VmEvent, EVENT_WRITER_ADDRESS, H256}; use zksync_utils::{be_chunks_to_h256_words, h256_to_account_address}; diff --git a/core/multivm_deps/vm_m5/src/glue.rs b/core/lib/multivm/src/versions/vm_m5/glue.rs similarity index 70% rename from core/multivm_deps/vm_m5/src/glue.rs rename to core/lib/multivm/src/versions/vm_m5/glue.rs index 6ba7f0f4a478..b2116a098511 100644 --- a/core/multivm_deps/vm_m5/src/glue.rs +++ b/core/lib/multivm/src/versions/vm_m5/glue.rs @@ -24,14 +24,14 @@ impl GlueFrom for T { } } -impl GlueFrom for zksync_types::Timestamp { - fn glue_from(timestamp: zk_evm::aux_structures::Timestamp) -> Self { +impl GlueFrom for zksync_types::Timestamp { + fn glue_from(timestamp: zk_evm_1_3_1::aux_structures::Timestamp) -> Self { zksync_types::Timestamp(timestamp.0) } } -impl GlueFrom for zksync_types::LogQuery { - fn glue_from(query: zk_evm::aux_structures::LogQuery) -> Self { +impl GlueFrom for zksync_types::LogQuery { + fn glue_from(query: zk_evm_1_3_1::aux_structures::LogQuery) -> Self { zksync_types::LogQuery { address: query.address, key: query.key, @@ -48,15 +48,15 @@ impl GlueFrom for zksync_types::LogQuery { } } -impl GlueFrom for zk_evm::aux_structures::Timestamp { +impl GlueFrom for zk_evm_1_3_1::aux_structures::Timestamp { fn glue_from(timestamp: zksync_types::Timestamp) -> Self { - zk_evm::aux_structures::Timestamp(timestamp.0) + zk_evm_1_3_1::aux_structures::Timestamp(timestamp.0) } } -impl GlueFrom for zk_evm::aux_structures::LogQuery { +impl GlueFrom for zk_evm_1_3_1::aux_structures::LogQuery { fn glue_from(query: zksync_types::LogQuery) -> Self { - zk_evm::aux_structures::LogQuery { + zk_evm_1_3_1::aux_structures::LogQuery { address: query.address, key: query.key, written_value: query.written_value, @@ -72,8 +72,10 @@ impl GlueFrom for zk_evm::aux_structures::LogQuery { } } -impl GlueFrom for zksync_types::EventMessage { - fn glue_from(event: zk_evm::reference_impls::event_sink::EventMessage) -> Self { +impl GlueFrom + for zksync_types::EventMessage +{ + fn glue_from(event: zk_evm_1_3_1::reference_impls::event_sink::EventMessage) -> Self { zksync_types::EventMessage { shard_id: event.shard_id, is_first: event.is_first, diff --git a/core/multivm_deps/vm_m5/src/history_recorder.rs b/core/lib/multivm/src/versions/vm_m5/history_recorder.rs similarity index 99% rename from core/multivm_deps/vm_m5/src/history_recorder.rs rename to core/lib/multivm/src/versions/vm_m5/history_recorder.rs index 8631c0c35036..896b2261e9c5 100644 --- a/core/multivm_deps/vm_m5/src/history_recorder.rs +++ b/core/lib/multivm/src/versions/vm_m5/history_recorder.rs @@ -3,9 +3,9 @@ use std::{ hash::{BuildHasherDefault, Hash, Hasher}, }; -use crate::storage::{Storage, StoragePtr}; +use crate::vm_m5::storage::{Storage, StoragePtr}; -use zk_evm::{ +use zk_evm_1_3_1::{ aux_structures::Timestamp, reference_impls::event_sink::ApplicationData, vm_state::PrimitiveValue, diff --git a/core/multivm_deps/vm_m5/src/memory.rs b/core/lib/multivm/src/versions/vm_m5/memory.rs similarity index 95% rename from core/multivm_deps/vm_m5/src/memory.rs rename to core/lib/multivm/src/versions/vm_m5/memory.rs index 4591bf916847..2c0b317a798a 100644 --- a/core/multivm_deps/vm_m5/src/memory.rs +++ b/core/lib/multivm/src/versions/vm_m5/memory.rs @@ -1,12 +1,12 @@ -use zk_evm::abstractions::{Memory, MemoryType, MEMORY_CELLS_OTHER_PAGES}; -use zk_evm::aux_structures::{MemoryPage, MemoryQuery, Timestamp}; -use zk_evm::vm_state::PrimitiveValue; -use zk_evm::zkevm_opcode_defs::FatPointer; +use zk_evm_1_3_1::abstractions::{Memory, MemoryType, MEMORY_CELLS_OTHER_PAGES}; +use zk_evm_1_3_1::aux_structures::{MemoryPage, MemoryQuery, Timestamp}; +use zk_evm_1_3_1::vm_state::PrimitiveValue; +use zk_evm_1_3_1::zkevm_opcode_defs::FatPointer; use zksync_types::U256; -use crate::history_recorder::{IntFrameManagerWithHistory, MemoryWithHistory}; -use crate::oracles::OracleWithHistory; -use crate::utils::{aux_heap_page_from_base, heap_page_from_base, stack_page_from_base}; +use crate::vm_m5::history_recorder::{IntFrameManagerWithHistory, MemoryWithHistory}; +use crate::vm_m5::oracles::OracleWithHistory; +use crate::vm_m5::utils::{aux_heap_page_from_base, heap_page_from_base, stack_page_from_base}; #[derive(Debug, Default, Clone, PartialEq)] pub struct SimpleMemory { diff --git a/core/multivm_deps/vm_m5/src/lib.rs b/core/lib/multivm/src/versions/vm_m5/mod.rs similarity index 73% rename from core/multivm_deps/vm_m5/src/lib.rs rename to core/lib/multivm/src/versions/vm_m5/mod.rs index bd6b9364eceb..c501398ea1df 100644 --- a/core/multivm_deps/vm_m5/src/lib.rs +++ b/core/lib/multivm/src/versions/vm_m5/mod.rs @@ -21,13 +21,13 @@ pub mod vm_with_bootloader; #[cfg(test)] mod tests; -pub use crate::errors::TxRevertReason; -pub use crate::oracle_tools::OracleTools; -pub use crate::oracles::storage::StorageOracle; -pub use crate::vm::VmBlockResult; -pub use crate::vm::VmExecutionResult; -pub use crate::vm::VmInstance; -pub use zk_evm; +pub use errors::TxRevertReason; +pub use oracle_tools::OracleTools; +pub use oracles::storage::StorageOracle; +pub use vm::VmBlockResult; +pub use vm::VmExecutionResult; +pub use vm::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/multivm_deps/vm_m5/src/oracle_tools.rs b/core/lib/multivm/src/versions/vm_m5/oracle_tools.rs similarity index 70% rename from core/multivm_deps/vm_m5/src/oracle_tools.rs rename to core/lib/multivm/src/versions/vm_m5/oracle_tools.rs index a3d368457987..47239c435d58 100644 --- a/core/multivm_deps/vm_m5/src/oracle_tools.rs +++ b/core/lib/multivm/src/versions/vm_m5/oracle_tools.rs @@ -1,14 +1,14 @@ -use crate::memory::SimpleMemory; -use crate::vm::MultiVMSubversion; +use crate::vm_m5::memory::SimpleMemory; +use crate::vm_m5::vm::MultiVMSubversion; use std::fmt::Debug; -use crate::event_sink::InMemoryEventSink; -use crate::oracles::decommitter::DecommitterOracle; -use crate::oracles::precompile::PrecompilesProcessorWithHistory; -use crate::oracles::storage::StorageOracle; -use crate::storage::{Storage, StoragePtr}; -use zk_evm::witness_trace::DummyTracer; +use crate::vm_m5::event_sink::InMemoryEventSink; +use crate::vm_m5::oracles::decommitter::DecommitterOracle; +use crate::vm_m5::oracles::precompile::PrecompilesProcessorWithHistory; +use crate::vm_m5::oracles::storage::StorageOracle; +use crate::vm_m5::storage::{Storage, StoragePtr}; +use zk_evm_1_3_1::witness_trace::DummyTracer; #[derive(Debug)] pub struct OracleTools { diff --git a/core/multivm_deps/vm_m5/src/oracles/decommitter.rs b/core/lib/multivm/src/versions/vm_m5/oracles/decommitter.rs similarity index 96% rename from core/multivm_deps/vm_m5/src/oracles/decommitter.rs rename to core/lib/multivm/src/versions/vm_m5/oracles/decommitter.rs index 4498869d03e7..24a18f998dfe 100644 --- a/core/multivm_deps/vm_m5/src/oracles/decommitter.rs +++ b/core/lib/multivm/src/versions/vm_m5/oracles/decommitter.rs @@ -1,11 +1,11 @@ use std::collections::HashMap; -use crate::history_recorder::HistoryRecorder; -use crate::storage::{Storage, StoragePtr}; +use crate::vm_m5::history_recorder::HistoryRecorder; +use crate::vm_m5::storage::{Storage, StoragePtr}; -use zk_evm::abstractions::MemoryType; -use zk_evm::aux_structures::Timestamp; -use zk_evm::{ +use zk_evm_1_3_1::abstractions::MemoryType; +use zk_evm_1_3_1::aux_structures::Timestamp; +use zk_evm_1_3_1::{ abstractions::{DecommittmentProcessor, Memory}, aux_structures::{DecommittmentQuery, MemoryIndex, MemoryLocation, MemoryPage, MemoryQuery}, }; diff --git a/core/multivm_deps/vm_m5/src/oracles/mod.rs b/core/lib/multivm/src/versions/vm_m5/oracles/mod.rs similarity index 61% rename from core/multivm_deps/vm_m5/src/oracles/mod.rs rename to core/lib/multivm/src/versions/vm_m5/oracles/mod.rs index 5b9378729ed8..31686fa70f6e 100644 --- a/core/multivm_deps/vm_m5/src/oracles/mod.rs +++ b/core/lib/multivm/src/versions/vm_m5/oracles/mod.rs @@ -1,12 +1,12 @@ -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_1::aux_structures::Timestamp; // We will discard RAM as soon as the execution of a tx ends, so // it is ok for now to use SimpleMemory -pub use zk_evm::reference_impls::memory::SimpleMemory as RamOracle; +pub use zk_evm_1_3_1::reference_impls::memory::SimpleMemory as RamOracle; // All the changes to the events in the DB will be applied after the tx is executed, // so fow now it is fine. -pub use zk_evm::reference_impls::event_sink::InMemoryEventSink as EventSinkOracle; +pub use zk_evm_1_3_1::reference_impls::event_sink::InMemoryEventSink as EventSinkOracle; -pub use zk_evm::testing::simple_tracer::NoopTracer; +pub use zk_evm_1_3_1::testing::simple_tracer::NoopTracer; pub mod decommitter; pub mod precompile; diff --git a/core/multivm_deps/vm_m5/src/oracles/precompile.rs b/core/lib/multivm/src/versions/vm_m5/oracles/precompile.rs similarity index 97% rename from core/multivm_deps/vm_m5/src/oracles/precompile.rs rename to core/lib/multivm/src/versions/vm_m5/oracles/precompile.rs index 3374be5caa96..853ce7d8cec0 100644 --- a/core/multivm_deps/vm_m5/src/oracles/precompile.rs +++ b/core/lib/multivm/src/versions/vm_m5/oracles/precompile.rs @@ -1,4 +1,4 @@ -use zk_evm::{ +use zk_evm_1_3_1::{ abstractions::Memory, abstractions::PrecompileCyclesWitness, abstractions::PrecompilesProcessor, @@ -6,7 +6,7 @@ use zk_evm::{ precompiles::DefaultPrecompilesProcessor, }; -use crate::history_recorder::HistoryRecorder; +use crate::vm_m5::history_recorder::HistoryRecorder; use super::OracleWithHistory; diff --git a/core/multivm_deps/vm_m5/src/oracles/storage.rs b/core/lib/multivm/src/versions/vm_m5/oracles/storage.rs similarity index 95% rename from core/multivm_deps/vm_m5/src/oracles/storage.rs rename to core/lib/multivm/src/versions/vm_m5/oracles/storage.rs index 8bbb85808db5..8fcdc6bcba52 100644 --- a/core/multivm_deps/vm_m5/src/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_m5/oracles/storage.rs @@ -1,16 +1,16 @@ use std::collections::HashMap; -use crate::glue::GlueInto; -use crate::storage::{Storage, StoragePtr}; +use crate::vm_m5::glue::GlueInto; +use crate::vm_m5::storage::{Storage, StoragePtr}; -use crate::history_recorder::{ +use crate::vm_m5::history_recorder::{ AppDataFrameManagerWithHistory, HashMapHistoryEvent, HistoryRecorder, StorageWrapper, }; -use crate::vm::MultiVMSubversion; +use crate::vm_m5::vm::MultiVMSubversion; -use zk_evm::abstractions::RefundedAmounts; -use zk_evm::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES; -use zk_evm::{ +use zk_evm_1_3_1::abstractions::RefundedAmounts; +use zk_evm_1_3_1::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES; +use zk_evm_1_3_1::{ abstractions::{RefundType, Storage as VmStorageOracle}, aux_structures::{LogQuery, Timestamp}, reference_impls::event_sink::ApplicationData, @@ -301,8 +301,8 @@ fn get_pubdata_price_bytes(_query: &LogQuery, is_initial: bool) -> u32 { // TODO (SMA-1702): take into account the content of the log query, i.e. values that contain mostly zeroes // should cost less. if is_initial { - zk_evm::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES as u32 + zk_evm_1_3_1::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES as u32 } else { - zk_evm::zkevm_opcode_defs::system_params::REPEATED_STORAGE_WRITE_PUBDATA_BYTES as u32 + zk_evm_1_3_1::zkevm_opcode_defs::system_params::REPEATED_STORAGE_WRITE_PUBDATA_BYTES as u32 } } diff --git a/core/multivm_deps/vm_m5/src/oracles/tracer.rs b/core/lib/multivm/src/versions/vm_m5/oracles/tracer.rs similarity index 98% rename from core/multivm_deps/vm_m5/src/oracles/tracer.rs rename to core/lib/multivm/src/versions/vm_m5/oracles/tracer.rs index 73a9721f0f81..8ad13e6527b1 100644 --- a/core/multivm_deps/vm_m5/src/oracles/tracer.rs +++ b/core/lib/multivm/src/versions/vm_m5/oracles/tracer.rs @@ -4,7 +4,7 @@ use std::{ fmt::{self, Display}, }; -use crate::{ +use crate::vm_m5::{ errors::VmRevertReasonParsingResult, memory::SimpleMemory, storage::StoragePtr, @@ -12,9 +12,9 @@ use crate::{ vm::{get_vm_hook_params, VM_HOOK_POSITION}, vm_with_bootloader::BOOTLOADER_HEAP_PAGE, }; -// use zk_evm::testing::memory::SimpleMemory; -use crate::storage::Storage; -use zk_evm::{ +// use zk_evm_1_3_1::testing::memory::SimpleMemory; +use crate::vm_m5::storage::Storage; +use zk_evm_1_3_1::{ abstractions::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, Tracer, VmLocalStateData, }, @@ -697,8 +697,12 @@ impl Tracer for BootloaderTracer { ) { // Decodes next opcode. // `self` is passed as `tracer`, so `self.after_decoding` will be called and it will catch "out of gas". - let (next_opcode, _, _) = - zk_evm::vm_state::read_and_decode(state.vm_local_state, memory, &mut DummyTracer, self); + let (next_opcode, _, _) = zk_evm_1_3_1::vm_state::read_and_decode( + state.vm_local_state, + memory, + &mut DummyTracer, + self, + ); if Self::current_frame_is_bootloader(state.vm_local_state) { if let Opcode::Ret(ret) = next_opcode.inner.variant.opcode { self.ret_from_the_bootloader = Some(ret); diff --git a/core/multivm_deps/vm_m5/src/pubdata_utils.rs b/core/lib/multivm/src/versions/vm_m5/pubdata_utils.rs similarity index 91% rename from core/multivm_deps/vm_m5/src/pubdata_utils.rs rename to core/lib/multivm/src/versions/vm_m5/pubdata_utils.rs index c3df97793833..7a2d9b713864 100644 --- a/core/multivm_deps/vm_m5/src/pubdata_utils.rs +++ b/core/lib/multivm/src/versions/vm_m5/pubdata_utils.rs @@ -1,10 +1,10 @@ -use crate::glue::GlueInto; -use crate::oracles::storage::storage_key_of_log; -use crate::storage::Storage; -use crate::utils::collect_storage_log_queries_after_timestamp; -use crate::VmInstance; +use crate::vm_m5::glue::GlueInto; +use crate::vm_m5::oracles::storage::storage_key_of_log; +use crate::vm_m5::storage::Storage; +use crate::vm_m5::utils::collect_storage_log_queries_after_timestamp; +use crate::vm_m5::VmInstance; use std::collections::HashMap; -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_1::aux_structures::Timestamp; use zksync_types::event::{extract_long_l2_to_l1_messages, extract_published_bytecodes}; use zksync_types::zkevm_test_harness::witness::sort_storage_access::sort_storage_access_queries; @@ -23,7 +23,7 @@ impl VmInstance { .iter() .filter(|log| log.sender != SYSTEM_CONTEXT_ADDRESS) .count() as u32) - * zk_evm::zkevm_opcode_defs::system_params::L1_MESSAGE_PUBDATA_BYTES; + * zk_evm_1_3_1::zkevm_opcode_defs::system_params::L1_MESSAGE_PUBDATA_BYTES; let l2_l1_long_messages_bytes: u32 = extract_long_l2_to_l1_messages(&events) .iter() .map(|event| event.len() as u32) diff --git a/core/multivm_deps/vm_m5/src/refunds.rs b/core/lib/multivm/src/versions/vm_m5/refunds.rs similarity index 98% rename from core/multivm_deps/vm_m5/src/refunds.rs rename to core/lib/multivm/src/versions/vm_m5/refunds.rs index b7cfb7e0ce94..47ad87d06995 100644 --- a/core/multivm_deps/vm_m5/src/refunds.rs +++ b/core/lib/multivm/src/versions/vm_m5/refunds.rs @@ -1,9 +1,9 @@ -use crate::storage::Storage; -use crate::vm_with_bootloader::{ +use crate::vm_m5::storage::Storage; +use crate::vm_m5::vm_with_bootloader::{ eth_price_per_pubdata_byte, BOOTLOADER_HEAP_PAGE, TX_GAS_LIMIT_OFFSET, }; -use crate::VmInstance; -use zk_evm::aux_structures::Timestamp; +use crate::vm_m5::VmInstance; +use zk_evm_1_3_1::aux_structures::Timestamp; use zksync_types::U256; use zksync_utils::ceil_div_u256; diff --git a/core/multivm_deps/vm_m5/src/storage.rs b/core/lib/multivm/src/versions/vm_m5/storage.rs similarity index 100% rename from core/multivm_deps/vm_m5/src/storage.rs rename to core/lib/multivm/src/versions/vm_m5/storage.rs diff --git a/core/multivm_deps/vm_m5/src/test_utils.rs b/core/lib/multivm/src/versions/vm_m5/test_utils.rs similarity index 99% rename from core/multivm_deps/vm_m5/src/test_utils.rs rename to core/lib/multivm/src/versions/vm_m5/test_utils.rs index b151ac457817..2db6c7986c97 100644 --- a/core/multivm_deps/vm_m5/src/test_utils.rs +++ b/core/lib/multivm/src/versions/vm_m5/test_utils.rs @@ -9,7 +9,7 @@ use std::collections::HashMap; use itertools::Itertools; -use zk_evm::{ +use zk_evm_1_3_1::{ aux_structures::Timestamp, reference_impls::event_sink::ApplicationData, vm_state::VmLocalState, }; use zksync_contracts::test_contracts::LoadnextContractExecutionParams; @@ -26,9 +26,9 @@ use zksync_utils::{ address_to_h256, bytecode::hash_bytecode, h256_to_account_address, u256_to_h256, }; -use crate::storage::Storage; +use crate::vm_m5::storage::Storage; /// The tests here help us with the testing the VM -use crate::{ +use crate::vm_m5::{ event_sink::InMemoryEventSink, history_recorder::{FrameManager, HistoryRecorder}, memory::SimpleMemory, diff --git a/core/multivm_deps/vm_m5/src/tests/bootloader.rs b/core/lib/multivm/src/versions/vm_m5/tests/bootloader.rs similarity index 99% rename from core/multivm_deps/vm_m5/src/tests/bootloader.rs rename to core/lib/multivm/src/versions/vm_m5/tests/bootloader.rs index 99a00efc9c07..e3ef3f991b83 100644 --- a/core/multivm_deps/vm_m5/src/tests/bootloader.rs +++ b/core/lib/multivm/src/versions/vm_m5/tests/bootloader.rs @@ -38,16 +38,16 @@ // use std::ops::{Add, DivAssign}; // use std::rc::Rc; // use tempfile::TempDir; -// use zk_evm::abstractions::{ +// use zk_evm_1_3_1::abstractions::{ // AfterDecodingData, AfterExecutionData, BeforeExecutionData, Tracer, VmLocalStateData, // MAX_HEAP_PAGE_SIZE_IN_WORDS, MAX_MEMORY_BYTES, // }; -// use zk_evm::aux_structures::Timestamp; -// use zk_evm::block_properties::BlockProperties; -// use zk_evm::sha3::digest::typenum::U830; -// use zk_evm::witness_trace::VmWitnessTracer; -// use zk_evm::zkevm_opcode_defs::decoding::VmEncodingMode; -// use zk_evm::zkevm_opcode_defs::FatPointer; +// use zk_evm_1_3_1::aux_structures::Timestamp; +// use zk_evm_1_3_1::block_properties::BlockProperties; +// use zk_evm_1_3_1::sha3::digest::typenum::U830; +// use zk_evm_1_3_1::witness_trace::VmWitnessTracer; +// use zk_evm_1_3_1::zkevm_opcode_defs::decoding::VmEncodingMode; +// use zk_evm_1_3_1::zkevm_opcode_defs::FatPointer; // use zksync_types::block::DeployedContract; // use zksync_types::ethabi::encode; // use zksync_types::l1::L1Tx; diff --git a/core/multivm_deps/vm_m5/src/tests/mod.rs b/core/lib/multivm/src/versions/vm_m5/tests/mod.rs similarity index 100% rename from core/multivm_deps/vm_m5/src/tests/mod.rs rename to core/lib/multivm/src/versions/vm_m5/tests/mod.rs diff --git a/core/multivm_deps/vm_m5/src/transaction_data.rs b/core/lib/multivm/src/versions/vm_m5/transaction_data.rs similarity index 99% rename from core/multivm_deps/vm_m5/src/transaction_data.rs rename to core/lib/multivm/src/versions/vm_m5/transaction_data.rs index a49599af3381..b749ff092750 100644 --- a/core/multivm_deps/vm_m5/src/transaction_data.rs +++ b/core/lib/multivm/src/versions/vm_m5/transaction_data.rs @@ -1,4 +1,4 @@ -use zk_evm::zkevm_opcode_defs::system_params::{MAX_PUBDATA_PER_BLOCK, MAX_TX_ERGS_LIMIT}; +use zk_evm_1_3_1::zkevm_opcode_defs::system_params::{MAX_PUBDATA_PER_BLOCK, MAX_TX_ERGS_LIMIT}; use zksync_types::ethabi::{encode, Address, Token}; use zksync_types::fee::encoding_len; use zksync_types::MAX_TXS_IN_BLOCK; @@ -6,7 +6,7 @@ use zksync_types::{l2::TransactionType, ExecuteTransactionCommon, Transaction, U use zksync_utils::{address_to_h256, ceil_div_u256}; use zksync_utils::{bytecode::hash_bytecode, bytes_to_be_words, h256_to_u256}; -use crate::vm_with_bootloader::{ +use crate::vm_m5::vm_with_bootloader::{ BLOCK_OVERHEAD_GAS, BLOCK_OVERHEAD_PUBDATA, BOOTLOADER_TX_ENCODING_SPACE, }; @@ -110,7 +110,7 @@ impl From for TransactionData { } } ExecuteTransactionCommon::ProtocolUpgrade(_) => { - panic!("Protocol upgrade transactions are not supported in vm_m5") + panic!("Protocol upgrade transactions are not supported in vm_m5") } } } diff --git a/core/multivm_deps/vm_m5/src/utils.rs b/core/lib/multivm/src/versions/vm_m5/utils.rs similarity index 96% rename from core/multivm_deps/vm_m5/src/utils.rs rename to core/lib/multivm/src/versions/vm_m5/utils.rs index 6340034a7cc8..2b8b535ab5eb 100644 --- a/core/multivm_deps/vm_m5/src/utils.rs +++ b/core/lib/multivm/src/versions/vm_m5/utils.rs @@ -1,9 +1,9 @@ -use crate::glue::GlueInto; -use crate::{memory::SimpleMemory, vm_with_bootloader::BlockContext}; +use crate::vm_m5::glue::GlueInto; +use crate::vm_m5::{memory::SimpleMemory, vm_with_bootloader::BlockContext}; use once_cell::sync::Lazy; -use zk_evm::block_properties::BlockProperties; -use zk_evm::{ +use zk_evm_1_3_1::block_properties::BlockProperties; +use zk_evm_1_3_1::{ aux_structures::{LogQuery, MemoryPage, Timestamp}, vm_state::PrimitiveValue, zkevm_opcode_defs::FatPointer, @@ -22,7 +22,8 @@ pub const ENTRY_POINT_PAGE: u32 = code_page_candidate_from_base(MemoryPage(INITI /// How many gas bootloader is allowed to spend within one block. /// Note that this value doesn't correspond to the gas limit of any particular transaction /// (except for the fact that, of course, gas limit for each transaction should be <= `BLOCK_GAS_LIMIT`). -pub const BLOCK_GAS_LIMIT: u32 = zk_evm::zkevm_opcode_defs::system_params::VM_INITIAL_FRAME_ERGS; +pub const BLOCK_GAS_LIMIT: u32 = + zk_evm_1_3_1::zkevm_opcode_defs::system_params::VM_INITIAL_FRAME_ERGS; pub const ETH_CALL_GAS_LIMIT: u32 = MAX_L2_TX_GAS_LIMIT as u32; #[derive(Debug, Clone)] diff --git a/core/multivm_deps/vm_m5/src/vm.rs b/core/lib/multivm/src/versions/vm_m5/vm.rs similarity index 96% rename from core/multivm_deps/vm_m5/src/vm.rs rename to core/lib/multivm/src/versions/vm_m5/vm.rs index 84880ce6fcca..53458856c153 100644 --- a/core/multivm_deps/vm_m5/src/vm.rs +++ b/core/lib/multivm/src/versions/vm_m5/vm.rs @@ -1,11 +1,13 @@ use std::convert::TryFrom; use std::fmt::Debug; -use zk_evm::aux_structures::Timestamp; -use zk_evm::vm_state::{PrimitiveValue, VmLocalState, VmState}; -use zk_evm::witness_trace::DummyTracer; -use zk_evm::zkevm_opcode_defs::decoding::{AllowedPcOrImm, EncodingModeProduction, VmEncodingMode}; -use zk_evm::zkevm_opcode_defs::definitions::RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER; +use zk_evm_1_3_1::aux_structures::Timestamp; +use zk_evm_1_3_1::vm_state::{PrimitiveValue, VmLocalState, VmState}; +use zk_evm_1_3_1::witness_trace::DummyTracer; +use zk_evm_1_3_1::zkevm_opcode_defs::decoding::{ + AllowedPcOrImm, EncodingModeProduction, VmEncodingMode, +}; +use zk_evm_1_3_1::zkevm_opcode_defs::definitions::RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER; use zksync_system_constants::MAX_TXS_IN_BLOCK; use zksync_types::l2_to_l1_log::L2ToL1Log; @@ -13,26 +15,26 @@ use zksync_types::tx::tx_execution_info::{TxExecutionStatus, VmExecutionLogs}; use zksync_types::vm_trace::VmExecutionTrace; use zksync_types::{L1BatchNumber, StorageLogQuery, VmEvent, U256}; -use crate::bootloader_state::BootloaderState; -use crate::errors::{TxRevertReason, VmRevertReason, VmRevertReasonParsingResult}; -use crate::event_sink::InMemoryEventSink; -use crate::events::merge_events; -use crate::glue::GlueInto; -use crate::memory::SimpleMemory; -use crate::oracles::decommitter::DecommitterOracle; -use crate::oracles::precompile::PrecompilesProcessorWithHistory; -use crate::oracles::storage::StorageOracle; -use crate::oracles::tracer::{ +use crate::vm_m5::bootloader_state::BootloaderState; +use crate::vm_m5::errors::{TxRevertReason, VmRevertReason, VmRevertReasonParsingResult}; +use crate::vm_m5::event_sink::InMemoryEventSink; +use crate::vm_m5::events::merge_events; +use crate::vm_m5::glue::GlueInto; +use crate::vm_m5::memory::SimpleMemory; +use crate::vm_m5::oracles::decommitter::DecommitterOracle; +use crate::vm_m5::oracles::precompile::PrecompilesProcessorWithHistory; +use crate::vm_m5::oracles::storage::StorageOracle; +use crate::vm_m5::oracles::tracer::{ BootloaderTracer, ExecutionEndTracer, OneTxTracer, PendingRefundTracer, PubdataSpentTracer, TransactionResultTracer, ValidationError, ValidationTracer, ValidationTracerParams, }; -use crate::oracles::OracleWithHistory; -use crate::storage::Storage; -use crate::utils::{ +use crate::vm_m5::oracles::OracleWithHistory; +use crate::vm_m5::storage::Storage; +use crate::vm_m5::utils::{ collect_log_queries_after_timestamp, collect_storage_log_queries_after_timestamp, dump_memory_page_using_primitive_value, precompile_calls_count_after_timestamp, }; -use crate::vm_with_bootloader::{ +use crate::vm_m5::vm_with_bootloader::{ BootloaderJobType, DerivedBlockContext, TxExecutionMode, BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, }; @@ -164,7 +166,7 @@ pub enum VmExecutionStopReason { TracerRequestedStop, } -use crate::utils::VmExecutionResult as NewVmExecutionResult; +use crate::vm_m5::utils::VmExecutionResult as NewVmExecutionResult; fn vm_may_have_ended_inner( vm: &VmState< diff --git a/core/multivm_deps/vm_m5/src/vm_with_bootloader.rs b/core/lib/multivm/src/versions/vm_m5/vm_with_bootloader.rs similarity index 99% rename from core/multivm_deps/vm_m5/src/vm_with_bootloader.rs rename to core/lib/multivm/src/versions/vm_m5/vm_with_bootloader.rs index 537f71411773..115ca93ad957 100644 --- a/core/multivm_deps/vm_m5/src/vm_with_bootloader.rs +++ b/core/lib/multivm/src/versions/vm_m5/vm_with_bootloader.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use zk_evm::{ +use zk_evm_1_3_1::{ abstractions::{MAX_HEAP_PAGE_SIZE_IN_WORDS, MAX_MEMORY_BYTES}, aux_structures::{MemoryPage, Timestamp}, block_properties::BlockProperties, @@ -21,8 +21,8 @@ use zksync_utils::{ address_to_u256, bytecode::hash_bytecode, bytes_to_be_words, h256_to_u256, misc::ceil_div, }; -use crate::storage::Storage; -use crate::{ +use crate::vm_m5::storage::Storage; +use crate::vm_m5::{ bootloader_state::BootloaderState, oracles::OracleWithHistory, transaction_data::TransactionData, diff --git a/core/multivm_deps/vm_m6/README.md b/core/lib/multivm/src/versions/vm_m6/README.md similarity index 100% rename from core/multivm_deps/vm_m6/README.md rename to core/lib/multivm/src/versions/vm_m6/README.md diff --git a/core/multivm_deps/vm_m6/src/bootloader_state.rs b/core/lib/multivm/src/versions/vm_m6/bootloader_state.rs similarity index 98% rename from core/multivm_deps/vm_m6/src/bootloader_state.rs rename to core/lib/multivm/src/versions/vm_m6/bootloader_state.rs index 8832a59dc50e..5dce7e1c6a96 100644 --- a/core/multivm_deps/vm_m6/src/bootloader_state.rs +++ b/core/lib/multivm/src/versions/vm_m6/bootloader_state.rs @@ -1,4 +1,4 @@ -use crate::vm_with_bootloader::TX_DESCRIPTION_OFFSET; +use crate::vm_m6::vm_with_bootloader::TX_DESCRIPTION_OFFSET; /// Intermediate bootloader-related VM state. /// diff --git a/core/multivm_deps/vm_m6/src/errors/bootloader_error.rs b/core/lib/multivm/src/versions/vm_m6/errors/bootloader_error.rs similarity index 100% rename from core/multivm_deps/vm_m6/src/errors/bootloader_error.rs rename to core/lib/multivm/src/versions/vm_m6/errors/bootloader_error.rs diff --git a/core/multivm_deps/vm_m6/src/errors/mod.rs b/core/lib/multivm/src/versions/vm_m6/errors/mod.rs similarity index 100% rename from core/multivm_deps/vm_m6/src/errors/mod.rs rename to core/lib/multivm/src/versions/vm_m6/errors/mod.rs diff --git a/core/multivm_deps/vm_m6/src/errors/tx_revert_reason.rs b/core/lib/multivm/src/versions/vm_m6/errors/tx_revert_reason.rs similarity index 100% rename from core/multivm_deps/vm_m6/src/errors/tx_revert_reason.rs rename to core/lib/multivm/src/versions/vm_m6/errors/tx_revert_reason.rs diff --git a/core/multivm_deps/vm_m6/src/errors/vm_revert_reason.rs b/core/lib/multivm/src/versions/vm_m6/errors/vm_revert_reason.rs similarity index 99% rename from core/multivm_deps/vm_m6/src/errors/vm_revert_reason.rs rename to core/lib/multivm/src/versions/vm_m6/errors/vm_revert_reason.rs index f8e9d704ff87..d954f0779535 100644 --- a/core/multivm_deps/vm_m6/src/errors/vm_revert_reason.rs +++ b/core/lib/multivm/src/versions/vm_m6/errors/vm_revert_reason.rs @@ -3,7 +3,7 @@ use std::fmt::{Debug, Display}; use zksync_types::U256; -use crate::TxRevertReason; +use crate::vm_m6::TxRevertReason; #[derive(Debug, thiserror::Error)] pub enum VmRevertReasonParsingError { diff --git a/core/multivm_deps/vm_m6/src/event_sink.rs b/core/lib/multivm/src/versions/vm_m6/event_sink.rs similarity index 99% rename from core/multivm_deps/vm_m6/src/event_sink.rs rename to core/lib/multivm/src/versions/vm_m6/event_sink.rs index 868f06482e48..41fd22e9eedb 100644 --- a/core/multivm_deps/vm_m6/src/event_sink.rs +++ b/core/lib/multivm/src/versions/vm_m6/event_sink.rs @@ -1,10 +1,10 @@ -use crate::{ +use crate::vm_m6::{ history_recorder::{AppDataFrameManagerWithHistory, HistoryEnabled, HistoryMode}, oracles::OracleWithHistory, utils::collect_log_queries_after_timestamp, }; use std::collections::HashMap; -use zk_evm::{ +use zk_evm_1_3_1::{ abstractions::EventSink, aux_structures::{LogQuery, Timestamp}, reference_impls::event_sink::EventMessage, diff --git a/core/multivm_deps/vm_m6/src/events.rs b/core/lib/multivm/src/versions/vm_m6/events.rs similarity index 98% rename from core/multivm_deps/vm_m6/src/events.rs rename to core/lib/multivm/src/versions/vm_m6/events.rs index 0d11d9102ea2..146c938021a7 100644 --- a/core/multivm_deps/vm_m6/src/events.rs +++ b/core/lib/multivm/src/versions/vm_m6/events.rs @@ -1,4 +1,4 @@ -use zk_evm::{ethereum_types::Address, reference_impls::event_sink::EventMessage}; +use zk_evm_1_3_1::{ethereum_types::Address, reference_impls::event_sink::EventMessage}; use zksync_types::{L1BatchNumber, VmEvent, EVENT_WRITER_ADDRESS, H256}; use zksync_utils::{be_chunks_to_h256_words, h256_to_account_address}; diff --git a/core/multivm_deps/vm_m6/fuzz/.gitignore b/core/lib/multivm/src/versions/vm_m6/fuzz/.gitignore similarity index 100% rename from core/multivm_deps/vm_m6/fuzz/.gitignore rename to core/lib/multivm/src/versions/vm_m6/fuzz/.gitignore diff --git a/core/multivm_deps/vm_m6/fuzz/Cargo.toml b/core/lib/multivm/src/versions/vm_m6/fuzz/Cargo.toml similarity index 76% rename from core/multivm_deps/vm_m6/fuzz/Cargo.toml rename to core/lib/multivm/src/versions/vm_m6/fuzz/Cargo.toml index fb659b9c6284..80245efa7e03 100644 --- a/core/multivm_deps/vm_m6/fuzz/Cargo.toml +++ b/core/lib/multivm/src/versions/vm_m6/fuzz/Cargo.toml @@ -9,8 +9,8 @@ cargo-fuzz = true [dependencies] libfuzzer-sys = "0.4" -vm-benchmark = {path = "../../../tests/vm-benchmark"} -zksync_types = {path = "../../types"} +vm-benchmark = {path = "../../../../../../tests/vm-benchmark"} +zksync_types = {path = "../../../../../types"} # Prevent this from interfering with workspaces [workspace] diff --git a/core/multivm_deps/vm_m6/fuzz/compare.sh b/core/lib/multivm/src/versions/vm_m6/fuzz/compare.sh similarity index 100% rename from core/multivm_deps/vm_m6/fuzz/compare.sh rename to core/lib/multivm/src/versions/vm_m6/fuzz/compare.sh diff --git a/core/multivm_deps/vm_m6/fuzz/fuzz.sh b/core/lib/multivm/src/versions/vm_m6/fuzz/fuzz.sh similarity index 100% rename from core/multivm_deps/vm_m6/fuzz/fuzz.sh rename to core/lib/multivm/src/versions/vm_m6/fuzz/fuzz.sh diff --git a/core/multivm_deps/vm_m6/fuzz/fuzz_targets/deploy_transaction.rs b/core/lib/multivm/src/versions/vm_m6/fuzz/fuzz_targets/deploy_transaction.rs similarity index 100% rename from core/multivm_deps/vm_m6/fuzz/fuzz_targets/deploy_transaction.rs rename to core/lib/multivm/src/versions/vm_m6/fuzz/fuzz_targets/deploy_transaction.rs diff --git a/core/multivm_deps/vm_m6/fuzz/show_cycle.gdb b/core/lib/multivm/src/versions/vm_m6/fuzz/show_cycle.gdb similarity index 100% rename from core/multivm_deps/vm_m6/fuzz/show_cycle.gdb rename to core/lib/multivm/src/versions/vm_m6/fuzz/show_cycle.gdb diff --git a/core/multivm_deps/vm_m6/src/glue.rs b/core/lib/multivm/src/versions/vm_m6/glue.rs similarity index 63% rename from core/multivm_deps/vm_m6/src/glue.rs rename to core/lib/multivm/src/versions/vm_m6/glue.rs index a36ec390bf6e..72cae86b173b 100644 --- a/core/multivm_deps/vm_m6/src/glue.rs +++ b/core/lib/multivm/src/versions/vm_m6/glue.rs @@ -24,14 +24,14 @@ impl GlueFrom for T { } } -impl GlueFrom for zksync_types::Timestamp { - fn glue_from(timestamp: zk_evm::aux_structures::Timestamp) -> Self { +impl GlueFrom for zksync_types::Timestamp { + fn glue_from(timestamp: zk_evm_1_3_1::aux_structures::Timestamp) -> Self { zksync_types::Timestamp(timestamp.0) } } -impl GlueFrom for zksync_types::LogQuery { - fn glue_from(query: zk_evm::aux_structures::LogQuery) -> Self { +impl GlueFrom for zksync_types::LogQuery { + fn glue_from(query: zk_evm_1_3_1::aux_structures::LogQuery) -> Self { zksync_types::LogQuery { address: query.address, key: query.key, @@ -48,15 +48,15 @@ impl GlueFrom for zksync_types::LogQuery { } } -impl GlueFrom for zk_evm::aux_structures::Timestamp { +impl GlueFrom for zk_evm_1_3_1::aux_structures::Timestamp { fn glue_from(timestamp: zksync_types::Timestamp) -> Self { - zk_evm::aux_structures::Timestamp(timestamp.0) + zk_evm_1_3_1::aux_structures::Timestamp(timestamp.0) } } -impl GlueFrom for zk_evm::aux_structures::LogQuery { +impl GlueFrom for zk_evm_1_3_1::aux_structures::LogQuery { fn glue_from(query: zksync_types::LogQuery) -> Self { - zk_evm::aux_structures::LogQuery { + zk_evm_1_3_1::aux_structures::LogQuery { address: query.address, key: query.key, written_value: query.written_value, @@ -72,8 +72,10 @@ impl GlueFrom for zk_evm::aux_structures::LogQuery { } } -impl GlueFrom for zksync_types::EventMessage { - fn glue_from(event: zk_evm::reference_impls::event_sink::EventMessage) -> Self { +impl GlueFrom + for zksync_types::EventMessage +{ + fn glue_from(event: zk_evm_1_3_1::reference_impls::event_sink::EventMessage) -> Self { zksync_types::EventMessage { shard_id: event.shard_id, is_first: event.is_first, @@ -85,17 +87,17 @@ impl GlueFrom for zksync_type } } -impl GlueFrom for zksync_types::FarCallOpcode { - fn glue_from(value: zk_evm::zkevm_opcode_defs::FarCallOpcode) -> Self { +impl GlueFrom for zksync_types::FarCallOpcode { + fn glue_from(value: zk_evm_1_3_1::zkevm_opcode_defs::FarCallOpcode) -> Self { match value { - zk_evm::zkevm_opcode_defs::FarCallOpcode::Normal => Self::Normal, - zk_evm::zkevm_opcode_defs::FarCallOpcode::Delegate => Self::Delegate, - zk_evm::zkevm_opcode_defs::FarCallOpcode::Mimic => Self::Mimic, + zk_evm_1_3_1::zkevm_opcode_defs::FarCallOpcode::Normal => Self::Normal, + zk_evm_1_3_1::zkevm_opcode_defs::FarCallOpcode::Delegate => Self::Delegate, + zk_evm_1_3_1::zkevm_opcode_defs::FarCallOpcode::Mimic => Self::Mimic, } } } -impl GlueFrom for zk_evm::zkevm_opcode_defs::FarCallOpcode { +impl GlueFrom for zk_evm_1_3_1::zkevm_opcode_defs::FarCallOpcode { fn glue_from(value: zksync_types::FarCallOpcode) -> Self { match value { zksync_types::FarCallOpcode::Normal => Self::Normal, diff --git a/core/multivm_deps/vm_m6/src/history_recorder.rs b/core/lib/multivm/src/versions/vm_m6/history_recorder.rs similarity index 99% rename from core/multivm_deps/vm_m6/src/history_recorder.rs rename to core/lib/multivm/src/versions/vm_m6/history_recorder.rs index f697da5b23bd..a85279e56c13 100644 --- a/core/multivm_deps/vm_m6/src/history_recorder.rs +++ b/core/lib/multivm/src/versions/vm_m6/history_recorder.rs @@ -4,9 +4,9 @@ use std::{ hash::{BuildHasherDefault, Hash, Hasher}, }; -use crate::storage::{Storage, StoragePtr}; +use crate::vm_m6::storage::{Storage, StoragePtr}; -use zk_evm::{ +use zk_evm_1_3_1::{ aux_structures::Timestamp, vm_state::PrimitiveValue, zkevm_opcode_defs::{self}, diff --git a/core/multivm_deps/vm_m6/src/memory.rs b/core/lib/multivm/src/versions/vm_m6/memory.rs similarity index 95% rename from core/multivm_deps/vm_m6/src/memory.rs rename to core/lib/multivm/src/versions/vm_m6/memory.rs index ecc8dc9c04c5..52a3d7f606f8 100644 --- a/core/multivm_deps/vm_m6/src/memory.rs +++ b/core/lib/multivm/src/versions/vm_m6/memory.rs @@ -1,15 +1,15 @@ -use zk_evm::abstractions::{Memory, MemoryType, MEMORY_CELLS_OTHER_PAGES}; -use zk_evm::aux_structures::{MemoryPage, MemoryQuery, Timestamp}; -use zk_evm::vm_state::PrimitiveValue; -use zk_evm::zkevm_opcode_defs::FatPointer; +use zk_evm_1_3_1::abstractions::{Memory, MemoryType, MEMORY_CELLS_OTHER_PAGES}; +use zk_evm_1_3_1::aux_structures::{MemoryPage, MemoryQuery, Timestamp}; +use zk_evm_1_3_1::vm_state::PrimitiveValue; +use zk_evm_1_3_1::zkevm_opcode_defs::FatPointer; use zksync_types::U256; -use crate::history_recorder::{ +use crate::vm_m6::history_recorder::{ FramedStack, HistoryEnabled, HistoryMode, IntFrameManagerWithHistory, MemoryWithHistory, MemoryWrapper, WithHistory, }; -use crate::oracles::OracleWithHistory; -use crate::utils::{aux_heap_page_from_base, heap_page_from_base, stack_page_from_base}; +use crate::vm_m6::oracles::OracleWithHistory; +use crate::vm_m6::utils::{aux_heap_page_from_base, heap_page_from_base, stack_page_from_base}; #[derive(Debug, Clone, PartialEq, Default)] pub struct SimpleMemory { diff --git a/core/multivm_deps/vm_m6/src/lib.rs b/core/lib/multivm/src/versions/vm_m6/mod.rs similarity index 69% rename from core/multivm_deps/vm_m6/src/lib.rs rename to core/lib/multivm/src/versions/vm_m6/mod.rs index f88ae4a42b18..b8a6f6f051d5 100644 --- a/core/multivm_deps/vm_m6/src/lib.rs +++ b/core/lib/multivm/src/versions/vm_m6/mod.rs @@ -21,12 +21,12 @@ pub mod vm_with_bootloader; #[cfg(test)] mod tests; -pub use crate::errors::TxRevertReason; -pub use crate::history_recorder::{HistoryDisabled, HistoryEnabled, HistoryMode}; -pub use crate::oracle_tools::OracleTools; -pub use crate::oracles::storage::StorageOracle; -pub use crate::vm::{VmBlockResult, VmExecutionResult, VmInstance}; -pub use zk_evm; +pub use errors::TxRevertReason; +pub use history_recorder::{HistoryDisabled, HistoryEnabled, HistoryMode}; +pub use oracle_tools::OracleTools; +pub use oracles::storage::StorageOracle; +pub use vm::{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/multivm_deps/vm_m6/src/oracle_tools.rs b/core/lib/multivm/src/versions/vm_m6/oracle_tools.rs similarity index 84% rename from core/multivm_deps/vm_m6/src/oracle_tools.rs rename to core/lib/multivm/src/versions/vm_m6/oracle_tools.rs index 14c7aededb63..6650752da27b 100644 --- a/core/multivm_deps/vm_m6/src/oracle_tools.rs +++ b/core/lib/multivm/src/versions/vm_m6/oracle_tools.rs @@ -1,15 +1,15 @@ -use crate::memory::SimpleMemory; +use crate::vm_m6::memory::SimpleMemory; use std::fmt::Debug; -use crate::event_sink::InMemoryEventSink; -use crate::history_recorder::HistoryMode; -use crate::oracles::{ +use crate::vm_m6::event_sink::InMemoryEventSink; +use crate::vm_m6::history_recorder::HistoryMode; +use crate::vm_m6::oracles::{ decommitter::DecommitterOracle, precompile::PrecompilesProcessorWithHistory, storage::StorageOracle, }; -use crate::storage::{Storage, StoragePtr}; -use zk_evm::witness_trace::DummyTracer; +use crate::vm_m6::storage::{Storage, StoragePtr}; +use zk_evm_1_3_1::witness_trace::DummyTracer; /// zkEVM requires a bunch of objects implementing given traits to work. /// For example: Storage, Memory, PrecompilerProcessor etc diff --git a/core/multivm_deps/vm_m6/src/oracles/decommitter.rs b/core/lib/multivm/src/versions/vm_m6/oracles/decommitter.rs similarity index 97% rename from core/multivm_deps/vm_m6/src/oracles/decommitter.rs rename to core/lib/multivm/src/versions/vm_m6/oracles/decommitter.rs index ee2c551f5f53..3917063422aa 100644 --- a/core/multivm_deps/vm_m6/src/oracles/decommitter.rs +++ b/core/lib/multivm/src/versions/vm_m6/oracles/decommitter.rs @@ -1,11 +1,11 @@ use std::collections::HashMap; -use crate::history_recorder::{HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory}; -use crate::storage::{Storage, StoragePtr}; +use crate::vm_m6::history_recorder::{HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory}; +use crate::vm_m6::storage::{Storage, StoragePtr}; -use zk_evm::abstractions::MemoryType; -use zk_evm::aux_structures::Timestamp; -use zk_evm::{ +use zk_evm_1_3_1::abstractions::MemoryType; +use zk_evm_1_3_1::aux_structures::Timestamp; +use zk_evm_1_3_1::{ abstractions::{DecommittmentProcessor, Memory}, aux_structures::{DecommittmentQuery, MemoryIndex, MemoryLocation, MemoryPage, MemoryQuery}, }; diff --git a/core/multivm_deps/vm_m6/src/oracles/mod.rs b/core/lib/multivm/src/versions/vm_m6/oracles/mod.rs similarity index 59% rename from core/multivm_deps/vm_m6/src/oracles/mod.rs rename to core/lib/multivm/src/versions/vm_m6/oracles/mod.rs index d219216b25f8..d6b00c8500d7 100644 --- a/core/multivm_deps/vm_m6/src/oracles/mod.rs +++ b/core/lib/multivm/src/versions/vm_m6/oracles/mod.rs @@ -1,12 +1,12 @@ -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_1::aux_structures::Timestamp; // We will discard RAM as soon as the execution of a tx ends, so // it is ok for now to use SimpleMemory -pub use zk_evm::reference_impls::memory::SimpleMemory as RamOracle; +pub use zk_evm_1_3_1::reference_impls::memory::SimpleMemory as RamOracle; // All the changes to the events in the DB will be applied after the tx is executed, // so fow now it is fine. -pub use zk_evm::reference_impls::event_sink::InMemoryEventSink as EventSinkOracle; +pub use zk_evm_1_3_1::reference_impls::event_sink::InMemoryEventSink as EventSinkOracle; -pub use zk_evm::testing::simple_tracer::NoopTracer; +pub use zk_evm_1_3_1::testing::simple_tracer::NoopTracer; pub mod decommitter; pub mod precompile; diff --git a/core/lib/vm/src/old_vm/oracles/precompile.rs b/core/lib/multivm/src/versions/vm_m6/oracles/precompile.rs similarity index 96% rename from core/lib/vm/src/old_vm/oracles/precompile.rs rename to core/lib/multivm/src/versions/vm_m6/oracles/precompile.rs index 72b751c75d49..bb7f9f568191 100644 --- a/core/lib/vm/src/old_vm/oracles/precompile.rs +++ b/core/lib/multivm/src/versions/vm_m6/oracles/precompile.rs @@ -1,4 +1,4 @@ -use zk_evm::{ +use zk_evm_1_3_1::{ abstractions::Memory, abstractions::PrecompileCyclesWitness, abstractions::PrecompilesProcessor, @@ -6,7 +6,7 @@ use zk_evm::{ precompiles::DefaultPrecompilesProcessor, }; -use crate::old_vm::history_recorder::{HistoryEnabled, HistoryMode, HistoryRecorder}; +use crate::vm_m6::history_recorder::{HistoryEnabled, HistoryMode, HistoryRecorder}; use super::OracleWithHistory; diff --git a/core/multivm_deps/vm_m6/src/oracles/storage.rs b/core/lib/multivm/src/versions/vm_m6/oracles/storage.rs similarity index 96% rename from core/multivm_deps/vm_m6/src/oracles/storage.rs rename to core/lib/multivm/src/versions/vm_m6/oracles/storage.rs index 551ffc468d9a..025e4bf504c9 100644 --- a/core/multivm_deps/vm_m6/src/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_m6/oracles/storage.rs @@ -1,16 +1,16 @@ use std::collections::HashMap; -use crate::glue::GlueInto; -use crate::storage::{Storage, StoragePtr}; +use crate::vm_m6::glue::GlueInto; +use crate::vm_m6::storage::{Storage, StoragePtr}; -use crate::history_recorder::{ +use crate::vm_m6::history_recorder::{ AppDataFrameManagerWithHistory, HashMapHistoryEvent, HistoryEnabled, HistoryMode, HistoryRecorder, StorageWrapper, WithHistory, }; -use zk_evm::abstractions::RefundedAmounts; -use zk_evm::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES; -use zk_evm::{ +use zk_evm_1_3_1::abstractions::RefundedAmounts; +use zk_evm_1_3_1::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES; +use zk_evm_1_3_1::{ abstractions::{RefundType, Storage as VmStorageOracle}, aux_structures::{LogQuery, Timestamp}, }; @@ -302,8 +302,8 @@ fn get_pubdata_price_bytes(_query: &LogQuery, is_initial: bool) -> u32 { // TODO (SMA-1702): take into account the content of the log query, i.e. values that contain mostly zeroes // should cost less. if is_initial { - zk_evm::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES as u32 + zk_evm_1_3_1::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES as u32 } else { - zk_evm::zkevm_opcode_defs::system_params::REPEATED_STORAGE_WRITE_PUBDATA_BYTES as u32 + zk_evm_1_3_1::zkevm_opcode_defs::system_params::REPEATED_STORAGE_WRITE_PUBDATA_BYTES as u32 } } diff --git a/core/multivm_deps/vm_m6/src/oracles/tracer/bootloader.rs b/core/lib/multivm/src/versions/vm_m6/oracles/tracer/bootloader.rs similarity index 91% rename from core/multivm_deps/vm_m6/src/oracles/tracer/bootloader.rs rename to core/lib/multivm/src/versions/vm_m6/oracles/tracer/bootloader.rs index c2a02a5690bb..fc2a62374dbf 100644 --- a/core/multivm_deps/vm_m6/src/oracles/tracer/bootloader.rs +++ b/core/lib/multivm/src/versions/vm_m6/oracles/tracer/bootloader.rs @@ -1,13 +1,13 @@ use std::marker::PhantomData; -use crate::history_recorder::HistoryMode; -use crate::memory::SimpleMemory; -use crate::oracles::tracer::{ +use crate::vm_m6::history_recorder::HistoryMode; +use crate::vm_m6::memory::SimpleMemory; +use crate::vm_m6::oracles::tracer::{ utils::gas_spent_on_bytecodes_and_long_messages_this_opcode, ExecutionEndTracer, PendingRefundTracer, PubdataSpentTracer, StorageInvocationTracer, }; -use zk_evm::{ +use zk_evm_1_3_1::{ abstractions::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, Tracer, VmLocalStateData, }, @@ -67,8 +67,12 @@ impl Tracer for BootloaderTracer { ) { // Decodes next opcode. // `self` is passed as `tracer`, so `self.after_decoding` will be called and it will catch "out of gas". - let (next_opcode, _, _) = - zk_evm::vm_state::read_and_decode(state.vm_local_state, memory, &mut DummyTracer, self); + let (next_opcode, _, _) = zk_evm_1_3_1::vm_state::read_and_decode( + state.vm_local_state, + memory, + &mut DummyTracer, + self, + ); if Self::current_frame_is_bootloader(state.vm_local_state) { if let Opcode::Ret(ret) = next_opcode.inner.variant.opcode { self.ret_from_the_bootloader = Some(ret); diff --git a/core/multivm_deps/vm_m6/src/oracles/tracer/call.rs b/core/lib/multivm/src/versions/vm_m6/oracles/tracer/call.rs similarity index 96% rename from core/multivm_deps/vm_m6/src/oracles/tracer/call.rs rename to core/lib/multivm/src/versions/vm_m6/oracles/tracer/call.rs index a1eae50d663b..767dfe143c98 100644 --- a/core/multivm_deps/vm_m6/src/oracles/tracer/call.rs +++ b/core/lib/multivm/src/versions/vm_m6/oracles/tracer/call.rs @@ -1,18 +1,18 @@ -use crate::errors::VmRevertReason; -use crate::glue::GlueInto; -use crate::history_recorder::HistoryMode; -use crate::memory::SimpleMemory; +use crate::vm_m6::errors::VmRevertReason; +use crate::vm_m6::glue::GlueInto; +use crate::vm_m6::history_recorder::HistoryMode; +use crate::vm_m6::memory::SimpleMemory; use std::convert::TryFrom; use std::marker::PhantomData; use std::mem; -use zk_evm::abstractions::{ +use zk_evm_1_3_1::abstractions::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, Tracer, VmLocalStateData, }; -use zk_evm::zkevm_opcode_defs::{ +use zk_evm_1_3_1::zkevm_opcode_defs::FatPointer; +use zk_evm_1_3_1::zkevm_opcode_defs::{ FarCallABI, FarCallOpcode, Opcode, RetOpcode, CALL_IMPLICIT_CALLDATA_FAT_PTR_REGISTER, RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }; -use zkevm_assembly::zkevm_opcode_defs::FatPointer; use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_types::vm_trace::{Call, CallType}; use zksync_types::U256; @@ -283,11 +283,11 @@ fn filter_near_call(mut call: Call) -> Vec { #[cfg(test)] mod tests { - use crate::{ + use crate::vm_m6::{ glue::GlueInto, oracles::tracer::call::{filter_near_call, Call, CallType}, }; - use zk_evm::zkevm_opcode_defs::FarCallOpcode; + use zk_evm_1_3_1::zkevm_opcode_defs::FarCallOpcode; #[test] fn test_filter_near_calls() { diff --git a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/mod.rs b/core/lib/multivm/src/versions/vm_m6/oracles/tracer/mod.rs similarity index 90% rename from core/multivm_deps/vm_1_3_2/src/oracles/tracer/mod.rs rename to core/lib/multivm/src/versions/vm_m6/oracles/tracer/mod.rs index 677dea459637..93486f039fac 100644 --- a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/mod.rs +++ b/core/lib/multivm/src/versions/vm_m6/oracles/tracer/mod.rs @@ -1,5 +1,5 @@ -use zk_evm::tracing::Tracer; -use zk_evm::vm_state::VmLocalState; +use zk_evm_1_3_1::abstractions::Tracer; +use zk_evm_1_3_1::vm_state::VmLocalState; mod bootloader; mod call; @@ -17,8 +17,8 @@ pub use validation::{ pub(crate) use transaction_result::TransactionResultTracer; -use crate::history_recorder::HistoryMode; -use crate::memory::SimpleMemory; +use crate::vm_m6::history_recorder::HistoryMode; +use crate::vm_m6::memory::SimpleMemory; pub trait ExecutionEndTracer: Tracer> { // Returns whether the vm execution should stop. diff --git a/core/multivm_deps/vm_m6/src/oracles/tracer/one_tx.rs b/core/lib/multivm/src/versions/vm_m6/oracles/tracer/one_tx.rs similarity index 97% rename from core/multivm_deps/vm_m6/src/oracles/tracer/one_tx.rs rename to core/lib/multivm/src/versions/vm_m6/oracles/tracer/one_tx.rs index b2b04b13181c..f27bfb5494ea 100644 --- a/core/multivm_deps/vm_m6/src/oracles/tracer/one_tx.rs +++ b/core/lib/multivm/src/versions/vm_m6/oracles/tracer/one_tx.rs @@ -1,5 +1,5 @@ use super::utils::{computational_gas_price, print_debug_if_needed}; -use crate::{ +use crate::vm_m6::{ history_recorder::HistoryMode, memory::SimpleMemory, oracles::tracer::{ @@ -9,8 +9,8 @@ use crate::{ vm::get_vm_hook_params, }; -use crate::oracles::tracer::{CallTracer, StorageInvocationTracer}; -use zk_evm::{ +use crate::vm_m6::oracles::tracer::{CallTracer, StorageInvocationTracer}; +use zk_evm_1_3_1::{ abstractions::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, Tracer, VmLocalStateData, }, diff --git a/core/multivm_deps/vm_m6/src/oracles/tracer/transaction_result.rs b/core/lib/multivm/src/versions/vm_m6/oracles/tracer/transaction_result.rs similarity index 96% rename from core/multivm_deps/vm_m6/src/oracles/tracer/transaction_result.rs rename to core/lib/multivm/src/versions/vm_m6/oracles/tracer/transaction_result.rs index 0adbf36a9bed..661305fd3d8c 100644 --- a/core/multivm_deps/vm_m6/src/oracles/tracer/transaction_result.rs +++ b/core/lib/multivm/src/versions/vm_m6/oracles/tracer/transaction_result.rs @@ -1,4 +1,4 @@ -use zk_evm::{ +use zk_evm_1_3_1::{ abstractions::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, Tracer, VmLocalStateData, }, @@ -7,13 +7,13 @@ use zk_evm::{ }; use zksync_types::{vm_trace, U256}; -use crate::memory::SimpleMemory; -use crate::oracles::tracer::{ +use crate::vm_m6::memory::SimpleMemory; +use crate::vm_m6::oracles::tracer::{ CallTracer, ExecutionEndTracer, PendingRefundTracer, PubdataSpentTracer, StorageInvocationTracer, }; -use crate::vm::get_vm_hook_params; -use crate::{ +use crate::vm_m6::vm::get_vm_hook_params; +use crate::vm_m6::{ history_recorder::HistoryMode, oracles::tracer::utils::{ gas_spent_on_bytecodes_and_long_messages_this_opcode, print_debug_if_needed, read_pointer, diff --git a/core/multivm_deps/vm_m6/src/oracles/tracer/utils.rs b/core/lib/multivm/src/versions/vm_m6/oracles/tracer/utils.rs similarity index 94% rename from core/multivm_deps/vm_m6/src/oracles/tracer/utils.rs rename to core/lib/multivm/src/versions/vm_m6/oracles/tracer/utils.rs index 4c1f64b7181c..07c02d350552 100644 --- a/core/multivm_deps/vm_m6/src/oracles/tracer/utils.rs +++ b/core/lib/multivm/src/versions/vm_m6/oracles/tracer/utils.rs @@ -1,12 +1,12 @@ -use crate::history_recorder::HistoryMode; -use crate::memory::SimpleMemory; -use crate::utils::{aux_heap_page_from_base, heap_page_from_base}; -use crate::vm::{get_vm_hook_params, VM_HOOK_POSITION}; -use crate::vm_with_bootloader::BOOTLOADER_HEAP_PAGE; - -use zk_evm::aux_structures::MemoryPage; -use zk_evm::zkevm_opcode_defs::{FarCallABI, FarCallForwardPageType}; -use zk_evm::{ +use crate::vm_m6::history_recorder::HistoryMode; +use crate::vm_m6::memory::SimpleMemory; +use crate::vm_m6::utils::{aux_heap_page_from_base, heap_page_from_base}; +use crate::vm_m6::vm::{get_vm_hook_params, VM_HOOK_POSITION}; +use crate::vm_m6::vm_with_bootloader::BOOTLOADER_HEAP_PAGE; + +use zk_evm_1_3_1::aux_structures::MemoryPage; +use zk_evm_1_3_1::zkevm_opcode_defs::{FarCallABI, FarCallForwardPageType}; +use zk_evm_1_3_1::{ abstractions::{BeforeExecutionData, VmLocalStateData}, zkevm_opcode_defs::{FatPointer, LogOpcode, Opcode, UMAOpcode}, }; diff --git a/core/multivm_deps/vm_m6/src/oracles/tracer/validation.rs b/core/lib/multivm/src/versions/vm_m6/oracles/tracer/validation.rs similarity index 99% rename from core/multivm_deps/vm_m6/src/oracles/tracer/validation.rs rename to core/lib/multivm/src/versions/vm_m6/oracles/tracer/validation.rs index 6d2a08511eb4..4e55ad4db004 100644 --- a/core/multivm_deps/vm_m6/src/oracles/tracer/validation.rs +++ b/core/lib/multivm/src/versions/vm_m6/oracles/tracer/validation.rs @@ -2,7 +2,7 @@ use std::fmt; use std::fmt::Display; use std::{collections::HashSet, marker::PhantomData}; -use crate::{ +use crate::vm_m6::{ errors::VmRevertReasonParsingResult, history_recorder::HistoryMode, memory::SimpleMemory, @@ -12,15 +12,15 @@ use crate::{ }, }; -use zk_evm::{ +use zk_evm_1_3_1::{ abstractions::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, Tracer, VmLocalStateData, }, zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; -use crate::oracles::tracer::{utils::get_calldata_page_via_abi, StorageInvocationTracer}; -use crate::storage::{Storage, StoragePtr}; +use crate::vm_m6::oracles::tracer::{utils::get_calldata_page_via_abi, StorageInvocationTracer}; +use crate::vm_m6::storage::{Storage, StoragePtr}; use zksync_system_constants::{ ACCOUNT_CODE_STORAGE_ADDRESS, BOOTLOADER_ADDRESS, CONTRACT_DEPLOYER_ADDRESS, KECCAK256_PRECOMPILE_ADDRESS, L2_ETH_TOKEN_ADDRESS, MSG_VALUE_SIMULATOR_ADDRESS, diff --git a/core/multivm_deps/vm_m6/src/pubdata_utils.rs b/core/lib/multivm/src/versions/vm_m6/pubdata_utils.rs similarity index 90% rename from core/multivm_deps/vm_m6/src/pubdata_utils.rs rename to core/lib/multivm/src/versions/vm_m6/pubdata_utils.rs index 721f5925f1d1..b658dcc363a0 100644 --- a/core/multivm_deps/vm_m6/src/pubdata_utils.rs +++ b/core/lib/multivm/src/versions/vm_m6/pubdata_utils.rs @@ -1,11 +1,11 @@ -use crate::glue::GlueInto; -use crate::history_recorder::HistoryMode; -use crate::oracles::storage::storage_key_of_log; -use crate::storage::Storage; -use crate::utils::collect_storage_log_queries_after_timestamp; -use crate::VmInstance; +use crate::vm_m6::glue::GlueInto; +use crate::vm_m6::history_recorder::HistoryMode; +use crate::vm_m6::oracles::storage::storage_key_of_log; +use crate::vm_m6::storage::Storage; +use crate::vm_m6::utils::collect_storage_log_queries_after_timestamp; +use crate::vm_m6::VmInstance; use std::collections::HashMap; -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_1::aux_structures::Timestamp; use zksync_types::event::{extract_long_l2_to_l1_messages, extract_published_bytecodes}; use zksync_types::zkevm_test_harness::witness::sort_storage_access::sort_storage_access_queries; use zksync_types::{StorageKey, PUBLISH_BYTECODE_OVERHEAD, SYSTEM_CONTEXT_ADDRESS}; @@ -23,7 +23,7 @@ impl VmInstance { .iter() .filter(|log| log.sender != SYSTEM_CONTEXT_ADDRESS) .count() as u32) - * zk_evm::zkevm_opcode_defs::system_params::L1_MESSAGE_PUBDATA_BYTES; + * zk_evm_1_3_1::zkevm_opcode_defs::system_params::L1_MESSAGE_PUBDATA_BYTES; let l2_l1_long_messages_bytes: u32 = extract_long_l2_to_l1_messages(&events) .iter() .map(|event| event.len() as u32) diff --git a/core/multivm_deps/vm_m6/src/refunds.rs b/core/lib/multivm/src/versions/vm_m6/refunds.rs similarity index 97% rename from core/multivm_deps/vm_m6/src/refunds.rs rename to core/lib/multivm/src/versions/vm_m6/refunds.rs index f3aba742521f..da16d6219114 100644 --- a/core/multivm_deps/vm_m6/src/refunds.rs +++ b/core/lib/multivm/src/versions/vm_m6/refunds.rs @@ -1,10 +1,10 @@ -use crate::history_recorder::HistoryMode; -use crate::storage::Storage; -use crate::vm_with_bootloader::{ +use crate::vm_m6::history_recorder::HistoryMode; +use crate::vm_m6::storage::Storage; +use crate::vm_m6::vm_with_bootloader::{ eth_price_per_pubdata_byte, BOOTLOADER_HEAP_PAGE, TX_GAS_LIMIT_OFFSET, }; -use crate::VmInstance; -use zk_evm::aux_structures::Timestamp; +use crate::vm_m6::VmInstance; +use zk_evm_1_3_1::aux_structures::Timestamp; use zksync_types::U256; use zksync_utils::ceil_div_u256; diff --git a/core/multivm_deps/vm_m6/src/storage.rs b/core/lib/multivm/src/versions/vm_m6/storage.rs similarity index 100% rename from core/multivm_deps/vm_m6/src/storage.rs rename to core/lib/multivm/src/versions/vm_m6/storage.rs diff --git a/core/multivm_deps/vm_m6/src/test_utils.rs b/core/lib/multivm/src/versions/vm_m6/test_utils.rs similarity index 98% rename from core/multivm_deps/vm_m6/src/test_utils.rs rename to core/lib/multivm/src/versions/vm_m6/test_utils.rs index 5b881f3ade52..8b022c008a78 100644 --- a/core/multivm_deps/vm_m6/src/test_utils.rs +++ b/core/lib/multivm/src/versions/vm_m6/test_utils.rs @@ -9,7 +9,7 @@ use std::collections::HashMap; use itertools::Itertools; -use zk_evm::{aux_structures::Timestamp, vm_state::VmLocalState}; +use zk_evm_1_3_1::{aux_structures::Timestamp, vm_state::VmLocalState}; use zksync_contracts::test_contracts::LoadnextContractExecutionParams; use zksync_contracts::{deployer_contract, get_loadnext_contract, load_contract}; use zksync_types::{ @@ -24,9 +24,9 @@ use zksync_utils::{ address_to_h256, bytecode::hash_bytecode, h256_to_account_address, u256_to_h256, }; -use crate::storage::Storage; +use crate::vm_m6::storage::Storage; /// The tests here help us with the testing the VM -use crate::{ +use crate::vm_m6::{ event_sink::InMemoryEventSink, history_recorder::{ AppDataFrameManagerWithHistory, HistoryEnabled, HistoryMode, HistoryRecorder, diff --git a/core/multivm_deps/vm_m6/src/tests/bootloader.rs b/core/lib/multivm/src/versions/vm_m6/tests/bootloader.rs similarity index 99% rename from core/multivm_deps/vm_m6/src/tests/bootloader.rs rename to core/lib/multivm/src/versions/vm_m6/tests/bootloader.rs index e37b4259f2cb..26fe03453225 100644 --- a/core/multivm_deps/vm_m6/src/tests/bootloader.rs +++ b/core/lib/multivm/src/versions/vm_m6/tests/bootloader.rs @@ -36,7 +36,7 @@ // HistoryEnabled, OracleTools, TxRevertReason, VmBlockResult, VmExecutionResult, VmInstance, // }; -// use zk_evm::{ +// use zk_evm_1_3_1::{ // aux_structures::Timestamp, block_properties::BlockProperties, zkevm_opcode_defs::FarCallOpcode, // }; diff --git a/core/multivm_deps/vm_m6/src/tests/mod.rs b/core/lib/multivm/src/versions/vm_m6/tests/mod.rs similarity index 100% rename from core/multivm_deps/vm_m6/src/tests/mod.rs rename to core/lib/multivm/src/versions/vm_m6/tests/mod.rs diff --git a/core/multivm_deps/vm_m6/src/transaction_data.rs b/core/lib/multivm/src/versions/vm_m6/transaction_data.rs similarity index 99% rename from core/multivm_deps/vm_m6/src/transaction_data.rs rename to core/lib/multivm/src/versions/vm_m6/transaction_data.rs index a04641b3a995..f41afee3a40f 100644 --- a/core/multivm_deps/vm_m6/src/transaction_data.rs +++ b/core/lib/multivm/src/versions/vm_m6/transaction_data.rs @@ -1,4 +1,4 @@ -use zk_evm::zkevm_opcode_defs::system_params::MAX_TX_ERGS_LIMIT; +use zk_evm_1_3_1::zkevm_opcode_defs::system_params::MAX_TX_ERGS_LIMIT; use zksync_types::ethabi::{encode, Address, Token}; use zksync_types::fee::encoding_len; use zksync_types::l1::is_l1_tx_type; @@ -7,7 +7,7 @@ use zksync_types::{MAX_L2_TX_GAS_LIMIT, MAX_TXS_IN_BLOCK}; use zksync_utils::{address_to_h256, ceil_div_u256}; use zksync_utils::{bytecode::hash_bytecode, bytes_to_be_words, h256_to_u256}; -use crate::vm_with_bootloader::{ +use crate::vm_m6::vm_with_bootloader::{ BLOCK_OVERHEAD_GAS, BLOCK_OVERHEAD_PUBDATA, BOOTLOADER_TX_ENCODING_SPACE, }; diff --git a/core/multivm_deps/vm_m6/src/utils.rs b/core/lib/multivm/src/versions/vm_m6/utils.rs similarity index 96% rename from core/multivm_deps/vm_m6/src/utils.rs rename to core/lib/multivm/src/versions/vm_m6/utils.rs index 16fe10d56596..916f9c998d15 100644 --- a/core/multivm_deps/vm_m6/src/utils.rs +++ b/core/lib/multivm/src/versions/vm_m6/utils.rs @@ -1,14 +1,14 @@ -use crate::glue::GlueInto; -use crate::history_recorder::HistoryMode; -use crate::{ +use crate::vm_m6::glue::GlueInto; +use crate::vm_m6::history_recorder::HistoryMode; +use crate::vm_m6::{ memory::SimpleMemory, oracles::tracer::PubdataSpentTracer, vm_with_bootloader::BlockContext, VmInstance, }; use once_cell::sync::Lazy; -use crate::storage::Storage; -use zk_evm::block_properties::BlockProperties; -use zk_evm::{ +use crate::vm_m6::storage::Storage; +use zk_evm_1_3_1::block_properties::BlockProperties; +use zk_evm_1_3_1::{ aux_structures::{LogQuery, MemoryPage, Timestamp}, vm_state::PrimitiveValue, zkevm_opcode_defs::FatPointer, @@ -27,7 +27,8 @@ pub const ENTRY_POINT_PAGE: u32 = code_page_candidate_from_base(MemoryPage(INITI /// How many gas bootloader is allowed to spend within one block. /// Note that this value doesn't correspond to the gas limit of any particular transaction /// (except for the fact that, of course, gas limit for each transaction should be <= `BLOCK_GAS_LIMIT`). -pub const BLOCK_GAS_LIMIT: u32 = zk_evm::zkevm_opcode_defs::system_params::VM_INITIAL_FRAME_ERGS; +pub const BLOCK_GAS_LIMIT: u32 = + zk_evm_1_3_1::zkevm_opcode_defs::system_params::VM_INITIAL_FRAME_ERGS; pub const ETH_CALL_GAS_LIMIT: u32 = MAX_L2_TX_GAS_LIMIT as u32; #[derive(Debug, Clone)] diff --git a/core/multivm_deps/vm_m6/src/vm.rs b/core/lib/multivm/src/versions/vm_m6/vm.rs similarity index 97% rename from core/multivm_deps/vm_m6/src/vm.rs rename to core/lib/multivm/src/versions/vm_m6/vm.rs index 7a75c28ff314..d54c2d2f25a3 100644 --- a/core/multivm_deps/vm_m6/src/vm.rs +++ b/core/lib/multivm/src/versions/vm_m6/vm.rs @@ -1,40 +1,42 @@ use std::convert::TryFrom; use std::fmt::Debug; -use zk_evm::aux_structures::Timestamp; -use zk_evm::vm_state::{PrimitiveValue, VmLocalState, VmState}; -use zk_evm::witness_trace::DummyTracer; -use zk_evm::zkevm_opcode_defs::decoding::{AllowedPcOrImm, EncodingModeProduction, VmEncodingMode}; -use zk_evm::zkevm_opcode_defs::definitions::RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER; +use zk_evm_1_3_1::aux_structures::Timestamp; +use zk_evm_1_3_1::vm_state::{PrimitiveValue, VmLocalState, VmState}; +use zk_evm_1_3_1::witness_trace::DummyTracer; +use zk_evm_1_3_1::zkevm_opcode_defs::decoding::{ + AllowedPcOrImm, EncodingModeProduction, VmEncodingMode, +}; +use zk_evm_1_3_1::zkevm_opcode_defs::definitions::RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER; use zksync_system_constants::MAX_TXS_IN_BLOCK; use zksync_types::l2_to_l1_log::L2ToL1Log; use zksync_types::tx::tx_execution_info::{TxExecutionStatus, VmExecutionLogs}; use zksync_types::vm_trace::{Call, VmExecutionTrace, VmTrace}; use zksync_types::{L1BatchNumber, StorageLogQuery, VmEvent, U256}; -use crate::bootloader_state::BootloaderState; -use crate::errors::{TxRevertReason, VmRevertReason, VmRevertReasonParsingResult}; -use crate::event_sink::InMemoryEventSink; -use crate::events::merge_events; -use crate::glue::GlueInto; -use crate::history_recorder::{HistoryEnabled, HistoryMode}; -use crate::memory::SimpleMemory; -use crate::oracles::decommitter::DecommitterOracle; -use crate::oracles::precompile::PrecompilesProcessorWithHistory; -use crate::oracles::storage::StorageOracle; -use crate::oracles::tracer::{ +use crate::vm_m6::bootloader_state::BootloaderState; +use crate::vm_m6::errors::{TxRevertReason, VmRevertReason, VmRevertReasonParsingResult}; +use crate::vm_m6::event_sink::InMemoryEventSink; +use crate::vm_m6::events::merge_events; +use crate::vm_m6::glue::GlueInto; +use crate::vm_m6::history_recorder::{HistoryEnabled, HistoryMode}; +use crate::vm_m6::memory::SimpleMemory; +use crate::vm_m6::oracles::decommitter::DecommitterOracle; +use crate::vm_m6::oracles::precompile::PrecompilesProcessorWithHistory; +use crate::vm_m6::oracles::storage::StorageOracle; +use crate::vm_m6::oracles::tracer::{ BootloaderTracer, ExecutionEndTracer, OneTxTracer, PendingRefundTracer, PubdataSpentTracer, StorageInvocationTracer, TransactionResultTracer, ValidationError, ValidationTracer, ValidationTracerParams, }; -use crate::oracles::OracleWithHistory; -use crate::storage::Storage; -use crate::utils::{ +use crate::vm_m6::oracles::OracleWithHistory; +use crate::vm_m6::storage::Storage; +use crate::vm_m6::utils::{ calculate_computational_gas_used, collect_log_queries_after_timestamp, collect_storage_log_queries_after_timestamp, dump_memory_page_using_primitive_value, precompile_calls_count_after_timestamp, }; -use crate::vm_with_bootloader::{ +use crate::vm_m6::vm_with_bootloader::{ BootloaderJobType, DerivedBlockContext, TxExecutionMode, BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, }; @@ -168,7 +170,7 @@ pub enum VmExecutionStopReason { TracerRequestedStop, } -use crate::utils::VmExecutionResult as NewVmExecutionResult; +use crate::vm_m6::utils::VmExecutionResult as NewVmExecutionResult; fn vm_may_have_ended_inner( vm: &ZkSyncVmState, diff --git a/core/multivm_deps/vm_m6/src/vm_with_bootloader.rs b/core/lib/multivm/src/versions/vm_m6/vm_with_bootloader.rs similarity index 99% rename from core/multivm_deps/vm_m6/src/vm_with_bootloader.rs rename to core/lib/multivm/src/versions/vm_m6/vm_with_bootloader.rs index 5be0497d0467..35b78e92d1c8 100644 --- a/core/multivm_deps/vm_m6/src/vm_with_bootloader.rs +++ b/core/lib/multivm/src/versions/vm_m6/vm_with_bootloader.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use zk_evm::{ +use zk_evm_1_3_1::{ abstractions::{MAX_HEAP_PAGE_SIZE_IN_WORDS, MAX_MEMORY_BYTES}, aux_structures::{MemoryPage, Timestamp}, block_properties::BlockProperties, @@ -24,8 +24,8 @@ use zksync_utils::{ misc::ceil_div, }; -use crate::storage::Storage; -use crate::{ +use crate::vm_m6::storage::Storage; +use crate::vm_m6::{ bootloader_state::BootloaderState, history_recorder::HistoryMode, transaction_data::{TransactionData, L1_TX_TYPE}, diff --git a/core/multivm_deps/vm_virtual_blocks/README.md b/core/lib/multivm/src/versions/vm_virtual_blocks/README.md similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/README.md rename to core/lib/multivm/src/versions/vm_virtual_blocks/README.md diff --git a/core/lib/vm/src/bootloader_state/l2_block.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/l2_block.rs similarity index 90% rename from core/lib/vm/src/bootloader_state/l2_block.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/l2_block.rs index 8b08978a9adb..65d2ea64aeb9 100644 --- a/core/lib/vm/src/bootloader_state/l2_block.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/l2_block.rs @@ -2,10 +2,10 @@ use std::cmp::Ordering; use zksync_types::{MiniblockNumber, H256}; use zksync_utils::concat_and_hash; -use crate::bootloader_state::snapshot::L2BlockSnapshot; -use crate::bootloader_state::tx::BootloaderTx; -use crate::utils::l2_blocks::l2_block_hash; -use crate::{L2Block, L2BlockEnv}; +use crate::vm_virtual_blocks::bootloader_state::snapshot::L2BlockSnapshot; +use crate::vm_virtual_blocks::bootloader_state::tx::BootloaderTx; +use crate::vm_virtual_blocks::utils::l2_blocks::l2_block_hash; +use crate::vm_virtual_blocks::{L2Block, L2BlockEnv}; const EMPTY_TXS_ROLLING_HASH: H256 = H256::zero(); diff --git a/core/multivm_deps/vm_virtual_blocks/src/bootloader_state/mod.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/mod.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/bootloader_state/mod.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/mod.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/bootloader_state/snapshot.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/snapshot.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/bootloader_state/snapshot.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/snapshot.rs diff --git a/core/lib/vm/src/bootloader_state/state.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/state.rs similarity index 93% rename from core/lib/vm/src/bootloader_state/state.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/state.rs index ca6f54e233eb..b595b76b4f66 100644 --- a/core/lib/vm/src/bootloader_state/state.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/state.rs @@ -1,16 +1,16 @@ -use crate::bootloader_state::l2_block::BootloaderL2Block; -use crate::bootloader_state::snapshot::BootloaderStateSnapshot; -use crate::bootloader_state::utils::{apply_l2_block, apply_tx_to_memory}; +use crate::vm_virtual_blocks::bootloader_state::l2_block::BootloaderL2Block; +use crate::vm_virtual_blocks::bootloader_state::snapshot::BootloaderStateSnapshot; +use crate::vm_virtual_blocks::bootloader_state::utils::{apply_l2_block, apply_tx_to_memory}; use std::cmp::Ordering; use zksync_types::{L2ChainId, U256}; use zksync_utils::bytecode::CompressedBytecodeInfo; -use crate::constants::TX_DESCRIPTION_OFFSET; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::types::internals::TransactionData; -use crate::types::outputs::BootloaderMemory; -use crate::utils::l2_blocks::assert_next_block; -use crate::L2BlockEnv; +use crate::vm_virtual_blocks::constants::TX_DESCRIPTION_OFFSET; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; +use crate::vm_virtual_blocks::types::internals::TransactionData; +use crate::vm_virtual_blocks::types::outputs::BootloaderMemory; +use crate::vm_virtual_blocks::utils::l2_blocks::assert_next_block; +use crate::vm_virtual_blocks::L2BlockEnv; use super::tx::BootloaderTx; /// Intermediate bootloader-related VM state. diff --git a/core/lib/vm/src/bootloader_state/tx.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/tx.rs similarity index 95% rename from core/lib/vm/src/bootloader_state/tx.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/tx.rs index ecf40eca824e..73825312b5e1 100644 --- a/core/lib/vm/src/bootloader_state/tx.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/tx.rs @@ -1,4 +1,4 @@ -use crate::types::internals::TransactionData; +use crate::vm_virtual_blocks::types::internals::TransactionData; use zksync_types::{L2ChainId, H256, U256}; use zksync_utils::bytecode::CompressedBytecodeInfo; diff --git a/core/multivm_deps/vm_virtual_blocks/src/bootloader_state/utils.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/utils.rs similarity index 96% rename from core/multivm_deps/vm_virtual_blocks/src/bootloader_state/utils.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/utils.rs index 31ec2ede5995..197567734dd9 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/bootloader_state/utils.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/bootloader_state/utils.rs @@ -2,13 +2,13 @@ use zksync_types::U256; use zksync_utils::bytecode::CompressedBytecodeInfo; use zksync_utils::{bytes_to_be_words, h256_to_u256}; -use crate::bootloader_state::l2_block::BootloaderL2Block; -use crate::constants::{ +use crate::vm_virtual_blocks::bootloader_state::l2_block::BootloaderL2Block; +use crate::vm_virtual_blocks::constants::{ BOOTLOADER_TX_DESCRIPTION_OFFSET, BOOTLOADER_TX_DESCRIPTION_SIZE, COMPRESSED_BYTECODES_OFFSET, OPERATOR_REFUNDS_OFFSET, TX_DESCRIPTION_OFFSET, TX_OPERATOR_L2_BLOCK_INFO_OFFSET, TX_OPERATOR_SLOTS_PER_L2_BLOCK_INFO, TX_OVERHEAD_OFFSET, TX_TRUSTED_GAS_LIMIT_OFFSET, }; -use crate::{BootloaderMemory, TxExecutionMode}; +use crate::vm_virtual_blocks::{BootloaderMemory, TxExecutionMode}; use super::tx::BootloaderTx; diff --git a/core/multivm_deps/vm_virtual_blocks/src/constants.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/constants.rs similarity index 94% rename from core/multivm_deps/vm_virtual_blocks/src/constants.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/constants.rs index 975e9c8a3093..ed462581cb79 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/constants.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/constants.rs @@ -1,15 +1,15 @@ -use zk_evm::aux_structures::MemoryPage; +use zk_evm_1_3_3::aux_structures::MemoryPage; use zksync_system_constants::{ L1_GAS_PER_PUBDATA_BYTE, MAX_L2_TX_GAS_LIMIT, MAX_NEW_FACTORY_DEPS, MAX_TXS_IN_BLOCK, USED_BOOTLOADER_MEMORY_WORDS, }; -pub use zk_evm::zkevm_opcode_defs::system_params::{ +pub use zk_evm_1_3_3::zkevm_opcode_defs::system_params::{ ERGS_PER_CIRCUIT, INITIAL_STORAGE_WRITE_PUBDATA_BYTES, MAX_PUBDATA_PER_BLOCK, }; -use crate::old_vm::utils::heap_page_from_base; +use crate::vm_virtual_blocks::old_vm::utils::heap_page_from_base; /// Max cycles for a single transaction. pub const MAX_CYCLES_FOR_TX: u32 = u32::MAX; @@ -92,7 +92,8 @@ pub const RESULT_SUCCESS_FIRST_SLOT: u32 = /// How many gas bootloader is allowed to spend within one block. /// Note that this value doesn't correspond to the gas limit of any particular transaction /// (except for the fact that, of course, gas limit for each transaction should be <= `BLOCK_GAS_LIMIT`). -pub const BLOCK_GAS_LIMIT: u32 = zk_evm::zkevm_opcode_defs::system_params::VM_INITIAL_FRAME_ERGS; +pub const BLOCK_GAS_LIMIT: u32 = + zk_evm_1_3_3::zkevm_opcode_defs::system_params::VM_INITIAL_FRAME_ERGS; /// How many gas is allowed to spend on a single transaction in eth_call method pub const ETH_CALL_GAS_LIMIT: u32 = MAX_L2_TX_GAS_LIMIT as u32; diff --git a/core/multivm_deps/vm_virtual_blocks/src/errors/bootloader_error.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/errors/bootloader_error.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/errors/bootloader_error.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/errors/bootloader_error.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/errors/bytecode_compression.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/errors/bytecode_compression.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/errors/bytecode_compression.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/errors/bytecode_compression.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/errors/halt.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/errors/halt.rs similarity index 98% rename from core/multivm_deps/vm_virtual_blocks/src/errors/halt.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/errors/halt.rs index 10c8a8d702b9..59a35d0b9a0f 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/errors/halt.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/errors/halt.rs @@ -1,4 +1,4 @@ -use crate::errors::VmRevertReason; +use crate::vm_virtual_blocks::errors::VmRevertReason; use std::fmt::{Display, Formatter}; /// Structure for non-contract errors from the Virtual Machine (EVM). diff --git a/core/multivm_deps/vm_virtual_blocks/src/errors/mod.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/errors/mod.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/errors/mod.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/errors/mod.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/errors/tx_revert_reason.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/errors/tx_revert_reason.rs similarity index 99% rename from core/multivm_deps/vm_virtual_blocks/src/errors/tx_revert_reason.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/errors/tx_revert_reason.rs index 8e65b15a0976..95c61c523569 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/errors/tx_revert_reason.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/errors/tx_revert_reason.rs @@ -1,4 +1,4 @@ -use crate::errors::halt::Halt; +use crate::vm_virtual_blocks::errors::halt::Halt; use std::fmt::Display; diff --git a/core/multivm_deps/vm_virtual_blocks/src/errors/vm_revert_reason.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/errors/vm_revert_reason.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/errors/vm_revert_reason.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/errors/vm_revert_reason.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/implementation/bytecode.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/bytecode.rs similarity index 97% rename from core/multivm_deps/vm_virtual_blocks/src/implementation/bytecode.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/implementation/bytecode.rs index 053d980bad73..d1ce1ce9d293 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/implementation/bytecode.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/bytecode.rs @@ -5,7 +5,7 @@ use zksync_types::U256; use zksync_utils::bytecode::{compress_bytecode, hash_bytecode, CompressedBytecodeInfo}; use zksync_utils::bytes_to_be_words; -use crate::{HistoryMode, Vm}; +use crate::vm_virtual_blocks::{HistoryMode, Vm}; 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/multivm_deps/vm_virtual_blocks/src/implementation/execution.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/execution.rs similarity index 93% rename from core/multivm_deps/vm_virtual_blocks/src/implementation/execution.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/implementation/execution.rs index 9944a37f7e83..71d941bc24ea 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/implementation/execution.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/execution.rs @@ -1,17 +1,17 @@ -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_state::WriteStorage; -use crate::old_vm::{ +use crate::vm_virtual_blocks::old_vm::{ history_recorder::HistoryMode, utils::{vm_may_have_ended_inner, VmExecutionResult}, }; -use crate::tracers::{ +use crate::vm_virtual_blocks::tracers::{ traits::{BoxedTracer, ExecutionEndTracer, ExecutionProcessing, VmTracer}, DefaultExecutionTracer, RefundsTracer, }; -use crate::types::{inputs::VmExecutionMode, outputs::VmExecutionResultAndLogs}; -use crate::vm::Vm; -use crate::VmExecutionStopReason; +use crate::vm_virtual_blocks::types::{inputs::VmExecutionMode, outputs::VmExecutionResultAndLogs}; +use crate::vm_virtual_blocks::vm::Vm; +use crate::vm_virtual_blocks::VmExecutionStopReason; impl Vm { pub(crate) fn inspect_inner( diff --git a/core/multivm_deps/vm_virtual_blocks/src/implementation/gas.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/gas.rs similarity index 90% rename from core/multivm_deps/vm_virtual_blocks/src/implementation/gas.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/implementation/gas.rs index a7938125540e..1d6de3f0b6cc 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/implementation/gas.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/gas.rs @@ -1,8 +1,8 @@ use zksync_state::WriteStorage; -use crate::old_vm::history_recorder::HistoryMode; -use crate::tracers::DefaultExecutionTracer; -use crate::vm::Vm; +use crate::vm_virtual_blocks::old_vm::history_recorder::HistoryMode; +use crate::vm_virtual_blocks::tracers::DefaultExecutionTracer; +use crate::vm_virtual_blocks::vm::Vm; impl Vm { /// Returns the amount of gas remaining to the VM. diff --git a/core/multivm_deps/vm_virtual_blocks/src/implementation/logs.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/logs.rs similarity index 86% rename from core/multivm_deps/vm_virtual_blocks/src/implementation/logs.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/implementation/logs.rs index 6bc095740ef1..92de884c2a5c 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/implementation/logs.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/logs.rs @@ -1,14 +1,14 @@ -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_state::WriteStorage; use zksync_types::l2_to_l1_log::L2ToL1Log; use zksync_types::tx::tx_execution_info::VmExecutionLogs; use zksync_types::VmEvent; -use crate::old_vm::events::merge_events; -use crate::old_vm::history_recorder::HistoryMode; -use crate::old_vm::utils::precompile_calls_count_after_timestamp; -use crate::vm::Vm; +use crate::vm_virtual_blocks::old_vm::events::merge_events; +use crate::vm_virtual_blocks::old_vm::history_recorder::HistoryMode; +use crate::vm_virtual_blocks::old_vm::utils::precompile_calls_count_after_timestamp; +use crate::vm_virtual_blocks::vm::Vm; impl Vm { pub(crate) fn collect_execution_logs_after_timestamp( diff --git a/core/multivm_deps/vm_virtual_blocks/src/implementation/mod.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/mod.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/implementation/mod.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/implementation/mod.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/implementation/snapshots.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/snapshots.rs similarity index 97% rename from core/multivm_deps/vm_virtual_blocks/src/implementation/snapshots.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/implementation/snapshots.rs index e3ddb14a59ee..fa1067402772 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/implementation/snapshots.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/snapshots.rs @@ -2,10 +2,10 @@ use vise::{Buckets, EncodeLabelSet, EncodeLabelValue, Family, Histogram, Metrics use std::time::Duration; -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_state::WriteStorage; -use crate::{ +use crate::vm_virtual_blocks::{ old_vm::{history_recorder::HistoryEnabled, oracles::OracleWithHistory}, types::internals::VmSnapshot, vm::Vm, diff --git a/core/multivm_deps/vm_virtual_blocks/src/implementation/statistics.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/statistics.rs similarity index 89% rename from core/multivm_deps/vm_virtual_blocks/src/implementation/statistics.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/implementation/statistics.rs index 54b77d574940..3d690e063647 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/implementation/statistics.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/statistics.rs @@ -1,14 +1,14 @@ -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_state::WriteStorage; use zksync_types::U256; -use crate::old_vm::history_recorder::HistoryMode; -use crate::tracers::DefaultExecutionTracer; -use crate::types::outputs::VmExecutionStatistics; -use crate::vm::Vm; +use crate::vm_virtual_blocks::old_vm::history_recorder::HistoryMode; +use crate::vm_virtual_blocks::tracers::DefaultExecutionTracer; +use crate::vm_virtual_blocks::types::outputs::VmExecutionStatistics; +use crate::vm_virtual_blocks::vm::Vm; -use crate::VmMemoryMetrics; +use crate::vm_virtual_blocks::VmMemoryMetrics; /// Module responsible for observing the VM behavior, i.e. calculating the statistics of the VM runs /// or reporting the VM memory usage. diff --git a/core/multivm_deps/vm_virtual_blocks/src/implementation/tx.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/tx.rs similarity index 82% rename from core/multivm_deps/vm_virtual_blocks/src/implementation/tx.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/implementation/tx.rs index 8341782d8abf..da6bcd62c690 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/implementation/tx.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/implementation/tx.rs @@ -1,13 +1,15 @@ -use crate::constants::BOOTLOADER_HEAP_PAGE; -use crate::implementation::bytecode::{bytecode_to_factory_dep, compress_bytecodes}; -use zk_evm::aux_structures::Timestamp; +use crate::vm_virtual_blocks::constants::BOOTLOADER_HEAP_PAGE; +use crate::vm_virtual_blocks::implementation::bytecode::{ + bytecode_to_factory_dep, compress_bytecodes, +}; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_state::WriteStorage; use zksync_types::l1::is_l1_tx_type; use zksync_types::Transaction; -use crate::old_vm::history_recorder::HistoryMode; -use crate::types::internals::TransactionData; -use crate::vm::Vm; +use crate::vm_virtual_blocks::old_vm::history_recorder::HistoryMode; +use crate::vm_virtual_blocks::types::internals::TransactionData; +use crate::vm_virtual_blocks::vm::Vm; impl Vm { pub(crate) fn push_raw_transaction( diff --git a/core/multivm_deps/vm_virtual_blocks/src/lib.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/mod.rs similarity index 88% rename from core/multivm_deps/vm_virtual_blocks/src/lib.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/mod.rs index 6c356dbdff90..1e0b6df38927 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/lib.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/mod.rs @@ -1,8 +1,3 @@ -#![deny(unreachable_pub)] -#![deny(unused_crate_dependencies)] -#![warn(unused_extern_crates)] -#![warn(unused_imports)] - pub use old_vm::{ history_recorder::{HistoryDisabled, HistoryEnabled, HistoryMode}, memory::SimpleMemory, @@ -32,7 +27,7 @@ pub use utils::transaction_encoding::TransactionVmExt; pub use bootloader_state::BootloaderState; -pub use crate::vm::Vm; +pub use vm::Vm; mod bootloader_state; mod errors; diff --git a/core/multivm_deps/vm_virtual_blocks/src/old_vm/event_sink.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/event_sink.rs similarity index 99% rename from core/multivm_deps/vm_virtual_blocks/src/old_vm/event_sink.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/event_sink.rs index 03156e83b9fb..49ec162fd5e2 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/old_vm/event_sink.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/event_sink.rs @@ -1,9 +1,9 @@ -use crate::old_vm::{ +use crate::vm_virtual_blocks::old_vm::{ history_recorder::{AppDataFrameManagerWithHistory, HistoryEnabled, HistoryMode}, oracles::OracleWithHistory, }; use std::collections::HashMap; -use zk_evm::{ +use zk_evm_1_3_3::{ abstractions::EventSink, aux_structures::{LogQuery, Timestamp}, reference_impls::event_sink::EventMessage, diff --git a/core/lib/vm/src/old_vm/events.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/events.rs similarity index 98% rename from core/lib/vm/src/old_vm/events.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/events.rs index 384a0eb86d67..de918e069141 100644 --- a/core/lib/vm/src/old_vm/events.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/events.rs @@ -1,4 +1,4 @@ -use zk_evm::{ethereum_types::Address, reference_impls::event_sink::EventMessage}; +use zk_evm_1_3_3::{ethereum_types::Address, reference_impls::event_sink::EventMessage}; use zksync_types::{L1BatchNumber, VmEvent, EVENT_WRITER_ADDRESS, H256}; use zksync_utils::{be_chunks_to_h256_words, h256_to_account_address}; diff --git a/core/multivm_deps/vm_virtual_blocks/src/old_vm/history_recorder.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/history_recorder.rs similarity index 98% rename from core/multivm_deps/vm_virtual_blocks/src/old_vm/history_recorder.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/history_recorder.rs index 1a5f7db58664..a38ee1772459 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/old_vm/history_recorder.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/history_recorder.rs @@ -1,6 +1,6 @@ use std::{collections::HashMap, fmt::Debug, hash::Hash}; -use zk_evm::{ +use zk_evm_1_3_3::{ aux_structures::Timestamp, vm_state::PrimitiveValue, zkevm_opcode_defs::{self}, @@ -767,9 +767,9 @@ impl HistoryRecorder, H> { #[cfg(test)] mod tests { - use crate::old_vm::history_recorder::{HistoryRecorder, MemoryWrapper}; - use crate::HistoryDisabled; - use zk_evm::{aux_structures::Timestamp, vm_state::PrimitiveValue}; + use crate::vm_virtual_blocks::old_vm::history_recorder::{HistoryRecorder, MemoryWrapper}; + use crate::vm_virtual_blocks::HistoryDisabled; + use zk_evm_1_3_3::{aux_structures::Timestamp, vm_state::PrimitiveValue}; use zksync_types::U256; #[test] diff --git a/core/lib/vm/src/old_vm/memory.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/memory.rs similarity index 95% rename from core/lib/vm/src/old_vm/memory.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/memory.rs index 8569c135d1e2..f1a424c36aed 100644 --- a/core/lib/vm/src/old_vm/memory.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/memory.rs @@ -1,15 +1,17 @@ -use zk_evm::abstractions::{Memory, MemoryType}; -use zk_evm::aux_structures::{MemoryPage, MemoryQuery, Timestamp}; -use zk_evm::vm_state::PrimitiveValue; -use zk_evm::zkevm_opcode_defs::FatPointer; +use zk_evm_1_3_3::abstractions::{Memory, MemoryType}; +use zk_evm_1_3_3::aux_structures::{MemoryPage, MemoryQuery, Timestamp}; +use zk_evm_1_3_3::vm_state::PrimitiveValue; +use zk_evm_1_3_3::zkevm_opcode_defs::FatPointer; use zksync_types::U256; -use crate::old_vm::history_recorder::{ +use crate::vm_virtual_blocks::old_vm::history_recorder::{ FramedStack, HistoryEnabled, HistoryMode, IntFrameManagerWithHistory, MemoryWithHistory, MemoryWrapper, WithHistory, }; -use crate::old_vm::oracles::OracleWithHistory; -use crate::old_vm::utils::{aux_heap_page_from_base, heap_page_from_base, stack_page_from_base}; +use crate::vm_virtual_blocks::old_vm::oracles::OracleWithHistory; +use crate::vm_virtual_blocks::old_vm::utils::{ + aux_heap_page_from_base, heap_page_from_base, stack_page_from_base, +}; #[derive(Debug, Clone, PartialEq)] pub struct SimpleMemory { diff --git a/core/multivm_deps/vm_virtual_blocks/src/old_vm/mod.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/mod.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/old_vm/mod.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/mod.rs diff --git a/core/lib/vm/src/old_vm/oracles/decommitter.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/decommitter.rs similarity index 96% rename from core/lib/vm/src/old_vm/oracles/decommitter.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/decommitter.rs index e91380a6d385..050b244736ff 100644 --- a/core/lib/vm/src/old_vm/oracles/decommitter.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/decommitter.rs @@ -1,11 +1,13 @@ use std::collections::HashMap; use std::fmt::Debug; -use crate::old_vm::history_recorder::{HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory}; +use crate::vm_virtual_blocks::old_vm::history_recorder::{ + HistoryEnabled, HistoryMode, HistoryRecorder, WithHistory, +}; -use zk_evm::abstractions::MemoryType; -use zk_evm::aux_structures::Timestamp; -use zk_evm::{ +use zk_evm_1_3_3::abstractions::MemoryType; +use zk_evm_1_3_3::aux_structures::Timestamp; +use zk_evm_1_3_3::{ abstractions::{DecommittmentProcessor, Memory}, aux_structures::{DecommittmentQuery, MemoryIndex, MemoryLocation, MemoryPage, MemoryQuery}, }; @@ -171,7 +173,7 @@ impl DecommittmentProcess memory: &mut M, ) -> Result< ( - zk_evm::aux_structures::DecommittmentQuery, + zk_evm_1_3_3::aux_structures::DecommittmentQuery, Option>, ), anyhow::Error, diff --git a/core/multivm_deps/vm_virtual_blocks/src/old_vm/oracles/mod.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/mod.rs similarity index 80% rename from core/multivm_deps/vm_virtual_blocks/src/old_vm/oracles/mod.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/mod.rs index daa2e21672df..d0213fd9b35b 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/old_vm/oracles/mod.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/mod.rs @@ -1,4 +1,4 @@ -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; pub(crate) mod decommitter; pub(crate) mod precompile; diff --git a/core/multivm_deps/vm_1_3_2/src/oracles/precompile.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/precompile.rs similarity index 95% rename from core/multivm_deps/vm_1_3_2/src/oracles/precompile.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/precompile.rs index c75a8899f8f5..03f96ec9e622 100644 --- a/core/multivm_deps/vm_1_3_2/src/oracles/precompile.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/precompile.rs @@ -1,4 +1,4 @@ -use zk_evm::{ +use zk_evm_1_3_3::{ abstractions::Memory, abstractions::PrecompileCyclesWitness, abstractions::PrecompilesProcessor, @@ -6,7 +6,9 @@ use zk_evm::{ precompiles::DefaultPrecompilesProcessor, }; -use crate::history_recorder::{HistoryEnabled, HistoryMode, HistoryRecorder}; +use crate::vm_virtual_blocks::old_vm::history_recorder::{ + HistoryEnabled, HistoryMode, HistoryRecorder, +}; use super::OracleWithHistory; diff --git a/core/lib/vm/src/old_vm/oracles/storage.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/storage.rs similarity index 96% rename from core/lib/vm/src/old_vm/oracles/storage.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/storage.rs index e1f5467253aa..70186b78b324 100644 --- a/core/lib/vm/src/old_vm/oracles/storage.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/oracles/storage.rs @@ -1,13 +1,13 @@ use std::collections::HashMap; -use crate::old_vm::history_recorder::{ +use crate::vm_virtual_blocks::old_vm::history_recorder::{ AppDataFrameManagerWithHistory, HashMapHistoryEvent, HistoryEnabled, HistoryMode, HistoryRecorder, StorageWrapper, WithHistory, }; -use zk_evm::abstractions::RefundedAmounts; -use zk_evm::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES; -use zk_evm::{ +use zk_evm_1_3_3::abstractions::RefundedAmounts; +use zk_evm_1_3_3::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES; +use zk_evm_1_3_3::{ abstractions::{RefundType, Storage as VmStorageOracle}, aux_structures::{LogQuery, Timestamp}, }; @@ -331,8 +331,8 @@ fn get_pubdata_price_bytes(_query: &LogQuery, is_initial: bool) -> u32 { // TODO (SMA-1702): take into account the content of the log query, i.e. values that contain mostly zeroes // should cost less. if is_initial { - zk_evm::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES as u32 + zk_evm_1_3_3::zkevm_opcode_defs::system_params::INITIAL_STORAGE_WRITE_PUBDATA_BYTES as u32 } else { - zk_evm::zkevm_opcode_defs::system_params::REPEATED_STORAGE_WRITE_PUBDATA_BYTES as u32 + zk_evm_1_3_3::zkevm_opcode_defs::system_params::REPEATED_STORAGE_WRITE_PUBDATA_BYTES as u32 } } diff --git a/core/lib/vm/src/old_vm/utils.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/utils.rs similarity index 94% rename from core/lib/vm/src/old_vm/utils.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/utils.rs index 7ef211aa5407..654977784957 100644 --- a/core/lib/vm/src/old_vm/utils.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/old_vm/utils.rs @@ -1,11 +1,13 @@ -use crate::old_vm::memory::SimpleMemory; +use crate::vm_virtual_blocks::old_vm::memory::SimpleMemory; -use crate::types::internals::ZkSyncVmState; -use crate::HistoryMode; +use crate::vm_virtual_blocks::types::internals::ZkSyncVmState; +use crate::vm_virtual_blocks::HistoryMode; -use zk_evm::zkevm_opcode_defs::decoding::{AllowedPcOrImm, EncodingModeProduction, VmEncodingMode}; -use zk_evm::zkevm_opcode_defs::RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER; -use zk_evm::{ +use zk_evm_1_3_3::zkevm_opcode_defs::decoding::{ + AllowedPcOrImm, EncodingModeProduction, VmEncodingMode, +}; +use zk_evm_1_3_3::zkevm_opcode_defs::RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER; +use zk_evm_1_3_3::{ aux_structures::{MemoryPage, Timestamp}, vm_state::PrimitiveValue, zkevm_opcode_defs::FatPointer, diff --git a/core/lib/vm/src/tests/bootloader.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/bootloader.rs similarity index 73% rename from core/lib/vm/src/tests/bootloader.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/bootloader.rs index 0479672a6ef2..edecf75f0c79 100644 --- a/core/lib/vm/src/tests/bootloader.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/bootloader.rs @@ -1,13 +1,15 @@ use zksync_types::U256; -use crate::constants::BOOTLOADER_HEAP_PAGE; -use crate::errors::Halt; -use crate::tests::tester::VmTesterBuilder; -use crate::tests::utils::{get_bootloader, verify_required_memory, BASE_SYSTEM_CONTRACTS}; -use crate::types::inputs::system_env::TxExecutionMode; - -use crate::types::outputs::ExecutionResult; -use crate::{HistoryEnabled, VmExecutionMode}; +use crate::vm_virtual_blocks::constants::BOOTLOADER_HEAP_PAGE; +use crate::vm_virtual_blocks::errors::Halt; +use crate::vm_virtual_blocks::tests::tester::VmTesterBuilder; +use crate::vm_virtual_blocks::tests::utils::{ + get_bootloader, verify_required_memory, BASE_SYSTEM_CONTRACTS, +}; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; + +use crate::vm_virtual_blocks::types::outputs::ExecutionResult; +use crate::vm_virtual_blocks::{HistoryEnabled, VmExecutionMode}; #[test] fn test_dummy_bootloader() { diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/bytecode_publishing.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/bytecode_publishing.rs similarity index 80% rename from core/multivm_deps/vm_virtual_blocks/src/tests/bytecode_publishing.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/bytecode_publishing.rs index 60e45e252570..ba68052d0e9d 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/bytecode_publishing.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/bytecode_publishing.rs @@ -1,10 +1,10 @@ use zksync_types::event::extract_long_l2_to_l1_messages; use zksync_utils::bytecode::compress_bytecode; -use crate::tests::tester::{DeployContractsTx, TxType, VmTesterBuilder}; -use crate::tests::utils::read_test_contract; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{HistoryEnabled, VmExecutionMode}; +use crate::vm_virtual_blocks::tests::tester::{DeployContractsTx, TxType, VmTesterBuilder}; +use crate::vm_virtual_blocks::tests::utils::read_test_contract; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; +use crate::vm_virtual_blocks::{HistoryEnabled, VmExecutionMode}; #[test] fn test_bytecode_publishing() { diff --git a/core/lib/vm/src/tests/call_tracer.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/call_tracer.rs similarity index 89% rename from core/lib/vm/src/tests/call_tracer.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/call_tracer.rs index d55ba826030f..b86b86d035e5 100644 --- a/core/lib/vm/src/tests/call_tracer.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/call_tracer.rs @@ -1,7 +1,7 @@ -use crate::constants::BLOCK_GAS_LIMIT; -use crate::tests::tester::VmTesterBuilder; -use crate::tests::utils::{read_max_depth_contract, read_test_contract}; -use crate::{CallTracer, HistoryEnabled, TxExecutionMode, VmExecutionMode}; +use crate::vm_virtual_blocks::constants::BLOCK_GAS_LIMIT; +use crate::vm_virtual_blocks::tests::tester::VmTesterBuilder; +use crate::vm_virtual_blocks::tests::utils::{read_max_depth_contract, read_test_contract}; +use crate::vm_virtual_blocks::{CallTracer, HistoryEnabled, TxExecutionMode, VmExecutionMode}; use once_cell::sync::OnceCell; use std::sync::Arc; use zksync_types::{Address, Execute}; diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/default_aa.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/default_aa.rs similarity index 87% rename from core/multivm_deps/vm_virtual_blocks/src/tests/default_aa.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/default_aa.rs index 173a76bf3083..35f904c5810e 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/default_aa.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/default_aa.rs @@ -4,10 +4,12 @@ use zksync_types::system_contracts::{DEPLOYMENT_NONCE_INCREMENT, TX_NONCE_INCREM use zksync_types::{get_code_key, get_known_code_key, get_nonce_key, AccountTreeId, U256}; use zksync_utils::u256_to_h256; -use crate::tests::tester::{DeployContractsTx, TxType, VmTesterBuilder}; -use crate::tests::utils::{get_balance, read_test_contract, verify_required_storage}; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{HistoryEnabled, VmExecutionMode}; +use crate::vm_virtual_blocks::tests::tester::{DeployContractsTx, TxType, VmTesterBuilder}; +use crate::vm_virtual_blocks::tests::utils::{ + get_balance, read_test_contract, verify_required_storage, +}; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; +use crate::vm_virtual_blocks::{HistoryEnabled, VmExecutionMode}; #[test] fn test_default_aa_interaction() { diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/gas_limit.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/gas_limit.rs similarity index 77% rename from core/multivm_deps/vm_virtual_blocks/src/tests/gas_limit.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/gas_limit.rs index c439b6d89b20..b0f38d71b6a3 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/gas_limit.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/gas_limit.rs @@ -1,11 +1,13 @@ use zksync_types::fee::Fee; use zksync_types::Execute; -use crate::constants::{BOOTLOADER_HEAP_PAGE, TX_DESCRIPTION_OFFSET, TX_GAS_LIMIT_OFFSET}; -use crate::tests::tester::VmTesterBuilder; +use crate::vm_virtual_blocks::constants::{ + BOOTLOADER_HEAP_PAGE, TX_DESCRIPTION_OFFSET, TX_GAS_LIMIT_OFFSET, +}; +use crate::vm_virtual_blocks::tests::tester::VmTesterBuilder; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::HistoryDisabled; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; +use crate::vm_virtual_blocks::HistoryDisabled; /// Checks that `TX_GAS_LIMIT_OFFSET` constant is correct. #[test] diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/get_used_contracts.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/get_used_contracts.rs similarity index 90% rename from core/multivm_deps/vm_virtual_blocks/src/tests/get_used_contracts.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/get_used_contracts.rs index 2749d7a79b92..88d9fc262f0d 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/get_used_contracts.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/get_used_contracts.rs @@ -9,10 +9,10 @@ use zksync_types::{Execute, U256}; use zksync_utils::bytecode::hash_bytecode; use zksync_utils::h256_to_u256; -use crate::tests::tester::{TxType, VmTesterBuilder}; -use crate::tests::utils::{read_test_contract, BASE_SYSTEM_CONTRACTS}; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{HistoryDisabled, HistoryMode, Vm, VmExecutionMode}; +use crate::vm_virtual_blocks::tests::tester::{TxType, VmTesterBuilder}; +use crate::vm_virtual_blocks::tests::utils::{read_test_contract, BASE_SYSTEM_CONTRACTS}; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; +use crate::vm_virtual_blocks::{HistoryDisabled, HistoryMode, Vm, VmExecutionMode}; #[test] fn test_get_used_contracts() { diff --git a/core/lib/vm/src/tests/invalid_bytecode.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/invalid_bytecode.rs similarity index 95% rename from core/lib/vm/src/tests/invalid_bytecode.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/invalid_bytecode.rs index 6353d445e718..5636d3a164a3 100644 --- a/core/lib/vm/src/tests/invalid_bytecode.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/invalid_bytecode.rs @@ -1,9 +1,9 @@ use zksync_types::H256; use zksync_utils::h256_to_u256; -use crate::tests::tester::VmTesterBuilder; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{HistoryEnabled, TxRevertReason}; +use crate::vm_virtual_blocks::tests::tester::VmTesterBuilder; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; +use crate::vm_virtual_blocks::{HistoryEnabled, TxRevertReason}; // TODO this test requires a lot of hacks for bypassing the bytecode checks in the VM. // Port it later, it's not significant. for now diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/is_write_initial.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/is_write_initial.rs similarity index 81% rename from core/multivm_deps/vm_virtual_blocks/src/tests/is_write_initial.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/is_write_initial.rs index 7ccdf072744a..1a10be44c18b 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/is_write_initial.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/is_write_initial.rs @@ -1,10 +1,10 @@ use zksync_state::ReadStorage; use zksync_types::get_nonce_key; -use crate::tests::tester::{Account, TxType, VmTesterBuilder}; -use crate::tests::utils::read_test_contract; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{HistoryDisabled, VmExecutionMode}; +use crate::vm_virtual_blocks::tests::tester::{Account, TxType, VmTesterBuilder}; +use crate::vm_virtual_blocks::tests::utils::read_test_contract; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; +use crate::vm_virtual_blocks::{HistoryDisabled, VmExecutionMode}; #[test] fn test_is_write_initial_behaviour() { diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/l1_tx_execution.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/l1_tx_execution.rs similarity index 91% rename from core/multivm_deps/vm_virtual_blocks/src/tests/l1_tx_execution.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/l1_tx_execution.rs index 2f83d8b3f208..b5e7856134cb 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/l1_tx_execution.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/l1_tx_execution.rs @@ -4,11 +4,13 @@ use zksync_types::storage_writes_deduplicator::StorageWritesDeduplicator; use zksync_types::{get_code_key, get_known_code_key, U256}; use zksync_utils::u256_to_h256; -use crate::tests::tester::{TxType, VmTesterBuilder}; -use crate::tests::utils::{read_test_contract, verify_required_storage, BASE_SYSTEM_CONTRACTS}; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::types::internals::TransactionData; -use crate::{HistoryEnabled, VmExecutionMode}; +use crate::vm_virtual_blocks::tests::tester::{TxType, VmTesterBuilder}; +use crate::vm_virtual_blocks::tests::utils::{ + read_test_contract, verify_required_storage, BASE_SYSTEM_CONTRACTS, +}; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; +use crate::vm_virtual_blocks::types::internals::TransactionData; +use crate::vm_virtual_blocks::{HistoryEnabled, VmExecutionMode}; #[test] fn test_l1_tx_execution() { diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/l2_blocks.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/l2_blocks.rs similarity index 98% rename from core/multivm_deps/vm_virtual_blocks/src/tests/l2_blocks.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/l2_blocks.rs index 192930d73a47..994e2fbea72f 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/l2_blocks.rs @@ -3,17 +3,17 @@ //! The description for each of the tests can be found in the corresponding `.yul` file. //! -use crate::constants::{ +use crate::vm_virtual_blocks::constants::{ BOOTLOADER_HEAP_PAGE, TX_OPERATOR_L2_BLOCK_INFO_OFFSET, TX_OPERATOR_SLOTS_PER_L2_BLOCK_INFO, }; -use crate::tests::tester::default_l1_batch; -use crate::tests::tester::VmTesterBuilder; -use crate::utils::l2_blocks::get_l2_block_hash_key; -use crate::{ +use crate::vm_virtual_blocks::tests::tester::default_l1_batch; +use crate::vm_virtual_blocks::tests::tester::VmTesterBuilder; +use crate::vm_virtual_blocks::utils::l2_blocks::get_l2_block_hash_key; +use crate::vm_virtual_blocks::{ ExecutionResult, Halt, HistoryEnabled, HistoryMode, L2BlockEnv, TxExecutionMode, Vm, VmExecutionMode, }; -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_state::{ReadStorage, WriteStorage}; use zksync_system_constants::{ CURRENT_VIRTUAL_BLOCK_INFO_POSITION, REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_BYTE, diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/mod.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/mod.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/tests/mod.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/mod.rs diff --git a/core/lib/vm/src/tests/nonce_holder.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/nonce_holder.rs similarity index 92% rename from core/lib/vm/src/tests/nonce_holder.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/nonce_holder.rs index 35af6ad15f43..ea6de34eebf5 100644 --- a/core/lib/vm/src/tests/nonce_holder.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/nonce_holder.rs @@ -1,11 +1,13 @@ use zksync_types::{Execute, Nonce}; -use crate::errors::VmRevertReason; -use crate::tests::tester::{Account, VmTesterBuilder}; -use crate::tests::utils::read_nonce_holder_tester; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::types::internals::TransactionData; -use crate::{ExecutionResult, Halt, HistoryEnabled, TxRevertReason, VmExecutionMode}; +use crate::vm_virtual_blocks::errors::VmRevertReason; +use crate::vm_virtual_blocks::tests::tester::{Account, VmTesterBuilder}; +use crate::vm_virtual_blocks::tests::utils::read_nonce_holder_tester; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; +use crate::vm_virtual_blocks::types::internals::TransactionData; +use crate::vm_virtual_blocks::{ + ExecutionResult, Halt, HistoryEnabled, TxRevertReason, VmExecutionMode, +}; pub enum NonceHolderTestMode { SetValueUnderNonce, diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/refunds.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/refunds.rs similarity index 93% rename from core/multivm_deps/vm_virtual_blocks/src/tests/refunds.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/refunds.rs index 4314f57489eb..0ad6ed9955af 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/refunds.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/refunds.rs @@ -1,9 +1,9 @@ -use crate::tests::tester::{DeployContractsTx, TxType, VmTesterBuilder}; -use crate::tests::utils::read_test_contract; -use crate::types::inputs::system_env::TxExecutionMode; +use crate::vm_virtual_blocks::tests::tester::{DeployContractsTx, TxType, VmTesterBuilder}; +use crate::vm_virtual_blocks::tests::utils::read_test_contract; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; -use crate::types::internals::TransactionData; -use crate::{HistoryEnabled, VmExecutionMode}; +use crate::vm_virtual_blocks::types::internals::TransactionData; +use crate::vm_virtual_blocks::{HistoryEnabled, VmExecutionMode}; #[test] fn test_predetermined_refunded_gas() { diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/require_eip712.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/require_eip712.rs similarity index 95% rename from core/multivm_deps/vm_virtual_blocks/src/tests/require_eip712.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/require_eip712.rs index 4cb69b906ca4..dc7ab47d5bcc 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/require_eip712.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/require_eip712.rs @@ -11,10 +11,10 @@ use zksync_types::transaction_request::TransactionRequest; use zksync_types::utils::storage_key_for_standard_token_balance; use zksync_types::{AccountTreeId, Address, Eip712Domain, Execute, Nonce, Transaction, U256}; -use crate::tests::tester::{Account, VmTester, VmTesterBuilder}; -use crate::tests::utils::read_many_owners_custom_account_contract; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{HistoryDisabled, VmExecutionMode}; +use crate::vm_virtual_blocks::tests::tester::{Account, VmTester, VmTesterBuilder}; +use crate::vm_virtual_blocks::tests::utils::read_many_owners_custom_account_contract; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; +use crate::vm_virtual_blocks::{HistoryDisabled, VmExecutionMode}; impl VmTester { pub(crate) fn get_eth_balance(&mut self, address: Address) -> U256 { diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/rollbacks.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/rollbacks.rs similarity index 95% rename from core/multivm_deps/vm_virtual_blocks/src/tests/rollbacks.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/rollbacks.rs index 1fa6a2afe390..733e39de8f1f 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/rollbacks.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/rollbacks.rs @@ -5,12 +5,12 @@ use zksync_contracts::test_contracts::LoadnextContractExecutionParams; use zksync_types::{Execute, U256}; -use crate::tests::tester::{ +use crate::vm_virtual_blocks::tests::tester::{ DeployContractsTx, TransactionTestInfo, TxModifier, TxType, VmTesterBuilder, }; -use crate::tests::utils::read_test_contract; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::HistoryEnabled; +use crate::vm_virtual_blocks::tests::utils::read_test_contract; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; +use crate::vm_virtual_blocks::HistoryEnabled; #[test] fn test_vm_rollbacks() { diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/simple_execution.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/simple_execution.rs similarity index 91% rename from core/multivm_deps/vm_virtual_blocks/src/tests/simple_execution.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/simple_execution.rs index 40e51739b072..d8fdcead2e93 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/simple_execution.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/simple_execution.rs @@ -1,6 +1,6 @@ -use crate::tests::tester::{TxType, VmTesterBuilder}; -use crate::types::outputs::ExecutionResult; -use crate::{HistoryDisabled, VmExecutionMode}; +use crate::vm_virtual_blocks::tests::tester::{TxType, VmTesterBuilder}; +use crate::vm_virtual_blocks::types::outputs::ExecutionResult; +use crate::vm_virtual_blocks::{HistoryDisabled, VmExecutionMode}; #[test] fn estimate_fee() { diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/tester/inner_state.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/inner_state.rs similarity index 92% rename from core/multivm_deps/vm_virtual_blocks/src/tests/tester/inner_state.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/inner_state.rs index 08220724b4dd..0a6d9c03afe6 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/tester/inner_state.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/inner_state.rs @@ -1,14 +1,16 @@ use std::collections::HashMap; -use zk_evm::aux_structures::Timestamp; -use zk_evm::vm_state::VmLocalState; +use zk_evm_1_3_3::aux_structures::Timestamp; +use zk_evm_1_3_3::vm_state::VmLocalState; use zksync_state::WriteStorage; use zksync_types::{StorageKey, StorageLogQuery, StorageValue, U256}; -use crate::old_vm::event_sink::InMemoryEventSink; -use crate::old_vm::history_recorder::{AppDataFrameManagerWithHistory, HistoryRecorder}; -use crate::{HistoryEnabled, HistoryMode, SimpleMemory, Vm}; +use crate::vm_virtual_blocks::old_vm::event_sink::InMemoryEventSink; +use crate::vm_virtual_blocks::old_vm::history_recorder::{ + AppDataFrameManagerWithHistory, HistoryRecorder, +}; +use crate::vm_virtual_blocks::{HistoryEnabled, HistoryMode, SimpleMemory, Vm}; #[derive(Clone, Debug)] pub(crate) struct ModifiedKeysMap(HashMap); diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/tester/mod.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/mod.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/tests/tester/mod.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/mod.rs diff --git a/core/lib/vm/src/tests/tester/transaction_test_info.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/transaction_test_info.rs similarity index 98% rename from core/lib/vm/src/tests/tester/transaction_test_info.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/transaction_test_info.rs index 65ceb3c5cf3c..da25d6bb3320 100644 --- a/core/lib/vm/src/tests/tester/transaction_test_info.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/transaction_test_info.rs @@ -1,8 +1,8 @@ use zksync_types::{ExecuteTransactionCommon, Transaction}; -use crate::errors::VmRevertReason; -use crate::tests::tester::vm_tester::VmTester; -use crate::{ +use crate::vm_virtual_blocks::errors::VmRevertReason; +use crate::vm_virtual_blocks::tests::tester::vm_tester::VmTester; +use crate::vm_virtual_blocks::{ CurrentExecutionState, ExecutionResult, Halt, HistoryEnabled, TxRevertReason, VmExecutionMode, VmExecutionResultAndLogs, }; diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/tester/vm_tester.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/vm_tester.rs similarity index 95% rename from core/multivm_deps/vm_virtual_blocks/src/tests/tester/vm_tester.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/vm_tester.rs index 3e69d2f01a51..ab4bbe4ba4ab 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/tester/vm_tester.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tester/vm_tester.rs @@ -11,14 +11,16 @@ use zksync_types::{ use zksync_utils::bytecode::hash_bytecode; use zksync_utils::u256_to_h256; -use crate::constants::BLOCK_GAS_LIMIT; - -use crate::tests::tester::Account; -use crate::tests::tester::TxType; -use crate::tests::utils::read_test_contract; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::utils::l2_blocks::load_last_l2_block; -use crate::{HistoryMode, L1BatchEnv, L2Block, L2BlockEnv, SystemEnv, Vm, VmExecutionMode}; +use crate::vm_virtual_blocks::constants::BLOCK_GAS_LIMIT; + +use crate::vm_virtual_blocks::tests::tester::Account; +use crate::vm_virtual_blocks::tests::tester::TxType; +use crate::vm_virtual_blocks::tests::utils::read_test_contract; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; +use crate::vm_virtual_blocks::utils::l2_blocks::load_last_l2_block; +use crate::vm_virtual_blocks::{ + HistoryMode, L1BatchEnv, L2Block, L2BlockEnv, SystemEnv, Vm, VmExecutionMode, +}; pub(crate) type InMemoryStorageView = StorageView; diff --git a/core/lib/vm/src/tests/tracing_execution_error.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tracing_execution_error.rs similarity index 78% rename from core/lib/vm/src/tests/tracing_execution_error.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/tracing_execution_error.rs index dbe9f74a85bd..771061499413 100644 --- a/core/lib/vm/src/tests/tracing_execution_error.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/tracing_execution_error.rs @@ -1,10 +1,14 @@ use zksync_types::{Execute, H160}; -use crate::errors::VmRevertReason; -use crate::tests::tester::{ExpectedError, TransactionTestInfo, VmTesterBuilder}; -use crate::tests::utils::{get_execute_error_calldata, read_error_contract, BASE_SYSTEM_CONTRACTS}; -use crate::types::inputs::system_env::TxExecutionMode; -use crate::{HistoryEnabled, TxRevertReason}; +use crate::vm_virtual_blocks::errors::VmRevertReason; +use crate::vm_virtual_blocks::tests::tester::{ + ExpectedError, TransactionTestInfo, VmTesterBuilder, +}; +use crate::vm_virtual_blocks::tests::utils::{ + get_execute_error_calldata, read_error_contract, BASE_SYSTEM_CONTRACTS, +}; +use crate::vm_virtual_blocks::types::inputs::system_env::TxExecutionMode; +use crate::vm_virtual_blocks::{HistoryEnabled, TxRevertReason}; #[test] fn test_tracing_of_execution_errors() { diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/upgrade.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/upgrade.rs similarity index 97% rename from core/multivm_deps/vm_virtual_blocks/src/tests/upgrade.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/upgrade.rs index 05646326ffd1..871c68528592 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/upgrade.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/upgrade.rs @@ -1,4 +1,4 @@ -use zk_evm::aux_structures::Timestamp; +use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_types::{ ethabi::Contract, @@ -14,9 +14,11 @@ use zksync_contracts::{deployer_contract, load_contract, load_sys_contract, read use zksync_state::WriteStorage; use zksync_test_account::TxType; -use crate::tests::tester::VmTesterBuilder; -use crate::tests::utils::verify_required_storage; -use crate::{ExecutionResult, Halt, HistoryEnabled, TxExecutionMode, VmExecutionMode}; +use crate::vm_virtual_blocks::tests::tester::VmTesterBuilder; +use crate::vm_virtual_blocks::tests::utils::verify_required_storage; +use crate::vm_virtual_blocks::{ + ExecutionResult, Halt, HistoryEnabled, TxExecutionMode, VmExecutionMode, +}; use zksync_types::protocol_version::ProtocolUpgradeTxCommonData; use super::utils::read_test_contract; diff --git a/core/multivm_deps/vm_virtual_blocks/src/tests/utils.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/utils.rs similarity index 95% rename from core/multivm_deps/vm_virtual_blocks/src/tests/utils.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tests/utils.rs index f709ebdd8ede..d418a6f32e0d 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tests/utils.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tests/utils.rs @@ -1,7 +1,7 @@ use ethabi::Contract; use once_cell::sync::Lazy; -use crate::tests::tester::InMemoryStorageView; +use crate::vm_virtual_blocks::tests::tester::InMemoryStorageView; use zksync_contracts::{ load_contract, read_bytecode, read_zbin_bytecode, BaseSystemContracts, SystemContractCode, }; @@ -11,8 +11,8 @@ use zksync_types::{AccountTreeId, Address, StorageKey, H256, U256}; use zksync_utils::bytecode::hash_bytecode; use zksync_utils::{bytes_to_be_words, h256_to_u256, u256_to_h256}; -use crate::types::internals::ZkSyncVmState; -use crate::HistoryMode; +use crate::vm_virtual_blocks::types::internals::ZkSyncVmState; +use crate::vm_virtual_blocks::HistoryMode; pub(crate) static BASE_SYSTEM_CONTRACTS: Lazy = Lazy::new(BaseSystemContracts::load_from_disk); diff --git a/core/multivm_deps/vm_virtual_blocks/src/tracers/call.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/call.rs similarity index 94% rename from core/multivm_deps/vm_virtual_blocks/src/tracers/call.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tracers/call.rs index e7011cb4dcab..fd9545e7f18e 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tracers/call.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/call.rs @@ -2,8 +2,8 @@ use once_cell::sync::OnceCell; use std::marker::PhantomData; use std::sync::Arc; -use zk_evm::tracing::{AfterExecutionData, VmLocalStateData}; -use zk_evm::zkevm_opcode_defs::{ +use zk_evm_1_3_3::tracing::{AfterExecutionData, VmLocalStateData}; +use zk_evm_1_3_3::zkevm_opcode_defs::{ FarCallABI, FarCallOpcode, FatPointer, Opcode, RetOpcode, CALL_IMPLICIT_CALLDATA_FAT_PTR_REGISTER, RET_IMPLICIT_RETURNDATA_PARAMS_REGISTER, }; @@ -13,11 +13,13 @@ use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS; use zksync_types::vm_trace::{Call, CallType}; use zksync_types::U256; -use crate::errors::VmRevertReason; -use crate::old_vm::history_recorder::HistoryMode; -use crate::old_vm::memory::SimpleMemory; -use crate::tracers::traits::{DynTracer, ExecutionEndTracer, ExecutionProcessing, VmTracer}; -use crate::types::outputs::VmExecutionResultAndLogs; +use crate::vm_virtual_blocks::errors::VmRevertReason; +use crate::vm_virtual_blocks::old_vm::history_recorder::HistoryMode; +use crate::vm_virtual_blocks::old_vm::memory::SimpleMemory; +use crate::vm_virtual_blocks::tracers::traits::{ + DynTracer, ExecutionEndTracer, ExecutionProcessing, VmTracer, +}; +use crate::vm_virtual_blocks::types::outputs::VmExecutionResultAndLogs; #[derive(Debug, Clone)] pub struct CallTracer { diff --git a/core/multivm_deps/vm_virtual_blocks/src/tracers/default_tracers.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs similarity index 90% rename from core/multivm_deps/vm_virtual_blocks/src/tracers/default_tracers.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs index 7cc1e19869cf..ed08cb5d72f2 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tracers/default_tracers.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/default_tracers.rs @@ -1,8 +1,8 @@ use std::fmt::{Debug, Formatter}; -use zk_evm::witness_trace::DummyTracer; -use zk_evm::zkevm_opcode_defs::{Opcode, RetOpcode}; -use zk_evm::{ +use zk_evm_1_3_3::witness_trace::DummyTracer; +use zk_evm_1_3_3::zkevm_opcode_defs::{Opcode, RetOpcode}; +use zk_evm_1_3_3::{ tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, Tracer, VmLocalStateData, }, @@ -11,19 +11,21 @@ use zk_evm::{ use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::Timestamp; -use crate::bootloader_state::utils::apply_l2_block; -use crate::bootloader_state::BootloaderState; -use crate::constants::BOOTLOADER_HEAP_PAGE; -use crate::old_vm::history_recorder::HistoryMode; -use crate::old_vm::memory::SimpleMemory; -use crate::tracers::traits::{DynTracer, ExecutionEndTracer, ExecutionProcessing, VmTracer}; -use crate::tracers::utils::{ +use crate::vm_virtual_blocks::bootloader_state::utils::apply_l2_block; +use crate::vm_virtual_blocks::bootloader_state::BootloaderState; +use crate::vm_virtual_blocks::constants::BOOTLOADER_HEAP_PAGE; +use crate::vm_virtual_blocks::old_vm::history_recorder::HistoryMode; +use crate::vm_virtual_blocks::old_vm::memory::SimpleMemory; +use crate::vm_virtual_blocks::tracers::traits::{ + DynTracer, ExecutionEndTracer, ExecutionProcessing, VmTracer, +}; +use crate::vm_virtual_blocks::tracers::utils::{ computational_gas_price, gas_spent_on_bytecodes_and_long_messages_this_opcode, print_debug_if_needed, VmHook, }; -use crate::tracers::ResultTracer; -use crate::types::internals::ZkSyncVmState; -use crate::{VmExecutionMode, VmExecutionStopReason}; +use crate::vm_virtual_blocks::tracers::ResultTracer; +use crate::vm_virtual_blocks::types::internals::ZkSyncVmState; +use crate::vm_virtual_blocks::{VmExecutionMode, VmExecutionStopReason}; /// Default tracer for the VM. It manages the other tracers execution and stop the vm when needed. pub(crate) struct DefaultExecutionTracer { @@ -119,7 +121,7 @@ impl Tracer for DefaultExecutionTracer { memory: &Self::SupportedMemory, ) { if let VmExecutionMode::Bootloader = self.execution_mode { - let (next_opcode, _, _) = zk_evm::vm_state::read_and_decode( + let (next_opcode, _, _) = zk_evm_1_3_3::vm_state::read_and_decode( state.vm_local_state, memory, &mut DummyTracer, diff --git a/core/multivm_deps/vm_virtual_blocks/src/tracers/mod.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/mod.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/tracers/mod.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tracers/mod.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs similarity index 96% rename from core/multivm_deps/vm_virtual_blocks/src/tracers/refunds.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs index 84c6263f2aca..26ff824dea08 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs @@ -2,7 +2,7 @@ use vise::{Buckets, EncodeLabelSet, EncodeLabelValue, Family, Histogram, Metrics use std::collections::HashMap; -use zk_evm::{ +use zk_evm_1_3_3::{ aux_structures::Timestamp, tracing::{BeforeExecutionData, VmLocalStateData}, vm_state::VmLocalState, @@ -18,18 +18,20 @@ use zksync_types::{ use zksync_utils::bytecode::bytecode_len_in_bytes; use zksync_utils::{ceil_div_u256, u256_to_h256}; -use crate::bootloader_state::BootloaderState; -use crate::constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}; -use crate::old_vm::{ +use crate::vm_virtual_blocks::bootloader_state::BootloaderState; +use crate::vm_virtual_blocks::constants::{ + BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET, +}; +use crate::vm_virtual_blocks::old_vm::{ events::merge_events, history_recorder::HistoryMode, memory::SimpleMemory, oracles::storage::storage_key_of_log, utils::eth_price_per_pubdata_byte, }; -use crate::tracers::utils::gas_spent_on_bytecodes_and_long_messages_this_opcode; -use crate::tracers::{ +use crate::vm_virtual_blocks::tracers::utils::gas_spent_on_bytecodes_and_long_messages_this_opcode; +use crate::vm_virtual_blocks::tracers::{ traits::{DynTracer, ExecutionEndTracer, ExecutionProcessing, VmTracer}, utils::{get_vm_hook_params, VmHook}, }; -use crate::types::{ +use crate::vm_virtual_blocks::types::{ inputs::L1BatchEnv, internals::ZkSyncVmState, outputs::{Refunds, VmExecutionResultAndLogs}, @@ -311,7 +313,7 @@ pub(crate) fn pubdata_published( }) .filter(|log| log.sender != SYSTEM_CONTEXT_ADDRESS) .count() as u32) - * zk_evm::zkevm_opcode_defs::system_params::L1_MESSAGE_PUBDATA_BYTES; + * zk_evm_1_3_3::zkevm_opcode_defs::system_params::L1_MESSAGE_PUBDATA_BYTES; let l2_l1_long_messages_bytes: u32 = extract_long_l2_to_l1_messages(&events) .iter() .map(|event| event.len() as u32) diff --git a/core/multivm_deps/vm_virtual_blocks/src/tracers/result_tracer.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs similarity index 94% rename from core/multivm_deps/vm_virtual_blocks/src/tracers/result_tracer.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs index b8e089493565..051fda9ad396 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tracers/result_tracer.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/result_tracer.rs @@ -1,4 +1,4 @@ -use zk_evm::{ +use zk_evm_1_3_3::{ tracing::{AfterDecodingData, BeforeExecutionData, VmLocalStateData}, vm_state::{ErrorFlags, VmLocalState}, zkevm_opcode_defs::FatPointer, @@ -7,25 +7,25 @@ use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::U256; -use crate::bootloader_state::BootloaderState; -use crate::errors::VmRevertReason; -use crate::old_vm::{ +use crate::vm_virtual_blocks::bootloader_state::BootloaderState; +use crate::vm_virtual_blocks::errors::VmRevertReason; +use crate::vm_virtual_blocks::old_vm::{ history_recorder::HistoryMode, memory::SimpleMemory, utils::{vm_may_have_ended_inner, VmExecutionResult}, }; -use crate::tracers::{ +use crate::vm_virtual_blocks::tracers::{ traits::{DynTracer, ExecutionEndTracer, ExecutionProcessing, VmTracer}, utils::{get_vm_hook_params, read_pointer, VmHook}, }; -use crate::types::{ +use crate::vm_virtual_blocks::types::{ internals::ZkSyncVmState, outputs::{ExecutionResult, VmExecutionResultAndLogs}, }; -use crate::constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}; -use crate::{Halt, TxRevertReason}; -use crate::{VmExecutionMode, VmExecutionStopReason}; +use crate::vm_virtual_blocks::constants::{BOOTLOADER_HEAP_PAGE, RESULT_SUCCESS_FIRST_SLOT}; +use crate::vm_virtual_blocks::{Halt, TxRevertReason}; +use crate::vm_virtual_blocks::{VmExecutionMode, VmExecutionStopReason}; #[derive(Debug, Clone)] enum Result { diff --git a/core/multivm_deps/vm_virtual_blocks/src/tracers/storage_invocations.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/storage_invocations.rs similarity index 77% rename from core/multivm_deps/vm_virtual_blocks/src/tracers/storage_invocations.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tracers/storage_invocations.rs index ef4b59c60a88..b7e86e08c130 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tracers/storage_invocations.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/storage_invocations.rs @@ -1,7 +1,9 @@ -use crate::bootloader_state::BootloaderState; -use crate::old_vm::history_recorder::HistoryMode; -use crate::tracers::traits::{DynTracer, ExecutionEndTracer, ExecutionProcessing, VmTracer}; -use crate::types::internals::ZkSyncVmState; +use crate::vm_virtual_blocks::bootloader_state::BootloaderState; +use crate::vm_virtual_blocks::old_vm::history_recorder::HistoryMode; +use crate::vm_virtual_blocks::tracers::traits::{ + DynTracer, ExecutionEndTracer, ExecutionProcessing, VmTracer, +}; +use crate::vm_virtual_blocks::types::internals::ZkSyncVmState; use zksync_state::WriteStorage; #[derive(Debug, Default, Clone)] diff --git a/core/multivm_deps/vm_virtual_blocks/src/tracers/traits.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs similarity index 82% rename from core/multivm_deps/vm_virtual_blocks/src/tracers/traits.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs index 6e76a041fabc..989ee3989025 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tracers/traits.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/traits.rs @@ -1,14 +1,14 @@ -use zk_evm::tracing::{ +use zk_evm_1_3_3::tracing::{ AfterDecodingData, AfterExecutionData, BeforeExecutionData, VmLocalStateData, }; use zksync_state::{StoragePtr, WriteStorage}; -use crate::bootloader_state::BootloaderState; -use crate::old_vm::history_recorder::HistoryMode; -use crate::old_vm::memory::SimpleMemory; -use crate::types::internals::ZkSyncVmState; -use crate::types::outputs::VmExecutionResultAndLogs; -use crate::VmExecutionStopReason; +use crate::vm_virtual_blocks::bootloader_state::BootloaderState; +use crate::vm_virtual_blocks::old_vm::history_recorder::HistoryMode; +use crate::vm_virtual_blocks::old_vm::memory::SimpleMemory; +use crate::vm_virtual_blocks::types::internals::ZkSyncVmState; +use crate::vm_virtual_blocks::types::outputs::VmExecutionResultAndLogs; +use crate::vm_virtual_blocks::VmExecutionStopReason; /// Run tracer for collecting data during the vm execution cycles pub trait ExecutionProcessing: @@ -39,7 +39,7 @@ pub trait ExecutionEndTracer { } } -/// Version of zk_evm::Tracer suitable for dynamic dispatch. +/// Version of zk_evm_1_3_3::Tracer suitable for dynamic dispatch. pub trait DynTracer { fn before_decoding(&mut self, _state: VmLocalStateData<'_>, _memory: &SimpleMemory) {} fn after_decoding( diff --git a/core/multivm_deps/vm_virtual_blocks/src/tracers/utils.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/utils.rs similarity index 94% rename from core/multivm_deps/vm_virtual_blocks/src/tracers/utils.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tracers/utils.rs index 43a4a6fc33fb..9122e0f1b0ea 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tracers/utils.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/utils.rs @@ -1,6 +1,6 @@ -use zk_evm::aux_structures::MemoryPage; -use zk_evm::zkevm_opcode_defs::{FarCallABI, FarCallForwardPageType}; -use zk_evm::{ +use zk_evm_1_3_3::aux_structures::MemoryPage; +use zk_evm_1_3_3::zkevm_opcode_defs::{FarCallABI, FarCallForwardPageType}; +use zk_evm_1_3_3::{ tracing::{BeforeExecutionData, VmLocalStateData}, zkevm_opcode_defs::{FatPointer, LogOpcode, Opcode, UMAOpcode}, }; @@ -12,12 +12,12 @@ use zksync_system_constants::{ use zksync_types::U256; use zksync_utils::u256_to_h256; -use crate::constants::{ +use crate::vm_virtual_blocks::constants::{ BOOTLOADER_HEAP_PAGE, VM_HOOK_PARAMS_COUNT, VM_HOOK_PARAMS_START_POSITION, VM_HOOK_POSITION, }; -use crate::old_vm::history_recorder::HistoryMode; -use crate::old_vm::memory::SimpleMemory; -use crate::old_vm::utils::{aux_heap_page_from_base, heap_page_from_base}; +use crate::vm_virtual_blocks::old_vm::history_recorder::HistoryMode; +use crate::vm_virtual_blocks::old_vm::memory::SimpleMemory; +use crate::vm_virtual_blocks::old_vm::utils::{aux_heap_page_from_base, heap_page_from_base}; #[derive(Clone, Debug, Copy)] pub(crate) enum VmHook { diff --git a/core/lib/vm/src/tracers/validation/error.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/validation/error.rs similarity index 94% rename from core/lib/vm/src/tracers/validation/error.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tracers/validation/error.rs index 8fb104cb67a3..3f2465f41b40 100644 --- a/core/lib/vm/src/tracers/validation/error.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/validation/error.rs @@ -1,4 +1,4 @@ -use crate::Halt; +use crate::vm_virtual_blocks::Halt; use std::fmt::Display; use zksync_types::vm_trace::ViolatedValidationRule; diff --git a/core/multivm_deps/vm_virtual_blocks/src/tracers/validation/mod.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/validation/mod.rs similarity index 97% rename from core/multivm_deps/vm_virtual_blocks/src/tracers/validation/mod.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tracers/validation/mod.rs index e019c9428a98..a1e9762dbd9c 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/tracers/validation/mod.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/validation/mod.rs @@ -6,7 +6,7 @@ use std::sync::Arc; use std::{collections::HashSet, marker::PhantomData}; use once_cell::sync::OnceCell; -use zk_evm::{ +use zk_evm_1_3_3::{ tracing::{BeforeExecutionData, VmLocalStateData}, zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, }; @@ -25,10 +25,12 @@ use zksync_utils::{ be_bytes_to_safe_address, h256_to_account_address, u256_to_account_address, u256_to_h256, }; -use crate::old_vm::history_recorder::HistoryMode; -use crate::old_vm::memory::SimpleMemory; -use crate::tracers::traits::{DynTracer, ExecutionEndTracer, ExecutionProcessing, VmTracer}; -use crate::tracers::utils::{ +use crate::vm_virtual_blocks::old_vm::history_recorder::HistoryMode; +use crate::vm_virtual_blocks::old_vm::memory::SimpleMemory; +use crate::vm_virtual_blocks::tracers::traits::{ + DynTracer, ExecutionEndTracer, ExecutionProcessing, VmTracer, +}; +use crate::vm_virtual_blocks::tracers::utils::{ computational_gas_price, get_calldata_page_via_abi, print_debug_if_needed, VmHook, }; @@ -39,7 +41,7 @@ use types::NewTrustedValidationItems; use types::ValidationTracerMode; use zksync_types::vm_trace::ViolatedValidationRule; -use crate::VmExecutionResultAndLogs; +use crate::vm_virtual_blocks::VmExecutionResultAndLogs; /// Tracer that is used to ensure that the validation adheres to all the rules /// to prevent DDoS attacks on the server. diff --git a/core/multivm_deps/vm_virtual_blocks/src/tracers/validation/params.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/validation/params.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/tracers/validation/params.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tracers/validation/params.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/tracers/validation/types.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/validation/types.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/tracers/validation/types.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/tracers/validation/types.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/inputs/execution_mode.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/inputs/execution_mode.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/types/inputs/execution_mode.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/inputs/execution_mode.rs diff --git a/core/lib/vm/src/types/inputs/l1_batch_env.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/inputs/l1_batch_env.rs similarity index 94% rename from core/lib/vm/src/types/inputs/l1_batch_env.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/inputs/l1_batch_env.rs index ff8433257698..260d5b72fdd3 100644 --- a/core/lib/vm/src/types/inputs/l1_batch_env.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/types/inputs/l1_batch_env.rs @@ -1,11 +1,11 @@ use std::collections::HashMap; -use crate::L2BlockEnv; -use zk_evm::address_to_u256; +use crate::vm_virtual_blocks::L2BlockEnv; +use zk_evm_1_3_3::address_to_u256; use zksync_types::{Address, L1BatchNumber, H256, U256}; use zksync_utils::h256_to_u256; -use crate::utils::fee::derive_base_fee_and_gas_per_pubdata; +use crate::vm_virtual_blocks::utils::fee::derive_base_fee_and_gas_per_pubdata; /// Unique params for each block #[derive(Debug, Clone)] diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/inputs/l2_block.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/inputs/l2_block.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/types/inputs/l2_block.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/inputs/l2_block.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/inputs/mod.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/inputs/mod.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/types/inputs/mod.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/inputs/mod.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/inputs/system_env.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/inputs/system_env.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/types/inputs/system_env.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/inputs/system_env.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/internals/mod.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/mod.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/types/internals/mod.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/mod.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/internals/snapshot.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/snapshot.rs similarity index 69% rename from core/multivm_deps/vm_virtual_blocks/src/types/internals/snapshot.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/snapshot.rs index 3b336d5e3541..d48e046ddf4d 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/types/internals/snapshot.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/snapshot.rs @@ -1,6 +1,6 @@ -use zk_evm::vm_state::VmLocalState; +use zk_evm_1_3_3::vm_state::VmLocalState; -use crate::bootloader_state::BootloaderStateSnapshot; +use crate::vm_virtual_blocks::bootloader_state::BootloaderStateSnapshot; /// A snapshot of the VM that holds enough information to /// rollback the VM to some historical state. diff --git a/core/lib/vm/src/types/internals/transaction_data.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/transaction_data.rs similarity index 99% rename from core/lib/vm/src/types/internals/transaction_data.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/transaction_data.rs index 7d8598842d83..55f942d99283 100644 --- a/core/lib/vm/src/types/internals/transaction_data.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/transaction_data.rs @@ -11,7 +11,7 @@ use zksync_types::{ use zksync_utils::address_to_h256; use zksync_utils::{bytecode::hash_bytecode, bytes_to_be_words, h256_to_u256}; -use crate::utils::overhead::{get_amortized_overhead, OverheadCoeficients}; +use crate::vm_virtual_blocks::utils::overhead::{get_amortized_overhead, OverheadCoeficients}; /// This structure represents the data that is used by /// the Bootloader to describe the transaction. diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/internals/vm_state.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/vm_state.rs similarity index 93% rename from core/multivm_deps/vm_virtual_blocks/src/types/internals/vm_state.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/vm_state.rs index 101bbe101c27..aaa28bfbb974 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/types/internals/vm_state.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/vm_state.rs @@ -1,4 +1,4 @@ -use zk_evm::{ +use zk_evm_1_3_3::{ aux_structures::MemoryPage, aux_structures::Timestamp, block_properties::BlockProperties, @@ -10,7 +10,7 @@ use zk_evm::{ }, }; -use zk_evm::zkevm_opcode_defs::{ +use zk_evm_1_3_3::zkevm_opcode_defs::{ BOOTLOADER_BASE_PAGE, BOOTLOADER_CODE_PAGE, STARTING_BASE_PAGE, STARTING_TIMESTAMP, }; use zksync_state::{StoragePtr, WriteStorage}; @@ -19,16 +19,16 @@ use zksync_types::block::legacy_miniblock_hash; use zksync_types::{zkevm_test_harness::INITIAL_MONOTONIC_CYCLE_COUNTER, Address, MiniblockNumber}; use zksync_utils::h256_to_u256; -use crate::bootloader_state::BootloaderState; -use crate::constants::BOOTLOADER_HEAP_PAGE; -use crate::old_vm::{ +use crate::vm_virtual_blocks::bootloader_state::BootloaderState; +use crate::vm_virtual_blocks::constants::BOOTLOADER_HEAP_PAGE; +use crate::vm_virtual_blocks::old_vm::{ event_sink::InMemoryEventSink, history_recorder::HistoryMode, memory::SimpleMemory, oracles::decommitter::DecommitterOracle, oracles::precompile::PrecompilesProcessorWithHistory, oracles::storage::StorageOracle, }; -use crate::types::inputs::{L1BatchEnv, SystemEnv}; -use crate::utils::l2_blocks::{assert_next_block, load_last_l2_block}; -use crate::L2Block; +use crate::vm_virtual_blocks::types::inputs::{L1BatchEnv, SystemEnv}; +use crate::vm_virtual_blocks::utils::l2_blocks::{assert_next_block, load_last_l2_block}; +use crate::vm_virtual_blocks::L2Block; pub type ZkSyncVmState = VmState< StorageOracle, diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/mod.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/mod.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/types/mod.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/mod.rs diff --git a/core/lib/vm/src/types/outputs/execution_result.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/outputs/execution_result.rs similarity index 97% rename from core/lib/vm/src/types/outputs/execution_result.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/outputs/execution_result.rs index 44aa053bfc15..4e4d3ffff6d4 100644 --- a/core/lib/vm/src/types/outputs/execution_result.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/types/outputs/execution_result.rs @@ -1,4 +1,4 @@ -use crate::{Halt, VmExecutionStatistics, VmRevertReason}; +use crate::vm_virtual_blocks::{Halt, VmExecutionStatistics, VmRevertReason}; use zksync_system_constants::PUBLISH_BYTECODE_OVERHEAD; use zksync_types::event::{extract_long_l2_to_l1_messages, extract_published_bytecodes}; use zksync_types::tx::tx_execution_info::VmExecutionLogs; diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/outputs/execution_state.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/outputs/execution_state.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/types/outputs/execution_state.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/outputs/execution_state.rs diff --git a/core/lib/vm/src/types/outputs/finished_l1batch.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/outputs/finished_l1batch.rs similarity index 84% rename from core/lib/vm/src/types/outputs/finished_l1batch.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/outputs/finished_l1batch.rs index 064d4c2d6586..44deba256a34 100644 --- a/core/lib/vm/src/types/outputs/finished_l1batch.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/types/outputs/finished_l1batch.rs @@ -1,4 +1,4 @@ -use crate::{BootloaderMemory, CurrentExecutionState, VmExecutionResultAndLogs}; +use crate::vm_virtual_blocks::{BootloaderMemory, CurrentExecutionState, VmExecutionResultAndLogs}; /// State of the VM after the batch execution. #[derive(Debug, Clone)] diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/outputs/l2_block.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/outputs/l2_block.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/types/outputs/l2_block.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/outputs/l2_block.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/outputs/mod.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/outputs/mod.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/types/outputs/mod.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/outputs/mod.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/types/outputs/statistic.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/outputs/statistic.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/types/outputs/statistic.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/types/outputs/statistic.rs diff --git a/core/multivm_deps/vm_virtual_blocks/src/utils/fee.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/utils/fee.rs similarity index 93% rename from core/multivm_deps/vm_virtual_blocks/src/utils/fee.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/utils/fee.rs index b89c996575a2..d4808e91bf4f 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/utils/fee.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/utils/fee.rs @@ -2,7 +2,7 @@ use zksync_system_constants::MAX_GAS_PER_PUBDATA_BYTE; use zksync_utils::ceil_div; -use crate::old_vm::utils::eth_price_per_pubdata_byte; +use crate::vm_virtual_blocks::old_vm::utils::eth_price_per_pubdata_byte; /// Calcluates the amount of gas required to publish one byte of pubdata pub fn base_fee_to_gas_per_pubdata(l1_gas_price: u64, base_fee: u64) -> u64 { diff --git a/core/lib/vm/src/utils/l2_blocks.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/utils/l2_blocks.rs similarity index 98% rename from core/lib/vm/src/utils/l2_blocks.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/utils/l2_blocks.rs index 189ad8e79c5d..d5621b2880a1 100644 --- a/core/lib/vm/src/utils/l2_blocks.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/utils/l2_blocks.rs @@ -1,4 +1,4 @@ -use crate::{L2Block, L2BlockEnv}; +use crate::vm_virtual_blocks::{L2Block, L2BlockEnv}; use zksync_state::{ReadStorage, StoragePtr}; use zksync_system_constants::{ SYSTEM_CONTEXT_ADDRESS, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION, diff --git a/core/multivm_deps/vm_virtual_blocks/src/utils/mod.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/utils/mod.rs similarity index 100% rename from core/multivm_deps/vm_virtual_blocks/src/utils/mod.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/utils/mod.rs diff --git a/core/lib/vm/src/utils/overhead.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/utils/overhead.rs similarity index 98% rename from core/lib/vm/src/utils/overhead.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/utils/overhead.rs index 1d502ef2d152..85446534a2ec 100644 --- a/core/lib/vm/src/utils/overhead.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/utils/overhead.rs @@ -1,5 +1,7 @@ -use crate::constants::{BLOCK_OVERHEAD_GAS, BLOCK_OVERHEAD_PUBDATA, BOOTLOADER_TX_ENCODING_SPACE}; -use zk_evm::zkevm_opcode_defs::system_params::MAX_TX_ERGS_LIMIT; +use crate::vm_virtual_blocks::constants::{ + BLOCK_OVERHEAD_GAS, BLOCK_OVERHEAD_PUBDATA, BOOTLOADER_TX_ENCODING_SPACE, +}; +use zk_evm_1_3_3::zkevm_opcode_defs::system_params::MAX_TX_ERGS_LIMIT; use zksync_system_constants::{MAX_L2_TX_GAS_LIMIT, MAX_TXS_IN_BLOCK}; use zksync_types::l1::is_l1_tx_type; use zksync_types::U256; diff --git a/core/multivm_deps/vm_virtual_blocks/src/utils/transaction_encoding.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/utils/transaction_encoding.rs similarity index 87% rename from core/multivm_deps/vm_virtual_blocks/src/utils/transaction_encoding.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/utils/transaction_encoding.rs index e911a2805d82..b45ec4d14110 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/utils/transaction_encoding.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/utils/transaction_encoding.rs @@ -1,4 +1,4 @@ -use crate::types::internals::TransactionData; +use crate::vm_virtual_blocks::types::internals::TransactionData; use zksync_types::Transaction; /// Extension for transactions, specific for VM. Required for bypassing the orphan rule diff --git a/core/multivm_deps/vm_virtual_blocks/src/vm.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/vm.rs similarity index 93% rename from core/multivm_deps/vm_virtual_blocks/src/vm.rs rename to core/lib/multivm/src/versions/vm_virtual_blocks/vm.rs index ee196683db37..5bb8d086509c 100644 --- a/core/multivm_deps/vm_virtual_blocks/src/vm.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/vm.rs @@ -2,18 +2,18 @@ use zksync_state::{StoragePtr, WriteStorage}; use zksync_types::Transaction; use zksync_utils::bytecode::CompressedBytecodeInfo; -use crate::old_vm::events::merge_events; -use crate::old_vm::history_recorder::{HistoryEnabled, HistoryMode}; +use crate::vm_virtual_blocks::old_vm::events::merge_events; +use crate::vm_virtual_blocks::old_vm::history_recorder::{HistoryEnabled, HistoryMode}; -use crate::bootloader_state::BootloaderState; -use crate::errors::BytecodeCompressionError; -use crate::tracers::traits::VmTracer; -use crate::types::{ +use crate::vm_virtual_blocks::bootloader_state::BootloaderState; +use crate::vm_virtual_blocks::errors::BytecodeCompressionError; +use crate::vm_virtual_blocks::tracers::traits::VmTracer; +use crate::vm_virtual_blocks::types::{ inputs::{L1BatchEnv, SystemEnv, VmExecutionMode}, internals::{new_vm_state, VmSnapshot, ZkSyncVmState}, outputs::{BootloaderMemory, CurrentExecutionState, VmExecutionResultAndLogs}, }; -use crate::L2BlockEnv; +use crate::vm_virtual_blocks::L2BlockEnv; /// Main entry point for Virtual Machine integration. /// The instance should process only one l1 batch diff --git a/core/lib/multivm/src/vm_instance.rs b/core/lib/multivm/src/vm_instance.rs index e0529ca41645..1302f7745dd4 100644 --- a/core/lib/multivm/src/vm_instance.rs +++ b/core/lib/multivm/src/vm_instance.rs @@ -1,7 +1,7 @@ -use std::collections::HashSet; -use vm_latest::{ +use crate::vm_latest::{ FinishedL1Batch, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionMode, VmMemoryMetrics, }; +use std::collections::HashSet; use zksync_state::{ReadStorage, StorageView}; use zksync_utils::bytecode::{hash_bytecode, CompressedBytecodeInfo}; @@ -18,12 +18,12 @@ pub struct VmInstance { #[derive(Debug)] pub(crate) enum VmInstanceVersion { - VmM5(Box>>), - VmM6(Box, H::VmM6Mode>>), - Vm1_3_2(Box, H::Vm1_3_2Mode>>), - VmVirtualBlocks(Box, H::VmVirtualBlocksMode>>), + VmM5(Box>>), + VmM6(Box, H::VmM6Mode>>), + Vm1_3_2(Box, H::Vm1_3_2Mode>>), + VmVirtualBlocks(Box, H::VmVirtualBlocksMode>>), VmVirtualBlocksRefundsEnhancement( - Box, H::VmVirtualBlocksRefundsEnhancement>>, + Box, H::VmVirtualBlocksRefundsEnhancement>>, ), } @@ -32,14 +32,14 @@ impl VmInstance { pub fn push_transaction(&mut self, tx: &zksync_types::Transaction) { match &mut self.vm { VmInstanceVersion::VmM5(vm) => { - vm_m5::vm_with_bootloader::push_transaction_to_bootloader_memory( + crate::vm_m5::vm_with_bootloader::push_transaction_to_bootloader_memory( vm, tx, self.system_env.execution_mode.glue_into(), ) } VmInstanceVersion::VmM6(vm) => { - vm_m6::vm_with_bootloader::push_transaction_to_bootloader_memory( + crate::vm_m6::vm_with_bootloader::push_transaction_to_bootloader_memory( vm, tx, self.system_env.execution_mode.glue_into(), @@ -47,7 +47,7 @@ impl VmInstance { ) } VmInstanceVersion::Vm1_3_2(vm) => { - vm_1_3_2::vm_with_bootloader::push_transaction_to_bootloader_memory( + crate::vm_1_3_2::vm_with_bootloader::push_transaction_to_bootloader_memory( vm, tx, self.system_env.execution_mode.glue_into(), @@ -68,17 +68,17 @@ impl VmInstance { match &mut self.vm { VmInstanceVersion::VmM5(vm) => vm .execute_till_block_end( - vm_m5::vm_with_bootloader::BootloaderJobType::BlockPostprocessing, + crate::vm_m5::vm_with_bootloader::BootloaderJobType::BlockPostprocessing, ) .glue_into(), VmInstanceVersion::VmM6(vm) => vm .execute_till_block_end( - vm_m6::vm_with_bootloader::BootloaderJobType::BlockPostprocessing, + crate::vm_m6::vm_with_bootloader::BootloaderJobType::BlockPostprocessing, ) .glue_into(), VmInstanceVersion::Vm1_3_2(vm) => vm .execute_till_block_end( - vm_1_3_2::vm_with_bootloader::BootloaderJobType::BlockPostprocessing, + crate::vm_1_3_2::vm_with_bootloader::BootloaderJobType::BlockPostprocessing, ) .glue_into(), VmInstanceVersion::VmVirtualBlocks(vm) => { @@ -106,7 +106,7 @@ impl VmInstance { /// Execute the batch without stops after each tx. /// This method allows to execute the part of the VM cycle after executing all txs. - pub fn execute_block_tip(&mut self) -> vm_latest::VmExecutionResultAndLogs { + pub fn execute_block_tip(&mut self) -> crate::vm_latest::VmExecutionResultAndLogs { match &mut self.vm { VmInstanceVersion::VmM5(vm) => vm.execute_block_tip().glue_into(), VmInstanceVersion::VmM6(vm) => vm.execute_block_tip().glue_into(), @@ -121,13 +121,13 @@ impl VmInstance { } /// Execute next transaction and stop vm right after next transaction execution - pub fn execute_next_transaction(&mut self) -> vm_latest::VmExecutionResultAndLogs { + pub fn execute_next_transaction(&mut self) -> crate::vm_latest::VmExecutionResultAndLogs { match &mut self.vm { VmInstanceVersion::VmM5(vm) => match self.system_env.execution_mode { TxExecutionMode::VerifyExecute => vm.execute_next_tx().glue_into(), TxExecutionMode::EstimateFee | TxExecutionMode::EthCall => vm .execute_till_block_end( - vm_m5::vm_with_bootloader::BootloaderJobType::TransactionExecution, + crate::vm_m5::vm_with_bootloader::BootloaderJobType::TransactionExecution, ) .glue_into(), }, @@ -143,7 +143,7 @@ impl VmInstance { } TxExecutionMode::EstimateFee | TxExecutionMode::EthCall => vm .execute_till_block_end( - vm_m6::vm_with_bootloader::BootloaderJobType::TransactionExecution, + crate::vm_m6::vm_with_bootloader::BootloaderJobType::TransactionExecution, ) .glue_into(), } @@ -160,7 +160,7 @@ impl VmInstance { } TxExecutionMode::EstimateFee | TxExecutionMode::EthCall => vm .execute_till_block_end( - vm_1_3_2::vm_with_bootloader::BootloaderJobType::TransactionExecution, + crate::vm_1_3_2::vm_with_bootloader::BootloaderJobType::TransactionExecution, ) .glue_into(), } @@ -189,7 +189,7 @@ impl VmInstance { pub fn inspect_next_transaction( &mut self, tracers: Vec, H>>>, - ) -> vm_latest::VmExecutionResultAndLogs { + ) -> crate::vm_latest::VmExecutionResultAndLogs { match &mut self.vm { VmInstanceVersion::VmVirtualBlocks(vm) => vm .inspect( @@ -213,10 +213,13 @@ impl VmInstance { &mut self, tx: zksync_types::Transaction, with_compression: bool, - ) -> Result { + ) -> Result< + crate::vm_latest::VmExecutionResultAndLogs, + crate::vm_latest::BytecodeCompressionError, + > { match &mut self.vm { VmInstanceVersion::VmM5(vm) => { - vm_m5::vm_with_bootloader::push_transaction_to_bootloader_memory( + crate::vm_m5::vm_with_bootloader::push_transaction_to_bootloader_memory( vm, &tx, self.system_env.execution_mode.glue_into(), @@ -224,7 +227,7 @@ impl VmInstance { Ok(vm.execute_next_tx().glue_into()) } VmInstanceVersion::VmM6(vm) => { - use vm_m6::storage::Storage; + use crate::vm_m6::storage::Storage; let bytecodes = if with_compression { let deps = tx.execute.factory_deps.as_deref().unwrap_or_default(); let mut deps_hashes = HashSet::with_capacity(deps.len()); @@ -250,7 +253,7 @@ impl VmInstance { let compressed_bytecodes: Vec<_> = filtered_deps.collect(); self.last_tx_compressed_bytecodes = compressed_bytecodes.clone(); - vm_m6::vm_with_bootloader::push_transaction_to_bootloader_memory( + crate::vm_m6::vm_with_bootloader::push_transaction_to_bootloader_memory( vm, &tx, self.system_env.execution_mode.glue_into(), @@ -258,7 +261,7 @@ impl VmInstance { ); bytecode_hashes } else { - vm_m6::vm_with_bootloader::push_transaction_to_bootloader_memory( + crate::vm_m6::vm_with_bootloader::push_transaction_to_bootloader_memory( vm, &tx, self.system_env.execution_mode.glue_into(), @@ -282,13 +285,13 @@ impl VmInstance { .borrow_mut() .is_bytecode_exists(info) }) { - Err(vm_latest::BytecodeCompressionError::BytecodeCompressionFailed) + Err(crate::vm_latest::BytecodeCompressionError::BytecodeCompressionFailed) } else { Ok(result) } } VmInstanceVersion::Vm1_3_2(vm) => { - use vm_m6::storage::Storage; + use crate::vm_m6::storage::Storage; let bytecodes = if with_compression { let deps = tx.execute.factory_deps.as_deref().unwrap_or_default(); let mut deps_hashes = HashSet::with_capacity(deps.len()); @@ -314,7 +317,7 @@ impl VmInstance { let compressed_bytecodes: Vec<_> = filtered_deps.collect(); self.last_tx_compressed_bytecodes = compressed_bytecodes.clone(); - vm_1_3_2::vm_with_bootloader::push_transaction_to_bootloader_memory( + crate::vm_1_3_2::vm_with_bootloader::push_transaction_to_bootloader_memory( vm, &tx, self.system_env.execution_mode.glue_into(), @@ -322,7 +325,7 @@ impl VmInstance { ); bytecode_hashes } else { - vm_1_3_2::vm_with_bootloader::push_transaction_to_bootloader_memory( + crate::vm_1_3_2::vm_with_bootloader::push_transaction_to_bootloader_memory( vm, &tx, self.system_env.execution_mode.glue_into(), @@ -346,7 +349,7 @@ impl VmInstance { .borrow_mut() .is_bytecode_exists(info) }) { - Err(vm_latest::BytecodeCompressionError::BytecodeCompressionFailed) + Err(crate::vm_latest::BytecodeCompressionError::BytecodeCompressionFailed) } else { Ok(result) } @@ -366,7 +369,10 @@ impl VmInstance { tracers: Vec, H>>>, tx: zksync_types::Transaction, with_compression: bool, - ) -> Result { + ) -> Result< + crate::vm_latest::VmExecutionResultAndLogs, + crate::vm_latest::BytecodeCompressionError, + > { match &mut self.vm { VmInstanceVersion::VmVirtualBlocks(vm) => vm .inspect_transaction_with_bytecode_compression( @@ -442,7 +448,7 @@ impl VmInstance { } } -impl VmInstance { +impl VmInstance { pub fn make_snapshot(&mut self) { match &mut self.vm { VmInstanceVersion::VmM5(vm) => vm.save_current_vm_as_snapshot(), diff --git a/core/lib/types/Cargo.toml b/core/lib/types/Cargo.toml index faf3fb2144c4..f4ef6e19db7c 100644 --- a/core/lib/types/Cargo.toml +++ b/core/lib/types/Cargo.toml @@ -19,7 +19,7 @@ zksync_mini_merkle_tree = { path = "../mini_merkle_tree" } # We need this import because we wanat DAL to be responsible for (de)serialization codegen = { git = "https://github.com/matter-labs/solidity_plonk_verifier.git", branch = "dev" } zkevm_test_harness = { git = "https://github.com/matter-labs/era-zkevm_test_harness.git", branch = "v1.3.3" } -zk_evm = { git = "https://github.com/matter-labs/era-zk_evm.git", branch = "v1.3.3" } +zk_evm = { git = "https://github.com/matter-labs/era-zk_evm.git", tag = "v1.3.3-rc1" } chrono = { version = "0.4", features = ["serde"] } num = { version = "0.3.1", features = ["serde"] } diff --git a/core/lib/utils/Cargo.toml b/core/lib/utils/Cargo.toml index 1397f80fa8a4..99a1af6bdb6f 100644 --- a/core/lib/utils/Cargo.toml +++ b/core/lib/utils/Cargo.toml @@ -11,7 +11,7 @@ categories = ["cryptography"] [dependencies] zksync_basic_types = { path = "../../lib/basic_types" } -zk_evm = { git = "https://github.com/matter-labs/era-zk_evm.git", branch = "v1.3.3" } +zk_evm = { git = "https://github.com/matter-labs/era-zk_evm.git", tag = "v1.3.3-rc1" } vlog = { path = "../../lib/vlog" } num = { version = "0.3.1", features = ["serde"] } diff --git a/core/lib/vm/Cargo.toml b/core/lib/vm/Cargo.toml deleted file mode 100644 index f5270b33a23c..000000000000 --- a/core/lib/vm/Cargo.toml +++ /dev/null @@ -1,32 +0,0 @@ -[package] -name = "vm" -version = "0.1.0" -edition = "2018" -authors = ["The Matter Labs Team "] -homepage = "https://zksync.io/" -repository = "https://github.com/matter-labs/zksync-era" -license = "MIT OR Apache-2.0" -keywords = ["blockchain", "zksync"] -categories = ["cryptography"] - -[dependencies] -vise = { git = "https://github.com/matter-labs/vise.git", version = "0.1.0", rev = "dd05139b76ab0843443ab3ff730174942c825dae" } -zk_evm = { git = "https://github.com/matter-labs/era-zk_evm.git", branch = "v1.3.3" } -zksync_system_constants = { path = "../../lib/constants" } -zksync_types = { path = "../types" } -zksync_utils = { path = "../utils" } -zksync_state = { path = "../state" } -zksync_contracts = { path = "../contracts" } - -anyhow = "1.0" -hex = "0.4" -itertools = "0.10" -once_cell = "1.7" -thiserror = "1.0" -tracing = "0.1" - -[dev-dependencies] -tokio = { version = "1", features = ["time"] } -zksync_test_account = { path = "../test_account" } -ethabi = "18.0.0" -zksync_eth_signer = { path = "../eth_signer" } diff --git a/core/lib/zksync_core/Cargo.toml b/core/lib/zksync_core/Cargo.toml index 9826cf53de6b..8ee2e2aad92f 100644 --- a/core/lib/zksync_core/Cargo.toml +++ b/core/lib/zksync_core/Cargo.toml @@ -25,7 +25,6 @@ zksync_mempool = { path = "../mempool" } zksync_prover_utils = { path = "../prover_utils" } zksync_queued_job_processor = { path = "../queued_job_processor" } zksync_circuit_breaker = { path = "../circuit_breaker" } -vm = { path = "../vm" } zksync_storage = { path = "../storage" } zksync_merkle_tree = { path = "../merkle_tree" } zksync_mini_merkle_tree = { path = "../mini_merkle_tree" } diff --git a/core/lib/zksync_core/src/api_server/execution_sandbox/apply.rs b/core/lib/zksync_core/src/api_server/execution_sandbox/apply.rs index ac84d360314e..f1be42197078 100644 --- a/core/lib/zksync_core/src/api_server/execution_sandbox/apply.rs +++ b/core/lib/zksync_core/src/api_server/execution_sandbox/apply.rs @@ -8,8 +8,10 @@ use std::time::{Duration, Instant}; +use multivm::vm_latest::{ + constants::BLOCK_GAS_LIMIT, HistoryDisabled, L1BatchEnv, L2BlockEnv, SystemEnv, +}; use multivm::VmInstance; -use vm::{constants::BLOCK_GAS_LIMIT, HistoryDisabled, L1BatchEnv, L2BlockEnv, SystemEnv}; use zksync_dal::{ConnectionPool, SqlxError, StorageProcessor}; use zksync_state::{PostgresStorage, ReadStorage, StorageView, WriteStorage}; use zksync_system_constants::{ diff --git a/core/lib/zksync_core/src/api_server/execution_sandbox/error.rs b/core/lib/zksync_core/src/api_server/execution_sandbox/error.rs index b4f04e2e5d60..2c7b7be7dfe2 100644 --- a/core/lib/zksync_core/src/api_server/execution_sandbox/error.rs +++ b/core/lib/zksync_core/src/api_server/execution_sandbox/error.rs @@ -1,6 +1,6 @@ use thiserror::Error; -use vm::{Halt, TxRevertReason}; +use multivm::vm_latest::{Halt, TxRevertReason}; #[derive(Debug, Error)] pub(crate) enum SandboxExecutionError { diff --git a/core/lib/zksync_core/src/api_server/execution_sandbox/execute.rs b/core/lib/zksync_core/src/api_server/execution_sandbox/execute.rs index 9e0a17bc22c7..d897e34ac40f 100644 --- a/core/lib/zksync_core/src/api_server/execution_sandbox/execute.rs +++ b/core/lib/zksync_core/src/api_server/execution_sandbox/execute.rs @@ -2,10 +2,10 @@ use tracing::{span, Level}; -use multivm::MultivmTracer; -use vm::{ +use multivm::vm_latest::{ constants::ETH_CALL_GAS_LIMIT, StorageInvocations, TxExecutionMode, VmExecutionResultAndLogs, }; +use multivm::MultivmTracer; use zksync_dal::ConnectionPool; use zksync_types::{ diff --git a/core/lib/zksync_core/src/api_server/execution_sandbox/mod.rs b/core/lib/zksync_core/src/api_server/execution_sandbox/mod.rs index 893494e47619..67bc11e8c312 100644 --- a/core/lib/zksync_core/src/api_server/execution_sandbox/mod.rs +++ b/core/lib/zksync_core/src/api_server/execution_sandbox/mod.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use std::time::Duration; use tokio::runtime::Handle; -use vm::utils::fee::derive_base_fee_and_gas_per_pubdata; +use multivm::vm_latest::utils::fee::derive_base_fee_and_gas_per_pubdata; use zksync_dal::{ConnectionPool, SqlxError, StorageProcessor}; use zksync_state::{PostgresStorage, PostgresStorageCaches, ReadStorage, StorageView}; use zksync_system_constants::PUBLISH_BYTECODE_OVERHEAD; diff --git a/core/lib/zksync_core/src/api_server/execution_sandbox/tracers.rs b/core/lib/zksync_core/src/api_server/execution_sandbox/tracers.rs index 468bb4649e0f..ab83d553ab55 100644 --- a/core/lib/zksync_core/src/api_server/execution_sandbox/tracers.rs +++ b/core/lib/zksync_core/src/api_server/execution_sandbox/tracers.rs @@ -1,7 +1,7 @@ +use multivm::vm_latest::{CallTracer, HistoryMode}; use multivm::MultivmTracer; use once_cell::sync::OnceCell; use std::sync::Arc; -use vm::{CallTracer, HistoryMode}; use zksync_state::WriteStorage; use zksync_types::vm_trace::Call; diff --git a/core/lib/zksync_core/src/api_server/execution_sandbox/validate.rs b/core/lib/zksync_core/src/api_server/execution_sandbox/validate.rs index 66a390ec8c4d..b40430aa6aed 100644 --- a/core/lib/zksync_core/src/api_server/execution_sandbox/validate.rs +++ b/core/lib/zksync_core/src/api_server/execution_sandbox/validate.rs @@ -1,10 +1,10 @@ use std::collections::HashSet; -use multivm::MultivmTracer; -use vm::{ +use multivm::vm_latest::{ ExecutionResult, HistoryDisabled, StorageInvocations, ValidationError, ValidationTracer, ValidationTracerParams, }; +use multivm::MultivmTracer; use zksync_dal::{ConnectionPool, StorageProcessor}; use zksync_types::{l2::L2Tx, Transaction, TRUSTED_ADDRESS_SLOTS, TRUSTED_TOKEN_SLOTS, U256}; diff --git a/core/lib/zksync_core/src/api_server/execution_sandbox/vm_metrics.rs b/core/lib/zksync_core/src/api_server/execution_sandbox/vm_metrics.rs index 20183bcdbb61..6da7be01265c 100644 --- a/core/lib/zksync_core/src/api_server/execution_sandbox/vm_metrics.rs +++ b/core/lib/zksync_core/src/api_server/execution_sandbox/vm_metrics.rs @@ -2,7 +2,7 @@ use vise::{Buckets, EncodeLabelSet, EncodeLabelValue, Family, Gauge, Histogram, use std::time::Duration; -use vm::{VmExecutionResultAndLogs, VmMemoryMetrics}; +use multivm::vm_latest::{VmExecutionResultAndLogs, VmMemoryMetrics}; use zksync_state::StorageViewMetrics; use zksync_types::event::{extract_long_l2_to_l1_messages, extract_published_bytecodes}; use zksync_types::fee::TransactionExecutionMetrics; diff --git a/core/lib/zksync_core/src/api_server/tx_sender/mod.rs b/core/lib/zksync_core/src/api_server/tx_sender/mod.rs index f23c79d1d4ec..fae79ff920b9 100644 --- a/core/lib/zksync_core/src/api_server/tx_sender/mod.rs +++ b/core/lib/zksync_core/src/api_server/tx_sender/mod.rs @@ -13,7 +13,7 @@ use std::{cmp, num::NonZeroU32, sync::Arc, time::Instant}; // Workspace uses -use vm::{ +use multivm::vm_latest::{ constants::{BLOCK_GAS_LIMIT, MAX_PUBDATA_PER_BLOCK}, utils::{ fee::derive_base_fee_and_gas_per_pubdata, diff --git a/core/lib/zksync_core/src/api_server/tx_sender/result.rs b/core/lib/zksync_core/src/api_server/tx_sender/result.rs index 1696ba10453a..8f7101ac0e9b 100644 --- a/core/lib/zksync_core/src/api_server/tx_sender/result.rs +++ b/core/lib/zksync_core/src/api_server/tx_sender/result.rs @@ -1,7 +1,7 @@ use crate::api_server::execution_sandbox::SandboxExecutionError; use thiserror::Error; -use vm::{ExecutionResult, ValidationError, VmExecutionResultAndLogs}; +use multivm::vm_latest::{ExecutionResult, ValidationError, VmExecutionResultAndLogs}; use zksync_types::l2::error::TxCheckError; use zksync_types::U256; diff --git a/core/lib/zksync_core/src/api_server/web3/namespaces/debug.rs b/core/lib/zksync_core/src/api_server/web3/namespaces/debug.rs index 733b5847e234..16a4086ac11b 100644 --- a/core/lib/zksync_core/src/api_server/web3/namespaces/debug.rs +++ b/core/lib/zksync_core/src/api_server/web3/namespaces/debug.rs @@ -1,8 +1,8 @@ +use multivm::vm_latest::constants::BLOCK_GAS_LIMIT; use once_cell::sync::OnceCell; use std::sync::Arc; -use vm::constants::BLOCK_GAS_LIMIT; -use vm::ExecutionResult; +use multivm::vm_latest::ExecutionResult; use zksync_dal::ConnectionPool; use zksync_state::PostgresStorageCaches; diff --git a/core/lib/zksync_core/src/fee_ticker/mod.rs b/core/lib/zksync_core/src/fee_ticker/mod.rs index ef8e6fa05470..3589c9e30b33 100644 --- a/core/lib/zksync_core/src/fee_ticker/mod.rs +++ b/core/lib/zksync_core/src/fee_ticker/mod.rs @@ -3,8 +3,8 @@ use core::fmt::Debug; use bigdecimal::BigDecimal; +use multivm::vm_latest::utils::fee::base_fee_to_gas_per_pubdata; use num::{rational::Ratio, BigUint}; -use vm::utils::fee::base_fee_to_gas_per_pubdata; use zksync_types::Address; use zksync_utils::ratio_to_big_decimal_normalized; diff --git a/core/lib/zksync_core/src/state_keeper/batch_executor/mod.rs b/core/lib/zksync_core/src/state_keeper/batch_executor/mod.rs index 9b8586804260..9554393d5af3 100644 --- a/core/lib/zksync_core/src/state_keeper/batch_executor/mod.rs +++ b/core/lib/zksync_core/src/state_keeper/batch_executor/mod.rs @@ -7,11 +7,11 @@ use tokio::{ use std::{fmt, sync::Arc}; -use multivm::{MultivmTracer, VmInstance}; -use vm::{ +use multivm::vm_latest::{ CallTracer, ExecutionResult, FinishedL1Batch, Halt, HistoryEnabled, L1BatchEnv, L2BlockEnv, SystemEnv, VmExecutionResultAndLogs, }; +use multivm::{MultivmTracer, VmInstance}; use zksync_dal::ConnectionPool; use zksync_state::{ReadStorage, RocksdbStorage, StorageView}; use zksync_types::{vm_trace::Call, witness_block_state::WitnessBlockState, Transaction, U256}; diff --git a/core/lib/zksync_core/src/state_keeper/batch_executor/tests/tester.rs b/core/lib/zksync_core/src/state_keeper/batch_executor/tests/tester.rs index 27e59c0110e5..2e37ffa04a7e 100644 --- a/core/lib/zksync_core/src/state_keeper/batch_executor/tests/tester.rs +++ b/core/lib/zksync_core/src/state_keeper/batch_executor/tests/tester.rs @@ -3,7 +3,7 @@ use tempfile::TempDir; -use vm::{ +use multivm::vm_latest::{ constants::INITIAL_STORAGE_WRITE_PUBDATA_BYTES, {L1BatchEnv, SystemEnv}, }; diff --git a/core/lib/zksync_core/src/state_keeper/io/common.rs b/core/lib/zksync_core/src/state_keeper/io/common.rs index 875e87630f63..7ae9e0170a79 100644 --- a/core/lib/zksync_core/src/state_keeper/io/common.rs +++ b/core/lib/zksync_core/src/state_keeper/io/common.rs @@ -1,6 +1,8 @@ use std::time::Duration; -use vm::{constants::BLOCK_GAS_LIMIT, L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode}; +use multivm::vm_latest::{ + constants::BLOCK_GAS_LIMIT, L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, +}; use zksync_contracts::BaseSystemContracts; use zksync_dal::StorageProcessor; use zksync_types::{ diff --git a/core/lib/zksync_core/src/state_keeper/io/mempool.rs b/core/lib/zksync_core/src/state_keeper/io/mempool.rs index a2ce726250b9..a473d461e69a 100644 --- a/core/lib/zksync_core/src/state_keeper/io/mempool.rs +++ b/core/lib/zksync_core/src/state_keeper/io/mempool.rs @@ -8,7 +8,9 @@ use std::{ time::{Duration, Instant}, }; -use vm::{utils::fee::derive_base_fee_and_gas_per_pubdata, FinishedL1Batch, L1BatchEnv, SystemEnv}; +use multivm::vm_latest::{ + utils::fee::derive_base_fee_and_gas_per_pubdata, FinishedL1Batch, L1BatchEnv, SystemEnv, +}; use zksync_config::configs::chain::StateKeeperConfig; use zksync_dal::ConnectionPool; diff --git a/core/lib/zksync_core/src/state_keeper/io/mod.rs b/core/lib/zksync_core/src/state_keeper/io/mod.rs index dee69982cf4b..e6427fd3790d 100644 --- a/core/lib/zksync_core/src/state_keeper/io/mod.rs +++ b/core/lib/zksync_core/src/state_keeper/io/mod.rs @@ -6,7 +6,7 @@ use std::{ time::{Duration, Instant}, }; -use vm::{FinishedL1Batch, L1BatchEnv, SystemEnv}; +use multivm::vm_latest::{FinishedL1Batch, L1BatchEnv, SystemEnv}; use zksync_dal::ConnectionPool; use zksync_types::{ diff --git a/core/lib/zksync_core/src/state_keeper/io/seal_logic.rs b/core/lib/zksync_core/src/state_keeper/io/seal_logic.rs index f8ef912ce6d0..424b04b6899c 100644 --- a/core/lib/zksync_core/src/state_keeper/io/seal_logic.rs +++ b/core/lib/zksync_core/src/state_keeper/io/seal_logic.rs @@ -8,7 +8,7 @@ use std::{ time::{Duration, Instant}, }; -use vm::{FinishedL1Batch, L1BatchEnv}; +use multivm::vm_latest::{FinishedL1Batch, L1BatchEnv}; use zksync_dal::StorageProcessor; use zksync_system_constants::ACCOUNT_CODE_STORAGE_ADDRESS; use zksync_types::{ diff --git a/core/lib/zksync_core/src/state_keeper/io/tests/mod.rs b/core/lib/zksync_core/src/state_keeper/io/tests/mod.rs index 6e17dce26ccb..db4083fe1407 100644 --- a/core/lib/zksync_core/src/state_keeper/io/tests/mod.rs +++ b/core/lib/zksync_core/src/state_keeper/io/tests/mod.rs @@ -4,7 +4,7 @@ use std::time::Duration; use db_test_macro::db_test; -use vm::utils::fee::derive_base_fee_and_gas_per_pubdata; +use multivm::vm_latest::utils::fee::derive_base_fee_and_gas_per_pubdata; use zksync_contracts::BaseSystemContractsHashes; use zksync_dal::ConnectionPool; use zksync_mempool::L2TxFilter; diff --git a/core/lib/zksync_core/src/state_keeper/io/tests/tester.rs b/core/lib/zksync_core/src/state_keeper/io/tests/tester.rs index 92b54950e5b2..57be16319ea4 100644 --- a/core/lib/zksync_core/src/state_keeper/io/tests/tester.rs +++ b/core/lib/zksync_core/src/state_keeper/io/tests/tester.rs @@ -1,7 +1,7 @@ //! Testing harness for the IO. +use multivm::vm_latest::constants::BLOCK_GAS_LIMIT; use std::{sync::Arc, time::Duration}; -use vm::constants::BLOCK_GAS_LIMIT; use zksync_config::configs::chain::StateKeeperConfig; use zksync_config::GasAdjusterConfig; diff --git a/core/lib/zksync_core/src/state_keeper/keeper.rs b/core/lib/zksync_core/src/state_keeper/keeper.rs index 0d6ebf40733a..39197c270b9c 100644 --- a/core/lib/zksync_core/src/state_keeper/keeper.rs +++ b/core/lib/zksync_core/src/state_keeper/keeper.rs @@ -4,7 +4,7 @@ use tokio::sync::watch; use std::convert::Infallible; use std::time::{Duration, Instant}; -use vm::{Halt, L1BatchEnv, SystemEnv}; +use multivm::vm_latest::{Halt, L1BatchEnv, SystemEnv}; use zksync_types::{ block::MiniblockReexecuteData, l2::TransactionType, protocol_version::ProtocolUpgradeTx, storage_writes_deduplicator::StorageWritesDeduplicator, Transaction, diff --git a/core/lib/zksync_core/src/state_keeper/mempool_actor.rs b/core/lib/zksync_core/src/state_keeper/mempool_actor.rs index 4150f10af55f..2c369d35a0fb 100644 --- a/core/lib/zksync_core/src/state_keeper/mempool_actor.rs +++ b/core/lib/zksync_core/src/state_keeper/mempool_actor.rs @@ -2,7 +2,7 @@ use tokio::sync::watch; use std::{sync::Arc, time::Duration}; -use vm::utils::fee::derive_base_fee_and_gas_per_pubdata; +use multivm::vm_latest::utils::fee::derive_base_fee_and_gas_per_pubdata; use zksync_config::configs::chain::MempoolConfig; use zksync_dal::ConnectionPool; use zksync_mempool::L2TxFilter; diff --git a/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/geometry_seal_criteria.rs b/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/geometry_seal_criteria.rs index 5250ab98bb11..5a03107a97f0 100644 --- a/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/geometry_seal_criteria.rs +++ b/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/geometry_seal_criteria.rs @@ -1,5 +1,5 @@ +use multivm::vm_latest::constants::{ERGS_PER_CIRCUIT, MAX_CYCLES_FOR_TX}; use std::fmt; -use vm::constants::{ERGS_PER_CIRCUIT, MAX_CYCLES_FOR_TX}; use zksync_config::configs::chain::StateKeeperConfig; use zksync_types::{ circuit::{GEOMETRY_CONFIG, SCHEDULER_UPPER_BOUND}, diff --git a/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/tx_encoding_size.rs b/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/tx_encoding_size.rs index e2b77cf7cfb0..39eb6a68062f 100644 --- a/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/tx_encoding_size.rs +++ b/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/tx_encoding_size.rs @@ -1,4 +1,4 @@ -use vm::constants::BOOTLOADER_TX_ENCODING_SPACE; +use multivm::vm_latest::constants::BOOTLOADER_TX_ENCODING_SPACE; use crate::state_keeper::seal_criteria::{ SealCriterion, SealData, SealResolution, StateKeeperConfig, diff --git a/core/lib/zksync_core/src/state_keeper/seal_criteria/mod.rs b/core/lib/zksync_core/src/state_keeper/seal_criteria/mod.rs index 74c64ff42d1b..ffc5bd4b4728 100644 --- a/core/lib/zksync_core/src/state_keeper/seal_criteria/mod.rs +++ b/core/lib/zksync_core/src/state_keeper/seal_criteria/mod.rs @@ -12,7 +12,7 @@ use std::fmt; -use vm::TransactionVmExt; +use multivm::vm_latest::TransactionVmExt; use zksync_config::configs::chain::StateKeeperConfig; use zksync_types::{ block::BlockGasCount, diff --git a/core/lib/zksync_core/src/state_keeper/tests/mod.rs b/core/lib/zksync_core/src/state_keeper/tests/mod.rs index 8a7246943ad7..b85878aa8f0c 100644 --- a/core/lib/zksync_core/src/state_keeper/tests/mod.rs +++ b/core/lib/zksync_core/src/state_keeper/tests/mod.rs @@ -8,7 +8,7 @@ use std::{ time::Instant, }; -use vm::{ +use multivm::vm_latest::{ constants::BLOCK_GAS_LIMIT, CurrentExecutionState, ExecutionResult, FinishedL1Batch, L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionResultAndLogs, VmExecutionStatistics, diff --git a/core/lib/zksync_core/src/state_keeper/tests/tester.rs b/core/lib/zksync_core/src/state_keeper/tests/tester.rs index 62bd4307b4e6..b1543a7e3abc 100644 --- a/core/lib/zksync_core/src/state_keeper/tests/tester.rs +++ b/core/lib/zksync_core/src/state_keeper/tests/tester.rs @@ -8,7 +8,7 @@ use std::{ time::{Duration, Instant}, }; -use vm::{ +use multivm::vm_latest::{ constants::BLOCK_GAS_LIMIT, ExecutionResult, FinishedL1Batch, L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionResultAndLogs, }; @@ -263,7 +263,7 @@ pub(crate) fn successful_exec_with_metrics( /// Creates a `TxExecutionResult` object denoting a tx that was rejected. pub(crate) fn rejected_exec() -> TxExecutionResult { TxExecutionResult::RejectedByVm { - reason: vm::Halt::InnerTxError, + reason: multivm::vm_latest::Halt::InnerTxError, } } diff --git a/core/lib/zksync_core/src/state_keeper/updates/l1_batch_updates.rs b/core/lib/zksync_core/src/state_keeper/updates/l1_batch_updates.rs index c7ab405d9dab..f03a12224cb3 100644 --- a/core/lib/zksync_core/src/state_keeper/updates/l1_batch_updates.rs +++ b/core/lib/zksync_core/src/state_keeper/updates/l1_batch_updates.rs @@ -51,7 +51,7 @@ mod tests { gas_tracker::new_block_gas_count, state_keeper::tests::{create_execution_result, create_transaction}, }; - use vm::TransactionVmExt; + use multivm::vm_latest::TransactionVmExt; #[test] fn apply_miniblock_with_empty_tx() { diff --git a/core/lib/zksync_core/src/state_keeper/updates/miniblock_updates.rs b/core/lib/zksync_core/src/state_keeper/updates/miniblock_updates.rs index a49edbee2257..d1b14e25a8f9 100644 --- a/core/lib/zksync_core/src/state_keeper/updates/miniblock_updates.rs +++ b/core/lib/zksync_core/src/state_keeper/updates/miniblock_updates.rs @@ -1,5 +1,5 @@ +use multivm::vm_latest::{ExecutionResult, L2BlockEnv, TransactionVmExt, VmExecutionResultAndLogs}; use std::collections::HashMap; -use vm::{ExecutionResult, L2BlockEnv, TransactionVmExt, VmExecutionResultAndLogs}; use zksync_types::{ block::{legacy_miniblock_hash, miniblock_hash, BlockGasCount}, @@ -162,7 +162,7 @@ impl MiniblockUpdates { mod tests { use super::*; use crate::state_keeper::tests::{create_execution_result, create_transaction}; - use vm::TransactionVmExt; + use multivm::vm_latest::TransactionVmExt; #[test] fn apply_empty_l2_tx() { diff --git a/core/lib/zksync_core/src/state_keeper/updates/mod.rs b/core/lib/zksync_core/src/state_keeper/updates/mod.rs index 0837bc6da60d..a552d2f0ec56 100644 --- a/core/lib/zksync_core/src/state_keeper/updates/mod.rs +++ b/core/lib/zksync_core/src/state_keeper/updates/mod.rs @@ -1,4 +1,4 @@ -use vm::{L1BatchEnv, VmExecutionResultAndLogs}; +use multivm::vm_latest::{L1BatchEnv, VmExecutionResultAndLogs}; use zksync_contracts::BaseSystemContractsHashes; use zksync_types::vm_trace::Call; diff --git a/core/lib/zksync_core/src/sync_layer/external_io.rs b/core/lib/zksync_core/src/sync_layer/external_io.rs index 86d401118f08..76c3fdc424dc 100644 --- a/core/lib/zksync_core/src/sync_layer/external_io.rs +++ b/core/lib/zksync_core/src/sync_layer/external_io.rs @@ -7,7 +7,7 @@ use std::{ time::Duration, }; -use vm::{FinishedL1Batch, L1BatchEnv, SystemEnv}; +use multivm::vm_latest::{FinishedL1Batch, L1BatchEnv, SystemEnv}; use zksync_contracts::{BaseSystemContracts, SystemContractCode}; use zksync_dal::ConnectionPool; use zksync_types::{ diff --git a/core/lib/zksync_core/src/witness_generator/basic_circuits.rs b/core/lib/zksync_core/src/witness_generator/basic_circuits.rs index 554b166f0bf8..82f130583cbf 100644 --- a/core/lib/zksync_core/src/witness_generator/basic_circuits.rs +++ b/core/lib/zksync_core/src/witness_generator/basic_circuits.rs @@ -10,7 +10,9 @@ use std::{ time::Instant, }; -use vm::{constants::MAX_CYCLES_FOR_TX, HistoryDisabled, SimpleMemory, StorageOracle}; +use multivm::vm_latest::{ + constants::MAX_CYCLES_FOR_TX, HistoryDisabled, SimpleMemory, StorageOracle, +}; use zksync_config::configs::witness_generator::BasicWitnessGeneratorDataSource; use zksync_config::configs::WitnessGeneratorConfig; use zksync_dal::ConnectionPool; diff --git a/core/multivm_deps/vm_1_3_2/Cargo.toml b/core/multivm_deps/vm_1_3_2/Cargo.toml deleted file mode 100644 index 2b6fe359797b..000000000000 --- a/core/multivm_deps/vm_1_3_2/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -[package] -name = "vm_1_3_2" -version = "0.1.0" -edition = "2018" -authors = ["The Matter Labs Team "] -homepage = "https://zksync.io/" -repository = "https://github.com/matter-labs/zksync-era" -license = "MIT OR Apache-2.0" -keywords = ["blockchain", "zksync"] -categories = ["cryptography"] - -[dependencies] -zkevm-assembly = { git = "https://github.com/matter-labs/era-zkEVM-assembly.git", branch = "v1.3.2" } -zk_evm = { git = "https://github.com/matter-labs/era-zk_evm.git", branch = "v1.3.3" } - -zksync_system_constants = { path = "../../lib/constants" } -zksync_types = { path = "../../lib/types" } -zksync_utils = { path = "../../lib/utils" } -zksync_state = { path = "../../lib/state" } - -zksync_contracts = { path = "../../lib/contracts" } - -anyhow = "1.0" -hex = "0.4" -itertools = "0.10" -ethabi = "18.0.0" -once_cell = "1.7" -thiserror = "1.0" -tracing = "0.1" - -[dev-dependencies] -zksync_eth_signer = { path = "../../lib/eth_signer" } -tokio = { version = "1", features = ["time"] } diff --git a/core/multivm_deps/vm_m5/Cargo.toml b/core/multivm_deps/vm_m5/Cargo.toml deleted file mode 100644 index 2a65494d618d..000000000000 --- a/core/multivm_deps/vm_m5/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -[package] -name = "vm_m5" -version = "0.1.0" -edition = "2018" -authors = ["The Matter Labs Team "] -homepage = "https://zksync.io/" -repository = "https://github.com/matter-labs/zksync-2" -license = "Apache-2.0" -keywords = ["blockchain", "zksync"] -categories = ["cryptography"] - -[dependencies] -zksync_crypto = { path = "../../lib/crypto" } -zksync_types = { path = "../../lib/types" } -zksync_utils = { path = "../../lib/utils" } -zksync_system_constants = { path = "../../lib/constants" } -zksync_state = { path = "../../lib/state" } -zksync_storage = { path = "../../lib/storage" } - -zk_evm = { git = "https://github.com/matter-labs/era-zk_evm.git", tag = "v1.3.1-rc1" } -zksync_contracts = { path = "../../lib/contracts" } - -hex = "0.4" -thiserror = "1.0" -itertools = "0.10" -once_cell = "1.7" -vlog = { path = "../../lib/vlog" } - -tracing = "0.1" - -[dev-dependencies] -tempfile = "3.0.2" -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" diff --git a/core/multivm_deps/vm_m6/Cargo.toml b/core/multivm_deps/vm_m6/Cargo.toml deleted file mode 100644 index ee0ed1d72e0c..000000000000 --- a/core/multivm_deps/vm_m6/Cargo.toml +++ /dev/null @@ -1,35 +0,0 @@ -[package] -name = "vm_m6" -version = "0.1.0" -edition = "2018" -authors = ["The Matter Labs Team "] -homepage = "https://zksync.io/" -repository = "https://github.com/matter-labs/zksync-2" -license = "Apache-2.0" -keywords = ["blockchain", "zksync"] -categories = ["cryptography"] - -[dependencies] -zkevm-assembly = { git = "https://github.com/matter-labs/era-zkEVM-assembly.git", tag = "v1.3.1-rc0" } -zksync_crypto = { path = "../../lib/crypto" } -zksync_types = { path = "../../lib/types" } -zksync_utils = { path = "../../lib/utils" } -zksync_system_constants = { path = "../../lib/constants" } -zksync_state = { path = "../../lib/state" } -zksync_storage = { path = "../../lib/storage" } - -zk_evm = { git = "https://github.com/matter-labs/era-zk_evm.git", tag = "v1.3.1-rc1" } -zksync_contracts = { path = "../../lib/contracts" } - -hex = "0.4" -thiserror = "1.0" -itertools = "0.10" -once_cell = "1.7" -vlog = { path = "../../lib/vlog" } - -tracing = "0.1" - -[dev-dependencies] -tempfile = "3.0.2" -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" diff --git a/core/multivm_deps/vm_virtual_blocks/Cargo.toml b/core/multivm_deps/vm_virtual_blocks/Cargo.toml deleted file mode 100644 index ef45ff0fdec0..000000000000 --- a/core/multivm_deps/vm_virtual_blocks/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -[package] -name = "vm_virtual_blocks" -version = "0.1.0" -edition = "2018" -authors = ["The Matter Labs Team "] -homepage = "https://zksync.io/" -repository = "https://github.com/matter-labs/zksync-era" -license = "MIT OR Apache-2.0" -keywords = ["blockchain", "zksync"] -categories = ["cryptography"] - -[dependencies] -vise = { git = "https://github.com/matter-labs/vise.git", version = "0.1.0", rev = "dd05139b76ab0843443ab3ff730174942c825dae" } -zk_evm = { git = "https://github.com/matter-labs/era-zk_evm.git", branch = "v1.3.3" } -zksync_system_constants = { path = "../../lib/constants" } -zksync_types = { path = "../../lib/types" } -zksync_utils = { path = "../../lib/utils" } -zksync_state = { path = "../../lib/state" } -zksync_contracts = { path = "../../lib/contracts" } - -anyhow = "1.0" -hex = "0.4" -itertools = "0.10" -once_cell = "1.7" -thiserror = "1.0" -tracing = "0.1" - -[dev-dependencies] -tokio = { version = "1", features = ["time"] } -zksync_test_account = { path = "../../lib/test_account" } -ethabi = "18.0.0" -zksync_eth_signer = { path = "../../lib/eth_signer" } - diff --git a/core/tests/vm-benchmark/harness/Cargo.toml b/core/tests/vm-benchmark/harness/Cargo.toml index 1252ef4b7aa1..8a08e11d03b6 100644 --- a/core/tests/vm-benchmark/harness/Cargo.toml +++ b/core/tests/vm-benchmark/harness/Cargo.toml @@ -5,11 +5,11 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -vm = { path = "../../../lib/vm" } +multivm = { path = "../../../lib/multivm" } zksync_types = { path = "../../../lib/types" } zksync_state = { path = "../../../lib/state" } zksync_utils = { path = "../../../lib/utils" } zksync_system_constants = { path = "../../../lib/constants" } zksync_contracts = { path = "../../../lib/contracts" } -zk_evm = { git = "https://github.com/matter-labs/era-zk_evm.git", branch = "v1.3.3" } +zk_evm = { git = "https://github.com/matter-labs/era-zk_evm.git", tag = "v1.3.3-rc1" } once_cell = "1.17" diff --git a/core/tests/vm-benchmark/harness/src/lib.rs b/core/tests/vm-benchmark/harness/src/lib.rs index 16a40f21ae32..24e805570592 100644 --- a/core/tests/vm-benchmark/harness/src/lib.rs +++ b/core/tests/vm-benchmark/harness/src/lib.rs @@ -1,9 +1,9 @@ -use once_cell::sync::Lazy; -use std::{cell::RefCell, rc::Rc}; -use vm::{ +use multivm::vm_latest::{ constants::BLOCK_GAS_LIMIT, HistoryEnabled, L2BlockEnv, TxExecutionMode, Vm, VmExecutionMode, VmExecutionResultAndLogs, }; +use once_cell::sync::Lazy; +use std::{cell::RefCell, rc::Rc}; use zksync_contracts::{deployer_contract, BaseSystemContracts}; use zksync_state::{InMemoryStorage, StorageView}; use zksync_system_constants::ethereum::MAX_GAS_PER_PUBDATA_BYTE; @@ -62,7 +62,7 @@ impl BenchmarkingVm { let timestamp = unix_timestamp_ms(); Self(Vm::new( - vm::L1BatchEnv { + multivm::vm_latest::L1BatchEnv { previous_batch_hash: None, number: L1BatchNumber(1), timestamp, @@ -77,7 +77,7 @@ impl BenchmarkingVm { max_virtual_blocks_to_create: 100, }, }, - vm::SystemEnv { + multivm::vm_latest::SystemEnv { zk_porter_available: false, version: ProtocolVersionId::latest(), base_system_smart_contracts: SYSTEM_CONTRACTS.clone(), @@ -145,6 +145,9 @@ mod tests { let mut vm = BenchmarkingVm::new(); let res = vm.run_transaction(&get_deploy_tx(&test_contract)); - assert!(matches!(res.result, vm::ExecutionResult::Success { .. })); + assert!(matches!( + res.result, + multivm::vm_latest::ExecutionResult::Success { .. } + )); } } diff --git a/prover/witness_generator/Cargo.toml b/prover/witness_generator/Cargo.toml index f5a7480195c0..ef2ce86bc579 100644 --- a/prover/witness_generator/Cargo.toml +++ b/prover/witness_generator/Cargo.toml @@ -17,7 +17,7 @@ zksync_system_constants = { path = "../../core/lib/constants" } prometheus_exporter = { path = "../../core/lib/prometheus_exporter" } vlog = { path = "../../core/lib/vlog" } zksync_queued_job_processor = { path = "../../core/lib/queued_job_processor" } -vm = { path = "../../core/lib/vm", version = "0.1.0" } +multivm = { path = "../../core/lib/multivm", version = "0.1.0" } zksync_object_store = { path = "../../core/lib/object_store" } zksync_types = { path = "../../core/lib/types" } zksync_state = { path = "../../core/lib/state" } diff --git a/prover/witness_generator/src/basic_circuits.rs b/prover/witness_generator/src/basic_circuits.rs index 594c20f8b251..e7e7cf43e098 100644 --- a/prover/witness_generator/src/basic_circuits.rs +++ b/prover/witness_generator/src/basic_circuits.rs @@ -22,7 +22,7 @@ use zksync_prover_fri_types::circuit_definitions::zkevm_circuits::scheduler::blo use zksync_prover_fri_types::circuit_definitions::zkevm_circuits::scheduler::input::SchedulerCircuitInstanceWitness; use zksync_prover_fri_types::{AuxOutputWitnessWrapper, get_current_pod_name}; -use vm::{constants::MAX_CYCLES_FOR_TX, HistoryDisabled, StorageOracle}; +use multivm::vm_latest::{constants::MAX_CYCLES_FOR_TX, HistoryDisabled, StorageOracle}; use zksync_config::configs::FriWitnessGeneratorConfig; use zksync_dal::fri_witness_generator_dal::FriWitnessJobStatus; use zksync_dal::ConnectionPool;