From d8edf9c80ec2a339486c8b678642c90a59756a12 Mon Sep 17 00:00:00 2001 From: Emilia Hane Date: Wed, 6 Nov 2024 14:20:51 +0100 Subject: [PATCH] chore(sdk): define `FullBlock` trait (#12326) --- crates/primitives-traits/src/block/mod.rs | 9 +++++---- crates/primitives-traits/src/lib.rs | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/primitives-traits/src/block/mod.rs b/crates/primitives-traits/src/block/mod.rs index 395cf61df145..519987606eee 100644 --- a/crates/primitives-traits/src/block/mod.rs +++ b/crates/primitives-traits/src/block/mod.rs @@ -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 + Compact {} -impl Header for T where T: BlockHeader + Sealable {} +impl FullBlock for T where T: Block + Compact {} /// Abstraction of block data type. // todo: make sealable super-trait, depends on @@ -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; diff --git a/crates/primitives-traits/src/lib.rs b/crates/primitives-traits/src/lib.rs index 90a6935ae10b..02f1664d7997 100644 --- a/crates/primitives-traits/src/lib.rs +++ b/crates/primitives-traits/src/lib.rs @@ -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;