Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New flag disable_relay_submit #236

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config-live-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jsonrpc_server_ip = "0.0.0.0"
el_node_ipc_path = "/tmp/reth.ipc"
extra_data = "βš‘πŸ€–"

disable_relay_submit = false

blocklist_file_path = "./blocklist.json"

dry_run = true
Expand Down
1 change: 1 addition & 0 deletions crates/rbuilder/src/live_builder/block_output/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ pub mod bid_observer;
pub mod bid_value_source;
pub mod bidding;
pub mod block_sealing_bidder_factory;
pub mod null_builder_sink_factory;
pub mod relay_submit;
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//! Null implementation for BuilderSinkFactory. It just throws away the bids.
//! Useful for testing.

use crate::building::builders::Block;
use reth_primitives::format_ether;
use tracing::info;

use super::relay_submit::{BlockBuildingSink, BuilderSinkFactory};

#[derive(Debug)]
pub struct NullBuilderSinkFactory {}

impl BuilderSinkFactory for NullBuilderSinkFactory {
fn create_builder_sink(
&self,
_slot_data: crate::live_builder::payload_events::MevBoostSlotData,
_competition_bid_value_source: std::sync::Arc<
dyn super::bid_value_source::interfaces::BidValueSource + Send + Sync,
>,
_cancel: tokio_util::sync::CancellationToken,
) -> Box<dyn super::relay_submit::BlockBuildingSink> {
Box::new(NullBuilderSink {})
}
}

#[derive(Debug)]
struct NullBuilderSink {}

impl BlockBuildingSink for NullBuilderSink {
fn new_block(&self, block: Block) {
info!(
true_bid_value = format_ether(block.trace.true_bid_value),
buidler_name = block.builder_name,
fill_time_ms = block.trace.fill_time.as_millis(),
finalize_time_ms = block.trace.finalize_time.as_millis(),
"NullBuilderSink received new block"
);
}
}
27 changes: 21 additions & 6 deletions crates/rbuilder/src/live_builder/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ use crate::{
Sorting,
},
live_builder::{
base_config::EnvOrValue, block_output::relay_submit::BuilderSinkFactory,
cli::LiveBuilderConfig, payload_events::MevBoostSlotDataGenerator,
base_config::EnvOrValue,
block_output::{
null_builder_sink_factory::NullBuilderSinkFactory, relay_submit::BuilderSinkFactory,
},
cli::LiveBuilderConfig,
payload_events::MevBoostSlotDataGenerator,
},
mev_boost::BLSBlockSigner,
primitives::mev_boost::{MevBoostRelay, RelayConfig},
Expand Down Expand Up @@ -131,6 +135,12 @@ pub struct L1Config {

/// Genesis fork version for the chain. If not provided it will be fetched from the beacon client.
pub genesis_fork_version: Option<String>,

/// @Pending: mix this with dry_run?
/// If disable_relay_submit the the whole final submition state is dropped.
/// This way we can test knowing no bid is going to the relay and there is no need to configure dry_run_validation_url.
/// Notice that at relays are still needed to get the final fee recipient for PBS.
pub disable_relay_submit: bool,
}

impl Default for L1Config {
Expand All @@ -147,6 +157,7 @@ impl Default for L1Config {
cl_node_url: vec![EnvOrValue::from("http://127.0.0.1:3500")],
max_concurrent_seals: DEFAULT_MAX_CONCURRENT_SEALS,
genesis_fork_version: None,
disable_relay_submit: false,
}
}
}
Expand Down Expand Up @@ -276,10 +287,14 @@ impl L1Config {
);

let relays = self.create_relays()?;
let sink_factory: Box<dyn BuilderSinkFactory> = Box::new(RelaySubmitSinkFactory::new(
submission_config,
relays.clone(),
));
let sink_factory: Box<dyn BuilderSinkFactory> = if self.disable_relay_submit {
Box::new(NullBuilderSinkFactory {})
} else {
Box::new(RelaySubmitSinkFactory::new(
submission_config,
relays.clone(),
))
};
Ok((sink_factory, relays))
}
}
Expand Down
Loading