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 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.