Skip to content

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

Open
fichiokaku wants to merge 1 commit into
developfrom
fix/eip712-domain-7702-fresh-eoa
Open

fix: resolve eip712Domain on fresh 7702 EOAs in signQuote#203
fichiokaku wants to merge 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 getEip712Domain function to handle EIP-7702 mode correctly. It ensures that the EIP-712 domain is fetched directly from the implementation contract when the smart-account address is the EOA, preventing issues with address mismatches during delegation.

Detailed summary

  • Updated documentation to clarify handling of EIP-7702 mode.
  • Added logic to fetch the EIP-712 domain from the implementation contract if the address matches the signer.address.
  • Modified the _eip712Domain assignment to include the correct chainId and verifyingContract values after delegation.

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

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 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) 71.49 KB (+0.09% 🔺)
core (cjs) 86.52 KB (+0.02% 🔺)
bundler (tree-shaking) 7 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.

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