From 93985258608b08532ab781b9cf1b113e04e8336a Mon Sep 17 00:00:00 2001 From: Gustavo Madeira Krieger Date: Wed, 14 Aug 2024 15:30:30 -0300 Subject: [PATCH] chore: improve logging --- offchain/advance-runner/src/broker.rs | 5 ++++- offchain/advance-runner/src/runner.rs | 4 ++-- offchain/authority-claimer/src/checker.rs | 6 ++++-- offchain/dispatcher/src/drivers/machine.rs | 5 +++-- offchain/dispatcher/src/machine/rollups_broker.rs | 4 ++-- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/offchain/advance-runner/src/broker.rs b/offchain/advance-runner/src/broker.rs index 0cf722597..12284a986 100644 --- a/offchain/advance-runner/src/broker.rs +++ b/offchain/advance-runner/src/broker.rs @@ -117,7 +117,10 @@ impl BrokerFacade { let should_enqueue_claim = match last_claim_event { Some(event) => { let last_claim = event.payload; - tracing::trace!(?last_claim, "got last claim from Redis"); + tracing::trace!( + ?last_claim, + "got last claim from broker stream" + ); let should_enqueue_claim = rollups_claim.epoch_index > last_claim.epoch_index; diff --git a/offchain/advance-runner/src/runner.rs b/offchain/advance-runner/src/runner.rs index ccd09479b..81736fcc3 100644 --- a/offchain/advance-runner/src/runner.rs +++ b/offchain/advance-runner/src/runner.rs @@ -125,13 +125,13 @@ impl Runner { .produce_outputs(proofs) .await .context(ProduceOutputsSnafu)?; - tracing::trace!("produced outputs in broker"); + tracing::trace!("produced outputs in broker stream"); self.broker .produce_rollups_claim(rollups_claim) .await .context(ProduceClaimSnafu)?; - tracing::info!("produced epoch claim"); + tracing::info!("produced epoch claim in broker stream"); } Err(source) => { if let ServerManagerError::EmptyEpochError { .. } = source { diff --git a/offchain/authority-claimer/src/checker.rs b/offchain/authority-claimer/src/checker.rs index 3ca293574..7479a8b0d 100644 --- a/offchain/authority-claimer/src/checker.rs +++ b/offchain/authority-claimer/src/checker.rs @@ -127,14 +127,16 @@ impl DuplicateChecker for DefaultDuplicateChecker { .flatten() // Back to only one Option .map(|claim| claim.last_index + 1) // Maps to a number .unwrap_or(0); // If None, unwrap to 0 + tracing::debug!("checking duplicate claim: expected_first_index={}, rollups_claim={:?}", + expected_first_index, rollups_claim); if rollups_claim.first_index == expected_first_index { - // This claim is the one the blockchain expects, so it is not considered duplicate. + // This claim is the one the blockchain expects, so it is not considered a duplicate. Ok(false) } else if rollups_claim.last_index < expected_first_index { // This claim is already on the blockchain. Ok(true) } else { - // This claim is not on blockchain, but it isn't the one blockchain expects. + // This claim is not on the blockchain, but it isn't the one the blockchain expects. // If this happens, there is a bug on the dispatcher. Err(DuplicateCheckerError::ClaimMismatch { expected_first_index, diff --git a/offchain/dispatcher/src/drivers/machine.rs b/offchain/dispatcher/src/drivers/machine.rs index f899aae51..ecab9a3d8 100644 --- a/offchain/dispatcher/src/drivers/machine.rs +++ b/offchain/dispatcher/src/drivers/machine.rs @@ -36,8 +36,9 @@ impl MachineDriver { } }; - let block = block.number.as_u64(); - context.finish_epoch_if_needed(block, broker).await?; + let block_number = block.number.as_u64(); + tracing::debug!("reacting to standalone block {}", block_number); + context.finish_epoch_if_needed(block_number, broker).await?; Ok(()) } diff --git a/offchain/dispatcher/src/machine/rollups_broker.rs b/offchain/dispatcher/src/machine/rollups_broker.rs index a2f729766..99daa425d 100644 --- a/offchain/dispatcher/src/machine/rollups_broker.rs +++ b/offchain/dispatcher/src/machine/rollups_broker.rs @@ -185,10 +185,10 @@ impl BrokerSend for BrokerFacade { tracing::info!(?inputs_sent_count, "finishing epoch"); let mut broker = self.broker.lock().await; - let status = self.broker_status(&mut broker).await?; + let status = self.broker_status(&mut broker).await?; // Epoch number gets incremented here! let event = build_next_finish_epoch(&status); - tracing::trace!(?event, "producing finish epoch event"); + tracing::info!(?event, "producing finish epoch event"); epoch_sanity_check!(event, inputs_sent_count);