Enable proto JSON generally and remove HybridCodec (#6859)

* Remove HybridCodec

* WIP on fixing proto JSON issues

* WIP on fixing proto JSON issues

* WIP on fixing proto JSON issues

* WIP on fixing proto JSON issues

* WIP on fixing proto JSON issues

* Test fixes

* Delete hybrid_codec.go

* Fixes

* Fixes

* Fixes

* Test fixes

* Test fixes

* Test fixes

* Lint

* Sim fixes

* Sim fixes

* Revert

* Remove vesting account JSON tests

* Update CHANGELOG.md

* Lint

* Sim fixes

* Sim fixes

* Docs

* Migrate more amino usages

* Remove custom VoteOption String() and json marshaling

* Fix tests

* Add comments, update CHANGELOG.md

Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
This commit is contained in:
Aaron Craelius 2020-08-13 09:20:02 -04:00 committed by GitHub
parent 134e1dcecd
commit 816c5a37bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
77 changed files with 325 additions and 845 deletions

View File

@ -62,7 +62,8 @@ older clients.
* (client/keys) [\#5889](https://github.com/cosmos/cosmos-sdk/pull/5889) Remove `keys update` command.
* (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Remove CLI and REST handlers for querying `x/evidence` parameters.
* (server) [\#5982](https://github.com/cosmos/cosmos-sdk/pull/5982) `--pruning` now must be set to `custom` if you want to customise the granular options.
* (x/gov) [\#7000](https://github.com/cosmos/cosmos-sdk/pull/7000) `ProposalStatus` is now JSON serialized using its protobuf name, so expect names like `PROPOSAL_STATUS_DEPOSIT_PERIOD` as opposed to `DepositPeriod`.
* (x/gov) [\#7000](https://github.com/cosmos/cosmos-sdk/pull/7000) [\#6859](https://github.com/cosmos/cosmos-sdk/pull/6859) `ProposalStatus` and `VoteOption` are now JSON serialized using its protobuf name, so expect names like `PROPOSAL_STATUS_DEPOSIT_PERIOD` as opposed to `DepositPeriod`.
* (x/auth/vesting) [\#6859](https://github.com/cosmos/cosmos-sdk/pull/6859) Custom JSON marshaling of vesting accounts was removed. Vesting accounts are now marshaled using their default proto or amino JSON representation.
### API Breaking Changes

View File

@ -1,69 +0,0 @@
package codec
import "github.com/cosmos/cosmos-sdk/codec/types"
// HybridCodec defines a codec that utilizes Protobuf for binary encoding
// and Amino for JSON encoding.
type HybridCodec struct {
proto Marshaler
amino Marshaler
}
func NewHybridCodec(amino *LegacyAmino, unpacker types.AnyUnpacker) Marshaler {
return &HybridCodec{
proto: NewProtoCodec(unpacker),
amino: NewAminoCodec(amino),
}
}
func (hc *HybridCodec) MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) {
return hc.proto.MarshalBinaryBare(o)
}
func (hc *HybridCodec) MustMarshalBinaryBare(o ProtoMarshaler) []byte {
return hc.proto.MustMarshalBinaryBare(o)
}
func (hc *HybridCodec) MarshalBinaryLengthPrefixed(o ProtoMarshaler) ([]byte, error) {
return hc.proto.MarshalBinaryLengthPrefixed(o)
}
func (hc *HybridCodec) MustMarshalBinaryLengthPrefixed(o ProtoMarshaler) []byte {
return hc.proto.MustMarshalBinaryLengthPrefixed(o)
}
func (hc *HybridCodec) UnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) error {
return hc.proto.UnmarshalBinaryBare(bz, ptr)
}
func (hc *HybridCodec) MustUnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) {
hc.proto.MustUnmarshalBinaryBare(bz, ptr)
}
func (hc *HybridCodec) UnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) error {
return hc.proto.UnmarshalBinaryLengthPrefixed(bz, ptr)
}
func (hc *HybridCodec) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) {
hc.proto.MustUnmarshalBinaryLengthPrefixed(bz, ptr)
}
func (hc *HybridCodec) MarshalJSON(o interface{}) ([]byte, error) {
return hc.amino.MarshalJSON(o)
}
func (hc *HybridCodec) MustMarshalJSON(o interface{}) []byte {
return hc.amino.MustMarshalJSON(o)
}
func (hc *HybridCodec) UnmarshalJSON(bz []byte, ptr interface{}) error {
return hc.amino.UnmarshalJSON(bz, ptr)
}
func (hc *HybridCodec) MustUnmarshalJSON(bz []byte, ptr interface{}) {
hc.amino.MustUnmarshalJSON(bz, ptr)
}
func (hc *HybridCodec) UnpackAny(any *types.Any, iface interface{}) error {
return hc.proto.UnpackAny(any, iface)
}

View File

@ -1,108 +0,0 @@
package codec_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
)
func TestHybridCodec(t *testing.T) {
testCases := []struct {
name string
codec codec.Marshaler
input codec.ProtoMarshaler
recv codec.ProtoMarshaler
marshalErr bool
unmarshalErr bool
}{
{
"valid encoding and decoding",
codec.NewHybridCodec(createTestCodec(), createTestInterfaceRegistry()),
&testdata.Dog{Name: "rufus"},
&testdata.Dog{},
false,
false,
},
{
"invalid decode type",
codec.NewHybridCodec(createTestCodec(), createTestInterfaceRegistry()),
&testdata.Dog{Name: "rufus"},
&testdata.Cat{},
false,
true,
},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
bz, err := tc.codec.MarshalBinaryBare(tc.input)
if tc.marshalErr {
require.Error(t, err)
require.Panics(t, func() { tc.codec.MustMarshalBinaryBare(tc.input) })
} else {
var bz2 []byte
require.NoError(t, err)
require.NotPanics(t, func() { bz2 = tc.codec.MustMarshalBinaryBare(tc.input) })
require.Equal(t, bz, bz2)
err := tc.codec.UnmarshalBinaryBare(bz, tc.recv)
if tc.unmarshalErr {
require.Error(t, err)
require.Panics(t, func() { tc.codec.MustUnmarshalBinaryBare(bz, tc.recv) })
} else {
require.NoError(t, err)
require.NotPanics(t, func() { tc.codec.MustUnmarshalBinaryBare(bz, tc.recv) })
require.Equal(t, tc.input, tc.recv)
}
}
bz, err = tc.codec.MarshalBinaryLengthPrefixed(tc.input)
if tc.marshalErr {
require.Error(t, err)
require.Panics(t, func() { tc.codec.MustMarshalBinaryLengthPrefixed(tc.input) })
} else {
var bz2 []byte
require.NoError(t, err)
require.NotPanics(t, func() { bz2 = tc.codec.MustMarshalBinaryLengthPrefixed(tc.input) })
require.Equal(t, bz, bz2)
err := tc.codec.UnmarshalBinaryLengthPrefixed(bz, tc.recv)
if tc.unmarshalErr {
require.Error(t, err)
require.Panics(t, func() { tc.codec.MustUnmarshalBinaryLengthPrefixed(bz, tc.recv) })
} else {
require.NoError(t, err)
require.NotPanics(t, func() { tc.codec.MustUnmarshalBinaryLengthPrefixed(bz, tc.recv) })
require.Equal(t, tc.input, tc.recv)
}
}
bz, err = tc.codec.MarshalJSON(tc.input)
if tc.marshalErr {
require.Error(t, err)
require.Panics(t, func() { tc.codec.MustMarshalJSON(tc.input) })
} else {
var bz2 []byte
require.NoError(t, err)
require.NotPanics(t, func() { bz2 = tc.codec.MustMarshalJSON(tc.input) })
require.Equal(t, bz, bz2)
err := tc.codec.UnmarshalJSON(bz, tc.recv)
if tc.unmarshalErr {
require.Error(t, err)
require.Panics(t, func() { tc.codec.MustUnmarshalJSON(bz, tc.recv) })
} else {
require.NoError(t, err)
require.NotPanics(t, func() { tc.codec.MustUnmarshalJSON(bz, tc.recv) })
require.Equal(t, tc.input, tc.recv)
}
}
})
}
}

View File

