Skip to content

Commit 6230b53

Browse files
authored
chore(drive): improve withdrawal logging (#2203)
1 parent 3404f59 commit 6230b53

File tree

2 files changed

+21
-16
lines changed
  • packages/rs-drive-abci/src/execution/platform_events/withdrawals
    • append_signatures_and_broadcast_withdrawal_transactions/v0
    • rebroadcast_expired_withdrawal_documents/v0

2 files changed

+21
-16
lines changed

packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/v0/mod.rs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ where
3131
}
3232

3333
tracing::debug!(
34-
"Broadcasting {} withdrawal transactions",
34+
"Broadcasting {} asset unlock transactions",
3535
withdrawal_transactions_with_vote_extensions.len(),
3636
);
3737

@@ -55,19 +55,20 @@ where
5555
let signature = BLSSignature::from(signature_bytes);
5656

5757
// Modify the transaction's payload
58-
if let Some(AssetUnlockPayloadType(mut payload)) =
59-
transaction.special_transaction_payload
60-
{
61-
// Assign the quorum signature
62-
payload.quorum_sig = signature;
63-
64-
// Assign the modified payload back to the transaction
65-
transaction.special_transaction_payload = Some(AssetUnlockPayloadType(payload));
66-
} else {
58+
let Some(AssetUnlockPayloadType(mut payload)) = transaction.special_transaction_payload
59+
else {
6760
return Err(Error::Execution(ExecutionError::CorruptedCachedState(
6861
"withdrawal transaction payload must be AssetUnlockPayloadType".to_string(),
6962
)));
70-
}
63+
};
64+
65+
// Assign the quorum signature
66+
payload.quorum_sig = signature;
67+
68+
let tx_index = payload.base.index;
69+
70+
// Assign the modified payload back to the transaction
71+
transaction.special_transaction_payload = Some(AssetUnlockPayloadType(payload));
7172

7273
// Serialize the transaction
7374
let tx_bytes = consensus::serialize(&transaction);
@@ -77,7 +78,8 @@ where
7778
Ok(_) => {
7879
tracing::debug!(
7980
tx_id = transaction.txid().to_hex(),
80-
"Successfully broadcasted withdrawal transaction"
81+
tx_index,
82+
"Successfully broadcasted asset unlock transaction with index {tx_index}",
8183
);
8284
}
8385
// Handle specific errors
@@ -92,7 +94,9 @@ where
9294
{
9395
tracing::debug!(
9496
tx_id = transaction.txid().to_string(),
95-
"Asset unlock is expired or has no active quorum: {}",
97+
tx_index,
98+
error = ?e,
99+
"Asset unlock transaction with index {tx_index} is expired or has no active quorum: {}",
96100
e.message
97101
);
98102
transaction_submission_failures.push((transaction.txid(), tx_bytes));
@@ -101,7 +105,8 @@ where
101105
Err(e) => {
102106
tracing::warn!(
103107
tx_id = transaction.txid().to_string(),
104-
"Failed to broadcast asset unlock transaction: {}",
108+
tx_index,
109+
"Failed to broadcast asset unlock transaction with index {tx_index}: {}",
105110
e
106111
);
107112
// Collect failed transactions for potential future retries

packages/rs-drive-abci/src/execution/platform_events/withdrawals/rebroadcast_expired_withdrawal_documents/v0/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ where
2222
let Some(position_of_current_quorum) =
2323
last_committed_platform_state.current_validator_set_position_in_list_by_most_recent()
2424
else {
25-
tracing::warn!("Current quorum not in current validator set, not making withdrawals");
25+
tracing::warn!("Current quorum not in current validator set, do not re-broadcast expired withdrawals");
2626
return Ok(());
2727
};
2828
if position_of_current_quorum != 0 {
2929
tracing::debug!(
30-
"Current quorum is not most recent, it is in position {}, not making withdrawals",
30+
"Current quorum is not most recent, it is in position {}, do not re-broadcast expired withdrawals",
3131
position_of_current_quorum
3232
);
3333
return Ok(());

0 commit comments

Comments
 (0)