Skip to content

Commit d4980dd

Browse files
authored
Merge pull request #6269 from obycode/chore/block-acceptance-logs
chore: add signer info logs for acceptance/rejections
2 parents 3f1966d + b7d68b8 commit d4980dd

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

stacks-signer/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to the versioning scheme outlined in the [README.md](README.md).
77

8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Added `info` logs to the signer to provide more visibility into the block approval/rejection status
13+
814
## [3.1.0.0.13.0]
915

1016
### Changed

stacks-signer/src/v0/signer.rs

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,9 +1425,28 @@ impl Signer {
14251425
});
14261426
if total_reject_weight.saturating_add(min_weight) <= total_weight {
14271427
// Not enough rejection signatures to make a decision
1428+
info!("{self}: Received block rejection";
1429+
"signer_pubkey" => public_key.to_hex(),
1430+
"signer_signature_hash" => %block_hash,
1431+
"consensus_hash" => %block_info.block.header.consensus_hash,
1432+
"block_height" => block_info.block.header.chain_length,
1433+
"reject_reason" => ?rejection.response_data.reject_reason,
1434+
"total_weight_rejected" => total_reject_weight,
1435+
"total_weight" => total_weight,
1436+
"percent_rejected" => (total_reject_weight as f64 / total_weight as f64 * 100.0),
1437+
);
14281438
return;
14291439
}
1430-
info!("{self}: {total_reject_weight}/{total_weight} signers voted to reject the block {block_hash}");
1440+
info!("{self}: Received block rejection and have reached the rejection threshold";
1441+
"signer_pubkey" => public_key.to_hex(),
1442+
"signer_signature_hash" => %block_hash,
1443+
"consensus_hash" => %block_info.block.header.consensus_hash,
1444+
"block_height" => block_info.block.header.chain_length,
1445+
"reject_reason" => ?rejection.response_data.reject_reason,
1446+
"total_weight_rejected" => total_reject_weight,
1447+
"total_weight" => total_weight,
1448+
"percent_rejected" => (total_reject_weight as f64 / total_weight as f64 * 100.0),
1449+
);
14311450
if let Err(e) = self.signer_db.mark_block_globally_rejected(&mut block_info) {
14321451
warn!("{self}: Failed to mark block as globally rejected: {e:?}",);
14331452
}
@@ -1544,12 +1563,26 @@ impl Signer {
15441563
});
15451564

15461565
if min_weight > signature_weight {
1547-
debug!(
1548-
"{self}: Not enough signatures on block {} (have {}, need at least {}/{})",
1549-
block_hash, signature_weight, min_weight, total_weight
1566+
info!("{self}: Received block acceptance";
1567+
"signer_pubkey" => public_key.to_hex(),
1568+
"signer_signature_hash" => %block_hash,
1569+
"consensus_hash" => %block_info.block.header.consensus_hash,
1570+
"block_height" => block_info.block.header.chain_length,
1571+
"total_weight_approved" => signature_weight,
1572+
"total_weight" => total_weight,
1573+
"percent_approved" => (signature_weight as f64 / total_weight as f64 * 100.0),
15501574
);
15511575
return;
15521576
}
1577+
info!("{self}: Received block acceptance and have reached the threshold";
1578+
"signer_pubkey" => public_key.to_hex(),
1579+
"signer_signature_hash" => %block_hash,
1580+
"consensus_hash" => %block_info.block.header.consensus_hash,
1581+
"block_height" => block_info.block.header.chain_length,
1582+
"total_weight_approved" => signature_weight,
1583+
"total_weight" => total_weight,
1584+
"percent_approved" => (signature_weight as f64 / total_weight as f64 * 100.0),
1585+
);
15531586

15541587
// have enough signatures to broadcast!
15551588
// move block to LOCALLY accepted state.

0 commit comments

Comments
 (0)