Skip to content

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

Closed
aelmanaa wants to merge 1 commit into
wevm:mainfrom
aelmanaa:feat/nonce-manager-reset-nonce-main
Closed

aelmanaa wants to merge 1 commit into
wevm:mainfrom
aelmanaa:feat/nonce-manager-reset-nonce-main

Conversation

@aelmanaa

@aelmanaa aelmanaa commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Closes #5352

Ports #5353 (merged into v3) to main.

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

As on v3, reset's parameters get an optional nonce. It holds the value consume returned, and it is omitted when consume threw. Existing managers keep working, and createNonceManager ignores the new field. A reset typed with only { address, chainId } is still assignable to NonceManager.

Differences from #5353:

  • main has no NonceManager namespace, so the new parameter type is not exported.
  • The tests are in src/utils/nonceManager.test.ts, next to the existing reset tests from fix: reset nonceManager after failed sends #4634, and use a custom transport. They 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.
  • The docs paragraph is on the createNonceManager page.

A changeset is included.

Port of wevm#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>
@changeset-bot

changeset-bot Bot commented Nov 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 05b61c1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Nov 1, 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 commented Nov 1, 2026

Copy link
Copy Markdown
Member

Thanks @aelmanaa! Superseded by #5373, which keeps your commit (rebased onto main) and adds review fixes on top: tests without vi.spyOn, a docs note that a failed send doesn't prove its nonce is unused, and a one-sentence changeset.


Generated by Claude Code

@jxom jxom closed this Nov 1, 2026
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.

NonceManager.reset gets no nonce, so a per-send manager can't match it to its consume

2 participants