Skip to content

Commit 160b495

Browse files
authored
Merge pull request #5501 from stacks-network/release/3.0.0.0.3
merge Release/3.0.0.0.3 to master
2 parents 40059a5 + 01a04d0 commit 160b495

File tree

137 files changed

+16726
-7285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+16726
-7285
lines changed

.github/actions/dockerfiles/Dockerfile.debian-source

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ RUN --mount=type=tmpfs,target=${BUILD_DIR} cp -R /src/. ${BUILD_DIR}/ \
2424
&& cp -R ${BUILD_DIR}/target/${TARGET}/release/. /out
2525

2626
FROM --platform=${TARGETPLATFORM} debian:bookworm
27-
COPY --from=build /out/stacks-node /out/stacks-signer /bin/
27+
COPY --from=build /out/stacks-node /out/stacks-signer /out/stacks-inspect /bin/
2828
CMD ["stacks-node", "mainnet"]

.github/workflows/bitcoin-tests.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ jobs:
9999
- tests::signer::v0::forked_tenure_okay
100100
- tests::signer::v0::forked_tenure_invalid
101101
- tests::signer::v0::empty_sortition
102+
- tests::signer::v0::empty_sortition_before_approval
103+
- tests::signer::v0::empty_sortition_before_proposal
102104
- tests::signer::v0::bitcoind_forking_test
103105
- tests::signer::v0::multiple_miners
104106
- tests::signer::v0::mock_sign_epoch_25
@@ -112,6 +114,7 @@ jobs:
112114
- tests::signer::v0::locally_accepted_blocks_overriden_by_global_rejection
113115
- tests::signer::v0::locally_rejected_blocks_overriden_by_global_acceptance
114116
- tests::signer::v0::reorg_locally_accepted_blocks_across_tenures_succeeds
117+
- tests::signer::v0::reorg_locally_accepted_blocks_across_tenures_fails
115118
- tests::signer::v0::miner_recovers_when_broadcast_block_delay_across_tenures_occurs
116119
- tests::signer::v0::multiple_miners_with_nakamoto_blocks
117120
- tests::signer::v0::partial_tenure_fork
@@ -120,6 +123,10 @@ jobs:
120123
- tests::signer::v0::signing_in_0th_tenure_of_reward_cycle
121124
- tests::signer::v0::continue_after_tenure_extend
122125
- tests::signer::v0::multiple_miners_with_custom_chain_id
126+
- tests::signer::v0::block_commit_delay
127+
- tests::signer::v0::continue_after_fast_block_no_sortition
128+
- tests::signer::v0::block_validation_response_timeout
129+
- tests::signer::v0::tenure_extend_after_bad_commit
123130
- tests::nakamoto_integrations::burn_ops_integration_test
124131
- tests::nakamoto_integrations::check_block_heights
125132
- tests::nakamoto_integrations::clarity_burn_state
@@ -133,6 +140,10 @@ jobs:
133140
- tests::nakamoto_integrations::utxo_check_on_startup_panic
134141
- tests::nakamoto_integrations::utxo_check_on_startup_recover
135142
- tests::nakamoto_integrations::v3_signer_api_endpoint
143+
- tests::nakamoto_integrations::test_shadow_recovery
144+
- tests::nakamoto_integrations::signer_chainstate
145+
- tests::nakamoto_integrations::clarity_cost_spend_down
146+
- tests::nakamoto_integrations::v3_blockbyheight_api_endpoint
136147
# TODO: enable these once v1 signer is supported by a new nakamoto epoch
137148
# - tests::signer::v1::dkg
138149
# - tests::signer::v1::sign_request_rejected

