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