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