Skip to content

Commit 2f81923

Browse files
committed
Merge branch 'develop' into chore/stacks-node-client-logs
2 parents 2813f3d + 56ce7d5 commit 2f81923

File tree

6 files changed

+40
-25
lines changed

6 files changed

+40
-25
lines changed

.github/workflows/bitcoin-tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ jobs:
140140
with:
141141
btc-version: "25.0"
142142

143+
## Increase open file descriptors limit
144+
- name: Increase Open File Descriptors
145+
run: |
146+
sudo prlimit --nofile=4096:4096
147+
143148
## Run test matrix using restored cache of archive file
144149
## - Test will timeout after env.TEST_TIMEOUT minutes
145150
- name: Run Tests

stacks-signer/src/chainstate.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,18 @@ impl SortitionsView {
194194
.cur_sortition
195195
.is_timed_out(self.config.block_proposal_timeout, signer_db)?
196196
{
197+
info!(
198+
"Current miner timed out, marking as invalid.";
199+
"current_sortition_consensus_hash" => ?self.cur_sortition.consensus_hash,
200+
);
197201
self.cur_sortition.miner_status = SortitionMinerStatus::InvalidatedBeforeFirstBlock;
198202
}
199203
if let Some(last_sortition) = self.last_sortition.as_mut() {
200204
if last_sortition.is_timed_out(self.config.block_proposal_timeout, signer_db)? {
205+
info!(
206+
"Last miner timed out, marking as invalid.";
207+
"last_sortition_consensus_hash" => ?last_sortition.consensus_hash,
208+
);
201209
last_sortition.miner_status = SortitionMinerStatus::InvalidatedBeforeFirstBlock;
202210
}
203211
}

stacks-signer/src/client/stacks_client.rs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,16 @@ impl StacksClient {
449449
"chosen_parent" => %chosen_parent,
450450
"last_sortition" => %last_sortition,
451451
);
452+
let path = self.tenure_forking_info_path(chosen_parent, last_sortition);
453+
let timer = crate::monitoring::new_rpc_call_timer(&path, &self.http_origin);
452454
let send_request = || {
453455
self.stacks_node_client
454-
.get(self.tenure_forking_info_path(chosen_parent, last_sortition))
456+
.get(&path)
455457
.send()
456458
.map_err(backoff::Error::transient)
457459
};
458460
let response = retry_with_exponential_backoff(send_request)?;
461+
timer.stop_and_record();
459462
if !response.status().is_success() {
460463
return Err(ClientError::RequestFailure(response.status()));
461464
}
@@ -467,16 +470,16 @@ impl StacksClient {
467470
/// Get the sortition information for the latest sortition
468471
pub fn get_latest_sortition(&self) -> Result<SortitionInfo, ClientError> {
469472
debug!("stacks_node_client: Getting latest sortition...");
473+
let path = self.sortition_info_path();
474+
let timer = crate::monitoring::new_rpc_call_timer(&path, &self.http_origin);
470475
let send_request = || {
471-
self.stacks_node_client
472-
.get(self.sortition_info_path())
473-
.send()
474-
.map_err(|e| {
475-
warn!("Signer failed to request latest sortition"; "err" => ?e);
476-
e
477-
})
476+
self.stacks_node_client.get(&path).send().map_err(|e| {
477+
warn!("Signer failed to request latest sortition"; "err" => ?e);
478+
e
479+
})
478480
};
479481
let response = send_request()?;
482+
timer.stop_and_record();
480483
if !response.status().is_success() {
481484
return Err(ClientError::RequestFailure(response.status()));
482485
}
@@ -487,16 +490,16 @@ impl StacksClient {
487490
/// Get the sortition information for a given sortition
488491
pub fn get_sortition(&self, ch: &ConsensusHash) -> Result<SortitionInfo, ClientError> {
489492
debug!("stacks_node_client: Getting sortition with consensus hash {ch}...");
493+
let path = format!("{}/consensus/{}", self.sortition_info_path(), ch.to_hex());
494+
let timer = crate::monitoring::new_rpc_call_timer(&path, &self.http_origin);
490495
let send_request = || {
491-
self.stacks_node_client
492-
.get(format!("{}/consensus/{}", self.sortition_info_path(), ch.to_hex()))
493-
.send()
494-
.map_err(|e| {
495-
warn!("Signer failed to request sortition"; "consensus_hash" => %ch, "err" => ?e);
496-
e
497-
})
496+
self.stacks_node_client.get(&path).send().map_err(|e| {
497+
warn!("Signer failed to request sortition"; "consensus_hash" => %ch, "err" => ?e);
498+
e
499+
})
498500
};
499501
let response = send_request()?;
502+
timer.stop_and_record();
500503
if !response.status().is_success() {
501504
return Err(ClientError::RequestFailure(response.status()));
502505
}
@@ -604,7 +607,6 @@ impl StacksClient {
604607
.map_err(backoff::Error::transient)
605608
};
606609
let response = retry_with_exponential_backoff(send_request)?;
607-
#[cfg(feature = "monitoring_prom")]
608610
timer.stop_and_record();
609611
if !response.status().is_success() {
610612
return Err(ClientError::RequestFailure(response.status()));
@@ -723,13 +725,11 @@ impl StacksClient {
723725
"block_id" => %block.header.block_id(),
724726
"block_height" => %block.header.chain_length,
725727
);
728+
let path = format!("{}{}?broadcast=1", self.http_origin, postblock_v3::PATH);
729+
let timer = crate::monitoring::new_rpc_call_timer(&path, &self.http_origin);
726730
let send_request = || {
727731
self.stacks_node_client
728-
.post(format!(
729-
"{}{}?broadcast=1",
730-
self.http_origin,
731-
postblock_v3::PATH
732-
))
732+
.post(&path)
733733
.header("Content-Type", "application/octet-stream")
734734
.header(AUTHORIZATION, self.auth_password.clone())
735735
.body(block.serialize_to_vec())
@@ -740,6 +740,7 @@ impl StacksClient {
740740
})
741741
};
742742
let response = retry_with_exponential_backoff(send_request)?;
743+
timer.stop_and_record();
743744
if !response.status().is_success() {
744745
return Err(ClientError::RequestFailure(response.status()));
745746
}

stacks-signer/src/signerdb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,14 @@ impl BlockInfo {
251251

252252
/// Mark the block as locally rejected and invalid
253253
pub fn mark_locally_rejected(&mut self) -> Result<(), String> {
254-
self.move_to(BlockState::LocallyRejected);
254+
self.move_to(BlockState::LocallyRejected)?;
255255
self.valid = Some(false);
256256
Ok(())
257257
}
258258

259259
/// Mark the block as globally rejected and invalid
260260
pub fn mark_globally_rejected(&mut self) -> Result<(), String> {
261-
self.move_to(BlockState::GloballyRejected);
261+
self.move_to(BlockState::GloballyRejected)?;
262262
self.valid = Some(false);
263263
Ok(())
264264
}

stacks-signer/src/v0/signer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ impl Signer {
400400
"{self}: received a block proposal for a new block. Submit block for validation. ";
401401
"signer_sighash" => %signer_signature_hash,
402402
"block_id" => %block_proposal.block.block_id(),
403+
"burn_height" => block_proposal.burn_height,
403404
);
404405
crate::monitoring::increment_block_proposals_received();
405406
let mut block_info = BlockInfo::from(block_proposal.clone());

testnet/stacks-node/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ impl BurnchainConfig {
14601460
rpc_ssl: false,
14611461
username: None,
14621462
password: None,
1463-
timeout: 300,
1463+
timeout: 60,
14641464
magic_bytes: BLOCKSTACK_MAGIC_MAINNET.clone(),
14651465
local_mining_public_key: None,
14661466
process_exit_at_block_height: None,
@@ -2376,7 +2376,7 @@ impl Default for MinerConfig {
23762376
first_attempt_time_ms: 10,
23772377
subsequent_attempt_time_ms: 120_000,
23782378
microblock_attempt_time_ms: 30_000,
2379-
nakamoto_attempt_time_ms: 20_000,
2379+
nakamoto_attempt_time_ms: 5_000,
23802380
probability_pick_no_estimate_tx: 25,
23812381
block_reward_recipient: None,
23822382
segwit: false,

0 commit comments

Comments
 (0)