Skip to content

Commit c8cb3eb

Browse files
authored
Merge branch 'develop' into chore/add-http-traffic-heartbeat-log
2 parents b133a2a + 7b46ba3 commit c8cb3eb

File tree

9 files changed

+234
-65
lines changed

9 files changed

+234
-65
lines changed

.github/workflows/clippy.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ name: Clippy Checks
77
# Only run when:
88
# - PRs are (re)opened against develop branch
99
on:
10+
merge_group:
11+
types:
12+
- checks_requested
1013
pull_request:
1114
branches:
1215
- develop
@@ -34,4 +37,4 @@ jobs:
3437
components: clippy
3538
- name: Clippy
3639
id: clippy
37-
run: cargo clippy-stacks
40+
run: cargo clippy-stacks

.github/workflows/github-release.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,11 @@ jobs:
164164
## Create the downstream PR for the release branch to master,develop
165165
create-pr:
166166
if: |
167-
inputs.node_tag != '' ||
168-
inputs.signer_tag != ''
167+
!contains(github.ref, '-rc') &&
168+
(
169+
inputs.node_tag != '' ||
170+
inputs.signer_tag != ''
171+
)
169172
name: Create Downstream PR (${{ github.ref_name }})
170173
runs-on: ubuntu-latest
171174
needs:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
2020
- When a miner times out waiting for signatures, it will re-propose the same block instead of building a new block ([#5877](https://github.com/stacks-network/stacks-core/pull/5877))
2121
- Improve tenure downloader trace verbosity applying proper logging level depending on the tenure state ("debug" if unconfirmed, "info" otherwise) ([#5871](https://github.com/stacks-network/stacks-core/issues/5871))
2222
- Remove warning log about missing UTXOs when a node is configured as `miner` with `mock_mining` mode enabled ([#5841](https://github.com/stacks-network/stacks-core/issues/5841))
23+
- Deprecated the `wait_on_interim_blocks` option in the miner config file. This option is no longer needed, as the miner will always wait for interim blocks to be processed before mining a new block. To wait extra time in between blocks, use the `min_time_between_blocks_ms` option instead.
2324

2425
## [3.1.0.0.7]
2526

stacks-signer/src/signerdb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ impl SignerDb {
12641264
// Plus (ms + 999)/1000 to round up to the nearest second
12651265
let tenure_extend_timestamp = tenure_start_time
12661266
.saturating_add(tenure_idle_timeout_secs)
1267-
.saturating_add(tenure_process_time_ms.saturating_add(999) / 1000);
1267+
.saturating_add(tenure_process_time_ms.div_ceil(1000));
12681268
debug!("Calculated tenure extend timestamp";
12691269
"tenure_extend_timestamp" => tenure_extend_timestamp,
12701270
"tenure_start_time" => tenure_start_time,

stackslib/src/config/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,8 @@ pub struct MinerConfig {
21382138
pub unprocessed_block_deadline_secs: u64,
21392139
pub mining_key: Option<Secp256k1PrivateKey>,
21402140
/// Amount of time while mining in nakamoto to wait in between mining interim blocks
2141-
pub wait_on_interim_blocks: Duration,
2141+
/// DEPRECATED: use `min_time_between_blocks_ms` instead
2142+
pub wait_on_interim_blocks: Option<Duration>,
21422143
/// minimum number of transactions that must be in a block if we're going to replace a pending
21432144
/// block-commit with a new block-commit
21442145
pub min_tx_count: u64,
@@ -2209,7 +2210,7 @@ impl Default for MinerConfig {
22092210
candidate_retry_cache_size: 1024 * 1024,
22102211
unprocessed_block_deadline_secs: 30,
22112212
mining_key: None,
2212-
wait_on_interim_blocks: Duration::from_millis(2_500),
2213+
wait_on_interim_blocks: None,
22132214
min_tx_count: 0,
22142215
only_increase_tx_count: false,
22152216
unconfirmed_commits_helper: None,
@@ -2733,8 +2734,7 @@ impl MinerConfigFile {
27332734
.transpose()?,
27342735
wait_on_interim_blocks: self
27352736
.wait_on_interim_blocks_ms
2736-
.map(Duration::from_millis)
2737-
.unwrap_or(miner_default_config.wait_on_interim_blocks),
2737+
.map(Duration::from_millis),
27382738
min_tx_count: self
27392739
.min_tx_count
27402740
.unwrap_or(miner_default_config.min_tx_count),
@@ -2789,7 +2789,7 @@ impl MinerConfigFile {
27892789
pre_nakamoto_mock_signing: self
27902790
.pre_nakamoto_mock_signing
27912791
.unwrap_or(pre_nakamoto_mock_signing), // Should only default true if mining key is set
2792-
min_time_between_blocks_ms: self.min_time_between_blocks_ms.map(|ms| if ms < DEFAULT_MIN_TIME_BETWEEN_BLOCKS_MS {
2792+
min_time_between_blocks_ms: self.min_time_between_blocks_ms.map(|ms| if ms < DEFAULT_MIN_TIME_BETWEEN_BLOCKS_MS {
27932793
warn!("miner.min_time_between_blocks_ms is less than the minimum allowed value of {DEFAULT_MIN_TIME_BETWEEN_BLOCKS_MS} ms. Using the default value instead.");
27942794
DEFAULT_MIN_TIME_BETWEEN_BLOCKS_MS
27952795
} else {

testnet/stacks-node/src/nakamoto_node/miner.rs

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,9 @@ impl BlockMinerThread {
643643
"block_height" => new_block.header.chain_length,
644644
"consensus_hash" => %new_block.header.consensus_hash,
645645
);
646+
647+
// We successfully mined, so the mempool caches are valid.
648+
self.reset_nonce_cache = false;
646649
}
647650

648651
// update mined-block counters and mined-tenure counters
@@ -660,20 +663,35 @@ impl BlockMinerThread {
660663
self.mined_blocks += 1;
661664
}
662665

663-
let Ok(sort_db) = SortitionDB::open(
664-
&self.config.get_burn_db_file_path(),
665-
true,
666-
self.burnchain.pox_constants.clone(),
667-
) else {
668-
error!("Failed to open sortition DB. Will try mining again.");
669-
return Ok(());
670-
};
666+
if let Some(last_block_mined) = &self.last_block_mined {
667+
// Wait until the last block mined has been processed
668+
loop {
669+
let (_, processed, _, _) = chain_state
670+
.nakamoto_blocks_db()
671+
.get_block_processed_and_signed_weight(
672+
&last_block_mined.header.consensus_hash,
673+
&last_block_mined.header.block_hash(),
674+
)?
675+
.ok_or_else(|| NakamotoNodeError::UnexpectedChainState)?;
676+
677+
if processed {
678+
break;
679+
}
680+
681+
thread::sleep(Duration::from_millis(ABORT_TRY_AGAIN_MS));
671682

672-
let wait_start = Instant::now();
673-
while wait_start.elapsed() < self.config.miner.wait_on_interim_blocks {
674-
thread::sleep(Duration::from_millis(ABORT_TRY_AGAIN_MS));
675-
if self.check_burn_tip_changed(&sort_db).is_err() {
676-
return Err(NakamotoNodeError::BurnchainTipChanged);
683+
// Check if the burnchain tip has changed
684+
let Ok(sort_db) = SortitionDB::open(
685+
&self.config.get_burn_db_file_path(),
686+
false,
687+
self.burnchain.pox_constants.clone(),
688+
) else {
689+
error!("Failed to open sortition DB. Will try mining again.");
690+
return Ok(());
691+
};
692+
if self.check_burn_tip_changed(&sort_db).is_err() {
693+
return Err(NakamotoNodeError::BurnchainTipChanged);
694+
}
677695
}
678696
}
679697

0 commit comments

Comments
 (0)