Expand description
System call implementations for special EVM operations. System call logic for external state transitions required by certain EIPs (notably EIP-2935 and EIP-4788).
These EIPs require the client to perform special system calls to update state (such as block hashes or beacon roots) at block boundaries, outside of normal EVM transaction execution. REVM provides the system call mechanism, but the actual state transitions must be performed by the client or test harness, not by the EVM itself.
§Example: Using transact_system_call
for pre/post block hooks
The client should use SystemCallEvm::transact_system_call
method to perform required state updates before or after block execution, as specified by the EIP:
ⓘ
// Example: update beacon root (EIP-4788) at the start of a block
let beacon_root: Bytes = ...; // obtained from consensus layer
let beacon_contract: Address = "0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02".parse().unwrap();
evm.transact_system_call(beacon_contract, beacon_root)?;
// Example: update block hash (EIP-2935) at the end of a block
let block_hash: Bytes = ...; // new block hash
let history_contract: Address = "0x0000F90827F1C53a10cb7A02335B175320002935".parse().unwrap();
evm.transact_system_call(history_contract, block_hash)?;
See the book section on External State Transitions for more details.
Constants§
- SYSTEM_
ADDRESS - The system address used for system calls.
Traits§
- System
Call Commit Evm - Extension of the
SystemCallEvm
trait that adds a method that commits the state after execution. - System
Call Evm - API for executing the system calls. System calls dont deduct the caller or reward the beneficiary. They are used before and after block execution to insert or obtain blockchain state.
- System
Call Tx - Creates the system transaction with default values and set data and tx call target to system contract address that is going to be called.