From aa67fadc5ddb8d5b38fd9c25aa14aa558a6905a0 Mon Sep 17 00:00:00 2001 From: Jimmy Chen Date: Tue, 10 Dec 2024 15:44:18 +1100 Subject: [PATCH] Remove unnecessary changes. --- Cargo.toml | 2 +- validator_client/src/lib.rs | 79 ++++++------------- .../validator_services/Cargo.toml | 3 - .../validator_services/src/block_service.rs | 21 ----- 4 files changed, 27 insertions(+), 78 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 52b54d20959..40ee17ada20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -98,7 +98,7 @@ members = [ "validator_manager", - "watch", "testing/validator_test_rig", + "watch", ] resolver = "2" diff --git a/validator_client/src/lib.rs b/validator_client/src/lib.rs index 34a2b9a2900..1faf8e477fb 100644 --- a/validator_client/src/lib.rs +++ b/validator_client/src/lib.rs @@ -3,8 +3,6 @@ pub mod config; mod latency; mod notifier; -pub use beacon_node_fallback::beacon_node_health::BeaconNodeSyncDistanceTiers; -pub use beacon_node_fallback::ApiTopic; pub use cli::cli_app; pub use config::Config; use initialized_validators::InitializedValidators; @@ -21,9 +19,7 @@ use account_utils::validator_definitions::ValidatorDefinitions; use clap::ArgMatches; use doppelganger_service::DoppelgangerService; use environment::RuntimeContext; -use eth2::types::Graffiti; use eth2::{reqwest::ClientBuilder, BeaconNodeHttpClient, StatusCode, Timeouts}; -use graffiti_file::GraffitiFile; use initialized_validators::Error::UnableToOpenVotingKeystore; use notifier::spawn_notifier; use parking_lot::RwLock; @@ -42,7 +38,7 @@ use tokio::{ sync::mpsc, time::{sleep, Duration}, }; -use types::{EthSpec, Hash256, PublicKeyBytes}; +use types::{EthSpec, Hash256}; use validator_http_api::ApiSecret; use validator_services::{ attestation_service::{AttestationService, AttestationServiceBuilder}, @@ -207,15 +203,15 @@ impl ProductionValidatorClient { config.initialized_validators.clone(), log.clone(), ) - .await - .map_err(|e| { - match e { - UnableToOpenVotingKeystore(err) => { - format!("Unable to initialize validators: {:?}. If you have recently moved the location of your data directory \ + .await + .map_err(|e| { + match e { + UnableToOpenVotingKeystore(err) => { + format!("Unable to initialize validators: {:?}. If you have recently moved the location of your data directory \ make sure to update the location of voting_keystore_path in your validator_definitions.yml", err) - }, - err => { - format!("Unable to initialize validators: {:?}", err)} + }, + err => { + format!("Unable to initialize validators: {:?}", err)} } })?; @@ -311,7 +307,23 @@ impl ProductionValidatorClient { log, "Fallback endpoints are available, using optimized timeouts."; ); - get_optimised_bn_timeouts(slot_duration) + Timeouts { + attestation: slot_duration / HTTP_ATTESTATION_TIMEOUT_QUOTIENT, + attester_duties: slot_duration / HTTP_ATTESTER_DUTIES_TIMEOUT_QUOTIENT, + attestation_subscriptions: slot_duration + / HTTP_ATTESTATION_SUBSCRIPTIONS_TIMEOUT_QUOTIENT, + liveness: slot_duration / HTTP_LIVENESS_TIMEOUT_QUOTIENT, + proposal: slot_duration / HTTP_PROPOSAL_TIMEOUT_QUOTIENT, + proposer_duties: slot_duration / HTTP_PROPOSER_DUTIES_TIMEOUT_QUOTIENT, + sync_committee_contribution: slot_duration + / HTTP_SYNC_COMMITTEE_CONTRIBUTION_TIMEOUT_QUOTIENT, + sync_duties: slot_duration / HTTP_SYNC_DUTIES_TIMEOUT_QUOTIENT, + get_beacon_blocks_ssz: slot_duration + / HTTP_GET_BEACON_BLOCK_SSZ_TIMEOUT_QUOTIENT, + get_debug_beacon_states: slot_duration / HTTP_GET_DEBUG_BEACON_STATE_QUOTIENT, + get_deposit_snapshot: slot_duration / HTTP_GET_DEPOSIT_SNAPSHOT_QUOTIENT, + get_validator_block: slot_duration / HTTP_GET_VALIDATOR_BLOCK_TIMEOUT_QUOTIENT, + } } else { Timeouts::set_all(slot_duration) }; @@ -823,42 +835,3 @@ pub fn load_pem_certificate>(pem_path: P) -> Result, - validator_definition_graffiti: Option, - graffiti_flag: Option, -) -> Option { - graffiti_file - .and_then(|mut g| match g.load_graffiti(validator_pubkey) { - Ok(g) => g, - Err(e) => { - warn!(log, "Failed to read graffiti file"; "error" => ?e); - None - } - }) - .or(validator_definition_graffiti) - .or(graffiti_flag) -} - -pub fn get_optimised_bn_timeouts(slot_duration: Duration) -> Timeouts { - Timeouts { - attestation: slot_duration / HTTP_ATTESTATION_TIMEOUT_QUOTIENT, - attester_duties: slot_duration / HTTP_ATTESTER_DUTIES_TIMEOUT_QUOTIENT, - attestation_subscriptions: slot_duration / HTTP_ATTESTATION_SUBSCRIPTIONS_TIMEOUT_QUOTIENT, - liveness: slot_duration / HTTP_LIVENESS_TIMEOUT_QUOTIENT, - proposal: slot_duration / HTTP_PROPOSAL_TIMEOUT_QUOTIENT, - proposer_duties: slot_duration / HTTP_PROPOSER_DUTIES_TIMEOUT_QUOTIENT, - sync_committee_contribution: slot_duration - / HTTP_SYNC_COMMITTEE_CONTRIBUTION_TIMEOUT_QUOTIENT, - sync_duties: slot_duration / HTTP_SYNC_DUTIES_TIMEOUT_QUOTIENT, - get_beacon_blocks_ssz: slot_duration / HTTP_GET_BEACON_BLOCK_SSZ_TIMEOUT_QUOTIENT, - get_debug_beacon_states: slot_duration / HTTP_GET_DEBUG_BEACON_STATE_QUOTIENT, - get_deposit_snapshot: slot_duration / HTTP_GET_DEPOSIT_SNAPSHOT_QUOTIENT, - get_validator_block: slot_duration / HTTP_GET_VALIDATOR_BLOCK_TIMEOUT_QUOTIENT, - } -} diff --git a/validator_client/validator_services/Cargo.toml b/validator_client/validator_services/Cargo.toml index 4e60389ccc1..7dcd815541e 100644 --- a/validator_client/validator_services/Cargo.toml +++ b/validator_client/validator_services/Cargo.toml @@ -21,6 +21,3 @@ tokio = { workspace = true } types = { workspace = true } tree_hash = { workspace = true } bls = { workspace = true } - -[features] -testing = [] \ No newline at end of file diff --git a/validator_client/validator_services/src/block_service.rs b/validator_client/validator_services/src/block_service.rs index 01d301b6841..60eb0361ad3 100644 --- a/validator_client/validator_services/src/block_service.rs +++ b/validator_client/validator_services/src/block_service.rs @@ -323,27 +323,6 @@ impl BlockService { Ok(()) } - #[cfg(any(test, feature = "testing"))] - pub async fn publish_block_for_testing( - &self, - slot: Slot, - validator_pubkey: &PublicKeyBytes, - unsigned_block: UnsignedBlock, - ) -> Result<(), BlockError> { - let proposer_fallback = ProposerFallback { - beacon_nodes: self.beacon_nodes.clone(), - proposer_nodes: self.proposer_nodes.clone(), - }; - self.sign_and_publish_block( - proposer_fallback, - slot, - None, - validator_pubkey, - unsigned_block, - ) - .await - } - #[allow(clippy::too_many_arguments)] async fn sign_and_publish_block( &self,