Expand description
Implementations of Evm cheatcodes.
Re-exportsΒ§
use crate::BroadcastableTransaction;πuse crate::Cheatcode;πuse crate::Cheatcodes;πuse crate::CheatcodesCore;πuse crate::CheatcodesExecutor;πuse crate::CheatsCtxt;πuse crate::Error;πuse crate::Result;πuse crate::env::FORGE_CONTEXT;πuse crate::inspector::RecordDebugStepInfo;πuse alloy_consensus::Transaction as _;πuse alloy_consensus::Typed2718;πuse alloy_consensus::transaction::SignerRecoverable;πuse alloy_genesis::Genesis;πuse alloy_genesis::GenesisAccount;πuse alloy_primitives::Address;πuse alloy_primitives::B256;πuse alloy_primitives::Bytes;πuse alloy_primitives::U256;πuse alloy_primitives::b256;πuse alloy_primitives::hex;πuse alloy_primitives::hex;πuse alloy_primitives::keccak256;πuse alloy_primitives::map::AddressMap;πuse alloy_primitives::map::AddressSet;πuse alloy_primitives::map::B256Map;πuse alloy_primitives::map::HashMap;πuse alloy_rlp::Decodable;πuse alloy_sol_types::SolCall;πuse alloy_sol_types::SolValue;πuse evm2::EvmFeatures;πuse evm2::SpecId;πuse evm2::bytecode::Bytecode;πuse evm2::evm::DbResult;πuse evm2::evm::State;πuse evm2::evm::StorageSlotHandle;πuse evm2::interpreter::Host;πuse evm2::registry::HandlerError;πuse foundry_common::EIP1967_IMPLEMENTATION_SLOT;πuse foundry_common::TransactionMaybeSigned;πuse foundry_common::fs::read_json_file;πuse foundry_common::fs::write_json_file;πuse foundry_common::slot_identifier::ENCODING_BYTES;πuse foundry_common::slot_identifier::ENCODING_DYN_ARRAY;πuse foundry_common::slot_identifier::ENCODING_INPLACE;πuse foundry_common::slot_identifier::ENCODING_MAPPING;πuse foundry_common::slot_identifier::SlotIdentifier;πuse foundry_common::slot_identifier::SlotInfo;πuse foundry_common::slot_identifier::identify_eip1967_slot;πuse foundry_common::tempo::TIP20_MAX_LOGO_URI_BYTES;πuse foundry_common::tempo::Tip20LogoUriValidationError;πuse foundry_common::tempo::validate_tip20_logo_uri;πuse foundry_compilers::artifacts::Storage;πuse foundry_compilers::artifacts::StorageLayout;πuse foundry_compilers::artifacts::StorageType;πuse foundry_evm_core::backend::GLOBAL_FAIL_SLOT;πuse foundry_evm_core::backend::RevertStateSnapshotAction;πuse foundry_evm_core::backend::transaction_error;πuse foundry_evm_core::constants::CALLER;πuse foundry_evm_core::constants::CHEATCODE_ADDRESS;πuse foundry_evm_core::constants::HARDHAT_CONSOLE_ADDRESS;πuse foundry_evm_core::constants::TEST_CONTRACT_ADDRESS;πuse foundry_evm_core::eip2935::HISTORY_SERVE_WINDOW;πuse foundry_evm_core::eip2935::HISTORY_STORAGE_ADDRESS;πuse foundry_evm_core::eip2935::HISTORY_STORAGE_CODE;πuse foundry_evm_core::eip2935::forward_fill_start;πuse foundry_evm_core::eip2935::history_storage_slot;πuse foundry_evm_core::eip2935::history_storage_value;πuse foundry_evm_core::evm::EvmEnvFor;πuse foundry_evm_core::evm::EvmFactoryFor;πuse foundry_evm_core::evm::ExecutionPhase;πuse foundry_evm_core::evm::FoundryEvmFactory;πuse foundry_evm_core::evm::FoundryEvmNetwork;πuse foundry_evm_core::evm::FoundryExecutionHooks;πuse foundry_evm_core::evm::FoundryTxConversion;πuse foundry_evm_core::evm::PersistentWrite;πuse foundry_evm_core::evm::Replay;πuse foundry_evm_core::evm::TxEnvelopeFor;πuse foundry_evm_core::evm::TxPayload;πuse foundry_evm_core::evm::TypesFor;πuse foundry_evm_core::evm::evm_env;πuse foundry_evm_traces::TraceRequirements;πuse itertools::Itertools;πuse std::collections::BTreeMap;πuse std::collections::btree_map::Entry;πuse std::fmt::Display;πuse std::path::Component;πuse std::path::Path;πuse std::str::FromStr;πuse std::sync::Arc;πuse foundry_common::fmt::format_token_raw;πuse foundry_config::ExecutionSpec;πuse foundry_config::evm_spec_id_from_str;πuse foundry_config::fs_permissions::FsAccessKind;πuse record_debug_step::convert_call_trace_ctx_to_debug_step;πuse record_debug_step::flatten_call_trace;πuse serde::Serialize;πuse serde::Serialize;πuse serde::Serializer;πuse serde::ser::SerializeMap;πuse crate::Vm::*;π
ModulesΒ§
- fork π
- mapping π
- mock π
- prank π
- record_
debug_ πstep
StructsΒ§
- Account
State πDiffs - Account state diff info.
- Balance
Diff π - Balance diff info.
- GasRecord
- Records the
snapshotGas*cheatcodes. - LogJson π
- JSON-serializable log entry for
getRecordedLogsJson. - Nonce
Diff π - Nonce diff info.
- Record
Access - Records storage slots reads and writes.
- Slot
State πDiff - Storage slot diff info.
- State
Dump π - Storage
Writers π - Storage writes to one account during a state-diff recording.
ConstantsΒ§
- EIP1822_
PROXIABLE_ πSLOT - EIP-1822 UUPS implementation storage slot: keccak256(βPROXIABLEβ)
- TIP20_
LOGO_ πURI_ SLOT_ INDEX
FunctionsΒ§
- append_
storage_ πaccess - Appends an AccountAccess that resumes the recording of the current context.
- cleanup_
long_ πstring_ tail - clear_
eip2935_ πhistory_ storage - Clears the EIP-2935 history ring buffer with journaled writes, so that reverting the enclosing frame restores the previous history storage.
- contract_
storage_ πlayout - Returns the storage layout of the contract at
target. - derive_
snapshot_ πname - encode_
short_ πstring - enter_
tx_ πwarm_ addresses - Installs the addresses a nested transaction in
envwithaccess_listwarms when it starts and thatvm.coolkeeps warm, returning the running transactionβs. - find_
storage_ πvariable - Finds a variable by its label in
storage_layout, returning its storage entry and type. - genesis_
account π - Creates a
GenesisAccountfrom the account ataddressand its known storage. - get_
contract_ πdata - Helper function to get the contract data from the deployed code at an address.
- get_
nonce π - get_
recorded_ πstate_ diffs - Helper function to returns state diffs recorded for each changed account.
- get_
state_ πdiff - Consumes recorded account accesses and returns them as an abi encoded array of AccountAccess. If there are no accounts were recorded as accessed, an abi encoded empty array is returned.
- inner_
last_ πgas_ snapshot - inner_
revert_ πto_ state - inner_
revert_ πto_ state_ and_ delete - inner_
snapshot_ πstate - inner_
start_ πgas_ snapshot - inner_
stop_ πgas_ snapshot - inner_
value_ πsnapshot - is_
long_ πstring - is_
valid_ πsnapshot_ group - Returns whether
groupis a relative path without empty or dot components. - long_
string_ πlength - mark_
account_ πaccesses_ reverted - Marks a reverted frameβs account accesses, including their storage accesses, as reverted.
- merge_
recorded_ πframe - Moves a finished frameβs account accesses into the enclosing recorded frame, or back onto the stack when no enclosing frame was recorded, preserving the order of the accesses.
- read_
callers π - Reads the current caller information and returns the current CallerMode,
msg.senderandtx.origin. - restore_
isolation_ πfee_ accounting - Zeroes the restored base fee again inside an isolated call, whose fee accounting runs without
one, and keeps the restored value visible to
BASEFEE. - set_
eip2935_ πblockhash - Writes
block_hashto the EIP-2935 history storage, if the history contract is deployed. - set_
persistent_ πnonce - Sets the nonce of
address, as a write that survives reverts of the enclosing calls. - set_
tip20_ πlogo_ uri - solidity_
dynamic_ πdata_ slot - store_
solidity_ πstring - string_
chunks π - touch_
account π - Ensures the account is loaded, warm and touched.
- warm_
storage_ πslot - Loads the storage slot and marks it warm, as an
SLOADorSSTOREof it would.