Skip to content

Commit

Permalink
Reduce unnecessary logs (#800)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaoticTempest authored Aug 5, 2024
1 parent eb05c22 commit d01771a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 31 deletions.
4 changes: 0 additions & 4 deletions chain-signatures/node/src/mesh/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ impl Pool {

async fn set_participants(&self, participants: &Participants) {
*self.connections.write().await = participants.clone();
tracing::debug!(
"Pool set participants to {:?}",
self.connections.read().await.keys_vec()
);
}

async fn set_potential_participants(&self, participants: &Participants) {
Expand Down
10 changes: 6 additions & 4 deletions chain-signatures/node/src/mesh/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,17 @@ impl Mesh {
.establish_participants(contract_state)
.await;
self.ping().await;

tracing::debug!(
active = ?self.active_participants.keys_vec(),
active_potential = ?self.active_potential_participants.keys_vec(),
"mesh pinging",
);
}

/// Ping the active participants such that we can see who is alive.
pub async fn ping(&mut self) {
self.active_participants = self.connections.ping().await;
tracing::debug!(
"Mesh.ping set active participants to {:?}",
self.active_participants.keys_vec()
);
self.active_potential_participants = self.connections.ping_potential().await;
}
}
6 changes: 0 additions & 6 deletions chain-signatures/node/src/protocol/cryptography.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,6 @@ impl CryptographicProtocol for RunningState {
) -> Result<NodeState, CryptographicError> {
let protocol_cfg = &ctx.cfg().protocol;
let active = ctx.mesh().active_participants();
tracing::debug!(
"RunningState.progress active participants: {:?} potential participants: {:?} me: {:?}",
active.keys_vec(),
ctx.mesh().potential_participants().await.keys_vec(),
ctx.me().await
);
if active.len() < self.threshold {
tracing::info!(
active = ?active.keys_vec(),
Expand Down
21 changes: 6 additions & 15 deletions chain-signatures/node/src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,13 @@ impl MpcSignProtocol {
};

let crypto_time = Instant::now();
tracing::debug!("State progress. Node state: {}", state);
let mut state = match state.progress(&mut self).await {
Ok(state) => {
tracing::debug!("Progress ok. New state: {}", state);
tracing::debug!("progress ok: {state}");
state
}
Err(err) => {
tracing::debug!("Progress error. State not changed");
tracing::info!("protocol unable to progress: {err:?}");
tracing::warn!("protocol unable to progress: {err:?}");
tokio::time::sleep(Duration::from_millis(100)).await;
continue;
}
Expand All @@ -303,19 +301,14 @@ impl MpcSignProtocol {

let consensus_time = Instant::now();
if let Some(contract_state) = contract_state {
tracing::debug!(
"State advance. Node state: {}, contract state: {:?}",
state,
contract_state
);
let from_state = format!("{state}");
state = match state.advance(&mut self, contract_state).await {
Ok(state) => {
tracing::debug!("Advance ok. New node state: {}", state);
tracing::debug!("advance ok: {from_state} => {state}");
state
}
Err(err) => {
tracing::debug!("Advance error. State not changed");
tracing::info!("protocol unable to advance: {err:?}");
tracing::warn!("protocol unable to advance: {err:?}");
tokio::time::sleep(Duration::from_millis(100)).await;
continue;
}
Expand All @@ -327,9 +320,7 @@ impl MpcSignProtocol {

let message_time = Instant::now();
if let Err(err) = state.handle(&self, &mut queue).await {
tracing::info!("protocol unable to handle messages: {err:?}");
tokio::time::sleep(Duration::from_millis(100)).await;
continue;
tracing::warn!("protocol unable to handle messages: {err:?}");
}
crate::metrics::PROTOCOL_LATENCY_ITER_MESSAGE
.with_label_values(&[my_account_id.as_str()])
Expand Down
6 changes: 4 additions & 2 deletions chain-signatures/node/src/protocol/presignature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ impl PresignatureGenerator {

pub fn poke(&mut self) -> Result<Action<PresignOutput<Secp256k1>>, ProtocolError> {
if self.timestamp.elapsed() > self.timeout {
tracing::info!(
let id = hash_as_id(self.triple0, self.triple1);
tracing::warn!(
presignature_id = id,
self.triple0,
self.triple1,
self.mine,
Expand Down Expand Up @@ -392,8 +394,8 @@ impl PresignatureManager {
}

pub fn take_mine(&mut self) -> Option<Presignature> {
tracing::info!(mine = ?self.mine, "my presignatures");
let my_presignature_id = self.mine.pop_front()?;
tracing::debug!(my_presignature_id, "take presignature of mine");
// SAFETY: This unwrap is safe because taking mine will always succeed since it is only
// present when generation completes where the determination of ownership is made.
Some(self.take(my_presignature_id).unwrap())
Expand Down

0 comments on commit d01771a

Please sign in to comment.