ethereum.forks.cancun.vm.memoryethereum.forks.prague.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.
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.
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 | ) |
| 82 | buffer_slice = buffer[start_position : Uint(start_position) + Uint(size)] |
| 83 | return right_pad_zero_bytes(bytes(buffer_slice), size) |