Skip to content

Commit d96fa87

Browse files
authored
Merge branch 'develop' into fix/clippy-ci-stacks-lib-needless-borrow
2 parents 6426d8a + e0d3f3c commit d96fa87

File tree

10 files changed

+596
-116
lines changed

10 files changed

+596
-116
lines changed

.github/workflows/bitcoin-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ jobs:
147147
- tests::signer::v0::multiple_miners_empty_sortition
148148
- tests::signer::v0::block_proposal_timeout
149149
- tests::signer::v0::rejected_blocks_count_towards_miner_validity
150+
- tests::signer::v0::allow_reorg_within_first_proposal_burn_block_timing_secs
150151
- tests::nakamoto_integrations::burn_ops_integration_test
151152
- tests::nakamoto_integrations::check_block_heights
152153
- tests::nakamoto_integrations::clarity_burn_state

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
1313
cases: when a bitcoin block is produced before the previous bitcoin block's Stacks tenure started.
1414
Previously, the miner had difficulty restarting their missed tenure and extending into the new
1515
bitcoin block, leading to 1-2 bitcoin blocks of missed Stacks block production.
16+
- The event dispatcher now includes `consensus_hash` in the `/new_block` and `/new_burn_block` payloads. ([#5677](https://github.com/stacks-network/stacks-core/pull/5677))
17+
18+
## Changed
19+
20+
- When a miner reorgs the previous tenure due to a poorly timed block, it can now continue to build blocks on this new chain tip (#5691)
1621

1722
## [3.1.0.0.3]
1823

stacks-signer/CHANGELOG.md

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

1010
## Added
1111

12+
- 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))
13+
- Introduced two new prometheus metrics:
14+
- `stacks_signer_block_validation_latencies_histogram`: the validation_time_ms reported by the node when validating a block proposal
15+
- `stacks_signer_block_response_latencies_histogram`: the "end-to-end" time it takes for the signer to issue a block response
16+
1217
## Changed
1318

1419
## [3.1.0.0.3.0]
1520

1621
## Added
1722

1823
- 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.
19-
- 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))
20-
- Introduced two new prometheus metrics:
21-
- `stacks_signer_block_validation_latencies_histogram`: the validation_time_ms reported by the node when validating a block proposal
22-
- `stacks_signer_block_response_latencies_histogram`: the "end-to-end" time it takes for the signer to issue a block response
2324

2425
## Changed
2526
- Improvements to the stale signer cleanup logic: deletes the prior signer if it has no remaining unprocessed blocks in its database

