Fix Prefer Builder Flag (#4622)

This commit is contained in:
ethDreamer 2023-08-18 03:22:27 +00:00
parent c7e978b727
commit 687c58fde0
3 changed files with 35 additions and 21 deletions

View File

@ -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,
}
@ -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(),
}
}

View File

@ -351,6 +351,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);
@ -801,10 +804,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 =

View File

@ -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() {
@ -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]