signTypedData_v4 not according to specification
Assessment
This issue has not been assessed yet.
Description
I was implementing signTypedData_v4 for our project, and I have used the tests in this repo to make sure our implementation was sound.
I then noticed that geth provided their own https://github.com/ethereum/go-ethereum/blob/43c278cdf93d5469702fd1c2f570dbf3c1718ff0/signer/core/signed_data.go#L323 , so I plugged in the tests from this repo in geth and noticed that the behavior was not consistent.
Upon further investigation, I noticed that currently the behavior of signTypedData_v4 is not according to
https://eips.ethereum.org/EIPS/eip-712 when it comes to encoding arrays.
The eip states:
The array values are encoded as the keccak256 hash of the
concatenated encodeData of their contents
The behavior instead was to encode array values as the keccak256 of the
concatenated keccak256 of the values.
This worked well for primary types, but not for struct, as encodeData
per spec is:
The encoding of a struct instance is enc(value₁) ‖ enc(value₂) ‖ … ‖ enc(valueₙ) , i.e. the concatenation of the
encoded member values in the order that they appear in the type.
Each encoded member value is exactly 32-byte long.
Instead, we are using basically hashStruct instead of encodeData
- Dominant language
- TypeScript
- Stars
- 586
- Forks
- 231
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MetaMask/eth-sig-util
-
team-wallet-framework
Difficulty 1/5 Under an hour Newbie friendliness 50/100
MetaMask/eth-sig-util#353 ·
-
tsconfig: Disable `strictNullChecks`, enable `strict`Possibly taken @itzKLAUS claimed this 36 days ago. Openteam-wallet-framework
Difficulty 1/5 Under an hour Newbie friendliness 55/100
MetaMask/eth-sig-util#352 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
MetaMask/eth-sig-util#328 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 35/100
MetaMask/eth-sig-util#304 · 4 comments · 4 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
MetaMask/eth-sig-util#303 ·
All issues in MetaMask/eth-sig-util
Similar issues
-
desktop v3 windows
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
esengine/DeepSeek-Reasonix#15016 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
readest/readest#7413 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement good first issue priority: medium size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
content triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
eliasstravik/herdr-projects#788 ·