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))]
9#![cfg_attr(not(test), warn(unused_crate_dependencies))]
10#![cfg_attr(not(feature = "std"), no_std)]
11#![allow(unused)]
12extern crate alloc;
13
14pub mod bedrock;
15
16// Re-export predeploys from op-alloy-consensus
17pub use op_alloy_consensus::L2_TO_L1_MESSAGE_PASSER_ADDRESS;
18
19pub mod transaction;
20pub use transaction::*;
21
22mod receipt;
23pub use op_alloy_consensus::OpReceipt;
24pub use receipt::DepositReceipt;
25
26/// Optimism-specific block type.
27pub type OpBlock = alloy_consensus::Block<OpTransactionSigned>;
28
29/// Optimism-specific block body type.
30pub type OpBlockBody = <OpBlock as reth_primitives_traits::Block>::Body;
31
32/// Primitive types for Optimism Node.
33#[derive(Debug, Default, Clone, PartialEq, Eq)]
34#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
35pub struct OpPrimitives;
36
37impl reth_primitives_traits::NodePrimitives for OpPrimitives {
38    type Block = OpBlock;
39    type BlockHeader = alloy_consensus::Header;
40    type BlockBody = OpBlockBody;
41    type SignedTx = OpTransactionSigned;
42    type Receipt = OpReceipt;
43}
44
45/// Bincode-compatible serde implementations.
46#[cfg(feature = "serde-bincode-compat")]
47pub mod serde_bincode_compat {
48    pub use super::receipt::serde_bincode_compat::OpReceipt as LocalOpReceipt;
49    pub use op_alloy_consensus::serde_bincode_compat::OpReceipt;
50}