Skip to content
This repository was archived by the owner on Apr 4, 2024. It is now read-only.

Commit 0b1a3ae

Browse files
authored
fixes for 19.0.1 (#1305) (#1306)
1 parent 9ec604a commit 0b1a3ae

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ Ref: https://keepachangelog.com/en/1.0.0/
3636

3737
# Changelog
3838

39+
## [v0.19.1] - 2022-08-26
40+
41+
### State Machine Breaking
42+
43+
* (eth) [#1305](https://github.com/evmos/ethermint/pull/1305) Added support for optional params, basic types arrays and `time` type on eip712.
44+
3945
## [v0.19.0] - 2022-08-15
4046

4147
### State Machine Breaking

ethereum/eip712/eip712.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"math/big"
88
"reflect"
99
"strings"
10+
"time"
1011

1112
"golang.org/x/text/cases"
1213
"golang.org/x/text/language"
@@ -231,6 +232,11 @@ func traverseFields(
231232
// then continue as normal
232233
}
233234

235+
// If its a nil pointer, do not include in types
236+
if fieldType.Kind() == reflect.Ptr && field.IsNil() {
237+
continue
238+
}
239+
234240
for {
235241
if fieldType.Kind() == reflect.Ptr {
236242
fieldType = fieldType.Elem()
@@ -295,6 +301,11 @@ func traverseFields(
295301

296302
ethTyp := typToEth(fieldType)
297303
if len(ethTyp) > 0 {
304+
// Support array of uint64
305+
if isCollection && fieldType.Kind() != reflect.Slice && fieldType.Kind() != reflect.Array {
306+
ethTyp += "[]"
307+
}
308+
298309
if prefix == typeDefPrefix {
299310
typeMap[rootType] = append(typeMap[rootType], apitypes.Type{
300311
Name: fieldName,
@@ -381,6 +392,7 @@ var (
381392
bigIntType = reflect.TypeOf(big.Int{})
382393
cosmIntType = reflect.TypeOf(sdk.Int{})
383394
cosmosAnyType = reflect.TypeOf(&codectypes.Any{})
395+
timeType = reflect.TypeOf(time.Time{})
384396
)
385397

386398
// typToEth supports only basic types and arrays of basic types.
@@ -425,13 +437,15 @@ func typToEth(typ reflect.Type) string {
425437
}
426438
case reflect.Ptr:
427439
if typ.Elem().ConvertibleTo(bigIntType) ||
440+
typ.Elem().ConvertibleTo(timeType) ||
428441
typ.Elem().ConvertibleTo(cosmIntType) {
429442
return str
430443
}
431444
case reflect.Struct:
432445
if typ.ConvertibleTo(hashType) ||
433446
typ.ConvertibleTo(addressType) ||
434447
typ.ConvertibleTo(bigIntType) ||
448+
typ.ConvertibleTo(timeType) ||
435449
typ.ConvertibleTo(cosmIntType) {
436450
return str
437451
}

0 commit comments

Comments
 (0)