fix(script): match resume receipts by hash - #16619
Closed
figtracer wants to merge 1 commit into
Closed
Conversation
Record reverted receipts as completed and preserve each transaction index while concurrent sends resolve. This prevents resume from treating receipt count as a positional cursor while retaining the legacy fallback for unstamped sequence files.
Contributor
✅ Changelog foundThe deterministic check will validate the changed entry. |
figtracer
marked this pull request as ready for review
September 4, 2026 13:25
figtracer
requested review from
0xrusowsky,
DaniPopes,
grandizzy,
mablr,
mattsse and
stevencartavia
as code owners
September 4, 2026 13:25
| .iter() | ||
| .enumerate() | ||
| .filter(|(index, tx)| match tx.hash { | ||
| Some(hash) => !receipt_hashes.contains(&hash), |
Member
There was a problem hiding this comment.
Legacy sequence compatibility
Before this PR, concurrent broadcasts associated returned hashes with sequence entries in FuturesUnordered completion order rather than transaction order. A legacy same-sender sequence can therefore contain swapped hashes.
If only nonce 0’s receipt is recorded while nonce 1 is dropped, the new lookup selects nonce 0 for rebroadcast and omits nonce 1; the positional base behavior selects nonce 1.
Consider adding a format marker and using hash matching only for newly corrected sequences, while retaining positional behavior for legacy files.
Member
Author
|
we dont need this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
forge script --resumeused the number of receipts as a positional cursor. If a transaction in the middle of a concurrently broadcast sequence reverted while a later transaction mined, the reverted transaction left no receipt and shifted that cursor onto the already-mined transaction. Resume could then resend the wrong transaction and fail withnonce too low.Closes #16566.
Solution
Match stamped transactions to receipts by transaction hash, while retaining the positional fallback for older sequence files without hashes. Reverted transactions now retain their mined receipt, and concurrent send results carry their original sequence index when stamping hashes.
I reproduced the estimate-versus-mine state race against Anvil: two same-sender transactions passed preflight, the first reverted after the state changed, and the second mined successfully in the same block. The saved sequence retained both receipts, and a subsequent resume completed without sending another transaction.
This PR was written with Codex assistance for issue investigation, code generation, and validation. I reviewed and tested the resulting change.
PR Checklist