From f31898d3607d5aa4f5ac7fe642ae61eee89b81f9 Mon Sep 17 00:00:00 2001 From: Joey Yandle Date: Tue, 14 Jan 2025 10:11:41 -0500 Subject: [PATCH] remove extraneous assert; fix boolean cache name; use short name when logging vars --- src/state_machine/coordinator/mod.rs | 1 - src/state_machine/signer/mod.rs | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/state_machine/coordinator/mod.rs b/src/state_machine/coordinator/mod.rs index 2e42a8a..544679e 100644 --- a/src/state_machine/coordinator/mod.rs +++ b/src/state_machine/coordinator/mod.rs @@ -1117,7 +1117,6 @@ pub mod test { } } - assert_eq!(outbound_messages.len(), 1); let messages = outbound_messages.clone(); let result = feedback_messages_with_errors(&mut coordinators, &mut signers, &messages); assert!(result.is_ok()); diff --git a/src/state_machine/signer/mod.rs b/src/state_machine/signer/mod.rs index ce4fe46..91aac7d 100644 --- a/src/state_machine/signer/mod.rs +++ b/src/state_machine/signer/mod.rs @@ -573,16 +573,16 @@ impl Signer { // increment by one until self.total_signers - 1. So the checks // here should be sufficient for catching empty signer ID sets, // duplicate signer IDs, or unknown signer IDs. - let is_valid_request = sign_request.nonce_responses.len() != signer_id_set.len() + let is_invalid_request = sign_request.nonce_responses.len() != signer_id_set.len() || signer_id_set.is_empty() || signer_id_set.last() >= Some(&self.total_signers); - if is_valid_request { + if is_invalid_request { warn!("received an invalid SignatureShareRequest"); return Err(Error::InvalidNonceResponse); } - debug!(%self.signer_id, "received a valid SignatureShareRequest"); + debug!(signer_id = %self.signer_id, "received a valid SignatureShareRequest"); if signer_id_set.contains(&self.signer_id) { let key_ids: Vec = sign_request