Skip to content

Commit be9e05f

Browse files
committed
Merge branch 'develop' into test/allow_reorg_within_first_proposal_burn_block_timing_secs
2 parents fa80e0a + 9584bf7 commit be9e05f

File tree

32 files changed

+189
-152
lines changed

32 files changed

+189
-152
lines changed

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

stackslib/src/burnchains/bitcoin/bits.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,7 @@ impl BitcoinTxInputStructured {
223223
Instruction::Op(btc_opcodes::OP_CHECKMULTISIG),
224224
) => {
225225
// op1 and op2 must be integers
226-
match (
227-
btc_opcodes::from(*op1).classify(),
228-
btc_opcodes::from(*op2).classify(),
229-
) {
226+
match (op1.classify(), op2.classify()) {
230227
(Class::PushNum(num_sigs), Class::PushNum(num_pubkeys)) => {
231228
// the "#instructions - 3" comes from the OP_m, OP_n, and OP_CHECKMULTISIG
232229
if num_sigs < 1

stackslib/src/burnchains/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ impl PoxConstants {
629629
// TODO: I *think* the logic of `== 0` here requires some further digging.
630630
// `mod 0` may not have any rewards, but it does not behave like "prepare phase" blocks:
631631
// is it already a member of reward cycle "N" where N = block_height / reward_cycle_len
632-
reward_index == 0 || reward_index > u64::from(reward_cycle_length - prepare_length)
632+
reward_index == 0 || reward_index > reward_cycle_length - prepare_length
633633
}
634634
}
635635

@@ -658,7 +658,7 @@ impl PoxConstants {
658658
} else {
659659
let effective_height = block_height - first_block_height;
660660
let reward_index = effective_height % reward_cycle_length;
661-
reward_index > u64::from(reward_cycle_length - prepare_length)
661+
reward_index > reward_cycle_length - prepare_length
662662
}
663663
}
664664

stackslib/src/burnchains/tests/db.rs

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,38 +1316,30 @@ fn test_classify_delegate_stx() {
13161316
"Only one delegate_stx op should have been accepted"
13171317
);
13181318

1319-
let expected_pre_delegate_addr = StacksAddress::from_legacy_bitcoin_address(
1320-
&LegacyBitcoinAddress {
1319+
let expected_pre_delegate_addr =
1320+
StacksAddress::from_legacy_bitcoin_address(&LegacyBitcoinAddress {
13211321
addrtype: LegacyBitcoinAddressType::PublicKeyHash,
13221322
network_id: BitcoinNetworkType::Mainnet,
13231323
bytes: Hash160([1; 20]),
1324-
}
1325-
.into(),
1326-
);
1324+
});
13271325

13281326
let expected_delegate_addr = PoxAddress::Standard(
1329-
StacksAddress::from_legacy_bitcoin_address(
1330-
&LegacyBitcoinAddress {
1331-
addrtype: LegacyBitcoinAddressType::PublicKeyHash,
1332-
network_id: BitcoinNetworkType::Mainnet,
1333-
bytes: Hash160([2; 20]),
1334-
}
1335-
.into(),
1336-
),
1327+
StacksAddress::from_legacy_bitcoin_address(&LegacyBitcoinAddress {
1328+
addrtype: LegacyBitcoinAddressType::PublicKeyHash,
1329+
network_id: BitcoinNetworkType::Mainnet,
1330+
bytes: Hash160([2; 20]),
1331+
}),
13371332
Some(AddressHashMode::SerializeP2PKH),
13381333
);
13391334

13401335
let expected_reward_addr = Some((
13411336
1,
13421337
PoxAddress::Standard(
1343-
StacksAddress::from_legacy_bitcoin_address(
1344-
&LegacyBitcoinAddress {
1345-
addrtype: LegacyBitcoinAddressType::PublicKeyHash,
1346-
network_id: BitcoinNetworkType::Mainnet,
1347-
bytes: Hash160([1; 20]),
1348-
}
1349-
.into(),
1350-
),
1338+
StacksAddress::from_legacy_bitcoin_address(&LegacyBitcoinAddress {
1339+
addrtype: LegacyBitcoinAddressType::PublicKeyHash,
1340+
network_id: BitcoinNetworkType::Mainnet,
1341+
bytes: Hash160([1; 20]),
1342+
}),
13511343
Some(AddressHashMode::SerializeP2PKH),
13521344
),
13531345
));

stackslib/src/chainstate/coordinator/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,8 +1238,8 @@ impl<
12381238
continue;
12391239
}
12401240
Err(e) => {
1241-
error!("Failed to query affirmation map: {:?}", &e);
1242-
return Err(e.into());
1241+
error!("Failed to query affirmation map: {e:?}");
1242+
return Err(e);
12431243
}
12441244
};
12451245

