Skip to content

Commit

Permalink
Merge pull request #1539 from EspressoSystems/ed/reduce-logging-2
Browse files Browse the repository at this point in the history
Reduce logging more
  • Loading branch information
elliedavidson authored Aug 10, 2023
2 parents 32f0aad + c2e6e07 commit 3792b49
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 63 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>> SystemContext<TYPES::Consens
initializer: HotShotInitializer<TYPES, I::Leaf>,
metrics: Box<dyn Metrics>,
) -> Result<Self, HotShotError<TYPES>> {
info!("Creating a new hotshot");
debug!("Creating a new hotshot");

let consensus_metrics = Arc::new(ConsensusMetrics::new(
&*metrics.subgroup("consensus".to_string()),
Expand Down
4 changes: 2 additions & 2 deletions src/traits/election/static_committee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use jf_primitives::signatures::BLSSignatureScheme;
use serde::{Deserialize, Serialize};
use std::marker::PhantomData;
use std::num::NonZeroU64;
use tracing::info;
use tracing::debug;

/// Dummy implementation of [`Membership`]

Expand Down Expand Up @@ -154,7 +154,7 @@ where
fn create_election(keys: Vec<PUBKEY>, config: TYPES::ElectionConfigType) -> Self {
let mut committee_nodes = keys.clone();
committee_nodes.truncate(config.num_nodes.try_into().unwrap());
info!("Election Membership Size: {}", config.num_nodes);
debug!("Election Membership Size: {}", config.num_nodes);
Self {
nodes: keys,
committee_nodes,
Expand Down
16 changes: 6 additions & 10 deletions src/traits/networking/web_server_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ use std::{
time::Duration,
};
use surf_disco::error::ClientError;
use tracing::{debug, error, info, warn};
use tracing::{debug, error, info};
/// Represents the communication channel abstraction for the web server
#[derive(Clone, Debug)]
pub struct WebCommChannel<
Expand Down Expand Up @@ -182,7 +182,7 @@ impl<M: NetworkMsg, KEY: SignatureKey, ELECTIONCONFIG: ElectionConfig, TYPES: No

if message_purpose == MessagePurpose::Data {
tx_index = *self.tx_index.read().await;
warn!("Previous tx index was {}", tx_index);
debug!("Previous tx index was {}", tx_index);
};

while self.running.load(Ordering::Relaxed) {
Expand Down Expand Up @@ -232,10 +232,6 @@ impl<M: NetworkMsg, KEY: SignatureKey, ELECTIONCONFIG: ElectionConfig, TYPES: No
error!("We should not receive transactions in this function");
}
MessagePurpose::Proposal => {
// warn!(
// "Received proposal from web server for view {} {}",
// view_number, self.is_da
// );
// Only pushing the first proposal since we will soon only be allowing 1 proposal per view
self.broadcast_poll_queue
.write()
Expand Down Expand Up @@ -266,7 +262,7 @@ impl<M: NetworkMsg, KEY: SignatureKey, ELECTIONCONFIG: ElectionConfig, TYPES: No
}
}
MessagePurpose::DAC => {
warn!(
debug!(
"Received DAC from web server for view {} {}",
view_number, self.is_da
);
Expand Down Expand Up @@ -335,7 +331,7 @@ impl<M: NetworkMsg, KEY: SignatureKey, ELECTIONCONFIG: ElectionConfig, TYPES: No
| ConsensusIntentEvent::CancelPollForViewSyncCertificate(event_view)
| ConsensusIntentEvent::CancelPollForViewSyncVotes(event_view) => {
if view_number == event_view {
warn!("Shutting down polling task for view {}", event_view);
debug!("Shutting down polling task for view {}", event_view);
return Ok(());
}
}
Expand All @@ -346,7 +342,7 @@ impl<M: NetworkMsg, KEY: SignatureKey, ELECTIONCONFIG: ElectionConfig, TYPES: No
*lock = tx_index;

if view_number == event_view {
warn!("Shutting down polling task for view {}", event_view);
debug!("Shutting down polling task for view {}", event_view);
return Ok(());
}
}
Expand Down Expand Up @@ -1027,7 +1023,7 @@ impl<
.send(ConsensusIntentEvent::CancelPollForTransactions(view_number))
.await;
} else {
error!("Task map entry should have existed");
info!("Task map entry should have existed");
};
}

Expand Down
48 changes: 24 additions & 24 deletions task-impls/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ use std::marker::PhantomData;
use std::sync::Arc;
#[cfg(feature = "tokio-executor")]
use tokio::task::JoinHandle;
use tracing::{debug, error, info, instrument, warn};
use tracing::{debug, error, instrument};

#[derive(Snafu, Debug)]
pub struct ConsensusTaskError {}
Expand Down Expand Up @@ -237,7 +237,7 @@ where
return (None, state);
}
Either::Right(qc) => {
warn!("QCFormed! {:?}", qc.view_number);
debug!("QCFormed! {:?}", qc.view_number);
state
.event_stream
.publish(SequencingHotShotEvent::QCFormed(qc.clone()))
Expand Down Expand Up @@ -384,7 +384,7 @@ where
);

if let GeneralConsensusMessage::Vote(vote) = message {
warn!(
debug!(
"Sending vote to next quorum leader {:?}",
vote.current_view()
);
Expand Down Expand Up @@ -464,7 +464,7 @@ where

// TODO ED Only publish event in vote if able
if let GeneralConsensusMessage::Vote(vote) = message {
warn!(
debug!(
"Sending vote to next quorum leader {:?}",
vote.current_view()
);
Expand All @@ -476,13 +476,13 @@ where
}
}
}
warn!(
debug!(
"Couldn't find DAC cert in certs, meaning we haven't received it yet for view {:?}",
*proposal.get_view_number(),
);
return false;
}
warn!(
debug!(
"Could not vote because we don't have a proposal yet for view {}",
*self.cur_view
);
Expand All @@ -494,7 +494,7 @@ where

async fn update_view(&mut self, new_view: ViewNumber) -> bool {
if *self.cur_view < *new_view {
warn!(
debug!(
"Updating view from {} to {} in consensus task",
*self.cur_view, *new_view
);
Expand Down Expand Up @@ -522,7 +522,7 @@ where
.await;

if self.quorum_exchange.is_leader(self.cur_view + 1) {
warn!("Polling for quorum votes for view {}", *self.cur_view);
debug!("Polling for quorum votes for view {}", *self.cur_view);
self.quorum_exchange
.network()
.inject_consensus_info(ConsensusIntentEvent::PollForVotes(*self.cur_view))
Expand Down Expand Up @@ -856,7 +856,7 @@ where
.outstanding_transactions_memory_size
.update(-(i64::try_from(included_txn_size).unwrap_or(i64::MAX)));

warn!("about to publish decide");
debug!("about to publish decide");
let decide_sent = self.output_event_stream.publish(Event {
view_number: consensus.last_decided_view,
event: EventType::Decide {
Expand Down Expand Up @@ -917,7 +917,7 @@ where
self.update_view(new_view).await;

if let GeneralConsensusMessage::Vote(vote) = message {
info!("Sending vote to next leader {:?}", vote);
debug!("Sending vote to next leader {:?}", vote);
// warn!("Vote is {:?}", vote.current_view());

// self.event_stream
Expand All @@ -928,7 +928,7 @@ where
}
}
SequencingHotShotEvent::QuorumVoteRecv(vote) => {
warn!("Received quroum vote: {:?}", vote.current_view());
debug!("Received quroum vote: {:?}", vote.current_view());

if !self.quorum_exchange.is_leader(vote.current_view() + 1) {
error!(
Expand Down Expand Up @@ -1010,7 +1010,7 @@ where
let _task = async_spawn(async move {
VoteCollectionTypes::build(builder).launch().await;
});
warn!("Starting vote handle for view {:?}", vote.current_view);
debug!("Starting vote handle for view {:?}", vote.current_view);
} else if let Some((_, _, stream_id)) = self.vote_collector {
self.event_stream
.direct_message(
Expand All @@ -1026,7 +1026,7 @@ where
}
}
SequencingHotShotEvent::QCFormed(qc) => {
warn!("QC Formed event happened!");
debug!("QC Formed event happened!");

let mut consensus = self.consensus.write().await;
consensus.high_qc = qc.clone();
Expand Down Expand Up @@ -1058,7 +1058,7 @@ where
// warn!("Handle qc formed event!");
// TODO ED Why isn't cur view correct here?
// // So we don't create a QC on the first view unless we are the leader
warn!(
debug!(
"Attempting to publish proposal after forming a QC for view {}",
*qc.view_number
);
Expand All @@ -1068,7 +1068,7 @@ where
}
}
SequencingHotShotEvent::DACRecv(cert) => {
warn!("DAC Recved for view ! {}", *cert.view_number);
debug!("DAC Recved for view ! {}", *cert.view_number);

let view = cert.view_number;
self.certs.insert(view, cert);
Expand All @@ -1084,7 +1084,7 @@ where
}

SequencingHotShotEvent::ViewChange(new_view) => {
warn!("View Change event for view {}", *new_view);
debug!("View Change event for view {}", *new_view);

let old_view_number = self.cur_view;

Expand Down Expand Up @@ -1144,7 +1144,7 @@ where
let mut next_parent_hash = original_parent_hash;

if !reached_decided {
warn!("not reached decide fro view {:?}", self.cur_view);
debug!("not reached decide fro view {:?}", self.cur_view);
while let Some(next_parent_leaf) = consensus.saved_leaves.get(&next_parent_hash)
{
if next_parent_leaf.view_number <= consensus.last_decided_view {
Expand All @@ -1153,7 +1153,7 @@ where
next_parent_hash = next_parent_leaf.parent_commitment;
}
// TODO do some sort of sanity check on the view number that it matches decided
warn!("updated saved leaves");
debug!("updated saved leaves");
}

let block_commitment = self.block.commit();
Expand Down Expand Up @@ -1186,8 +1186,8 @@ where
data: proposal,
signature,
};
// warn!("Sending proposal for view {:?} \n {:?}", self.cur_view, message.clone());
warn!("Sending proposal for view {:?}", message.data.clone());
// debug!("Sending proposal for view {:?} \n {:?}", self.cur_view, message.clone());
debug!("Sending proposal for view {:?}", message.data.clone());

self.event_stream
.publish(SequencingHotShotEvent::QuorumProposalSend(
Expand All @@ -1210,7 +1210,7 @@ where
}
SequencingHotShotEvent::SendDABlockData(block) => {
// ED TODO Should make sure this is actually the most recent block
// warn!("Updating self . block!");
// debug!("Updating self . block!");
self.block = block;
}
_ => {}
Expand Down Expand Up @@ -1267,20 +1267,20 @@ where

// Walk back until we find a decide
if !reached_decided {
warn!("not reached decide fro view {:?}", self.cur_view);
debug!("not reached decide fro view {:?}", self.cur_view);
while let Some(next_parent_leaf) = consensus.saved_leaves.get(&next_parent_hash) {
if next_parent_leaf.view_number <= consensus.last_decided_view {
break;
}
next_parent_hash = next_parent_leaf.parent_commitment;
}
warn!("updated saved leaves");
debug!("updated saved leaves");
// TODO do some sort of sanity check on the view number that it matches decided
}

let block_commitment = self.block.commit();
if block_commitment == TYPES::BlockType::new().commit() {
warn!("Block is generic block! {:?}", self.cur_view);
debug!("Block is generic block! {:?}", self.cur_view);
}
// warn!(
// "leaf commitment of new qc: {:?}",
Expand Down
18 changes: 9 additions & 9 deletions task-impls/src/da.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ where
{
match event {
SequencingHotShotEvent::DAVoteRecv(vote) => {
warn!("DA vote recv, collection task {:?}", vote.current_view);
debug!("DA vote recv, collection task {:?}", vote.current_view);
// panic!("Vote handle received DA vote for view {}", *vote.current_view);

// For the case where we receive votes after we've made a certificate
if state.accumulator.is_right() {
warn!("DA accumulator finished view: {:?}", state.cur_view);
debug!("DA accumulator finished view: {:?}", state.cur_view);
return (None, state);
}

Expand All @@ -172,11 +172,11 @@ where
) {
Left(acc) => {
state.accumulator = Either::Left(acc);
// warn!("Not enough DA votes! ");
// debug!("Not enough DA votes! ");
return (None, state);
}
Right(dac) => {
warn!("Sending DAC! {:?}", dac.view_number);
debug!("Sending DAC! {:?}", dac.view_number);
state
.event_stream
.publish(SequencingHotShotEvent::DACSend(
Expand Down Expand Up @@ -260,7 +260,7 @@ where
return None;
}
SequencingHotShotEvent::DAProposalRecv(proposal, sender) => {
warn!(
debug!(
"DA proposal received for view: {:?}",
proposal.data.get_view_number()
);
Expand Down Expand Up @@ -312,7 +312,7 @@ where
// self.cur_view = view;

if let CommitteeConsensusMessage::DAVote(vote) = message {
warn!("Sending vote to the DA leader {:?}", vote.current_view);
debug!("Sending vote to the DA leader {:?}", vote.current_view);
self.event_stream
.publish(SequencingHotShotEvent::DAVoteSend(vote))
.await;
Expand Down Expand Up @@ -432,7 +432,7 @@ where
.contains(self.committee_exchange.public_key());

if is_da {
warn!("Polling for DA proposals for view {}", *self.cur_view + 1);
debug!("Polling for DA proposals for view {}", *self.cur_view + 1);
self.committee_exchange
.network()
.inject_consensus_info(ConsensusIntentEvent::PollForProposal(
Expand All @@ -441,7 +441,7 @@ where
.await;
}
if self.committee_exchange.is_leader(self.cur_view + 3) {
warn!("Polling for transactions for view {}", *self.cur_view + 3);
debug!("Polling for transactions for view {}", *self.cur_view + 3);
self.committee_exchange
.network()
.inject_consensus_info(ConsensusIntentEvent::PollForTransactions(
Expand Down Expand Up @@ -519,7 +519,7 @@ where
// Upon entering a new view we want to send a DA Proposal for the next view -> Is it always the case that this is cur_view + 1?
view_number: self.cur_view + 1,
};
warn!("Sending DA proposal for view {:?}", data.view_number);
debug!("Sending DA proposal for view {:?}", data.view_number);

// let message = SequencingMessage::<TYPES, I>(Right(
// CommitteeConsensusMessage::DAProposal(Proposal { data, signature }),
Expand Down
Loading

0 comments on commit 3792b49

Please sign in to comment.