mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(sdk): make Chain generic over data primitives (#12635)
This commit is contained in:
@ -3,15 +3,44 @@ use core::fmt;
|
||||
use crate::{BlockBody, FullBlock, FullReceipt, FullSignedTx, FullTxType, MaybeSerde};
|
||||
|
||||
/// Configures all the primitive types of the node.
|
||||
pub trait NodePrimitives: Send + Sync + Unpin + Clone + Default + fmt::Debug + 'static {
|
||||
pub trait NodePrimitives:
|
||||
Send + Sync + Unpin + Clone + Default + fmt::Debug + PartialEq + Eq + 'static
|
||||
{
|
||||
/// Block primitive.
|
||||
type Block: Send + Sync + Unpin + Clone + Default + fmt::Debug + MaybeSerde + 'static;
|
||||
type Block: Send
|
||||
+ Sync
|
||||
+ Unpin
|
||||
+ Clone
|
||||
+ Default
|
||||
+ fmt::Debug
|
||||
+ PartialEq
|
||||
+ Eq
|
||||
+ MaybeSerde
|
||||
+ 'static;
|
||||
/// Signed version of the transaction type.
|
||||
type SignedTx: Send + Sync + Unpin + Clone + Default + fmt::Debug + MaybeSerde + 'static;
|
||||
type SignedTx: Send
|
||||
+ Sync
|
||||
+ Unpin
|
||||
+ Clone
|
||||
+ Default
|
||||
+ fmt::Debug
|
||||
+ PartialEq
|
||||
+ Eq
|
||||
+ MaybeSerde
|
||||
+ 'static;
|
||||
/// Transaction envelope type ID.
|
||||
type TxType: Send + Sync + Unpin + Clone + Default + fmt::Debug + 'static;
|
||||
type TxType: Send + Sync + Unpin + Clone + Default + fmt::Debug + PartialEq + Eq + 'static;
|
||||
/// A receipt.
|
||||
type Receipt: Send + Sync + Unpin + Clone + Default + fmt::Debug + MaybeSerde + 'static;
|
||||
type Receipt: Send
|
||||
+ Sync
|
||||
+ Unpin
|
||||
+ Clone
|
||||
+ Default
|
||||
+ fmt::Debug
|
||||
+ PartialEq
|
||||
+ Eq
|
||||
+ MaybeSerde
|
||||
+ 'static;
|
||||
}
|
||||
|
||||
impl NodePrimitives for () {
|
||||
@ -22,7 +51,9 @@ impl NodePrimitives for () {
|
||||
}
|
||||
|
||||
/// Helper trait that sets trait bounds on [`NodePrimitives`].
|
||||
pub trait FullNodePrimitives: Send + Sync + Unpin + Clone + Default + fmt::Debug + 'static {
|
||||
pub trait FullNodePrimitives:
|
||||
Send + Sync + Unpin + Clone + Default + fmt::Debug + PartialEq + Eq + 'static
|
||||
{
|
||||
/// Block primitive.
|
||||
type Block: FullBlock<Body: BlockBody<Transaction = Self::SignedTx>>;
|
||||
/// Signed version of the transaction type.
|
||||
|
||||
Reference in New Issue
Block a user