mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add SealedBlock in reth-primitives-traits (#13735)
This commit is contained in:
@ -7,7 +7,7 @@ use alloy_eips::eip4895::Withdrawals;
|
||||
use alloy_primitives::{Address, B256, U256};
|
||||
use reth_payload_builder::PayloadId;
|
||||
use reth_payload_primitives::BuiltPayload;
|
||||
use reth_primitives::{NodePrimitives, SealedBlockFor};
|
||||
use reth_primitives::{NodePrimitives, SealedBlock};
|
||||
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use std::{error::Error, fmt};
|
||||
@ -155,7 +155,7 @@ where
|
||||
{
|
||||
type Primitives = L::Primitives;
|
||||
|
||||
fn block(&self) -> &SealedBlockFor<<L::Primitives as NodePrimitives>::Block> {
|
||||
fn block(&self) -> &SealedBlock<<L::Primitives as NodePrimitives>::Block> {
|
||||
match self {
|
||||
Self::Left(l) => l.block(),
|
||||
Self::Right(r) => r.block(),
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
//! use alloy_consensus::Header;
|
||||
//! use alloy_primitives::U256;
|
||||
//! use reth_payload_builder::{EthBuiltPayload, PayloadBuilderError, KeepPayloadJobAlive, EthPayloadBuilderAttributes, PayloadJob, PayloadJobGenerator, PayloadKind};
|
||||
//! use reth_primitives::{Block, BlockExt};
|
||||
//! use reth_primitives::{Block, SealedBlock};
|
||||
//!
|
||||
//! /// The generator type that creates new jobs that builds empty blocks.
|
||||
//! pub struct EmptyBlockPayloadJobGenerator;
|
||||
@ -67,7 +67,7 @@
|
||||
//! },
|
||||
//! ..Default::default()
|
||||
//! };
|
||||
//! let payload = EthBuiltPayload::new(self.attributes.id, Arc::new(block.seal_slow()), U256::ZERO, None, None);
|
||||
//! let payload = EthBuiltPayload::new(self.attributes.id, Arc::new(SealedBlock::seal_slow(block)), U256::ZERO, None, None);
|
||||
//! Ok(payload)
|
||||
//! }
|
||||
//!
|
||||
|
||||
@ -9,7 +9,8 @@ use alloy_primitives::U256;
|
||||
use reth_chain_state::{CanonStateNotification, ExecutedBlock};
|
||||
use reth_payload_builder_primitives::PayloadBuilderError;
|
||||
use reth_payload_primitives::{PayloadKind, PayloadTypes};
|
||||
use reth_primitives::{Block, BlockExt};
|
||||
use reth_primitives::Block;
|
||||
use reth_primitives_traits::Block as _;
|
||||
use std::{
|
||||
future::Future,
|
||||
pin::Pin,
|
||||
|
||||
@ -5,7 +5,7 @@ use alloy_eips::{
|
||||
use alloy_primitives::{Address, B256, U256};
|
||||
use alloy_rpc_types_engine::{PayloadAttributes as EthPayloadAttributes, PayloadId};
|
||||
use reth_chain_state::ExecutedBlock;
|
||||
use reth_primitives::{NodePrimitives, SealedBlockFor};
|
||||
use reth_primitives::{NodePrimitives, SealedBlock};
|
||||
|
||||
/// Represents a built payload type that contains a built `SealedBlock` and can be converted into
|
||||
/// engine API execution payloads.
|
||||
@ -14,7 +14,7 @@ pub trait BuiltPayload: Send + Sync + std::fmt::Debug {
|
||||
type Primitives: NodePrimitives;
|
||||
|
||||
/// Returns the built block (sealed)
|
||||
fn block(&self) -> &SealedBlockFor<<Self::Primitives as NodePrimitives>::Block>;
|
||||
fn block(&self) -> &SealedBlock<<Self::Primitives as NodePrimitives>::Block>;
|
||||
|
||||
/// Returns the fees collected for the built block
|
||||
fn fees(&self) -> U256;
|
||||
|
||||
@ -12,8 +12,8 @@ use alloy_rpc_types::engine::{
|
||||
ExecutionPayload, ExecutionPayloadSidecar, MaybeCancunPayloadFields, PayloadError,
|
||||
};
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_primitives::{BlockBody, BlockExt, Header, SealedBlock};
|
||||
use reth_primitives_traits::SignedTransaction;
|
||||
use reth_primitives::SealedBlock;
|
||||
use reth_primitives_traits::{Block, SignedTransaction};
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Execution payload validator.
|
||||
@ -59,9 +59,9 @@ impl<ChainSpec: EthereumHardforks> ExecutionPayloadValidator<ChainSpec> {
|
||||
///
|
||||
/// Ensures that the number of blob versioned hashes matches the number hashes included in the
|
||||
/// _separate_ `block_versioned_hashes` of the cancun payload fields.
|
||||
fn ensure_matching_blob_versioned_hashes<T: SignedTransaction>(
|
||||
fn ensure_matching_blob_versioned_hashes<B: Block>(
|
||||
&self,
|
||||
sealed_block: &SealedBlock<Header, BlockBody<T>>,
|
||||
sealed_block: &SealedBlock<B>,
|
||||
cancun_fields: &MaybeCancunPayloadFields,
|
||||
) -> Result<(), PayloadError> {
|
||||
let num_blob_versioned_hashes = sealed_block.blob_versioned_hashes_iter().count();
|
||||
@ -116,7 +116,7 @@ impl<ChainSpec: EthereumHardforks> ExecutionPayloadValidator<ChainSpec> {
|
||||
&self,
|
||||
payload: ExecutionPayload,
|
||||
sidecar: ExecutionPayloadSidecar,
|
||||
) -> Result<SealedBlock<Header, BlockBody<T>>, PayloadError> {
|
||||
) -> Result<SealedBlock<reth_primitives::Block<T>>, PayloadError> {
|
||||
let expected_hash = payload.block_hash();
|
||||
|
||||
// First parse the block
|
||||
|
||||
Reference in New Issue
Block a user