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

[Merged by Bors] - Fix Prefer Builder Flag #4622

Closed
wants to merge 1 commit into from
Closed
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: 0 additions & 2 deletions beacon_node/client/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ pub struct Config {
pub monitoring_api: Option<monitoring_api::Config>,
pub slasher: Option<slasher::Config>,
pub logger_config: LoggerConfig,
pub always_prefer_builder_payload: bool,
pub beacon_processor: BeaconProcessorConfig,
}

Expand Down Expand Up @@ -108,7 +107,6 @@ impl Default for Config {
validator_monitor_pubkeys: vec![],
validator_monitor_individual_tracking_threshold: DEFAULT_INDIVIDUAL_TRACKING_THRESHOLD,
logger_config: LoggerConfig::default(),
always_prefer_builder_payload: false,
beacon_processor: <_>::default(),
}
}
Expand Down
7 changes: 3 additions & 4 deletions beacon_node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ pub fn get_config<E: EthSpec>(
el_config.default_datadir = client_config.data_dir().clone();
el_config.builder_profit_threshold =
clap_utils::parse_required(cli_args, "builder-profit-threshold")?;
el_config.always_prefer_builder_payload =
cli_args.is_present("always-prefer-builder-payload");

let execution_timeout_multiplier =
clap_utils::parse_required(cli_args, "execution-timeout-multiplier")?;
el_config.execution_timeout_multiplier = Some(execution_timeout_multiplier);
Expand Down Expand Up @@ -798,10 +801,6 @@ pub fn get_config<E: EthSpec>(
if cli_args.is_present("genesis-backfill") {
client_config.chain.genesis_backfill = true;
}
// Payload selection configs
if cli_args.is_present("always-prefer-builder-payload") {
client_config.always_prefer_builder_payload = true;
}

// Backfill sync rate-limiting
client_config.beacon_processor.enable_backfill_rate_limiting =
Expand Down
47 changes: 32 additions & 15 deletions lighthouse/tests/beacon_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,21 +366,6 @@ fn genesis_backfill_with_historic_flag() {
.with_config(|config| assert_eq!(config.chain.genesis_backfill, true));
}

#[test]
fn always_prefer_builder_payload_flag() {
CommandLineTest::new()
.flag("always-prefer-builder-payload", None)
.run_with_zero_port()
.with_config(|config| assert!(config.always_prefer_builder_payload));
}

#[test]
fn no_flag_sets_always_prefer_builder_payload_to_false() {
CommandLineTest::new()
.run_with_zero_port()
.with_config(|config| assert!(!config.always_prefer_builder_payload));
}

// Tests for Eth1 flags.
#[test]
fn dummy_eth1_flag() {
Expand Down Expand Up @@ -735,6 +720,38 @@ fn builder_fallback_flags() {
);
},
);
run_payload_builder_flag_test_with_config(
"builder",
"http://meow.cats",
Some("always-prefer-builder-payload"),
None,
|config| {
assert_eq!(
config
.execution_layer
.as_ref()
.unwrap()
.always_prefer_builder_payload,
true
);
},
);
run_payload_builder_flag_test_with_config(
"builder",
"http://meow.cats",
None,
None,
|config| {
assert_eq!(
config
.execution_layer
.as_ref()
.unwrap()
.always_prefer_builder_payload,
false
);
},
);
}

#[test]
Expand Down