Skip to content

Commit

Permalink
compatibility with optimize external snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
joonazan committed Jul 24, 2024
1 parent f58a026 commit e88cf85
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
13 changes: 7 additions & 6 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 @@ -326,9 +325,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 @@ -460,7 +462,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
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

0 comments on commit e88cf85

Please sign in to comment.