Skip to content

Commit adb82c7

Browse files
committed
fix: revert changes and improve readability
1 parent 3b10d21 commit adb82c7

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

stacks-signer/CHANGELOG.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
1313
- Introduced `capitulate_miner_view_timeout_secs`: the duration (in seconds) for the signer to wait between updating the local state machine viewpoint and capitulating to other signers' miner views.
1414
- Added codepath to enable signers to evaluate block proposals and miner activity against global signer state for improved consistency and correctness. Currently feature gated behind the `SUPPORTED_SIGNER_PROTOCOL_VERSION`
1515

16-
### Fixed
17-
18-
- Fixed a bug where signers would incorrectly reject block proposals if the parent block was globally accepted and the signer hadn't signed it within the `tenure_last_block_proposal_timeout` period; if it is globally accepted, the signer should accept it regardless of the timeout.
19-
2016
## [3.1.0.0.13.0]
2117

2218
### Changed

stacks-signer/src/chainstate/mod.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,10 @@ impl SortitionData {
262262
Ok(true)
263263
}
264264

265-
/// Get the last locally signed block from the given tenure if it has not timed out
265+
/// Get the last signed block from the given tenure if it has not timed out.
266+
/// Even globally accepted blocks are allowed to be timed out, as that
267+
/// triggers the signer to consult the Stacks node for the latest globally
268+
/// accepted block. This is needed to handle Bitcoin reorgs correctly.
266269
pub fn get_tenure_last_block_info(
267270
consensus_hash: &ConsensusHash,
268271
signer_db: &SignerDb,
@@ -277,27 +280,22 @@ impl SortitionData {
277280
return Ok(None);
278281
};
279282

280-
// If the last accepted block was globally accepted, return it
281-
if block_info.state == BlockState::GloballyAccepted {
282-
return Ok(Some(block_info));
283-
}
284-
285-
// If the last accepted block was locally accepted, check if it has timed out
286283
let Some(signed_over_time) = block_info.signed_self else {
287284
return Ok(None);
288285
};
289286

290287
if signed_over_time.saturating_add(tenure_last_block_proposal_timeout.as_secs())
291288
> get_epoch_time_secs()
292289
{
293-
// The last locally accepted block is not timed out, return it
290+
// The last accepted block is not timed out, return it
294291
Ok(Some(block_info))
295292
} else {
296-
// The last locally accepted block is timed out
293+
// The last accepted block is timed out
297294
info!(
298-
"Last locally accepted block has timed out";
295+
"Last accepted block has timed out";
299296
"signer_signature_hash" => %block_info.block.header.signer_signature_hash(),
300297
"signed_over_time" => signed_over_time,
298+
"state" => block_info.state,
301299
);
302300
Ok(None)
303301
}

0 commit comments

Comments
 (0)