reth_primitives/
lib.rs

1//! Commonly used types in Reth.
2//!
3//! This crate contains Ethereum primitive types and helper functions.
4//!
5//! ## Feature Flags
6//!
7//! - `alloy-compat`: Adds compatibility conversions for certain alloy types.
8//! - `arbitrary`: Adds `proptest` and `arbitrary` support for primitive types.
9//! - `test-utils`: Export utilities for testing
10//! - `reth-codec`: Enables db codec support for reth types including zstd compression for certain
11//!   types.
12
13#![doc(
14    html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
15    html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
16    issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
17)]
18#![cfg_attr(not(test), warn(unused_crate_dependencies))]
19#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
20#![cfg_attr(not(feature = "std"), no_std)]
21
22mod block;
23mod receipt;
24pub use reth_static_file_types as static_file;
25pub mod transaction;
26#[cfg(any(test, feature = "arbitrary"))]
27pub use block::{generate_valid_header, valid_header_strategy};
28pub use block::{Block, BlockBody, SealedBlock};
29#[expect(deprecated)]
30pub use block::{BlockWithSenders, SealedBlockFor, SealedBlockWithSenders};
31
32pub use receipt::{gas_spent_by_transactions, Receipt};
33pub use reth_primitives_traits::{
34    logs_bloom, Account, BlockTy, BodyTy, Bytecode, GotExpected, GotExpectedBoxed, Header,
35    HeaderError, HeaderTy, Log, LogData, NodePrimitives, ReceiptTy, RecoveredBlock, SealedHeader,
36    StorageEntry, TxTy,
37};
38pub use static_file::StaticFileSegment;
39
40pub use alloy_consensus::{
41    transaction::{PooledTransaction, Recovered, TransactionMeta},
42    ReceiptWithBloom,
43};
44
45/// Recovered transaction
46#[deprecated(note = "use `Recovered` instead")]
47pub type RecoveredTx<T> = Recovered<T>;
48
49pub use transaction::{
50    util::secp256k1::{public_key_to_address, recover_signer_unchecked, sign_message},
51    InvalidTransactionError, Transaction, TransactionSigned, TxType,
52};
53#[expect(deprecated)]
54pub use transaction::{PooledTransactionsElementEcRecovered, TransactionSignedEcRecovered};
55
56// Re-exports
57pub use reth_ethereum_forks::*;
58
59#[cfg(any(test, feature = "arbitrary"))]
60pub use arbitrary;
61
62#[cfg(feature = "c-kzg")]
63pub use c_kzg as kzg;
64
65/// Bincode-compatible serde implementations for commonly used types in Reth.
66///
67/// `bincode` crate doesn't work with optionally serializable serde fields, but some of the
68/// Reth types require optional serialization for RPC compatibility. This module makes so that
69/// all fields are serialized.
70///
71/// Read more: <https://github.com/bincode-org/bincode/issues/326>
72#[cfg(feature = "serde-bincode-compat")]
73pub mod serde_bincode_compat {
74    pub use reth_primitives_traits::serde_bincode_compat::*;
75}
76
77// Re-export of `EthPrimitives`
78pub use reth_ethereum_primitives::EthPrimitives;