Skip to content

Commit

Permalink
consensus: update INFO logs
Browse files Browse the repository at this point in the history
  • Loading branch information
fed-franz committed Dec 20, 2024
1 parent e32667e commit 68d5a49
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 18 deletions.
7 changes: 4 additions & 3 deletions consensus/src/aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,11 @@ impl<V: StepVote> Aggregator<V> {
let quorum_reached = total >= quorum_target;
if quorum_reached {
tracing::info!(
event = "quorum reached",
?vote,
iter = v.header().iteration,
event = "Quorum reached",
step = ?V::STEP_NAME,
round = v.header().round,
iter = v.header().iteration,
?vote,
total,
target = quorum_target,
bitset,
Expand Down
16 changes: 5 additions & 11 deletions consensus/src/execution_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,11 @@ impl<'a, T: Operations + 'static, DB: Database> ExecutionCtx<'a, T, DB> {
let step_timeout = self.iter_ctx.get_timeout(step);
let timeout = step_timeout + additional_timeout.unwrap_or_default();

info!(
event = "Start Step",
debug!(
event = "Start step loop",
?step,
round,
iter,
?timeout,
?step_timeout,
?additional_timeout
);
Expand All @@ -167,13 +166,6 @@ impl<'a, T: Operations + 'static, DB: Database> ExecutionCtx<'a, T, DB> {
.process_inbound_msg(phase.clone(), msg.clone())
.await
{
info!(
event = "Step completed",
round,
?step,
info = ?msg.header
);

// In the normal case, we just return the result
// to Consensus
if !open_consensus_mode {
Expand Down Expand Up @@ -352,9 +344,11 @@ impl<'a, T: Operations + 'static, DB: Database> ExecutionCtx<'a, T, DB> {
// Timeout event. Phase could not reach its final goal.
// Increase timeout for next execution of this step and move on.
Err(_) => {
info!(event = "Step timeout expired", round, iter, ?step);
info!(event = "Step timeout expired", ?step, round, iter);

if self.is_last_step() {
info!(event = "Step ended", ?step, round, iter);

// If the last step expires, we enter Open Consensus
// mode. In this mode, the last step (Ratification)
// keeps running indefinitely, until a block is
Expand Down
14 changes: 10 additions & 4 deletions consensus/src/phase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use node_data::message::Message;
use node_data::StepName;
use tracing::{debug, trace};
use tracing::{info, trace};

use crate::commons::Database;
use crate::execution_ctx::ExecutionCtx;
Expand Down Expand Up @@ -54,10 +54,16 @@ impl<T: Operations + 'static, D: Database + 'static> Phase<T, D> {
pub async fn run(&mut self, mut ctx: ExecutionCtx<'_, T, D>) -> Message {
ctx.set_start_time();

let timeout = ctx.iter_ctx.get_timeout(ctx.step_name());
debug!(event = "execute_step", ?timeout);
let step = ctx.step_name();
let round = ctx.round_update.round;
let iter = ctx.iteration;
let timeout = ctx.iter_ctx.get_timeout(step);

// Execute step
await_phase!(self, run(ctx))
info!(event = "Step started", ?step, round, iter, ?timeout);
let msg = await_phase!(self, run(ctx));
info!(event = "Step ended", ?step, round, iter);

msg
}
}
16 changes: 16 additions & 0 deletions consensus/src/proposal/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ impl<D: Database> MsgHandler for ProposalHandler<D> {
.store_candidate_block(p.candidate.clone())
.await;

info!(
event = "New Candidate",
hash = &to_str(&p.candidate.header().hash),
round = p.candidate.header().height,
iter = p.candidate.header().iteration,
prev_block = &to_str(&p.candidate.header().prev_block_hash)
);

Ok(StepOutcome::Ready(msg))
}

Expand All @@ -84,6 +92,14 @@ impl<D: Database> MsgHandler for ProposalHandler<D> {
.store_candidate_block(p.candidate.clone())
.await;

info!(
event = "New Candidate",
hash = &to_str(&p.candidate.header().hash),
round = p.candidate.header().height,
iter = p.candidate.header().iteration,
prev_block = &to_str(&p.candidate.header().prev_block_hash)
);

Ok(StepOutcome::Ready(msg))
}

Expand Down

0 comments on commit 68d5a49

Please sign in to comment.