From de810b22a34ad1a0b612e315610db4c1a453f18f Mon Sep 17 00:00:00 2001 From: Ramiro Carlucho Date: Fri, 26 Aug 2022 18:10:16 +0100 Subject: [PATCH 1/3] fixes for 19.0.1 --- ethereum/eip712/eip712.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ethereum/eip712/eip712.go b/ethereum/eip712/eip712.go index 2f5b5eea1b..98065a86df 100644 --- a/ethereum/eip712/eip712.go +++ b/ethereum/eip712/eip712.go @@ -7,6 +7,7 @@ import ( "math/big" "reflect" "strings" + "time" sdkmath "cosmossdk.io/math" "golang.org/x/text/cases" @@ -232,6 +233,11 @@ func traverseFields( // then continue as normal } + // If its a nil pointer, do not include in types + if fieldType.Kind() == reflect.Ptr && field.IsNil() { + continue + } + for { if fieldType.Kind() == reflect.Ptr { fieldType = fieldType.Elem() @@ -296,6 +302,11 @@ func traverseFields( ethTyp := typToEth(fieldType) if len(ethTyp) > 0 { + // Support array of uint64 + if isCollection && fieldType.Kind() != reflect.Slice && fieldType.Kind() != reflect.Array { + ethTyp += "[]" + } + if prefix == typeDefPrefix { typeMap[rootType] = append(typeMap[rootType], apitypes.Type{ Name: fieldName, @@ -382,6 +393,7 @@ var ( bigIntType = reflect.TypeOf(big.Int{}) cosmIntType = reflect.TypeOf(sdkmath.Int{}) cosmosAnyType = reflect.TypeOf(&codectypes.Any{}) + timeType = reflect.TypeOf(time.Time{}) ) // typToEth supports only basic types and arrays of basic types. @@ -426,6 +438,7 @@ func typToEth(typ reflect.Type) string { } case reflect.Ptr: if typ.Elem().ConvertibleTo(bigIntType) || + typ.Elem().ConvertibleTo(timeType) || typ.Elem().ConvertibleTo(cosmIntType) { return str } @@ -433,6 +446,7 @@ func typToEth(typ reflect.Type) string { if typ.ConvertibleTo(hashType) || typ.ConvertibleTo(addressType) || typ.ConvertibleTo(bigIntType) || + typ.ConvertibleTo(timeType) || typ.ConvertibleTo(cosmIntType) { return str } From 5314a16b56fa838102a74c7eb9dc8c10fb5891a8 Mon Sep 17 00:00:00 2001 From: Ramiro Carlucho Date: Fri, 26 Aug 2022 18:37:46 +0100 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e741fd76c..e9e2cc167a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (feemarket) [\#1165](https://github.com/evmos/ethermint/pull/1165) Add hint in specs about different gas terminology for gas in Cosmos and Ethereum. * (cli) [#1226](https://github.com/evmos/ethermint/pull/1226) Add custom app db backend flag. * (cli) [#1230](https://github.com/evmos/ethermint/pull/1230) Remove redundant positional height parameter from feemarket's query cli. +* (eth) [#1305](https://github.com/evmos/ethermint/pull/1305) Added support for optional params, basic types arrays and `time` type on eip712. ### Bug Fixes From e88ee06af9c6f964a07b973439c368270e071755 Mon Sep 17 00:00:00 2001 From: Ramiro Carlucho Date: Fri, 26 Aug 2022 18:49:54 +0100 Subject: [PATCH 3/3] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9e2cc167a..62f9fc1f81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ recompute eth tx hashes in JSON-RPC APIs to fix old blocks. * (deps) [#1168](https://github.com/evmos/ethermint/pull/1168) Upgrade cosmos-sdk to v0.46. * (feemarket) [#1194](https://github.com/evmos/ethermint/pull/1194) Apply feemarket to native cosmos tx. +* (eth) [#1305](https://github.com/evmos/ethermint/pull/1305) Added support for optional params, basic types arrays and `time` type on eip712. ### API Breaking @@ -57,7 +58,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (feemarket) [\#1165](https://github.com/evmos/ethermint/pull/1165) Add hint in specs about different gas terminology for gas in Cosmos and Ethereum. * (cli) [#1226](https://github.com/evmos/ethermint/pull/1226) Add custom app db backend flag. * (cli) [#1230](https://github.com/evmos/ethermint/pull/1230) Remove redundant positional height parameter from feemarket's query cli. -* (eth) [#1305](https://github.com/evmos/ethermint/pull/1305) Added support for optional params, basic types arrays and `time` type on eip712. ### Bug Fixes