mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: move (Full)NodePrimitives to reth-primitive-traits (#12461)
Co-authored-by: Emilia Hane <elsaemiliaevahane@gmail.com>
This commit is contained in:
@ -9,9 +9,11 @@
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
pub use reth_primitives_traits::{Block, BlockBody, FullBlock, FullReceipt, FullSignedTx};
|
||||
pub use reth_primitives_traits::{
|
||||
Block, BlockBody, FullBlock, FullNodePrimitives, FullReceipt, FullSignedTx, NodePrimitives,
|
||||
};
|
||||
|
||||
use core::{fmt, marker::PhantomData};
|
||||
use core::marker::PhantomData;
|
||||
|
||||
use reth_chainspec::EthChainSpec;
|
||||
use reth_db_api::{
|
||||
@ -21,41 +23,6 @@ use reth_db_api::{
|
||||
use reth_engine_primitives::EngineTypes;
|
||||
use reth_trie_db::StateCommitment;
|
||||
|
||||
/// Configures all the primitive types of the node.
|
||||
pub trait NodePrimitives: Send + Sync + Unpin + Clone + Default + fmt::Debug {
|
||||
/// Block primitive.
|
||||
type Block: Send + Sync + Unpin + Clone + Default + fmt::Debug + 'static;
|
||||
/// Signed version of the transaction type.
|
||||
type SignedTx: Send + Sync + Unpin + Clone + Default + fmt::Debug + 'static;
|
||||
/// A receipt.
|
||||
type Receipt: Send + Sync + Unpin + Clone + Default + fmt::Debug + 'static;
|
||||
}
|
||||
|
||||
impl NodePrimitives for () {
|
||||
type Block = ();
|
||||
type SignedTx = ();
|
||||
type Receipt = ();
|
||||
}
|
||||
|
||||
/// Helper trait that sets trait bounds on [`NodePrimitives`].
|
||||
pub trait FullNodePrimitives: Send + Sync + Unpin + Clone + Default + fmt::Debug {
|
||||
/// Block primitive.
|
||||
type Block: FullBlock<Body: BlockBody<SignedTransaction = Self::SignedTx>>;
|
||||
/// Signed version of the transaction type.
|
||||
type SignedTx: FullSignedTx;
|
||||
/// A receipt.
|
||||
type Receipt: FullReceipt;
|
||||
}
|
||||
|
||||
impl<T> NodePrimitives for T
|
||||
where
|
||||
T: FullNodePrimitives<Block: 'static, SignedTx: 'static, Receipt: 'static>,
|
||||
{
|
||||
type Block = T::Block;
|
||||
type SignedTx = T::SignedTx;
|
||||
type Receipt = T::Receipt;
|
||||
}
|
||||
|
||||
/// The type that configures the essential types of an Ethereum-like node.
|
||||
///
|
||||
/// This includes the primitive types of a node and chain specification.
|
||||
|
||||
Reference in New Issue
Block a user