Creates a new local instance of the builder node with the given builder configuration, with a given Reth node configuration. This method does not prefund any accounts, so before sending any transactions make sure that sender accounts are funded.
(
builder_config: BuilderConfig,
node_config: NodeConfig<BaseChainSpec>,
)
| 117 | /// This method does not prefund any accounts, so before sending any transactions |
| 118 | /// make sure that sender accounts are funded. |
| 119 | pub async fn new_with_node_config( |
| 120 | builder_config: BuilderConfig, |
| 121 | node_config: NodeConfig<BaseChainSpec>, |
| 122 | ) -> eyre::Result<Self> { |
| 123 | clear_otel_env_vars(); |
| 124 | init_silenced_tracing(); |
| 125 | let runtime = RuntimeBuilder::new(RuntimeConfig::default()).build()?; |
| 126 | let base_node = BaseNode::new(RollupArgs::default()); |
| 127 | |
| 128 | let (rpc_ready_tx, rpc_ready_rx) = oneshot::channel::<()>(); |
| 129 | let (txpool_ready_tx, txpool_ready_rx) = |
| 130 | oneshot::channel::<AllTransactionsEvents<BasePooledTransaction>>(); |
| 131 | let (pool_handle_tx, pool_handle_rx) = |
| 132 | oneshot::channel::<Arc<dyn ExternalTransactionPool>>(); |
| 133 | |
| 134 | let da_config = builder_config.da_config.clone(); |
| 135 | let gas_limit_config = builder_config.gas_limit_config.clone(); |
| 136 | let metering_provider = Arc::clone(&builder_config.metering_provider); |
| 137 | |
| 138 | let addons: base_node_runner::BaseAddOns< |
| 139 | _, |
| 140 | BaseEthApiBuilder, |
| 141 | BasePayloadValidatorBuilder, |
| 142 | > = base_node |
| 143 | .add_ons_builder() |
| 144 | .with_da_config(da_config.clone()) |
| 145 | .with_gas_limit_config(gas_limit_config.clone()) |
| 146 | .build(); |
| 147 | |
| 148 | let node_builder = NodeBuilder::<_, BaseChainSpec>::new(node_config.clone()) |
| 149 | .with_database(create_test_db(node_config.clone())) |
| 150 | .with_launch_context(runtime.clone()) |
| 151 | .with_types::<BaseNode>() |
| 152 | .with_components( |
| 153 | base_node |
| 154 | .components() |
| 155 | .pool(pool_component()) |
| 156 | .payload(FlashblocksServiceBuilder(builder_config.clone())), |
| 157 | ) |
| 158 | .with_add_ons(addons) |
| 159 | .on_rpc_started(move |_, _| { |
| 160 | let _ = rpc_ready_tx.send(()); |
| 161 | Ok(()) |
| 162 | }) |
| 163 | .on_node_started(move |ctx| { |
| 164 | txpool_ready_tx |
| 165 | .send(ctx.pool.all_transactions_event_listener()) |
| 166 | .expect("Failed to send txpool ready signal"); |
| 167 | |
| 168 | let pool_handle: Arc<dyn ExternalTransactionPool> = |
| 169 | Arc::new(PoolHandle { pool: ctx.pool }); |
| 170 | pool_handle_tx.send(pool_handle).expect("Failed to send pool handle"); |
| 171 | |
| 172 | Ok(()) |
| 173 | }); |
| 174 | |
| 175 | let node_handle = node_builder.launch().await?; |
| 176 | let exit_future = node_handle.node_exit_future; |
nothing calls this directly
no test coverage detected