diff --git a/evm/src/generation/memory.rs b/evm/src/generation/memory.rs index 0b80756a..60bfe794 100644 --- a/evm/src/generation/memory.rs +++ b/evm/src/generation/memory.rs @@ -42,7 +42,7 @@ impl MemorySegmentState { } pub(super) fn set(&mut self, virtual_addr: usize, value: U256) { - if virtual_addr + 1 > self.content.len() { + if virtual_addr >= self.content.len() { self.content.resize(virtual_addr + 1, U256::zero()); } self.content[virtual_addr] = value; diff --git a/evm/src/generation/mod.rs b/evm/src/generation/mod.rs index edca27dd..b73270db 100644 --- a/evm/src/generation/mod.rs +++ b/evm/src/generation/mod.rs @@ -12,6 +12,8 @@ use crate::util::trace_rows_to_poly_values; mod memory; pub(crate) mod state; +/// A piece of data which has been encoded using Recursive Length Prefix (RLP) serialization. +/// See https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/ pub type RlpBlob = Vec; /// Merkle proofs are encoded using an RLP blob for each node in the path.