From 935a63f04da34e5fdeaa0b1bca7ec62c5f596d15 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Mon, 20 Nov 2023 15:49:04 +0100 Subject: [PATCH 1/2] Use new Uint64 for IBCTimeout timestamp --- types/ibc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ibc.go b/types/ibc.go index 6fc412f17..6ed857b06 100644 --- a/types/ibc.go +++ b/types/ibc.go @@ -180,7 +180,7 @@ func (t IBCTimeoutBlock) IsZero() bool { type IBCTimeout struct { Block *IBCTimeoutBlock `json:"block"` // Nanoseconds since UNIX epoch - Timestamp uint64 `json:"timestamp,string,omitempty"` + Timestamp *Uint64 `json:"timestamp,omitempty"` } type IBCAcknowledgement struct { From 51d6a71657525ca80547bb976e1958880847649e Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Mon, 20 Nov 2023 16:01:32 +0100 Subject: [PATCH 2/2] Fix IBCTimeout tests --- types/ibc_test.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/types/ibc_test.go b/types/ibc_test.go index d859f3a6c..014647db7 100644 --- a/types/ibc_test.go +++ b/types/ibc_test.go @@ -9,13 +9,14 @@ import ( ) func TestIbcTimeoutSerialization(t *testing.T) { + ts := Uint64(1578939743_987654321) // All set timeout := IBCTimeout{ Block: &IBCTimeoutBlock{ Revision: 17, Height: 42, }, - Timestamp: 1578939743_987654321, + Timestamp: &ts, } bz, err := json.Marshal(timeout) require.NoError(t, err) @@ -24,7 +25,7 @@ func TestIbcTimeoutSerialization(t *testing.T) { // Null block timeout = IBCTimeout{ Block: nil, - Timestamp: 1578939743_987654321, + Timestamp: &ts, } bz, err = json.Marshal(timeout) require.NoError(t, err) @@ -38,7 +39,7 @@ func TestIbcTimeoutSerialization(t *testing.T) { Revision: 17, Height: 42, }, - Timestamp: 0, + Timestamp: nil, } bz, err = json.Marshal(timeout) require.NoError(t, err) @@ -47,6 +48,7 @@ func TestIbcTimeoutSerialization(t *testing.T) { func TestIbcTimeoutDeserialization(t *testing.T) { var err error + ts := Uint64(1578939743_987654321) // All set var timeout1 IBCTimeout @@ -57,7 +59,7 @@ func TestIbcTimeoutDeserialization(t *testing.T) { Revision: 17, Height: 42, }, - Timestamp: 1578939743_987654321, + Timestamp: &ts, }, timeout1) // Null block @@ -66,7 +68,7 @@ func TestIbcTimeoutDeserialization(t *testing.T) { require.NoError(t, err) assert.Equal(t, IBCTimeout{ Block: nil, - Timestamp: 1578939743_987654321, + Timestamp: &ts, }, timeout2) // Null timestamp @@ -78,6 +80,6 @@ func TestIbcTimeoutDeserialization(t *testing.T) { Revision: 17, Height: 42, }, - Timestamp: 0, + Timestamp: nil, }, timeout3) }