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 evm2::interpreter::op::AND;๐use evm2::interpreter::op::CALL;๐use evm2::interpreter::op::CLZ;๐use evm2::interpreter::op::CODECOPY;๐use evm2::interpreter::op::CREATE;๐use evm2::interpreter::op::DUP6;๐use evm2::interpreter::op::EQ;๐use evm2::interpreter::op::GAS;๐use evm2::interpreter::op::INVALID;๐use evm2::interpreter::op::ISZERO;๐use evm2::interpreter::op::JUMPDEST;๐use evm2::interpreter::op::JUMPI;๐use evm2::interpreter::op::MCOPY;๐use evm2::interpreter::op::MSTORE;๐use evm2::interpreter::op::MUL;๐use evm2::interpreter::op::OR;๐use evm2::interpreter::op::POP;๐use evm2::interpreter::op::PUSH0;๐use evm2::interpreter::op::PUSH1;๐use evm2::interpreter::op::PUSH2;๐use evm2::interpreter::op::PUSH3;๐use evm2::interpreter::op::RETURN;๐use evm2::interpreter::op::RETURNDATASIZE;๐use evm2::interpreter::op::SLOTNUM;๐use evm2::interpreter::op::STATICCALL;๐use evm2::interpreter::op::STOP;๐use evm2::interpreter::op::SWAP1;๐use foundry_compilers::artifacts::EvmVersion;๐
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.