Ethereum Fusaka upgrade EVM Object Format changes

The Ethereum Virtual Machine and state management

Ethereum functions as a distributed state machine. The state of the network is a large data structure that holds all accounts, balances, and a machine state. This machine state changes from block to block according to pre-defined rules. The Ethereum Virtual Machine (EVM) defines these specific rules of change. The state is an enormous data structure called a modified Merkle Patricia Trie. This structure keeps all accounts linked by hashes and reduces the entire state to a single root hash stored on the blockchain. Nodes run the EVM to execute smart contracts. The EVM executes code consistently and securely across all Ethereum nodes. The state transition function, denoted as Y(S, T), produces a new valid output state S’ from an old valid state S and a new set of valid transactions T. Transactions are cryptographically signed instructions from accounts. These instructions result in either message calls or contract creation. Contract creation results in a new contract account that contains compiled smart contract bytecode. When a user makes a message call to a contract, the EVM executes its bytecode.

Volatile machine state and the program counter

The EVM distinguishes between the volatile machine state and the persistent world state. The machine state includes the program counter, the stack, memory, and the gas supply, which are all volatile components that do not persist once the call ends or the transaction completes. The program counter steps through the contract’s bytecode one opcode at a time. The program counter acts as the lit cell on the strip of EVM code. The stack contains short-lived working values with a depth of up to 1,024 items. Each item in the stack is a 256-bit word. This specific word size allows for easy use with 256-bit cryptography, such as Keccak-256 hashes or secp256k1 signatures. Memory serves as a scratch space for the call. The EVM treats memory as a word-addressed byte array. This memory clears immediately when the call ends. You should understand that the program counter is part of the volatile machine state. The machine state is the plinth that carries the EVM.

Persistent storage and transient data

The EVM manages different types of data storage with varying levels of persistence. The contract’s own key-value store is the persistent storage. This storage is a Merkle Patricia storage trie. It is a word-addressable word array associated with the account in question. This storage forms part of the global world state. The world state is the plate that everything stands on. Unlike memory, writes made to the storage persist after the call ends unless the transaction reverts. The EVM also utilizes transient storage for temporary data needs. Transient storage is a per-transaction key-value store accessed through the TSTORE and TLOAD opcodes. This storage persists across all internal calls during a single transaction. The system clears all transient storage at the end of the transaction. Transient storage is modeled as part of the EVM state rather than the execution frame. This method enables gas-efficient temporary state sharing across internal calls during a transaction. How does the network maintain a consistent machine state across thousands of independent operators while processing these complex, multi-layered transactions?

Gas, opcodes, and transaction execution

Every operation in the EVM requires gas to compensate for computational effort. A transaction pays a base intrinsic cost of 21,000 gas before any code runs. The program counter then steps through the opcodes, and every opcode draws from the gas supply. The SSTORE opcode writes a new slot to storage at a cost of 22,100 gas. This cost is significantly higher than other operations. If a transaction provides too little gas, the execution runs out at a specific opcode like SSTORE. In that case, the system consumes all the gas and the write is reverted. The EVM executes as a stack machine and uses opcodes like XOR, AND, ADD, and SUB for standard stack operations. It also includes blockchain-specific stack operations like ADDRESS, BALANCE, and BLOCKHASH.

EVM Component/Metric Specification/Value
Stack Depth 1,024 items
Stack Item Size 256-bit word
Base Transaction Cost 21,000 gas
SSTORE Cost 22,100 gas
Memory Address Type Word-addressed byte array
Storage Type Merkle Patricia storage trie

The transaction fees remain notoriously high during periods of peak congestion on the network.

Newsletter