Skip to content

fix: resolve eip712Domain on fresh 7702 EOAs in signQuote - #203

Merged
fichiokaku merged 1 commit into
developfrom
fix/eip712-domain-7702-fresh-eoa
Sep 1, 2026
Merged

fichiokaku merged 1 commit into
developfrom
fix/eip712-domain-7702-fresh-eoa

Conversation

@fichiokaku

@fichiokaku fichiokaku commented May 1, 2026 •

Copy link
Copy Markdown
Contributor

In EIP-7702 mode the account address is the EOA itself, but the SDK still passes factoryAddress + factoryData to viem's getEip712Domain. When the EOA has no code yet, viem falls back to a deployless call that asserts the factory deploys at the expected address — which is impossible because the factory deploys at a CREATE2 address by definition different from the EOA — and reverts with CounterfactualDeploymentFailedError. This broke signQuote on V2_2_1+ for any 7702 user that called signQuote before delegation landed.

Detect the 7702 case (account address == signer address) and read the EIP-712 domain directly from the implementation contract, substituting chainId and verifyingContract with the values the EOA will return post-delegation.


PR-Codex overview

This PR enhances the documentation and logic of the getEip712Domain function in src/sdk/account/toNexusAccount.ts. It addresses issues related to EIP-7702 mode, ensuring correct domain retrieval for smart-account addresses.

Detailed summary

  • Updated docstring to clarify handling of EIP-7702 mode.
  • Adjusted logic to read the domain directly from the implementation contract for EOA addresses.
  • Substituted chainId and verifyingContract values after delegation.
  • Ensured compatibility with addresses that have not been delegated yet.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@fichiokaku
fichiokaku requested a review from vr16x May 1, 2026 08:28
@github-actions

github-actions Bot commented May 1, 2026 •

Copy link
Copy Markdown

size-limit report 📦

Path Size
core (esm) 72.17 KB (-0.03% 🔽)
core (cjs) 87.25 KB (+0.05% 🔺)
bundler (tree-shaking) 7.2 KB (0%)
paymaster (tree-shaking) 543 B (0%)

@vr16x vr16x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good, but it would be great if you could generate a test case for this.

In EIP-7702 mode the account address is the EOA itself, but the SDK
still passes factoryAddress + factoryData to viem's getEip712Domain.
When the EOA has no code yet, viem falls back to a deployless call
that asserts the factory deploys at the expected address — which is
impossible because the factory deploys at a CREATE2 address by
definition different from the EOA — and reverts with
CounterfactualDeploymentFailedError. This broke signQuote on V2_2_1+
for any 7702 user that called signQuote before delegation landed.

Detect the 7702 case (account address == signer address) and read the
EIP-712 domain directly from the implementation contract, substituting
chainId and verifyingContract with the values the EOA will return
post-delegation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fichiokaku
fichiokaku force-pushed the fix/eip712-domain-7702-fresh-eoa branch from 5cdee09 to 6f3fe94 Compare September 1, 2026 13:48
@fichiokaku
fichiokaku merged commit f041c36 into develop Sep 1, 2026
4 of 5 checks passed
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