Skip to content

Commit

Permalink
chore(sdk): auto trait bounds NodePrimitives (#12398)
Browse files Browse the repository at this point in the history
  • Loading branch information
emhane authored Nov 10, 2024
1 parent c1b4fd8 commit 23ec0af
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crates/ethereum/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use reth_trie_db::MerklePatriciaTrie;
use crate::{EthEngineTypes, EthEvmConfig};

/// Ethereum primitive types.
#[derive(Debug)]
#[derive(Debug, Default, Clone)]
pub struct EthPrimitives;

impl NodePrimitives for EthPrimitives {
Expand Down
15 changes: 9 additions & 6 deletions crates/node/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,27 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub use reth_primitives_traits::{Block, BlockBody};

use core::fmt;
use std::marker::PhantomData;

use reth_chainspec::EthChainSpec;
use reth_db_api::{
database_metrics::{DatabaseMetadata, DatabaseMetrics},
Database,
};
use reth_engine_primitives::EngineTypes;
pub use reth_primitives_traits::{Block, BlockBody};
use reth_trie_db::StateCommitment;
use std::marker::PhantomData;

/// Configures all the primitive types of the node.
pub trait NodePrimitives {
pub trait NodePrimitives: Send + Sync + Unpin + Clone + Default + fmt::Debug {
/// Block primitive.
type Block;
type Block: Send + Sync + Unpin + Clone + Default + fmt::Debug + 'static;
/// Signed version of the transaction type.
type SignedTx;
type SignedTx: Send + Sync + Unpin + Clone + Default + fmt::Debug + 'static;
/// A receipt.
type Receipt;
type Receipt: Send + Sync + Unpin + Clone + Default + fmt::Debug + 'static;
}

impl NodePrimitives for () {
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use crate::{
};

/// Optimism primitive types.
#[derive(Debug)]
#[derive(Debug, Default, Clone)]
pub struct OpPrimitives;

impl NodePrimitives for OpPrimitives {
Expand Down

0 comments on commit 23ec0af

Please sign in to comment.