@ -12,7 +12,9 @@ import (
// ProtoMarshalJSON provides an auxiliary function to return Proto3 JSON encoded
// bytes of a message.
func ProtoMarshalJSON(msg proto.Message) ([]byte, error) {
jm := &jsonpb.Marshaler{OrigName: true}
// We use the OrigName because camel casing fields just doesn't make sense.
// EmitDefaults is also often the more expected behavior for CLI users
jm := &jsonpb.Marshaler{OrigName: true, EmitDefaults: true}
err := types.UnpackInterfaces(msg, types.ProtoJSONPacker{JSONPBMarshaler: jm})
if err != nil {
return nil, err

View File

@ -15,8 +15,6 @@ option (gogoproto.goproto_getters_all) = false;
// VoteOption defines a vote option
enum VoteOption {
option (gogoproto.enum_stringer) = false;
option (gogoproto.goproto_enum_stringer) = false;
option (gogoproto.goproto_enum_prefix) = false;
// VOTE_OPTION_UNSPECIFIED defines a no-op vote option.

View File

@ -106,7 +106,8 @@ which accepts a path for the resulting pprof file.
serverCtx.Logger.Info("starting ABCI with Tendermint")
err := startInProcess(serverCtx, clientCtx.JSONMarshaler, appCreator)
// amino is needed here for backwards compatibility of REST routes
err := startInProcess(serverCtx, clientCtx.LegacyAmino, appCreator)
return err
},
}
@ -177,7 +178,8 @@ func startStandAlone(ctx *Context, appCreator types.AppCreator) error {
select {}
}
func startInProcess(ctx *Context, cdc codec.JSONMarshaler, appCreator types.AppCreator) error {
// legacyAminoCdc is used for the legacy REST API
func startInProcess(ctx *Context, legacyAminoCdc *codec.LegacyAmino, appCreator types.AppCreator) error {
cfg := ctx.Config
home := cfg.RootDir
@ -230,7 +232,9 @@ func startInProcess(ctx *Context, cdc codec.JSONMarshaler, appCreator types.AppC
clientCtx := client.Context{}.
WithHomeDir(home).
WithChainID(genDoc.ChainID).
WithJSONMarshaler(cdc).
WithJSONMarshaler(legacyAminoCdc).
// amino is needed here for backwards compatibility of REST routes
WithLegacyAmino(legacyAminoCdc).
WithClient(local.New(tmNode))
apiSrv = api.New(clientCtx, ctx.Logger.With("module", "api-server"))

View File

@ -202,7 +202,7 @@ func NewSimApp(
memKeys: memKeys,
}
app.ParamsKeeper = initParamsKeeper(appCodec, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey])
app.ParamsKeeper = initParamsKeeper(appCodec, cdc, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey])
// set the BaseApp's parameter store
bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(std.ConsensusParamsKeyTable()))
@ -503,9 +503,12 @@ func (app *SimApp) SimulationManager() *module.SimulationManager {
// RegisterAPIRoutes registers all application module routes with the provided
// API server.
func (app *SimApp) RegisterAPIRoutes(apiSvr *api.Server) {
rpc.RegisterRoutes(apiSvr.ClientCtx, apiSvr.Router)
authrest.RegisterTxRoutes(apiSvr.ClientCtx, apiSvr.Router)
ModuleBasics.RegisterRESTRoutes(apiSvr.ClientCtx, apiSvr.Router)
clientCtx := apiSvr.ClientCtx
// amino is needed here for backwards compatibility of REST routes
clientCtx = clientCtx.WithJSONMarshaler(clientCtx.LegacyAmino)
rpc.RegisterRoutes(clientCtx, apiSvr.Router)
authrest.RegisterTxRoutes(clientCtx, apiSvr.Router)
ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router)
}
// GetMaccPerms returns a copy of the module account permissions
@ -518,8 +521,8 @@ func GetMaccPerms() map[string][]string {
}
// initParamsKeeper init params keeper and its subspaces
func initParamsKeeper(appCodec codec.Marshaler, key, tkey sdk.StoreKey) paramskeeper.Keeper {
paramsKeeper := paramskeeper.NewKeeper(appCodec, key, tkey)
func initParamsKeeper(appCodec codec.BinaryMarshaler, legacyAmino *codec.LegacyAmino, key, tkey sdk.StoreKey) paramskeeper.Keeper {
paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey)
paramsKeeper.Subspace(authtypes.ModuleName)
paramsKeeper.Subspace(banktypes.ModuleName)

View File

@ -1,6 +1,7 @@
package simapp
import (
"encoding/json"
"os"
"testing"
@ -8,8 +9,6 @@ import (
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/codec"
abci "github.com/tendermint/tendermint/abci/types"
)
@ -18,7 +17,7 @@ func TestSimAppExport(t *testing.T) {
app := NewSimApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, MakeEncodingConfig())
genesisState := NewDefaultGenesisState()
stateBytes, err := codec.MarshalJSONIndent(app.LegacyAmino(), genesisState)
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
require.NoError(t, err)
// Initialize the chain

View File

@ -12,8 +12,7 @@ import (
func MakeEncodingConfig() EncodingConfig {
cdc := codec.New()
interfaceRegistry := types.NewInterfaceRegistry()
// TODO: switch to using AminoCodec here once amino compatibility is fixed
marshaler := codec.NewHybridCodec(cdc, interfaceRegistry)
marshaler := codec.NewAminoCodec(cdc)
return EncodingConfig{
InterfaceRegistry: interfaceRegistry,

View File

@ -13,8 +13,8 @@ import (
func MakeEncodingConfig() EncodingConfig {
amino := codec.New()
interfaceRegistry := types.NewInterfaceRegistry()
marshaler := codec.NewHybridCodec(amino, interfaceRegistry)
txCfg := tx.NewTxConfig(codec.NewProtoCodec(interfaceRegistry), std.DefaultPublicKeyCodec{}, tx.DefaultSignModes)
marshaler := codec.NewProtoCodec(interfaceRegistry)
txCfg := tx.NewTxConfig(marshaler, std.DefaultPublicKeyCodec{}, tx.DefaultSignModes)
return EncodingConfig{
InterfaceRegistry: interfaceRegistry,

View File

@ -30,8 +30,8 @@ func BenchmarkFullAppSimulation(b *testing.B) {
// run randomized simulation
_, simParams, simErr := simulation.SimulateFromSeed(
b, os.Stdout, app.BaseApp, AppStateFn(app.LegacyAmino(), app.SimulationManager()),
SimulationOperations(app, app.LegacyAmino(), config),
b, os.Stdout, app.BaseApp, AppStateFn(app.AppCodec(), app.SimulationManager()),
SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(), config,
)
@ -69,8 +69,8 @@ func BenchmarkInvariants(b *testing.B) {
// run randomized simulation
_, simParams, simErr := simulation.SimulateFromSeed(
b, os.Stdout, app.BaseApp, AppStateFn(app.LegacyAmino(), app.SimulationManager()),
SimulationOperations(app, app.LegacyAmino(), config),
b, os.Stdout, app.BaseApp, AppStateFn(app.AppCodec(), app.SimulationManager()),
SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(), config,
)

View File

@ -72,8 +72,8 @@ func TestFullAppSimulation(t *testing.T) {
// run randomized simulation
_, simParams, simErr := simulation.SimulateFromSeed(
t, os.Stdout, app.BaseApp, AppStateFn(app.LegacyAmino(), app.SimulationManager()),
SimulationOperations(app, app.LegacyAmino(), config),
t, os.Stdout, app.BaseApp, AppStateFn(app.AppCodec(), app.SimulationManager()),
SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(), config,
)
@ -104,8 +104,8 @@ func TestAppImportExport(t *testing.T) {
// Run randomized simulation
_, simParams, simErr := simulation.SimulateFromSeed(
t, os.Stdout, app.BaseApp, AppStateFn(app.LegacyAmino(), app.SimulationManager()),
SimulationOperations(app, app.LegacyAmino(), config),
t, os.Stdout, app.BaseApp, AppStateFn(app.AppCodec(), app.SimulationManager()),
SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(), config,
)
@ -137,12 +137,12 @@ func TestAppImportExport(t *testing.T) {
require.Equal(t, "SimApp", newApp.Name())
var genesisState GenesisState
err = app.LegacyAmino().UnmarshalJSON(appState, &genesisState)
err = json.Unmarshal(appState, &genesisState)
require.NoError(t, err)
ctxA := app.NewContext(true, abci.Header{Height: app.LastBlockHeight()})
ctxB := newApp.NewContext(true, abci.Header{Height: app.LastBlockHeight()})
newApp.mm.InitGenesis(ctxB, app.LegacyAmino(), genesisState)
newApp.mm.InitGenesis(ctxB, app.AppCodec(), genesisState)
newApp.StoreConsensusParams(ctxB, consensusParams)
fmt.Printf("comparing stores...\n")
@ -195,8 +195,8 @@ func TestAppSimulationAfterImport(t *testing.T) {
// Run randomized simulation
stopEarly, simParams, simErr := simulation.SimulateFromSeed(
t, os.Stdout, app.BaseApp, AppStateFn(app.LegacyAmino(), app.SimulationManager()),
SimulationOperations(app, app.LegacyAmino(), config),
t, os.Stdout, app.BaseApp, AppStateFn(app.AppCodec(), app.SimulationManager()),
SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(), config,
)
@ -237,8 +237,8 @@ func TestAppSimulationAfterImport(t *testing.T) {
})
_, _, err = simulation.SimulateFromSeed(
t, os.Stdout, newApp.BaseApp, AppStateFn(app.LegacyAmino(), app.SimulationManager()),
SimulationOperations(newApp, newApp.LegacyAmino(), config),
t, os.Stdout, newApp.BaseApp, AppStateFn(app.AppCodec(), app.SimulationManager()),
SimulationOperations(newApp, newApp.AppCodec(), config),
newApp.ModuleAccountAddrs(), config,
)
require.NoError(t, err)
@ -282,8 +282,8 @@ func TestAppStateDeterminism(t *testing.T) {
)
_, _, err := simulation.SimulateFromSeed(
t, os.Stdout, app.BaseApp, AppStateFn(app.LegacyAmino(), app.SimulationManager()),
SimulationOperations(app, app.LegacyAmino(), config),
t, os.Stdout, app.BaseApp, AppStateFn(app.AppCodec(), app.SimulationManager()),
SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(), config,
)
require.NoError(t, err)

View File

@ -54,7 +54,7 @@ var (
WithTxConfig(encodingConfig.TxConfig).
WithLegacyAmino(encodingConfig.Amino).
WithInput(os.Stdin).
WithAccountRetriever(types.NewAccountRetriever(encodingConfig.Marshaler)).
WithAccountRetriever(types.NewAccountRetriever(encodingConfig.Amino)).
WithBroadcastMode(flags.BroadcastBlock).
WithHomeDir(simapp.DefaultNodeHome)
)
@ -79,12 +79,12 @@ func init() {
authclient.Codec = encodingConfig.Marshaler
rootCmd.AddCommand(
withProtoJSON(genutilcli.InitCmd(simapp.ModuleBasics, simapp.DefaultNodeHome)),
withProtoJSON(genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome)),
genutilcli.InitCmd(simapp.ModuleBasics, simapp.DefaultNodeHome),
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome),
genutilcli.MigrateGenesisCmd(),
withProtoJSON(genutilcli.GenTxCmd(simapp.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome)),
withProtoJSON(genutilcli.ValidateGenesisCmd(simapp.ModuleBasics, encodingConfig.TxConfig)),
withProtoJSON(AddGenesisAccountCmd(simapp.DefaultNodeHome)),
genutilcli.GenTxCmd(simapp.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome),
genutilcli.ValidateGenesisCmd(simapp.ModuleBasics, encodingConfig.TxConfig),
AddGenesisAccountCmd(simapp.DefaultNodeHome),
tmcli.NewCompletionCmd(rootCmd, true),
testnetCmd(simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}),
debug.Cmd(),
@ -202,27 +202,3 @@ func exportAppStateAndTMValidators(
return simApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
}
// This is a temporary command middleware to enable proto JSON marshaling for testing.
// Once proto JSON works everywhere we can remove this and set ProtoCodec as default
func withProtoJSON(command *cobra.Command) *cobra.Command {
existing := command.PersistentPreRunE
if existing != nil {
command.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
err := existing(cmd, args)
if err != nil {
return err
}
return setProtoJSON(cmd, args)
}
} else {
command.PersistentPreRunE = setProtoJSON
}
return command
}
func setProtoJSON(cmd *cobra.Command, _ []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx = clientCtx.WithJSONMarshaler(codec.NewProtoCodec(clientCtx.InterfaceRegistry))
return client.SetCmdClientContext(cmd, clientCtx)
}

View File

@ -21,7 +21,7 @@ import (
// AppStateFn returns the initial application state using a genesis or the simulation parameters.
// It panics if the user provides files for both of them.
// If a file is not given for the genesis or the sim params, it creates a randomized one.
func AppStateFn(cdc *codec.LegacyAmino, simManager *module.SimulationManager) simtypes.AppStateFn {
func AppStateFn(cdc codec.JSONMarshaler, simManager *module.SimulationManager) simtypes.AppStateFn {
return func(r *rand.Rand, accs []simtypes.Account, config simtypes.Config,
) (appState json.RawMessage, simAccs []simtypes.Account, chainID string, genesisTimestamp time.Time) {
@ -71,7 +71,7 @@ func AppStateFn(cdc *codec.LegacyAmino, simManager *module.SimulationManager) si
// AppStateRandomizedFn creates calls each module's GenesisState generator function
// and creates the simulation params
func AppStateRandomizedFn(
simManager *module.SimulationManager, r *rand.Rand, cdc *codec.LegacyAmino,
simManager *module.SimulationManager, r *rand.Rand, cdc codec.JSONMarshaler,
accs []simtypes.Account, genesisTimestamp time.Time, appParams simtypes.AppParams,
) (json.RawMessage, []simtypes.Account) {
numAccs := int64(len(accs))
@ -115,7 +115,7 @@ func AppStateRandomizedFn(
simManager.GenerateGenesisStates(simState)
appState, err := cdc.MarshalJSON(genesisState)
appState, err := json.Marshal(genesisState)
if err != nil {
panic(err)
}
@ -125,7 +125,7 @@ func AppStateRandomizedFn(
// AppStateFromGenesisFileFn util function to generate the genesis AppState
// from a genesis.json file.
func AppStateFromGenesisFileFn(r io.Reader, cdc *codec.LegacyAmino, genesisFile string) (tmtypes.GenesisDoc, []simtypes.Account) {
func AppStateFromGenesisFileFn(r io.Reader, cdc codec.JSONMarshaler, genesisFile string) (tmtypes.GenesisDoc, []simtypes.Account) {
bytes, err := ioutil.ReadFile(genesisFile)
if err != nil {
panic(err)

View File

@ -19,7 +19,6 @@ import (
bam "github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp/helpers"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
@ -53,7 +52,7 @@ func Setup(isCheckTx bool) *SimApp {
if !isCheckTx {
// init chain must be called to stop deliverState from being nil
genesisState := NewDefaultGenesisState()
stateBytes, err := codec.MarshalJSONIndent(app.LegacyAmino(), genesisState)
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
if err != nil {
panic(err)
}
@ -83,7 +82,7 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs
// set genesis accounts
authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)
genesisState[authtypes.ModuleName] = app.LegacyAmino().MustMarshalJSON(authGenesis)
genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis)
validators := make([]stakingtypes.Validator, 0, len(valSet.Validators))
delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators))
@ -111,7 +110,7 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs
// set validators and delegations
stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations)
genesisState[stakingtypes.ModuleName] = app.LegacyAmino().MustMarshalJSON(stakingGenesis)
genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis)
totalSupply := sdk.NewCoins()
for _, b := range balances {
@ -121,9 +120,9 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs
// update total supply
bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{})
genesisState[banktypes.ModuleName] = app.LegacyAmino().MustMarshalJSON(bankGenesis)
genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis)
stateBytes, err := codec.MarshalJSONIndent(app.LegacyAmino(), genesisState)
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
require.NoError(t, err)
// init chain will set the validator set and initialize the genesis accounts

View File

@ -49,7 +49,7 @@ func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, dbm.DB, string,
// SimulationOperations retrieves the simulation params from the provided file path
// and returns all the modules weighted operations
func SimulationOperations(app App, cdc *codec.LegacyAmino, config simtypes.Config) []simtypes.WeightedOperation {
func SimulationOperations(app App, cdc codec.JSONMarshaler, config simtypes.Config) []simtypes.WeightedOperation {
simState := module.SimulationState{
AppParams: make(simtypes.AppParams),
Cdc: cdc,
@ -61,7 +61,10 @@ func SimulationOperations(app App, cdc *codec.LegacyAmino, config simtypes.Confi
panic(err)
}
app.LegacyAmino().MustUnmarshalJSON(bz, &simState.AppParams)
err = json.Unmarshal(bz, &simState.AppParams)
if err != nil {
panic(err)
}
}
simState.ParamChanges = app.SimulationManager().GenerateParamChanges(config.Seed)

View File

@ -92,7 +92,7 @@ func DefaultConfig() Config {
Codec: encCfg.Marshaler,
TxConfig: encCfg.TxConfig,
LegacyAmino: encCfg.Amino,
AccountRetriever: authtypes.NewAccountRetriever(encCfg.Marshaler),
AccountRetriever: authtypes.NewAccountRetriever(encCfg.Amino),
AppConstructor: NewSimApp,
GenesisState: simapp.ModuleBasics.DefaultGenesis(encCfg.Marshaler),
TimeoutCommit: 2 * time.Second,

View File

@ -99,7 +99,7 @@ func (sm *SimulationManager) WeightedOperations(simState SimulationState) []simu
// GenesisState generator function
type SimulationState struct {
AppParams simulation.AppParams
Cdc *codec.LegacyAmino // application codec
Cdc codec.JSONMarshaler // application codec
Rand *rand.Rand // random number
GenState map[string]json.RawMessage // genesis state
Accounts []simulation.Account // simulation accounts

View File

@ -170,7 +170,7 @@ func ExamplePaginate() {
accountStore := prefix.NewStore(balancesStore, addr1.Bytes())
pageRes, err := query.Paginate(accountStore, request.Pagination, func(key []byte, value []byte) error {
var tempRes sdk.Coin
err := app.LegacyAmino().UnmarshalBinaryBare(value, &tempRes)
err := app.AppCodec().UnmarshalBinaryBare(value, &tempRes)
if err != nil {
return err
}

View File

@ -45,7 +45,7 @@ func NewResponseWithHeight(height int64, result json.RawMessage) ResponseWithHei
// ParseResponseWithHeight returns the raw result from a JSON-encoded
// ResponseWithHeight object.
func ParseResponseWithHeight(cdc codec.JSONMarshaler, bz []byte) ([]byte, error) {
func ParseResponseWithHeight(cdc *codec.LegacyAmino, bz []byte) ([]byte, error) {
r := ResponseWithHeight{}
if err := cdc.UnmarshalJSON(bz, &r); err != nil {
return nil, err
@ -279,7 +279,7 @@ func PostProcessResponseBare(w http.ResponseWriter, ctx client.Context, body int
resp = b
default:
resp, err = ctx.JSONMarshaler.MarshalJSON(body)
resp, err = ctx.LegacyAmino.MarshalJSON(body)
if CheckInternalServerError(w, err) {
return
}
@ -303,15 +303,8 @@ func PostProcessResponse(w http.ResponseWriter, ctx client.Context, resp interfa
return
}
// TODO: Remove once PubKey Protobuf migration has been completed.
// ref: https://github.com/cosmos/cosmos-sdk/issues/6886
var marshaler codec.JSONMarshaler
if ctx.JSONMarshaler != nil {
marshaler = ctx.JSONMarshaler
} else {
marshaler = ctx.LegacyAmino
}
// LegacyAmino used intentionally for REST
marshaler := ctx.LegacyAmino
switch res := resp.(type) {
case []byte:

View File

@ -310,7 +310,8 @@ func TestPostProcessResponseBare(t *testing.T) {
encodingConfig := simappparams.MakeEncodingConfig()
clientCtx := client.Context{}.
WithTxConfig(encodingConfig.TxConfig).
WithJSONMarshaler(encodingConfig.Marshaler)
WithJSONMarshaler(encodingConfig.Amino). // amino used intentionally here
WithLegacyAmino(encodingConfig.Amino) // amino used intentionally here
// write bytes
w := httptest.NewRecorder()
bs := []byte("text string")

View File

@ -135,7 +135,7 @@ type AppParams map[string]json.RawMessage
// object. If it exists, it'll be decoded and returned. Otherwise, the provided
// ParamSimulator is used to generate a random value or default value (eg: in the
// case of operation weights where Rand is not used).
func (sp AppParams) GetOrGenerate(cdc *codec.LegacyAmino, key string, ptr interface{}, r *rand.Rand, ps ParamSimulator) {
func (sp AppParams) GetOrGenerate(cdc codec.JSONMarshaler, key string, ptr interface{}, r *rand.Rand, ps ParamSimulator) {
if v, ok := sp[key]; ok && v != nil {
cdc.MustUnmarshalJSON(v, ptr)
return

View File

@ -19,7 +19,6 @@ import (
"github.com/cosmos/cosmos-sdk/version"
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
"github.com/cosmos/cosmos-sdk/x/auth/types"
)
// GetSignCommand returns the sign command
@ -101,7 +100,7 @@ func makeMultiSignCmd() func(cmd *cobra.Command, args []string) error {
multisigPub := multisigInfo.GetPubKey().(multisig.PubKeyMultisigThreshold)
multisigSig := multisig.NewMultisig(len(multisigPub.PubKeys))
if !clientCtx.Offline {
accnum, seq, err := types.NewAccountRetriever(clientCtx.JSONMarshaler).GetAccountNumberSequence(clientCtx, multisigInfo.GetAddress())
accnum, seq, err := clientCtx.AccountRetriever.GetAccountNumberSequence(clientCtx, multisigInfo.GetAddress())
if err != nil {
return err
}

View File

@ -32,7 +32,7 @@ func QueryAccountRequestHandlerFn(storeName string, clientCtx client.Context) ht
return
}
accGetter := types.NewAccountRetriever(authclient.Codec)
accGetter := types.NewAccountRetriever(clientCtx.LegacyAmino)
account, height, err := accGetter.GetAccountWithHeight(clientCtx, addr)
if err != nil {

View File

@ -89,7 +89,7 @@ func RandomizedGenState(simState *module.SimulationState) {
authGenesis := types.NewGenesisState(params, genesisAccs)
fmt.Printf("Selected randomly generated auth parameters:\n%s\n", codec.MustMarshalJSONIndent(simState.Cdc, authGenesis.Params))
fmt.Printf("Selected randomly generated auth parameters:\n%s\n", codec.MustMarshalJSONIndent(simState.Cdc, &authGenesis.Params))
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(authGenesis)
}

View File

@ -11,11 +11,11 @@ import (
// AccountRetriever defines the properties of a type that can be used to
// retrieve accounts.
type AccountRetriever struct {
codec codec.JSONMarshaler
codec *codec.LegacyAmino
}
// NewAccountRetriever initialises a new AccountRetriever instance.
func NewAccountRetriever(codec codec.JSONMarshaler) AccountRetriever {
func NewAccountRetriever(codec *codec.LegacyAmino) AccountRetriever {
return AccountRetriever{codec: codec}
}

View File

@ -19,9 +19,9 @@ func TestAccountRetriever(t *testing.T) {
defer mockCtrl.Finish()
mockNodeQuerier := mocks.NewMockNodeQuerier(mockCtrl)
accRetr := types.NewAccountRetriever(appCodec)
accRetr := types.NewAccountRetriever(legacyAmino)
addr := []byte("test")
bs, err := appCodec.MarshalJSON(types.QueryAccountRequest{Address: addr})
bs, err := legacyAmino.MarshalJSON(types.QueryAccountRequest{Address: addr})
require.NoError(t, err)
route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryAccount)

View File

@ -6,12 +6,9 @@ import (
yaml "gopkg.in/yaml.v2"
"github.com/cosmos/cosmos-sdk/codec/legacy"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
vestexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported"
"github.com/tendermint/tendermint/crypto"
)
// Compile-time type assertions
@ -179,21 +176,6 @@ type vestingAccountYAML struct {
VestingPeriods Periods `json:"vesting_periods,omitempty" yaml:"vesting_periods,omitempty"`
}
type vestingAccountJSON struct {
Address sdk.AccAddress `json:"address" yaml:"address"`
PubKey crypto.PubKey `json:"public_key" yaml:"public_key"`
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
Sequence uint64 `json:"sequence" yaml:"sequence"`
OriginalVesting sdk.Coins `json:"original_vesting" yaml:"original_vesting"`
DelegatedFree sdk.Coins `json:"delegated_free" yaml:"delegated_free"`
DelegatedVesting sdk.Coins `json:"delegated_vesting" yaml:"delegated_vesting"`
EndTime int64 `json:"end_time" yaml:"end_time"`
// custom fields based on concrete vesting type which can be omitted
StartTime int64 `json:"start_time,omitempty" yaml:"start_time,omitempty"`
VestingPeriods Periods `json:"vesting_periods,omitempty" yaml:"vesting_periods,omitempty"`
}
func (bva BaseVestingAccount) String() string {
out, _ := bva.MarshalYAML()
return out.(string)
@ -229,38 +211,6 @@ func (bva BaseVestingAccount) MarshalYAML() (interface{}, error) {
return string(bz), err
}
// MarshalJSON returns the JSON representation of a BaseVestingAccount.
func (bva BaseVestingAccount) MarshalJSON() ([]byte, error) {
alias := vestingAccountJSON{
Address: bva.Address,
PubKey: bva.GetPubKey(),
AccountNumber: bva.AccountNumber,
Sequence: bva.Sequence,
OriginalVesting: bva.OriginalVesting,
DelegatedFree: bva.DelegatedFree,
DelegatedVesting: bva.DelegatedVesting,
EndTime: bva.EndTime,
}
return legacy.Cdc.MarshalJSON(alias)
}
// UnmarshalJSON unmarshals raw JSON bytes into a BaseVestingAccount.
func (bva *BaseVestingAccount) UnmarshalJSON(bz []byte) error {
var alias vestingAccountJSON
if err := legacy.Cdc.UnmarshalJSON(bz, &alias); err != nil {
return err
}
bva.BaseAccount = authtypes.NewBaseAccount(alias.Address, alias.PubKey, alias.AccountNumber, alias.Sequence)
bva.OriginalVesting = alias.OriginalVesting
bva.DelegatedFree = alias.DelegatedFree
bva.DelegatedVesting = alias.DelegatedVesting
bva.EndTime = alias.EndTime
return nil
}
//-----------------------------------------------------------------------------
// Continuous Vesting Account
@ -385,42 +335,6 @@ func (cva ContinuousVestingAccount) MarshalYAML() (interface{}, error) {
return string(bz), err
}
// MarshalJSON returns the JSON representation of a ContinuousVestingAccount.
func (cva ContinuousVestingAccount) MarshalJSON() ([]byte, error) {
alias := vestingAccountJSON{
Address: cva.Address,
PubKey: cva.GetPubKey(),
AccountNumber: cva.AccountNumber,
Sequence: cva.Sequence,
OriginalVesting: cva.OriginalVesting,
DelegatedFree: cva.DelegatedFree,
DelegatedVesting: cva.DelegatedVesting,
EndTime: cva.EndTime,
StartTime: cva.StartTime,
}
return legacy.Cdc.MarshalJSON(alias)
}
// UnmarshalJSON unmarshals raw JSON bytes into a ContinuousVestingAccount.
func (cva *ContinuousVestingAccount) UnmarshalJSON(bz []byte) error {
var alias vestingAccountJSON
if err := legacy.Cdc.UnmarshalJSON(bz, &alias); err != nil {
return err
}
cva.BaseVestingAccount = &BaseVestingAccount{
BaseAccount: authtypes.NewBaseAccount(alias.Address, alias.PubKey, alias.AccountNumber, alias.Sequence),
OriginalVesting: alias.OriginalVesting,
DelegatedFree: alias.DelegatedFree,
DelegatedVesting: alias.DelegatedVesting,
EndTime: alias.EndTime,
}
cva.StartTime = alias.StartTime
return nil
}
//-----------------------------------------------------------------------------
// Periodic Vesting Account
@ -575,44 +489,6 @@ func (pva PeriodicVestingAccount) MarshalYAML() (interface{}, error) {
return string(bz), err
}
// MarshalJSON returns the JSON representation of a PeriodicVestingAccount.
func (pva PeriodicVestingAccount) MarshalJSON() ([]byte, error) {
alias := vestingAccountJSON{
Address: pva.Address,
PubKey: pva.GetPubKey(),
AccountNumber: pva.AccountNumber,
Sequence: pva.Sequence,
OriginalVesting: pva.OriginalVesting,
DelegatedFree: pva.DelegatedFree,
DelegatedVesting: pva.DelegatedVesting,
EndTime: pva.EndTime,
StartTime: pva.StartTime,
VestingPeriods: pva.VestingPeriods,
}
return legacy.Cdc.MarshalJSON(alias)
}
// UnmarshalJSON unmarshals raw JSON bytes into a PeriodicVestingAccount.
func (pva *PeriodicVestingAccount) UnmarshalJSON(bz []byte) error {
var alias vestingAccountJSON
if err := legacy.Cdc.UnmarshalJSON(bz, &alias); err != nil {
return err
}
pva.BaseVestingAccount = &BaseVestingAccount{
BaseAccount: authtypes.NewBaseAccount(alias.Address, alias.PubKey, alias.AccountNumber, alias.Sequence),
OriginalVesting: alias.OriginalVesting,
DelegatedFree: alias.DelegatedFree,
DelegatedVesting: alias.DelegatedVesting,
EndTime: alias.EndTime,
}
pva.StartTime = alias.StartTime
pva.VestingPeriods = alias.VestingPeriods
return nil
}
//-----------------------------------------------------------------------------
// Delayed Vesting Account
@ -679,37 +555,3 @@ func (dva DelayedVestingAccount) String() string {
out, _ := dva.MarshalYAML()
return out.(string)
}
// MarshalJSON returns the JSON representation of a DelayedVestingAccount.
func (dva DelayedVestingAccount) MarshalJSON() ([]byte, error) {
alias := vestingAccountJSON{
Address: dva.Address,
PubKey: dva.GetPubKey(),
AccountNumber: dva.AccountNumber,
Sequence: dva.Sequence,
OriginalVesting: dva.OriginalVesting,
DelegatedFree: dva.DelegatedFree,
DelegatedVesting: dva.DelegatedVesting,
EndTime: dva.EndTime,
}
return legacy.Cdc.MarshalJSON(alias)
}
// UnmarshalJSON unmarshals raw JSON bytes into a DelayedVestingAccount.
func (dva *DelayedVestingAccount) UnmarshalJSON(bz []byte) error {
var alias vestingAccountJSON
if err := legacy.Cdc.UnmarshalJSON(bz, &alias); err != nil {
return err
}
dva.BaseVestingAccount = &BaseVestingAccount{
BaseAccount: authtypes.NewBaseAccount(alias.Address, alias.PubKey, alias.AccountNumber, alias.Sequence),
OriginalVesting: alias.OriginalVesting,
DelegatedFree: alias.DelegatedFree,
DelegatedVesting: alias.DelegatedVesting,
EndTime: alias.EndTime,
}
return nil
}

View File

@ -1,7 +1,6 @@
package types_test
import (
"encoding/json"
"testing"
"time"
@ -645,26 +644,6 @@ func TestGenesisAccountValidate(t *testing.T) {
}
}
func TestBaseVestingAccountJSON(t *testing.T) {
pubkey := secp256k1.GenPrivKey().PubKey()
addr := sdk.AccAddress(pubkey.Address())
coins := sdk.NewCoins(sdk.NewInt64Coin("test", 5))
baseAcc := authtypes.NewBaseAccount(addr, pubkey, 10, 50)
acc := types.NewBaseVestingAccount(baseAcc, coins, time.Now().Unix())
bz, err := json.Marshal(acc)
require.NoError(t, err)
bz1, err := acc.MarshalJSON()
require.NoError(t, err)
require.Equal(t, string(bz1), string(bz))
var a types.BaseVestingAccount
require.NoError(t, json.Unmarshal(bz, &a))
require.Equal(t, acc.String(), a.String())
}
func TestContinuousVestingAccountMarshal(t *testing.T) {
pubkey := secp256k1.GenPrivKey().PubKey()
addr := sdk.AccAddress(pubkey.Address())
@ -687,27 +666,6 @@ func TestContinuousVestingAccountMarshal(t *testing.T) {
require.NotNil(t, err)
}
func TestContinuousVestingAccountJSON(t *testing.T) {
pubkey := secp256k1.GenPrivKey().PubKey()
addr := sdk.AccAddress(pubkey.Address())
coins := sdk.NewCoins(sdk.NewInt64Coin("test", 5))
baseAcc := authtypes.NewBaseAccount(addr, pubkey, 10, 50)
baseVesting := types.NewBaseVestingAccount(baseAcc, coins, time.Now().Unix())
acc := types.NewContinuousVestingAccountRaw(baseVesting, baseVesting.EndTime)
bz, err := json.Marshal(acc)
require.NoError(t, err)
bz1, err := acc.MarshalJSON()
require.NoError(t, err)
require.Equal(t, string(bz1), string(bz))
var a types.ContinuousVestingAccount
require.NoError(t, json.Unmarshal(bz, &a))
require.Equal(t, acc.String(), a.String())
}
func TestPeriodicVestingAccountMarshal(t *testing.T) {
pubkey := secp256k1.GenPrivKey().PubKey()
addr := sdk.AccAddress(pubkey.Address())
@ -729,26 +687,6 @@ func TestPeriodicVestingAccountMarshal(t *testing.T) {
require.NotNil(t, err)
}
func TestPeriodicVestingAccountJSON(t *testing.T) {
pubkey := secp256k1.GenPrivKey().PubKey()
addr := sdk.AccAddress(pubkey.Address())
coins := sdk.NewCoins(sdk.NewInt64Coin("test", 5))
baseAcc := authtypes.NewBaseAccount(addr, pubkey, 10, 50)
acc := types.NewPeriodicVestingAccount(baseAcc, coins, time.Now().Unix(), types.Periods{types.Period{3600, coins}})
bz, err := json.Marshal(acc)
require.NoError(t, err)
bz1, err := acc.MarshalJSON()
require.NoError(t, err)
require.Equal(t, string(bz1), string(bz))
var a types.PeriodicVestingAccount
require.NoError(t, json.Unmarshal(bz, &a))
require.Equal(t, acc.String(), a.String())
}
func TestDelayedVestingAccountMarshal(t *testing.T) {
pubkey := secp256k1.GenPrivKey().PubKey()
addr := sdk.AccAddress(pubkey.Address())
@ -769,23 +707,3 @@ func TestDelayedVestingAccountMarshal(t *testing.T) {
_, err = app.AccountKeeper.UnmarshalAccount(bz[:len(bz)/2])
require.NotNil(t, err)
}
func TestDelayedVestingAccountJSON(t *testing.T) {
pubkey := secp256k1.GenPrivKey().PubKey()
addr := sdk.AccAddress(pubkey.Address())
coins := sdk.NewCoins(sdk.NewInt64Coin("test", 5))
baseAcc := authtypes.NewBaseAccount(addr, pubkey, 10, 50)
acc := types.NewDelayedVestingAccount(baseAcc, coins, time.Now().Unix())
bz, err := json.Marshal(acc)
require.NoError(t, err)
bz1, err := acc.MarshalJSON()
require.NoError(t, err)
require.Equal(t, string(bz1), string(bz))
var a types.DelayedVestingAccount
require.NoError(t, json.Unmarshal(bz, &a))
require.Equal(t, acc.String(), a.String())
}

View File

@ -195,6 +195,34 @@ func (s *IntegrationTestSuite) TestGetCmdQueryTotalSupply() {
}
}
func (s *IntegrationTestSuite) TestNewSendTxCmdGenOnly() {
val := s.network.Validators[0]
clientCtx := val.ClientCtx
ctx := context.Background()
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
from := val.Address
to := val.Address
amount := sdk.NewCoins(
sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), sdk.NewInt(10)),
sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)),
)
args := []string{
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
fmt.Sprintf("--%s=true", flags.FlagGenerateOnly),
}
bz, err := banktestutil.MsgSendExec(clientCtx, from, to, amount, args...)
s.Require().NoError(err)
tx, err := s.cfg.TxConfig.TxJSONDecoder()(bz.Bytes())
s.Require().NoError(err)
s.Require().Equal([]sdk.Msg{types.NewMsgSend(from, to, amount)}, tx.GetMsgs())
}
func (s *IntegrationTestSuite) TestNewSendTxCmd() {
val := s.network.Validators[0]
@ -207,24 +235,6 @@ func (s *IntegrationTestSuite) TestNewSendTxCmd() {
respType fmt.Stringer
expectedCode uint32
}{
{
"valid transaction (gen-only)",
val.Address,
val.Address,
sdk.NewCoins(
sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), sdk.NewInt(10)),
sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)),
),
[]string{
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
fmt.Sprintf("--%s=true", flags.FlagGenerateOnly),
},
false,
&sdk.TxResponse{},
0,
},
{
"valid transaction",
val.Address,

View File

@ -75,9 +75,9 @@ func (s *IntegrationTestSuite) TestQueryBalancesRequestHandlerFn() {
resp, err := rest.GetRequest(tc.url)
s.Require().NoError(err)
bz, err := rest.ParseResponseWithHeight(val.ClientCtx.JSONMarshaler, resp)
bz, err := rest.ParseResponseWithHeight(val.ClientCtx.LegacyAmino, resp)
s.Require().NoError(err)
s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(bz, tc.respType))
s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(bz, tc.respType))
s.Require().Equal(tc.expected.String(), tc.respType.String())
})
}
@ -122,9 +122,9 @@ func (s *IntegrationTestSuite) TestTotalSupplyHandlerFn() {
resp, err := rest.GetRequest(tc.url)
s.Require().NoError(err)
bz, err := rest.ParseResponseWithHeight(val.ClientCtx.JSONMarshaler, resp)
bz, err := rest.ParseResponseWithHeight(val.ClientCtx.LegacyAmino, resp)
s.Require().NoError(err)
s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(bz, tc.respType))
s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(bz, tc.respType))
s.Require().Equal(tc.expected.String(), tc.respType.String())
})
}

View File

@ -93,13 +93,13 @@ func getAccountInfo(val *network.Validator) (authtypes.AccountI, error) {
return nil, err
}
bz, err := rest.ParseResponseWithHeight(val.ClientCtx.JSONMarshaler, resp)
bz, err := rest.ParseResponseWithHeight(val.ClientCtx.LegacyAmino, resp)
if err != nil {
return nil, err
}
var acc authtypes.AccountI
err = val.ClientCtx.JSONMarshaler.UnmarshalJSON(bz, &acc)
err = val.ClientCtx.LegacyAmino.UnmarshalJSON(bz, &acc)
if err != nil {
return nil, err
}

View File

@ -77,6 +77,6 @@ func RandomizedGenState(simState *module.SimulationState) {
Supply: supply,
}
fmt.Printf("Selected randomly generated bank parameters:\n%s\n", codec.MustMarshalJSONIndent(simState.Cdc, bankGenesis.Params))
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(bankGenesis)
fmt.Printf("Selected randomly generated bank parameters:\n%s\n", codec.MustMarshalJSONIndent(simState.Cdc, &bankGenesis.Params))
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&bankGenesis)
}

View File

@ -24,7 +24,7 @@ const (
// WeightedOperations returns all the operations from the module with their respective weights
func WeightedOperations(
appParams simtypes.AppParams, cdc *codec.LegacyAmino, ak types.AccountKeeper, bk keeper.Keeper,
appParams simtypes.AppParams, cdc codec.JSONMarshaler, ak types.AccountKeeper, bk keeper.Keeper,
) simulation.WeightedOperations {
var weightMsgSend, weightMsgMultiSend int

View File

@ -31,7 +31,7 @@ func (suite *SimTestSuite) SetupTest() {
// TestWeightedOperations tests the weights of the operations.
func (suite *SimTestSuite) TestWeightedOperations() {
cdc := suite.app.LegacyAmino()
cdc := suite.app.AppCodec()
appParams := make(simtypes.AppParams)
weightesOps := simulation.WeightedOperations(appParams, cdc, suite.app.AccountKeeper, suite.app.BankKeeper)

View File

@ -39,7 +39,7 @@ var (
//
// The actual codec used for serialization should be provided to x/staking and
// defined at the application level.
ModuleCdc = codec.NewHybridCodec(amino, types.NewInterfaceRegistry())
ModuleCdc = codec.NewAminoCodec(amino)
)
func init() {

View File

@ -31,6 +31,6 @@ func RandomizedGenState(simState *module.SimulationState) {
capabilityGenesis := types.GenesisState{Index: idx}
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, codec.MustMarshalJSONIndent(simState.Cdc, capabilityGenesis))
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(capabilityGenesis)
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, codec.MustMarshalJSONIndent(simState.Cdc, &capabilityGenesis))
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&capabilityGenesis)
}

View File

@ -28,7 +28,7 @@ var (
//
// The actual codec used for serialization should be provided to x/crisis and
// defined at the application level.
ModuleCdc = codec.NewHybridCodec(amino, codectypes.NewInterfaceRegistry())
ModuleCdc = codec.NewAminoCodec(amino)
)
func init() {

View File

@ -299,7 +299,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorSlashes() {
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
},
false,
"{\"slashes\":null,\"pagination\":{}}",
"{\"slashes\":[],\"pagination\":{\"next_key\":null,\"total\":\"0\"}}",
},
{
"text output",
@ -309,7 +309,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorSlashes() {
sdk.ValAddress(val.Address).String(), "1", "3",
},
false,
"pagination: {}\nslashes: null",
"pagination:\n next_key: null\n total: \"0\"\nslashes: []",
},
}

View File

@ -36,7 +36,7 @@ func QueryDelegationRewards(clientCtx client.Context, delAddr, valAddr string) (
func QueryDelegatorValidators(clientCtx client.Context, delegatorAddr sdk.AccAddress) ([]byte, error) {
res, _, err := clientCtx.QueryWithData(
fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryDelegatorValidators),
clientCtx.JSONMarshaler.MustMarshalJSON(types.NewQueryDelegatorParams(delegatorAddr)),
clientCtx.LegacyAmino.MustMarshalJSON(types.NewQueryDelegatorParams(delegatorAddr)),
)
return res, err
}
@ -61,7 +61,7 @@ func WithdrawAllDelegatorRewards(clientCtx client.Context, delegatorAddr sdk.Acc
}
var validators []sdk.ValAddress
if err := clientCtx.JSONMarshaler.UnmarshalJSON(bz, &validators); err != nil {
if err := clientCtx.LegacyAmino.UnmarshalJSON(bz, &validators); err != nil {
return nil, err
}

View File

@ -77,6 +77,6 @@ func RandomizedGenState(simState *module.SimulationState) {
},
}
fmt.Printf("Selected randomly generated distribution parameters:\n%s\n", codec.MustMarshalJSONIndent(simState.Cdc, distrGenesis))
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(distrGenesis)
fmt.Printf("Selected randomly generated distribution parameters:\n%s\n", codec.MustMarshalJSONIndent(simState.Cdc, &distrGenesis))
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&distrGenesis)
}

View File

@ -26,7 +26,7 @@ const (
// WeightedOperations returns all the operations from the module with their respective weights
func WeightedOperations(
appParams simtypes.AppParams, cdc *codec.LegacyAmino, ak types.AccountKeeper,
appParams simtypes.AppParams, cdc codec.JSONMarshaler, ak types.AccountKeeper,
bk types.BankKeeper, k keeper.Keeper, sk stakingkeeper.Keeper,
) simulation.WeightedOperations {

View File

@ -20,7 +20,7 @@ import (
// TestWeightedOperations tests the weights of the operations.
func (suite *SimTestSuite) TestWeightedOperations() {
cdc := suite.app.LegacyAmino()
cdc := suite.app.AppCodec()
appParams := make(simtypes.AppParams)
weightesOps := simulation.WeightedOperations(appParams, cdc, suite.app.AccountKeeper,

View File

@ -41,7 +41,7 @@ var (
//
// The actual codec used for serialization should be provided to x/distribution and
// defined at the application level.
ModuleCdc = codec.NewHybridCodec(amino, types.NewInterfaceRegistry())
ModuleCdc = codec.NewAminoCodec(amino)
)
func init() {

View File

@ -18,7 +18,7 @@ const (
func (suite *KeeperTestSuite) TestQuerier_QueryEvidence_Existing() {
ctx := suite.ctx.WithIsCheckTx(false)
numEvidence := 100
cdc, _ := simapp.MakeCodecs()
_, cdc := simapp.MakeCodecs()
evidence := suite.populateEvidence(ctx, numEvidence)
query := abci.RequestQuery{
@ -53,7 +53,7 @@ func (suite *KeeperTestSuite) TestQuerier_QueryEvidence_NonExisting() {
func (suite *KeeperTestSuite) TestQuerier_QueryAllEvidence() {
ctx := suite.ctx.WithIsCheckTx(false)
cdc, _ := simapp.MakeCodecs()
_, cdc := simapp.MakeCodecs()
numEvidence := 100
suite.populateEvidence(ctx, numEvidence)
@ -73,7 +73,7 @@ func (suite *KeeperTestSuite) TestQuerier_QueryAllEvidence() {
func (suite *KeeperTestSuite) TestQuerier_QueryAllEvidence_InvalidPagination() {
ctx := suite.ctx.WithIsCheckTx(false)
cdc, _ := simapp.MakeCodecs()
_, cdc := simapp.MakeCodecs()
numEvidence := 100
suite.populateEvidence(ctx, numEvidence)

View File

@ -34,7 +34,7 @@ var (
//
// The actual codec used for serialization should be provided to x/evidence and
// defined at the application level.
ModuleCdc = codec.NewHybridCodec(amino, types.NewInterfaceRegistry())
ModuleCdc = codec.NewAminoCodec(amino)
)
func init() {

View File

@ -34,7 +34,11 @@ func (e *Equivocation) String() string {
// Hash returns the hash of an Equivocation object.
func (e *Equivocation) Hash() tmbytes.HexBytes {
return tmhash.Sum(ModuleCdc.MustMarshalBinaryBare(e))
bz, err := e.Marshal()
if err != nil {
panic(err)
}
return tmhash.Sum(bz)
}
// ValidateBasic performs basic stateless validation checks on an Equivocation object.

View File

@ -18,7 +18,7 @@ func NormalizeVoteOption(option string) string {
return types.OptionNoWithVeto.String()
default:
return ""
return option
}
}

View File

@ -146,8 +146,8 @@ func getQueriedVotes(t *testing.T, ctx sdk.Context, cdc codec.JSONMarshaler, que
func TestQueries(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, abci.Header{})
appCodec := app.AppCodec()
legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino())
appCodec := legacyQuerierCdc
querier := keeper.NewQuerier(app.GovKeeper, legacyQuerierCdc)
TestAddrs := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(20000001))
@ -294,7 +294,7 @@ func TestQueries(t *testing.T) {
func TestPaginatedVotesQuery(t *testing.T) {
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, abci.Header{})
appCodec := app.AppCodec()
legacyQuerierCdc := app.LegacyAmino()
proposal := types.Proposal{
ProposalID: 100,
@ -317,11 +317,10 @@ func TestPaginatedVotesQuery(t *testing.T) {
app.GovKeeper.SetVote(ctx, vote)
}
legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino())
querier := keeper.NewQuerier(app.GovKeeper, legacyQuerierCdc)
// keeper preserves consistent order for each query, but this is not the insertion order
all := getQueriedVotes(t, ctx, appCodec, querier, proposal.ProposalID, 1, 0)
all := getQueriedVotes(t, ctx, legacyQuerierCdc, querier, proposal.ProposalID, 1, 0)
require.Equal(t, len(all), len(votes))
type testCase struct {
@ -355,7 +354,7 @@ func TestPaginatedVotesQuery(t *testing.T) {
} {
tc := tc
t.Run(tc.description, func(t *testing.T) {
votes := getQueriedVotes(t, ctx, appCodec, querier, proposal.ProposalID, tc.page, tc.limit)
votes := getQueriedVotes(t, ctx, legacyQuerierCdc, querier, proposal.ProposalID, tc.page, tc.limit)
require.Equal(t, len(tc.votes), len(votes))
for i := range votes {
require.Equal(t, tc.votes[i], votes[i])

View File

@ -26,7 +26,7 @@ const (
// WeightedOperations returns all the operations from the module with their respective weights
func WeightedOperations(
appParams simtypes.AppParams, cdc *codec.LegacyAmino, ak types.AccountKeeper,
appParams simtypes.AppParams, cdc codec.JSONMarshaler, ak types.AccountKeeper,
bk types.BankKeeper, k keeper.Keeper, wContents []simtypes.WeightedProposalContent,
) simulation.WeightedOperations {

View File

@ -58,7 +58,7 @@ func TestWeightedOperations(t *testing.T) {
app, ctx := createTestApp(false)
ctx.WithChainID("test-chain")
cdc := app.LegacyAmino()
cdc := app.AppCodec()
appParams := make(simtypes.AppParams)
weightesOps := simulation.WeightedOperations(appParams, cdc, app.AccountKeeper,
@ -202,7 +202,7 @@ func TestSimulateMsgVote(t *testing.T) {
require.True(t, operationMsg.OK)
require.Equal(t, uint64(1), msg.ProposalID)
require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.Voter.String())
require.Equal(t, "Yes", msg.Option.String())
require.Equal(t, types.OptionYes, msg.Option)
require.Equal(t, "gov", msg.Route())
require.Equal(t, types.TypeMsgVote, msg.Type())

View File

@ -49,7 +49,7 @@ var (
//
// The actual codec used for serialization should be provided to x/gov and
// defined at the application level.
ModuleCdc = codec.NewHybridCodec(amino, types.NewInterfaceRegistry())
ModuleCdc = codec.NewAminoCodec(amino)
)
func init() {

View File

@ -65,6 +65,10 @@ var VoteOption_value = map[string]int32{
"VOTE_OPTION_NO_WITH_VETO": 4,
}
func (x VoteOption) String() string {
return proto.EnumName(VoteOption_name, int32(x))
}
func (VoteOption) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_6e82113c1a9a4b7c, []int{0}
}
@ -452,95 +456,94 @@ func init() {
func init() { proto.RegisterFile("cosmos/gov/v1beta1/gov.proto", fileDescriptor_6e82113c1a9a4b7c) }
var fileDescriptor_6e82113c1a9a4b7c = []byte{
// 1395 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x41, 0x6c, 0xdb, 0xd4,
0x1b, 0x8f, 0xd3, 0xb4, 0x5d, 0x5f, 0xd2, 0xd6, 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, 0x37,
0xf3, 0xc5, 0x3b, 0x5a, 0x81, 0x9f, 0x8c, 0xf3, 0xdf, 0xb4, 0x9c, 0x26, 0xb2, 0x85, 0x54, 0x20,
0xab, 0x5a, 0xda, 0x7b, 0x21, 0x26, 0x9e, 0xbd, 0x10, 0x13, 0x9f, 0xec, 0x8b, 0x89, 0xbd, 0x7d,
0x91, 0x7b, 0xba, 0x2f, 0x72, 0xbf, 0xef, 0x8b, 0xdc, 0xe3, 0x97, 0x62, 0xe2, 0xe9, 0x4b, 0x31,
0xf1, 0xec, 0xa5, 0x98, 0x78, 0xf0, 0xcf, 0x13, 0x6e, 0x27, 0xfc, 0x8d, 0x15, 0xde, 0xd5, 0xcd,
0xa9, 0x70, 0x28, 0xbc, 0xf9, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4f, 0x85, 0xd1, 0x2a, 0x7e,
0x0d, 0x00, 0x00,
// 1383 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x31, 0x6c, 0xdb, 0x46,
0x17, 0x16, 0x65, 0xd9, 0x8e, 0x4f, 0xb2, 0xcd, 0x9c, 0xfd, 0xdb, 0x32, 0xff, 0xfc, 0x24, 0xc3,
0x3f, 0x28, 0x8c, 0x20, 0x91, 0x13, 0x17, 0x28, 0xd0, 0x04, 0x28, 0x22, 0x5a, 0x4c, 0xa2, 0x22,
0x90, 0x04, 0x8a, 0x51, 0x90, 0x74, 0x20, 0x68, 0xf1, 0x22, 0xb3, 0x15, 0x79, 0xaa, 0x78, 0x72,
0x6d, 0x74, 0xe9, 0xd0, 0x21, 0x50, 0x8b, 0x22, 0x63, 0x81, 0x42, 0x40, 0x81, 0x76, 0xea, 0xdc,
0xb9, 0xb3, 0x51, 0x74, 0x08, 0x8a, 0x0e, 0x41, 0x07, 0xa5, 0x71, 0x80, 0xa2, 0xf0, 0xe8, 0xb1,
0x53, 0x41, 0xde, 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0x08, 0x01, 0x6b, 0x60, 0xc6, 0x27, 0x16, 0xe9, 0xf8, 0xd9, 0x29, 0x99, 0x5b, 0x5f, 0xd8, 0x54,
0x72, 0xe3, 0xf7, 0x38, 0x17, 0xf5, 0x52, 0x0d, 0x33, 0x55, 0xe1, 0xb8, 0x2f, 0xad, 0x8c, 0x9c,
0x10, 0x25, 0x51, 0x74, 0xc6, 0x06, 0x5b, 0x00, 0x3e, 0x76, 0x3c, 0xab, 0x69, 0x12, 0xab, 0xd9,
0xdc, 0x37, 0xdb, 0xc8, 0xef, 0x34, 0x49, 0x36, 0x15, 0xf6, 0x27, 0x9d, 0x56, 0xc3, 0x08, 0xf2,
0xf4, 0x30, 0x4d, 0xbd, 0x18, 0x48, 0x7c, 0xdc, 0x97, 0xd6, 0x68, 0x91, 0x71, 0x22, 0x45, 0xe7,
0xc3, 0x60, 0x0c, 0x04, 0xdf, 0x03, 0x69, 0xbf, 0xb3, 0xed, 0x3a, 0xc4, 0x0c, 0x4c, 0x91, 0x9d,
0x0e, 0x4b, 0x09, 0x63, 0x52, 0x18, 0x91, 0x63, 0x54, 0x91, 0x55, 0x61, 0x97, 0x2d, 0x06, 0x56,
0x9e, 0xbe, 0x90, 0x38, 0x1d, 0xd0, 0x48, 0x00, 0x80, 0x0e, 0xe0, 0xd9, 0x65, 0x31, 0x91, 0x67,
0xd3, 0x0a, 0x33, 0x67, 0x56, 0xf8, 0x3f, 0xab, 0xb0, 0x4a, 0x2b, 0x8c, 0x32, 0xd0, 0x32, 0x0b,
0x2c, 0xac, 0x79, 0x76, 0x58, 0xea, 0x09, 0x07, 0xe6, 0x09, 0x26, 0x56, 0xd3, 0x64, 0x0b, 0xd9,
0xd9, 0xb3, 0xae, 0xe4, 0x5d, 0x56, 0x67, 0x99, 0xd6, 0x19, 0x42, 0x2b, 0x13, 0x5d, 0xd5, 0x4c,
0x88, 0x8d, 0xdc, 0xda, 0x04, 0xe7, 0x77, 0x31, 0x71, 0xbc, 0x46, 0x70, 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(that interface{}) bool {

View File

@ -1,7 +1,6 @@
package types
import (
"encoding/json"
"fmt"
yaml "gopkg.in/yaml.v2"
@ -56,22 +55,11 @@ func (v Vote) Empty() bool {
// VoteOptionFromString returns a VoteOption from a string. It returns an error
// if the string is invalid.
func VoteOptionFromString(str string) (VoteOption, error) {
switch str {
case "Yes":
return OptionYes, nil
case "Abstain":
return OptionAbstain, nil
case "No":
return OptionNo, nil
case "NoWithVeto":
return OptionNoWithVeto, nil
default:
return VoteOption(0xff), fmt.Errorf("'%s' is not a valid vote option", str)
option, ok := VoteOption_value[str]
if !ok {
return OptionEmpty, fmt.Errorf("'%s' is not a valid vote option", str)
}
return VoteOption(option), nil
}
// ValidVoteOption returns true if the vote option is valid and false otherwise.
@ -96,49 +84,6 @@ func (vo *VoteOption) Unmarshal(data []byte) error {
return nil
}
// Marshals to JSON using string.
func (vo VoteOption) MarshalJSON() ([]byte, error) {
return json.Marshal(vo.String())
}
// UnmarshalJSON decodes from JSON assuming Bech32 encoding.
func (vo *VoteOption) UnmarshalJSON(data []byte) error {
var s string
err := json.Unmarshal(data, &s)
if err != nil {
return err
}
if s == "" {
*vo = OptionEmpty
return nil
}
bz2, err := VoteOptionFromString(s)
if err != nil {
return err
}
*vo = bz2
return nil
}
// String implements the Stringer interface.
func (vo VoteOption) String() string {
switch vo {
case OptionYes:
return "Yes"
case OptionAbstain:
return "Abstain"
case OptionNo:
return "No"
case OptionNoWithVeto:
return "NoWithVeto"
default:
return ""
}
}
// Format implements the fmt.Formatter interface.
func (vo VoteOption) Format(s fmt.State, verb rune) {
switch verb {

View File

@ -1,36 +0,0 @@
package types
import (
"encoding/json"
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
func TestVoteUnMarshalJSON(t *testing.T) {
tests := []struct {
option string
isError bool
}{
{"Yes", false},
{"No", false},
{"Abstain", false},
{"NoWithVeto", false},
{"", false},
{"misc", true},
}
for _, tt := range tests {
var vo VoteOption
data, err := json.Marshal(tt.option)
require.NoError(t, err)
err = vo.UnmarshalJSON(data)
if tt.isError {
require.Error(t, err)
require.EqualError(t, err, fmt.Sprintf("'%s' is not a valid vote option", tt.option))
} else {
require.NoError(t, err)
}
}
}

View File

@ -26,6 +26,6 @@ func RandomizedGenState(simState *module.SimulationState) {
PortID: portID,
}
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, codec.MustMarshalJSONIndent(simState.Cdc, transferGenesis))
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(transferGenesis)
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, codec.MustMarshalJSONIndent(simState.Cdc, &transferGenesis))
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&transferGenesis)
}

View File

@ -41,7 +41,7 @@ var (
//
// The actual codec used for serialization should be provided to x/ibc/07-tendermint and
// defined at the application level.
SubModuleCdc = codec.NewHybridCodec(amino, codectypes.NewInterfaceRegistry())
SubModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
)
func init() {

View File

@ -66,7 +66,7 @@ var (
//
// The actual codec used for serialization should be provided to x/ibc/23-commitmentl and
// defined at the application level.
SubModuleCdc = codec.NewHybridCodec(amino, codectypes.NewInterfaceRegistry())
SubModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
)
func init() {

View File

@ -55,6 +55,6 @@ func RandomizedGenState(simState *module.SimulationState) {
ChannelGenesis: channelGenesisState,
}
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", host.ModuleName, codec.MustMarshalJSONIndent(simState.Cdc, ibcGenesis))
simState.GenState[host.ModuleName] = simState.Cdc.MustMarshalJSON(ibcGenesis)
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", host.ModuleName, codec.MustMarshalJSONIndent(simState.Cdc, &ibcGenesis))
simState.GenState[host.ModuleName] = simState.Cdc.MustMarshalJSON(&ibcGenesis)
}

View File

@ -40,7 +40,7 @@ func (s *IntegrationTestSuite) SetupSuite() {
mintData.Params.InflationMin = inflation
mintData.Params.InflationMax = inflation
mintDataBz, err := cfg.Codec.MarshalJSON(mintData)
mintDataBz, err := cfg.Codec.MarshalJSON(&mintData)
s.Require().NoError(err)
genesisState[minttypes.ModuleName] = mintDataBz
cfg.GenesisState = genesisState

View File

@ -5,21 +5,23 @@ import (
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
"github.com/cosmos/cosmos-sdk/x/params/types/proposal"
)
func testComponents() (codec.Marshaler, sdk.Context, sdk.StoreKey, sdk.StoreKey, paramskeeper.Keeper) {
cdc := createTestCodec()
func testComponents() (*codec.LegacyAmino, sdk.Context, sdk.StoreKey, sdk.StoreKey, paramskeeper.Keeper) {
marshaler := simapp.MakeEncodingConfig().Marshaler
legacyAmino := createTestCodec()
mkey := sdk.NewKVStoreKey("test")
tkey := sdk.NewTransientStoreKey("transient_test")
ctx := defaultContext(mkey, tkey)
keeper := paramskeeper.NewKeeper(cdc, mkey, tkey)
keeper := paramskeeper.NewKeeper(marshaler, legacyAmino, mkey, tkey)
return cdc, ctx, mkey, tkey, keeper
return legacyAmino, ctx, mkey, tkey, keeper
}
type invalid struct{}
@ -28,12 +30,12 @@ type s struct {
I int
}
func createTestCodec() codec.Marshaler {
func createTestCodec() *codec.LegacyAmino {
cdc := codec.New()
sdk.RegisterCodec(cdc)
cdc.RegisterConcrete(s{}, "test/s", nil)
cdc.RegisterConcrete(invalid{}, "test/invalid", nil)
return proposal.NewCodec(cdc)
return cdc
}
func defaultContext(key sdk.StoreKey, tkey sdk.StoreKey) sdk.Context {

View File

@ -13,19 +13,21 @@ import (
// Keeper of the global paramstore
type Keeper struct {
cdc codec.Marshaler
key sdk.StoreKey
tkey sdk.StoreKey
spaces map[string]*types.Subspace
cdc codec.BinaryMarshaler
legacyAmino *codec.LegacyAmino
key sdk.StoreKey
tkey sdk.StoreKey
spaces map[string]*types.Subspace
}
// NewKeeper constructs a params keeper
func NewKeeper(cdc codec.Marshaler, key, tkey sdk.StoreKey) Keeper {
func NewKeeper(cdc codec.BinaryMarshaler, legacyAmino *codec.LegacyAmino, key, tkey sdk.StoreKey) Keeper {
return Keeper{
cdc: cdc,
key: key,
tkey: tkey,
spaces: make(map[string]*types.Subspace),
cdc: cdc,
legacyAmino: legacyAmino,
key: key,
tkey: tkey,
spaces: make(map[string]*types.Subspace),
}
}
@ -45,7 +47,7 @@ func (k Keeper) Subspace(s string) types.Subspace {
panic("cannot use empty string for subspace")
}
space := types.NewSubspace(k.cdc, k.key, k.tkey, s)
space := types.NewSubspace(k.cdc, k.legacyAmino, k.key, k.tkey, s)
k.spaces[s] = &space
return space

View File

@ -3,6 +3,8 @@ package params_test
import (
"testing"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
@ -75,7 +77,8 @@ func newTestInput(t *testing.T) testInput {
err := cms.LoadLatestVersion()
require.Nil(t, err)
keeper := keeper.NewKeeper(proposal.ModuleCdc, keyParams, tKeyParams)
encCfg := simapp.MakeEncodingConfig()
keeper := keeper.NewKeeper(encCfg.Marshaler, encCfg.Amino, keyParams, tKeyParams)
ctx := sdk.NewContext(cms, abci.Header{}, false, log.NewNopLogger())
return testInput{ctx, cdc, keeper}

View File

@ -6,28 +6,6 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
)
type Codec struct {
codec.Marshaler
// Keep reference to the amino codec to allow backwards compatibility along
// with type, and interface registration.
amino *codec.LegacyAmino
}
func NewCodec(amino *codec.LegacyAmino) *Codec {
return &Codec{Marshaler: codec.NewHybridCodec(amino, types.NewInterfaceRegistry()), amino: amino}
}
// ModuleCdc is the module codec.
var ModuleCdc *Codec
func init() {
ModuleCdc = NewCodec(codec.New())
RegisterCodec(ModuleCdc.amino)
ModuleCdc.amino.Seal()
}
// RegisterCodec registers all necessary param module types with a given codec.
func RegisterCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&ParameterChangeProposal{}, "cosmos-sdk/ParameterChangeProposal", nil)

View File

@ -21,21 +21,23 @@ const (
// Transient store persists for a block, so we use it for
// recording whether the parameter has been changed or not
type Subspace struct {
cdc codec.Marshaler
key sdk.StoreKey // []byte -> []byte, stores parameter
tkey sdk.StoreKey // []byte -> bool, stores parameter change
name []byte
table KeyTable
cdc codec.BinaryMarshaler
legacyAmino *codec.LegacyAmino
key sdk.StoreKey // []byte -> []byte, stores parameter
tkey sdk.StoreKey // []byte -> bool, stores parameter change
name []byte
table KeyTable
}
// NewSubspace constructs a store with namestore
func NewSubspace(cdc codec.Marshaler, key sdk.StoreKey, tkey sdk.StoreKey, name string) Subspace {
func NewSubspace(cdc codec.BinaryMarshaler, legacyAmino *codec.LegacyAmino, key sdk.StoreKey, tkey sdk.StoreKey, name string) Subspace {
return Subspace{
cdc: cdc,
key: key,
tkey: tkey,
name: []byte(name),
table: NewKeyTable(),
cdc: cdc,
legacyAmino: legacyAmino,
key: key,
tkey: tkey,
name: []byte(name),
table: NewKeyTable(),
}
}
@ -103,7 +105,7 @@ func (s Subspace) Get(ctx sdk.Context, key []byte, ptr interface{}) {
store := s.kvStore(ctx)
bz := store.Get(key)
if err := s.cdc.UnmarshalJSON(bz, ptr); err != nil {
if err := s.legacyAmino.UnmarshalJSON(bz, ptr); err != nil {
panic(err)
}
}
@ -120,7 +122,7 @@ func (s Subspace) GetIfExists(ctx sdk.Context, key []byte, ptr interface{}) {
s.checkType(key, ptr)
if err := s.cdc.UnmarshalJSON(bz, ptr); err != nil {
if err := s.legacyAmino.UnmarshalJSON(bz, ptr); err != nil {
panic(err)
}
}
@ -170,7 +172,7 @@ func (s Subspace) Set(ctx sdk.Context, key []byte, value interface{}) {
s.checkType(key, value)
store := s.kvStore(ctx)
bz, err := s.cdc.MarshalJSON(value)
bz, err := s.legacyAmino.MarshalJSON(value)
if err != nil {
panic(err)
}
@ -197,7 +199,7 @@ func (s Subspace) Update(ctx sdk.Context, key, value []byte) error {
dest := reflect.New(ty).Interface()
s.GetIfExists(ctx, key, dest)
if err := s.cdc.UnmarshalJSON(value, dest); err != nil {
if err := s.legacyAmino.UnmarshalJSON(value, dest); err != nil {
return err
}

View File

@ -11,22 +11,22 @@ import (
dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/cosmos-sdk/x/params/types/proposal"
)
type SubspaceTestSuite struct {
suite.Suite
cdc codec.Marshaler
ctx sdk.Context
ss types.Subspace
cdc codec.BinaryMarshaler
amino *codec.LegacyAmino
ctx sdk.Context
ss types.Subspace
}
func (suite *SubspaceTestSuite) SetupTest() {
cdc := proposal.ModuleCdc
db := dbm.NewMemDB()
ms := store.NewCommitMultiStore(db)
@ -34,9 +34,11 @@ func (suite *SubspaceTestSuite) SetupTest() {
ms.MountStoreWithDB(tkey, sdk.StoreTypeTransient, db)
suite.NoError(ms.LoadLatestVersion())
ss := types.NewSubspace(cdc, key, tkey, "testsubspace")
encCfg := simapp.MakeEncodingConfig()
ss := types.NewSubspace(encCfg.Marshaler, encCfg.Amino, key, tkey, "testsubspace")
suite.cdc = cdc
suite.cdc = encCfg.Marshaler
suite.amino = encCfg.Amino
suite.ctx = sdk.NewContext(ms, abci.Header{}, false, log.NewNopLogger())
suite.ss = ss.WithKeyTable(paramKeyTable())
}
@ -47,7 +49,7 @@ func (suite *SubspaceTestSuite) TestKeyTable() {
suite.ss.WithKeyTable(paramKeyTable())
})
suite.Require().NotPanics(func() {
ss := types.NewSubspace(proposal.ModuleCdc, key, tkey, "testsubspace2")
ss := types.NewSubspace(suite.cdc, suite.amino, key, tkey, "testsubspace2")
ss = ss.WithKeyTable(paramKeyTable())
})
}
@ -122,12 +124,12 @@ func (suite *SubspaceTestSuite) TestUpdate() {
bad := time.Minute * 5
bz, err := suite.cdc.MarshalJSON(bad)
bz, err := suite.amino.MarshalJSON(bad)
suite.Require().NoError(err)
suite.Require().Error(suite.ss.Update(suite.ctx, keyUnbondingTime, bz))
good := time.Hour * 360
bz, err = suite.cdc.MarshalJSON(good)
bz, err = suite.amino.MarshalJSON(good)
suite.Require().NoError(err)
suite.Require().NoError(suite.ss.Update(suite.ctx, keyUnbondingTime, bz))

View File

@ -5,6 +5,8 @@ import (
"fmt"
"math/rand"
"github.com/cosmos/cosmos-sdk/simapp/params"
"github.com/tendermint/tendermint/types"
abci "github.com/tendermint/tendermint/abci/types"
@ -155,7 +157,7 @@ func (w WeightedProposalContent) ContentSimulatorFn() simulation.ContentSimulato
// RandomParams returns random simulation consensus parameters, it extracts the Evidence from the Staking genesis state.
func RandomConsensusParams(r *rand.Rand, appState json.RawMessage) *abci.ConsensusParams {
cdc := codec.New()
cdc := params.MakeEncodingConfig().Marshaler
var genesisState map[string]json.RawMessage

View File

@ -67,7 +67,7 @@ func (s *IntegrationTestSuite) TestGetCmdQuerySigningInfo() {
fmt.Sprintf("--%s=1", flags.FlagHeight),
},
false,
fmt.Sprintf(`{"address":"%s","jailed_until":"1970-01-01T00:00:00Z"}`, sdk.ConsAddress(val.PubKey.Address())),
fmt.Sprintf("{\"address\":\"%s\",\"start_height\":\"0\",\"index_offset\":\"0\",\"jailed_until\":\"1970-01-01T00:00:00Z\",\"tombstoned\":false,\"missed_blocks_counter\":\"0\"}", sdk.ConsAddress(val.PubKey.Address())),
},
{
"valid address (text output)",
@ -78,7 +78,11 @@ func (s *IntegrationTestSuite) TestGetCmdQuerySigningInfo() {
},
false,
fmt.Sprintf(`address: %s
jailed_until: "1970-01-01T00:00:00Z"`, sdk.ConsAddress(val.PubKey.Address())),
index_offset: "0"
jailed_until: "1970-01-01T00:00:00Z"
missed_blocks_counter: "0"
start_height: "0"
tombstoned: false`, sdk.ConsAddress(val.PubKey.Address())),
},
}
@ -119,12 +123,12 @@ func (s *IntegrationTestSuite) TestGetCmdQueryParams() {
{
"json output",
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
`{"signed_blocks_window":"100","min_signed_per_window":"0.500000000000000000","downtime_jail_duration":"600000000000","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"}`,
`{"signed_blocks_window":"100","min_signed_per_window":"0.500000000000000000","downtime_jail_duration":"600s","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"}`,
},
{
"text output",
[]string{fmt.Sprintf("--%s=text", tmcli.OutputFlag)},
`downtime_jail_duration: "600000000000"
`downtime_jail_duration: 600s
min_signed_per_window: "0.500000000000000000"
signed_blocks_window: "100"
slash_fraction_double_sign: "0.050000000000000000"

View File

@ -88,6 +88,6 @@ func RandomizedGenState(simState *module.SimulationState) {
slashingGenesis := types.NewGenesisState(params, []types.SigningInfo{}, []types.ValidatorMissedBlocks{})
fmt.Printf("Selected randomly generated slashing parameters:\n%s\n", codec.MustMarshalJSONIndent(simState.Cdc, slashingGenesis.Params))
fmt.Printf("Selected randomly generated slashing parameters:\n%s\n", codec.MustMarshalJSONIndent(simState.Cdc, &slashingGenesis.Params))
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(slashingGenesis)
}

View File

@ -23,7 +23,7 @@ const (
// WeightedOperations returns all the operations from the module with their respective weights
func WeightedOperations(
appParams simtypes.AppParams, cdc *codec.LegacyAmino, ak types.AccountKeeper,
appParams simtypes.AppParams, cdc codec.JSONMarshaler, ak types.AccountKeeper,
bk types.BankKeeper, k keeper.Keeper, sk stakingkeeper.Keeper,
) simulation.WeightedOperations {

View File

@ -24,7 +24,7 @@ func TestWeightedOperations(t *testing.T) {
app, ctx := createTestApp(false)
ctx.WithChainID("test-chain")
cdc := app.LegacyAmino()
cdc := app.AppCodec()
appParams := make(simtypes.AppParams)
s := rand.NewSource(1)

View File

@ -27,7 +27,7 @@ var (
//
// The actual codec used for serialization should be provided to x/slashing and
// defined at the application level.
ModuleCdc = codec.NewHybridCodec(amino, types.NewInterfaceRegistry())
ModuleCdc = codec.NewAminoCodec(amino)
)
func init() {

View File

@ -26,7 +26,7 @@ const (
// WeightedOperations returns all the operations from the module with their respective weights
func WeightedOperations(
appParams simtypes.AppParams, cdc *codec.LegacyAmino, ak types.AccountKeeper,
appParams simtypes.AppParams, cdc codec.JSONMarshaler, ak types.AccountKeeper,
bk types.BankKeeper, k keeper.Keeper,
) simulation.WeightedOperations {
var (

View File

@ -25,7 +25,7 @@ func TestWeightedOperations(t *testing.T) {
ctx.WithChainID("test-chain")
cdc := app.LegacyAmino()
cdc := app.AppCodec()
appParams := make(simtypes.AppParams)
weightesOps := simulation.WeightedOperations(appParams, cdc, app.AccountKeeper,

View File

@ -37,7 +37,7 @@ var (
//
// The actual codec used for serialization should be provided to x/staking and
// defined at the application level.
ModuleCdc = codec.NewHybridCodec(amino, types.NewInterfaceRegistry())
ModuleCdc = codec.NewAminoCodec(amino)
)
func init() {

View File

@ -24,7 +24,7 @@ func DefaultGenesisState() *GenesisState {
// GetGenesisStateFromAppState returns x/staking GenesisState given raw application
// genesis state.
func GetGenesisStateFromAppState(cdc *codec.LegacyAmino, appState map[string]json.RawMessage) *GenesisState {
func GetGenesisStateFromAppState(cdc codec.JSONMarshaler, appState map[string]json.RawMessage) *GenesisState {
var genesisState GenesisState
if appState[ModuleName] != nil {

View File

@ -40,7 +40,7 @@ func setupTest(height int64, skip map[int64]bool) TestSuite {
db := dbm.NewMemDB()
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, skip, simapp.DefaultNodeHome, 0, simapp.MakeEncodingConfig())
genesisState := simapp.NewDefaultGenesisState()
stateBytes, err := codec.MarshalJSONIndent(app.LegacyAmino(), genesisState)
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
if err != nil {
panic(err)
}