chore(types): replace amino json encoder with stdlib (#18963)
This commit is contained in:
parent
48516bbf36
commit
732f26b5fe
@ -83,6 +83,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* (tx) [#18772](https://github.com/cosmos/cosmos-sdk/pull/18772) Remove misleading gas wanted from tx simulation failure log.
|
||||
* (tx) [#18852](https://github.com/cosmos/cosmos-sdk/pull/18852) Add `WithFromName` to tx factory.
|
||||
* (testutil) [#18930](https://github.com/cosmos/cosmos-sdk/pull/18930) Add NodeURI for clientCtx.
|
||||
* (types) [#18963](https://github.com/cosmos/cosmos-sdk/pull/18963) Swap out amino json encoding of `ABCIMessageLogs` for std lib json encoding
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
||||
@ -45,8 +45,7 @@ func NewABCIMessageLog(i uint32, log string, events Events) ABCIMessageLog {
|
||||
// String implements the fmt.Stringer interface for the ABCIMessageLogs type.
|
||||
func (logs ABCIMessageLogs) String() (str string) {
|
||||
if logs != nil {
|
||||
cdc := codec.NewLegacyAmino()
|
||||
raw, err := cdc.MarshalJSON(logs)
|
||||
raw, err := json.Marshal(logs)
|
||||
if err == nil {
|
||||
str = string(raw)
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package types_test
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@ -12,7 +13,6 @@ import (
|
||||
cmt "github.com/cometbft/cometbft/types"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
@ -39,14 +39,13 @@ func (s *resultTestSuite) TestParseABCILog() {
|
||||
}
|
||||
|
||||
func (s *resultTestSuite) TestABCIMessageLog() {
|
||||
cdc := codec.NewLegacyAmino()
|
||||
events := sdk.Events{
|
||||
sdk.NewEvent("transfer", sdk.NewAttribute("sender", "foo")),
|
||||
sdk.NewEvent("transfer", sdk.NewAttribute("sender", "bar")),
|
||||
}
|
||||
msgLog := sdk.NewABCIMessageLog(0, "", events)
|
||||
msgLogs := sdk.ABCIMessageLogs{msgLog}
|
||||
bz, err := cdc.MarshalJSON(msgLogs)
|
||||
bz, err := json.Marshal(msgLogs)
|
||||
|
||||
s.Require().NoError(err)
|
||||
s.Require().Equal(string(bz), msgLogs.String())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user