eip-712 icon indicating copy to clipboard operation
eip-712 copied to clipboard

Failed with recursive data

Open Pana opened this issue 3 years ago • 5 comments

For example

{
        CIP23Domain: [
          { name: 'name', type: 'string' },
          { name: 'version', type: 'string' },
          { name: 'chainId', type: 'uint256' },
          { name: 'verifyingContract', type: 'address' }
        ],
        Person: [
          { name: 'name', type: 'string' },
          { name: 'mother', type: 'Person' },
          { name: 'father', type: 'Person' }
        ]
}

Pana avatar Oct 18 '21 06:10 Pana

Could you provide an example of the message, and what the expected result would be?

Mrtenz avatar Oct 18 '21 11:10 Mrtenz

For example:

{
  "types": {
    "EIP712Domain": [
      { "name": "name", "type": "string" },
      { "name": "version", "type": "string" },
      { "name": "chainId", "type": "uint256" },
      { "name": "verifyingContract", "type": "address" }
    ],
    "Person": [
      { "name": "name", "type": "string" },
      { "name": "wallet", "type": "address" }
    ],
    "Mail": [
      { "name": "from", "type": "Person" },
      { "name": "to", "type": "Person" },
      { "name": "contents", "type": "string" },
      { "name": "replyTo", "type": "Mail" }
    ]
  },
  "primaryType": "Mail",
  "domain": {
    "name": "Ether Mail",
    "version": "1",
    "chainId": 1,
    "verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
  },
  "message": {
    "from": {
      "name": "Cow",
      "wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"
    },
    "to": {
      "name": "Bob",
      "wallet": "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"
    },
    "contents": "Hello, Bob!"
  }
}

The result is : 1901f2cee375fa42b42143804025fc449deafd50cc031ca257e0b194a650a912090fe51b671bc20a4046c6cfd629f9361edc9ea3c6ee0b20b767bcff06e1e8973930

eth_typedDataV4 support recursive data, when encode the omit value it will use a 0x0000000000000000000000000000000000000000000000000000000000000000

Pana avatar Oct 19 '21 02:10 Pana

Thank you, will look into this.

Mrtenz avatar Oct 19 '21 08:10 Mrtenz

Is there any documentation or a reference implementation for recursive types? I looked into this a little bit and I don't quite understand how it's supposed to work currently.

Mrtenz avatar Oct 23 '21 20:10 Mrtenz

Running into similar issues. Opened #35 as mine is related to encodeType.

alex-miller-0 avatar Jan 06 '22 19:01 alex-miller-0