Skip to main content

Module evm_version

Module evm_version 

Source
Expand description

Detects the EVM version a node executes at a given block.

Replaying a transaction needs the spec its chain applied at that block. For chains without a hardfork schedule known to Foundry, header fields only hint at it, and replaying an old block under a newer spec can make a transaction succeed locally that failed on-chain because an opcode was not active yet. probe_evm_version instead asks the node which features it executes.

Re-exportsยง

use alloy_network::Network; ๐Ÿ”’
use alloy_network::TransactionBuilder; ๐Ÿ”’
use alloy_primitives::Bytes; ๐Ÿ”’
use alloy_primitives::U256; ๐Ÿ”’
use alloy_provider::Provider; ๐Ÿ”’
use alloy_rpc_types::BlockId; ๐Ÿ”’
use foundry_compilers::artifacts::EvmVersion; ๐Ÿ”’
use revm::bytecode::opcode::AND; ๐Ÿ”’
use revm::bytecode::opcode::CALL; ๐Ÿ”’
use revm::bytecode::opcode::CLZ; ๐Ÿ”’
use revm::bytecode::opcode::CODECOPY; ๐Ÿ”’
use revm::bytecode::opcode::CREATE; ๐Ÿ”’
use revm::bytecode::opcode::DUP6; ๐Ÿ”’
use revm::bytecode::opcode::EQ; ๐Ÿ”’
use revm::bytecode::opcode::GAS; ๐Ÿ”’
use revm::bytecode::opcode::INVALID; ๐Ÿ”’
use revm::bytecode::opcode::ISZERO; ๐Ÿ”’
use revm::bytecode::opcode::JUMPDEST; ๐Ÿ”’
use revm::bytecode::opcode::JUMPI; ๐Ÿ”’
use revm::bytecode::opcode::MCOPY; ๐Ÿ”’
use revm::bytecode::opcode::MSTORE; ๐Ÿ”’
use revm::bytecode::opcode::MUL; ๐Ÿ”’
use revm::bytecode::opcode::OR; ๐Ÿ”’
use revm::bytecode::opcode::POP; ๐Ÿ”’
use revm::bytecode::opcode::PUSH0; ๐Ÿ”’
use revm::bytecode::opcode::PUSH1; ๐Ÿ”’
use revm::bytecode::opcode::PUSH2; ๐Ÿ”’
use revm::bytecode::opcode::PUSH3; ๐Ÿ”’
use revm::bytecode::opcode::RETURN; ๐Ÿ”’
use revm::bytecode::opcode::RETURNDATASIZE; ๐Ÿ”’
use revm::bytecode::opcode::SLOTNUM; ๐Ÿ”’
use revm::bytecode::opcode::STATICCALL; ๐Ÿ”’
use revm::bytecode::opcode::STOP; ๐Ÿ”’
use revm::bytecode::opcode::SWAP1; ๐Ÿ”’

Constantsยง

PROBES ๐Ÿ”’
Probed features in activation order, each paired with the EVM version that introduced it and runtime code that halts exceptionally unless the feature is active.
PROBE_CALL_GAS ๐Ÿ”’
Gas limit of the probe call, enough for the worst case in which every probe fails. Under EIP-8037 the six accounts the probe creates cost 1,101,600 state gas alone.
PROBE_GAS ๐Ÿ”’
Gas forwarded to each probe. A failing probe consumes all of it.

Functionsยง

deploy_code ๐Ÿ”’
Returns initcode that deploys runtime.
evm_version_from_mask ๐Ÿ”’
Maps the probe result to the newest version whose probe and all earlier probes succeeded.
probe_code ๐Ÿ”’
Builds the creation code of the probe call.
probe_evm_version
Returns the newest EVM version whose features, and those of every earlier probed version, the node executes at block.