diff --git a/crates/evm/execution-types/src/chain.rs b/crates/evm/execution-types/src/chain.rs index 4df08987dda7..929ac1c5c0dd 100644 --- a/crates/evm/execution-types/src/chain.rs +++ b/crates/evm/execution-types/src/chain.rs @@ -539,6 +539,7 @@ pub(super) mod serde_bincode_compat { use reth_primitives::{ serde_bincode_compat::SealedBlockWithSenders, EthPrimitives, NodePrimitives, }; + use reth_primitives_traits::{serde_bincode_compat::SerdeBincodeCompat, Block}; use reth_trie_common::serde_bincode_compat::updates::TrieUpdates; use serde::{ser::SerializeMap, Deserialize, Deserializer, Serialize, Serializer}; use serde_with::{DeserializeAs, SerializeAs}; @@ -576,7 +577,7 @@ pub(super) mod serde_bincode_compat { impl Serialize for SealedBlocksWithSenders<'_, B> where - B: reth_primitives_traits::Block, + B: Block, { fn serialize(&self, serializer: S) -> Result where @@ -594,7 +595,7 @@ pub(super) mod serde_bincode_compat { impl<'de, B> Deserialize<'de> for SealedBlocksWithSenders<'_, B> where - B: reth_primitives_traits::Block, + B: Block, { fn deserialize(deserializer: D) -> Result where diff --git a/crates/primitives-traits/src/block/body.rs b/crates/primitives-traits/src/block/body.rs index eecf3ee79dee..4546e855427b 100644 --- a/crates/primitives-traits/src/block/body.rs +++ b/crates/primitives-traits/src/block/body.rs @@ -9,9 +9,9 @@ use alloy_eips::{eip2718::Encodable2718, eip4895::Withdrawals}; use alloy_primitives::{Bytes, B256}; /// Helper trait that unifies all behaviour required by transaction to support full node operations. -pub trait FullBlockBody: BlockBody {} +pub trait FullBlockBody: BlockBody + MaybeSerdeBincodeCompat {} -impl FullBlockBody for T where T: BlockBody {} +impl FullBlockBody for T where T: BlockBody + MaybeSerdeBincodeCompat {} /// Abstraction for block's body. pub trait BlockBody: @@ -27,7 +27,6 @@ pub trait BlockBody: + alloy_rlp::Decodable + InMemorySize + MaybeSerde - + MaybeSerdeBincodeCompat + 'static { /// Ordered list of signed transactions as committed in block. diff --git a/crates/primitives-traits/src/node.rs b/crates/primitives-traits/src/node.rs index 0d46141da0c6..3f6786c8f94c 100644 --- a/crates/primitives-traits/src/node.rs +++ b/crates/primitives-traits/src/node.rs @@ -1,7 +1,4 @@ -use crate::{ - Block, BlockBody, BlockHeader, FullBlock, FullBlockBody, FullBlockHeader, FullReceipt, - FullSignedTx, Receipt, SignedTransaction, -}; +use crate::{Block, FullBlock, FullBlockBody, FullBlockHeader, FullReceipt, FullSignedTx, Receipt}; use core::fmt; /// Configures all the primitive types of the node. @@ -11,11 +8,11 @@ pub trait NodePrimitives: /// Block primitive. type Block: Block
; /// Block header primitive. - type BlockHeader: BlockHeader; + type BlockHeader: FullBlockHeader; /// Block body primitive. - type BlockBody: BlockBody; + type BlockBody: FullBlockBody; /// Signed version of the transaction type. - type SignedTx: SignedTransaction + 'static; + type SignedTx: FullSignedTx; /// A receipt. type Receipt: Receipt; } diff --git a/crates/primitives/src/block.rs b/crates/primitives/src/block.rs index c17cb6186919..8691cfa101bf 100644 --- a/crates/primitives/src/block.rs +++ b/crates/primitives/src/block.rs @@ -655,7 +655,7 @@ impl InMemorySize for BlockBody { impl reth_primitives_traits::BlockBody for BlockBody where - T: SignedTransaction + MaybeSerdeBincodeCompat, + T: SignedTransaction, { type Transaction = T; type OmmerHeader = Header; @@ -715,7 +715,10 @@ pub(super) mod serde_bincode_compat { use alloy_consensus::serde_bincode_compat::Header; use alloy_eips::eip4895::Withdrawals; use alloy_primitives::Address; - use reth_primitives_traits::serde_bincode_compat::{SealedHeader, SerdeBincodeCompat}; + use reth_primitives_traits::{ + serde_bincode_compat::{SealedHeader, SerdeBincodeCompat}, + Block, + }; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde_with::{DeserializeAs, SerializeAs}; @@ -868,7 +871,7 @@ pub(super) mod serde_bincode_compat { #[derive(Debug, Serialize, Deserialize)] pub struct SealedBlockWithSenders<'a, B = super::Block> where - B: reth_primitives_traits::Block, + B: Block, { block: SealedBlock<'a, B::Header, B::Body>, senders: Cow<'a, Vec
>, @@ -876,7 +879,7 @@ pub(super) mod serde_bincode_compat { impl<'a, B> From<&'a super::SealedBlockWithSenders> for SealedBlockWithSenders<'a, B> where - B: reth_primitives_traits::Block, + B: Block, { fn from(value: &'a super::SealedBlockWithSenders) -> Self { Self { block: SealedBlock::from(&value.block), senders: Cow::Borrowed(&value.senders) } @@ -885,7 +888,7 @@ pub(super) mod serde_bincode_compat { impl<'a, B> From> for super::SealedBlockWithSenders where - B: reth_primitives_traits::Block, + B: Block, { fn from(value: SealedBlockWithSenders<'a, B>) -> Self { Self { block: value.block.into(), senders: value.senders.into_owned() }