Skip to content

Commit 13a71b2

Browse files
committed
crc: code improvements from feedback
1 parent 2499c16 commit 13a71b2

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

stacks-signer/src/chainstate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub struct ProposalEvalConfig {
144144
/// Time to wait before submitting a block proposal to the stacks-node
145145
pub proposal_wait_for_parent_time: Duration,
146146
/// How many blocks after a fork should we reset the replay set,
147-
/// as a failsafe mechanism?
147+
/// as a failsafe mechanism
148148
pub reset_replay_set_after_fork_blocks: u64,
149149
}
150150

stacks-signer/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const DEFAULT_TENURE_IDLE_TIMEOUT_BUFFER_SECS: u64 = 2;
5151
const DEFAULT_PROPOSAL_WAIT_TIME_FOR_PARENT_SECS: u64 = 15;
5252
/// Default number of blocks after a fork to reset the replay set,
5353
/// as a failsafe mechanism
54-
const DEFAULT_RESET_REPLAY_SET_AFTER_FORK_BLOCKS: u64 = 2;
54+
pub const DEFAULT_RESET_REPLAY_SET_AFTER_FORK_BLOCKS: u64 = 2;
5555

5656
#[derive(thiserror::Error, Debug)]
5757
/// An error occurred parsing the provided configuration

stacks-signer/src/v0/signer_state.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,8 @@ impl LocalStateMachine {
641641
proposal_config.reset_replay_set_after_fork_blocks,
642642
)? {
643643
info!(
644-
"Signer state: replay set is stalled after 2 tenures. Clearing the replay set."
644+
"Signer state: replay set is stalled after {} tenures. Clearing the replay set.",
645+
proposal_config.reset_replay_set_after_fork_blocks
645646
);
646647
tx_replay_set = ReplayTransactionSet::none();
647648
*tx_replay_scope = None;
@@ -1246,7 +1247,7 @@ impl LocalStateMachine {
12461247
match replay_state {
12471248
ReplayState::Unset => {
12481249
// not in replay - skip
1249-
return Ok(false);
1250+
Ok(false)
12501251
}
12511252
ReplayState::InProgress(_, replay_scope) => {
12521253
let failsafe_height =

testnet/stacks-node/src/tests/nakamoto_integrations.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ use stacks_common::util::hash::{to_hex, Hash160, Sha512Trunc256Sum};
103103
use stacks_common::util::secp256k1::{MessageSignature, Secp256k1PrivateKey, Secp256k1PublicKey};
104104
use stacks_common::util::{get_epoch_time_secs, sleep_ms};
105105
use stacks_signer::chainstate::{ProposalEvalConfig, SortitionsView};
106+
use stacks_signer::config::DEFAULT_RESET_REPLAY_SET_AFTER_FORK_BLOCKS;
106107
use stacks_signer::signerdb::{BlockInfo, BlockState, ExtraBlockInfo, SignerDb};
107108
use stacks_signer::v0::SpawnedSigner;
108109

@@ -6589,7 +6590,7 @@ fn signer_chainstate() {
65896590
tenure_idle_timeout: Duration::from_secs(300),
65906591
tenure_idle_timeout_buffer: Duration::from_secs(2),
65916592
reorg_attempts_activity_timeout: Duration::from_secs(30),
6592-
reset_replay_set_after_fork_blocks: 2,
6593+
reset_replay_set_after_fork_blocks: DEFAULT_RESET_REPLAY_SET_AFTER_FORK_BLOCKS,
65936594
};
65946595
let mut sortitions_view =
65956596
SortitionsView::fetch_view(proposal_conf, &signer_client).unwrap();
@@ -6717,7 +6718,7 @@ fn signer_chainstate() {
67176718
tenure_idle_timeout: Duration::from_secs(300),
67186719
tenure_idle_timeout_buffer: Duration::from_secs(2),
67196720
reorg_attempts_activity_timeout: Duration::from_secs(30),
6720-
reset_replay_set_after_fork_blocks: 2,
6721+
reset_replay_set_after_fork_blocks: DEFAULT_RESET_REPLAY_SET_AFTER_FORK_BLOCKS,
67216722
};
67226723
let burn_block_height = SortitionDB::get_canonical_burn_chain_tip(sortdb.conn())
67236724
.unwrap()
@@ -6796,7 +6797,7 @@ fn signer_chainstate() {
67966797
tenure_idle_timeout: Duration::from_secs(300),
67976798
tenure_idle_timeout_buffer: Duration::from_secs(2),
67986799
reorg_attempts_activity_timeout: Duration::from_secs(30),
6799-
reset_replay_set_after_fork_blocks: 2,
6800+
reset_replay_set_after_fork_blocks: DEFAULT_RESET_REPLAY_SET_AFTER_FORK_BLOCKS,
68006801
};
68016802
let mut sortitions_view = SortitionsView::fetch_view(proposal_conf, &signer_client).unwrap();
68026803
sortitions_view

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4219,7 +4219,6 @@ fn tx_replay_disagreement() {
42194219
/// The test flow is:
42204220
///
42214221
/// - Boot to Epoch 3
4222-
/// - Mine 3 tenures
42234222
/// - Submit 2 STX Transfer txs (Tx1, Tx2) in the last tenure
42244223
/// - Trigger a Bitcoin fork (3 blocks)
42254224
/// - Verify that signers move into tx replay state [Tx1, Tx2]
@@ -4937,7 +4936,6 @@ fn tx_replay_with_fork_causing_replay_to_be_cleared_due_to_cycle() {
49374936
/// The test flow is:
49384937
///
49394938
/// - Boot to Epoch 3
4940-
/// - Mine 10 tenures (to handle multiple fork in Cycle 12)
49414939
/// - Deploy 1 Big Contract and mine 2 tenures (to escape fork)
49424940
/// - Submit 2 Contract Call txs (Tx1, Tx2) in the last tenure,
49434941
/// requiring Tenure Extend due to Tenure Budget exceeded
@@ -5102,7 +5100,6 @@ fn tx_replay_with_fork_middle_replay_while_tenure_extending() {
51025100
/// The test flow is:
51035101
///
51045102
/// - Boot to Epoch 3
5105-
/// - Mine 10 tenures (to handle multiple fork in Cycle 12)
51065103
/// - Deploy 1 Big Contract and mine 2 tenures (to escape fork)
51075104
/// - Submit 2 Contract Call txs (Tx1, Tx2) in the last tenure,
51085105
/// requiring Tenure Extend due to Tenure Budget exceeded

0 commit comments

Comments
 (0)