Crate primitives
Expand description
§revm-primitives
EVM primitive types.
Modules§
- alloy_
primitives - alloy-primitives
- bitvec
- db
- eip7702
- env
- eof
- kzg
- legacy
- precompile
- result
- specification
- state
- utilities
Macros§
- address
- Converts a sequence of string literals containing hex-encoded data
into a new
Address
at compile time. - b256
- Converts a sequence of string literals containing hex-encoded data
into a new
B256
at compile time. - bytes
- Converts a sequence of string literals containing hex-encoded data into a
new
Bytes
at compile time. - fixed_
bytes - Converts a sequence of string literals containing hex-encoded data
into a new
FixedBytes
at compile time. - hex
- Macro for converting sequence of string literals containing hex-encoded data into an array of bytes.
- spec_
to_ generic
Structs§
- Access
List - AccessList as defined in EIP-2930
- Access
List Item - A list of addresses and storage keys that the transaction plans to access. Accesses outside the list are possible, but become more expensive.
- Account
- Account
Info - AccountInfo account information.
- Account
Status - Address
- An Ethereum address, 20 bytes in length.
- Authorization
- An unsigned EIP-7702 authorization.
- Bedrock
Spec - Berlin
Spec - Blob
Excess GasAnd Price - Structure holding block blob excess gas and it calculates blob fee.
- Block
Env - The block environment.
- Bytes
- Wrapper type around [
bytes::Bytes
] to support “0x” prefixed hex strings. - Byzantium
Spec - Cancun
Spec - Canyon
Spec - CfgEnv
- EVM configuration.
- CfgEnv
With Handler Cfg - Configuration environment with the chain spec id.
- Ecotone
Spec - Eip7702
Bytecode - Bytecode of delegated account, specified in EIP-7702
- Env
- EVM environment configuration.
- EnvWith
Handler Cfg - Evm environment with the chain spec id.
- Eof
- EVM Object Format (EOF) container.
- EvmStorage
Slot - This type keeps track of the current value of a storage slot.
- Fixed
Bytes - A byte array of fixed length (
[u8; N]
). - Fjord
Spec - Frontier
Spec - Granite
Spec - Handler
Cfg - Handler configuration fields. It is used to configure the handler. It contains specification id and the Optimism related field if optimism feature is enabled.
- Holocene
Spec - Homestead
Spec - Istanbul
Spec - Isthmus
Spec - Jump
Table - A map of valid
jump
destinations. - KzgSettings
- Stores the setup and parameters needed for computing KZG proofs.
- Latest
Spec - Legacy
Analyzed Bytecode - Legacy analyzed
- Log
- A log consists of an address, and some log data.
- LogData
- An Ethereum event log object.
- London
Spec - Merge
Spec - Optimism
Fields - Additional TxEnv fields for optimism.
- Osaka
Spec - Petersburg
Spec - Prague
Spec - Precompile
Output - Precompile execution output
- Primitive
Signature - An Ethereum ECDSA signature.
- Recovered
Authorization - A recovered authorization.
- Regolith
Spec - Result
AndState - Shanghai
Spec - Signed
Authorization - A signed EIP-7702 authorization.
- Spurious
Dragon Spec - Tangerine
Spec - TxEnv
- The transaction environment.
Enums§
- Analysis
Kind - What bytecode analysis to perform.
- Authorization
List - Authorization list for EIP-7702 transaction type.
- Bytecode
- State of the
Bytecode
analysis. - Bytecode
Decode Error - EOF decode errors.
- Create
Scheme - Create scheme.
- EVMError
- Main EVM error.
- Eip7702
Decode Error - Bytecode errors.
- EnvKzg
Settings - KZG Settings that allow us to specify a custom trusted setup. or use hardcoded default settings.
- Execution
Result - Result of a transaction execution.
- Halt
Reason - Indicates that the EVM has experienced an exceptional halt. This causes execution to immediately end with all gas being consumed.
- Invalid
Header - Errors related to misconfiguration of a
crate::env::BlockEnv
. - Invalid
Transaction - Transaction validation error.
- Optimism
Invalid Transaction - Transaction validation error for Optimism.
- OutOf
GasError - Output
- Output of a transaction execution.
- Precompile
- Precompile and its handlers.
- Precompile
Error - Precompile
Errors - Precompile errors.
- Recovered
Authority - Represents the outcome of an attempt to recover the authority from an authorization.
It can either be valid (containing an
Address
) or invalid (indicating recovery failure). - SpecId
- Specification IDs and their activation block.
- Success
Reason - Reason a transaction successfully completed.
- TxKind
- The
to
field of a transaction. Either a target address, or empty for a contract creation. - TxType
Constants§
- BLOB_
BASE_ FEE_ UPDATE_ FRACTION_ CANCUN - Controls the maximum rate of change for blob gas price.
- BLOB_
BASE_ FEE_ UPDATE_ FRACTION_ ELECTRA - Controls the maximum rate of change for blob gas price (Electra). EIP-7691: Blob throughput increase
- BLOCKHASH_
SERVE_ WINDOW - EIP-2935: Serve historical block hashes from state
- BLOCKHASH_
STORAGE_ ADDRESS - EIP-2935: Serve historical block hashes from state
- BLOCK_
HASH_ HISTORY - Number of block hashes that EVM can access in the past (pre-Prague).
- EIP7702_
MAGIC - EIP-7702 Version Magic in u16 form.
- EIP7702_
MAGIC_ HASH - Hash of EF01 bytes that is used for EXTCODEHASH when called from legacy bytecode.
- EOF_
MAGIC - EOF Magic in u16 form.
- EOF_
MAGIC_ HASH - Hash of EF00 bytes that is used for EXTCODEHASH when called from legacy bytecode.
- GAS_
PER_ BLOB - Gas consumption of a single data blob (== blob byte size).
- KECCAK_
EMPTY - The Keccak-256 hash of the empty string
""
. - MAX_
CODE_ SIZE - EIP-170: Contract code size limit
- MAX_
INITCODE_ SIZE - EIP-3860: Limit and meter initcode
- MIN_
BLOB_ GASPRICE - Minimum gas price for data blobs.
- PRECOMPIL
E3 - The address of precompile 3, which is handled specially in a few places.
- VERSIONED_
HASH_ VERSION_ KZG - First version of the blob.
Statics§
- EIP7702_
MAGIC_ BYTES - EIP-7702 magic number in array form.
- EOF_
MAGIC_ BYTES - EOF magic number in array form.
Traits§
- Spec
- Stateful
Precompile - Stateful precompile trait. It is used to create a arc precompile Precompile::Stateful.
- Stateful
Precompile Mut - Mutable stateful precompile trait. It is used to create a boxed precompile in Precompile::StatefulMut.
Functions§
- calc_
blob_ gasprice - Calculates the blob gas price from the header’s excess blob gas field.
- calc_
excess_ blob_ gas - Calculates the
excess_blob_gas
from the parent header’sblob_gas_used
andexcess_blob_gas
. - fake_
exponential - Approximates
factor * e ** (numerator / denominator)
using Taylor expansion. - keccak256
- Simple interface to the
Keccak-256
hash function.
Type Aliases§
- B256
- 32-byte fixed byte-array type.
- EVMResult
- Result of EVM execution.
- EVMResult
Generic - Generic result of EVM execution. Used to represent error and generic output.
- EnvPrecompile
Fn - EvmState
- EVM State is a mapping from addresses to accounts.
- EvmStorage
- An account’s Storage is a mapping from 256-bit integer keys to EvmStorageSlots.
- HashMap
- A
HashMap
using the default hasher. - HashSet
- A
HashSet
using the default hasher. - I256
- 256-bit signed integer type, consisting of 4, 64-bit limbs.
- Precompile
Result - A precompile operation result.
- Standard
Precompile Fn - Stateful
Precompile Arc - Arc over stateful precompile.
- Stateful
Precompile Box - Box over mutable stateful precompile
- Transact
To - Transaction destination
- Transient
Storage - Structure used for EIP-1153 transient storage.
- U256
- 256-bit unsigned integer type, consisting of 4, 64-bit limbs.