From 72b0112e28898cab60f455e7a292c5e1e47e8ef2 Mon Sep 17 00:00:00 2001 From: Hwangjae Lee Date: Tue, 10 Sep 2024 16:41:05 +0900 Subject: [PATCH] Improve error messaging and enhance documentation in eip712_cosmos.go This PR improves error handling and enhances documentation in the eip712_cosmos.go file to provide clearer messages and more detailed explanations. Signed-off-by: Hwangjae Lee --- eip712_cosmos.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eip712_cosmos.go b/eip712_cosmos.go index cc0e645b..6c6bf2a0 100644 --- a/eip712_cosmos.go +++ b/eip712_cosmos.go @@ -231,7 +231,7 @@ func traverseFields( err = cdc.UnpackAny(any, &anyWrapper.Value) if err != nil { - err = errors.Wrap(err, "failed to unpack Any in msg struct") + err = errors.Wrapf(err, "failed to unpack Any in msg struct at field %s", fieldName) return err } @@ -354,8 +354,9 @@ func jsonNameFromTag(tag reflect.StructTag) string { } // _.foo_bar.baz -> TypeFooBarBaz -// this is needed for Geth's own signing code which doesn't -// tolerate complex type names +// sanitizeTypedef ensures that complex type names are simplified and +// conform to the format expected by Geth's signing code, which requires +// PascalCase for compatibility with EIP-712. func sanitizeTypedef(str string) string { buf := new(bytes.Buffer) parts := strings.Split(str, ".")