Skip to content

Commit 612dc5d

Browse files
committed
Merge branch 'develop' into test/allow_reorg_within_first_proposal_burn_block_timing_secs
2 parents 994bc83 + e1c09f7 commit 612dc5d

Some content is hidden

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

75 files changed

+2102
-1165
lines changed

.github/workflows/bitcoin-tests.yml

Lines changed: 5 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
@@ -132,13 +132,17 @@ jobs:
132132
- tests::signer::v0::block_commit_delay
133133
- tests::signer::v0::continue_after_fast_block_no_sortition
134134
- tests::signer::v0::block_validation_response_timeout
135+
- tests::signer::v0::block_validation_pending_table
136+
- tests::signer::v0::new_tenure_while_validating_previous_scenario
135137
- tests::signer::v0::tenure_extend_after_bad_commit
136138
- tests::signer::v0::block_proposal_max_age_rejections
137139
- tests::signer::v0::global_acceptance_depends_on_block_announcement
138140
- tests::signer::v0::no_reorg_due_to_successive_block_validation_ok
139141
- tests::signer::v0::incoming_signers_ignore_block_proposals
140142
- tests::signer::v0::outgoing_signers_ignore_block_proposals
141143
- 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
142146
- tests::signer::v0::allow_reorg_within_first_proposal_burn_block_timing_secs
143147
- tests::nakamoto_integrations::burn_ops_integration_test
144148
- tests::nakamoto_integrations::check_block_heights

clarity/src/vm/representations.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ guarded_string!(
8484
);
8585

8686
impl StacksMessageCodec for ClarityName {
87+
#[allow(clippy::needless_as_bytes)] // as_bytes isn't necessary, but verbosity is preferable in the codec impls
8788
fn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), codec_error> {
8889
// ClarityName can't be longer than vm::representations::MAX_STRING_LEN, which itself is
8990
// a u8, so we should be good here.
@@ -124,6 +125,7 @@ impl StacksMessageCodec for ClarityName {
124125
}
125126

126127
impl StacksMessageCodec for ContractName {
128+
#[allow(clippy::needless_as_bytes)] // as_bytes isn't necessary, but verbosity is preferable in the codec impls
127129
fn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), codec_error> {
128130
if self.as_bytes().len() < CONTRACT_MIN_NAME_LENGTH
129131
|| self.as_bytes().len() > CONTRACT_MAX_NAME_LENGTH

libsigner/src/v0/messages.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ pub struct PeerInfo {
283283
}
284284

285285
impl StacksMessageCodec for PeerInfo {
286+
#[allow(clippy::needless_as_bytes)] // as_bytes isn't necessary, but verbosity is preferable in the codec impls
286287
fn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), CodecError> {
287288
write_next(fd, &self.burn_block_height)?;
288289
write_next(fd, self.stacks_tip_consensus_hash.as_bytes())?;
@@ -687,6 +688,14 @@ impl BlockResponse {
687688
}
688689
}
689690

691+
/// The signer signature hash for the block response
692+
pub fn signer_signature_hash(&self) -> Sha512Trunc256Sum {
693+
match self {
694+
BlockResponse::Accepted(accepted) => accepted.signer_signature_hash,
695+
BlockResponse::Rejected(rejection) => rejection.signer_signature_hash,
696+
}
697+
}
698+
690699
/// Get the block accept data from the block response
691700
pub fn as_block_accepted(&self) -> Option<&BlockAccepted> {
692701
match self {

pox-locking/src/events.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ use clarity::vm::costs::LimitedCostTracker;
2020
use clarity::vm::errors::Error as ClarityError;
2121
use clarity::vm::types::{PrincipalData, QualifiedContractIdentifier, ResponseData, TupleData};
2222
use clarity::vm::Value;
23-
#[cfg(test)]
23+
#[cfg(any(test, feature = "testing"))]
2424
use slog::slog_debug;
2525
use slog::slog_error;
26-
#[cfg(test)]
26+
#[cfg(any(test, feature = "testing"))]
2727
use stacks_common::debug;
2828
use stacks_common::types::StacksEpochId;
2929
use stacks_common::{error, test_debug};

pox-locking/src/events_24.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ use clarity::vm::contexts::GlobalContext;
1919
use clarity::vm::errors::Error as ClarityError;
2020
use clarity::vm::types::{PrincipalData, QualifiedContractIdentifier, TupleData};
2121
use clarity::vm::Value;
22-
#[cfg(test)]
22+
#[cfg(any(test, feature = "testing"))]
2323
use slog::slog_debug;
2424
use slog::slog_error;
25-
#[cfg(test)]
25+
#[cfg(any(test, feature = "testing"))]
2626
use stacks_common::debug;
2727
use stacks_common::{error, test_debug};
2828

stacks-signer/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
1010
## Added
1111

1212
- 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.
13+
- 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))
1314

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

stacks-signer/src/chainstate.rs

Lines changed: 4 additions & 6 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
}
@@ -589,8 +587,8 @@ impl SortitionsView {
589587
signer_db.block_lookup(&nakamoto_tip.signer_signature_hash())
590588
{
591589
if block_info.state != BlockState::GloballyAccepted {
592-
if let Err(e) = block_info.mark_globally_accepted() {
593-
warn!("Failed to update block info in db: {e}");
590+
if let Err(e) = signer_db.mark_block_globally_accepted(&mut block_info) {
591+
warn!("Failed to mark block as globally accepted: {e}");
594592
} else if let Err(e) = signer_db.insert_block(&block_info) {
595593
warn!("Failed to update block info in db: {e}");
596594
}

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

0 commit comments

Comments
 (0)