stackslib/src/net/tests/inv/nakamoto.rs

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -901,18 +901,10 @@ fn test_nakamoto_inv_sync_state_machine() {
901901
let _ = peer.step_with_ibd(false);
902902
let _ = other_peer.step_with_ibd(false);
903903

904-
let event_ids: Vec<usize> = peer
905-
.network
906-
.iter_peer_event_ids()
907-
.map(|e_id| *e_id)
908-
.collect();
909-
let other_event_ids: Vec<usize> = other_peer
910-
.network
911-
.iter_peer_event_ids()
912-
.map(|e_id| *e_id)
913-
.collect();
904+
let event_ids = peer.network.iter_peer_event_ids();
905+
let other_event_ids = other_peer.network.iter_peer_event_ids();
914906

915-
if !event_ids.is_empty() && !other_event_ids.is_empty() {
907+
if !(event_ids.count() == 0) && !(other_event_ids.count() == 0) {
916908
break;
917909
}
918910
}
@@ -937,8 +929,8 @@ fn test_nakamoto_inv_sync_state_machine() {
937929
let mut last_learned_rc = 0;
938930
loop {
939931
let _ = other_peer.step_with_ibd(false);
940-
let ev_ids: Vec<_> = other_peer.network.iter_peer_event_ids().collect();
941-
if ev_ids.is_empty() {
932+
let ev_ids = other_peer.network.iter_peer_event_ids();
933+
if ev_ids.count() == 0 {
942934
// disconnected
943935
panic!("Disconnected");
944936
}
@@ -1032,18 +1024,10 @@ fn test_nakamoto_inv_sync_across_epoch_change() {
10321024
let _ = peer.step_with_ibd(false);
10331025
let _ = other_peer.step_with_ibd(false);
10341026

1035-
let event_ids: Vec<usize> = peer
1036-
.network
1037-
.iter_peer_event_ids()
1038-
.map(|e_id| *e_id)
1039-
.collect();
1040-
let other_event_ids: Vec<usize> = other_peer
1041-
.network
1042-
.iter_peer_event_ids()
1043-
.map(|e_id| *e_id)
1044-
.collect();
1027+
let event_ids = peer.network.iter_peer_event_ids();
1028+
let other_event_ids = other_peer.network.iter_peer_event_ids();
10451029

1046-
if !event_ids.is_empty() && !other_event_ids.is_empty() {
1030+
if !(event_ids.count() == 0) && !(other_event_ids.count() == 0) {
10471031
break;
10481032
}
10491033
}

stackslib/src/net/tests/mempool/mod.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,18 +1133,10 @@ fn test_mempool_sync_2_peers_nakamoto_paginated() {
11331133
let _ = peer_1.step_with_ibd(false);
11341134
let _ = peer_2.step_with_ibd(false);
11351135

1136-
let event_ids: Vec<usize> = peer_1
1137-
.network
1138-
.iter_peer_event_ids()
1139-
.map(|e_id| *e_id)
1140-
.collect();
1141-
let other_event_ids: Vec<usize> = peer_2
1142-
.network
1143-
.iter_peer_event_ids()
1144-
.map(|e_id| *e_id)
1145-
.collect();
1136+
let event_ids = peer_1.network.iter_peer_event_ids();
1137+
let other_event_ids = peer_2.network.iter_peer_event_ids();
11461138

1147-
if !event_ids.is_empty() && !other_event_ids.is_empty() {
1139+
if !(event_ids.count() == 0) && !(other_event_ids.count() == 0) {
11481140
break;
11491141
}
11501142
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -932,9 +932,8 @@ impl BlockMinerThread {
932932
})?;
933933

934934
let stacks_tip_block_id = StacksBlockId::new(&stacks_tip_ch, &stacks_tip_bh);
935-
let tenure_tip_opt = NakamotoChainState::get_highest_block_header_in_tenure(
935+
let tenure_tip_opt = NakamotoChainState::get_highest_known_block_header_in_tenure(
936936
&mut chain_state.index_conn(),
937-
&stacks_tip_block_id,
938937
&self.burn_election_block.consensus_hash,
939938
)
940939
.map_err(|e| {

testnet/stacks-node/src/neon_node.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,16 +1227,15 @@ impl BlockMinerThread {
12271227

12281228
// process earlier tips, back to max_depth
12291229
for cur_height in end_height.saturating_sub(max_depth)..end_height {
1230-
let stacks_tips: Vec<_> = chain_state
1230+
let stacks_tips = chain_state
12311231
.get_stacks_chain_tips_at_height(cur_height)
12321232
.expect("FATAL: could not query chain tips at height")
12331233
.into_iter()
12341234
.filter(|candidate| {
12351235
Self::is_on_canonical_burnchain_fork(candidate, &sortdb_tip_handle)
1236-
})
1237-
.collect();
1236+
});
12381237

1239-
for tip in stacks_tips.into_iter() {
1238+
for tip in stacks_tips {
12401239
let index_block_hash =
12411240
StacksBlockId::new(&tip.consensus_hash, &tip.anchored_block_hash);
12421241

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -955,17 +955,15 @@ fn integration_test_get_info() {
955955
.as_array()
956956
.expect("Fees should be array");
957957

958-
let estimated_fee_rates: Vec<_> = estimations
958+
let estimated_fee_rates = estimations
959959
.iter()
960-
.map(|x| x.get("fee_rate").expect("Should have fee_rate field"))
961-
.collect();
962-
let estimated_fees: Vec<_> = estimations
960+
.map(|x| x.get("fee_rate").expect("Should have fee_rate field"));
961+
let estimated_fees = estimations
963962
.iter()
964-
.map(|x| x.get("fee").expect("Should have fee field"))
965-
.collect();
963+
.map(|x| x.get("fee").expect("Should have fee field"));
966964

967-
assert_eq!(estimated_fee_rates.len(), 3, "Fee rates should be length 3 array");
968-
assert_eq!(estimated_fees.len(), 3, "Fees should be length 3 array");
965+
assert_eq!(estimated_fee_rates.count(), 3, "Fee rates should be length 3 array");
966+
assert_eq!(estimated_fees.count(), 3, "Fees should be length 3 array");
969967

970968
let tx_payload = TransactionPayload::from(TransactionContractCall {
971969
address: contract_addr,
@@ -1006,16 +1004,15 @@ fn integration_test_get_info() {
10061004
.as_array()
10071005
.expect("Fees should be array");
10081006

1009-
let estimated_fee_rates: Vec<_> = estimations
1007+
let estimated_fee_rates = estimations
10101008
.iter()
1011-
.map(|x| x.get("fee_rate").expect("Should have fee_rate field"))
1012-
.collect();
1009+
.map(|x| x.get("fee_rate").expect("Should have fee_rate field"));
10131010
let estimated_fees: Vec<_> = estimations
10141011
.iter()
10151012
.map(|x| x.get("fee").expect("Should have fee field"))
10161013
.collect();
10171014

1018-
assert_eq!(estimated_fee_rates.len(), 3, "Fee rates should be length 3 array");
1015+
assert_eq!(estimated_fee_rates.count(), 3, "Fee rates should be length 3 array");
10191016
assert_eq!(estimated_fees.len(), 3, "Fees should be length 3 array");
10201017

10211018
let tx_payload = TransactionPayload::from(TransactionContractCall {

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -759,12 +759,8 @@ fn should_succeed_mining_valid_txs() {
759759
));
760760

761761
// 0 event should have been produced
762-
let events: Vec<StacksTransactionEvent> = chain_tip
763-
.receipts
764-
.iter()
765-
.flat_map(|a| a.events.clone())
766-
.collect();
767-
assert!(events.is_empty());
762+
let events = chain_tip.receipts.iter().flat_map(|a| a.events.clone());
763+
assert!(events.count() == 0);
768764
}
769765
2 => {
770766
// Inspecting the chain at round 2.
@@ -791,12 +787,8 @@ fn should_succeed_mining_valid_txs() {
791787
));
792788

793789
// 2 lockup events should have been produced
794-
let events: Vec<StacksTransactionEvent> = chain_tip
795-
.receipts
796-
.iter()
797-
.flat_map(|a| a.events.clone())
798-
.collect();
799-
assert_eq!(events.len(), 2);
790+
let events = chain_tip.receipts.iter().flat_map(|a| a.events.clone());
791+
assert_eq!(events.count(), 2);
800792
}
801793
3 => {
802794
// Inspecting the chain at round 3.

0 commit comments

Comments
 (0)