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

EIP-712 typed data validation does not support fixed size arrays #30183

Closed
mdymalla opened this issue Jul 18, 2024 · 1 comment
Closed

EIP-712 typed data validation does not support fixed size arrays #30183

mdymalla opened this issue Jul 18, 2024 · 1 comment
Labels

Comments

@mdymalla
Copy link
Contributor

System information

Geth version: latest (1.14.7)

Expected behaviour

Encoding a typed data struct should support fixed size arrays as EIP-712 specifies, Arrays are either fixed size or dynamic and denoted by Type[n] or Type[] respectively.

Actual behaviour

Encoding a typed data struct fails validation if a fixed size array is referenced

Steps to reproduce the behaviour

declare a TypedData variable:

typedData := TypedData{
		Types: Types{
			"BulkOrder": []Type{
				{Name: "tree", Type: "OrderComponents[2][2]"},
			},
			"OrderComponents": []Type{
				{Name: "offerer", Type: "address"},
				{Name: "amount", Type: "uint8"},
			},
			"EIP712Domain": []Type{
				{Name: "name", Type: "string"},
				{Name: "version", Type: "string"},
				{Name: "chainId", Type: "uint8"},
				{Name: "verifyingContract", Type: "address"},
			},
		},
		PrimaryType: "BulkOrder",
		Domain: TypedDataDomain{
			VerifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
		},
		Message: TypedDataMessage{},
}

call EncodeData method on the variable:

typedData.EncodeData("EIP712Domain", typedData.Domain.Map(), 1)
@holiman
Copy link
Contributor

holiman commented Aug 28, 2024

Fixed by #30175 (thank you!)

@holiman holiman closed this as completed Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants