Skip to content

Commit

Permalink
Merge pull request #3236 from dusk-network/reduce_logs
Browse files Browse the repository at this point in the history
Reduce logs
  • Loading branch information
fed-franz authored Dec 19, 2024
2 parents 2516ce0 + 9a8b881 commit 9c0c8b0
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 18 deletions.
4 changes: 2 additions & 2 deletions consensus/src/proposal/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use node_data::get_current_timestamp;
use node_data::ledger::IterationsInfo;
use node_data::message::Message;
use tokio::sync::Mutex;
use tracing::{debug, error, info};
use tracing::{debug, error};

use crate::commons::Database;
use crate::config;
Expand Down Expand Up @@ -137,7 +137,7 @@ impl<T: Operations + 'static, D: Database> ProposalStep<T, D> {
/// Waits until the next slot is reached
async fn wait_until_next_slot(tip_timestamp: u64) {
if let Some(delay) = Self::next_slot_in(tip_timestamp) {
info!(event = "next_slot", ?delay);
debug!(event = "Wait next block slot for validation", ?delay);
tokio::time::sleep(delay).await;
}
}
Expand Down
1 change: 0 additions & 1 deletion consensus/src/validation/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ impl<D: Database> MsgHandler for ValidationHandler<D> {
return Err(ConsensusError::InvalidVote(vote));
}
};
info!(event = "quorum reached", ?vote);

let vrmsg = self
.build_validation_result(sv, vote, quorum_type, &p.header())
Expand Down
2 changes: 1 addition & 1 deletion node/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl<N: Network, DB: database::DB, VM: vm::VMExecution>
recv = result_chan.recv() => {
match recv? {
Err(ConsensusError::Canceled(round)) => {
info!(event = "consensus canceled", round);
debug!(event = "consensus canceled", round);
}
Err(err) => {
// Internal consensus execution has terminated with an error
Expand Down
42 changes: 29 additions & 13 deletions node/src/chain/acceptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,20 +355,36 @@ impl<DB: database::DB, VM: vm::VMExecution, N: Network> Acceptor<N, DB, VM> {
| Payload::Validation(_)
| Payload::Ratification(_)
| Payload::ValidationQuorum(_) => {
// Process consensus msg only if they are for the current round
// or at most 10 rounds in the future
let msg_round = msg.header.round;
if msg_round > tip_height
&& msg_round <= (tip_height + MAX_ROUND_DISTANCE)
{
consensus_task.main_inbound.try_send(msg);
} else {
warn!(
event = "msg discarded",
topic = ?msg.topic(),
info = ?msg.header,
ray_id = msg.ray_id()
);

match msg_round {
// Discard messages from the past
r if r <= tip_height => {
debug!(
event = "Consensus msg discarded",
reason = "past round",
topic = ?msg.topic(),
info = ?msg.header,
ray_id = msg.ray_id()
);
}

// Discard messages too far from the future
r if r > tip_height + MAX_ROUND_DISTANCE => {
warn!(
event = "Consensus msg discarded",
reason = "too far in the future",
topic = ?msg.topic(),
info = ?msg.header,
ray_id = msg.ray_id()
);
}

_ => {
// Process consensus msg only if they are for the
// current round or at most 10 rounds in the future
consensus_task.main_inbound.try_send(msg);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion node/src/chain/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl Task {

let (all_num, eligible_num) = current.get_provisioners_info(ru.round);

info!(
debug!(
event = "spawn consensus",
id = self.task_id,
round = ru.round,
Expand Down

0 comments on commit 9c0c8b0

Please sign in to comment.