Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signer/core: extended support for EIP-712 array types #30620

Merged

Conversation

naveen-imtb
Copy link
Contributor

This PR patches the current implementation to resolve this issue.

The test cases in testdata/typed-data.json have been repurposed from the ethers.js repository.

The test cases have been updated to remove the ones that don't have a valid domain separator as EIP-712 messages without a domain separator are not supported by geth.

As an example, the below test case from ethersjs repository has been removed as it is considered invalid.

  {
    "name": "random-33",
    "domain": {},
    "primaryType": "Struct3",
    "types": {
      "EIP712Domain": [],
      "Struct3": [
        {
          "name": "param2",
          "type": "bool"
        }
      ]
    },
    "data": {
      "param2": false
    },
    "digest": "0x1d066e0e8e8e4eaedde581dc40a550c2d6774f57126a6eb0dee143bfb6b3f949"
  },

@holiman
Copy link
Contributor

holiman commented Oct 23, 2024

Nice, I like it that you reused testcases from ethers. I will try to get this reviewed and merged, but it might take a while.

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM

@holiman holiman changed the title feat: signer: support encoding fixed and dynamic arrays to fully comply with EIP 712 spec signer/core: extended support for EIP-712 array types Nov 8, 2024
@holiman holiman added this to the 1.14.12 milestone Nov 8, 2024
@holiman holiman merged commit 5b78aef into ethereum:master Nov 8, 2024
3 checks passed
holiman added a commit that referenced this pull request Nov 19, 2024
This change updates the EIP-712 implementation to resolve [#30619](#30619).

The test cases have been repurposed from the ethers.js [repository](https://github.com/ethers-io/ethers.js/blob/main/testcases/typed-data.json.gz), but have been updated to remove tests that don't have a valid domain separator; EIP-712 messages without a domain separator are not supported by geth.

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
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.

Support fixed sized arrays for primitive and custom types to fully comply with EIP 712 specification
2 participants