Skip to main content
@tevm/voltaire
@tevm/voltaire / primitives/MemoryDump

primitives/MemoryDump

Type Aliases

MemoryDumpType

MemoryDumpType = object
Defined in: src/primitives/MemoryDump/MemoryDumpType.ts:15 Memory state snapshot from EVM execution Represents the complete memory state at a point in EVM execution. EVM memory is byte-addressable and grows dynamically, organized in 32-byte words.

Example

const dump: MemoryDumpType = {
  data: new Uint8Array([...]), // Full memory contents
  length: 128, // Memory size in bytes
};

Properties

data
readonly data: Uint8Array
Defined in: src/primitives/MemoryDump/MemoryDumpType.ts:19 Raw memory bytes - complete memory contents
length
readonly length: number
Defined in: src/primitives/MemoryDump/MemoryDumpType.ts:24 Total memory size in bytes

Variables

MemoryDump

const MemoryDump: object
Defined in: src/primitives/MemoryDump/index.ts:30

Type Declaration

from()
from: (value) => MemoryDumpType = _from
Create MemoryDump from raw bytes or object
Parameters
value
Memory data or object Uint8Array<ArrayBufferLike> | { data: Uint8Array; length?: number; }
Returns
MemoryDumpType MemoryDump
Example
const dump1 = MemoryDump.from(new Uint8Array(64));
const dump2 = MemoryDump.from({ data: new Uint8Array(64), length: 64 });
readWord()
readWord: (dump, offset) => Uint8Array
Parameters
dump
Uint8Array<ArrayBufferLike> | MemoryDumpType
offset
number
Returns
Uint8Array
slice()
slice: (dump, start, end?) => Uint8Array
Parameters
dump
Uint8Array<ArrayBufferLike> | MemoryDumpType
start
number
end?
number
Returns
Uint8Array

Functions

_readWord()

_readWord(dump, offset): Uint8Array<ArrayBufferLike>
Defined in: src/primitives/MemoryDump/readWord.js:15 Read a 32-byte word from memory at the given offset

Parameters

dump
MemoryDumpType Memory dump
offset
number Byte offset to read from

Returns

Uint8Array<ArrayBufferLike> 32-byte word

Throws

If offset is out of bounds or insufficient data

Example

const word = MemoryDump.readWord(dump, 0); // First 32 bytes
const word2 = MemoryDump.readWord(dump, 32); // Second 32 bytes

_slice()

_slice(dump, start, end?): Uint8Array<ArrayBufferLike>
Defined in: src/primitives/MemoryDump/slice.js:16 Extract a slice of memory

Parameters

dump
MemoryDumpType Memory dump
start
number Start offset (inclusive)
end?
number End offset (exclusive, defaults to length)

Returns

Uint8Array<ArrayBufferLike> Memory slice

Throws

If offsets are invalid

Example

const slice = MemoryDump.slice(dump, 0, 64); // First 64 bytes
const tail = MemoryDump.slice(dump, 64); // From byte 64 to end

from()

from(value): MemoryDumpType
Defined in: src/primitives/MemoryDump/from.js:13 Create MemoryDump from raw bytes or object

Parameters

value
Memory data or object Uint8Array<ArrayBufferLike> | { data: Uint8Array; length?: number; }

Returns

MemoryDumpType MemoryDump

Example

const dump1 = MemoryDump.from(new Uint8Array(64));
const dump2 = MemoryDump.from({ data: new Uint8Array(64), length: 64 });

readWord()

readWord(dump, offset): Uint8Array
Defined in: src/primitives/MemoryDump/index.ts:11

Parameters

dump
Uint8Array<ArrayBufferLike> | MemoryDumpType
offset
number

Returns

Uint8Array

slice()

slice(dump, start, end?): Uint8Array
Defined in: src/primitives/MemoryDump/index.ts:18

Parameters

dump
Uint8Array<ArrayBufferLike> | MemoryDumpType
start
number
end?
number

Returns

Uint8Array