Skip to content

Commit

Permalink
Merge pull request #5257 from stacks-network/feat/add-block-height-logs
Browse files Browse the repository at this point in the history
add Nakamoto block heights to info logs for easier integration with log analysis tools
  • Loading branch information
ASuciuX authored Oct 3, 2024
2 parents a62b9ad + 10eb397 commit 9c914cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions stacks-signer/src/chainstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ impl SortitionsView {
{
info!(
"Current miner timed out, marking as invalid.";
"block_height" => block.header.chain_length,
"current_sortition_consensus_hash" => ?self.cur_sortition.consensus_hash,
);
self.cur_sortition.miner_status = SortitionMinerStatus::InvalidatedBeforeFirstBlock;
Expand All @@ -203,6 +204,7 @@ impl SortitionsView {
if last_sortition.is_timed_out(self.config.block_proposal_timeout, signer_db)? {
info!(
"Last miner timed out, marking as invalid.";
"block_height" => block.header.chain_length,
"last_sortition_consensus_hash" => ?last_sortition.consensus_hash,
);
last_sortition.miner_status = SortitionMinerStatus::InvalidatedBeforeFirstBlock;
Expand Down Expand Up @@ -365,6 +367,7 @@ impl SortitionsView {
"sortition_state.consensus_hash" => %sortition_state.consensus_hash,
"sortition_state.prior_sortition" => %sortition_state.prior_sortition,
"sortition_state.parent_tenure_id" => %sortition_state.parent_tenure_id,
"block_height" => block.header.chain_length,
);

let tenures_reorged = client.get_tenure_forking_info(
Expand Down Expand Up @@ -424,6 +427,7 @@ impl SortitionsView {
"Miner is not building off of most recent tenure. A tenure they reorg has already mined blocks, but the block was poorly timed, allowing the reorg.";
"proposed_block_consensus_hash" => %block.header.consensus_hash,
"proposed_block_signer_sighash" => %block.header.signer_signature_hash(),
"proposed_block_height" => block.header.chain_length,
"parent_tenure" => %sortition_state.parent_tenure_id,
"last_sortition" => %sortition_state.prior_sortition,
"violating_tenure_id" => %tenure.consensus_hash,
Expand Down Expand Up @@ -596,6 +600,7 @@ impl SortitionsView {
"Have no accepted blocks in the tenure, assuming block confirmation is correct";
"proposed_block_consensus_hash" => %block.header.consensus_hash,
"proposed_block_signer_sighash" => %block.header.signer_signature_hash(),
"proposed_block_height" => block.header.chain_length,
);
return Ok(true);
};
Expand Down
2 changes: 2 additions & 0 deletions stacks-signer/src/v0/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ impl SignerTrait<SignerMessage> for Signer {
info!(
"{self}: Got block pushed message";
"block_id" => %b.block_id(),
"block_height" => b.header.chain_length,
"signer_sighash" => %b.header.signer_signature_hash(),
);
stacks_client.post_block_until_ok(self, &b);
Expand Down Expand Up @@ -352,6 +353,7 @@ impl Signer {
"{self}: received a block proposal for a new block. Submit block for validation. ";
"signer_sighash" => %signer_signature_hash,
"block_id" => %block_proposal.block.block_id(),
"block_height" => block_proposal.block.header.chain_length,
"burn_height" => block_proposal.burn_height,
);
crate::monitoring::increment_block_proposals_received();
Expand Down

0 comments on commit 9c914cf

Please sign in to comment.