Skip to content

Commit

Permalink
Merge branch 'develop' into feat/signer-metrics-validation-time
Browse files Browse the repository at this point in the history
  • Loading branch information
hstove authored Jan 20, 2025
2 parents eef55e5 + e2415d3 commit e9c3856
Show file tree
Hide file tree
Showing 97 changed files with 1,674 additions and 1,601 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
# - tests::neon_integrations::size_overflow_unconfirmed_microblocks_integration_test
# - tests::neon_integrations::size_overflow_unconfirmed_stream_microblocks_integration_test
# - tests::neon_integrations::runtime_overflow_unconfirmed_microblocks_integration_test
# - tests::epoch_25::microblocks_disabled
# Disable this flaky test. Microblocks are no longer supported anyways.
# - tests::neon_integrations::microblock_large_tx_integration_test_FLAKY
- tests::neon_integrations::miner_submit_twice
Expand All @@ -80,7 +81,6 @@ jobs:
- tests::neon_integrations::bitcoin_reorg_flap
- tests::neon_integrations::bitcoin_reorg_flap_with_follower
- tests::neon_integrations::start_stop_bitcoind
- tests::epoch_25::microblocks_disabled
- tests::should_succeed_handling_malformed_and_valid_txs
- tests::nakamoto_integrations::simple_neon_integration
- tests::nakamoto_integrations::flash_blocks_on_epoch_3
Expand Down Expand Up @@ -141,6 +141,8 @@ jobs:
- tests::signer::v0::incoming_signers_ignore_block_proposals
- tests::signer::v0::outgoing_signers_ignore_block_proposals
- tests::signer::v0::injected_signatures_are_ignored_across_boundaries
- tests::signer::v0::block_proposal_timeout
- tests::signer::v0::rejected_blocks_count_towards_miner_validity
- tests::nakamoto_integrations::burn_ops_integration_test
- tests::nakamoto_integrations::check_block_heights
- tests::nakamoto_integrations::clarity_burn_state
Expand Down
82 changes: 16 additions & 66 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,10 @@ jobs:
## - commit to either (development, master) branch
create-cache:
if: |
needs.check-release.outputs.is_release == 'true' || (
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
)
needs.check-release.outputs.is_release == 'true' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group'
name: Create Test Cache
needs:
- rustfmt
Expand All @@ -144,19 +135,9 @@ jobs:
## - commit to either (development, next, master) branch
stacks-core-tests:
if: |
needs.check-release.outputs.is_release == 'true' || (
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
)
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group'
name: Stacks Core Tests
needs:
- rustfmt
Expand All @@ -177,19 +158,9 @@ jobs:
## - commit to either (development, next, master) branch
stacks-core-build-tests:
if: |
needs.check-release.outputs.is_release == 'true' || (
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
)
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group'
name: Stacks Core Build Tests
needs:
- rustfmt
Expand All @@ -198,42 +169,21 @@ jobs:

bitcoin-tests:
if: |
needs.check-release.outputs.is_release == 'true' || (
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
)
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group'
name: Bitcoin Tests
needs:
- rustfmt
- create-cache
- check-release
uses: ./.github/workflows/bitcoin-tests.yml


p2p-tests:
if: |
needs.check-release.outputs.is_release == 'true' || (
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
)
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group'
name: P2P Tests
needs:
- rustfmt
Expand Down
114 changes: 0 additions & 114 deletions .github/workflows/docs-pr.yml

This file was deleted.

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

## [Unreleased]
## [3.1.0.0.3]

### Added

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

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

- The RPC endpoint `/v3/block_proposal` no longer will evaluate block proposals more than `block_proposal_max_age_secs` old
- 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)
- Nodes will assume that all PoX anchor blocks exist by default, and stall initial block download indefinitely to await their arrival (#5502)

### Fixed

- Signers no longer accept messages for blocks from different reward cycles (#5662)

## [3.1.0.0.2]

### Added
Expand Down
14 changes: 14 additions & 0 deletions stacks-signer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE

## Added

## Changed

## [3.1.0.0.3.0]

## Added

- 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.
- 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))
- Introduced two new prometheus metrics:
Expand All @@ -27,6 +33,14 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE

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

