Repository navigation
fix: keep the EIP-7702 initCode marker in UserOperation.toPacked - #593
Merged
Merged
Conversation
`toInitCode` always replaced the `0x7702` factory with the authorization's delegate address, and `toPacked` used it for the packed user operation sent to the EntryPoint. EntryPoint 0.8 and 0.9 only treat an operation as EIP-7702 when the first 20 bytes of `initCode` are the `0x7702` marker; the delegate address belongs only in the hashed form (`_getEip7702InitCodeHashOverride`). With the delegate in place, 0.8 reverts with "AA10 sender already constructed" and 0.9 ignores the initCode, skipping `factoryData`. `toInitCode` now takes a `forHash` option, as viem's `getInitCode` does: without it the init code is the padded marker followed by `factoryData`, with it the delegate form used for hashing. `toPacked` passes its own `forHash` on, so `hash` is unchanged. Co-authored-by: jxom <jake@tempo.xyz>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1bc8e-ad8f-7187-b41f-f8092b65ad6b Co-authored-by: jxom <jake@tempo.xyz>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 8, 2026
Contributor
|
Published pnpm add ox@pr-593
pnpm add ox@0.0.0-pr-593-8dd14de |
Merged
This branch had an error being deployed
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.
Supersedes #574 (thanks @erkancamli; your commit is kept as-is), with small review follow-ups.
UserOperation.toInitCodereplaced a0x7702factory with the authorization's delegate address, andtoPackedused it for the packed user operation sent to the EntryPoint. EntryPoint 0.8 and 0.9 only treat an operation as EIP-7702 when the first 20 bytes ofinitCodeare the padded0x7702marker; the delegate is substituted only when hashing (_getEip7702InitCodeHashOverride). With the delegate ininitCode, 0.8 reverts withAA10 sender already constructedand 0.9 emitsIgnoredInitCodeand skipsfactoryData.toInitCodenow takesforHash(as viem'sgetInitCodedoes): by default it returns the padded marker followed byfactoryData, and withforHashthe delegate form.toPackedpasses itsforHashthrough, sohashandtoTypedDataare unchanged.Behavior change: the default output of
toInitCodefor EIP-7702 operations is now the marker form; callers hashing it themselves need{ forHash: true }.Follow-ups on top of #574: one-sentence changeset,
options: forHashtest names, and whole-object inline snapshots for the packed operation.Validation:
initCoderunsfactoryDataon both; the delegate form revertsAA10on 0.8 and is ignored on 0.9.getUserOpHashequalsUserOperation.hashbefore and after this change.pnpm test --project core src/erc4337(67 passed; the new default-form tests fail onmain),pnpm check:types,vp check.Backport to
0.x: #594.