From d50c0d71d5f796667af98af057b87afc9f309b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=E1=BA=B7c?= Date: Tue, 12 Dec 2023 10:05:29 +0700 Subject: [PATCH 1/3] nguyen/remove-MustSortJson-types-Acknowledgement --- modules/core/04-channel/types/acknowledgement.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/core/04-channel/types/acknowledgement.go b/modules/core/04-channel/types/acknowledgement.go index 9b802d0e2c7..ae712fac5f7 100644 --- a/modules/core/04-channel/types/acknowledgement.go +++ b/modules/core/04-channel/types/acknowledgement.go @@ -1,13 +1,12 @@ package types import ( + "encoding/json" "fmt" "reflect" "strings" errorsmod "cosmossdk.io/errors" - - sdk "github.com/cosmos/cosmos-sdk/types" ) const ( @@ -70,5 +69,9 @@ func (ack Acknowledgement) Success() bool { // Acknowledgement implements the Acknowledgement interface. It returns the // acknowledgement serialised using JSON. func (ack Acknowledgement) Acknowledgement() []byte { - return sdk.MustSortJSON(SubModuleCdc.MustMarshalJSON(&ack)) + res, err := json.Marshal(SubModuleCdc.MustMarshalJSON(&ack)) + if err != nil { + panic("acknowledgement cannot marshal json") + } + return res } From 46f78ab147b3eee9b187d67751dfe8b80b86a853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=E1=BA=B7c?= Date: Wed, 13 Dec 2023 15:19:07 +0700 Subject: [PATCH 2/3] remove MustSortJson --- modules/core/04-channel/types/acknowledgement.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/04-channel/types/acknowledgement.go b/modules/core/04-channel/types/acknowledgement.go index ae712fac5f7..465526a47ff 100644 --- a/modules/core/04-channel/types/acknowledgement.go +++ b/modules/core/04-channel/types/acknowledgement.go @@ -69,7 +69,7 @@ func (ack Acknowledgement) Success() bool { // Acknowledgement implements the Acknowledgement interface. It returns the // acknowledgement serialised using JSON. func (ack Acknowledgement) Acknowledgement() []byte { - res, err := json.Marshal(SubModuleCdc.MustMarshalJSON(&ack)) + res, err := json.Marshal(&ack) if err != nil { panic("acknowledgement cannot marshal json") } From b4a9649bd069c9e0de456e4890d17fa975119b8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=E1=BA=B7c?= Date: Mon, 18 Dec 2023 15:10:13 +0700 Subject: [PATCH 3/3] using SubModuleCdc.MustMarshalJSON --- modules/core/04-channel/types/acknowledgement.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/core/04-channel/types/acknowledgement.go b/modules/core/04-channel/types/acknowledgement.go index 465526a47ff..e8db340bfeb 100644 --- a/modules/core/04-channel/types/acknowledgement.go +++ b/modules/core/04-channel/types/acknowledgement.go @@ -1,7 +1,6 @@ package types import ( - "encoding/json" "fmt" "reflect" "strings" @@ -69,9 +68,5 @@ func (ack Acknowledgement) Success() bool { // Acknowledgement implements the Acknowledgement interface. It returns the // acknowledgement serialised using JSON. func (ack Acknowledgement) Acknowledgement() []byte { - res, err := json.Marshal(&ack) - if err != nil { - panic("acknowledgement cannot marshal json") - } - return res + return SubModuleCdc.MustMarshalJSON(&ack) }