Skip to content

Commit 7aa5721

Browse files
authored
feat(vm): Do not panic on VM divergence (#2705)
## What ❔ - Allows to continue batch execution on divergence via new `ShadowLenient` VM mode. - Dumps VM state to logs and optionally a file on divergence. ## Why ❔ Allows to detect divergencies in multiple batches w/o blockers. The dumped VM state will hopefully allow investigating divergencies locally, although this logic isn't implemented yet. ## Checklist - [x] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [x] Tests for the changes have been added / updated. - [x] Documentation comments have been added / updated. - [x] Code has been formatted via `zk fmt` and `zk lint`.
1 parent e9d1d90 commit 7aa5721

File tree

42 files changed

+1398
-513
lines changed

Some content is hidden

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

42 files changed

+1398
-513
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/lib/basic_types/src/vm.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ pub enum FastVmMode {
3232
/// Run only the old VM.
3333
#[default]
3434
Old,
35-
/// Run only the new Vm.
35+
/// Run only the new VM.
3636
New,
3737
/// Run both the new and old VM and compare their outputs for each transaction execution.
38+
/// The VM will panic on divergence.
3839
Shadow,
3940
}

core/lib/multivm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ anyhow.workspace = true
3434
hex.workspace = true
3535
itertools.workspace = true
3636
once_cell.workspace = true
37-
pretty_assertions.workspace = true
3837
thiserror.workspace = true
3938
tracing.workspace = true
4039
vise.workspace = true
4140

4241
[dev-dependencies]
4342
assert_matches.workspace = true
43+
pretty_assertions.workspace = true
4444
tokio = { workspace = true, features = ["time"] }
4545
zksync_test_account.workspace = true
4646
ethabi.workspace = true

core/lib/multivm/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ pub use crate::{
2222
mod glue;
2323
pub mod tracers;
2424
pub mod utils;
25-
pub mod versions;
25+
mod versions;
2626
mod vm_instance;

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
pub mod shadow;
21
mod shared;
2+
#[cfg(test)]
3+
mod testonly;
4+
#[cfg(test)]
5+
mod tests;
36
pub mod vm_1_3_2;
47
pub mod vm_1_4_1;
58
pub mod vm_1_4_2;

core/lib/multivm/src/versions/shadow.rs

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

0 commit comments

Comments
 (0)