Skip to content

feat: pass the consumed nonce to NonceManager.reset - #5353

Merged
jxom merged 1 commit into
wevm:v3from
aelmanaa:feat/nonce-manager-reset-nonce
Nov 1, 2026
Merged

jxom merged 1 commit into
wevm:v3from
aelmanaa:feat/nonce-manager-reset-nonce

Conversation

@aelmanaa

Copy link
Copy Markdown
Contributor

Closes #5352

When transaction.send or transaction.sendSync fails after the account's nonce manager has consumed a nonce, they call reset({ address, chainId }). A manager that reserves a nonce per send can't tell which consume the reset follows, so it can't release just that nonce when sends overlap. The issue has the details and a reproduction.

This adds an optional nonce to reset's parameters (NonceManager.ResetParameters): what consume returned, left out when consume threw. Existing managers keep working, and the built-in ones ignore it. A reset(parameters: NonceManager.Parameters) implementation is still assignable.

Alternatives: a separate release(nonce) method adds API surface, and a per-send handle returned from consume is a breaking change.

Tests: send.test.ts and sendSync.test.ts record the reset arguments when consume throws (no nonce) and when the broadcast fails (the consumed nonce). The broadcast-failure tests fail without the change. Docs (nonce-manager.mdx) and a changeset are included.

This targets v3. main has the same pattern; I can port it there in a separate PR if you want it.

Add an optional nonce to reset's parameters (NonceManager.ResetParameters),
set to what consume returned and left out when consume threw, in
transaction.send and transaction.sendSync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 30, 2026

Copy link
Copy Markdown

@aelmanaa is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@jxom
jxom merged commit 2a7219a into wevm:v3 Nov 1, 2026
2 of 3 checks passed
jxom added a commit that referenced this pull request Nov 1, 2026
* feat: pass the consumed nonce to NonceManager.reset

Port of #5353 to main. Add an optional nonce to reset's parameters, set
to what consume returned and left out when consume threw, in
sendTransaction and sendTransactionSync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: cover nonce release without spies

Rewrite the reset-nonce tests to use custom nonce managers instead of
`vi.spyOn`, asserting the broadcast nonces: a failed send's nonce is the
only one released and the next send reuses it. Document that a failed send
does not prove its nonce is unused, and shorten the changeset to one
sentence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D3nmWi1KSPEvFxpccK5EDN

---------

Co-authored-by: aelmanaa <aelmanaa@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants