reth_eth_wire_types/
primitives.rs1use alloy_rlp::{Decodable, Encodable};
4use reth_primitives_traits::{Block, BlockBody, BlockHeader, SignedTransaction};
5use std::fmt::Debug;
6
7pub trait NetworkPrimitives:
10 Send + Sync + Unpin + Clone + Debug + PartialEq + Eq + 'static
11{
12 type BlockHeader: BlockHeader + 'static;
14
15 type BlockBody: BlockBody + 'static;
17
18 type Block: Block<Header = Self::BlockHeader, Body = Self::BlockBody>
20 + Encodable
21 + Decodable
22 + 'static;
23
24 type BroadcastedTransaction: SignedTransaction + 'static;
28
29 type PooledTransaction: SignedTransaction + TryFrom<Self::BroadcastedTransaction> + 'static;
31
32 type Receipt: Encodable
34 + Decodable
35 + Send
36 + Sync
37 + Unpin
38 + Clone
39 + Debug
40 + PartialEq
41 + Eq
42 + 'static;
43}
44
45#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
47#[non_exhaustive]
48pub struct EthNetworkPrimitives;
49
50impl NetworkPrimitives for EthNetworkPrimitives {
51 type BlockHeader = alloy_consensus::Header;
52 type BlockBody = reth_primitives::BlockBody;
53 type Block = reth_primitives::Block;
54 type BroadcastedTransaction = reth_primitives::TransactionSigned;
55 type PooledTransaction = reth_primitives::PooledTransactionsElement;
56 type Receipt = reth_primitives::Receipt;
57}