Skip to content

Commit

Permalink
chore(sdk): define FullBlock trait (#12326)
Browse files Browse the repository at this point in the history
  • Loading branch information
emhane authored Nov 6, 2024
1 parent 098fa7f commit d8edf9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions crates/primitives-traits/src/block/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ use alloc::{fmt, vec::Vec};

use alloy_consensus::BlockHeader;
use alloy_primitives::{Address, Sealable, B256};
use reth_codecs::Compact;

use crate::BlockBody;

/// Helper trait, unifies behaviour required of a block header.
pub trait Header: BlockHeader + Sealable {}
/// Helper trait that unifies all behaviour required by block to support full node operations.
pub trait FullBlock: Block<Header: Compact> + Compact {}

impl<T> Header for T where T: BlockHeader + Sealable {}
impl<T> FullBlock for T where T: Block<Header: Compact> + Compact {}

/// Abstraction of block data type.
// todo: make sealable super-trait, depends on <https://github.com/paradigmxyz/reth/issues/11449>
Expand All @@ -30,7 +31,7 @@ pub trait Block:
+ Into<(Self::Header, Self::Body)>
{
/// Header part of the block.
type Header: Header;
type Header: BlockHeader + Sealable;

/// The block's body contains the transactions in the block.
type Body: BlockBody;
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives-traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ mod integer_list;
pub use integer_list::{IntegerList, IntegerListError};

pub mod block;
pub use block::{body::BlockBody, Block};
pub use block::{body::BlockBody, Block, FullBlock};

mod withdrawal;
pub use withdrawal::Withdrawals;
Expand Down

0 comments on commit d8edf9c

Please sign in to comment.