Skip to main content
@tevm/voltaire
@tevm/voltaire / evm / Memory

Memory

Functions

mcopy()

mcopy(frame): EvmError | null
Defined in: src/evm/memory/0x5e_MCOPY.js:41 MCOPY opcode (0x5e) - Copy memory (EIP-5656, Cancun+) Pops dest, src, len from stack. Copies len bytes from src to dest. Handles overlapping regions correctly using temporary buffer. Gas cost: GasFastestStep (3) + memory expansion cost + copy cost (3 gas per word) Note: This opcode was introduced in the Cancun hardfork (EIP-5656). Implementation assumes hardfork check is done externally.

Parameters

frame
BrandedFrame Frame instance

Returns

EvmError | null Error if any

mload()

mload(frame): EvmError | null
Defined in: src/evm/memory/0x51_MLOAD.js:18 MLOAD opcode (0x51) - Load word from memory Pops offset from stack, reads 32 bytes from memory starting at offset, and pushes the result as a 256-bit value onto the stack. Gas cost: GasFastestStep (3) + memory expansion cost

Parameters

frame
BrandedFrame Frame instance

Returns

EvmError | null Error if any

mstore()

mstore(frame): EvmError | null
Defined in: src/evm/memory/0x52_MSTORE.js:17 MSTORE opcode (0x52) - Save word to memory Pops offset and value from stack, writes 32 bytes to memory starting at offset. Value is stored in big-endian format. Gas cost: GasFastestStep (3) + memory expansion cost

Parameters

frame
BrandedFrame Frame instance

Returns

EvmError | null Error if any

mstore8()

mstore8(frame): EvmError | null
Defined in: src/evm/memory/0x53_MSTORE8.js:17 MSTORE8 opcode (0x53) - Save byte to memory Pops offset and value from stack, writes the least significant byte of value to memory at offset. Gas cost: GasFastestStep (3) + memory expansion cost

Parameters

frame
BrandedFrame Frame instance

Returns

EvmError | null Error if any