reth_primitives_traits/
node.rs1use crate::{
2 Block, FullBlock, FullBlockBody, FullBlockHeader, FullReceipt, FullSignedTx,
3 MaybeSerdeBincodeCompat, Receipt,
4};
5use core::fmt;
6
7pub trait NodePrimitives:
13 Send + Sync + Unpin + Clone + Default + fmt::Debug + PartialEq + Eq + 'static
14{
15 type Block: Block<Header = Self::BlockHeader, Body = Self::BlockBody> + MaybeSerdeBincodeCompat;
17 type BlockHeader: FullBlockHeader;
19 type BlockBody: FullBlockBody<Transaction = Self::SignedTx, OmmerHeader = Self::BlockHeader>;
21 type SignedTx: FullSignedTx;
26 type Receipt: Receipt;
28}
29pub trait FullNodePrimitives
31where
32 Self: NodePrimitives<
33 Block: FullBlock<Header = Self::BlockHeader, Body = Self::BlockBody>,
34 BlockHeader: FullBlockHeader,
35 BlockBody: FullBlockBody<Transaction = Self::SignedTx>,
36 SignedTx: FullSignedTx,
37 Receipt: FullReceipt,
38 >,
39{
40}
41
42impl<T> FullNodePrimitives for T where
43 T: NodePrimitives<
44 Block: FullBlock<Header = Self::BlockHeader, Body = Self::BlockBody>,
45 BlockHeader: FullBlockHeader,
46 BlockBody: FullBlockBody<Transaction = Self::SignedTx>,
47 SignedTx: FullSignedTx,
48 Receipt: FullReceipt,
49 >
50{
51}
52
53pub type HeaderTy<N> = <N as NodePrimitives>::BlockHeader;
55
56pub type BodyTy<N> = <N as NodePrimitives>::BlockBody;
58
59pub type BlockTy<N> = <N as NodePrimitives>::Block;
61
62pub type ReceiptTy<N> = <N as NodePrimitives>::Receipt;
64
65pub type TxTy<N> = <N as NodePrimitives>::SignedTx;