From 49745c056ed25e19803bead7844367647d391a6f Mon Sep 17 00:00:00 2001 From: ThreeHrSleep Date: Sat, 21 Sep 2024 13:05:01 +0530 Subject: [PATCH] remove more loggers --- beacon_node/beacon_chain/src/builder.rs | 13 ++----- beacon_node/beacon_chain/src/eth1_chain.rs | 38 ++++-------------- beacon_node/beacon_chain/src/fork_revert.rs | 1 - .../beacon_chain/src/graffiti_calculator.rs | 15 ++----- beacon_node/beacon_chain/src/migrate.rs | 39 ++++++------------- beacon_node/client/src/builder.rs | 24 ++++-------- .../src/compute_light_client_updates.rs | 1 - beacon_node/client/src/notifier.rs | 2 - beacon_node/eth1/src/service.rs | 22 ++--------- .../genesis/src/eth1_genesis_service.rs | 4 +- beacon_node/http_api/src/lib.rs | 2 +- .../http_api/src/sync_committee_rewards.rs | 2 - beacon_node/http_api/src/test_utils.rs | 3 +- .../lighthouse_network/src/rpc/handler.rs | 5 --- beacon_node/lighthouse_network/src/rpc/mod.rs | 8 ++-- .../network/src/sync/network_context.rs | 1 - .../src/sync/network_context/custody.rs | 5 +-- beacon_node/src/lib.rs | 2 +- boot_node/src/config.rs | 2 +- boot_node/src/lib.rs | 2 - common/eth2_network_config/src/lib.rs | 7 +--- consensus/fork_choice/src/fork_choice.rs | 1 - database_manager/src/lib.rs | 4 +- slasher/service/src/service.rs | 7 ---- slasher/src/database.rs | 1 - slasher/src/slasher.rs | 19 +++------ .../http_api/create_signed_voluntary_exit.rs | 1 - validator_client/src/http_api/keystores.rs | 5 +-- validator_client/src/http_api/mod.rs | 6 +-- validator_client/src/http_api/remotekeys.rs | 1 - validator_client/src/http_api/test_utils.rs | 1 - validator_client/src/http_metrics/mod.rs | 1 - validator_client/src/lib.rs | 1 - validator_client/src/validator_store.rs | 4 -- 34 files changed, 58 insertions(+), 192 deletions(-) diff --git a/beacon_node/beacon_chain/src/builder.rs b/beacon_node/beacon_chain/src/builder.rs index 5f84c94be7e..488a8eb31e8 100644 --- a/beacon_node/beacon_chain/src/builder.rs +++ b/beacon_node/beacon_chain/src/builder.rs @@ -820,12 +820,8 @@ where })?; let migrator_config = self.store_migrator_config.unwrap_or_default(); - let store_migrator = BackgroundMigrator::new( - store.clone(), - migrator_config, - genesis_block_root, - log.clone(), - ); + let store_migrator = + BackgroundMigrator::new(store.clone(), migrator_config, genesis_block_root); if let Some(slot) = slot_clock.now() { validator_monitor.process_valid_state( @@ -970,7 +966,6 @@ where self.beacon_graffiti, self.execution_layer, slot_clock.slot_duration() * E::slots_per_epoch() as u32, - log.clone(), ), slasher: self.slasher.clone(), validator_monitor: RwLock::new(validator_monitor), @@ -1077,8 +1072,7 @@ where .as_ref() .ok_or("dummy_eth1_backend requires a log")?; - let backend = - CachingEth1Backend::new(Eth1Config::default(), log.clone(), self.spec.clone())?; + let backend = CachingEth1Backend::new(Eth1Config::default(), self.spec.clone())?; self.eth1_chain = Some(Eth1Chain::new_dummy(backend)); @@ -1158,6 +1152,7 @@ mod test { use std::time::Duration; use store::config::StoreConfig; use store::{HotColdDB, MemoryStore}; + use task_executor::test_utils::TestRuntime; use types::{EthSpec, MinimalEthSpec, Slot}; diff --git a/beacon_node/beacon_chain/src/eth1_chain.rs b/beacon_node/beacon_chain/src/eth1_chain.rs index 2578ebcb548..64f5450632e 100644 --- a/beacon_node/beacon_chain/src/eth1_chain.rs +++ b/beacon_node/beacon_chain/src/eth1_chain.rs @@ -3,7 +3,6 @@ use eth1::{Config as Eth1Config, Eth1Block, Service as HttpService}; use eth2::lighthouse::Eth1SyncStatusData; use ethereum_hashing::hash; use int_to_bytes::int_to_bytes32; -use slog::Logger; use ssz::{Decode, Encode}; use ssz_derive::{Decode, Encode}; use state_processing::per_block_processing::get_new_eth1_data; @@ -284,11 +283,9 @@ where pub fn from_ssz_container( ssz_container: &SszEth1, config: Eth1Config, - log: &Logger, spec: ChainSpec, ) -> Result { - let backend = - Eth1ChainBackend::from_bytes(&ssz_container.backend_bytes, config, log.clone(), spec)?; + let backend = Eth1ChainBackend::from_bytes(&ssz_container.backend_bytes, config, spec)?; Ok(Self { use_dummy_backend: ssz_container.use_dummy_backend, backend, @@ -352,12 +349,7 @@ pub trait Eth1ChainBackend: Sized + Send + Sync { fn as_bytes(&self) -> Vec; /// Create a `Eth1ChainBackend` instance given encoded bytes. - fn from_bytes( - bytes: &[u8], - config: Eth1Config, - log: Logger, - spec: ChainSpec, - ) -> Result; + fn from_bytes(bytes: &[u8], config: Eth1Config, spec: ChainSpec) -> Result; } /// Provides a simple, testing-only backend that generates deterministic, meaningless eth1 data. @@ -410,12 +402,7 @@ impl Eth1ChainBackend for DummyEth1ChainBackend { } /// Create dummy eth1 backend. - fn from_bytes( - _bytes: &[u8], - _config: Eth1Config, - _log: Logger, - _spec: ChainSpec, - ) -> Result { + fn from_bytes(_bytes: &[u8], _config: Eth1Config, _spec: ChainSpec) -> Result { Ok(Self(PhantomData)) } } @@ -434,7 +421,6 @@ impl Default for DummyEth1ChainBackend { #[derive(Clone)] pub struct CachingEth1Backend { pub core: HttpService, - log: Logger, _phantom: PhantomData, } @@ -442,11 +428,10 @@ impl CachingEth1Backend { /// Instantiates `self` with empty caches. /// /// Does not connect to the eth1 node or start any tasks to keep the cache updated. - pub fn new(config: Eth1Config, log: Logger, spec: ChainSpec) -> Result { + pub fn new(config: Eth1Config, spec: ChainSpec) -> Result { Ok(Self { - core: HttpService::new(config, log.clone(), spec) + core: HttpService::new(config, spec) .map_err(|e| format!("Failed to create eth1 http service: {:?}", e))?, - log, _phantom: PhantomData, }) } @@ -459,7 +444,6 @@ impl CachingEth1Backend { /// Instantiates `self` from an existing service. pub fn from_service(service: HttpService) -> Self { Self { - log: service.log.clone(), core: service, _phantom: PhantomData, } @@ -589,16 +573,10 @@ impl Eth1ChainBackend for CachingEth1Backend { } /// Recover the cached backend from encoded bytes. - fn from_bytes( - bytes: &[u8], - config: Eth1Config, - log: Logger, - spec: ChainSpec, - ) -> Result { - let inner = HttpService::from_bytes(bytes, config, log.clone(), spec)?; + fn from_bytes(bytes: &[u8], config: Eth1Config, spec: ChainSpec) -> Result { + let inner = HttpService::from_bytes(bytes, config, spec)?; Ok(Self { core: inner, - log, _phantom: PhantomData, }) } @@ -749,7 +727,7 @@ mod test { let log = test_logger(); Eth1Chain::new( - CachingEth1Backend::new(eth1_config, log, MainnetEthSpec::default_spec()).unwrap(), + CachingEth1Backend::new(eth1_config, MainnetEthSpec::default_spec()).unwrap(), ) } diff --git a/beacon_node/beacon_chain/src/fork_revert.rs b/beacon_node/beacon_chain/src/fork_revert.rs index 9329ce0aad8..55d61afb024 100644 --- a/beacon_node/beacon_chain/src/fork_revert.rs +++ b/beacon_node/beacon_chain/src/fork_revert.rs @@ -1,7 +1,6 @@ use crate::{BeaconForkChoiceStore, BeaconSnapshot}; use fork_choice::{ForkChoice, PayloadVerificationStatus}; use itertools::process_results; -use slog::Logger; use state_processing::state_advance::complete_state_advance; use state_processing::{ per_block_processing, per_block_processing::BlockSignatureStrategy, ConsensusContext, diff --git a/beacon_node/beacon_chain/src/graffiti_calculator.rs b/beacon_node/beacon_chain/src/graffiti_calculator.rs index d6b924b1dad..efbc37af2c2 100644 --- a/beacon_node/beacon_chain/src/graffiti_calculator.rs +++ b/beacon_node/beacon_chain/src/graffiti_calculator.rs @@ -3,7 +3,7 @@ use crate::BeaconChainTypes; use execution_layer::{http::ENGINE_GET_CLIENT_VERSION_V1, CommitPrefix, ExecutionLayer}; use logging::crit; use serde::{Deserialize, Serialize}; -use slog::Logger; + use slot_clock::SlotClock; use std::{fmt::Debug, time::Duration}; use task_executor::TaskExecutor; @@ -53,7 +53,6 @@ pub struct GraffitiCalculator { pub beacon_graffiti: GraffitiOrigin, execution_layer: Option>, pub epoch_duration: Duration, - log: Logger, } impl GraffitiCalculator { @@ -61,13 +60,11 @@ impl GraffitiCalculator { beacon_graffiti: GraffitiOrigin, execution_layer: Option>, epoch_duration: Duration, - log: Logger, ) -> Self { Self { beacon_graffiti, execution_layer, epoch_duration, - log, } } @@ -163,13 +160,8 @@ pub fn start_engine_version_cache_refresh_service( let epoch_duration = chain.graffiti_calculator.epoch_duration; executor.spawn( async move { - engine_version_cache_refresh_service::( - execution_layer, - slot_clock, - epoch_duration, - log, - ) - .await + engine_version_cache_refresh_service::(execution_layer, slot_clock, epoch_duration) + .await }, "engine_version_cache_refresh_service", ); @@ -179,7 +171,6 @@ async fn engine_version_cache_refresh_service( execution_layer: ExecutionLayer, slot_clock: T::SlotClock, epoch_duration: Duration, - log: Logger, ) { // Preload the engine version cache after a brief delay to allow for EL initialization. // This initial priming ensures cache readiness before the service's regular update cycle begins. diff --git a/beacon_node/beacon_chain/src/migrate.rs b/beacon_node/beacon_chain/src/migrate.rs index cd8bd233fd1..f634aa586f5 100644 --- a/beacon_node/beacon_chain/src/migrate.rs +++ b/beacon_node/beacon_chain/src/migrate.rs @@ -3,7 +3,6 @@ use crate::errors::BeaconChainError; use crate::head_tracker::{HeadTracker, SszHeadTracker}; use crate::persisted_beacon_chain::{PersistedBeaconChain, DUMMY_CANONICAL_HEAD_BLOCK_ROOT}; use parking_lot::Mutex; -use slog::Logger; use std::collections::{HashMap, HashSet}; use std::mem; use std::sync::{mpsc, Arc}; @@ -39,7 +38,6 @@ pub struct BackgroundMigrator, Cold: ItemStore> tx_thread: Option, thread::JoinHandle<()>)>>, /// Genesis block root, for persisting the `PersistedBeaconChain`. genesis_block_root: Hash256, - log: Logger, } #[derive(Debug, Clone, PartialEq, Eq)] @@ -135,7 +133,6 @@ impl, Cold: ItemStore> BackgroundMigrator>, config: MigratorConfig, genesis_block_root: Hash256, - log: Logger, ) -> Self { // Estimate last migration run from DB split slot. let prev_migration = Arc::new(Mutex::new(PrevMigration { @@ -145,14 +142,13 @@ impl, Cold: ItemStore> BackgroundMigrator, Cold: ItemStore> BackgroundMigrator, Cold: ItemStore> BackgroundMigrator, Cold: ItemStore> BackgroundMigrator>, log: &Logger) { + pub fn run_reconstruction(db: Arc>) { if let Err(e) = db.reconstruct_historic_states() { error!( error = ?e, @@ -210,11 +206,7 @@ impl, Cold: ItemStore> BackgroundMigrator>, - data_availability_boundary: Epoch, - log: &Logger, - ) { + pub fn run_prune_blobs(db: Arc>, data_availability_boundary: Epoch) { if let Err(e) = db.try_prune_blobs(false, data_availability_boundary) { error!( error = ?e, @@ -234,7 +226,7 @@ impl, Cold: ItemStore> BackgroundMigrator, Cold: ItemStore> BackgroundMigrator>, - notif: FinalizationNotification, - log: &Logger, - ) { + fn run_migration(db: Arc>, notif: FinalizationNotification) { // Do not run too frequently. let epoch = notif.finalized_checkpoint.epoch; let mut prev_migration = notif.prev_migration.lock(); @@ -307,7 +295,6 @@ impl, Cold: ItemStore> BackgroundMigrator, Cold: ItemStore> BackgroundMigrator, Cold: ItemStore> BackgroundMigrator>, - log: Logger, ) -> (mpsc::Sender, thread::JoinHandle<()>) { let (tx, rx) = mpsc::channel(); let thread = thread::spawn(move || { @@ -409,13 +394,13 @@ impl, Cold: ItemStore> BackgroundMigrator, Cold: ItemStore> BackgroundMigrator, new_finalized_checkpoint: Checkpoint, genesis_block_root: Hash256, - log: &Logger, ) -> Result { let old_finalized_checkpoint = store @@ -706,7 +690,6 @@ impl, Cold: ItemStore> BackgroundMigrator>, old_finalized_epoch: Epoch, new_finalized_epoch: Epoch, - log: &Logger, ) -> Result<(), Error> { if !db.compact_on_prune() { return Ok(()); diff --git a/beacon_node/client/src/builder.rs b/beacon_node/client/src/builder.rs index 513146bd8a5..4bff27f08a9 100644 --- a/beacon_node/client/src/builder.rs +++ b/beacon_node/client/src/builder.rs @@ -288,7 +288,7 @@ where ClientGenesis::GenesisState => { info!("Starting from known genesis state"); - let genesis_state = genesis_state(&runtime_context, &config, log).await?; + let genesis_state = genesis_state(&runtime_context, &config).await?; // If the user has not explicitly allowed genesis sync, prevent // them from trying to sync from genesis if we're outside of the @@ -355,7 +355,7 @@ where } else { None }; - let genesis_state = genesis_state(&runtime_context, &config, log).await?; + let genesis_state = genesis_state(&runtime_context, &config).await?; builder .weak_subjectivity_state( @@ -473,7 +473,7 @@ where None }; - let genesis_state = genesis_state(&runtime_context, &config, log).await?; + let genesis_state = genesis_state(&runtime_context, &config).await?; info!( block_slot = ?block.slot(), @@ -801,7 +801,6 @@ where let (listen_addr, server) = http_api::serve(ctx, exit) .map_err(|e| format!("Unable to start HTTP API server: {:?}", e))?; - let http_log = runtime_context.log().clone(); let http_api_task = async move { server.await; debug!("HTTP API server task ended"); @@ -1112,22 +1111,15 @@ where CachingEth1Backend::from_service(eth1_service_from_genesis) } else if config.purge_cache { - CachingEth1Backend::new(config, context.log().clone(), spec)? + CachingEth1Backend::new(config, spec)? } else { beacon_chain_builder .get_persisted_eth1_backend()? .map(|persisted| { - Eth1Chain::from_ssz_container( - &persisted, - config.clone(), - &context.log().clone(), - spec.clone(), - ) - .map(|chain| chain.into_backend()) + Eth1Chain::from_ssz_container(&persisted, config.clone(), spec.clone()) + .map(|chain| chain.into_backend()) }) - .unwrap_or_else(|| { - CachingEth1Backend::new(config, context.log().clone(), spec.clone()) - })? + .unwrap_or_else(|| CachingEth1Backend::new(config, spec.clone()))? }; self.eth1_service = Some(backend.core.clone()); @@ -1210,7 +1202,6 @@ where async fn genesis_state( context: &RuntimeContext, config: &ClientConfig, - log: &Logger, ) -> Result, String> { let eth2_network_config = context .eth2_network_config @@ -1220,7 +1211,6 @@ async fn genesis_state( .genesis_state::( config.genesis_state_url.as_deref(), config.genesis_state_url_timeout, - log, ) .await? .ok_or_else(|| "Genesis state is unknown".to_string()) diff --git a/beacon_node/client/src/compute_light_client_updates.rs b/beacon_node/client/src/compute_light_client_updates.rs index 72b90d5a68c..fab284c4285 100644 --- a/beacon_node/client/src/compute_light_client_updates.rs +++ b/beacon_node/client/src/compute_light_client_updates.rs @@ -2,7 +2,6 @@ use beacon_chain::{BeaconChain, BeaconChainTypes, LightClientProducerEvent}; use beacon_processor::work_reprocessing_queue::ReprocessQueueMessage; use futures::channel::mpsc::Receiver; use futures::StreamExt; -use slog::Logger; use tokio::sync::mpsc::Sender; use tracing::error; diff --git a/beacon_node/client/src/notifier.rs b/beacon_node/client/src/notifier.rs index 7643b1a4aa6..c7db743d987 100644 --- a/beacon_node/client/src/notifier.rs +++ b/beacon_node/client/src/notifier.rs @@ -8,7 +8,6 @@ use beacon_chain::{ }; use lighthouse_network::{types::SyncState, NetworkGlobals}; use logging::crit; -use slog::Logger; use slot_clock::SlotClock; use std::sync::Arc; use std::time::{Duration, Instant}; @@ -40,7 +39,6 @@ pub fn spawn_notifier( let slot_duration = Duration::from_secs(seconds_per_slot); let speedo = Mutex::new(Speedo::default()); - let log = executor.log().clone(); // Keep track of sync state and reset the speedo on specific sync state changes. // Specifically, if we switch between a sync and a backfill sync, reset the speedo. diff --git a/beacon_node/eth1/src/service.rs b/beacon_node/eth1/src/service.rs index 358057017ce..3f1451d9fc5 100644 --- a/beacon_node/eth1/src/service.rs +++ b/beacon_node/eth1/src/service.rs @@ -59,11 +59,7 @@ type EndpointState = Result<(), EndpointError>; /// Returns `Ok` if the endpoint is usable, i.e. is reachable and has a correct network id and /// chain id. Otherwise it returns `Err`. -async fn endpoint_state( - endpoint: &HttpJsonRpc, - config_chain_id: &Eth1Id, - log: &Logger, -) -> EndpointState { +async fn endpoint_state(endpoint: &HttpJsonRpc, config_chain_id: &Eth1Id) -> EndpointState { let error_connecting = |e: String| { debug!( %endpoint, @@ -387,12 +383,11 @@ pub fn endpoint_from_config(config: &Config) -> Result { #[derive(Clone)] pub struct Service { inner: Arc, - pub log: Logger, } impl Service { /// Creates a new service. Does not attempt to connect to the eth1 node. - pub fn new(config: Config, log: Logger, spec: ChainSpec) -> Result { + pub fn new(config: Config, spec: ChainSpec) -> Result { Ok(Self { inner: Arc::new(Inner { block_cache: <_>::default(), @@ -405,7 +400,6 @@ impl Service { config: RwLock::new(config), spec, }), - log, }) } @@ -435,7 +429,6 @@ impl Service { config: RwLock::new(config), spec, }), - log, }) } @@ -455,16 +448,10 @@ impl Service { } /// Recover the deposit and block caches from encoded bytes. - pub fn from_bytes( - bytes: &[u8], - config: Config, - log: Logger, - spec: ChainSpec, - ) -> Result { + pub fn from_bytes(bytes: &[u8], config: Config, spec: ChainSpec) -> Result { let inner = Inner::from_bytes(bytes, config, spec)?; Ok(Self { inner: Arc::new(inner), - log, }) } @@ -611,11 +598,10 @@ impl Service { &self, ) -> Result<(DepositCacheUpdateOutcome, BlockCacheUpdateOutcome), String> { let client = self.client(); - let log = self.log.clone(); let chain_id = self.config().chain_id.clone(); let node_far_behind_seconds = self.inner.config.read().node_far_behind_seconds; - match endpoint_state(client, &chain_id, &log).await { + match endpoint_state(client, &chain_id).await { Ok(()) => crate::metrics::set_gauge(&metrics::ETH1_CONNECTED, 1), Err(e) => { crate::metrics::set_gauge(&metrics::ETH1_CONNECTED, 0); diff --git a/beacon_node/genesis/src/eth1_genesis_service.rs b/beacon_node/genesis/src/eth1_genesis_service.rs index 9073ca68032..f2b3a4c0b3b 100644 --- a/beacon_node/genesis/src/eth1_genesis_service.rs +++ b/beacon_node/genesis/src/eth1_genesis_service.rs @@ -66,7 +66,7 @@ impl Eth1GenesisService { }; Ok(Self { - eth1_service: Eth1Service::new(config, log, spec) + eth1_service: Eth1Service::new(config, spec) .map_err(|e| format!("Failed to create eth1 service: {:?}", e))?, stats: Arc::new(Statistics { highest_processed_block: AtomicU64::new(0), @@ -104,7 +104,6 @@ impl Eth1GenesisService { spec: ChainSpec, ) -> Result, String> { let eth1_service = &self.eth1_service; - let log = ð1_service.log; let mut sync_blocks = false; let mut highest_processed_block = None; @@ -238,7 +237,6 @@ impl Eth1GenesisService { spec: &ChainSpec, ) -> Result>, String> { let eth1_service = &self.eth1_service; - let log = ð1_service.log; for block in eth1_service.blocks().read().iter() { // It's possible that the block and deposit caches aren't synced. Ignore any blocks diff --git a/beacon_node/http_api/src/lib.rs b/beacon_node/http_api/src/lib.rs index cdfb80c06f3..c129a97c96b 100644 --- a/beacon_node/http_api/src/lib.rs +++ b/beacon_node/http_api/src/lib.rs @@ -2594,7 +2594,7 @@ pub fn serve( task_spawner.blocking_json_task(Priority::P1, move || { let (rewards, execution_optimistic, finalized) = sync_committee_rewards::compute_sync_committee_rewards( - chain, block_id, validators, log, + chain, block_id, validators, )?; Ok(api_types::GenericResponse::from(rewards)).map(|resp| { diff --git a/beacon_node/http_api/src/sync_committee_rewards.rs b/beacon_node/http_api/src/sync_committee_rewards.rs index e990810b777..98a5811a8eb 100644 --- a/beacon_node/http_api/src/sync_committee_rewards.rs +++ b/beacon_node/http_api/src/sync_committee_rewards.rs @@ -2,7 +2,6 @@ use crate::{BlockId, ExecutionOptimistic}; use beacon_chain::{BeaconChain, BeaconChainError, BeaconChainTypes}; use eth2::lighthouse::SyncCommitteeReward; use eth2::types::ValidatorId; -use slog::Logger; use state_processing::BlockReplayer; use std::sync::Arc; use tracing::debug; @@ -13,7 +12,6 @@ pub fn compute_sync_committee_rewards( chain: Arc>, block_id: BlockId, validators: Vec, - log: Logger, ) -> Result<(Option>, ExecutionOptimistic, bool), warp::Rejection> { let (block, execution_optimistic, finalized) = block_id.blinded_block(&chain)?; diff --git a/beacon_node/http_api/src/test_utils.rs b/beacon_node/http_api/src/test_utils.rs index dcd494a880f..875c42d154f 100644 --- a/beacon_node/http_api/src/test_utils.rs +++ b/beacon_node/http_api/src/test_utils.rs @@ -175,8 +175,7 @@ pub async fn create_api_server( })); *network_globals.sync_state.write() = SyncState::Synced; - let eth1_service = - eth1::Service::new(eth1::Config::default(), log.clone(), chain.spec.clone()).unwrap(); + let eth1_service = eth1::Service::new(eth1::Config::default(), chain.spec.clone()).unwrap(); let beacon_processor_config = BeaconProcessorConfig { // The number of workers must be greater than one. Tests which use the diff --git a/beacon_node/lighthouse_network/src/rpc/handler.rs b/beacon_node/lighthouse_network/src/rpc/handler.rs index a6f05f2e70c..df9488ab656 100644 --- a/beacon_node/lighthouse_network/src/rpc/handler.rs +++ b/beacon_node/lighthouse_network/src/rpc/handler.rs @@ -143,9 +143,6 @@ where /// Waker, to be sure the handler gets polled when needed. waker: Option, - /// Logger for handling RPC streams - log: slog::Logger, - /// Timeout that will me used for inbound and outbound responses. resp_timeout: Duration, } @@ -231,7 +228,6 @@ where peer_id: PeerId, listen_protocol: SubstreamProtocol, ()>, fork_context: Arc, - log: &slog::Logger, resp_timeout: Duration, ) -> Self { RPCHandler { @@ -252,7 +248,6 @@ where outbound_io_error_retries: 0, fork_context, waker: None, - log: log.clone(), resp_timeout, } } diff --git a/beacon_node/lighthouse_network/src/rpc/mod.rs b/beacon_node/lighthouse_network/src/rpc/mod.rs index 86c8f19015e..f6297461701 100644 --- a/beacon_node/lighthouse_network/src/rpc/mod.rs +++ b/beacon_node/lighthouse_network/src/rpc/mod.rs @@ -243,15 +243,14 @@ where }, (), ); - let log = self - .log - .new(slog::o!("peer_id" => peer_id.to_string(), "connection_id" => connection_id.to_string())); + // let log = self + // .log + // .new(slog::o!("peer_id" => peer_id.to_string(), "connection_id" => connection_id.to_string())); let handler = RPCHandler::new( connection_id, peer_id, protocol, self.fork_context.clone(), - &log, self.network_params.resp_timeout, ); @@ -286,7 +285,6 @@ where peer_id, protocol, self.fork_context.clone(), - &log, self.network_params.resp_timeout, ); diff --git a/beacon_node/network/src/sync/network_context.rs b/beacon_node/network/src/sync/network_context.rs index 92d33941e22..9b2c877f78e 100644 --- a/beacon_node/network/src/sync/network_context.rs +++ b/beacon_node/network/src/sync/network_context.rs @@ -776,7 +776,6 @@ impl SyncNetworkContext { // TODO(das): req_id is duplicated here, also present in id CustodyId { requester, req_id }, &custody_indexes_to_fetch, - self.log.clone(), ); // TODO(das): start request diff --git a/beacon_node/network/src/sync/network_context/custody.rs b/beacon_node/network/src/sync/network_context/custody.rs index 8c6ea2bab03..526e4161ecb 100644 --- a/beacon_node/network/src/sync/network_context/custody.rs +++ b/beacon_node/network/src/sync/network_context/custody.rs @@ -31,8 +31,7 @@ pub struct ActiveCustodyRequest { /// Peers that have recently failed to successfully respond to a columns by root request. /// Having a LRUTimeCache allows this request to not have to track disconnecting peers. failed_peers: LRUTimeCache, - /// Logger for the `SyncNetworkContext`. - pub log: slog::Logger, + _phantom: PhantomData, } @@ -63,7 +62,6 @@ impl ActiveCustodyRequest { block_root: Hash256, custody_id: CustodyId, column_indices: &[ColumnIndex], - log: slog::Logger, ) -> Self { Self { block_root, @@ -75,7 +73,6 @@ impl ActiveCustodyRequest { ), active_batch_columns_requests: <_>::default(), failed_peers: LRUTimeCache::new(Duration::from_secs(FAILED_PEERS_CACHE_EXPIRY_SECONDS)), - log, _phantom: PhantomData, } } diff --git a/beacon_node/src/lib.rs b/beacon_node/src/lib.rs index d00e82f2577..39aee80bed0 100644 --- a/beacon_node/src/lib.rs +++ b/beacon_node/src/lib.rs @@ -116,7 +116,7 @@ impl ProductionBeaconNode { Slasher::open( slasher_config, Arc::new(spec), - log.new(slog::o!("service" => "slasher")), + //log.new(slog::o!("service" => "slasher")), ) .map_err(|e| format!("Slasher open error: {:?}", e))?, ); diff --git a/boot_node/src/config.rs b/boot_node/src/config.rs index 33ad7c46f7c..dab09d01df3 100644 --- a/boot_node/src/config.rs +++ b/boot_node/src/config.rs @@ -104,7 +104,7 @@ impl BootNodeConfig { if eth2_network_config.genesis_state_is_known() { let mut genesis_state = eth2_network_config - .genesis_state::(genesis_state_url.as_deref(), genesis_state_url_timeout, &logger).await? + .genesis_state::(genesis_state_url.as_deref(), genesis_state_url_timeout).await? .ok_or_else(|| { "The genesis state for this network is not known, this is an unsupported mode" .to_string() diff --git a/boot_node/src/lib.rs b/boot_node/src/lib.rs index d31e7f6f51f..5658bed1d18 100644 --- a/boot_node/src/lib.rs +++ b/boot_node/src/lib.rs @@ -48,8 +48,6 @@ pub fn run( log::Level::Error => drain.filter_level(Level::Error), }; - let log = Logger::root(drain.fuse(), o!()); - // Run the main function emitting any errors if let Err(e) = match eth_spec_id { EthSpecId::Minimal => { diff --git a/common/eth2_network_config/src/lib.rs b/common/eth2_network_config/src/lib.rs index 609d9504e9b..222b825d29e 100644 --- a/common/eth2_network_config/src/lib.rs +++ b/common/eth2_network_config/src/lib.rs @@ -18,7 +18,6 @@ use pretty_reqwest_error::PrettyReqwestError; use reqwest::{Client, Error}; use sensitive_url::SensitiveUrl; use sha2::{Digest, Sha256}; -use slog::Logger; use std::fs::{create_dir_all, File}; use std::io::{Read, Write}; use std::path::PathBuf; @@ -192,7 +191,6 @@ impl Eth2NetworkConfig { &self, genesis_state_url: Option<&str>, timeout: Duration, - log: &Logger, ) -> Result>, String> { let spec = self.chain_spec::()?; match &self.genesis_state_source { @@ -210,9 +208,9 @@ impl Eth2NetworkConfig { format!("Unable to parse genesis state bytes checksum: {:?}", e) })?; let bytes = if let Some(specified_url) = genesis_state_url { - download_genesis_state(&[specified_url], timeout, checksum, log).await + download_genesis_state(&[specified_url], timeout, checksum).await } else { - download_genesis_state(built_in_urls, timeout, checksum, log).await + download_genesis_state(built_in_urls, timeout, checksum).await }?; let state = BeaconState::from_ssz_bytes(bytes.as_ref(), &spec).map_err(|e| { format!("Downloaded genesis state SSZ bytes are invalid: {:?}", e) @@ -380,7 +378,6 @@ async fn download_genesis_state( urls: &[&str], timeout: Duration, checksum: Hash256, - log: &Logger, ) -> Result, String> { if urls.is_empty() { return Err( diff --git a/consensus/fork_choice/src/fork_choice.rs b/consensus/fork_choice/src/fork_choice.rs index 1b73fe938f7..9c32f0da09e 100644 --- a/consensus/fork_choice/src/fork_choice.rs +++ b/consensus/fork_choice/src/fork_choice.rs @@ -5,7 +5,6 @@ use proto_array::{ Block as ProtoBlock, DisallowedReOrgOffsets, ExecutionStatus, ProposerHeadError, ProposerHeadInfo, ProtoArrayForkChoice, ReOrgThreshold, }; -use slog::Logger; use ssz_derive::{Decode, Encode}; use state_processing::{ per_block_processing::errors::AttesterSlashingValidationError, per_epoch_processing, diff --git a/database_manager/src/lib.rs b/database_manager/src/lib.rs index 0d913627b35..c00462d6ce9 100644 --- a/database_manager/src/lib.rs +++ b/database_manager/src/lib.rs @@ -261,7 +261,6 @@ fn parse_compact_config(compact_config: &Compact) -> Result( compact_config: CompactConfig, client_config: ClientConfig, - log: Logger, ) -> Result<(), Error> { let hot_path = client_config.get_db_path(); let cold_path = client_config.get_freezer_db_path(); @@ -502,7 +501,6 @@ pub fn run( network_config.genesis_state::( client_config.genesis_state_url.as_deref(), client_config.genesis_state_url_timeout, - &log, ), "get_genesis_state", ) @@ -516,7 +514,7 @@ pub fn run( } cli::DatabaseManagerSubcommand::Compact(compact_config) => { let compact_config = parse_compact_config(compact_config)?; - compact_db::(compact_config, client_config, log).map_err(format_err) + compact_db::(compact_config, client_config).map_err(format_err) } } } diff --git a/slasher/service/src/service.rs b/slasher/service/src/service.rs index 84503a28748..14b19d3ad04 100644 --- a/slasher/service/src/service.rs +++ b/slasher/service/src/service.rs @@ -8,7 +8,6 @@ use slasher::{ metrics::{self, SLASHER_DATABASE_SIZE, SLASHER_RUN_TIME}, Slasher, }; -use slog::Logger; use slot_clock::SlotClock; use state_processing::{ per_block_processing::errors::{ @@ -48,7 +47,6 @@ impl SlasherService { .slasher .clone() .ok_or("No slasher is configured")?; - let log = slasher.log().clone(); info!(broadcast = slasher.config().broadcast, "Starting slasher"); @@ -66,7 +64,6 @@ impl SlasherService { update_period, slot_offset, notif_sender, - log, ), "slasher_server_notifier", ); @@ -85,7 +82,6 @@ impl SlasherService { update_period: u64, slot_offset: f64, notif_sender: SyncSender, - log: Logger, ) { let slot_offset = Duration::from_secs_f64(slot_offset); let start_instant = @@ -117,7 +113,6 @@ impl SlasherService { notif_receiver: Receiver, network_sender: UnboundedSender>, ) { - let log = slasher.log(); while let Ok(current_epoch) = notif_receiver.recv() { let t = Instant::now(); @@ -179,7 +174,6 @@ impl SlasherService { slasher: &Slasher, network_sender: &UnboundedSender>, ) { - let log = slasher.log(); let attester_slashings = slasher.get_attester_slashings(); for slashing in attester_slashings { @@ -233,7 +227,6 @@ impl SlasherService { slasher: &Slasher, network_sender: &UnboundedSender>, ) { - let log = slasher.log(); let proposer_slashings = slasher.get_proposer_slashings(); for slashing in proposer_slashings { diff --git a/slasher/src/database.rs b/slasher/src/database.rs index 5403dbc07a4..ee3b7780708 100644 --- a/slasher/src/database.rs +++ b/slasher/src/database.rs @@ -12,7 +12,6 @@ use interface::{Environment, OpenDatabases, RwTransaction}; use lru::LruCache; use parking_lot::Mutex; use serde::de::DeserializeOwned; -use slog::Logger; use ssz::{Decode, Encode}; use ssz_derive::{Decode, Encode}; use std::borrow::{Borrow, Cow}; diff --git a/slasher/src/slasher.rs b/slasher/src/slasher.rs index 279366428bc..6dd1cbc789c 100644 --- a/slasher/src/slasher.rs +++ b/slasher/src/slasher.rs @@ -9,7 +9,6 @@ use crate::{ IndexedAttestationId, ProposerSlashingStatus, RwTransaction, SimpleBatch, SlasherDB, }; use parking_lot::Mutex; -use slog::Logger; use std::collections::HashSet; use std::sync::Arc; use tracing::{debug, error, info}; @@ -26,26 +25,21 @@ pub struct Slasher { attester_slashings: Mutex>>, proposer_slashings: Mutex>, config: Arc, - log: Logger, } impl Slasher { - pub fn open(config: Config, spec: Arc, log: Logger) -> Result { + pub fn open(config: Config, spec: Arc) -> Result { config.validate()?; let config = Arc::new(config); let db = SlasherDB::open(config.clone(), spec)?; - Self::from_config_and_db(config, db, log) + Self::from_config_and_db(config, db) } /// TESTING ONLY. /// /// Initialise a slasher database from an existing `db`. The caller must ensure that the /// database's config matches the one provided. - pub fn from_config_and_db( - config: Arc, - db: SlasherDB, - log: Logger, - ) -> Result { + pub fn from_config_and_db(config: Arc, db: SlasherDB) -> Result { config.validate()?; let attester_slashings = Mutex::new(HashSet::new()); let proposer_slashings = Mutex::new(HashSet::new()); @@ -58,7 +52,6 @@ impl Slasher { attester_slashings, proposer_slashings, config, - log, }) } @@ -81,9 +74,9 @@ impl Slasher { &self.config } - pub fn log(&self) -> &Logger { - &self.log - } + // pub fn log(&self) -> &Logger { + // &self.log + // } /// Accept an attestation from the network and queue it for processing. pub fn accept_attestation(&self, attestation: IndexedAttestation) { diff --git a/validator_client/src/http_api/create_signed_voluntary_exit.rs b/validator_client/src/http_api/create_signed_voluntary_exit.rs index 620dfe6c9c1..245acfd8c0e 100644 --- a/validator_client/src/http_api/create_signed_voluntary_exit.rs +++ b/validator_client/src/http_api/create_signed_voluntary_exit.rs @@ -1,7 +1,6 @@ use crate::validator_store::ValidatorStore; use bls::{PublicKey, PublicKeyBytes}; use eth2::types::GenericResponse; -use slog::Logger; use slot_clock::SlotClock; use std::sync::Arc; use tracing::info; diff --git a/validator_client/src/http_api/keystores.rs b/validator_client/src/http_api/keystores.rs index 6d10c00da48..cc94795e9ba 100644 --- a/validator_client/src/http_api/keystores.rs +++ b/validator_client/src/http_api/keystores.rs @@ -13,7 +13,6 @@ use eth2::lighthouse_vc::{ types::{ExportKeystoresResponse, SingleExportKeystoresResponse}, }; use eth2_keystore::Keystore; -use slog::Logger; use slot_clock::SlotClock; use std::path::PathBuf; use std::sync::Arc; @@ -230,9 +229,8 @@ pub fn delete( request: DeleteKeystoresRequest, validator_store: Arc>, task_executor: TaskExecutor, - log: Logger, ) -> Result { - let export_response = export(request, validator_store, task_executor, log)?; + let export_response = export(request, validator_store, task_executor)?; Ok(DeleteKeystoresResponse { data: export_response .data @@ -247,7 +245,6 @@ pub fn export( request: DeleteKeystoresRequest, validator_store: Arc>, task_executor: TaskExecutor, - log: Logger, ) -> Result { // Remove from initialized validators. let initialized_validators_rwlock = validator_store.initialized_validators(); diff --git a/validator_client/src/http_api/mod.rs b/validator_client/src/http_api/mod.rs index 66011ae4a27..4f37d2640f7 100644 --- a/validator_client/src/http_api/mod.rs +++ b/validator_client/src/http_api/mod.rs @@ -776,7 +776,7 @@ pub fn serve( .then(move |request, validator_store, task_executor, log| { blocking_json_task(move || { if allow_keystore_export { - keystores::export(request, validator_store, task_executor, log) + keystores::export(request, validator_store, task_executor) } else { Err(warp_utils::reject::custom_bad_request( "keystore export is disabled".to_string(), @@ -1156,9 +1156,7 @@ pub fn serve( .and(task_executor_filter.clone()) .and(log_filter.clone()) .then(|request, validator_store, task_executor, log| { - blocking_json_task(move || { - keystores::delete(request, validator_store, task_executor, log) - }) + blocking_json_task(move || keystores::delete(request, validator_store, task_executor)) }); // GET /eth/v1/remotekeys diff --git a/validator_client/src/http_api/remotekeys.rs b/validator_client/src/http_api/remotekeys.rs index 77ff37a9ae6..47b9e37760e 100644 --- a/validator_client/src/http_api/remotekeys.rs +++ b/validator_client/src/http_api/remotekeys.rs @@ -8,7 +8,6 @@ use eth2::lighthouse_vc::std_types::{ ImportRemotekeyStatus, ImportRemotekeysRequest, ImportRemotekeysResponse, ListRemotekeysResponse, SingleListRemotekeysResponse, Status, }; -use slog::Logger; use slot_clock::SlotClock; use std::sync::Arc; use task_executor::TaskExecutor; diff --git a/validator_client/src/http_api/test_utils.rs b/validator_client/src/http_api/test_utils.rs index 8bb56e87a32..b430f655d02 100644 --- a/validator_client/src/http_api/test_utils.rs +++ b/validator_client/src/http_api/test_utils.rs @@ -115,7 +115,6 @@ impl ApiTester { slot_clock.clone(), &config, test_runtime.task_executor.clone(), - log.clone(), )); validator_store diff --git a/validator_client/src/http_metrics/mod.rs b/validator_client/src/http_metrics/mod.rs index 3dc3f254f11..826df491b39 100644 --- a/validator_client/src/http_metrics/mod.rs +++ b/validator_client/src/http_metrics/mod.rs @@ -8,7 +8,6 @@ use lighthouse_version::version_with_platform; use logging::crit; use parking_lot::RwLock; use serde::{Deserialize, Serialize}; -use slog::Logger; use slot_clock::SystemTimeSlotClock; use std::future::Future; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; diff --git a/validator_client/src/lib.rs b/validator_client/src/lib.rs index 97fa98ab415..394a018535d 100644 --- a/validator_client/src/lib.rs +++ b/validator_client/src/lib.rs @@ -440,7 +440,6 @@ impl ProductionValidatorClient { slot_clock.clone(), &config, context.executor.clone(), - log.clone(), )); // Ensure all validators are registered in doppelganger protection. diff --git a/validator_client/src/validator_store.rs b/validator_client/src/validator_store.rs index d078609724a..ab046cfcf08 100644 --- a/validator_client/src/validator_store.rs +++ b/validator_client/src/validator_store.rs @@ -11,7 +11,6 @@ use parking_lot::{Mutex, RwLock}; use slashing_protection::{ interchange::Interchange, InterchangeError, NotSafe, Safe, SlashingDatabase, }; -use slog::Logger; use slot_clock::SlotClock; use std::marker::PhantomData; use std::path::Path; @@ -66,7 +65,6 @@ pub struct ValidatorStore { slashing_protection_last_prune: Arc>, genesis_validators_root: Hash256, spec: Arc, - log: Logger, doppelganger_service: Option>, slot_clock: T, fee_recipient_process: Option
, @@ -92,7 +90,6 @@ impl ValidatorStore { slot_clock: T, config: &Config, task_executor: TaskExecutor, - log: Logger, ) -> Self { Self { validators: Arc::new(RwLock::new(validators)), @@ -100,7 +97,6 @@ impl ValidatorStore { slashing_protection_last_prune: Arc::new(Mutex::new(Epoch::new(0))), genesis_validators_root, spec: Arc::new(spec), - log, doppelganger_service, slot_clock, fee_recipient_process: config.fee_recipient,