.github/workflows/p2p-tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ jobs:
4242
- net::tests::convergence::test_walk_star_15_pingback
4343
- net::tests::convergence::test_walk_star_15_org_biased
4444
- net::tests::convergence::test_walk_inbound_line_15
45+
- net::api::tests::postblock_proposal::test_try_make_response
46+
- net::server::tests::test_http_10_threads_getinfo
47+
- net::server::tests::test_http_10_threads_getblock
48+
- net::server::tests::test_http_too_many_clients
49+
- net::server::tests::test_http_slow_client
4550
steps:
4651
## Setup test environment
4752
- name: Setup Test Environment

CHANGELOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,48 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
77

88
## [Unreleased]
99

10+
### Added
11+
12+
### Changed
13+
14+
15+
## [3.0.0.0.3]
16+
17+
### Added
18+
19+
### Changed
20+
- Add index for StacksBlockId to nakamoto block headers table (improves node performance)
21+
- Remove the panic for reporting DB deadlocks (just error and continue waiting)
22+
- Add index to `metadata_table` in Clarity DB on `blockhash`
23+
- Add `block_commit_delay_ms` to the config file to control the time to wait after seeing a new burn block, before submitting a block commit, to allow time for the first Nakamoto block of the new tenure to be mined, allowing this miner to avoid the need to RBF the block commit.
24+
- Add `tenure_cost_limit_per_block_percentage` to the miner config file to control the percentage remaining tenure cost limit to consume per nakamoto block.
25+
- Add `/v3/blocks/height/:block_height` rpc endpoint
26+
- If the winning miner of a sortition is committed to the wrong parent tenure, the previous miner can immediately tenure extend and continue mining since the winning miner would never be able to propose a valid block. (#5361)
27+
28+
## [3.0.0.0.2]
29+
30+
### Added
31+
32+
### Changed
33+
- Fixes a few bugs in the relayer and networking stack
34+
- detects and deprioritizes unhealthy replicas
35+
- fixes an issue in the p2p stack which was preventing it from caching the reward set.
36+
37+
## [3.0.0.0.1]
38+
39+
### Changed
40+
- Add index for StacksBlockId to nakamoto block headers table (improves node performance)
41+
- Remove the panic for reporting DB deadlocks (just error and continue waiting)
42+
- Various test fixes for CI (5353, 5368, 5372, 5371, 5380, 5378, 5387, 5396, 5390, 5394)
43+
- Various log fixes:
44+
- don't say proceeding to mine blocks if not a miner
45+
- misc. warns downgraded to debugs
46+
- 5391: Update default block proposal timeout to 10 minutes
47+
- 5406: After block rejection, miner pauses
48+
- Docs fixes
49+
- Fix signer docs link
50+
- Specify burn block in clarity docs
51+
1052
## [3.0.0.0.0]
1153

1254
### Added

Cargo.lock

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ rand = "0.8"
2121
rand_chacha = "0.3.1"
2222
tikv-jemallocator = "0.5.4"
2323
rusqlite = { version = "0.31.0", features = ["blob", "serde_json", "i128_blob", "bundled", "trace"] }
24+
thiserror = { version = "1.0.65" }
2425

2526
# Use a bit more than default optimization for
2627
# dev builds to speed up test execution

clarity/src/vm/costs/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,7 @@ impl LimitedCostTracker {
896896
Self::Free => ExecutionCost::max_value(),
897897
}
898898
}
899+
899900
pub fn get_memory(&self) -> u64 {
900901
match self {
901902
Self::Limited(TrackerData { memory, .. }) => *memory,
@@ -1170,6 +1171,7 @@ pub trait CostOverflowingMath<T> {
11701171
fn cost_overflow_mul(self, other: T) -> Result<T>;
11711172
fn cost_overflow_add(self, other: T) -> Result<T>;
11721173
fn cost_overflow_sub(self, other: T) -> Result<T>;
1174+
fn cost_overflow_div(self, other: T) -> Result<T>;
11731175
}
11741176

11751177
impl CostOverflowingMath<u64> for u64 {
@@ -1185,6 +1187,10 @@ impl CostOverflowingMath<u64> for u64 {
11851187
self.checked_sub(other)
11861188
.ok_or_else(|| CostErrors::CostOverflow)
11871189
}
1190+
fn cost_overflow_div(self, other: u64) -> Result<u64> {
1191+
self.checked_div(other)
1192+
.ok_or_else(|| CostErrors::CostOverflow)
1193+
}
11881194
}
11891195

11901196
impl ExecutionCost {
@@ -1293,6 +1299,15 @@ impl ExecutionCost {
12931299
Ok(())
12941300
}
12951301

1302+
pub fn divide(&mut self, divisor: u64) -> Result<()> {
1303+
self.runtime = self.runtime.cost_overflow_div(divisor)?;
1304+
self.read_count = self.read_count.cost_overflow_div(divisor)?;
1305+
self.read_length = self.read_length.cost_overflow_div(divisor)?;
1306+
self.write_length = self.write_length.cost_overflow_div(divisor)?;
1307+
self.write_count = self.write_count.cost_overflow_div(divisor)?;
1308+
Ok(())
1309+
}
1310+
12961311
/// Returns whether or not this cost exceeds any dimension of the
12971312
/// other cost.
12981313
pub fn exceeds(&self, other: &ExecutionCost) -> bool {

clarity/src/vm/database/sqlite.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ impl SqliteConnection {
248248
)
249249
.map_err(|x| InterpreterError::SqliteError(IncomparableError { err: x }))?;
250250

251+
conn.execute(
252+
"CREATE INDEX IF NOT EXISTS md_blockhashes ON metadata_table(blockhash)",
253+
NO_PARAMS,
254+
)
255+
.map_err(|x| InterpreterError::SqliteError(IncomparableError { err: x }))?;
256+
251257
Self::check_schema(conn)?;
252258

253259
Ok(())

clarity/src/vm/docs/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,17 +1775,17 @@ this value is less than or equal to the value for `miner-spend-total` at the sam
17751775
const GET_BURN_BLOCK_INFO_API: SpecialAPI = SpecialAPI {
17761776
input_type: "BurnBlockInfoPropertyName, uint",
17771777
output_type: "(optional buff) | (optional (tuple (addrs (list 2 (tuple (hashbytes (buff 32)) (version (buff 1))))) (payout uint)))",
1778-
snippet: "get-burn-block-info? ${1:prop} ${2:block-height}",
1779-
signature: "(get-burn-block-info? prop-name block-height)",
1778+
snippet: "get-burn-block-info? ${1:prop} ${2:burn-block-height}",
1779+
signature: "(get-burn-block-info? prop-name burn-block-height)",
17801780
description: "The `get-burn-block-info?` function fetches data for a block of the given *burnchain* block height. The
1781-
value and type returned are determined by the specified `BlockInfoPropertyName`. Valid values for `block-height` only
1781+
value and type returned are determined by the specified `BlockInfoPropertyName`. Valid values for `burn-block-height` only
17821782
include heights between the burnchain height at the time the Stacks chain was launched, and the last-processed burnchain
1783-
block. If the `block-height` argument falls outside of this range, then `none` shall be returned.
1783+
block. If the `burn-block-height` argument falls outside of this range, then `none` shall be returned.
17841784
17851785
The following `BlockInfoPropertyName` values are defined:
17861786
17871787
* The `header-hash` property returns a 32-byte buffer representing the header hash of the burnchain block at
1788-
burnchain height `block-height`.
1788+
burnchain height `burn-block-height`.
17891789
17901790
* The `pox-addrs` property returns a tuple with two items: a list of up to two PoX addresses that received a PoX payout at that block height, and the amount of burnchain
17911791
tokens paid to each address (note that per the blockchain consensus rules, each PoX payout will be the same for each address in the block-commit transaction).
@@ -1811,11 +1811,11 @@ The `addrs` list contains the same PoX address values passed into the PoX smart
18111811

18121812
const GET_STACKS_BLOCK_INFO_API: SpecialAPI = SpecialAPI {
18131813
input_type: "StacksBlockInfoPropertyName, uint",
1814-
snippet: "get-stacks-block-info? ${1:prop} ${2:block-height}",
1814+
snippet: "get-stacks-block-info? ${1:prop} ${2:stacks-block-height}",
18151815
output_type: "(optional buff) | (optional uint)",
1816-
signature: "(get-stacks-block-info? prop-name block-height)",
1816+
signature: "(get-stacks-block-info? prop-name stacks-block-height)",
18171817
description: "The `get-stacks-block-info?` function fetches data for a block of the given *Stacks* block height. The
1818-
value and type returned are determined by the specified `StacksBlockInfoPropertyName`. If the provided `block-height` does
1818+
value and type returned are determined by the specified `StacksBlockInfoPropertyName`. If the provided `stacks-block-height` does
18191819
not correspond to an existing block prior to the current block, the function returns `none`. The currently available property names
18201820
are as follows:
18211821
@@ -1840,11 +1840,11 @@ the mining of this block started, but is not guaranteed to be accurate. This tim
18401840

18411841
const GET_TENURE_INFO_API: SpecialAPI = SpecialAPI {
18421842
input_type: "TenureInfoPropertyName, uint",
1843-
snippet: "get-tenure-info? ${1:prop} ${2:block-height}",
1843+
snippet: "get-tenure-info? ${1:prop} ${2:stacks-block-height}",
18441844
output_type: "(optional buff) | (optional uint)",
1845-
signature: "(get-tenure-info? prop-name block-height)",
1845+
signature: "(get-tenure-info? prop-name stacks-block-height)",
18461846
description: "The `get-tenure-info?` function fetches data for the tenure at the given block height. The
1847-
value and type returned are determined by the specified `TenureInfoPropertyName`. If the provided `block-height` does
1847+
value and type returned are determined by the specified `TenureInfoPropertyName`. If the provided `stacks-block-height` does
18481848
not correspond to an existing block prior to the current block, the function returns `none`. The currently available property names
18491849
are as follows:
18501850

docs/mining.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,26 @@ nakamoto_attempt_time_ms = 20000
1919
[burnchain]
2020
# Maximum amount (in sats) of "burn commitment" to broadcast for the next block's leader election
2121
burn_fee_cap = 20000
22-
# Amount (in sats) per byte - Used to calculate the transaction fees
23-
satoshis_per_byte = 25
24-
# Amount of sats to add when RBF'ing bitcoin tx (default: 5)
22+
# Amount in sats per byte used to calculate the Bitcoin transaction fee (default: 50)
23+
satoshis_per_byte = 50
24+
# Amount of sats per byte to add when RBF'ing a Bitcoin tx (default: 5)
2525
rbf_fee_increment = 5
26-
# Maximum percentage to RBF bitcoin tx (default: 150% of satsv/B)
26+
# Maximum percentage of satoshis_per_byte to allow in RBF fee (default: 150)
2727
max_rbf = 150
2828
```
2929

30+
NOTE: Ensuring that your miner can successfully use RBF (Replace-by-Fee) is
31+
critical for reliable block production. If a miner fails to replace an outdated
32+
block commit with a higher-fee transaction, it risks committing to an incorrect
33+
tenure. This would prevent the miner from producing valid blocks during its
34+
tenure, as it would be building on an invalid chain tip, causing the signers to
35+
reject its blocks.
36+
37+
To avoid this, configure satoshis_per_byte, rbf_fee_increment, and max_rbf to
38+
allow for at least three fee increments within the max_rbf limit. This helps
39+
ensure that your miner can adjust its fees sufficiently to stay on the canonical
40+
chain.
41+
3042
You can verify that your node is operating as a miner by checking its log output
3143
to verify that it was able to find its Bitcoin UTXOs:
3244

0 commit comments

Comments
 (0)