Skip to content

Commit e85e8c3

Browse files
committed
CRC and fix test compilatation after merge
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent 6ff1668 commit e85e8c3

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

.github/workflows/bitcoin-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ jobs:
146146
- tests::signer::v0::single_miner_empty_sortition
147147
- tests::signer::v0::multiple_miners_empty_sortition
148148
- tests::signer::v0::block_proposal_timeout
149+
- tests::signer::v0::reorg_attempts_count_towards_miner_validity
149150
- tests::signer::v0::reorg_attempts_activity_timeout_exceeded
150-
- tests::signer::v0::late_reorg_attempts_do_not_count_towards_miner_validity
151151
- tests::signer::v0::allow_reorg_within_first_proposal_burn_block_timing_secs
152152
- tests::nakamoto_integrations::burn_ops_integration_test
153153
- tests::nakamoto_integrations::check_block_heights

stacks-signer/src/chainstate.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ pub struct ProposalEvalConfig {
124124
pub tenure_last_block_proposal_timeout: Duration,
125125
/// How much idle time must pass before allowing a tenure extend
126126
pub tenure_idle_timeout: Duration,
127-
/// Time following a block's global acceptance that a signer will consider an attempt by a miner to reorg the block
128-
/// as valid towards miner activity
127+
/// Time following the last block of the previous tenure's global acceptance that a signer will consider an attempt by
128+
/// the new miner to reorg it as valid towards miner activity
129129
pub reorg_attempts_activity_timeout: Duration,
130130
}
131131

@@ -574,10 +574,9 @@ impl SortitionsView {
574574
"proposed_chain_length" => block.header.chain_length,
575575
"expected_at_least" => info.block.header.chain_length + 1,
576576
);
577-
if info.signed_group.unwrap_or(get_epoch_time_secs())
578-
+ reorg_attempts_activity_timeout.as_secs()
579-
> get_epoch_time_secs()
580-
{
577+
if info.signed_group.map_or(true, |signed_time| {
578+
signed_time + reorg_attempts_activity_timeout.as_secs() > get_epoch_time_secs()
579+
}) {
581580
// Note if there is no signed_group time, this is a locally accepted block (i.e. tenure_last_block_proposal_timeout has not been exceeded).
582581
// Treat any attempt to reorg a locally accepted block as valid miner activity.
583582
// If the call returns a globally accepted block, check its globally accepted time against a quarter of the block_proposal_timeout

stacks-signer/src/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ pub struct SignerConfig {
142142
pub tenure_idle_timeout: Duration,
143143
/// The maximum age of a block proposal in seconds that will be processed by the signer
144144
pub block_proposal_max_age_secs: u64,
145-
/// Time following a block's global acceptance that a signer will consider an attempt by a miner to reorg the block
146-
/// as valid towards miner activity
145+
/// Time following the last block of the previous tenure's global acceptance that a signer will consider an attempt by
146+
/// the new miner to reorg it as valid towards miner activity
147147
pub reorg_attempts_activity_timeout: Duration,
148148
}
149149

@@ -185,8 +185,8 @@ pub struct GlobalConfig {
185185
pub tenure_idle_timeout: Duration,
186186
/// The maximum age of a block proposal that will be processed by the signer
187187
pub block_proposal_max_age_secs: u64,
188-
/// Time following a block's global acceptance that a signer will consider an attempt by a miner to reorg the block
189-
/// as valid towards miner activity
188+
/// Time following the last block of the previous tenure's global acceptance that a signer will consider an attempt by
189+
/// the new miner to reorg it as valid towards miner activity
190190
pub reorg_attempts_activity_timeout: Duration,
191191
}
192192

stacks-signer/src/signerdb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ impl SignerDb {
774774

775775
/// Return whether there was signed block in a tenure (identified by its consensus hash)
776776
pub fn has_signed_block_in_tenure(&self, tenure: &ConsensusHash) -> Result<bool, DBError> {
777-
let query = "SELECT block_info FROM blocks WHERE consensus_hash = ? AND signed_over = 1 ORDER BY stacks_height DESC LIMIT 1";
777+
let query = "SELECT block_info FROM blocks WHERE consensus_hash = ? AND signed_over = 1 DESC LIMIT 1";
778778
let result: Option<String> = query_row(&self.db, query, [tenure])?;
779779

780780
Ok(result.is_some())

testnet/stacks-node/src/tests/signer/v0.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11410,7 +11410,7 @@ fn reorg_attempts_activity_timeout_exceeded() {
1141011410

1141111411
info!("------------------------- Test Setup -------------------------");
1141211412
let num_signers = 5;
11413-
let sender_sk = Secp256k1PrivateKey::new();
11413+
let sender_sk = Secp256k1PrivateKey::random();
1141411414
let sender_addr = tests::to_addr(&sender_sk);
1141511415
let send_amt = 100;
1141611416
let send_fee = 180;

0 commit comments

Comments
 (0)