reth_optimism_primitives/
lib.rs

1//! Standalone crate for Optimism-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/paradigmxyz/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
14#[cfg(feature = "alloy-compat")]
15mod alloy_compat;
16
17pub mod bedrock;
18
19pub mod predeploys;
20pub use predeploys::ADDRESS_L2_TO_L1_MESSAGE_PASSER;
21
22pub mod transaction;
23pub use transaction::{signed::OpTransactionSigned, tx_type::OpTxType};
24
25mod receipt;
26pub use receipt::{DepositReceipt, OpReceipt};
27
28/// Optimism-specific block type.
29pub type OpBlock = alloy_consensus::Block<OpTransactionSigned>;
30
31/// Optimism-specific block body type.
32pub type OpBlockBody = <OpBlock as reth_primitives_traits::Block>::Body;
33
34/// Primitive types for Optimism Node.
35#[derive(Debug, Default, Clone, PartialEq, Eq)]
36#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
37pub struct OpPrimitives;
38
39impl reth_primitives_traits::NodePrimitives for OpPrimitives {
40    type Block = OpBlock;
41    type BlockHeader = alloy_consensus::Header;
42    type BlockBody = OpBlockBody;
43    type SignedTx = OpTransactionSigned;
44    type Receipt = OpReceipt;
45}
46
47/// Bincode-compatible serde implementations.
48#[cfg(feature = "serde-bincode-compat")]
49pub mod serde_bincode_compat {
50    pub use super::receipt::serde_bincode_compat::*;
51}