Skip to content

fix(account-abstraction): forward falsy per-operation paymasterContext instead of the bundler client default - #5421

Closed
saravanan619 wants to merge 3 commits into
wevm:mainfrom
saravanan619:fix/paymaster-context-presence-5418
Closed

saravanan619 wants to merge 3 commits into
wevm:mainfrom
saravanan619:fix/paymaster-context-presence-5418

Conversation

@saravanan619

Copy link
Copy Markdown
Contributor

Summary

Fixes #5418.

prepareUserOperation chose between the per-operation
paymasterContext and the bundler client's default with a truthiness
test, but the option is typed unknown, so false, 0, and '' are
legitimate values. Any of them was treated as "not provided": with a
client default, the default was silently passed to
getPaymasterStubData/getPaymasterData instead of the explicit
override; without one, the explicit value was erased to undefined.
A caller therefore could not opt a single operation out of a
bundler-level default sponsorship context (e.g. with
paymasterContext: false), and a paymaster callback that distinguishes
"no context" from "explicitly false/empty" could never see the
distinction.

Changes

  • src/account-abstraction/actions/bundler/prepareUserOperation.ts:
    select on presence (!== undefined) instead of truthiness, so the
    client default applies only when the per-operation option is absent.
    null is still forwarded verbatim, matching the declared unknown
    type; only undefined means "not supplied".
  • src/account-abstraction/actions/bundler/prepareUserOperation.paymasterContext.test.ts:
    new offline regression tests that run prepareUserOperation with
    parameters: ['paymaster'] against a real local HTTP paymaster
    server whose returned paymasterData encodes the context it
    received, asserting on the prepared User Operation output: false,
    0, and '' overrides are forwarded instead of the client default,
    a truthy object override still wins, undefined still falls back to
    the client default, and a falsy override is preserved when no client
    default exists.
  • .changeset/paymaster-context-presence.md: patch changeset.

Verification

  • New suite: 6 passed on the fix. Red-then-green: reverting the
    one-line fix makes the 4 falsy-override cases fail (the 2
    fallback/truthy controls still pass), re-applying it makes all 6
    pass.
  • tsc -b src passes; the new test file typechecks clean; Biome
    check passes on both changed source files.
  • Not run: the existing anvil-based prepareUserOperation.test.ts
    suite (it needs an anvil + alto bundler harness, unavailable in this
    environment). The change is a single presence-vs-truthiness selection
    with no effect on truthy/undefined inputs, which the existing
    args: paymasterContext and behavior: bundlerClient.paymasterContext
    tests already cover.

@vercel

vercel Bot commented Nov 5, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9758ed1

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

jxom commented Nov 6, 2026

Copy link
Copy Markdown
Member

Thanks for the fix! I'm closing this in favour of #5431. It keeps your source change unchanged, credits you as co-author, and moves the regression test into the existing prepareUserOperation.test.ts to follow the repo's test conventions. It also extends the changeset to cover null.


Generated by Claude Code

@jxom jxom closed this Nov 6, 2026
jxom added a commit that referenced this pull request Nov 6, 2026
…ver the client default (#5431)

`prepareUserOperation` chose between the per-operation `paymasterContext`
and the bundler client default with a truthiness check, so `false`, `0`,
`''`, and `null` were replaced by the default. Only `undefined` now falls
back to the client default.

Fixes #5418. Supersedes #5421.



Claude-Session: https://claude.ai/code/session_01D3nmWjV2LuSbn2SFpBG1hn

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Saravanan <76141249+saravanan619@users.noreply.github.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.

Falsy per-operation paymasterContext is silently replaced by the bundler client default

2 participants