# [3.1.0.0.2.1]

## Added

## Changed

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

## [3.1.0.0.2.0]

## Added
Expand Down
6 changes: 2 additions & 4 deletions stacks-signer/src/chainstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,8 @@ impl SortitionState {
if self.miner_status != SortitionMinerStatus::Valid {
return Ok(false);
}
// if we've already signed a block in this tenure, the miner can't have timed out.
let has_blocks = signer_db
.get_last_signed_block_in_tenure(&self.consensus_hash)?
.is_some();
// if we've already seen a proposed block from this miner. It cannot have timed out.
let has_blocks = signer_db.has_proposed_block_in_tenure(&self.consensus_hash)?;
if has_blocks {
return Ok(false);
}
Expand Down
2 changes: 1 addition & 1 deletion stacks-signer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const BLOCK_PROPOSAL_TIMEOUT_MS: u64 = 600_000;
const BLOCK_PROPOSAL_VALIDATION_TIMEOUT_MS: u64 = 120_000;
const DEFAULT_FIRST_PROPOSAL_BURN_BLOCK_TIMING_SECS: u64 = 60;
const DEFAULT_TENURE_LAST_BLOCK_PROPOSAL_TIMEOUT_SECS: u64 = 30;
const TENURE_IDLE_TIMEOUT_SECS: u64 = 300;
const TENURE_IDLE_TIMEOUT_SECS: u64 = 120;

#[derive(thiserror::Error, Debug)]
/// An error occurred parsing the provided configuration
Expand Down
36 changes: 29 additions & 7 deletions stacks-signer/src/signerdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,15 +746,13 @@ impl SignerDb {
try_deserialize(result)
}

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

try_deserialize(result)
Ok(result.is_some())
}

/// Return the first signed block in a tenure (identified by its consensus hash)
Expand Down Expand Up @@ -1904,4 +1902,28 @@ mod tests {
let pendings = db.get_all_pending_block_validations().unwrap();
assert_eq!(pendings.len(), 0);
}

#[test]
fn has_proposed_block() {
let db_path = tmp_db_path();
let consensus_hash_1 = ConsensusHash([0x01; 20]);
let consensus_hash_2 = ConsensusHash([0x02; 20]);
let mut db = SignerDb::new(db_path).expect("Failed to create signer db");
let (mut block_info, _) = create_block_override(|b| {
b.block.header.consensus_hash = consensus_hash_1;
b.block.header.chain_length = 1;
});

assert!(!db.has_proposed_block_in_tenure(&consensus_hash_1).unwrap());
assert!(!db.has_proposed_block_in_tenure(&consensus_hash_2).unwrap());

db.insert_block(&block_info).unwrap();

block_info.block.header.chain_length = 2;

db.insert_block(&block_info).unwrap();

assert!(db.has_proposed_block_in_tenure(&consensus_hash_1).unwrap());
assert!(!db.has_proposed_block_in_tenure(&consensus_hash_2).unwrap());
}
}
2 changes: 1 addition & 1 deletion stackslib/src/blockstack_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ fn main_handler(mut argv: Vec<String>) -> Result<String, CliError> {
if let Some(custom_chain_id) = flag.split('=').nth(1) {
// Attempt to parse the custom chain ID from hex
chain_id = u32::from_str_radix(custom_chain_id.trim_start_matches("0x"), 16)
.map_err(|err| CliError::InvalidChainId(err))?;
.map_err(CliError::InvalidChainId)?;
} else {
// Use the default testnet chain ID
chain_id = CHAIN_ID_TESTNET;
Expand Down
Loading

0 comments on commit e9c3856

Please sign in to comment.