Skip to main content

Module backend

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 ๐Ÿ”’
strategy ๐Ÿ”’

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
BackendStrategy
Strategy for super::Backend.
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.
EvmBackendStrategyRunner
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ยง

BackendStrategyContext
Context for BackendStrategyRunner.
BackendStrategyRunner
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
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.