Crate reth_primitives

Source
Expand description

Commonly used types in Reth.

This crate contains Ethereum primitive types and helper functions.

§Feature Flags

  • alloy-compat: Adds compatibility conversions for certain alloy types.
  • arbitrary: Adds proptest and arbitrary support for primitive types.
  • test-utils: Export utilities for testing
  • reth-codec: Enables db codec support for reth types including zstd compression for certain types.

Re-exports§

pub use transaction::PooledTransactionsElementEcRecovered;Deprecated
pub use transaction::TransactionSignedEcRecovered;Deprecated
pub use reth_static_file_types as static_file;
pub use arbitrary;arbitrary
pub use c_kzg as kzg;c-kzg

Modules§

arbitrary
The Arbitrary trait crate.
serde_bincode_compatserde-bincode-compat
Bincode-compatible serde implementations for commonly used types in Reth.
transaction
Transaction types.

Macros§

hardfork
Macro that defines different variants of a chain specific enum. See crate::Hardfork as an example.

Structs§

Account
An Ethereum account.
Bytecode
Bytecode for an account.
ChainHardforks
Ordered list of a chain hardforks that implement Hardfork.
DisplayHardforks
A container for pretty-printing a list of hardforks.
EnrForkIdEntry
Represents a forward-compatible ENR entry for including the forkid in a node record via EIP-868. Forward compatibility is achieved via EIP-8.
EthPrimitives
Helper struct that specifies the ethereum NodePrimitives types.
EthereumChainHardforks
A type allowing to configure activation ForkConditions for a given list of EthereumHardforks.
ForkFilter
Filter that describes the state of blockchain and can be used to check incoming ForkIds for compatibility.
ForkHash
CRC32 hash of all previous forks starting from genesis block.
ForkId
A fork identifier as defined by EIP-2124. Serves as the chain compatibility identifier.
ForkTransition
Represents a transition from one fork to another
GotExpected
A pair of values, one of which is expected and one of which is actual.
GotExpectedBoxed
A pair of values, one of which is expected and one of which is actual.
Head
Describes the current head block.
Header
Ethereum Block header
Log
A log consists of an address, and some log data.
LogData
An Ethereum event log object.
Receipt
Receipt containing result of transaction execution. Typed ethereum transaction receipt. Receipt containing result of transaction execution.
ReceiptWithBloom
[Receipt] with calculated bloom filter.
Recovered
Signed object with recovered signer.
RecoveredBlock
A block with senders recovered from the block’s transactions.
SealedHeader
Seals the header with the block hash.
StorageEntry
Account storage entry.
TransactionMeta
Additional fields in the context of a block that contains this mined transaction.
TransactionSigned
Signed transaction. Signed Ethereum transaction.

Enums§

EthereumHardfork
The name of an Ethereum hardfork.
ForkCondition
The condition at which a fork is activated.
ForkFilterKey
How to filter forks.
HeaderError
Errors that can occur during header sanity checks.
InvalidTransactionError
Represents error variants that can happen when trying to validate a transaction.
StaticFileSegment
Segment of the data that can be moved to static files.
Transaction
Signed transaction. A raw transaction.
TxType
Transaction Type
ValidationError
Reason for rejecting provided ForkId.

Statics§

DEV_HARDFORKS
Dev hardforks

Traits§

EthereumHardforks
Helper methods for Ethereum forks.
Hardfork
Generic hardfork trait.
Hardforks
Generic trait over a set of ordered hardforks
NodePrimitives
Configures all the primitive types of the node.

Functions§

gas_spent_by_transactions
Retrieves gas spent by transactions as a vector of tuples (transaction index, gas used). Retrieves gas spent by transactions as a vector of tuples (transaction index, gas used).
generate_valid_headerarbitrary
Generates a header which is valid with respect to past and future forks. This means, for example, that if the withdrawals root is present, the base fee per gas is also present.
logs_bloom
Compute the logs bloom filter for the given logs.
public_key_to_address
Converts a public key into an ethereum address by hashing the encoded public key with keccak256.
recover_signer_unchecked
Recover signer from message hash, without ensuring that the signature has a low s value.
sign_message
Signs message with the given secret key. Returns the corresponding signature.
valid_header_strategyarbitrary
Generates a proptest strategy for constructing an instance of a header which is valid with respect to past and future forks.

Type Aliases§

Block
Ethereum full block.
BlockBody
A response to GetBlockBodies, containing bodies if any bodies were found.
BlockTy
Helper adapter type for accessing NodePrimitives block types.
BlockWithSendersDeprecated
Ethereum recovered block
BodyTy
Helper adapter type for accessing NodePrimitives block body types.
HeaderTy
Helper adapter type for accessing NodePrimitives block header types.
PooledTransaction
All possible transactions that can be included in a response to GetPooledTransactions. A response to GetPooledTransactions. This can include either a blob transaction, or a non-4844 signed transaction.
ReceiptTy
Helper adapter type for accessing NodePrimitives receipt types.
RecoveredTxDeprecated
Recovered transaction
SealedBlock
Ethereum sealed block type
SealedBlockForDeprecated
Helper type for constructing the block
SealedBlockWithSendersDeprecated
Ethereum recovered block
TxTy
Helper adapter type for accessing NodePrimitives signed transaction types.