Skip to content

Commit 319e93b

Browse files
authored
Merge pull request #5179 from stacks-network/chore/stacks-node-client-logs
chore: add debug logs before all `stacks_node_client` use
2 parents 56ce7d5 + 57351cf commit 319e93b

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

stacks-signer/src/client/stacks_client.rs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ impl StacksClient {
242242
&self,
243243
tx: &StacksTransaction,
244244
) -> Result<u64, ClientError> {
245+
debug!("stacks_node_client: Getting estimated fee...");
245246
let request = FeeRateEstimateRequestBody {
246247
estimated_len: Some(tx.tx_len()),
247248
transaction_payload: to_hex(&tx.payload.serialize_to_vec()),
@@ -306,6 +307,11 @@ impl StacksClient {
306307

307308
/// Submit the block proposal to the stacks node. The block will be validated and returned via the HTTP endpoint for Block events.
308309
pub fn submit_block_for_validation(&self, block: NakamotoBlock) -> Result<(), ClientError> {
310+
debug!("stacks_node_client: Submitting block for validation...";
311+
"signer_sighash" => %block.header.signer_signature_hash(),
312+
"block_id" => %block.header.block_id(),
313+
"block_height" => %block.header.chain_length,
314+
);
309315
let block_proposal = NakamotoBlockProposal {
310316
block,
311317
chain_id: self.chain_id,
@@ -439,6 +445,10 @@ impl StacksClient {
439445
chosen_parent: &ConsensusHash,
440446
last_sortition: &ConsensusHash,
441447
) -> Result<VecDeque<TenureForkingInfo>, ClientError> {
448+
debug!("stacks_node_client: Getting tenure forking info...";
449+
"chosen_parent" => %chosen_parent,
450+
"last_sortition" => %last_sortition,
451+
);
442452
let path = self.tenure_forking_info_path(chosen_parent, last_sortition);
443453
let timer = crate::monitoring::new_rpc_call_timer(&path, &self.http_origin);
444454
let send_request = || {
@@ -459,6 +469,7 @@ impl StacksClient {
459469

460470
/// Get the sortition information for the latest sortition
461471
pub fn get_latest_sortition(&self) -> Result<SortitionInfo, ClientError> {
472+
debug!("stacks_node_client: Getting latest sortition...");
462473
let path = self.sortition_info_path();
463474
let timer = crate::monitoring::new_rpc_call_timer(&path, &self.http_origin);
464475
let send_request = || {
@@ -478,6 +489,7 @@ impl StacksClient {
478489

479490
/// Get the sortition information for a given sortition
480491
pub fn get_sortition(&self, ch: &ConsensusHash) -> Result<SortitionInfo, ClientError> {
492+
debug!("stacks_node_client: Getting sortition with consensus hash {ch}...");
481493
let path = format!("{}/consensus/{}", self.sortition_info_path(), ch.to_hex());
482494
let timer = crate::monitoring::new_rpc_call_timer(&path, &self.http_origin);
483495
let send_request = || {
@@ -497,7 +509,7 @@ impl StacksClient {
497509

498510
/// Get the current peer info data from the stacks node
499511
pub fn get_peer_info(&self) -> Result<PeerInfo, ClientError> {
500-
debug!("Getting stacks node info...");
512+
debug!("stacks_node_client: Getting peer info...");
501513
let timer =
502514
crate::monitoring::new_rpc_call_timer(&self.core_info_path(), &self.http_origin);
503515
let send_request = || {
@@ -547,6 +559,7 @@ impl StacksClient {
547559
&self,
548560
reward_cycle: u64,
549561
) -> Result<Option<Vec<NakamotoSignerEntry>>, ClientError> {
562+
debug!("stacks_node_client: Getting reward set signers for reward cycle {reward_cycle}...");
550563
let timer = crate::monitoring::new_rpc_call_timer(
551564
&self.reward_set_path(reward_cycle),
552565
&self.http_origin,
@@ -584,7 +597,7 @@ impl StacksClient {
584597

585598
/// Retrieve the current pox data from the stacks node
586599
pub fn get_pox_data(&self) -> Result<RPCPoxInfoData, ClientError> {
587-
debug!("Getting pox data...");
600+
debug!("stacks_node_client: Getting pox data...");
588601
let timer = crate::monitoring::new_rpc_call_timer(&self.pox_path(), &self.http_origin);
589602
let send_request = || {
590603
self.stacks_node_client
@@ -630,7 +643,7 @@ impl StacksClient {
630643
&self,
631644
address: &StacksAddress,
632645
) -> Result<AccountEntryResponse, ClientError> {
633-
debug!("Getting account info...");
646+
debug!("stacks_node_client: Getting account info...");
634647
let timer =
635648
crate::monitoring::new_rpc_call_timer(&self.accounts_path(address), &self.http_origin);
636649
let send_request = || {
@@ -707,6 +720,10 @@ impl StacksClient {
707720
/// Returns `true` if the block was accepted or `false` if the block
708721
/// was rejected.
709722
pub fn post_block(&self, block: &NakamotoBlock) -> Result<bool, ClientError> {
723+
debug!("stacks_node_client: Posting block to the stacks node...";
724+
"block_id" => %block.header.block_id(),
725+
"block_height" => %block.header.chain_length,
726+
);
710727
let path = format!("{}{}?broadcast=1", self.http_origin, postblock_v3::PATH);
711728
let timer = crate::monitoring::new_rpc_call_timer(&path, &self.http_origin);
712729
let send_request = || {
@@ -734,6 +751,9 @@ impl StacksClient {
734751
pub fn submit_transaction(&self, tx: &StacksTransaction) -> Result<Txid, ClientError> {
735752
let txid = tx.txid();
736753
let tx = tx.serialize_to_vec();
754+
debug!("stacks_node_client: Submitting transaction to the stacks node...";
755+
"txid" => %txid,
756+
);
737757
let timer =
738758
crate::monitoring::new_rpc_call_timer(&self.transaction_path(), &self.http_origin);
739759
let send_request = || {
@@ -763,7 +783,7 @@ impl StacksClient {
763783
function_name: &ClarityName,
764784
function_args: &[ClarityValue],
765785
) -> Result<ClarityValue, ClientError> {
766-
debug!("Calling read-only function {function_name} with args {function_args:?}...");
786+
debug!("stacks_node_client: Calling read-only function {function_name} with args {function_args:?}...");
767787
let args = function_args
768788
.iter()
769789
.filter_map(|arg| arg.serialize_to_hex().ok())

0 commit comments

Comments
 (0)