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

Fix encoding of array in signTypedData_v4 #107

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Dec 2, 2021

  1. Fix encoding of array in signTypedData_v4

    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 were using basically `hashStruct` instead of `encodeData`
    cammellos committed Dec 2, 2021
    Configuration menu
    Copy the full SHA
    c3f3882 View commit details
    Browse the repository at this point in the history