mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
Propagating OpDAConfig to OpPayloadBuilder (#13375)
This commit is contained in:
@ -32,10 +32,12 @@ fn main() {
|
||||
let engine_tree_config = TreeConfig::default()
|
||||
.with_persistence_threshold(rollup_args.persistence_threshold)
|
||||
.with_memory_block_buffer_target(rollup_args.memory_block_buffer_target);
|
||||
|
||||
let op_node = OpNode::new(rollup_args.clone());
|
||||
let handle = builder
|
||||
.with_types_and_provider::<OpNode, BlockchainProvider2<_>>()
|
||||
.with_components(OpNode::components(rollup_args.clone()))
|
||||
.with_add_ons(OpNode::new(rollup_args).add_ons())
|
||||
.with_components(op_node.components())
|
||||
.with_add_ons(op_node.add_ons())
|
||||
.launch_with_fn(|builder| {
|
||||
let launcher = EngineNodeLauncher::new(
|
||||
builder.task_executor().clone(),
|
||||
|
||||
@ -25,7 +25,10 @@ use reth_node_builder::{
|
||||
use reth_optimism_chainspec::OpChainSpec;
|
||||
use reth_optimism_consensus::OpBeaconConsensus;
|
||||
use reth_optimism_evm::{OpEvmConfig, OpExecutionStrategyFactory};
|
||||
use reth_optimism_payload_builder::{builder::OpPayloadTransactions, config::OpDAConfig};
|
||||
use reth_optimism_payload_builder::{
|
||||
builder::OpPayloadTransactions,
|
||||
config::{OpBuilderConfig, OpDAConfig},
|
||||
};
|
||||
use reth_optimism_primitives::OpPrimitives;
|
||||
use reth_optimism_rpc::{
|
||||
miner::{MinerApiExtServer, OpMinerExtApi},
|
||||
@ -136,7 +139,7 @@ impl OpNode {
|
||||
|
||||
/// Returns the components for the given [`RollupArgs`].
|
||||
pub fn components<Node>(
|
||||
args: RollupArgs,
|
||||
&self,
|
||||
) -> ComponentsBuilder<
|
||||
Node,
|
||||
OpPoolBuilder,
|
||||
@ -154,11 +157,14 @@ impl OpNode {
|
||||
>,
|
||||
>,
|
||||
{
|
||||
let RollupArgs { disable_txpool_gossip, compute_pending_block, discovery_v4, .. } = args;
|
||||
let RollupArgs { disable_txpool_gossip, compute_pending_block, discovery_v4, .. } =
|
||||
self.args;
|
||||
ComponentsBuilder::default()
|
||||
.node_types::<Node>()
|
||||
.pool(OpPoolBuilder::default())
|
||||
.payload(OpPayloadBuilder::new(compute_pending_block))
|
||||
.payload(
|
||||
OpPayloadBuilder::new(compute_pending_block).with_da_config(self.da_config.clone()),
|
||||
)
|
||||
.network(OpNetworkBuilder {
|
||||
disable_txpool_gossip,
|
||||
disable_discovery_v4: !discovery_v4,
|
||||
@ -192,7 +198,7 @@ where
|
||||
OpAddOns<NodeAdapter<N, <Self::ComponentsBuilder as NodeComponentsBuilder<N>>::Components>>;
|
||||
|
||||
fn components_builder(&self) -> Self::ComponentsBuilder {
|
||||
Self::components(self.args.clone())
|
||||
Self::components(self)
|
||||
}
|
||||
|
||||
fn add_ons(&self) -> Self::AddOns {
|
||||
@ -494,12 +500,22 @@ pub struct OpPayloadBuilder<Txs = ()> {
|
||||
/// The type responsible for yielding the best transactions for the payload if mempool
|
||||
/// transactions are allowed.
|
||||
pub best_transactions: Txs,
|
||||
/// This data availability configuration specifies constraints for the payload builder
|
||||
/// when assembling payloads
|
||||
pub da_config: OpDAConfig,
|
||||
}
|
||||
|
||||
impl OpPayloadBuilder {
|
||||
/// Create a new instance with the given `compute_pending_block` flag.
|
||||
pub const fn new(compute_pending_block: bool) -> Self {
|
||||
Self { compute_pending_block, best_transactions: () }
|
||||
/// Create a new instance with the given `compute_pending_block` flag and data availability
|
||||
/// config.
|
||||
pub fn new(compute_pending_block: bool) -> Self {
|
||||
Self { compute_pending_block, best_transactions: (), da_config: OpDAConfig::default() }
|
||||
}
|
||||
|
||||
/// Configure the data availability configuration for the OP payload builder.
|
||||
pub fn with_da_config(mut self, da_config: OpDAConfig) -> Self {
|
||||
self.da_config = da_config;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
@ -513,8 +529,8 @@ where
|
||||
self,
|
||||
best_transactions: T,
|
||||
) -> OpPayloadBuilder<T> {
|
||||
let Self { compute_pending_block, .. } = self;
|
||||
OpPayloadBuilder { compute_pending_block, best_transactions }
|
||||
let Self { compute_pending_block, da_config, .. } = self;
|
||||
OpPayloadBuilder { compute_pending_block, best_transactions, da_config }
|
||||
}
|
||||
|
||||
/// A helper method to initialize [`PayloadBuilderService`] with the given EVM config.
|
||||
@ -537,7 +553,10 @@ where
|
||||
+ 'static,
|
||||
Evm: ConfigureEvm<Header = Header, Transaction = TransactionSigned>,
|
||||
{
|
||||
let payload_builder = reth_optimism_payload_builder::OpPayloadBuilder::new(evm_config)
|
||||
let payload_builder = reth_optimism_payload_builder::OpPayloadBuilder::with_builder_config(
|
||||
evm_config,
|
||||
OpBuilderConfig { da_config: self.da_config },
|
||||
)
|
||||
.with_transactions(self.best_transactions)
|
||||
.set_compute_pending_block(self.compute_pending_block);
|
||||
let conf = ctx.payload_builder_config();
|
||||
|
||||
@ -12,11 +12,12 @@ fn test_basic_setup() {
|
||||
let config = NodeConfig::new(BASE_MAINNET.clone());
|
||||
let db = create_test_rw_db();
|
||||
let args = RollupArgs::default();
|
||||
let op_node = OpNode::new(args);
|
||||
let _builder = NodeBuilder::new(config)
|
||||
.with_database(db)
|
||||
.with_types::<OpNode>()
|
||||
.with_components(OpNode::components(args.clone()))
|
||||
.with_add_ons(OpNode::new(args).add_ons())
|
||||
.with_components(op_node.components())
|
||||
.with_add_ons(op_node.add_ons())
|
||||
.on_component_initialized(move |ctx| {
|
||||
let _provider = ctx.provider();
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user