Skip to content

Commit

Permalink
Fix Prefer Builder Flag (sigp#4622)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethDreamer authored and Woodpile37 committed Jan 6, 2024
1 parent 0a71bdc commit 325acff
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 19 deletions.
7 changes: 3 additions & 4 deletions beacon_node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,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 @@ -832,10 +835,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

0 comments on commit 325acff

Please sign in to comment.