Skip to content

Commit 79f6578

Browse files
authored
refactor(vm): Deduplicate code shared with legacy VM (#3477)
## What ❔ Deduplicates helper code shared between legacy and fast VMs. ## Why ❔ Less code is easier to maintain. ## Checklist - [x] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [x] Code has been formatted via `zkstack dev fmt` and `zkstack dev lint`.
1 parent 293617a commit 79f6578

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+222
-1420
lines changed

core/lib/multivm/src/tracers/validator/vm_latest/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ use crate::{
2222
},
2323
},
2424
vm_latest::{
25-
tracers::utils::{computational_gas_price, get_calldata_page_via_abi, VmHook},
26-
BootloaderState, SimpleMemory, VmTracer, ZkSyncVmState,
25+
tracers::utils::{computational_gas_price, get_calldata_page_via_abi},
26+
BootloaderState, SimpleMemory, VmHook, VmTracer, ZkSyncVmState,
2727
},
2828
HistoryMode,
2929
};
@@ -205,25 +205,25 @@ impl<S: WriteStorage, H: HistoryMode> DynTracer<S, SimpleMemory<H::Vm1_5_0>>
205205
let hook = VmHook::from_opcode_memory(&state, &data, self.vm_version.try_into().unwrap());
206206
let current_mode = self.validation_mode;
207207
match (current_mode, hook) {
208-
(ValidationTracerMode::NoValidation, VmHook::AccountValidationEntered) => {
208+
(ValidationTracerMode::NoValidation, Some(VmHook::AccountValidationEntered)) => {
209209
// Account validation can be entered when there is no prior validation (i.e. "nested" validations are not allowed)
210210
self.validation_mode = ValidationTracerMode::UserTxValidation;
211211
}
212-
(ValidationTracerMode::NoValidation, VmHook::PaymasterValidationEntered) => {
212+
(ValidationTracerMode::NoValidation, Some(VmHook::PaymasterValidationEntered)) => {
213213
// Paymaster validation can be entered when there is no prior validation (i.e. "nested" validations are not allowed)
214214
self.validation_mode = ValidationTracerMode::PaymasterTxValidation;
215215
}
216-
(_, VmHook::AccountValidationEntered | VmHook::PaymasterValidationEntered) => {
216+
(_, Some(VmHook::AccountValidationEntered | VmHook::PaymasterValidationEntered)) => {
217217
panic!(
218218
"Unallowed transition inside the validation tracer. Mode: {:#?}, hook: {:#?}",
219219
self.validation_mode, hook
220220
);
221221
}
222-
(_, VmHook::NoValidationEntered) => {
222+
(_, Some(VmHook::ValidationExited)) => {
223223
// Validation can be always turned off
224224
self.validation_mode = ValidationTracerMode::NoValidation;
225225
}
226-
(_, VmHook::ValidationStepEndeded) => {
226+
(_, Some(VmHook::ValidationStepEnded)) => {
227227
// The validation step has ended.
228228
self.should_stop_execution = true;
229229
}

core/lib/multivm/src/versions/vm_fast/bootloader_state/l2_block.rs

Lines changed: 0 additions & 78 deletions
This file was deleted.

core/lib/multivm/src/versions/vm_fast/bootloader_state/mod.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)