stackslib/src/chainstate/coordinator/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4736,7 +4736,7 @@ fn atlas_stop_start() {
47364736
TransactionVersion::Testnet,
47374737
TransactionAuth::from_p2pkh(&signer_sk).unwrap(),
47384738
TransactionPayload::ContractCall(TransactionContractCall {
4739-
address: signer_pk.clone().into(),
4739+
address: signer_pk.clone(),
47404740
contract_name: atlas_name.clone(),
47414741
function_name: "make-attach".into(),
47424742
function_args: vec![Value::buff_from(vec![ix; 20]).unwrap()],

stackslib/src/chainstate/nakamoto/mod.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4511,7 +4511,7 @@ impl NakamotoChainState {
45114511
Ok((block_fees, _block_burns, txs_receipts)) => (block_fees, txs_receipts),
45124512
};
45134513

4514-
tx_receipts.extend(txs_receipts.into_iter());
4514+
tx_receipts.extend(txs_receipts);
45154515

45164516
let total_tenure_cost = clarity_tx.cost_so_far();
45174517
let mut block_execution_cost = total_tenure_cost.clone();
@@ -4655,10 +4655,8 @@ impl NakamotoChainState {
46554655
let new_block_id = new_tip.index_block_hash();
46564656
chainstate_tx.log_transactions_processed(&new_block_id, &tx_receipts);
46574657

4658-
let reward_cycle = pox_constants.block_height_to_reward_cycle(
4659-
first_block_height.into(),
4660-
chain_tip_burn_header_height.into(),
4661-
);
4658+
let reward_cycle = pox_constants
4659+
.block_height_to_reward_cycle(first_block_height, chain_tip_burn_header_height.into());
46624660

46634661
// store the reward set calculated during this block if it happened
46644662
// NOTE: miner and proposal evaluation should not invoke this because
@@ -4669,14 +4667,14 @@ impl NakamotoChainState {
46694667
Self::write_reward_set(chainstate_tx, &new_block_id, &signer_calculation.reward_set)?;
46704668

46714669
let cycle_number = if let Some(cycle) = pox_constants.reward_cycle_of_prepare_phase(
4672-
first_block_height.into(),
4670+
first_block_height,
46734671
chain_tip_burn_header_height.into(),
46744672
) {
46754673
Some(cycle)
46764674
} else {
46774675
pox_constants
46784676
.block_height_to_reward_cycle(
4679-
first_block_height.into(),
4677+
first_block_height,
46804678
chain_tip_burn_header_height.into(),
46814679
)
46824680
.map(|cycle| cycle + 1)

stackslib/src/chainstate/nakamoto/shadow.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -901,17 +901,17 @@ pub fn process_shadow_block(
901901
) {
902902
Ok(receipt_opt) => receipt_opt,
903903
Err(ChainstateError::InvalidStacksBlock(msg)) => {
904-
warn!("Encountered invalid block: {}", &msg);
904+
warn!("Encountered invalid block: {msg}");
905905
continue;
906906
}
907907
Err(ChainstateError::NetError(NetError::DeserializeError(msg))) => {
908908
// happens if we load a zero-sized block (i.e. an invalid block)
909-
warn!("Encountered invalid block (codec error): {}", &msg);
909+
warn!("Encountered invalid block (codec error): {msg}");
910910
continue;
911911
}
912912
Err(e) => {
913913
// something else happened
914-
return Err(e.into());
914+
return Err(e);
915915
}
916916
};
917917

stackslib/src/chainstate/nakamoto/tests/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ impl TestStacksNode {
10051005
}
10061006
Ok(blocks
10071007
.into_iter()
1008-
.zip(all_malleablized_blocks.into_iter())
1008+
.zip(all_malleablized_blocks)
10091009
.map(|((blk, sz, cost), mals)| (blk, sz, cost, mals))
10101010
.collect())
10111011
}

0 commit comments

Comments
 (0)