feat: local engine (#10803)

This commit is contained in:
greged93
2024-09-19 15:07:15 +02:00
committed by GitHub
parent 89ca7a9ef1
commit 668807802b
11 changed files with 478 additions and 23 deletions

View File

@ -20,6 +20,7 @@ reth-errors.workspace = true
reth-provider.workspace = true
reth-payload-primitives.workspace = true
reth-ethereum-engine-primitives.workspace = true
reth-chain-state = { workspace = true, optional = true }
# alloy
alloy-primitives.workspace = true
@ -42,4 +43,4 @@ tracing.workspace = true
revm.workspace = true
[features]
test-utils = []
test-utils = ["reth-chain-state"]

View File

@ -6,6 +6,7 @@ use crate::{
PayloadJobGenerator,
};
use alloy_primitives::U256;
use reth_chain_state::ExecutedBlock;
use reth_payload_primitives::PayloadTypes;
use reth_primitives::Block;
use reth_provider::CanonStateNotification;
@ -87,7 +88,7 @@ impl PayloadJob for TestPayloadJob {
self.attr.payload_id(),
Block::default().seal_slow(),
U256::ZERO,
None,
Some(ExecutedBlock::default()),
))
}

View File

@ -15,7 +15,9 @@ pub use error::{EngineObjectValidationError, PayloadBuilderError, VersionSpecifi
/// Contains traits to abstract over payload attributes types and default implementations of the
/// [`PayloadAttributes`] trait for ethereum mainnet and optimism types.
mod traits;
pub use traits::{BuiltPayload, PayloadAttributes, PayloadBuilderAttributes};
pub use traits::{
BuiltPayload, PayloadAttributes, PayloadAttributesBuilder, PayloadBuilderAttributes,
};
mod payload;
pub use payload::PayloadOrAttributes;

View File

@ -145,3 +145,14 @@ impl PayloadAttributes for OptimismPayloadAttributes {
Ok(())
}
}
/// A builder that can return the current payload attribute.
pub trait PayloadAttributesBuilder: std::fmt::Debug + Send + Sync + 'static {
/// The payload attributes type returned by the builder.
type PayloadAttributes: PayloadAttributes;
/// The error type returned by [`PayloadAttributesBuilder::build`].
type Error: std::error::Error + Send + Sync;
/// Return a new payload attribute from the builder.
fn build(&self) -> Result<Self::PayloadAttributes, Self::Error>;
}