From 4da1e29320a75cd22accf835b26a696bae2bad68 Mon Sep 17 00:00:00 2001 From: Conor Patrick Date: Mon, 13 Apr 2026 09:30:36 -0400 Subject: [PATCH] signer/core/apitypes: fix encoding of opening parenthesis (#33702) This fixes a truncation bug that results in an invalid serialization of empty EIP712. For example: ```json { "method": "eth_signTypedData_v4", "request": { "types": { "EIP712Domain": [ { "name": "version", "type": "string" } ], "Empty": [] }, "primaryType": "Empty", "domain": { "version": "0" }, "message": {} } } ``` When calculating the type-hash for the stuct-hash, it will incorrectly use `Empty)` instead of `Empty()` --- signer/core/apitypes/types.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/signer/core/apitypes/types.go b/signer/core/apitypes/types.go index 401f4fba07..ee12bb263e 100644 --- a/signer/core/apitypes/types.go +++ b/signer/core/apitypes/types.go @@ -454,7 +454,9 @@ func (typedData *TypedData) EncodeType(primaryType string) hexutil.Bytes { buffer.WriteString(obj.Name) buffer.WriteString(",") } - buffer.Truncate(buffer.Len() - 1) + if len(typedData.Types[dep]) > 0 { + buffer.Truncate(buffer.Len() - 1) + } buffer.WriteString(")") } return buffer.Bytes()