Skip to content

Commit

Permalink
let task_executor = builder.task_executor().clone();
Browse files Browse the repository at this point in the history
  • Loading branch information
CeciliaZ030 committed Dec 15, 2024
1 parent 9460d5d commit 2e03125
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
11 changes: 5 additions & 6 deletions crates/gwyneth-rbuilder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,8 @@ fn main() -> eyre::Result<()> {

if let Err(err) = Cli::<GwynethArgs>::parse().run(|builder, arg| async move {
let l1_node_config = builder.config().clone();
let gwyneth_nodes = create_gwyneth_nodes(
&arg,
builder.task_executor().clone(),
&l1_node_config
).await;
let task_executor = builder.task_executor().clone();
let gwyneth_nodes = create_gwyneth_nodes(&arg, task_executor.clone(), &l1_node_config).await;

let enable_engine2 = arg.experimental;
match enable_engine2 {
Expand Down Expand Up @@ -70,7 +67,7 @@ fn main() -> eyre::Result<()> {
})
.launch_with_fn(|builder| {
let launcher = EngineNodeLauncher::new(
builder.task_executor().clone(),
task_executor,
builder.config().datadir(),
);
builder.launch_with(launcher)
Expand Down Expand Up @@ -133,6 +130,8 @@ where
let mut config: Config = load_config_toml_and_env(
arg.rbuilder_config.clone().expect("Gwyneth-rbuilder needs config path")
)?;
// Where we set L1 rpc, proposer pk and rollup contract address
config.l1_config.update_in_process_setting(&l1_node_config);
config.base_config.update_in_process_setting(arg, l1_node_config);

// TODO: Check removing this is OK. It seems reth already sets up the global tracing
Expand Down
1 change: 0 additions & 1 deletion crates/rbuilder/src/live_builder/base_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ impl BaseConfig {
if self.l2_ipc_paths.is_none() {
eyre::bail!("IPC should be provided with config or in-process GwynethArgs");
}
// TODO(Cecilia): get this from exex
let layer2_info = tokio::runtime::Handle::current().block_on(Layer2Info::<P>::new(
l2_providers,
&self.l2_ipc_paths.clone().unwrap(),
Expand Down
17 changes: 15 additions & 2 deletions crates/rbuilder/src/live_builder/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use ethereum_consensus::{
state_transition::Context as ContextEth,
};
use eyre::Context;
use reth::tasks::pool::BlockingTaskPool;
use reth::{builder::NodeConfig, tasks::pool::BlockingTaskPool};
use reth_chainspec::{Chain, ChainSpec, NamedChain};
use reth_db::{Database, DatabaseEnv};
use reth_payload_builder::database::SyncCachedReads as CachedReads;
Expand All @@ -61,7 +61,7 @@ use reth_provider::{
};
use serde::Deserialize;
use serde_with::{serde_as, OneOrMany};
use std::fmt::Debug;
use std::{fmt::Debug, net::SocketAddr};
use std::{
path::{Path, PathBuf},
str::FromStr,
Expand Down Expand Up @@ -158,6 +158,19 @@ impl Default for L1Config {
}

impl L1Config {

pub fn update_in_process_setting(
&mut self,
l1_node_config: &NodeConfig,
) {
assert!(!self.relays.is_empty(), "Must contains at least one relay for L1 proposing");
let relay_proposer = self.relays.get_mut(0).unwrap();

assert!(relay_proposer.l1_proposer_pk.is_some(), "L1 proposer private key should be set");
assert!(relay_proposer.l1_rollup_contract.is_some(), "L1 rollup contract should be set");
relay_proposer.l1_rpc_url = Some(SocketAddr::new(l1_node_config.rpc.http_addr, l1_node_config.rpc.http_port).to_string());
}

pub fn resolve_cl_node_urls(&self) -> eyre::Result<Vec<String>> {
crate::live_builder::base_config::resolve_env_or_values::<String>(&self.cl_node_url)
}
Expand Down
4 changes: 2 additions & 2 deletions crates/rbuilder/src/primitives/mev_boost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub struct RelayConfig {
#[serde(default, deserialize_with = "deserialize_env_var")]
pub l1_rpc_url: Option<String>,
pub l1_proposer_pk: Option<String>,
pub l1_smart_contract_address: Option<String>,
pub l1_rollup_contract: Option<String>,
}

impl RelayConfig {
Expand Down Expand Up @@ -93,7 +93,7 @@ impl MevBoostRelay {
let block_proposer =
if let (Some(l1_rpc_url), Some(l1_smart_contract_address), Some(l1_proposer_pk)) = (
&config.l1_rpc_url,
&config.l1_smart_contract_address,
&config.l1_rollup_contract,
&config.l1_proposer_pk,
) {
Some(BlockProposer::new(
Expand Down

0 comments on commit 2e03125

Please sign in to comment.