Module backend

Source
Expand description

Foundry’s main executor backend abstraction and implementation.

ModulesΒ§

cow πŸ”’
A wrapper around Backend that is clone-on-write used for fuzzing.
diagnostic πŸ”’
error πŸ”’
in_memory_db πŸ”’
In-memory database.
snapshot πŸ”’

StructsΒ§

Backend
Provides the underlying revm::Database implementation.
BackendInner
Container type for various Backend related data
BackendStateSnapshot
Represents a state snapshot taken during evm execution
BlockchainDb
A shareable Block database
BlockchainDbMeta
relevant identifying markers in the context of BlockchainDb
CowBackend
A wrapper around Backend that ensures only revm::DatabaseRef functions are called.
EmptyDBWrapper
An empty database that always returns default values when queried.
Fork
Represents a fork
MemDb
In-memory [Database] for Anvil.
SharedBackend
A cloneable backend type that shares access to the backend data with all its clones.
StateSnapshot
A minimal abstraction of a state at a certain point in time
_ObjectSafe πŸ”’

EnumsΒ§

BackendDatabaseSnapshot
Variants of a [revm::Database]
BackendError
Errors that can happen when working with [revm::Database]
DatabaseError
Errors that can happen when working with [revm::Database]
RevertDiagnostic
Represents possible diagnostic cases on revert
RevertStateSnapshotAction
What to do when reverting a state snapshot.

ConstantsΒ§

DEFAULT_PERSISTENT_ACCOUNTS πŸ”’
All accounts that will have persistent storage across fork swaps.
GLOBAL_FAIL_SLOT
bytes32("failed"), as a storage slot key into CHEATCODE_ADDRESS.

TraitsΒ§

DatabaseExt
An extension trait that allows us to easily extend the revm::Inspector capabilities

FunctionsΒ§

apply_state_changeset πŸ”’
Applies the changeset of a transaction to the active journaled state and also commits it in the forked db
commit_transaction πŸ”’
Executes the given transaction and commits state changes to the database and the journaled state, with an inspector.
is_contract_in_state πŸ”’
Returns true of the address is a contract
merge_account_data πŸ”’
Clones the data of the given accounts from the active database into the fork_db This includes the data held in storage (CacheDB) and kept in the JournaledState.
merge_db_account_data πŸ”’
Clones the account data from the active db into the ForkDB
merge_journaled_state_data πŸ”’
Clones the account data from the active_journaled_state into the fork_journaled_state
update_current_env_with_fork_env πŸ”’
This updates the currently used env with the fork’s environment
update_env_block πŸ”’
Updates the env’s block with the block’s data
update_state
Helper method which updates data in the state with the data from the database. Does not change state for persistent accounts (for roll fork to transaction and transact).

Type AliasesΒ§

BackendResult
DatabaseResult
Result alias with DatabaseError as error
ForkDB πŸ”’
ForkLookupIndex πŸ”’
Represents the index of a fork in the created forks vector This is used for fast lookup
FoundryEvmInMemoryDB
Type alias for an in-memory database.
JournaledState
LocalForkId
Represents a numeric ForkId valid only for the existence of the Backend.