Skip to content

fix: keep the EIP-7702 initCode marker in UserOperation.toPacked - #594

Merged
jxom merged 1 commit into
0.xfrom
jxom/user-operation-7702-init-code-v0
Nov 8, 2026
Merged

jxom merged 1 commit into
0.xfrom
jxom/user-operation-7702-init-code-v0

Conversation

@jxom

@jxom jxom commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Backports #593 (the main fix for #574) to 0.x (credit @erkancamli).

UserOperation.toInitCode replaced a 0x7702 factory with the authorization's delegate address, so toPacked produced an initCode that EntryPoint 0.8 does not recognise as EIP-7702 and rejects with AA10 sender already constructed; the delegate belongs only in the hashed form.

toInitCode and toPacked now take forHash: by default initCode is the padded 0x7702 marker followed by factoryData, and with forHash the delegate form. On 0.x, toPacked had no options and toTypedData packed without them, so this adds toPacked.Options and has toTypedData (and so hash) pack with forHash: true; hashes are unchanged.

Behavior change: the default output of toInitCode and toPacked for EIP-7702 operations is now the marker form; callers hashing toInitCode themselves need { forHash: true }.

Validation:

  • UserOperation.hash for 0.8 matches the v0.8.0 EntryPoint's getUserOpHash (forge), and the packed marker initCode passes handleOps.
  • pnpm test --project core src/erc4337 (51 passed; the new default-form tests fail on 0.x), pnpm check:types, biome check.

Backports #574 to 0.x. `toInitCode` replaced the `0x7702`
factory with the authorization's delegate address, so `toPacked`
produced an initCode that EntryPoint 0.8 does not recognise as
EIP-7702 and rejects with "AA10 sender already constructed".

`toInitCode` and `toPacked` now take a `forHash` option: by default the
init code is the padded `0x7702` marker followed by `factoryData`; with
`forHash` it is the delegate form the EntryPoint hashes. `toTypedData`
(and so `hash`) packs with `forHash`, so hashes are unchanged.

Co-authored-by: ecamli <107792368+erkancamli@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1bc8e-ad8f-7187-b41f-f8092b65ad6b
Co-authored-by: jxom <jake@tempo.xyz>
@vercel

vercel Bot commented Nov 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ox Building Building Preview Nov 8, 2026 7:52pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T19:53:36.649814Z 15b3812 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Published ox@0.0.0-pr-594-15b3812 under the pr-594 dist-tag, which follows this pull request until it closes.

pnpm add ox@pr-594
pnpm add ox@0.0.0-pr-594-15b3812

@jxom
jxom merged commit 4208467 into 0.x Nov 8, 2026
13 of 14 checks passed
@jxom
jxom deleted the jxom/user-operation-7702-init-code-v0 branch November 8, 2026 19:57
@github-actions github-actions Bot mentioned this pull request Nov 8, 2026

This branch was successfully deployed

1 active deployment
Preview — 15b38126 Deployed Nov 8, 2026 by vercel[bot]
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