Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: compatibility with the snapshot changes #2481

Merged
merged 6 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/lib/multivm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ zk_evm_1_4_1.workspace = true
zk_evm_1_4_0.workspace = true
zk_evm_1_3_3.workspace = true
zk_evm_1_3_1.workspace = true
vm2 = { git = "https://github.com/matter-labs/vm2.git", rev = "2882a1232a695ffc1ec4b796195f7aababeb6ab2" }
vm2 = { git = "https://github.com/matter-labs/vm2.git", rev = "28770597a3f150dbe4373cb57929bd8db82e884f" }

circuit_sequencer_api_1_3_3.workspace = true
circuit_sequencer_api_1_4_0.workspace = true
Expand Down
15 changes: 8 additions & 7 deletions core/lib/multivm/src/versions/vm_fast/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ use crate::{
},
vm_latest::{
constants::{
get_used_bootloader_memory_bytes, get_vm_hook_params_start_position,
get_vm_hook_position, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET,
VM_HOOK_PARAMS_COUNT,
get_vm_hook_params_start_position, get_vm_hook_position, OPERATOR_REFUNDS_OFFSET,
TX_GAS_LIMIT_OFFSET, VM_HOOK_PARAMS_COUNT,
},
BootloaderMemory, CurrentExecutionState, ExecutionResult, FinishedL1Batch, L1BatchEnv,
L2BlockEnv, MultiVMSubversion, Refunds, SystemEnv, VmExecutionLogs, VmExecutionMode,
Expand Down Expand Up @@ -325,9 +324,12 @@ impl<S: ReadStorage> Vm<S> {
) {
assert!(self.inner.state.previous_frames.is_empty());
// TODO: this should probably address `vm2::FIRST_HEAP` instead.
let heap = &mut self.inner.state.heaps[self.inner.state.current_frame.heap];
for (slot, value) in memory {
heap.write_u256(slot as u32 * 32, value);
self.inner.state.heaps.write_u256(
self.inner.state.current_frame.heap,
slot as u32 * 32,
value,
);
}
}

Expand Down Expand Up @@ -458,7 +460,6 @@ impl<S: ReadStorage> Vm<S> {
inner.state.current_frame.sp = 0;

// The bootloader writes results to high addresses in its heap, so it makes sense to preallocate it.
inner.state.heaps[vm2::FIRST_HEAP].reserve(get_used_bootloader_memory_bytes(VM_VERSION));
inner.state.current_frame.heap_size = u32::MAX;
inner.state.current_frame.aux_heap_size = u32::MAX;
inner.state.current_frame.exception_handler = INITIAL_FRAME_FORMAL_EH_LOCATION;
Expand Down Expand Up @@ -716,7 +717,7 @@ impl<S: ReadStorage> VmInterfaceHistoryEnabled for Vm<S> {
impl<S: ReadStorage> Vm<S> {
fn delete_history_if_appropriate(&mut self) {
if self.snapshots.is_empty() && self.inner.state.previous_frames.is_empty() {
self.inner.world_diff.delete_history();
self.inner.delete_history();
}
}
}
Expand Down
1 change: 0 additions & 1 deletion core/tests/vm-benchmark/benches/fill_bootloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ fn main() {
let mut vm = BenchmarkingVm::new();
for _ in 0..1000 {
vm.run_transaction(black_box(&tx));
dbg!("tx");
}

println!("{:?}", start.elapsed());
Expand Down
2 changes: 1 addition & 1 deletion prover/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading