Expand description
Cheatcode EVM inspector.
Re-exportsΒ§
use crate::Cheatcode;πuse crate::CheatcodesBackend;πuse crate::CheatcodesCore;πuse crate::CheatsConfig;πuse crate::CheatsCtxt;πuse crate::Error;πuse crate::Result;πuse crate::Vm;πuse crate::Vm::AccountAccess;πuse crate::evm::GasRecord;πuse crate::evm::RecordAccess;πuse crate::evm::append_storage_access;πuse crate::evm::mark_account_accesses_reverted;πuse crate::evm::merge_recorded_frame;πuse crate::evm::mock;πuse crate::evm::mock::MockCallDataContext;πuse crate::evm::mock::MockCallReturnData;πuse crate::evm::prank::Prank;πuse crate::evm::touch_account;πuse crate::expected_emit;πuse crate::expected_emit::ExpectedEmitTracker;πuse crate::script::Broadcast;πuse crate::test::assert::FailureProvenance;πuse crate::test::assert::FailureTrace;πuse crate::test::assume::AssumeNoRevert;πuse crate::test::expect;πuse crate::test::expect::ExpectedCallTracker;πuse crate::test::expect::ExpectedCreate;πuse crate::test::expect::ExpectedRevert;πuse crate::test::expect::ExpectedRevertKind;πuse crate::test::revert_handlers;πuse crate::utils::IgnoredTraces;πuse alloy_consensus::BlobTransactionSidecarVariant;πuse alloy_consensus::transaction::Recovered;πuse alloy_eips::eip7702::SignedAuthorization;πuse alloy_network::Ethereum;πuse alloy_network::Network;πuse alloy_network::TransactionBuilder;πuse alloy_primitives::Address;πuse alloy_primitives::B256;πuse alloy_primitives::Bytes;πuse alloy_primitives::Log;πuse alloy_primitives::TxKind;πuse alloy_primitives::U256;πuse alloy_primitives::hex;πuse alloy_primitives::hex;πuse alloy_primitives::map::HashMap;πuse alloy_primitives::map::HashSet;πuse alloy_rpc_types::AccessList;πuse alloy_sol_types::SolCall;πuse alloy_sol_types::SolInterface;πuse evm2::ExecutionError;πuse evm2::OpcodeSet;πuse evm2::evm::State;πuse evm2::evm::StateSnapshot;πuse evm2::interpreter::Gas;πuse evm2::interpreter::GasTracker;πuse evm2::interpreter::Host;πuse evm2::interpreter::InstrStop;πuse evm2::interpreter::Interpreter;πuse evm2::interpreter::MessageExt;πuse evm2::interpreter::MessageKind;πuse evm2::interpreter::MessageResultExt;πuse evm2::interpreter::derive_create_destination;πuse evm2::interpreter::op;πuse foundry_common::FoundryTransactionBuilder;πuse foundry_common::SELECTOR_LEN;πuse foundry_common::TransactionMaybeSigned;πuse foundry_common::mapping_slots::MappingSlots;πuse foundry_common::mapping_slots::PendingMappingHash;πuse foundry_common::mapping_slots::capture_hash as capture_mapping_hash;πuse foundry_common::mapping_slots::record_hash as record_mapping_hash;πuse foundry_common::mapping_slots::step as mapping_step;πuse foundry_evm_core::Breakpoints;πuse foundry_evm_core::abi::Vm::stopExpectSafeMemoryCall;πuse foundry_evm_core::backend::LocalForkId;πuse foundry_evm_core::backend::RevertDiagnostic;πuse foundry_evm_core::constants::CHEATCODE_ADDRESS;πuse foundry_evm_core::constants::HARDHAT_CONSOLE_ADDRESS;πuse foundry_evm_core::constants::MAGIC_ASSUME;πuse foundry_evm_core::evm::BlockEnvFor;πuse foundry_evm_core::evm::EthEvmNetwork;πuse foundry_evm_core::evm::EvmEnvFor;πuse foundry_evm_core::evm::FoundryEvmFor;πuse foundry_evm_core::evm::FoundryEvmNetwork;πuse foundry_evm_core::evm::InterpreterFor;πuse foundry_evm_core::evm::MessageFor;πuse foundry_evm_core::evm::MessageResultFor;πuse foundry_evm_core::evm::PersistentWrite;πuse foundry_evm_core::evm::SnapshotRestores;πuse foundry_evm_core::evm::SpecFor;πuse foundry_evm_core::evm::TransactionRequestFor;πuse foundry_evm_core::evm::TxFor;πuse foundry_evm_core::evm::TxResultFor;πuse foundry_evm_core::evm::restore_access_warmth;πuse foundry_evm_core::utils::opcodes;πuse foundry_evm_traces::TracingInspector;πuse foundry_evm_traces::TracingInspectorConfig;πuse foundry_evm_traces::identifier::SignaturesIdentifier;πuse itertools::Itertools;πuse rand::Rng;πuse std::cmp::max;πuse std::collections::BTreeMap;πuse std::collections::VecDeque;πuse std::fmt::Debug;πuse std::fmt::Debug;πuse std::ops::Range;πuse std::sync::Arc;πuse std::sync::OnceLock;πuse std::sync::atomic::Ordering;π
ModulesΒ§
- analysis
- Cheatcode information, extracted from the syntactic and semantic analysis of the sources.
- env_
overrides π - Cheatcode overrides of the
BASEFEE,GASPRICE,BLOBHASHandCHAINIDopcode values.
MacrosΒ§
- try_
or_ πreturn
StructsΒ§
- Active
Storage πHook - The storage-hook callback frame currently executing.
- Arbitrary
Storage - Holds data about arbitrary storage.
- Broadcastable
Transaction - Helps collecting transactions from different forks.
- Cheatcode
Analysis - Provides cached, on-demand syntactic and semantic analysis of a completed
Compilerinstance. - Cheatcodes
- An EVM inspector that handles calls to various cheatcodes, each with their own behavior.
- Created
Account πChange - Created
Accounts πFrame - Created
Accounts πSnapshot - EnvOverride
State - Per-fork environment overrides and their state-snapshot copies.
- GasMetering
- Holds gas metering state.
- Record
Debug Step Info - Storage
Hook - A callback registered for a storage access hook.
- Storage
Hook πInspector State
EnumsΒ§
- Created
Accounts πFrame Kind - Pending
Storage πHook
ConstantsΒ§
- FRAME_
END_ πOPCODES - The instructions that end a frame with a result its caller reads: a halt discards the gas and refund of the frame.
- LOG_
EMITTING_ πOPCODES - The instructions during which the running frame can emit a log:
LOG*, and the message and self-destruct instructions, such as for logs of precompiles and value transfers. - MEMORY_
OPCODES π - The instructions that read or write memory, which
expectSafeMemorychecks. - STATE_
DIFF_ πOPCODES - The instructions that
startStateDiffRecordingrecords.
TraitsΒ§
- Cheatcodes
Executor - Runs nested executions on behalf of cheatcodes.
FunctionsΒ§
- access_
is_ πcall - Returns true if the kind of account access is a call.
- apply_
authorization_ πnonces - Bumps the nonces of the authorities of
authorizationsthat the transaction will apply, as EIP-7702 does, for a transaction that is broadcast but not executed. - apply_
dispatch π - Dispatches the cheatcode call to the appropriate function.
- cheatcode_
id π - cheatcode_
of π - Returns the
spec::Cheatcodedefinition for a givenspec::CheatcodeDefimplementor. - cheatcode_
signature π - decode_
cheatcode_ call - Decodes a cheatcode call, reporting an unknown selector as a
Vminterface mismatch. - disallowed_
mem_ πwrite - Helper that expands memory, stores a revert string pertaining to a disallowed memory write, and sets the return range to the revert stringβs location in memory.
- exec_
create π - Executes the given CREATE message as a nested frame with the whole inspector stack.
- frame_
gas π - Returns the gas a frame used, as reported by
lastCallGasandlastFrameGas. - has_
host_ πeffects - Returns whether
callwrites to files or environment variables, runs a command, sends an arbitrary RPC request, creates a fork at the latest block, which can be newer than the campaignβs, prompts for input, or reads the clock, which skipped sleeps would make disagree with the campaignβs. - message_
result - Returns the result of a message that did not execute, keeping its whole execution gas.
- record_
logs π - Records a log into the recorded logs vector, if it exists.
- recorded_
call_ πstate_ account - Returns the account whose balance and nonce a callβs
AccountAccessrecords. - revert_
frame - Stops the running frame with a revert carrying
output, before its current instruction runs or after it ran. - set_
return π - Turns
outcomeinto a successful return withoutput. - set_
revert π - Turns
outcomeinto a revert withoutput. - transfer_
value π - Returns the value a call message transfers, if it transfers one.
Type AliasesΒ§
- Broadcastable
Transactions - List of transactions that can be broadcasted.