diff --git a/CHANGELOG.md b/CHANGELOG.md index 226f7b5159..d8c569dff9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE ### Changed - Miner will include other transactions in blocks with tenure extend transactions (#5760) +- Various logging improvements ## [3.1.0.0.4] diff --git a/testnet/stacks-node/src/nakamoto_node/signer_coordinator.rs b/testnet/stacks-node/src/nakamoto_node/signer_coordinator.rs index 58d5f2da89..3d51cf8f1c 100644 --- a/testnet/stacks-node/src/nakamoto_node/signer_coordinator.rs +++ b/testnet/stacks-node/src/nakamoto_node/signer_coordinator.rs @@ -298,9 +298,9 @@ impl SignerCoordinator { block_signer_sighash, EVENT_RECEIVER_POLL, |status| { - status.total_weight_signed < self.weight_threshold + status.total_weight_approved < self.weight_threshold && status - .total_reject_weight + .total_weight_rejected .saturating_add(self.weight_threshold) <= self.total_weight }, @@ -341,18 +341,18 @@ impl SignerCoordinator { }; if block_status - .total_reject_weight + .total_weight_rejected .saturating_add(self.weight_threshold) > self.total_weight { info!( "{}/{} signers vote to reject block", - block_status.total_reject_weight, self.total_weight; + block_status.total_weight_rejected, self.total_weight; "block_signer_sighash" => %block_signer_sighash, ); counters.bump_naka_rejected_blocks(); return Err(NakamotoNodeError::SignersRejected); - } else if block_status.total_weight_signed >= self.weight_threshold { + } else if block_status.total_weight_approved >= self.weight_threshold { info!("Received enough signatures, block accepted"; "block_signer_sighash" => %block_signer_sighash, ); diff --git a/testnet/stacks-node/src/nakamoto_node/stackerdb_listener.rs b/testnet/stacks-node/src/nakamoto_node/stackerdb_listener.rs index 834c59fa95..68a8af3b92 100644 --- a/testnet/stacks-node/src/nakamoto_node/stackerdb_listener.rs +++ b/testnet/stacks-node/src/nakamoto_node/stackerdb_listener.rs @@ -54,8 +54,8 @@ pub static EVENT_RECEIVER_POLL: Duration = Duration::from_millis(500); pub struct BlockStatus { pub responded_signers: HashSet, pub gathered_signatures: BTreeMap, - pub total_weight_signed: u32, - pub total_reject_weight: u32, + pub total_weight_approved: u32, + pub total_weight_rejected: u32, } #[derive(Debug, Clone)] @@ -312,14 +312,17 @@ impl StackerDBListener { "signer_slot_id" => slot_id, "signature" => %signature, "signer_weight" => signer_entry.weight, - "total_weight_signed" => block.total_weight_signed, + "total_weight_approved" => block.total_weight_approved, + "percent_approved" => block.total_weight_approved as f64 / self.total_weight as f64 * 100.0, + "total_weight_rejected" => block.total_weight_rejected, + "percent_rejected" => block.total_weight_rejected as f64 / self.total_weight as f64 * 100.0, ); continue; } if !block.gathered_signatures.contains_key(&slot_id) { - block.total_weight_signed = block - .total_weight_signed + block.total_weight_approved = block + .total_weight_approved .checked_add(signer_entry.weight) .expect("FATAL: total weight signed exceeds u32::MAX"); } @@ -330,14 +333,18 @@ impl StackerDBListener { "signer_slot_id" => slot_id, "signature" => %signature, "signer_weight" => signer_entry.weight, - "total_weight_signed" => block.total_weight_signed, + "total_weight_approved" => block.total_weight_approved, + "percent_approved" => block.total_weight_approved as f64 / self.total_weight as f64 * 100.0, + "total_weight_rejected" => block.total_weight_rejected, + "percent_rejected" => block.total_weight_rejected as f64 / self.total_weight as f64 * 100.0, + "weight_threshold" => self.weight_threshold, "tenure_extend_timestamp" => tenure_extend_timestamp, "server_version" => metadata.server_version, ); block.gathered_signatures.insert(slot_id, signature); block.responded_signers.insert(signer_pubkey); - if block.total_weight_signed >= self.weight_threshold { + if block.total_weight_approved >= self.weight_threshold { // Signal to anyone waiting on this block that we have enough signatures cvar.notify_all(); } @@ -378,8 +385,8 @@ impl StackerDBListener { } }; block.responded_signers.insert(rejected_pubkey); - block.total_reject_weight = block - .total_reject_weight + block.total_weight_rejected = block + .total_weight_rejected .checked_add(signer_entry.weight) .expect("FATAL: total weight rejected exceeds u32::MAX"); @@ -389,7 +396,11 @@ impl StackerDBListener { "signer_slot_id" => slot_id, "signature" => %rejected_data.signature, "signer_weight" => signer_entry.weight, - "total_weight_signed" => block.total_weight_signed, + "total_weight_approved" => block.total_weight_approved, + "percent_approved" => block.total_weight_approved as f64 / self.total_weight as f64 * 100.0, + "total_weight_rejected" => block.total_weight_rejected, + "percent_rejected" => block.total_weight_rejected as f64 / self.total_weight as f64 * 100.0, + "weight_threshold" => self.weight_threshold, "reason" => rejected_data.reason, "reason_code" => %rejected_data.reason_code, "tenure_extend_timestamp" => rejected_data.response_data.tenure_extend_timestamp, @@ -397,7 +408,7 @@ impl StackerDBListener { ); if block - .total_reject_weight + .total_weight_rejected .saturating_add(self.weight_threshold) > self.total_weight { @@ -479,8 +490,8 @@ impl StackerDBListenerComms { let block_status = BlockStatus { responded_signers: HashSet::new(), gathered_signatures: BTreeMap::new(), - total_weight_signed: 0, - total_reject_weight: 0, + total_weight_approved: 0, + total_weight_rejected: 0, }; blocks.insert(block.signer_signature_hash(), block_status); }