ethereum.forks.dao_fork.vm.memoryethereum.forks.tangerine_whistle.vm.memory

Ethereum Virtual Machine (EVM) Memory.

.. contents:: Table of Contents :backlinks: none :local:

Introduction

EVM memory operations.

memory_write

Writes to memory.

Parameters

memory : Memory contents of the EVM. start_position : Starting pointer to the memory. value : Data to write to memory.

def memory_write(memory: bytearray, ​​start_position: U256, ​​value: Bytes) -> None:
23
    <snip>
36
    memory[start_position : int(start_position) + len(value)] = value

memory_read_bytes

Read bytes from memory.

Parameters

memory : Memory contents of the EVM. start_position : Starting pointer to the memory. size : Size of the data that needs to be read from start_position.

Returns

data_bytes : Data read from memory.

def memory_read_bytes(memory: bytearray, ​​start_position: U256, ​​size: U256) -> Bytes:
42
    <snip>
60
    return Bytes(memory[start_position : Uint(start_position) + Uint(size)])

buffer_read

Read bytes from a buffer. Padding with zeros if necessary.

Parameters

buffer : Memory contents of the EVM. start_position : Starting pointer to the memory. size : Size of the data that needs to be read from start_position.

Returns

data_bytes : Data read from memory.

def buffer_read(buffer: Bytes, ​​start_position: U256, ​​size: U256) -> Bytes:
64
    <snip>
82
    return right_pad_zero_bytes(
83
        buffer[start_position : Uint(start_position) + Uint(size)], size
84
    )