Skip to main content

Module evm

Module evm 

Source
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Β§

AccountStateDiffs πŸ”’
Account state diff info.
BalanceDiff πŸ”’
Balance diff info.
GasRecord
Records the snapshotGas* cheatcodes.
LogJson πŸ”’
JSON-serializable log entry for getRecordedLogsJson.
NonceDiff πŸ”’
Nonce diff info.
RecordAccess
Records storage slots reads and writes.
SlotStateDiff πŸ”’
Storage slot diff info.
StateDump πŸ”’
StorageWriters πŸ”’
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 env with access_list warms when it starts and that vm.cool keeps 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 GenesisAccount from the account at address and 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 group is 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.sender and tx.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_hash to 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 SLOAD or SSTORE of it would.