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§

AccessList
AccessList as defined in EIP-2930
AccessListItem
A list of addresses and storage keys that the transaction plans to access. Accesses outside the list are possible, but become more expensive.
Account
AccountInfo
AccountInfo account information.
AccountStatus
Address
An Ethereum address, 20 bytes in length.
Authorization
An unsigned EIP-7702 authorization.
BedrockSpec
BerlinSpec
BlobExcessGasAndPrice
Structure holding block blob excess gas and it calculates blob fee.
BlockEnv
The block environment.
Bytes
Wrapper type around [bytes::Bytes] to support “0x” prefixed hex strings.
ByzantiumSpec
CancunSpec
CanyonSpec
CfgEnv
EVM configuration.
CfgEnvWithHandlerCfg
Configuration environment with the chain spec id.
EcotoneSpec
Eip7702Bytecode
Bytecode of delegated account, specified in EIP-7702
Env
EVM environment configuration.
EnvWithHandlerCfg
Evm environment with the chain spec id.
Eof
EVM Object Format (EOF) container.
EvmStorageSlot
This type keeps track of the current value of a storage slot.
FixedBytes
A byte array of fixed length ([u8; N]).
FjordSpec
FrontierSpec
GraniteSpec
HandlerCfg
Handler configuration fields. It is used to configure the handler. It contains specification id and the Optimism related field if optimism feature is enabled.
HoloceneSpec
HomesteadSpec
IstanbulSpec
IsthmusSpec
JumpTable
A map of valid jump destinations.
KzgSettings
Stores the setup and parameters needed for computing KZG proofs.
LatestSpec
LegacyAnalyzedBytecode
Legacy analyzed
Log
A log consists of an address, and some log data.
LogData
An Ethereum event log object.
LondonSpec
MergeSpec
OptimismFields
Additional TxEnv fields for optimism.
OsakaSpec
PetersburgSpec
PragueSpec
PrecompileOutput
Precompile execution output
PrimitiveSignature
An Ethereum ECDSA signature.
RecoveredAuthorization
A recovered authorization.
RegolithSpec
ResultAndState
ShanghaiSpec
SignedAuthorization
A signed EIP-7702 authorization.
SpuriousDragonSpec
TangerineSpec
TxEnv
The transaction environment.

Enums§

AnalysisKind
What bytecode analysis to perform.
AuthorizationList
Authorization list for EIP-7702 transaction type.
Bytecode
State of the Bytecode analysis.
BytecodeDecodeError
EOF decode errors.
CreateScheme
Create scheme.
EVMError
Main EVM error.
Eip7702DecodeError
Bytecode errors.
EnvKzgSettings
KZG Settings that allow us to specify a custom trusted setup. or use hardcoded default settings.
ExecutionResult
Result of a transaction execution.
HaltReason
Indicates that the EVM has experienced an exceptional halt. This causes execution to immediately end with all gas being consumed.
InvalidHeader
Errors related to misconfiguration of a crate::env::BlockEnv.
InvalidTransaction
Transaction validation error.
OptimismInvalidTransaction
Transaction validation error for Optimism.
OutOfGasError
Output
Output of a transaction execution.
Precompile
Precompile and its handlers.
PrecompileError
PrecompileErrors
Precompile errors.
RecoveredAuthority
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.
SuccessReason
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.
PRECOMPILE3
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
StatefulPrecompile
Stateful precompile trait. It is used to create a arc precompile Precompile::Stateful.
StatefulPrecompileMut
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’s blob_gas_used and excess_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.
EVMResultGeneric
Generic result of EVM execution. Used to represent error and generic output.
EnvPrecompileFn
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.
PrecompileResult
A precompile operation result.
StandardPrecompileFn
StatefulPrecompileArc
Arc over stateful precompile.
StatefulPrecompileBox
Box over mutable stateful precompile
TransactTo
Transaction destination
TransientStorage
Structure used for EIP-1153 transient storage.
U256
256-bit unsigned integer type, consisting of 4, 64-bit limbs.