Skip to content

fix: handle empty receipt when transactions are discarded by RPCs #10457

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

DeVikingMark
Copy link

Motivation

Fixes issue #10453 where some RPCs discard transactions but return empty receipts (with missing block information), causing the --resume flag to be ineffective when trying to retry these transactions.

Solution

  • Modified the check_tx_status function to properly detect and handle empty receipts by checking for null block_number, block_hash, and transaction_index
  • Updated error messages in the wait_for_pending function to clearly indicate when transactions were discarded by RPC nodes
  • Added specific instructions for users about using the --resume flag to retry discarded transactions

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty,
conceptionally this makes sense, but I wonder if we can sleep + retry a few times here instead?

Comment on lines 41 to 42
// Check if the receipt has valid block information
if receipt.block_number.is_none() || receipt.block_hash.is_none() || receipt.transaction_index.is_none() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

receipt usually should only return mined transactions, but I can see that some networks might behave that way.

since these are mostly faster L2s, I wonder if the better approach here would be, just retry a few times here?

@DeVikingMark DeVikingMark requested a review from mattsse May 8, 2025 10:20
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few more style nits

Comment on lines 265 to 266
error_msg += "\n\n Add `--resume` to your command to try and continue broadcasting ";
error_msg += "the transactions. This will attempt to resend transactions that were discarded by the RPC.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer a single raw string here r#""#

Comment on lines 58 to 60
} else {
// Receipt has valid block information, proceed normally
Ok(receipt.into())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to lift this up, like

let is_pending = receipt.block_number.is_none() || receipt.block_hash.is_none() || receipt.transaction_index.is_none();

if !is_pnding {return Ok(receipt.into())}


seq_progress.inner.write().finish_tx_spinner(tx_hash);
// Check if this is a retry error for empty receipts
if err.to_string().contains("Received an empty receipt") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't quite empty, but pending, can we update the wording here?

@DeVikingMark DeVikingMark requested a review from mattsse May 10, 2025 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants