Skip to content

Commit ed29147

Browse files
authored
Merge branch 'develop' into fix/clippy-ci-unnecessary-lazy-evaluations
2 parents 5b79ec2 + fc92d18 commit ed29147

Some content is hidden

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

82 files changed

+1503
-1419
lines changed

.github/workflows/bitcoin-tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
# - tests::neon_integrations::size_overflow_unconfirmed_microblocks_integration_test
5555
# - tests::neon_integrations::size_overflow_unconfirmed_stream_microblocks_integration_test
5656
# - tests::neon_integrations::runtime_overflow_unconfirmed_microblocks_integration_test
57+
# - tests::epoch_25::microblocks_disabled
5758
# Disable this flaky test. Microblocks are no longer supported anyways.
5859
# - tests::neon_integrations::microblock_large_tx_integration_test_FLAKY
5960
- tests::neon_integrations::miner_submit_twice
@@ -80,7 +81,6 @@ jobs:
8081
- tests::neon_integrations::bitcoin_reorg_flap
8182
- tests::neon_integrations::bitcoin_reorg_flap_with_follower
8283
- tests::neon_integrations::start_stop_bitcoind
83-
- tests::epoch_25::microblocks_disabled
8484
- tests::should_succeed_handling_malformed_and_valid_txs
8585
- tests::nakamoto_integrations::simple_neon_integration
8686
- tests::nakamoto_integrations::flash_blocks_on_epoch_3
@@ -141,6 +141,8 @@ jobs:
141141
- tests::signer::v0::incoming_signers_ignore_block_proposals
142142
- tests::signer::v0::outgoing_signers_ignore_block_proposals
143143
- tests::signer::v0::injected_signatures_are_ignored_across_boundaries
144+
- tests::signer::v0::block_proposal_timeout
145+
- tests::signer::v0::rejected_blocks_count_towards_miner_validity
144146
- tests::nakamoto_integrations::burn_ops_integration_test
145147
- tests::nakamoto_integrations::check_block_heights
146148
- tests::nakamoto_integrations::clarity_burn_state

.github/workflows/ci.yml

