Skip to content

Commit b0a4b89

Browse files
fix: lazy_update_boundary_heights needs to handle uninitialized memory (#2286)
towards INT-5617 The metering update did not account for the initial 8->4 split from `handle_uninitialized_memory`
1 parent c380567 commit b0a4b89

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

crates/vm/src/arch/execution_mode/metered/memory_ctx.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,15 @@ impl<const PAGE_BITS: usize> MemoryCtx<PAGE_BITS> {
271271
// SAFETY: address_space is from 0 to len(), guaranteed to be in bounds
272272
let x = unsafe { *self.addr_space_access_count.get_unchecked(address_space) };
273273
if x > 0 {
274-
// After finalize, we'll need to read it in chunk-sized units for the merkle chip
274+
// Initial **and** final handling of touched pages requires send (resp. receive) in
275+
// chunk-sized units for the merkle chip
276+
// Corresponds to `handle_uninitialized_memory` and `handle_touched_blocks` in
277+
// online.rs
275278
self.update_adapter_heights_batch(
276279
trace_heights,
277280
address_space as u32,
278281
self.chunk_bits,
279-
(x << PAGE_BITS) as u32,
282+
(x << (PAGE_BITS + 1)) as u32,
280283
);
281284
// SAFETY: address_space is from 0 to len(), guaranteed to be in bounds
282285
unsafe {

0 commit comments

Comments
 (0)