Move codec.RegisterCrypto and codec.Cdc to new packages (#6330)
* Move codec.Cdc to legacy_global.Cdc * Update CHANGELOG.md * Updates * nit * Fix imports * Updates * Use cosmos multisig instead of tendermint multisig everywhere * Fix tests * Rename legacy_global -> legacy * Add doc.go * Linting, move all RegisterCrypto calls to crypto/codec * Update crypto/codec/amino.go Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
co-authored by
Federico Kunze
parent
dcbf152ae5
commit
81d647e505
+1
-1
@@ -9,9 +9,9 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
tmamino "github.com/tendermint/tendermint/crypto/encoding/amino"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
tmamino "github.com/cosmos/cosmos-sdk/crypto/codec"
|
||||
"github.com/cosmos/cosmos-sdk/types/bech32"
|
||||
)
|
||||
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@ import (
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/legacy"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
@@ -180,7 +181,7 @@ func CheckNotFoundError(w http.ResponseWriter, err error) bool {
|
||||
func WriteErrorResponse(w http.ResponseWriter, status int, err string) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(status)
|
||||
_, _ = w.Write(codec.Cdc.MustMarshalJSON(NewErrorResponse(0, err)))
|
||||
_, _ = w.Write(legacy.Cdc.MustMarshalJSON(NewErrorResponse(0, err)))
|
||||
}
|
||||
|
||||
// WriteSimulationResponse prepares and writes an HTTP
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||
)
|
||||
@@ -199,7 +200,7 @@ func TestProcessPostResponse(t *testing.T) {
|
||||
|
||||
acc := mockAccount{addr, coins, pubKey, accNumber, sequence}
|
||||
cdc := codec.New()
|
||||
codec.RegisterCrypto(cdc)
|
||||
cryptocodec.RegisterCrypto(cdc)
|
||||
cdc.RegisterConcrete(&mockAccount{}, "cosmos-sdk/mockAccount", nil)
|
||||
ctx = ctx.WithCodec(cdc)
|
||||
|
||||
|
||||
+4
-4
@@ -9,10 +9,10 @@ import (
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/types"
|
||||
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec/legacy"
|
||||
"github.com/cosmos/cosmos-sdk/codec/types"
|
||||
)
|
||||
|
||||
func (gi GasInfo) String() string {
|
||||
@@ -58,7 +58,7 @@ func NewABCIMessageLog(i uint16, log string, events Events) ABCIMessageLog {
|
||||
// String implements the fmt.Stringer interface for the ABCIMessageLogs type.
|
||||
func (logs ABCIMessageLogs) String() (str string) {
|
||||
if logs != nil {
|
||||
raw, err := codec.Cdc.MarshalJSON(logs)
|
||||
raw, err := legacy.Cdc.MarshalJSON(logs)
|
||||
if err == nil {
|
||||
str = string(raw)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/tendermint/tendermint/libs/bytes"
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/legacy"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
@@ -31,7 +31,7 @@ func TestABCIMessageLog(t *testing.T) {
|
||||
msgLog := sdk.NewABCIMessageLog(0, "", events)
|
||||
|
||||
msgLogs := sdk.ABCIMessageLogs{msgLog}
|
||||
bz, err := codec.Cdc.MarshalJSON(msgLogs)
|
||||
bz, err := legacy.Cdc.MarshalJSON(msgLogs)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, string(bz), msgLogs.String())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user