Skip to content

Commit 917907a

Browse files
Logging cleanup
1 parent fd56b8b commit 917907a

File tree

6 files changed

+34
-31
lines changed

6 files changed

+34
-31
lines changed

eth1/src/download_manager.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::sync::Arc;
33
use anyhow::{Context as _, Result};
44
use eth1_api::{Eth1Api, Eth1ApiToMetrics, Eth1Block};
55
use futures::channel::mpsc::UnboundedSender;
6-
use log::{info, warn};
6+
use log::{debug, warn};
77
use prometheus_metrics::Metrics;
88
use reqwest::Client;
99
use std_ext::ArcExt as _;
@@ -100,7 +100,7 @@ impl DownloadManager {
100100
.await
101101
.context(Error::ConnectionError)?;
102102

103-
info!(
103+
debug!(
104104
"downloaded {} Eth1 blocks from block {from_block} to block {to_block}",
105105
blocks.len(),
106106
);
@@ -148,7 +148,7 @@ impl DownloadManager {
148148
let mut from_block = starting_block_number + 1;
149149

150150
if from_block <= latest_block_number {
151-
info!(
151+
debug!(
152152
"will download Eth1 deposits from block {} to block {}",
153153
from_block, latest_block_number,
154154
);
@@ -157,7 +157,7 @@ impl DownloadManager {
157157
while from_block <= latest_block_number {
158158
let to_block = latest_block_number.min(from_block + DEPOSIT_BATCH_SIZE - 1);
159159

160-
info!("downloading Eth1 deposits from block {from_block} to block {to_block}");
160+
debug!("downloading Eth1 deposits from block {from_block} to block {to_block}");
161161

162162
let deposit_event_map = self.api.get_deposit_events(from_block..=to_block).await?;
163163
let deposit_events = deposit_event_map.values().flatten().collect();

eth1/src/eth1_chain.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use futures::{
88
channel::mpsc::UnboundedSender,
99
stream::{Stream, TryStreamExt as _},
1010
};
11-
use log::{error, info};
11+
use log::{debug, error};
1212
use prometheus_metrics::Metrics;
1313
use reqwest::Client;
1414
use std_ext::ArcExt as _;
@@ -194,7 +194,7 @@ async fn download_deposits_and_blocks(
194194
eth1_api_to_metrics_tx: Option<UnboundedSender<Eth1ApiToMetrics>>,
195195
metrics: Option<Arc<Metrics>>,
196196
) -> Result<()> {
197-
info!(
197+
debug!(
198198
"started new Eth1 deposit download task (deposit contract {:?})",
199199
chain_config.deposit_contract_address,
200200
);
@@ -209,7 +209,7 @@ async fn download_deposits_and_blocks(
209209
);
210210

211211
loop {
212-
info!("started Eth1 deposit download task");
212+
debug!("started Eth1 deposit download task");
213213

214214
match download_manager.download_and_store_deposits().await {
215215
Ok(block_number) => {
@@ -228,7 +228,7 @@ async fn download_deposits_and_blocks(
228228
}
229229

230230
loop {
231-
info!("started Eth1 block download task");
231+
debug!("started Eth1 block download task");
232232

233233
if let Err(error) = download_manager.download_and_store_blocks().await {
234234
handle_error(&error);

fork_choice_store/src/store.rs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,17 +2026,27 @@ impl<P: Preset> Store<P> {
20262026
let justified_checkpoint_updated = old_justified_checkpoint != self.justified_checkpoint;
20272027
let finalized_checkpoint_updated = old_finalized_checkpoint != self.finalized_checkpoint;
20282028

2029-
// Temporary logging for debugging
2030-
if let Some(post_deneb_block_body) = chain_link.block.message().body().post_deneb() {
2031-
if self.should_check_data_availability_at_slot(chain_link.slot()) {
2032-
let blob_count = post_deneb_block_body.blob_kzg_commitments().len();
2033-
2034-
log::info!(
2035-
"imported {blob_count}/{blob_count} blobs for beacon block: {block_root:?}, slot: {}",
2036-
chain_link.slot()
2037-
);
2029+
let log_imported_block_info = || {
2030+
if let Some(post_deneb_block_body) = chain_link.block.message().body().post_deneb() {
2031+
if self.should_check_data_availability_at_slot(chain_link.slot()) {
2032+
let blob_count = post_deneb_block_body.blob_kzg_commitments().len();
2033+
2034+
log::info!(
2035+
"imported beacon block with {blob_count} blobs (slot: {}, {block_root:?}",
2036+
chain_link.slot(),
2037+
);
2038+
2039+
return;
2040+
}
20382041
}
2039-
}
2042+
2043+
log::info!(
2044+
"imported beacon block (slot: {}, {block_root:?})",
2045+
chain_link.slot(),
2046+
);
2047+
};
2048+
2049+
log_imported_block_info();
20402050

20412051
self.insert_block(chain_link)?;
20422052

p2p/src/block_sync_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ impl<P: Preset> BlockSyncService<P> {
368368
metrics.observe_block_duration_to_slot(block_slot_timestamp);
369369
}
370370

371-
info!(
371+
debug!(
372372
"received beacon block as gossip (slot: {block_slot}, root: {block_root:?}, \
373373
peer_id: {peer_id})"
374374
);

p2p/src/network.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ impl<P: Preset> Network<P> {
16011601

16021602
fn check_status(&self, local: &StatusMessage, remote: StatusMessage, peer_id: PeerId) {
16031603
if local.fork_digest != remote.fork_digest {
1604-
warn!(
1604+
debug!(
16051605
"local fork digest doesn't match remote fork digest \
16061606
(local: {local:?}, remote: {remote:?}, peer_id: {peer_id}); \
16071607
disconnecting from peer",
@@ -1660,7 +1660,7 @@ impl<P: Preset> Network<P> {
16601660

16611661
if let Some(root) = local_finalized_root_at_remote_finalized_epoch {
16621662
if root != remote.finalized_root {
1663-
warn!(
1663+
debug!(
16641664
"peer {peer_id} has different block finalized at epoch {} ({root:?} != {:?})",
16651665
remote.finalized_epoch, remote.finalized_root,
16661666
);
@@ -1932,7 +1932,7 @@ fn run_network_service<P: Preset>(
19321932
}
19331933
ServiceInboundMessage::SendRequest(peer_id, request_id, request) => {
19341934
if let Err(error) = service.send_request(peer_id, request_id, request) {
1935-
warn!("Unable to send request to peer: {peer_id}: {error:?}");
1935+
debug!("Unable to send request to peer: {peer_id}: {error:?}");
19361936
}
19371937
}
19381938
ServiceInboundMessage::SendResponse(peer_id, peer_request_id, request_id, response) => {

validator/src/validator.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use http_api_utils::EventChannels;
3838
use itertools::Itertools as _;
3939
use keymanager::ProposerConfigs;
4040
use liveness_tracker::ValidatorToLiveness;
41-
use log::{debug, error, info, log, warn, Level};
41+
use log::{debug, error, info, warn};
4242
use once_cell::sync::OnceCell;
4343
use operation_pools::{AttestationAggPool, Origin, PoolAdditionOutcome, SyncCommitteeAggPool};
4444
use p2p::{P2pToValidator, ToSubnetService, ValidatorToP2p};
@@ -484,14 +484,7 @@ impl<P: Preset, W: Wait + Sync> Validator<P, W> {
484484
&& self.registered_validators.is_empty()
485485
&& self.block_producer.no_prepared_proposers().await;
486486

487-
log!(
488-
if no_validators {
489-
Level::Debug
490-
} else {
491-
Level::Info
492-
},
493-
"{kind:?} tick in slot {slot}",
494-
);
487+
debug!("{kind:?} tick in slot {slot}");
495488

496489
let current_epoch = misc::compute_epoch_at_slot::<P>(slot);
497490

0 commit comments

Comments
 (0)