Enable proto JSON for genesis (#7000)
* Enable proto JSON for genesis * Test fixes * Cleanup * Cleanup * Cleanup * Update CHANGELOG.md * Protogen Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Co-authored-by: SaReN <sahithnarahari@gmail.com>
This commit is contained in:
parent
1744194e71
commit
20c5ee3624
|
@ -62,6 +62,7 @@ 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`.
|
||||
|
||||
### API Breaking Changes
|
||||
|
||||
|
@ -153,6 +154,8 @@ be used to retrieve the actual proposal `Content`. Also the `NewMsgSubmitProposa
|
|||
* (crypto) [\#6780](https://github.com/cosmos/cosmos-sdk/issues/6780) Move ledger code to its own package.
|
||||
* (modules) [\#6834](https://github.com/cosmos/cosmos-sdk/issues/6834) Add `RegisterInterfaces` method to `AppModuleBasic` to support registration of protobuf interface types.
|
||||
* (modules) [\#6734](https://github.com/cosmos/cosmos-sdk/issues/6834) Add `TxEncodingConfig` parameter to `AppModuleBasic.ValidateGenesis` command to support JSON tx decoding in `genutil`.
|
||||
* (genesis) [\#7000](https://github.com/cosmos/cosmos-sdk/pull/7000) The root `GenesisState` is now decoded using `encoding/json` instead of amino so `int64` and `uint64` types are now encoded as integers as opposed to strings.
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
|
|
2
go.sum
2
go.sum
|
@ -41,8 +41,6 @@ github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hC
|
|||
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
||||
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I=
|
||||
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
|
||||
github.com/armon/go-metrics v0.3.3 h1:a9F4rlj7EWWrbj7BYw8J8+x+ZZkJeqzNyRk8hdPF+ro=
|
||||
github.com/armon/go-metrics v0.3.3/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
|
||||
github.com/armon/go-metrics v0.3.4 h1:Xqf+7f2Vhl9tsqDYmXhnXInUdcrtgpRNpIA15/uldSc=
|
||||
github.com/armon/go-metrics v0.3.4/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
|
||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
|
|
|
@ -79,8 +79,6 @@ message Proposal {
|
|||
|
||||
// ProposalStatus is a type alias that represents a proposal status as a byte
|
||||
enum ProposalStatus {
|
||||
option (gogoproto.enum_stringer) = false;
|
||||
option (gogoproto.goproto_enum_stringer) = false;
|
||||
option (gogoproto.goproto_enum_prefix) = false;
|
||||
|
||||
// PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status.
|
||||
|
|
|
@ -3,6 +3,7 @@ package server
|
|||
// DONTCOVER
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
@ -10,9 +11,7 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/server/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
@ -29,9 +28,6 @@ func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Com
|
|||
Use: "export",
|
||||
Short: "Export state to JSON",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx := client.GetClientContextFromCmd(cmd)
|
||||
cdc := clientCtx.JSONMarshaler
|
||||
|
||||
serverCtx := GetServerContextFromCmd(cmd)
|
||||
config := serverCtx.Config
|
||||
|
||||
|
@ -94,7 +90,10 @@ func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Com
|
|||
},
|
||||
}
|
||||
|
||||
encoded, err := codec.MarshalJSONIndent(cdc, doc)
|
||||
// NOTE: for now we're just using standard JSON marshaling for the root GenesisDoc.
|
||||
// These types are in Tendermint, don't support proto and as far as we know, don't need it.
|
||||
// All of the protobuf/amino state is inside AppState
|
||||
encoded, err := json.MarshalIndent(doc, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import (
|
|||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/types/errors"
|
||||
|
@ -36,14 +35,14 @@ func TestExportCmd_ConsensusParams(t *testing.T) {
|
|||
}
|
||||
|
||||
db := dbm.NewMemDB()
|
||||
app := simapp.NewSimApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, tempDir, 0)
|
||||
app := simapp.NewSimApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, tempDir, 0, simapp.MakeEncodingConfig())
|
||||
|
||||
serverCtx := NewDefaultContext()
|
||||
serverCtx.Config.RootDir = tempDir
|
||||
|
||||
clientCtx := client.Context{}.WithJSONMarshaler(app.LegacyAmino())
|
||||
clientCtx := client.Context{}.WithJSONMarshaler(app.AppCodec())
|
||||
|
||||
genDoc := newDefaultGenesisDoc(app.LegacyAmino())
|
||||
genDoc := newDefaultGenesisDoc()
|
||||
err = saveGenesisFile(genDoc, serverCtx.Config.GenesisFile())
|
||||
|
||||
app.InitChain(
|
||||
|
@ -71,7 +70,7 @@ func TestExportCmd_ConsensusParams(t *testing.T) {
|
|||
require.NoError(t, cmd.ExecuteContext(ctx))
|
||||
|
||||
var exportedGenDoc tmtypes.GenesisDoc
|
||||
err = app.LegacyAmino().UnmarshalJSON(output.Bytes(), &exportedGenDoc)
|
||||
err = json.Unmarshal(output.Bytes(), &exportedGenDoc)
|
||||
if err != nil {
|
||||
t.Fatalf("error unmarshaling exported genesis doc: %s", err)
|
||||
}
|
||||
|
@ -90,10 +89,10 @@ func createConfigFolder(dir string) error {
|
|||
return os.Mkdir(path.Join(dir, "config"), 0700)
|
||||
}
|
||||
|
||||
func newDefaultGenesisDoc(cdc *codec.LegacyAmino) *tmtypes.GenesisDoc {
|
||||
func newDefaultGenesisDoc() *tmtypes.GenesisDoc {
|
||||
genesisState := simapp.NewDefaultGenesisState()
|
||||
|
||||
stateBytes, err := codec.MarshalJSONIndent(cdc, genesisState)
|
||||
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec/types"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmos "github.com/tendermint/tendermint/libs/os"
|
||||
|
@ -14,7 +12,9 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/client/rpc"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/server/api"
|
||||
simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
@ -169,11 +169,10 @@ type SimApp struct {
|
|||
// NewSimApp returns a reference to an initialized SimApp.
|
||||
func NewSimApp(
|
||||
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool,
|
||||
homePath string, invCheckPeriod uint, baseAppOptions ...func(*baseapp.BaseApp),
|
||||
homePath string, invCheckPeriod uint, encodingConfig simappparams.EncodingConfig, baseAppOptions ...func(*baseapp.BaseApp),
|
||||
) *SimApp {
|
||||
|
||||
// TODO: Remove cdc in favor of appCodec once all modules are migrated.
|
||||
encodingConfig := MakeEncodingConfig()
|
||||
appCodec := encodingConfig.Marshaler
|
||||
cdc := encodingConfig.Amino
|
||||
interfaceRegistry := encodingConfig.InterfaceRegistry
|
||||
|
@ -417,7 +416,7 @@ func (app *SimApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.Re
|
|||
func (app *SimApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
|
||||
var genesisState GenesisState
|
||||
app.cdc.MustUnmarshalJSON(req.AppStateBytes, &genesisState)
|
||||
return app.mm.InitGenesis(ctx, app.cdc, genesisState)
|
||||
return app.mm.InitGenesis(ctx, app.appCodec, genesisState)
|
||||
}
|
||||
|
||||
// LoadHeight loads a particular height
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
|
||||
func TestSimAppExport(t *testing.T) {
|
||||
db := dbm.NewMemDB()
|
||||
app := NewSimApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0)
|
||||
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)
|
||||
|
@ -31,7 +31,7 @@ func TestSimAppExport(t *testing.T) {
|
|||
app.Commit()
|
||||
|
||||
// Making a new app object with the db, so that initchain hasn't been called
|
||||
app2 := NewSimApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0)
|
||||
app2 := NewSimApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, MakeEncodingConfig())
|
||||
_, _, _, err = app2.ExportAppStateAndValidators(false, []string{})
|
||||
require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ func TestSimAppExport(t *testing.T) {
|
|||
// ensure that blocked addresses are properly set in bank keeper
|
||||
func TestBlockedAddrs(t *testing.T) {
|
||||
db := dbm.NewMemDB()
|
||||
app := NewSimApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0)
|
||||
app := NewSimApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, MakeEncodingConfig())
|
||||
|
||||
for acc := range maccPerms {
|
||||
require.Equal(t, !allowedReceivingModAcc[acc], app.BankKeeper.BlockedAddr(app.AccountKeeper.GetModuleAddress(acc)))
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/staking"
|
||||
|
@ -28,8 +27,8 @@ func (app *SimApp) ExportAppStateAndValidators(
|
|||
app.prepForZeroHeightGenesis(ctx, jailWhiteList)
|
||||
}
|
||||
|
||||
genState := app.mm.ExportGenesis(ctx, app.cdc)
|
||||
appState, err = codec.MarshalJSONIndent(app.cdc, genState)
|
||||
genState := app.mm.ExportGenesis(ctx, app.appCodec)
|
||||
appState, err = json.MarshalIndent(genState, "", " ")
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@ package simapp
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
)
|
||||
|
||||
// The genesis state of the blockchain is represented here as a map of raw json
|
||||
|
@ -17,6 +15,6 @@ type GenesisState map[string]json.RawMessage
|
|||
|
||||
// NewDefaultGenesisState generates the default state for the application.
|
||||
func NewDefaultGenesisState() GenesisState {
|
||||
cdc := std.MakeCodec(ModuleBasics)
|
||||
return ModuleBasics.DefaultGenesis(cdc)
|
||||
encCfg := MakeEncodingConfig()
|
||||
return ModuleBasics.DefaultGenesis(encCfg.Marshaler)
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ func BenchmarkFullAppSimulation(b *testing.B) {
|
|||
}
|
||||
}()
|
||||
|
||||
app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, interBlockCacheOpt())
|
||||
app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeEncodingConfig(), interBlockCacheOpt())
|
||||
|
||||
// run randomized simulation
|
||||
_, simParams, simErr := simulation.SimulateFromSeed(
|
||||
|
@ -65,7 +65,7 @@ func BenchmarkInvariants(b *testing.B) {
|
|||
}
|
||||
}()
|
||||
|
||||
app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, interBlockCacheOpt())
|
||||
app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeEncodingConfig(), interBlockCacheOpt())
|
||||
|
||||
// run randomized simulation
|
||||
_, simParams, simErr := simulation.SimulateFromSeed(
|
||||
|
|
|
@ -67,7 +67,7 @@ func TestFullAppSimulation(t *testing.T) {
|
|||
require.NoError(t, os.RemoveAll(dir))
|
||||
}()
|
||||
|
||||
app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, fauxMerkleModeOpt)
|
||||
app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeEncodingConfig(), fauxMerkleModeOpt)
|
||||
require.Equal(t, "SimApp", app.Name())
|
||||
|
||||
// run randomized simulation
|
||||
|
@ -99,7 +99,7 @@ func TestAppImportExport(t *testing.T) {
|
|||
require.NoError(t, os.RemoveAll(dir))
|
||||
}()
|
||||
|
||||
app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, fauxMerkleModeOpt)
|
||||
app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeEncodingConfig(), fauxMerkleModeOpt)
|
||||
require.Equal(t, "SimApp", app.Name())
|
||||
|
||||
// Run randomized simulation
|
||||
|
@ -133,7 +133,7 @@ func TestAppImportExport(t *testing.T) {
|
|||
require.NoError(t, os.RemoveAll(newDir))
|
||||
}()
|
||||
|
||||
newApp := NewSimApp(log.NewNopLogger(), newDB, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, fauxMerkleModeOpt)
|
||||
newApp := NewSimApp(log.NewNopLogger(), newDB, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeEncodingConfig(), fauxMerkleModeOpt)
|
||||
require.Equal(t, "SimApp", newApp.Name())
|
||||
|
||||
var genesisState GenesisState
|
||||
|
@ -190,7 +190,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
|
|||
require.NoError(t, os.RemoveAll(dir))
|
||||
}()
|
||||
|
||||
app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, fauxMerkleModeOpt)
|
||||
app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeEncodingConfig(), fauxMerkleModeOpt)
|
||||
require.Equal(t, "SimApp", app.Name())
|
||||
|
||||
// Run randomized simulation
|
||||
|
@ -229,7 +229,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
|
|||
require.NoError(t, os.RemoveAll(newDir))
|
||||
}()
|
||||
|
||||
newApp := NewSimApp(log.NewNopLogger(), newDB, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, fauxMerkleModeOpt)
|
||||
newApp := NewSimApp(log.NewNopLogger(), newDB, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeEncodingConfig(), fauxMerkleModeOpt)
|
||||
require.Equal(t, "SimApp", newApp.Name())
|
||||
|
||||
newApp.InitChain(abci.RequestInitChain{
|
||||
|
@ -274,7 +274,7 @@ func TestAppStateDeterminism(t *testing.T) {
|
|||
}
|
||||
|
||||
db := dbm.NewMemDB()
|
||||
app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, interBlockCacheOpt())
|
||||
app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeEncodingConfig(), interBlockCacheOpt())
|
||||
|
||||
fmt.Printf(
|
||||
"running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n",
|
||||
|
|
|
@ -6,6 +6,8 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
|
||||
"github.com/spf13/cast"
|
||||
"github.com/spf13/cobra"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
|
@ -77,12 +79,12 @@ func init() {
|
|||
authclient.Codec = encodingConfig.Marshaler
|
||||
|
||||
rootCmd.AddCommand(
|
||||
genutilcli.InitCmd(simapp.ModuleBasics, simapp.DefaultNodeHome),
|
||||
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome),
|
||||
withProtoJSON(genutilcli.InitCmd(simapp.ModuleBasics, simapp.DefaultNodeHome)),
|
||||
withProtoJSON(genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome)),
|
||||
genutilcli.MigrateGenesisCmd(),
|
||||
genutilcli.GenTxCmd(simapp.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome),
|
||||
genutilcli.ValidateGenesisCmd(simapp.ModuleBasics, encodingConfig.TxConfig),
|
||||
AddGenesisAccountCmd(simapp.DefaultNodeHome),
|
||||
withProtoJSON(genutilcli.GenTxCmd(simapp.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome)),
|
||||
withProtoJSON(genutilcli.ValidateGenesisCmd(simapp.ModuleBasics, encodingConfig.TxConfig)),
|
||||
withProtoJSON(AddGenesisAccountCmd(simapp.DefaultNodeHome)),
|
||||
tmcli.NewCompletionCmd(rootCmd, true),
|
||||
testnetCmd(simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}),
|
||||
debug.Cmd(),
|
||||
|
@ -171,6 +173,7 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts serverty
|
|||
logger, db, traceStore, true, skipUpgradeHeights,
|
||||
cast.ToString(appOpts.Get(flags.FlagHome)),
|
||||
cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)),
|
||||
encodingConfig,
|
||||
baseapp.SetPruning(pruningOpts),
|
||||
baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))),
|
||||
baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))),
|
||||
|
@ -184,16 +187,42 @@ func exportAppStateAndTMValidators(
|
|||
logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailWhiteList []string,
|
||||
) (json.RawMessage, []tmtypes.GenesisValidator, *abci.ConsensusParams, error) {
|
||||
|
||||
encCfg := simapp.MakeEncodingConfig()
|
||||
encCfg.Marshaler = codec.NewProtoCodec(encCfg.InterfaceRegistry)
|
||||
var simApp *simapp.SimApp
|
||||
if height != -1 {
|
||||
simApp = simapp.NewSimApp(logger, db, traceStore, false, map[int64]bool{}, "", uint(1))
|
||||
simApp = simapp.NewSimApp(logger, db, traceStore, false, map[int64]bool{}, "", uint(1), encCfg)
|
||||
|
||||
if err := simApp.LoadHeight(height); err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
} else {
|
||||
simApp = simapp.NewSimApp(logger, db, traceStore, true, map[int64]bool{}, "", uint(1))
|
||||
simApp = simapp.NewSimApp(logger, db, traceStore, true, map[int64]bool{}, "", uint(1), encCfg)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package simapp
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
@ -48,7 +49,7 @@ var DefaultConsensusParams = &abci.ConsensusParams{
|
|||
// Setup initializes a new SimApp. A Nop logger is set in SimApp.
|
||||
func Setup(isCheckTx bool) *SimApp {
|
||||
db := dbm.NewMemDB()
|
||||
app := NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5)
|
||||
app := NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5, MakeEncodingConfig())
|
||||
if !isCheckTx {
|
||||
// init chain must be called to stop deliverState from being nil
|
||||
genesisState := NewDefaultGenesisState()
|
||||
|
@ -76,7 +77,7 @@ func Setup(isCheckTx bool) *SimApp {
|
|||
// account. A Nop logger is set in SimApp.
|
||||
func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp {
|
||||
db := dbm.NewMemDB()
|
||||
app := NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5)
|
||||
app := NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5, MakeEncodingConfig())
|
||||
|
||||
genesisState := NewDefaultGenesisState()
|
||||
|
||||
|
@ -150,13 +151,13 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs
|
|||
// accounts and possible balances.
|
||||
func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp {
|
||||
db := dbm.NewMemDB()
|
||||
app := NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0)
|
||||
app := NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, MakeEncodingConfig())
|
||||
|
||||
// initialize the chain with the passed in genesis accounts
|
||||
genesisState := NewDefaultGenesisState()
|
||||
|
||||
authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)
|
||||
genesisState[authtypes.ModuleName] = app.LegacyAmino().MustMarshalJSON(authGenesis)
|
||||
genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis)
|
||||
|
||||
totalSupply := sdk.NewCoins()
|
||||
for _, b := range balances {
|
||||
|
@ -164,9 +165,9 @@ func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...ba
|
|||
}
|
||||
|
||||
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, "", " ")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ type AppConstructor = func(val Validator) servertypes.Application
|
|||
func NewSimApp(val Validator) servertypes.Application {
|
||||
return simapp.NewSimApp(
|
||||
val.Ctx.Logger, dbm.NewMemDB(), nil, true, make(map[int64]bool), val.Ctx.Config.RootDir, 0,
|
||||
simapp.MakeEncodingConfig(),
|
||||
baseapp.SetPruning(storetypes.NewPruningOptionsFromString(val.AppConfig.Pruning)),
|
||||
baseapp.SetMinGasPrices(val.AppConfig.MinGasPrices),
|
||||
)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package network
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
|
@ -13,7 +14,6 @@ import (
|
|||
"github.com/tendermint/tendermint/types"
|
||||
tmtime "github.com/tendermint/tendermint/types/time"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/server/api"
|
||||
servergrpc "github.com/cosmos/cosmos-sdk/server/grpc"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
|
@ -142,16 +142,16 @@ func initGenFiles(cfg Config, genAccounts []authtypes.GenesisAccount, genBalance
|
|||
}
|
||||
|
||||
authGenState.Accounts = accounts
|
||||
cfg.GenesisState[authtypes.ModuleName] = cfg.Codec.MustMarshalJSON(authGenState)
|
||||
cfg.GenesisState[authtypes.ModuleName] = cfg.Codec.MustMarshalJSON(&authGenState)
|
||||
|
||||
// set the balances in the genesis state
|
||||
var bankGenState banktypes.GenesisState
|
||||
cfg.Codec.MustUnmarshalJSON(cfg.GenesisState[banktypes.ModuleName], &bankGenState)
|
||||
|
||||
bankGenState.Balances = genBalances
|
||||
cfg.GenesisState[banktypes.ModuleName] = cfg.Codec.MustMarshalJSON(bankGenState)
|
||||
cfg.GenesisState[banktypes.ModuleName] = cfg.Codec.MustMarshalJSON(&bankGenState)
|
||||
|
||||
appGenStateJSON, err := codec.MarshalJSONIndent(cfg.Codec, cfg.GenesisState)
|
||||
appGenStateJSON, err := json.MarshalIndent(cfg.GenesisState, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ func InitGenesis(ctx sdk.Context, ak keeper.AccountKeeper, data types.GenesisSta
|
|||
}
|
||||
|
||||
// ExportGenesis returns a GenesisState for a given context and keeper
|
||||
func ExportGenesis(ctx sdk.Context, ak keeper.AccountKeeper) types.GenesisState {
|
||||
func ExportGenesis(ctx sdk.Context, ak keeper.AccountKeeper) *types.GenesisState {
|
||||
params := ak.GetParams(ctx)
|
||||
|
||||
var genAccounts types.GenesisAccounts
|
||||
|
|
|
@ -26,6 +26,13 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
|
|||
&BaseAccount{},
|
||||
&ModuleAccount{},
|
||||
)
|
||||
|
||||
registry.RegisterInterface(
|
||||
"cosmos.auth.GenesisAccount",
|
||||
(*GenesisAccount)(nil),
|
||||
&BaseAccount{},
|
||||
&ModuleAccount{},
|
||||
)
|
||||
}
|
||||
|
||||
// RegisterKeyTypeCodec registers an external concrete type defined in
|
||||
|
@ -37,7 +44,7 @@ func RegisterKeyTypeCodec(o interface{}, name string) {
|
|||
var (
|
||||
amino = codec.New()
|
||||
|
||||
ModuleCdc = codec.NewHybridCodec(amino, types.NewInterfaceRegistry())
|
||||
ModuleCdc = codec.NewAminoCodec(amino)
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -5,6 +5,6 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
app = simapp.Setup(false)
|
||||
appCodec, _ = simapp.MakeCodecs()
|
||||
app = simapp.Setup(false)
|
||||
appCodec, legacyAmino = simapp.MakeCodecs()
|
||||
)
|
||||
|
|
|
@ -14,12 +14,12 @@ import (
|
|||
var _ types.UnpackInterfacesMessage = GenesisState{}
|
||||
|
||||
// NewGenesisState - Create a new genesis state
|
||||
func NewGenesisState(params Params, accounts GenesisAccounts) GenesisState {
|
||||
func NewGenesisState(params Params, accounts GenesisAccounts) *GenesisState {
|
||||
genAccounts, err := PackAccounts(accounts)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return GenesisState{
|
||||
return &GenesisState{
|
||||
Params: params,
|
||||
Accounts: genAccounts,
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ func (g GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error {
|
|||
}
|
||||
|
||||
// DefaultGenesisState - Return a default genesis state
|
||||
func DefaultGenesisState() GenesisState {
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return NewGenesisState(DefaultParams(), GenesisAccounts{})
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,20 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
|
|||
&DelayedVestingAccount{},
|
||||
&PeriodicVestingAccount{},
|
||||
)
|
||||
|
||||
registry.RegisterImplementations(
|
||||
(*authtypes.AccountI)(nil),
|
||||
&DelayedVestingAccount{},
|
||||
&ContinuousVestingAccount{},
|
||||
&PeriodicVestingAccount{},
|
||||
)
|
||||
|
||||
registry.RegisterImplementations(
|
||||
(*authtypes.GenesisAccount)(nil),
|
||||
&DelayedVestingAccount{},
|
||||
&ContinuousVestingAccount{},
|
||||
&PeriodicVestingAccount{},
|
||||
)
|
||||
}
|
||||
|
||||
var amino = codec.New()
|
||||
|
|
|
@ -34,7 +34,7 @@ func (k BaseKeeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) {
|
|||
}
|
||||
|
||||
// ExportGenesis returns the bank module's genesis state.
|
||||
func (k BaseKeeper) ExportGenesis(ctx sdk.Context) types.GenesisState {
|
||||
func (k BaseKeeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
|
||||
return types.NewGenesisState(
|
||||
k.GetParams(ctx),
|
||||
k.GetAccountsBalances(ctx),
|
||||
|
|
|
@ -23,7 +23,7 @@ type Keeper interface {
|
|||
SendKeeper
|
||||
|
||||
InitGenesis(sdk.Context, types.GenesisState)
|
||||
ExportGenesis(sdk.Context) types.GenesisState
|
||||
ExportGenesis(sdk.Context) *types.GenesisState
|
||||
|
||||
GetSupply(ctx sdk.Context) exported.SupplyI
|
||||
SetSupply(ctx sdk.Context, supply exported.SupplyI)
|
||||
|
|
|
@ -46,8 +46,8 @@ func ValidateGenesis(data GenesisState) error {
|
|||
}
|
||||
|
||||
// NewGenesisState creates a new genesis state.
|
||||
func NewGenesisState(params Params, balances []Balance, supply sdk.Coins, denomMetaData []Metadata) GenesisState {
|
||||
return GenesisState{
|
||||
func NewGenesisState(params Params, balances []Balance, supply sdk.Coins, denomMetaData []Metadata) *GenesisState {
|
||||
return &GenesisState{
|
||||
Params: params,
|
||||
Balances: balances,
|
||||
Supply: supply,
|
||||
|
@ -56,20 +56,20 @@ func NewGenesisState(params Params, balances []Balance, supply sdk.Coins, denomM
|
|||
}
|
||||
|
||||
// DefaultGenesisState returns a default bank module genesis state.
|
||||
func DefaultGenesisState() GenesisState {
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return NewGenesisState(DefaultParams(), []Balance{}, DefaultSupply().GetTotal(), []Metadata{})
|
||||
}
|
||||
|
||||
// GetGenesisStateFromAppState returns x/bank GenesisState given raw application
|
||||
// genesis state.
|
||||
func GetGenesisStateFromAppState(cdc codec.JSONMarshaler, appState map[string]json.RawMessage) GenesisState {
|
||||
func GetGenesisStateFromAppState(cdc codec.JSONMarshaler, appState map[string]json.RawMessage) *GenesisState {
|
||||
var genesisState GenesisState
|
||||
|
||||
if appState[ModuleName] != nil {
|
||||
cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState)
|
||||
}
|
||||
|
||||
return genesisState
|
||||
return &genesisState
|
||||
}
|
||||
|
||||
// GenesisAccountIterator implements genesis account iteration.
|
||||
|
|
|
@ -19,7 +19,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
|
|||
}
|
||||
|
||||
// ExportGenesis returns the capability module's exported genesis.
|
||||
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
|
||||
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
|
||||
index := k.GetLatestIndex(ctx)
|
||||
owners := []types.GenesisOwners{}
|
||||
|
||||
|
@ -36,7 +36,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
|
|||
owners = append(owners, genOwner)
|
||||
}
|
||||
|
||||
return types.GenesisState{
|
||||
return &types.GenesisState{
|
||||
Index: index,
|
||||
Owners: owners,
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ import (
|
|||
const DefaultIndex uint64 = 1
|
||||
|
||||
// DefaultGenesis returns the default Capability genesis state
|
||||
func DefaultGenesis() GenesisState {
|
||||
return GenesisState{
|
||||
func DefaultGenesis() *GenesisState {
|
||||
return &GenesisState{
|
||||
Index: DefaultIndex,
|
||||
Owners: []GenesisOwners{},
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ func TestValidateGenesis(t *testing.T) {
|
|||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
genState := DefaultGenesis()
|
||||
tc.malleate(&genState)
|
||||
tc.malleate(genState)
|
||||
err := genState.Validate()
|
||||
if tc.expPass {
|
||||
require.NoError(t, err, tc.name)
|
||||
|
|
|
@ -28,7 +28,7 @@ var (
|
|||
|
||||
func createTestApp() (*simapp.SimApp, sdk.Context, []sdk.AccAddress) {
|
||||
db := dbm.NewMemDB()
|
||||
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, simapp.DefaultNodeHome, 1)
|
||||
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, simapp.DefaultNodeHome, 1, simapp.MakeEncodingConfig())
|
||||
ctx := app.NewContext(true, abci.Header{})
|
||||
|
||||
constantFee := sdk.NewInt64Coin(sdk.DefaultBondDenom, 10)
|
||||
|
|
|
@ -6,12 +6,12 @@ import (
|
|||
)
|
||||
|
||||
// new crisis genesis
|
||||
func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState) {
|
||||
func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) {
|
||||
k.SetConstantFee(ctx, data.ConstantFee)
|
||||
}
|
||||
|
||||
// ExportGenesis returns a GenesisState for a given context and keeper.
|
||||
func (k Keeper) ExportGenesis(ctx sdk.Context) types.GenesisState {
|
||||
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
|
||||
constantFee := k.GetConstantFee(ctx)
|
||||
return types.NewGenesisState(constantFee)
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, config client.TxE
|
|||
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
|
||||
}
|
||||
|
||||
return types.ValidateGenesis(data)
|
||||
return types.ValidateGenesis(&data)
|
||||
}
|
||||
|
||||
// RegisterRESTRoutes registers no REST routes for the crisis module.
|
||||
|
@ -118,7 +118,7 @@ func (am AppModule) RegisterQueryService(grpc.Server) {}
|
|||
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate {
|
||||
var genesisState types.GenesisState
|
||||
cdc.MustUnmarshalJSON(data, &genesisState)
|
||||
am.keeper.InitGenesis(ctx, genesisState)
|
||||
am.keeper.InitGenesis(ctx, &genesisState)
|
||||
am.keeper.AssertInvariants(ctx)
|
||||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
|
|
@ -7,21 +7,21 @@ import (
|
|||
)
|
||||
|
||||
// NewGenesisState creates a new GenesisState object
|
||||
func NewGenesisState(constantFee sdk.Coin) GenesisState {
|
||||
return GenesisState{
|
||||
func NewGenesisState(constantFee sdk.Coin) *GenesisState {
|
||||
return &GenesisState{
|
||||
ConstantFee: constantFee,
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultGenesisState creates a default GenesisState object
|
||||
func DefaultGenesisState() GenesisState {
|
||||
return GenesisState{
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
ConstantFee: sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1000)),
|
||||
}
|
||||
}
|
||||
|
||||
// ValidateGenesis - validate crisis genesis data
|
||||
func ValidateGenesis(data GenesisState) error {
|
||||
func ValidateGenesis(data *GenesisState) error {
|
||||
if !data.ConstantFee.IsPositive() {
|
||||
return fmt.Errorf("constant fee must be positive: %s", data.ConstantFee)
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState) {
|
|||
}
|
||||
|
||||
// ExportGenesis returns a GenesisState for a given context and keeper.
|
||||
func (k Keeper) ExportGenesis(ctx sdk.Context) types.GenesisState {
|
||||
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
|
||||
feePool := k.GetFeePool(ctx)
|
||||
params := k.GetParams(ctx)
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, config sdkclient.
|
|||
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
|
||||
}
|
||||
|
||||
return types.ValidateGenesis(data)
|
||||
return types.ValidateGenesis(&data)
|
||||
}
|
||||
|
||||
// RegisterRESTRoutes registers the REST routes for the distribution module.
|
||||
|
|
|
@ -8,9 +8,9 @@ func NewGenesisState(
|
|||
params Params, fp FeePool, dwis []DelegatorWithdrawInfo, pp sdk.ConsAddress, r []ValidatorOutstandingRewardsRecord,
|
||||
acc []ValidatorAccumulatedCommissionRecord, historical []ValidatorHistoricalRewardsRecord,
|
||||
cur []ValidatorCurrentRewardsRecord, dels []DelegatorStartingInfoRecord, slashes []ValidatorSlashEventRecord,
|
||||
) GenesisState {
|
||||
) *GenesisState {
|
||||
|
||||
return GenesisState{
|
||||
return &GenesisState{
|
||||
Params: params,
|
||||
FeePool: fp,
|
||||
DelegatorWithdrawInfos: dwis,
|
||||
|
@ -25,8 +25,8 @@ func NewGenesisState(
|
|||
}
|
||||
|
||||
// get raw genesis raw message for testing
|
||||
func DefaultGenesisState() GenesisState {
|
||||
return GenesisState{
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
FeePool: InitialFeePool(),
|
||||
Params: DefaultParams(),
|
||||
DelegatorWithdrawInfos: []DelegatorWithdrawInfo{},
|
||||
|
@ -41,7 +41,7 @@ func DefaultGenesisState() GenesisState {
|
|||
}
|
||||
|
||||
// ValidateGenesis validates the genesis state of distribution genesis input
|
||||
func ValidateGenesis(gs GenesisState) error {
|
||||
func ValidateGenesis(gs *GenesisState) error {
|
||||
if err := gs.Params.ValidateBasic(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
// InitGenesis initializes the evidence module's state from a provided genesis
|
||||
// state.
|
||||
func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs types.GenesisState) {
|
||||
func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs *types.GenesisState) {
|
||||
if err := gs.Validate(); err != nil {
|
||||
panic(fmt.Sprintf("failed to validate %s genesis state: %s", types.ModuleName, err))
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs types.GenesisState) {
|
|||
}
|
||||
|
||||
// ExportGenesis returns the evidence module's exported genesis.
|
||||
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
|
||||
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
|
||||
e := k.GetAllEvidence(ctx)
|
||||
evidence := make([]*codectypes.Any, len(e))
|
||||
for i, evi := range e {
|
||||
|
@ -47,7 +47,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
|
|||
}
|
||||
evidence[i] = any
|
||||
}
|
||||
return types.GenesisState{
|
||||
return &types.GenesisState{
|
||||
Evidence: evidence,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ func (suite *GenesisTestSuite) SetupTest() {
|
|||
|
||||
func (suite *GenesisTestSuite) TestInitGenesis() {
|
||||
var (
|
||||
genesisState types.GenesisState
|
||||
genesisState *types.GenesisState
|
||||
testEvidence []exported.Evidence
|
||||
pk = ed25519.GenPrivKey()
|
||||
)
|
||||
|
|
|
@ -160,7 +160,7 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, bz jso
|
|||
panic(fmt.Sprintf("failed to unmarshal %s genesis state: %s", types.ModuleName, err))
|
||||
}
|
||||
|
||||
InitGenesis(ctx, am.keeper, gs)
|
||||
InitGenesis(ctx, am.keeper, &gs)
|
||||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
var _ types.UnpackInterfacesMessage = GenesisState{}
|
||||
|
||||
// NewGenesisState creates a new genesis state for the evidence module.
|
||||
func NewGenesisState(e []exported.Evidence) GenesisState {
|
||||
func NewGenesisState(e []exported.Evidence) *GenesisState {
|
||||
evidence := make([]*types.Any, len(e))
|
||||
for i, evi := range e {
|
||||
msg, ok := evi.(proto.Message)
|
||||
|
@ -25,14 +25,14 @@ func NewGenesisState(e []exported.Evidence) GenesisState {
|
|||
}
|
||||
evidence[i] = any
|
||||
}
|
||||
return GenesisState{
|
||||
return &GenesisState{
|
||||
Evidence: evidence,
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultGenesisState returns the evidence module's default genesis state.
|
||||
func DefaultGenesisState() GenesisState {
|
||||
return GenesisState{
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
Evidence: []*types.Any{},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ func TestNewGenesisState(t *testing.T) {
|
|||
|
||||
func TestGenesisStateValidate(t *testing.T) {
|
||||
var (
|
||||
genesisState types.GenesisState
|
||||
genesisState *types.GenesisState
|
||||
testEvidence []exported.Evidence
|
||||
pk = ed25519.GenPrivKey()
|
||||
)
|
||||
|
@ -104,7 +104,7 @@ func TestGenesisStateValidate(t *testing.T) {
|
|||
{
|
||||
"expected evidence",
|
||||
func() {
|
||||
genesisState = types.GenesisState{
|
||||
genesisState = &types.GenesisState{
|
||||
Evidence: []*codectypes.Any{{}},
|
||||
}
|
||||
},
|
||||
|
|
|
@ -88,7 +88,7 @@ $ %s gentx my-key-name --home=/path/to/home/dir --keyring-backend=os --chain-id=
|
|||
}
|
||||
|
||||
var genesisState map[string]json.RawMessage
|
||||
if err = cdc.UnmarshalJSON(genDoc.AppState, &genesisState); err != nil {
|
||||
if err = json.Unmarshal(genDoc.AppState, &genesisState); err != nil {
|
||||
return errors.Wrap(err, "failed to unmarshal genesis state")
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ func QueryGenesisTxs(clientCtx client.Context, w http.ResponseWriter) {
|
|||
return
|
||||
}
|
||||
|
||||
appState, err := types.GenesisStateFromGenDoc(clientCtx.LegacyAmino, *resultGenesis.Genesis)
|
||||
appState, err := types.GenesisStateFromGenDoc(*resultGenesis.Genesis)
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(
|
||||
w, http.StatusInternalServerError,
|
||||
|
|
|
@ -45,7 +45,7 @@ func GenAppStateFromConfig(cdc codec.JSONMarshaler, txEncodingConfig client.TxEn
|
|||
}
|
||||
|
||||
// create the app state
|
||||
appGenesisState, err := types.GenesisStateFromGenDoc(cdc, genDoc)
|
||||
appGenesisState, err := types.GenesisStateFromGenDoc(genDoc)
|
||||
if err != nil {
|
||||
return appState, err
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ func GenAppStateFromConfig(cdc codec.JSONMarshaler, txEncodingConfig client.TxEn
|
|||
return appState, err
|
||||
}
|
||||
|
||||
appState, err = codec.MarshalJSONIndent(cdc, appGenesisState)
|
||||
appState, err = json.MarshalIndent(appGenesisState, "", " ")
|
||||
if err != nil {
|
||||
return appState, err
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ func CollectTxs(cdc codec.JSONMarshaler, txJSONDecoder sdk.TxDecoder, moniker, g
|
|||
// prepare a map of all balances in genesis state to then validate
|
||||
// against the validators addresses
|
||||
var appState map[string]json.RawMessage
|
||||
if err := cdc.UnmarshalJSON(genDoc.AppState, &appState); err != nil {
|
||||
if err := json.Unmarshal(genDoc.AppState, &appState); err != nil {
|
||||
return appGenTxs, persistentPeers, err
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, txEncodingConfi
|
|||
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
|
||||
}
|
||||
|
||||
return types.ValidateGenesis(data, txEncodingConfig.TxJSONDecoder())
|
||||
return types.ValidateGenesis(&data, txEncodingConfig.TxJSONDecoder())
|
||||
}
|
||||
|
||||
// RegisterRESTRoutes registers the REST routes for the genutil module.
|
||||
|
|
|
@ -14,26 +14,26 @@ import (
|
|||
)
|
||||
|
||||
// NewGenesisState creates a new GenesisState object
|
||||
func NewGenesisState(genTxs []json.RawMessage) GenesisState {
|
||||
func NewGenesisState(genTxs []json.RawMessage) *GenesisState {
|
||||
// Ensure genTxs is never nil, https://github.com/cosmos/cosmos-sdk/issues/5086
|
||||
if len(genTxs) == 0 {
|
||||
genTxs = make([]json.RawMessage, 0)
|
||||
}
|
||||
return GenesisState{
|
||||
return &GenesisState{
|
||||
GenTxs: genTxs,
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultGenesisState returns the genutil module's default genesis state.
|
||||
func DefaultGenesisState() GenesisState {
|
||||
return GenesisState{
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
GenTxs: []json.RawMessage{},
|
||||
}
|
||||
}
|
||||
|
||||
// NewGenesisStateFromTx creates a new GenesisState object
|
||||
// from auth transactions
|
||||
func NewGenesisStateFromTx(txJSONEncoder sdk.TxEncoder, genTxs []sdk.Tx) GenesisState {
|
||||
func NewGenesisStateFromTx(txJSONEncoder sdk.TxEncoder, genTxs []sdk.Tx) *GenesisState {
|
||||
genTxsBz := make([]json.RawMessage, len(genTxs))
|
||||
for i, genTx := range genTxs {
|
||||
var err error
|
||||
|
@ -46,17 +46,17 @@ func NewGenesisStateFromTx(txJSONEncoder sdk.TxEncoder, genTxs []sdk.Tx) Genesis
|
|||
}
|
||||
|
||||
// GetGenesisStateFromAppState gets the genutil genesis state from the expected app state
|
||||
func GetGenesisStateFromAppState(cdc codec.JSONMarshaler, appState map[string]json.RawMessage) GenesisState {
|
||||
func GetGenesisStateFromAppState(cdc codec.JSONMarshaler, appState map[string]json.RawMessage) *GenesisState {
|
||||
var genesisState GenesisState
|
||||
if appState[ModuleName] != nil {
|
||||
cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState)
|
||||
}
|
||||
return genesisState
|
||||
return &genesisState
|
||||
}
|
||||
|
||||
// SetGenesisStateInAppState sets the genutil genesis state within the expected app state
|
||||
func SetGenesisStateInAppState(
|
||||
cdc codec.JSONMarshaler, appState map[string]json.RawMessage, genesisState GenesisState,
|
||||
cdc codec.JSONMarshaler, appState map[string]json.RawMessage, genesisState *GenesisState,
|
||||
) map[string]json.RawMessage {
|
||||
|
||||
genesisStateBz := cdc.MustMarshalJSON(genesisState)
|
||||
|
@ -68,10 +68,9 @@ func SetGenesisStateInAppState(
|
|||
// for the application.
|
||||
//
|
||||
// NOTE: The pubkey input is this machines pubkey.
|
||||
func GenesisStateFromGenDoc(cdc codec.JSONMarshaler, genDoc tmtypes.GenesisDoc,
|
||||
) (genesisState map[string]json.RawMessage, err error) {
|
||||
func GenesisStateFromGenDoc(genDoc tmtypes.GenesisDoc) (genesisState map[string]json.RawMessage, err error) {
|
||||
|
||||
if err = cdc.UnmarshalJSON(genDoc.AppState, &genesisState); err != nil {
|
||||
if err = json.Unmarshal(genDoc.AppState, &genesisState); err != nil {
|
||||
return genesisState, err
|
||||
}
|
||||
return genesisState, nil
|
||||
|
@ -92,12 +91,12 @@ func GenesisStateFromGenFile(cdc codec.JSONMarshaler, genFile string) (genesisSt
|
|||
return genesisState, genDoc, err
|
||||
}
|
||||
|
||||
genesisState, err = GenesisStateFromGenDoc(cdc, *genDoc)
|
||||
genesisState, err = GenesisStateFromGenDoc(*genDoc)
|
||||
return genesisState, genDoc, err
|
||||
}
|
||||
|
||||
// ValidateGenesis validates GenTx transactions
|
||||
func ValidateGenesis(genesisState GenesisState, txJSONDecoder sdk.TxDecoder) error {
|
||||
func ValidateGenesis(genesisState *GenesisState, txJSONDecoder sdk.TxDecoder) error {
|
||||
for i, genTx := range genesisState.GenTxs {
|
||||
var tx sdk.Tx
|
||||
tx, err := txJSONDecoder(genTx)
|
||||
|
|
|
@ -44,6 +44,7 @@ func NormalizeProposalStatus(status string) string {
|
|||
return "Passed"
|
||||
case "Rejected", "rejected":
|
||||
return "Rejected"
|
||||
default:
|
||||
return status
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
)
|
||||
|
||||
// InitGenesis - store genesis parameters
|
||||
func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, data types.GenesisState) {
|
||||
func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, data *types.GenesisState) {
|
||||
k.SetProposalID(ctx, data.StartingProposalID)
|
||||
k.SetDepositParams(ctx, data.DepositParams)
|
||||
k.SetVotingParams(ctx, data.VotingParams)
|
||||
|
@ -52,7 +52,7 @@ func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k
|
|||
}
|
||||
|
||||
// ExportGenesis - output genesis parameters
|
||||
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
|
||||
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
|
||||
startingProposalID, _ := k.GetProposalID(ctx)
|
||||
depositParams := k.GetDepositParams(ctx)
|
||||
votingParams := k.GetVotingParams(ctx)
|
||||
|
@ -69,7 +69,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
|
|||
proposalsVotes = append(proposalsVotes, votes...)
|
||||
}
|
||||
|
||||
return types.GenesisState{
|
||||
return &types.GenesisState{
|
||||
StartingProposalID: startingProposalID,
|
||||
Deposits: proposalsDeposits,
|
||||
Votes: proposalsVotes,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package gov_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -8,7 +9,6 @@ import (
|
|||
"github.com/tendermint/tendermint/libs/log"
|
||||
dbm "github.com/tendermint/tm-db"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
|
@ -61,13 +61,13 @@ func TestImportExportQueues(t *testing.T) {
|
|||
genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenState)
|
||||
genesisState[types.ModuleName] = app.AppCodec().MustMarshalJSON(govGenState)
|
||||
|
||||
stateBytes, err := codec.MarshalJSONIndent(app.LegacyAmino(), genesisState)
|
||||
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
db := dbm.NewMemDB()
|
||||
app2 := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, simapp.DefaultNodeHome, 0)
|
||||
app2 := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, simapp.DefaultNodeHome, 0, simapp.MakeEncodingConfig())
|
||||
|
||||
app2.InitChain(
|
||||
abci.RequestInitChain{
|
||||
|
|
|
@ -2,6 +2,7 @@ package keeper_test
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -128,14 +129,16 @@ func TestGetProposalsFiltered(t *testing.T) {
|
|||
{types.NewQueryProposalsParams(1, 50, types.StatusVotingPeriod, nil, nil), 50},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
proposals := app.GovKeeper.GetProposalsFiltered(ctx, tc.params)
|
||||
require.Len(t, proposals, tc.expectedNumResults)
|
||||
for i, tc := range testCases {
|
||||
t.Run(fmt.Sprintf("Test Case %d", i), func(t *testing.T) {
|
||||
proposals := app.GovKeeper.GetProposalsFiltered(ctx, tc.params)
|
||||
require.Len(t, proposals, tc.expectedNumResults)
|
||||
|
||||
for _, p := range proposals {
|
||||
if len(tc.params.ProposalStatus.String()) != 0 {
|
||||
require.Equal(t, tc.params.ProposalStatus, p.Status)
|
||||
for _, p := range proposals {
|
||||
if types.ValidProposalStatus(tc.params.ProposalStatus) {
|
||||
require.Equal(t, tc.params.ProposalStatus, p.Status)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, config client.TxE
|
|||
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
|
||||
}
|
||||
|
||||
return types.ValidateGenesis(data)
|
||||
return types.ValidateGenesis(&data)
|
||||
}
|
||||
|
||||
// RegisterRESTRoutes registers the REST routes for the gov module.
|
||||
|
@ -160,7 +160,7 @@ func (am AppModule) RegisterQueryService(server grpc.Server) {
|
|||
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate {
|
||||
var genesisState types.GenesisState
|
||||
cdc.MustUnmarshalJSON(data, &genesisState)
|
||||
InitGenesis(ctx, am.accountKeeper, am.bankKeeper, am.keeper, genesisState)
|
||||
InitGenesis(ctx, am.accountKeeper, am.bankKeeper, am.keeper, &genesisState)
|
||||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
)
|
||||
|
||||
// NewGenesisState creates a new genesis state for the governance module
|
||||
func NewGenesisState(startingProposalID uint64, dp DepositParams, vp VotingParams, tp TallyParams) GenesisState {
|
||||
return GenesisState{
|
||||
func NewGenesisState(startingProposalID uint64, dp DepositParams, vp VotingParams, tp TallyParams) *GenesisState {
|
||||
return &GenesisState{
|
||||
StartingProposalID: startingProposalID,
|
||||
DepositParams: dp,
|
||||
VotingParams: vp,
|
||||
|
@ -18,7 +18,7 @@ func NewGenesisState(startingProposalID uint64, dp DepositParams, vp VotingParam
|
|||
}
|
||||
|
||||
// DefaultGenesisState defines the default governance genesis state
|
||||
func DefaultGenesisState() GenesisState {
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return NewGenesisState(
|
||||
DefaultStartingProposalID,
|
||||
DefaultDepositParams(),
|
||||
|
@ -43,7 +43,7 @@ func (data GenesisState) Empty() bool {
|
|||
}
|
||||
|
||||
// ValidateGenesis checks if parameters are within valid ranges
|
||||
func ValidateGenesis(data GenesisState) error {
|
||||
func ValidateGenesis(data *GenesisState) error {
|
||||
threshold := data.TallyParams.Threshold
|
||||
if threshold.IsNegative() || threshold.GT(sdk.OneDec()) {
|
||||
return fmt.Errorf("governance vote threshold should be positive and less or equal to one, is %s",
|
||||
|
|
|
@ -105,6 +105,10 @@ var ProposalStatus_value = map[string]int32{
|
|||
"PROPOSAL_STATUS_FAILED": 5,
|
||||
}
|
||||
|
||||
func (x ProposalStatus) String() string {
|
||||
return proto.EnumName(ProposalStatus_name, int32(x))
|
||||
}
|
||||
|
||||
func (ProposalStatus) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6e82113c1a9a4b7c, []int{1}
|
||||
}
|
||||
|
@ -448,94 +452,95 @@ func init() {
|
|||
func init() { proto.RegisterFile("cosmos/gov/v1beta1/gov.proto", fileDescriptor_6e82113c1a9a4b7c) }
|
||||
|
||||
var fileDescriptor_6e82113c1a9a4b7c = []byte{
|
||||
// 1392 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x3f, 0x6c, 0xdb, 0xc6,
|
||||
0x17, 0x16, 0xe5, 0x7f, 0xf1, 0x49, 0xb6, 0x99, 0xb3, 0x7f, 0xb6, 0xcc, 0x5f, 0x4a, 0x32, 0x6c,
|
||||
0x50, 0x18, 0x41, 0x22, 0x27, 0x2e, 0x50, 0xa0, 0x09, 0x50, 0x44, 0xb4, 0x98, 0x44, 0x45, 0x20,
|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c4, 0x0f, 0x2f, 0xa4,
|
||||
0xb5, 0xd7, 0x28, 0x16, 0x00, 0x7c, 0x9d, 0x51, 0x5f, 0x9b, 0x0c, 0x94, 0x51, 0x3e, 0x9f, 0x01,
|
||||
0x67, 0x8e, 0x45, 0x56, 0x4f, 0xd2, 0xe3, 0xfc, 0xa0, 0x1e, 0x87, 0x3d, 0x29, 0xe9, 0xd8, 0x47,
|
||||
0x3d, 0x69, 0x96, 0xaa, 0x32, 0x2c, 0xc6, 0x75, 0x30, 0x53, 0xa3, 0x52, 0x87, 0x52, 0xa4, 0x36,
|
||||
0x96, 0xb2, 0xf4, 0xa8, 0xb3, 0xd1, 0x51, 0x67, 0x73, 0xde, 0x9e, 0x9a, 0xfa, 0xa5, 0x7f, 0x26,
|
||||
0x7a, 0x84, 0x80, 0x55, 0x30, 0xed, 0x13, 0x8b, 0xb4, 0xfd, 0xcc, 0x84, 0xcc, 0xad, 0xcd, 0x6f,
|
||||
0x28, 0xd9, 0xd1, 0x7b, 0x9c, 0x8d, 0x7a, 0xa9, 0x84, 0x99, 0xaa, 0x70, 0xd4, 0x93, 0x96, 0x87,
|
||||
0x4e, 0x88, 0x92, 0x28, 0x3a, 0x63, 0x83, 0x4d, 0x00, 0x1f, 0x3a, 0x9e, 0xd5, 0x30, 0x89, 0xd5,
|
||||
0x68, 0xec, 0x99, 0x2d, 0xe4, 0xb7, 0x1b, 0x24, 0x33, 0x19, 0xf6, 0x27, 0x9d, 0x54, 0xc3, 0x08,
|
||||
0xf2, 0xf4, 0x30, 0x4d, 0x3d, 0x1f, 0x48, 0x7c, 0xd4, 0x93, 0x56, 0x69, 0x91, 0x51, 0x22, 0x45,
|
||||
0xe7, 0xc3, 0x60, 0x0c, 0x04, 0x3f, 0x00, 0x29, 0xbf, 0xbd, 0xe5, 0x3a, 0xc4, 0x0c, 0x4c, 0x91,
|
||||
0x99, 0x0a, 0x4b, 0x09, 0x23, 0x52, 0x18, 0x91, 0x63, 0x54, 0x91, 0x55, 0x61, 0x97, 0x2d, 0x06,
|
||||
0x56, 0x1e, 0xbf, 0x90, 0x38, 0x1d, 0xd0, 0x48, 0x00, 0x80, 0x0e, 0xe0, 0xd9, 0x65, 0x31, 0x91,
|
||||
0x67, 0xd3, 0x0a, 0xd3, 0xa7, 0x56, 0x78, 0x93, 0x55, 0x58, 0xa1, 0x15, 0x86, 0x19, 0x68, 0x99,
|
||||
0x79, 0x16, 0xd6, 0x3c, 0x3b, 0x2c, 0xf5, 0x88, 0x03, 0x73, 0x04, 0x13, 0xab, 0x61, 0xb2, 0x85,
|
||||
0xcc, 0xcc, 0x69, 0x57, 0xf2, 0x36, 0xab, 0xb3, 0x44, 0xeb, 0x0c, 0xa0, 0x95, 0xb1, 0xae, 0x6a,
|
||||
0x3a, 0xc4, 0x46, 0x6e, 0x6d, 0x80, 0xb3, 0x3b, 0x98, 0x38, 0x5e, 0x3d, 0x38, 0xde, 0x16, 0x13,
|
||||
0xf6, 0xcc, 0xa9, 0xdb, 0xbe, 0xc0, 0xda, 0xc9, 0xd0, 0x76, 0x46, 0x28, 0xe8, 0xbe, 0x17, 0x68,
|
||||
0xbc, 0x12, 0x84, 0xc3, 0x8d, 0x3f, 0x04, 0x2c, 0xd4, 0x97, 0x78, 0xf6, 0xd4, 0x5a, 0x0a, 0xab,
|
||||
0xb5, 0x3c, 0x50, 0x6b, 0x50, 0xe1, 0x39, 0x1a, 0x65, 0x02, 0x33, 0x1b, 0xee, 0x27, 0x41, 0x2a,
|
||||
0x7e, 0x7d, 0x6e, 0x80, 0x89, 0x3d, 0xe4, 0xd3, 0x61, 0xa7, 0x66, 0x03, 0xd6, 0xdf, 0x7a, 0xd2,
|
||||
0x5b, 0xaf, 0x21, 0x5c, 0xc1, 0x23, 0x7a, 0x00, 0x85, 0xb7, 0xc1, 0x8c, 0xb5, 0xe5, 0x13, 0xcb,
|
||||
0x61, 0x63, 0x71, 0x6c, 0x96, 0x08, 0x0e, 0xdf, 0x03, 0x49, 0x0f, 0x87, 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, 0xdd, 0x47, 0x3e, 0xbc, 0x08, 0x16, 0xe3, 0x39, 0x39,
|
||||
0xb5, 0x62, 0xe4, 0x0a, 0x45, 0x3e, 0x29, 0x9c, 0xed, 0x74, 0xe5, 0x39, 0x9a, 0x97, 0x63, 0x83,
|
||||
0x50, 0x06, 0xf3, 0xf1, 0xdc, 0x62, 0x89, 0x9f, 0x10, 0xd2, 0x9d, 0xae, 0x7c, 0x86, 0xa6, 0x15,
|
||||
0x31, 0xdc, 0x00, 0x99, 0xc1, 0x0c, 0xf3, 0x5e, 0xc1, 0xb8, 0x6d, 0x56, 0x35, 0xa3, 0xc4, 0x4f,
|
||||
0x0a, 0x4b, 0x9d, 0xae, 0xcc, 0x47, 0xb9, 0xd1, 0xd4, 0x12, 0xd2, 0x8f, 0xbe, 0x13, 0x13, 0xdf,
|
||||
0x3f, 0x11, 0x13, 0x3f, 0x3e, 0x11, 0x13, 0x17, 0x9f, 0x25, 0xc1, 0xfc, 0xe0, 0x3f, 0x38, 0x30,
|
||||
0x0b, 0xfe, 0x5f, 0xd6, 0x4b, 0xe5, 0x52, 0x25, 0x77, 0xc7, 0xac, 0x18, 0x39, 0xe3, 0x6e, 0x65,
|
||||
0x68, 0xe3, 0xe1, 0x96, 0x68, 0x72, 0xd1, 0x69, 0xc0, 0xeb, 0x40, 0x1c, 0xce, 0xcf, 0x6b, 0xe5,
|
||||
0x52, 0xa5, 0x60, 0x98, 0x65, 0x4d, 0x2f, 0x94, 0xf2, 0x3c, 0x27, 0xac, 0x74, 0xba, 0xf2, 0x22,
|
||||
0x85, 0x0c, 0xb8, 0x04, 0xbe, 0x0b, 0xde, 0x18, 0x06, 0x57, 0x4b, 0x46, 0xa1, 0x78, 0x2b, 0xc2,
|
||||
0x26, 0x85, 0xe5, 0x4e, 0x57, 0x86, 0x14, 0x5b, 0x8d, 0x5d, 0x69, 0x78, 0x09, 0x2c, 0x0f, 0x43,
|
||||
0xcb, 0xb9, 0x4a, 0x45, 0xcb, 0xf3, 0x13, 0x02, 0xdf, 0xe9, 0xca, 0x69, 0x8a, 0x29, 0x5b, 0xbe,
|
||||
0x8f, 0x6c, 0x78, 0x05, 0x64, 0x86, 0xb3, 0x75, 0xed, 0x7d, 0x6d, 0xd3, 0xd0, 0xf2, 0xfc, 0xa4,
|
||||
0x00, 0x3b, 0x5d, 0x79, 0x9e, 0xe6, 0xeb, 0xe8, 0x43, 0x54, 0x23, 0xe8, 0x44, 0xfe, 0x9b, 0xb9,
|
||||
0xc2, 0x1d, 0x2d, 0xcf, 0x4f, 0xc5, 0xf9, 0x6f, 0x5a, 0x4e, 0x03, 0xd9, 0x83, 0xb2, 0xaa, 0xc5,
|
||||
0xfd, 0x97, 0x62, 0xe2, 0xf9, 0x4b, 0x31, 0xf1, 0xd9, 0x81, 0x98, 0xd8, 0x3f, 0x10, 0xb9, 0xa7,
|
||||
0x07, 0x22, 0xf7, 0xfb, 0x81, 0xc8, 0x3d, 0x7e, 0x25, 0x26, 0x9e, 0xbe, 0x12, 0x13, 0xcf, 0x5f,
|
||||
0x89, 0x89, 0x07, 0xff, 0x3c, 0xe9, 0x76, 0xc3, 0xdf, 0x5a, 0xe1, 0x9d, 0xdd, 0x9a, 0x0e, 0x87,
|
||||
0xc3, 0xdb, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xc9, 0x24, 0xef, 0x4e, 0x86, 0x0d, 0x00, 0x00,
|
||||
// 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, 0x7b, 0xed, 0xbf, 0x4d, 0xfd, 0x1f, 0xb6, 0x67,
|
||||
0x26, 0x54, 0x4d, 0x5b, 0xba, 0x15, 0x09, 0x89, 0x4d, 0x42, 0x8b, 0x1b, 0x6f, 0x0b, 0x9a, 0x92,
|
||||
0xc8, 0xf1, 0x32, 0x6d, 0x1c, 0x2c, 0x37, 0x7e, 0x4b, 0x0d, 0xb1, 0x5f, 0x88, 0x5f, 0x4a, 0x2b,
|
||||
0x2e, 0x1c, 0x38, 0x4c, 0x01, 0xa1, 0x1d, 0x91, 0x50, 0x24, 0x24, 0x76, 0x40, 0x9c, 0x38, 0x70,
|
||||
0xe6, 0x5c, 0x21, 0x0e, 0x13, 0xe2, 0x30, 0x71, 0xc8, 0x58, 0x77, 0x41, 0x3d, 0x70, 0xe8, 0x91,
|
||||
0x13, 0xb2, 0xdf, 0x73, 0xeb, 0x24, 0x15, 0x5d, 0x04, 0xa7, 0xda, 0xdf, 0xfb, 0x7e, 0xbf, 0xef,
|
||||
0x7b, 0xbf, 0xf7, 0x7e, 0x9f, 0x1b, 0x70, 0xae, 0x8e, 0x7d, 0x17, 0xfb, 0x6b, 0x0d, 0xbc, 0xbd,
|
||||
0xb6, 0x7d, 0x75, 0x13, 0x11, 0xeb, 0x6a, 0xf0, 0x9c, 0x6b, 0xb5, 0x31, 0xc1, 0x10, 0xd2, 0xd5,
|
||||
0x5c, 0x10, 0x61, 0xab, 0x82, 0xc8, 0x10, 0x9b, 0x96, 0x8f, 0x8e, 0x20, 0x75, 0xec, 0x78, 0x14,
|
||||
0x23, 0x2c, 0x36, 0x70, 0x03, 0x87, 0x8f, 0x6b, 0xc1, 0x13, 0x8b, 0xae, 0x50, 0x94, 0x49, 0x17,
|
||||
0x18, 0x2d, 0x5d, 0x92, 0x1a, 0x18, 0x37, 0x9a, 0x68, 0x2d, 0x7c, 0xdb, 0xec, 0x3c, 0x5c, 0x23,
|
||||
0x8e, 0x8b, 0x7c, 0x62, 0xb9, 0xad, 0x08, 0x3b, 0x9c, 0x60, 0x79, 0xbb, 0x6c, 0x49, 0x1c, 0x5e,
|
||||
0xb2, 0x3b, 0x6d, 0x8b, 0x38, 0x98, 0x35, 0xa3, 0xdc, 0x03, 0x19, 0x03, 0xed, 0x90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, 0xad, 0xe4, 0xab, 0x55, 0xad, 0xc0, 0x4f, 0x08, 0x7c, 0xb7, 0x27, 0x67, 0x28, 0xa6, 0x62,
|
||||
0xf9, 0x3e, 0xb2, 0xe1, 0x15, 0x90, 0x1d, 0xce, 0xd6, 0xb5, 0x77, 0xb5, 0x0d, 0x43, 0x2b, 0xf0,
|
||||
0x29, 0x01, 0x76, 0x7b, 0xf2, 0x1c, 0xcd, 0xd7, 0xd1, 0xfb, 0xa8, 0x4e, 0xd0, 0x89, 0xfc, 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,
|
||||
}
|
||||
|
||||
func (this *TextProposal) Equal(that interface{}) bool {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package types
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -137,28 +136,11 @@ type (
|
|||
|
||||
// ProposalStatusFromString turns a string into a ProposalStatus
|
||||
func ProposalStatusFromString(str string) (ProposalStatus, error) {
|
||||
switch str {
|
||||
case "DepositPeriod":
|
||||
return StatusDepositPeriod, nil
|
||||
|
||||
case "VotingPeriod":
|
||||
return StatusVotingPeriod, nil
|
||||
|
||||
case "Passed":
|
||||
return StatusPassed, nil
|
||||
|
||||
case "Rejected":
|
||||
return StatusRejected, nil
|
||||
|
||||
case "Failed":
|
||||
return StatusFailed, nil
|
||||
|
||||
case "":
|
||||
return StatusNil, nil
|
||||
|
||||
default:
|
||||
return ProposalStatus(0xff), fmt.Errorf("'%s' is not a valid proposal status", str)
|
||||
num, ok := ProposalStatus_value[str]
|
||||
if !ok {
|
||||
return StatusNil, fmt.Errorf("'%s' is not a valid proposal status", str)
|
||||
}
|
||||
return ProposalStatus(num), nil
|
||||
}
|
||||
|
||||
// ValidProposalStatus returns true if the proposal status is valid and false
|
||||
|
@ -185,51 +167,6 @@ func (status *ProposalStatus) Unmarshal(data []byte) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON Marshals to JSON using string representation of the status
|
||||
func (status ProposalStatus) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(status.String())
|
||||
}
|
||||
|
||||
// UnmarshalJSON Unmarshals from JSON assuming Bech32 encoding
|
||||
func (status *ProposalStatus) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
err := json.Unmarshal(data, &s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
bz2, err := ProposalStatusFromString(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*status = bz2
|
||||
return nil
|
||||
}
|
||||
|
||||
// String implements the Stringer interface.
|
||||
func (status ProposalStatus) String() string {
|
||||
switch status {
|
||||
case StatusDepositPeriod:
|
||||
return "DepositPeriod"
|
||||
|
||||
case StatusVotingPeriod:
|
||||
return "VotingPeriod"
|
||||
|
||||
case StatusPassed:
|
||||
return "Passed"
|
||||
|
||||
case StatusRejected:
|
||||
return "Rejected"
|
||||
|
||||
case StatusFailed:
|
||||
return "Failed"
|
||||
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// Format implements the fmt.Formatter interface.
|
||||
// nolint: errcheck
|
||||
func (status ProposalStatus) Format(s fmt.State, verb rune) {
|
||||
|
|
|
@ -8,13 +8,13 @@ import (
|
|||
)
|
||||
|
||||
func TestProposalStatus_Format(t *testing.T) {
|
||||
statusDepositPeriod, _ := ProposalStatusFromString("DepositPeriod")
|
||||
statusDepositPeriod, _ := ProposalStatusFromString("PROPOSAL_STATUS_DEPOSIT_PERIOD")
|
||||
tests := []struct {
|
||||
pt ProposalStatus
|
||||
sprintFArgs string
|
||||
expectedStringOutput string
|
||||
}{
|
||||
{statusDepositPeriod, "%s", "DepositPeriod"},
|
||||
{statusDepositPeriod, "%s", "PROPOSAL_STATUS_DEPOSIT_PERIOD"},
|
||||
{statusDepositPeriod, "%v", "1"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
|
|
@ -31,8 +31,8 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, state types.GenesisState
|
|||
}
|
||||
|
||||
// ExportGenesis exports transfer module's portID into its geneis state
|
||||
func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState {
|
||||
return types.GenesisState{
|
||||
func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState {
|
||||
return &types.GenesisState{
|
||||
PortID: keeper.GetPort(ctx),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
)
|
||||
|
||||
// DefaultGenesisState returns a GenesisState with "transfer" as the default PortID.
|
||||
func DefaultGenesisState() GenesisState {
|
||||
return GenesisState{
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
PortID: PortID,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
func TestValidateGenesis(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
genState types.GenesisState
|
||||
genState *types.GenesisState
|
||||
expPass bool
|
||||
}{
|
||||
{
|
||||
|
@ -21,14 +21,14 @@ func TestValidateGenesis(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"valid genesis",
|
||||
types.GenesisState{
|
||||
&types.GenesisState{
|
||||
PortID: "portidone",
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"invalid client",
|
||||
types.GenesisState{
|
||||
&types.GenesisState{
|
||||
PortID: "(INVALIDPORT)",
|
||||
},
|
||||
false,
|
||||
|
|
|
@ -11,15 +11,15 @@ import (
|
|||
|
||||
// InitGenesis initializes the ibc state from a provided genesis
|
||||
// state.
|
||||
func InitGenesis(ctx sdk.Context, k keeper.Keeper, createLocalhost bool, gs types.GenesisState) {
|
||||
func InitGenesis(ctx sdk.Context, k keeper.Keeper, createLocalhost bool, gs *types.GenesisState) {
|
||||
client.InitGenesis(ctx, k.ClientKeeper, gs.ClientGenesis)
|
||||
connection.InitGenesis(ctx, k.ConnectionKeeper, gs.ConnectionGenesis)
|
||||
channel.InitGenesis(ctx, k.ChannelKeeper, gs.ChannelGenesis)
|
||||
}
|
||||
|
||||
// ExportGenesis returns the ibc exported genesis.
|
||||
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
|
||||
return types.GenesisState{
|
||||
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
|
||||
return &types.GenesisState{
|
||||
ClientGenesis: client.ExportGenesis(ctx, k.ClientKeeper),
|
||||
ConnectionGenesis: connection.ExportGenesis(ctx, k.ConnectionKeeper),
|
||||
ChannelGenesis: channel.ExportGenesis(ctx, k.ChannelKeeper),
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
func (suite *IBCTestSuite) TestValidateGenesis() {
|
||||
testCases := []struct {
|
||||
name string
|
||||
genState types.GenesisState
|
||||
genState *types.GenesisState
|
||||
expPass bool
|
||||
}{
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
|
|||
},
|
||||
{
|
||||
name: "valid genesis",
|
||||
genState: types.GenesisState{
|
||||
genState: &types.GenesisState{
|
||||
ClientGenesis: clienttypes.NewGenesisState(
|
||||
[]clienttypes.GenesisClientState{
|
||||
clienttypes.NewGenesisClientState(
|
||||
|
@ -93,7 +93,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
|
|||
},
|
||||
{
|
||||
name: "invalid client genesis",
|
||||
genState: types.GenesisState{
|
||||
genState: &types.GenesisState{
|
||||
ClientGenesis: clienttypes.NewGenesisState(
|
||||
[]clienttypes.GenesisClientState{
|
||||
clienttypes.NewGenesisClientState(
|
||||
|
@ -112,7 +112,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
|
|||
},
|
||||
{
|
||||
name: "invalid connection genesis",
|
||||
genState: types.GenesisState{
|
||||
genState: &types.GenesisState{
|
||||
ClientGenesis: clienttypes.DefaultGenesisState(),
|
||||
ConnectionGenesis: connectiontypes.NewGenesisState(
|
||||
[]connectiontypes.IdentifiedConnection{
|
||||
|
@ -127,7 +127,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
|
|||
},
|
||||
{
|
||||
name: "invalid channel genesis",
|
||||
genState: types.GenesisState{
|
||||
genState: &types.GenesisState{
|
||||
ClientGenesis: clienttypes.DefaultGenesisState(),
|
||||
ConnectionGenesis: connectiontypes.DefaultGenesisState(),
|
||||
ChannelGenesis: channeltypes.GenesisState{
|
||||
|
@ -154,7 +154,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
|
|||
func (suite *IBCTestSuite) TestInitGenesis() {
|
||||
testCases := []struct {
|
||||
name string
|
||||
genState types.GenesisState
|
||||
genState *types.GenesisState
|
||||
}{
|
||||
{
|
||||
name: "default",
|
||||
|
@ -162,7 +162,7 @@ func (suite *IBCTestSuite) TestInitGenesis() {
|
|||
},
|
||||
{
|
||||
name: "valid genesis",
|
||||
genState: types.GenesisState{
|
||||
genState: &types.GenesisState{
|
||||
ClientGenesis: clienttypes.NewGenesisState(
|
||||
[]clienttypes.GenesisClientState{
|
||||
clienttypes.NewGenesisClientState(
|
||||
|
@ -254,7 +254,7 @@ func (suite *HandlerTestSuite) TestExportGenesis() {
|
|||
|
||||
tc.malleate()
|
||||
|
||||
var gs types.GenesisState
|
||||
var gs *types.GenesisState
|
||||
suite.NotPanics(func() {
|
||||
gs = ibc.ExportGenesis(suite.chainA.GetContext(), *suite.chainA.App.IBCKeeper)
|
||||
})
|
||||
|
@ -266,8 +266,8 @@ func (suite *HandlerTestSuite) TestExportGenesis() {
|
|||
|
||||
suite.NotPanics(func() {
|
||||
cdc := codec.NewProtoCodec(suite.chainA.App.InterfaceRegistry())
|
||||
genState := cdc.MustMarshalJSON(&gs)
|
||||
cdc.MustUnmarshalJSON(genState, &gs)
|
||||
genState := cdc.MustMarshalJSON(gs)
|
||||
cdc.MustUnmarshalJSON(genState, gs)
|
||||
})
|
||||
|
||||
// init genesis based on marshal and unmarshal
|
||||
|
|
|
@ -137,7 +137,7 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, bz jso
|
|||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to unmarshal %s genesis state: %s", host.ModuleName, err))
|
||||
}
|
||||
InitGenesis(ctx, *am.keeper, am.createLocalhost, gs)
|
||||
InitGenesis(ctx, *am.keeper, am.createLocalhost, &gs)
|
||||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
var _ codectypes.UnpackInterfacesMessage = GenesisState{}
|
||||
|
||||
// DefaultGenesisState returns the ibc module's default genesis state.
|
||||
func DefaultGenesisState() GenesisState {
|
||||
return GenesisState{
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
ClientGenesis: clienttypes.DefaultGenesisState(),
|
||||
ConnectionGenesis: connectiontypes.DefaultGenesisState(),
|
||||
ChannelGenesis: channeltypes.DefaultGenesisState(),
|
||||
|
@ -25,7 +25,7 @@ func (gs GenesisState) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
|||
|
||||
// Validate performs basic genesis state validation returning an error upon any
|
||||
// failure.
|
||||
func (gs GenesisState) Validate() error {
|
||||
func (gs *GenesisState) Validate() error {
|
||||
if err := gs.ClientGenesis.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -7,14 +7,14 @@ import (
|
|||
)
|
||||
|
||||
// InitGenesis new mint genesis
|
||||
func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, ak types.AccountKeeper, data types.GenesisState) {
|
||||
func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, ak types.AccountKeeper, data *types.GenesisState) {
|
||||
keeper.SetMinter(ctx, data.Minter)
|
||||
keeper.SetParams(ctx, data.Params)
|
||||
ak.GetModuleAccount(ctx, types.ModuleName)
|
||||
}
|
||||
|
||||
// ExportGenesis returns a GenesisState for a given context and keeper.
|
||||
func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState {
|
||||
func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState {
|
||||
minter := keeper.GetMinter(ctx)
|
||||
params := keeper.GetParams(ctx)
|
||||
return types.NewGenesisState(minter, params)
|
||||
|
|
|
@ -128,7 +128,7 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data j
|
|||
var genesisState types.GenesisState
|
||||
cdc.MustUnmarshalJSON(data, &genesisState)
|
||||
|
||||
InitGenesis(ctx, am.keeper, am.authKeeper, genesisState)
|
||||
InitGenesis(ctx, am.keeper, am.authKeeper, &genesisState)
|
||||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package types
|
||||
|
||||
// NewGenesisState creates a new GenesisState object
|
||||
func NewGenesisState(minter Minter, params Params) GenesisState {
|
||||
return GenesisState{
|
||||
func NewGenesisState(minter Minter, params Params) *GenesisState {
|
||||
return &GenesisState{
|
||||
Minter: minter,
|
||||
Params: params,
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultGenesisState creates a default GenesisState object
|
||||
func DefaultGenesisState() GenesisState {
|
||||
return GenesisState{
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
Minter: DefaultInitialMinter(),
|
||||
Params: DefaultParams(),
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
// InitGenesis initialize default parameters
|
||||
// and the keeper's address to pubkey map
|
||||
func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, stakingKeeper types.StakingKeeper, data types.GenesisState) {
|
||||
func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, stakingKeeper types.StakingKeeper, data *types.GenesisState) {
|
||||
stakingKeeper.IterateValidators(ctx,
|
||||
func(index int64, validator exported.ValidatorI) bool {
|
||||
keeper.AddPubkey(ctx, validator.GetConsPubKey())
|
||||
|
@ -41,7 +41,7 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, stakingKeeper types.Stak
|
|||
// ExportGenesis writes the current store values
|
||||
// to a genesis file, which can be imported again
|
||||
// with InitGenesis
|
||||
func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) (data types.GenesisState) {
|
||||
func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) (data *types.GenesisState) {
|
||||
params := keeper.GetParams(ctx)
|
||||
signingInfos := make([]types.SigningInfo, 0)
|
||||
missedBlocks := make([]types.ValidatorMissedBlocks, 0)
|
||||
|
|
|
@ -141,8 +141,8 @@ func (am AppModule) RegisterQueryService(server grpc.Server) {
|
|||
// no validator updates.
|
||||
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate {
|
||||
var genesisState types.GenesisState
|
||||
types.ModuleCdc.MustUnmarshalJSON(data, &genesisState)
|
||||
InitGenesis(ctx, am.keeper, am.stakingKeeper, genesisState)
|
||||
cdc.MustUnmarshalJSON(data, &genesisState)
|
||||
InitGenesis(ctx, am.keeper, am.stakingKeeper, &genesisState)
|
||||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
// NewGenesisState creates a new GenesisState object
|
||||
func NewGenesisState(
|
||||
params Params, signingInfos []SigningInfo, missedBlocks []ValidatorMissedBlocks,
|
||||
) GenesisState {
|
||||
) *GenesisState {
|
||||
|
||||
return GenesisState{
|
||||
return &GenesisState{
|
||||
Params: params,
|
||||
SigningInfos: signingInfos,
|
||||
MissedBlocks: missedBlocks,
|
||||
|
@ -28,8 +28,8 @@ func NewMissedBlock(index int64, missed bool) MissedBlock {
|
|||
}
|
||||
|
||||
// DefaultGenesisState - default GenesisState used by Cosmos Hub
|
||||
func DefaultGenesisState() GenesisState {
|
||||
return GenesisState{
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
Params: DefaultParams(),
|
||||
SigningInfos: []SigningInfo{},
|
||||
MissedBlocks: []ValidatorMissedBlocks{},
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
// Returns final validator set after applying all declaration and delegations
|
||||
func InitGenesis(
|
||||
ctx sdk.Context, keeper keeper.Keeper, accountKeeper types.AccountKeeper,
|
||||
bankKeeper types.BankKeeper, data types.GenesisState,
|
||||
bankKeeper types.BankKeeper, data *types.GenesisState,
|
||||
) (res []abci.ValidatorUpdate) {
|
||||
bondedTokens := sdk.ZeroInt()
|
||||
notBondedTokens := sdk.ZeroInt()
|
||||
|
@ -147,7 +147,7 @@ func InitGenesis(
|
|||
// ExportGenesis returns a GenesisState for a given context and keeper. The
|
||||
// GenesisState will contain the pool, params, validators, and bonds found in
|
||||
// the keeper.
|
||||
func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState {
|
||||
func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState {
|
||||
var unbondingDelegations []types.UnbondingDelegation
|
||||
|
||||
keeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd types.UnbondingDelegation) (stop bool) {
|
||||
|
@ -169,7 +169,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState {
|
|||
return false
|
||||
})
|
||||
|
||||
return types.GenesisState{
|
||||
return &types.GenesisState{
|
||||
Params: keeper.GetParams(ctx),
|
||||
LastTotalPower: keeper.GetLastTotalPower(ctx),
|
||||
LastValidatorPowers: lastValidatorPowers,
|
||||
|
@ -199,7 +199,7 @@ func WriteValidators(ctx sdk.Context, keeper keeper.Keeper) (vals []tmtypes.Gene
|
|||
|
||||
// ValidateGenesis validates the provided staking genesis state to ensure the
|
||||
// expected invariants holds. (i.e. params in correct bounds, no duplicate validators)
|
||||
func ValidateGenesis(data types.GenesisState) error {
|
||||
func ValidateGenesis(data *types.GenesisState) error {
|
||||
if err := validateGenesisStateValidators(data.Validators); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ func TestValidateGenesis(t *testing.T) {
|
|||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
genesisState := types.DefaultGenesisState()
|
||||
tt.mutate(&genesisState)
|
||||
tt.mutate(genesisState)
|
||||
if tt.wantErr {
|
||||
assert.Error(t, staking.ValidateGenesis(genesisState))
|
||||
} else {
|
||||
|
|
|
@ -65,7 +65,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, config client.TxE
|
|||
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
|
||||
}
|
||||
|
||||
return ValidateGenesis(data)
|
||||
return ValidateGenesis(&data)
|
||||
}
|
||||
|
||||
// RegisterRESTRoutes registers the REST routes for the staking module.
|
||||
|
@ -141,7 +141,7 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data j
|
|||
|
||||
cdc.MustUnmarshalJSON(data, &genesisState)
|
||||
|
||||
return InitGenesis(ctx, am.keeper, am.accountKeeper, am.bankKeeper, genesisState)
|
||||
return InitGenesis(ctx, am.keeper, am.accountKeeper, am.bankKeeper, &genesisState)
|
||||
}
|
||||
|
||||
// ExportGenesis returns the exported genesis state as raw bytes for the staking
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
)
|
||||
|
||||
// NewGenesisState creates a new GenesisState instanc e
|
||||
func NewGenesisState(params Params, validators []Validator, delegations []Delegation) GenesisState {
|
||||
return GenesisState{
|
||||
func NewGenesisState(params Params, validators []Validator, delegations []Delegation) *GenesisState {
|
||||
return &GenesisState{
|
||||
Params: params,
|
||||
Validators: validators,
|
||||
Delegations: delegations,
|
||||
|
@ -16,20 +16,20 @@ func NewGenesisState(params Params, validators []Validator, delegations []Delega
|
|||
}
|
||||
|
||||
// DefaultGenesisState gets the raw genesis raw message for testing
|
||||
func DefaultGenesisState() GenesisState {
|
||||
return GenesisState{
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
Params: DefaultParams(),
|
||||
}
|
||||
}
|
||||
|
||||
// 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.LegacyAmino, appState map[string]json.RawMessage) *GenesisState {
|
||||
var genesisState GenesisState
|
||||
|
||||
if appState[ModuleName] != nil {
|
||||
cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState)
|
||||
}
|
||||
|
||||
return genesisState
|
||||
return &genesisState
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -38,7 +38,7 @@ var s TestSuite
|
|||
|
||||
func setupTest(height int64, skip map[int64]bool) TestSuite {
|
||||
db := dbm.NewMemDB()
|
||||
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, skip, simapp.DefaultNodeHome, 0)
|
||||
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, skip, simapp.DefaultNodeHome, 0, simapp.MakeEncodingConfig())
|
||||
genesisState := simapp.NewDefaultGenesisState()
|
||||
stateBytes, err := codec.MarshalJSONIndent(app.LegacyAmino(), genesisState)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue