Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(drive): improve withdrawal logging #2203

Merged
merged 4 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ where
}

tracing::debug!(
"Broadcasting {} withdrawal transactions",
"Broadcasting {} asset unlock transactions",
withdrawal_transactions_with_vote_extensions.len(),
);

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

// Modify the transaction's payload
if let Some(AssetUnlockPayloadType(mut payload)) =
transaction.special_transaction_payload
{
// Assign the quorum signature
payload.quorum_sig = signature;

// Assign the modified payload back to the transaction
transaction.special_transaction_payload = Some(AssetUnlockPayloadType(payload));
} else {
let Some(AssetUnlockPayloadType(mut payload)) = transaction.special_transaction_payload
else {
return Err(Error::Execution(ExecutionError::CorruptedCachedState(
"withdrawal transaction payload must be AssetUnlockPayloadType".to_string(),
)));
}
};

// Assign the quorum signature
payload.quorum_sig = signature;

let tx_index = payload.base.index;

// Assign the modified payload back to the transaction
transaction.special_transaction_payload = Some(AssetUnlockPayloadType(payload));

// Serialize the transaction
let tx_bytes = consensus::serialize(&transaction);
Expand All @@ -77,7 +78,8 @@ where
Ok(_) => {
tracing::debug!(
tx_id = transaction.txid().to_hex(),
"Successfully broadcasted withdrawal transaction"
tx_index,
"Successfully broadcasted asset unlock transaction"
);
}
// Handle specific errors
Expand All @@ -92,7 +94,8 @@ where
{
tracing::debug!(
tx_id = transaction.txid().to_string(),
"Asset unlock is expired or has no active quorum: {}",
tx_index,
"Asset unlock transaction is expired or has no active quorum: {}",
e.message
);
transaction_submission_failures.push((transaction.txid(), tx_bytes));
Expand All @@ -101,6 +104,7 @@ where
Err(e) => {
tracing::warn!(
tx_id = transaction.txid().to_string(),
tx_index,
"Failed to broadcast asset unlock transaction: {}",
e
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ where
let Some(position_of_current_quorum) =
last_committed_platform_state.current_validator_set_position_in_list_by_most_recent()
else {
tracing::warn!("Current quorum not in current validator set, not making withdrawals");
tracing::warn!("Current quorum not in current validator set, do not re-broadcast expired withdrawals");
return Ok(());
};
if position_of_current_quorum != 0 {
tracing::debug!(
"Current quorum is not most recent, it is in position {}, not making withdrawals",
"Current quorum is not most recent, it is in position {}, do not re-broadcast expired withdrawals",
position_of_current_quorum
);
return Ok(());
Expand Down
Loading