From 44c1817c2b417ca99cd4d34126f7e26d1b3d3874 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Tue, 28 Nov 2023 16:00:28 +1100 Subject: [PATCH] Remove block-delay-ms (#4956) --- lighthouse/tests/validator_client.rs | 18 ------------------ validator_client/src/block_service.rs | 23 +---------------------- validator_client/src/cli.rs | 12 ------------ validator_client/src/config.rs | 13 ------------- validator_client/src/lib.rs | 3 +-- 5 files changed, 2 insertions(+), 67 deletions(-) diff --git a/lighthouse/tests/validator_client.rs b/lighthouse/tests/validator_client.rs index 32866cc4f..4234de613 100644 --- a/lighthouse/tests/validator_client.rs +++ b/lighthouse/tests/validator_client.rs @@ -422,24 +422,6 @@ fn no_doppelganger_protection_flag() { .with_config(|config| assert!(!config.enable_doppelganger_protection)); } #[test] -fn block_delay_ms() { - CommandLineTest::new() - .flag("block-delay-ms", Some("2000")) - .run() - .with_config(|config| { - assert_eq!( - config.block_delay, - Some(std::time::Duration::from_millis(2000)) - ) - }); -} -#[test] -fn no_block_delay_ms() { - CommandLineTest::new() - .run() - .with_config(|config| assert_eq!(config.block_delay, None)); -} -#[test] fn no_gas_limit_flag() { CommandLineTest::new() .run() diff --git a/validator_client/src/block_service.rs b/validator_client/src/block_service.rs index fbdfa1d68..47f16fc41 100644 --- a/validator_client/src/block_service.rs +++ b/validator_client/src/block_service.rs @@ -21,7 +21,6 @@ use std::ops::Deref; use std::sync::Arc; use std::time::Duration; use tokio::sync::mpsc; -use tokio::time::sleep; use types::{ AbstractExecPayload, BlindedPayload, BlockType, EthSpec, FullPayload, Graffiti, PublicKeyBytes, Slot, @@ -57,7 +56,6 @@ pub struct BlockServiceBuilder { context: Option>, graffiti: Option, graffiti_file: Option, - block_delay: Option, } impl BlockServiceBuilder { @@ -70,7 +68,6 @@ impl BlockServiceBuilder { context: None, graffiti: None, graffiti_file: None, - block_delay: None, } } @@ -109,11 +106,6 @@ impl BlockServiceBuilder { self } - pub fn block_delay(mut self, block_delay: Option) -> Self { - self.block_delay = block_delay; - self - } - pub fn build(self) -> Result, String> { Ok(BlockService { inner: Arc::new(Inner { @@ -132,7 +124,6 @@ impl BlockServiceBuilder { proposer_nodes: self.proposer_nodes, graffiti: self.graffiti, graffiti_file: self.graffiti_file, - block_delay: self.block_delay, }), }) } @@ -222,7 +213,6 @@ pub struct Inner { context: RuntimeContext, graffiti: Option, graffiti_file: Option, - block_delay: Option, } /// Attempts to produce attestations for any block producer(s) at the start of the epoch. @@ -266,18 +256,7 @@ impl BlockService { executor.spawn( async move { while let Some(notif) = notification_rx.recv().await { - let service = self.clone(); - - if let Some(delay) = service.block_delay { - debug!( - service.context.log(), - "Delaying block production by {}ms", - delay.as_millis() - ); - sleep(delay).await; - } - - service.do_update(notif).await.ok(); + self.do_update(notif).await.ok(); } debug!(log, "Block service shutting down"); }, diff --git a/validator_client/src/cli.rs b/validator_client/src/cli.rs index 69c97dea6..6957934fb 100644 --- a/validator_client/src/cli.rs +++ b/validator_client/src/cli.rs @@ -340,16 +340,4 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> { .default_value("500") .takes_value(true), ) - /* - * Experimental/development options. - */ - .arg( - Arg::with_name("block-delay-ms") - .long("block-delay-ms") - .value_name("MILLIS") - .hidden(true) - .help("Time to delay block production from the start of the slot. Should only be \ - used for testing.") - .takes_value(true), - ) } diff --git a/validator_client/src/config.rs b/validator_client/src/config.rs index 26c2bccd3..95d42d6d8 100644 --- a/validator_client/src/config.rs +++ b/validator_client/src/config.rs @@ -14,7 +14,6 @@ use slog::{info, warn, Logger}; use std::fs; use std::net::IpAddr; use std::path::PathBuf; -use std::time::Duration; use types::{Address, GRAFFITI_BYTES_LEN}; pub const DEFAULT_BEACON_NODE: &str = "http://localhost:5052/"; @@ -70,10 +69,6 @@ pub struct Config { /// A list of custom certificates that the validator client will additionally use when /// connecting to a beacon node over SSL/TLS. pub beacon_nodes_tls_certs: Option>, - /// Delay from the start of the slot to wait before publishing a block. - /// - /// This is *not* recommended in prod and should only be used for testing. - pub block_delay: Option, /// Enables broadcasting of various requests (by topic) to all beacon nodes. pub broadcast_topics: Vec, /// Enables a service which attempts to measure latency between the VC and BNs. @@ -114,7 +109,6 @@ impl Default for Config { enable_doppelganger_protection: false, enable_high_validator_count_metrics: false, beacon_nodes_tls_certs: None, - block_delay: None, builder_proposals: false, builder_registration_timestamp_override: None, gas_limit: None, @@ -373,13 +367,6 @@ impl Config { return Err("validator-registration-batch-size cannot be 0".to_string()); } - /* - * Experimental - */ - if let Some(delay_ms) = parse_optional::(cli_args, "block-delay-ms")? { - config.block_delay = Some(Duration::from_millis(delay_ms)); - } - Ok(config) } } diff --git a/validator_client/src/lib.rs b/validator_client/src/lib.rs index c020c1415..d52247df4 100644 --- a/validator_client/src/lib.rs +++ b/validator_client/src/lib.rs @@ -472,8 +472,7 @@ impl ProductionValidatorClient { .beacon_nodes(beacon_nodes.clone()) .runtime_context(context.service_context("block".into())) .graffiti(config.graffiti) - .graffiti_file(config.graffiti_file.clone()) - .block_delay(config.block_delay); + .graffiti_file(config.graffiti_file.clone()); // If we have proposer nodes, add them to the block service builder. if proposer_nodes_num > 0 {