reth_ethereum_primitives/
lib.rs

1//! Standalone crate for ethereum-specific Reth primitive types.
2
3#![doc(
4    html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
5    html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
6    issue_tracker_base_url = "https://github.com/SeismicSystems/seismic-reth/issues/"
7)]
8#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
9#![cfg_attr(not(test), warn(unused_crate_dependencies))]
10#![cfg_attr(not(feature = "std"), no_std)]
11
12extern crate alloc;
13
14mod receipt;
15pub use receipt::*;
16
17/// Kept for consistency tests
18#[cfg(test)]
19mod transaction;
20
21pub use alloy_consensus::{transaction::PooledTransaction, TxType};
22use alloy_consensus::{TxEip4844, TxEip4844WithSidecar};
23use alloy_eips::eip7594::BlobTransactionSidecarVariant;
24
25/// Typed Transaction type without a signature
26pub type Transaction = alloy_consensus::EthereumTypedTransaction<TxEip4844>;
27
28/// Signed transaction.
29pub type TransactionSigned = alloy_consensus::EthereumTxEnvelope<TxEip4844>;
30
31/// A type alias for [`PooledTransaction`] that's also generic over blob sidecar.
32pub type PooledTransactionVariant =
33    alloy_consensus::EthereumTxEnvelope<TxEip4844WithSidecar<BlobTransactionSidecarVariant>>;
34
35/// Bincode-compatible serde implementations.
36#[cfg(all(feature = "serde", feature = "serde-bincode-compat"))]
37pub mod serde_bincode_compat {
38    pub use super::receipt::serde_bincode_compat::*;
39    pub use alloy_consensus::serde_bincode_compat::transaction::*;
40}
41
42/// Type alias for the ethereum block
43pub type Block = alloy_consensus::Block<TransactionSigned>;
44
45/// Type alias for the ethereum blockbody
46pub type BlockBody = alloy_consensus::BlockBody<TransactionSigned>;
47
48/// Helper struct that specifies the ethereum
49/// [`NodePrimitives`](reth_primitives_traits::NodePrimitives) types.
50#[derive(Debug, Clone, Default, PartialEq, Eq)]
51#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
52#[non_exhaustive]
53pub struct EthPrimitives;
54
55impl reth_primitives_traits::NodePrimitives for EthPrimitives {
56    type Block = crate::Block;
57    type BlockHeader = alloy_consensus::Header;
58    type BlockBody = crate::BlockBody;
59    type SignedTx = crate::TransactionSigned;
60    type Receipt = crate::Receipt;
61}