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 > + Send
39 + Sync
40 + Unpin
41 + Clone
42 + Default
43 + fmt::Debug
44 + PartialEq
45 + Eq
46 + 'static,
47{
48}
49
50impl<T> FullNodePrimitives for T where
51 T: NodePrimitives<
52 Block: FullBlock<Header = Self::BlockHeader, Body = Self::BlockBody>,
53 BlockHeader: FullBlockHeader,
54 BlockBody: FullBlockBody<Transaction = Self::SignedTx>,
55 SignedTx: FullSignedTx,
56 Receipt: FullReceipt,
57 > + Send
58 + Sync
59 + Unpin
60 + Clone
61 + Default
62 + fmt::Debug
63 + PartialEq
64 + Eq
65 + 'static
66{
67}
68
69pub type HeaderTy<N> = <N as NodePrimitives>::BlockHeader;
71
72pub type BodyTy<N> = <N as NodePrimitives>::BlockBody;
74
75pub type BlockTy<N> = <N as NodePrimitives>::Block;
77
78pub type ReceiptTy<N> = <N as NodePrimitives>::Receipt;
80
81pub type TxTy<N> = <N as NodePrimitives>::SignedTx;