From ba6bb4748a36386c929151ca71b21dd0eb85eb1f Mon Sep 17 00:00:00 2001 From: Michele Meloni Date: Mon, 6 Nov 2023 16:42:27 +0100 Subject: [PATCH 1/2] fix(eip712): skip empty strings from type mapping --- eip712_cosmos.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eip712_cosmos.go b/eip712_cosmos.go index 313eecd8..13d8ba7c 100644 --- a/eip712_cosmos.go +++ b/eip712_cosmos.go @@ -301,6 +301,10 @@ func traverseFields( if isCollection { ethTyp += "[]" } + if field.Kind() == reflect.String && ethTyp == "string" && field.Len() == 0 { + // skip empty strings from type mapping + continue + } if prefix == typeDefPrefix { typeMap[rootType] = append(typeMap[rootType], typeddata.Type{ Name: fieldName, From fbaa2edd66a41f65d12a2175250cfa8b8aa10903 Mon Sep 17 00:00:00 2001 From: Michele Meloni Date: Mon, 6 Nov 2023 17:08:33 +0100 Subject: [PATCH 2/2] chore(eip712): simplify empty string check --- eip712_cosmos.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eip712_cosmos.go b/eip712_cosmos.go index 13d8ba7c..73d3ef1c 100644 --- a/eip712_cosmos.go +++ b/eip712_cosmos.go @@ -301,7 +301,7 @@ func traverseFields( if isCollection { ethTyp += "[]" } - if field.Kind() == reflect.String && ethTyp == "string" && field.Len() == 0 { + if field.Kind() == reflect.String && field.Len() == 0 { // skip empty strings from type mapping continue }