Lines changed: 16 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,10 @@ jobs:
112112
## - commit to either (development, master) branch
113113
create-cache:
114114
if: |
115-
needs.check-release.outputs.is_release == 'true' || (
116-
github.event_name == 'workflow_dispatch' ||
117-
github.event_name == 'pull_request' ||
118-
github.event_name == 'merge_group' ||
119-
(
120-
contains('
121-
refs/heads/master
122-
refs/heads/develop
123-
refs/heads/next
124-
', github.event.pull_request.head.ref) &&
125-
github.event_name == 'push'
126-
)
127-
)
115+
needs.check-release.outputs.is_release == 'true' ||
116+
github.event_name == 'workflow_dispatch' ||
117+
github.event_name == 'pull_request' ||
118+
github.event_name == 'merge_group'
128119
name: Create Test Cache
129120
needs:
130121
- rustfmt
@@ -144,19 +135,9 @@ jobs:
144135
## - commit to either (development, next, master) branch
145136
stacks-core-tests:
146137
if: |
147-
needs.check-release.outputs.is_release == 'true' || (
148-
github.event_name == 'workflow_dispatch' ||
149-
github.event_name == 'pull_request' ||
150-
github.event_name == 'merge_group' ||
151-
(
152-
contains('
153-
refs/heads/master
154-
refs/heads/develop
155-
refs/heads/next
156-
', github.event.pull_request.head.ref) &&
157-
github.event_name == 'push'
158-
)
159-
)
138+
github.event_name == 'workflow_dispatch' ||
139+
github.event_name == 'pull_request' ||
140+
github.event_name == 'merge_group'
160141
name: Stacks Core Tests
161142
needs:
162143
- rustfmt
@@ -177,19 +158,9 @@ jobs:
177158
## - commit to either (development, next, master) branch
178159
stacks-core-build-tests:
179160
if: |
180-
needs.check-release.outputs.is_release == 'true' || (
181-
github.event_name == 'workflow_dispatch' ||
182-
github.event_name == 'pull_request' ||
183-
github.event_name == 'merge_group' ||
184-
(
185-
contains('
186-
refs/heads/master
187-
refs/heads/develop
188-
refs/heads/next
189-
', github.event.pull_request.head.ref) &&
190-
github.event_name == 'push'
191-
)
192-
)
161+
github.event_name == 'workflow_dispatch' ||
162+
github.event_name == 'pull_request' ||
163+
github.event_name == 'merge_group'
193164
name: Stacks Core Build Tests
194165
needs:
195166
- rustfmt
@@ -198,42 +169,21 @@ jobs:
198169

199170
bitcoin-tests:
200171
if: |
201-
needs.check-release.outputs.is_release == 'true' || (
202-
github.event_name == 'workflow_dispatch' ||
203-
github.event_name == 'pull_request' ||
204-
github.event_name == 'merge_group' ||
205-
(
206-
contains('
207-
refs/heads/master
208-
refs/heads/develop
209-
refs/heads/next
210-
', github.event.pull_request.head.ref) &&
211-
github.event_name == 'push'
212-
)
213-
)
172+
github.event_name == 'workflow_dispatch' ||
173+
github.event_name == 'pull_request' ||
174+
github.event_name == 'merge_group'
214175
name: Bitcoin Tests
215176
needs:
216177
- rustfmt
217178
- create-cache
218179
- check-release
219180
uses: ./.github/workflows/bitcoin-tests.yml
220181

221-
222182
p2p-tests:
223183
if: |
224-
needs.check-release.outputs.is_release == 'true' || (
225-
github.event_name == 'workflow_dispatch' ||
226-
github.event_name == 'pull_request' ||
227-
github.event_name == 'merge_group' ||
228-
(
229-
contains('
230-
refs/heads/master
231-
refs/heads/develop
232-
refs/heads/next
233-
', github.event.pull_request.head.ref) &&
234-
github.event_name == 'push'
235-
)
236-
)
184+
github.event_name == 'workflow_dispatch' ||
185+
github.event_name == 'pull_request' ||
186+
github.event_name == 'merge_group'
237187
name: P2P Tests
238188
needs:
239189
- rustfmt

.github/workflows/docs-pr.yml

Lines changed: 0 additions & 114 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to the versioning scheme outlined in the [README.md](README.md).
77

8-
## [Unreleased]
8+
## [3.1.0.0.3]
99

1010
### Added
1111

1212
- Add `tenure_timeout_secs` to the miner for determining when a time-based tenure extend should be attempted.
1313
- Added configuration option `block_proposal_max_age_secs` under `[connection_options]` to prevent processing stale block proposals
1414

1515
### Changed
16-
- The RPC endpoint `/v3/block_proposal` no longer will evaluate block proposals more than `block_proposal_max_age_secs` old
1716

17+
- The RPC endpoint `/v3/block_proposal` no longer will evaluate block proposals more than `block_proposal_max_age_secs` old
1818
- When a transaction is dropped due to replace-by-fee, the `/drop_mempool_tx` event observer payload now includes `new_txid`, which is the transaction that replaced this dropped transaction. When a transaction is dropped for other reasons, `new_txid` is `null`. [#5381](https://github.com/stacks-network/stacks-core/pull/5381)
1919
- Nodes will assume that all PoX anchor blocks exist by default, and stall initial block download indefinitely to await their arrival (#5502)
2020

21+
### Fixed
22+
23+
- Signers no longer accept messages for blocks from different reward cycles (#5662)
24+
2125
## [3.1.0.0.2]
2226

2327
### Added

stacks-signer/CHANGELOG.md

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

1010
## Added
1111

12+
## Changed
13+
14+
## [3.1.0.0.3.0]
15+
16+
## Added
17+
1218
- Introduced the `block_proposal_max_age_secs` configuration option for signers, enabling them to automatically ignore block proposals that exceed the specified age in seconds.
1319
- When a new block proposal is received while the signer is waiting for an existing proposal to be validated, the signer will wait until the existing block is done validating before submitting the new one for validating. ([#5453](https://github.com/stacks-network/stacks-core/pull/5453))
1420

@@ -24,6 +30,14 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
2430

2531
- Prevent old reward cycle signers from processing block validation response messages that do not apply to blocks from their cycle.
2632

33+
# [3.1.0.0.2.1]
34+
35+
## Added
36+
37+
## Changed
38+
39+
- Prevent old reward cycle signers from processing block validation response messages that do not apply to blocks from their cycle.
40+
2741
## [3.1.0.0.2.0]
2842

2943
## Added

stacks-signer/src/chainstate.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,8 @@ impl SortitionState {
8989
if self.miner_status != SortitionMinerStatus::Valid {
9090
return Ok(false);
9191
}
92-
// if we've already signed a block in this tenure, the miner can't have timed out.
93-
let has_blocks = signer_db
94-
.get_last_signed_block_in_tenure(&self.consensus_hash)?
95-
.is_some();
92+
// if we've already seen a proposed block from this miner. It cannot have timed out.
93+
let has_blocks = signer_db.has_proposed_block_in_tenure(&self.consensus_hash)?;
9694
if has_blocks {
9795
return Ok(false);
9896
}

stacks-signer/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const BLOCK_PROPOSAL_TIMEOUT_MS: u64 = 600_000;
3939
const BLOCK_PROPOSAL_VALIDATION_TIMEOUT_MS: u64 = 120_000;
4040
const DEFAULT_FIRST_PROPOSAL_BURN_BLOCK_TIMING_SECS: u64 = 60;
4141
const DEFAULT_TENURE_LAST_BLOCK_PROPOSAL_TIMEOUT_SECS: u64 = 30;
42-
const TENURE_IDLE_TIMEOUT_SECS: u64 = 300;
42+
const TENURE_IDLE_TIMEOUT_SECS: u64 = 120;
4343

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

stacks-signer/src/signerdb.rs

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -746,15 +746,13 @@ impl SignerDb {
746746
try_deserialize(result)
747747
}
748748

749-
/// Return the last signed block in a tenure (identified by its consensus hash)
750-
pub fn get_last_signed_block_in_tenure(
751-
&self,
752-
tenure: &ConsensusHash,
753-
) -> Result<Option<BlockInfo>, DBError> {
754-
let query = "SELECT block_info FROM blocks WHERE consensus_hash = ? AND signed_over = 1 ORDER BY stacks_height DESC LIMIT 1";
749+
/// Return whether a block proposal has been stored for a tenure (identified by its consensus hash)
750+
/// Does not consider the block's state.
751+
pub fn has_proposed_block_in_tenure(&self, tenure: &ConsensusHash) -> Result<bool, DBError> {
752+
let query = "SELECT block_info FROM blocks WHERE consensus_hash = ? LIMIT 1";
755753
let result: Option<String> = query_row(&self.db, query, [tenure])?;
756754

757-
try_deserialize(result)
755+
Ok(result.is_some())
758756
}
759757

760758
/// Return the first signed block in a tenure (identified by its consensus hash)
@@ -1904,4 +1902,28 @@ mod tests {
19041902
let pendings = db.get_all_pending_block_validations().unwrap();
19051903
assert_eq!(pendings.len(), 0);
19061904
}
1905+
1906+
#[test]
1907+
fn has_proposed_block() {
1908+
let db_path = tmp_db_path();
1909+
let consensus_hash_1 = ConsensusHash([0x01; 20]);
1910+
let consensus_hash_2 = ConsensusHash([0x02; 20]);
1911+
let mut db = SignerDb::new(db_path).expect("Failed to create signer db");
1912+
let (mut block_info, _) = create_block_override(|b| {
1913+
b.block.header.consensus_hash = consensus_hash_1;
1914+
b.block.header.chain_length = 1;
1915+
});
1916+
1917+
assert!(!db.has_proposed_block_in_tenure(&consensus_hash_1).unwrap());
1918+
assert!(!db.has_proposed_block_in_tenure(&consensus_hash_2).unwrap());
1919+
1920+
db.insert_block(&block_info).unwrap();
1921+
1922+
block_info.block.header.chain_length = 2;
1923+
1924+
db.insert_block(&block_info).unwrap();
1925+
1926+
assert!(db.has_proposed_block_in_tenure(&consensus_hash_1).unwrap());
1927+
assert!(!db.has_proposed_block_in_tenure(&consensus_hash_2).unwrap());
1928+
}
19071929
}

stackslib/src/blockstack_cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ fn main_handler(mut argv: Vec<String>) -> Result<String, CliError> {
864864
if let Some(custom_chain_id) = flag.split('=').nth(1) {
865865
// Attempt to parse the custom chain ID from hex
866866
chain_id = u32::from_str_radix(custom_chain_id.trim_start_matches("0x"), 16)
867-
.map_err(|err| CliError::InvalidChainId(err))?;
867+
.map_err(CliError::InvalidChainId)?;
868868
} else {
869869
// Use the default testnet chain ID
870870
chain_id = CHAIN_ID_TESTNET;

0 commit comments

Comments
 (0)