diff --git a/CHANGELOG.md b/CHANGELOG.md index ac29677b4..4882574ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes ### State Machine Breaking Changes * (app) [\#326](https://github.com/certikfoundation/shentu/pull/326) Bump Cosmos SDK to v0.44.3. +* (app) [\#334](https://github.com/certikfoundation/shentu/pull/334) Implement in-store migration from v2.2.0 to v2.3.0. +* (x/gov) [\#334](https://github.com/certikfoundation/shentu/pull/334) `TxHash` field has been removed from `Vote` and `Deposit` types. ### Features * (app) [\#326](https://github.com/certikfoundation/shentu/pull/326) Add `authz` and `feegrant` modules. @@ -55,7 +57,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/shield) [\#326](https://github.com/certikfoundation/shentu/pull/326) Add checks for expired entries in shield purchase. * (x/gov) [\#331](https://github.com/certikfoundation/shentu/pull/331) Fix gov tally logic. -## [v2.1.0] - 08-09-2021 + +## [v2.1.0] - 09-03-2021 Version 2.1.0 re-enables endblocker in the staking module, and bumps SDK to 0.42.9 for necessary query route. diff --git a/app/app.go b/app/app.go index aab9e8017..54a899473 100644 --- a/app/app.go +++ b/app/app.go @@ -212,7 +212,8 @@ type ShentuApp struct { mm *module.Manager // simulation manager - sm *module.SimulationManager + sm *module.SimulationManager + configurator module.Configurator } // NewShentuApp returns a reference to an initialized ShentuApp. @@ -437,10 +438,6 @@ func NewShentuApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest // If evidence needs to be handled for the app, set routes in router here and seal app.evidenceKeeper = *evidenceKeeper - // Add empty upgrade handler to bump to 0.44.0 - cfg := module.NewConfigurator(appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) - app.setUpgradeHandler(cfg) - /**** Module Options ****/ // NOTE: Any module instantiated in the module manager that is @@ -524,7 +521,9 @@ func NewShentuApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest ) app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) - app.mm.RegisterServices(cfg) + + app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) + app.mm.RegisterServices(app.configurator) app.sm = module.NewSimulationManager( auth.NewAppModule(appCodec, app.authKeeper, app.accountKeeper, app.bankKeeper, app.certKeeper, authsims.RandomGenesisAccounts), @@ -552,8 +551,6 @@ func NewShentuApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest app.MountTransientStores(tkeys) app.MountMemoryStores(memKeys) - app.SetInitChainer(app.InitChainer) - app.SetBeginBlocker(app.BeginBlocker) // The AnteHandler handles signature verification and transaction pre-processing anteHandler, err := ante.NewAnteHandler( ante.HandlerOptions{ @@ -568,8 +565,12 @@ func NewShentuApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest tmos.Exit(err.Error()) } app.SetAnteHandler(anteHandler) + app.SetInitChainer(app.InitChainer) + app.SetBeginBlocker(app.BeginBlocker) app.SetEndBlocker(app.EndBlocker) + app.setUpgradeHandler() + if loadLatest { if err := app.LoadLatestVersion(); err != nil { tmos.Exit(err.Error()) diff --git a/app/upgrade_handler.go b/app/upgrade_handler.go index c0366aee8..42e851f2d 100644 --- a/app/upgrade_handler.go +++ b/app/upgrade_handler.go @@ -1,7 +1,60 @@ package app import ( + "fmt" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/authz" + sdkauthz "github.com/cosmos/cosmos-sdk/x/authz" + "github.com/cosmos/cosmos-sdk/x/feegrant" + sdkfeegrant "github.com/cosmos/cosmos-sdk/x/feegrant" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + ibcconnectiontypes "github.com/cosmos/ibc-go/modules/core/03-connection/types" ) -func (app ShentuApp) setUpgradeHandler(cfg module.Configurator) {} +const upgradeName = "Shentu-v230" + +func (app ShentuApp) setUpgradeHandler() { + app.upgradeKeeper.SetUpgradeHandler( + upgradeName, + func(ctx sdk.Context, _ upgradetypes.Plan, _ module.VersionMap) (module.VersionMap, error) { + app.ibcKeeper.ConnectionKeeper.SetParams(ctx, ibcconnectiontypes.DefaultParams()) + + fromVM := make(map[string]uint64) + for moduleName := range app.mm.Modules { + fromVM[moduleName] = 1 + } + // override versions for _new_ modules as to not skip InitGenesis + fromVM[sdkauthz.ModuleName] = 0 + fromVM[sdkfeegrant.ModuleName] = 0 + + temp, err := app.mm.RunMigrations(ctx, app.configurator, fromVM) + + if err != nil { + return temp, err + } + + authVM := make(map[string]uint64) + authVM[authtypes.ModuleName] = 1 + + _, err = app.mm.RunMigrations(ctx, app.configurator, authVM) + return temp, err + }, + ) + + upgradeInfo, err := app.upgradeKeeper.ReadUpgradeInfoFromDisk() + if err != nil { + panic(fmt.Sprintf("failed to read upgrade info from disk %s", err)) + } + + if upgradeInfo.Name == upgradeName && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + storeUpgrades := storetypes.StoreUpgrades{ + Added: []string{authz.ModuleName, feegrant.ModuleName}, + } + + // configure store loader that checks if version == upgradeHeight and applies store upgrades + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) + } +} diff --git a/proto/shentu/gov/v1alpha1/gov.proto b/proto/shentu/gov/v1alpha1/gov.proto index a40d19204..c0d873426 100644 --- a/proto/shentu/gov/v1alpha1/gov.proto +++ b/proto/shentu/gov/v1alpha1/gov.proto @@ -23,9 +23,9 @@ message GenesisState { // starting_proposal_id is the ID of the starting proposal. uint64 starting_proposal_id = 1 [(gogoproto.moretags) = "yaml:\"starting_proposal_id\""]; // deposits defines all the deposits present at genesis. - repeated Deposit deposits = 2 [(gogoproto.castrepeated) = "Deposits", (gogoproto.nullable) = false]; + repeated cosmos.gov.v1beta1.Deposit deposits = 2 [(gogoproto.nullable) = false]; // votes defines all the votes present at genesis. - repeated Vote votes = 3 [(gogoproto.castrepeated) = "Votes", (gogoproto.nullable) = false]; + repeated cosmos.gov.v1beta1.Vote votes = 3 [(gogoproto.nullable) = false]; // proposals defines all the proposals present at genesis. repeated Proposal proposals = 4 [(gogoproto.castrepeated) = "Proposals", (gogoproto.nullable) = false]; // params defines all the paramaters of related to deposit. @@ -36,16 +36,6 @@ message GenesisState { TallyParams tally_params = 7 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"tally_params\""]; } -// Deposit defines an amount deposited by an account address to an active -// proposal. -message Deposit { - option (gogoproto.goproto_getters) = false; - option (gogoproto.equal) = false; - - cosmos.gov.v1beta1.Deposit deposit = 1 [(gogoproto.embed) = true]; - string tx_hash = 2 [ (gogoproto.moretags) = "yaml:\"txhash\"" ]; -} - // DepositParams defines the params for deposits on governance proposals. message DepositParams { // Minimum deposit for a proposal to enter voting period. @@ -129,13 +119,3 @@ enum ProposalStatus { // failed. PROPOSAL_STATUS_FAILED = 6 [(gogoproto.enumvalue_customname) = "StatusFailed"]; } - -// Vote defines a vote on a governance proposal. -// A Vote consists of a proposal ID, the voter, and the vote option. -message Vote { - option (gogoproto.goproto_stringer) = false; - option (gogoproto.equal) = false; - - cosmos.gov.v1beta1.Vote deposit = 1 [(gogoproto.embed) = true]; - string tx_hash = 2 [ (gogoproto.moretags) = "yaml:\"txhash\"" ]; -} diff --git a/proto/shentu/gov/v1alpha1/query.proto b/proto/shentu/gov/v1alpha1/query.proto index 1cb828b30..b7e8c69fb 100644 --- a/proto/shentu/gov/v1alpha1/query.proto +++ b/proto/shentu/gov/v1alpha1/query.proto @@ -105,7 +105,7 @@ message QueryVoteRequest { // QueryVoteResponse is the response type for the Query/Vote RPC method. message QueryVoteResponse { // vote defined the queried vote. - Vote vote = 1 [(gogoproto.nullable) = false]; + cosmos.gov.v1beta1.Vote vote = 1 [(gogoproto.nullable) = false]; } // QueryVotesRequest is the request type for the Query/Votes RPC method. @@ -120,7 +120,7 @@ message QueryVotesRequest { // QueryVotesResponse is the response type for the Query/Votes RPC method. message QueryVotesResponse { // votes defined the queried votes. - repeated Vote votes = 1 [(gogoproto.nullable) = false]; + repeated cosmos.gov.v1beta1.Vote votes = 1 [(gogoproto.nullable) = false]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -158,7 +158,7 @@ message QueryDepositRequest { // QueryDepositResponse is the response type for the Query/Deposit RPC method. message QueryDepositResponse { // deposit defines the requested deposit. - Deposit deposit = 1 [(gogoproto.nullable) = false]; + cosmos.gov.v1beta1.Deposit deposit = 1 [(gogoproto.nullable) = false]; } // QueryDepositsRequest is the request type for the Query/Deposits RPC method. @@ -172,7 +172,7 @@ message QueryDepositsRequest { // QueryDepositsResponse is the response type for the Query/Deposits RPC method. message QueryDepositsResponse { - repeated Deposit deposits = 1 [(gogoproto.nullable) = false]; + repeated cosmos.gov.v1beta1.Deposit deposits = 1 [(gogoproto.nullable) = false]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; diff --git a/simapp/migration_test.go b/simapp/migration_test.go new file mode 100644 index 000000000..aea2f4b16 --- /dev/null +++ b/simapp/migration_test.go @@ -0,0 +1,167 @@ +package simapp + +import ( + "os" + "testing" + + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + dbm "github.com/tendermint/tm-db" + "github.com/test-go/testify/require" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth/vesting" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/capability" + "github.com/cosmos/cosmos-sdk/x/crisis" + "github.com/cosmos/cosmos-sdk/x/evidence" + feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" + "github.com/cosmos/cosmos-sdk/x/genutil" + sdkparams "github.com/cosmos/cosmos-sdk/x/params" + "github.com/cosmos/cosmos-sdk/x/upgrade" + "github.com/cosmos/ibc-go/modules/apps/transfer" + + "github.com/certikfoundation/shentu/v2/x/auth" + "github.com/certikfoundation/shentu/v2/x/cert" + "github.com/certikfoundation/shentu/v2/x/cvm" + "github.com/certikfoundation/shentu/v2/x/distribution" + "github.com/certikfoundation/shentu/v2/x/gov" + "github.com/certikfoundation/shentu/v2/x/mint" + "github.com/certikfoundation/shentu/v2/x/oracle" + "github.com/certikfoundation/shentu/v2/x/shield" + "github.com/certikfoundation/shentu/v2/x/slashing" + "github.com/certikfoundation/shentu/v2/x/staking" +) + +func TestRunMigrations(t *testing.T) { + db := dbm.NewMemDB() + encCfg := MakeTestEncodingConfig() + logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)) + app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encCfg, simapp.EmptyAppOptions{}) + + // Create a new baseapp and configurator for the purpose of this test. + bApp := baseapp.NewBaseApp(appName, logger, db, encCfg.TxConfig.TxDecoder()) + bApp.SetCommitMultiStoreTracer(nil) + bApp.SetInterfaceRegistry(encCfg.InterfaceRegistry) + app.BaseApp = bApp + app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) + + // We register all modules on the Configurator, except x/bank. x/bank will + // serve as the test subject on which we run the migration tests. + // + // The loop below is the same as calling `RegisterServices` on + // ModuleManager, except that we skip x/bank. + for _, module := range app.mm.Modules { + if module.Name() == banktypes.ModuleName { + continue + } + + module.RegisterServices(app.configurator) + } + + // Initialize the chain + app.InitChain(abci.RequestInitChain{}) + app.Commit() + + testCases := []struct { + name string + moduleName string + forVersion uint64 + expRegErr bool // errors while registering migration + expRegErrMsg string + expRunErr bool // errors while running migration + expRunErrMsg string + expCalled int + }{ + { + "cannot register migration for version 0", + "bank", 0, + true, "module migration versions should start at 1: invalid version", false, "", 0, + }, + { + "throws error on RunMigrations if no migration registered for bank", + "", 1, + false, "", true, "no migrations found for module bank: not found", 0, + }, + { + "can register and run migration handler for x/bank", + "bank", 1, + false, "", false, "", 1, + }, + { + "cannot register migration handler for same module & forVersion", + "bank", 1, + true, "another migration for module bank and version 1 already exists: internal logic error", false, "", 0, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + var err error + + // Since it's very hard to test actual in-place store migrations in + // tests (due to the difficulty of maintaining multiple versions of a + // module), we're just testing here that the migration logic is + // called. + called := 0 + + if tc.moduleName != "" { + // Register migration for module from version `forVersion` to `forVersion+1`. + err = app.configurator.RegisterMigration(tc.moduleName, tc.forVersion, func(sdk.Context) error { + called++ + + return nil + }) + + if tc.expRegErr { + require.EqualError(t, err, tc.expRegErrMsg) + + return + } + } + require.NoError(t, err) + + // Run migrations only for bank. That's why we put the initial + // version for bank as 1, and for all other modules, we put as + // their latest ConsensusVersion. + _, err = app.mm.RunMigrations( + app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}), app.configurator, + module.VersionMap{ + "bank": 1, + "cert": cert.AppModule{}.ConsensusVersion(), + "cvm": cvm.AppModule{}.ConsensusVersion(), + "oracle": oracle.AppModule{}.ConsensusVersion(), + "shield": shield.AppModule{}.ConsensusVersion(), + "auth": auth.AppModule{}.ConsensusVersion(), + "authz": authzmodule.AppModule{}.ConsensusVersion(), + "staking": staking.AppModule{}.ConsensusVersion(), + "mint": mint.AppModule{}.ConsensusVersion(), + "distribution": distribution.AppModule{}.ConsensusVersion(), + "slashing": slashing.AppModule{}.ConsensusVersion(), + "gov": gov.AppModule{}.ConsensusVersion(), + "params": sdkparams.AppModule{}.ConsensusVersion(), + "upgrade": upgrade.AppModule{}.ConsensusVersion(), + "vesting": vesting.AppModule{}.ConsensusVersion(), + "feegrant": feegrantmodule.AppModule{}.ConsensusVersion(), + "evidence": evidence.AppModule{}.ConsensusVersion(), + "crisis": crisis.AppModule{}.ConsensusVersion(), + "genutil": genutil.AppModule{}.ConsensusVersion(), + "capability": capability.AppModule{}.ConsensusVersion(), + "transfer": transfer.AppModule{}.ConsensusVersion(), + }, + ) + if tc.expRunErr { + require.EqualError(t, err, tc.expRunErrMsg) + } else { + require.NoError(t, err) + // Make sure bank's migration is called. + require.Equal(t, tc.expCalled, called) + } + }) + } +} diff --git a/simapp/simapp.go b/simapp/simapp.go index 5bad063e0..7d6ab52f5 100644 --- a/simapp/simapp.go +++ b/simapp/simapp.go @@ -227,6 +227,9 @@ type SimApp struct { // simulation manager sm *module.SimulationManager + + // module configurator + configurator module.Configurator } // NewSimApp returns a reference to an initialized SimApp. @@ -460,7 +463,6 @@ func NewSimApp( // If evidence needs to be handled for the app, set routes in router here and seal app.EvidenceKeeper = *evidenceKeeper - cfg := module.NewConfigurator(appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) /**** Module Options ****/ // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment @@ -545,7 +547,8 @@ func NewSimApp( app.mm.RegisterInvariants(&app.CrisisKeeper) app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) - app.mm.RegisterServices(cfg) + app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) + app.mm.RegisterServices(app.configurator) app.sm = module.NewSimulationManager( auth.NewAppModule(appCodec, app.AuthKeeper, app.AccountKeeper, app.BankKeeper, app.CertKeeper, authsims.RandomGenesisAccounts), diff --git a/x/auth/keeper/migrations.go b/x/auth/keeper/migrations.go new file mode 100644 index 000000000..8dbb39a0c --- /dev/null +++ b/x/auth/keeper/migrations.go @@ -0,0 +1,64 @@ +package keeper + +import ( + "github.com/gogo/protobuf/grpc" + "math" + + sdk "github.com/cosmos/cosmos-sdk/types" + v043 "github.com/cosmos/cosmos-sdk/x/auth/legacy/v043" + sdktypes "github.com/cosmos/cosmos-sdk/x/auth/types" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + + "github.com/certikfoundation/shentu/v2/x/auth/types" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + keeper types.AccountKeeper + queryServer grpc.Server +} + +// NewMigrator returns a new Migrator. +func NewMigrator(keeper Keeper, queryServer grpc.Server) Migrator { + return Migrator{keeper: keeper.ak, queryServer: queryServer} +} + +// Migrate1to2 migrates from version 1 to 2. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + var iterErr error + + m.keeper.IterateAccounts(ctx, func(account sdktypes.AccountI) (stop bool) { + mvacc, ok := account.(*types.ManualVestingAccount) + if !ok { + return false + } + + dvAcc := vestingtypes.NewDelayedVestingAccount( + mvacc.BaseAccount, mvacc.OriginalVesting, math.MaxInt64) + + wb, err := v043.MigrateAccount(ctx, dvAcc, m.queryServer) + if err != nil { + iterErr = err + return true + } + + if wb == nil { + return false + } + + dvAcc, ok = account.(*vestingtypes.DelayedVestingAccount) + if !ok { + return false + } + unlocker, err := sdk.AccAddressFromBech32(mvacc.Unlocker) + if err != nil { + panic(err) + } + newmvacc := types.NewManualVestingAccount(dvAcc.BaseAccount, dvAcc.OriginalVesting, dvAcc.OriginalVesting, unlocker) + + m.keeper.SetAccount(ctx, newmvacc) + return false + }) + + return iterErr +} diff --git a/x/auth/module.go b/x/auth/module.go index 3ebcdb996..f88e820e4 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -137,6 +137,12 @@ func (am AppModule) LegacyQuerierHandler(cdc *codec.LegacyAmino) sdk.Querier { func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) authtypes.RegisterQueryServer(cfg.QueryServer(), am.authKeeper) + + m := keeper.NewMigrator(am.keeper, cfg.QueryServer()) + err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) + if err != nil { + panic(err) + } } // InitGenesis performs genesis initialization for the auth module. It returns no validator updates. @@ -150,7 +156,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (am AppModule) ConsensusVersion() uint64 { return am.cosmosAppModule.ConsensusVersion() } // BeginBlock returns the begin blocker for the auth module. func (am AppModule) BeginBlock(ctx sdk.Context, rbb abci.RequestBeginBlock) { diff --git a/x/auth/types/expected_keepers.go b/x/auth/types/expected_keepers.go index 5fb596797..724d8cade 100644 --- a/x/auth/types/expected_keepers.go +++ b/x/auth/types/expected_keepers.go @@ -16,4 +16,6 @@ type CertKeeper interface { type AccountKeeper interface { GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI SetAccount(ctx sdk.Context, acc types.AccountI) + + IterateAccounts(ctx sdk.Context, cb func(account types.AccountI) (stop bool)) } diff --git a/x/bank/module.go b/x/bank/module.go index 49bf081b8..1adb2117b 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -20,6 +20,7 @@ import ( sdkbank "github.com/cosmos/cosmos-sdk/x/bank" bankcli "github.com/cosmos/cosmos-sdk/x/bank/client/cli" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + v040 "github.com/cosmos/cosmos-sdk/x/bank/legacy/v040" banksim "github.com/cosmos/cosmos-sdk/x/bank/simulation" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -88,6 +89,9 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { types.RegisterInterfaces(registry) banktypes.RegisterInterfaces(registry) + + // Register legacy interfaces for migration scripts. + v040.RegisterInterfaces(registry) } // ___________________________ @@ -150,7 +154,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (am AppModule) ConsensusVersion() uint64 { return am.cosmosAppModule.ConsensusVersion() } // BeginBlock returns the begin blocker for the bank module. func (am AppModule) BeginBlock(ctx sdk.Context, rbb abci.RequestBeginBlock) { diff --git a/x/crisis/module.go b/x/crisis/module.go index 30e4327ee..23f2d387c 100644 --- a/x/crisis/module.go +++ b/x/crisis/module.go @@ -160,7 +160,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (am AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock performs a no-op. func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/distribution/module.go b/x/distribution/module.go index 06013aee0..4a8aeba85 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -141,7 +141,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (am AppModule) ConsensusVersion() uint64 { return am.cosmosAppModule.ConsensusVersion() } // BeginBlock implements the Cosmos SDK BeginBlock module function. func (am AppModule) BeginBlock(ctx sdk.Context, rbb abci.RequestBeginBlock) { diff --git a/x/gov/client/cli/query.go b/x/gov/client/cli/query.go index ac83f4347..fc55a3b12 100644 --- a/x/gov/client/cli/query.go +++ b/x/gov/client/cli/query.go @@ -14,7 +14,7 @@ import ( "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" govUtils "github.com/cosmos/cosmos-sdk/x/gov/client/utils" - govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/certikfoundation/shentu/v2/x/gov/types" ) @@ -23,7 +23,7 @@ import ( func GetQueryCmd() *cobra.Command { // Group gov queries under a subcommand govQueryCmd := &cobra.Command{ - Use: govTypes.ModuleName, + Use: govtypes.ModuleName, Short: "Querying commands for the governance module", DisableFlagParsing: true, SuggestionsMinimumDistance: 2, @@ -222,13 +222,13 @@ $ %[1]s query gov votes 1 --page=2 --limit=100 page, _ := cmd.Flags().GetInt(flags.FlagPage) limit, _ := cmd.Flags().GetInt(flags.FlagLimit) - params := govTypes.NewQueryProposalVotesParams(proposalID, page, limit) + params := govtypes.NewQueryProposalVotesParams(proposalID, page, limit) resByTxQuery, err := govUtils.QueryVotesByTxQuery(cliCtx, params) if err != nil { return err } - var votes types.Votes + var votes govtypes.Votes // TODO migrate to use JSONCodec (implement MarshalJSONArray // or wrap lists of proto.Message in some other message) cliCtx.LegacyAmino.MustUnmarshalJSON(resByTxQuery, &votes) @@ -299,13 +299,13 @@ $ %[1]s query gov deposits 1 propStatus := proposalRes.GetProposal().Status if !(propStatus == types.StatusCertifierVotingPeriod || propStatus == types.StatusValidatorVotingPeriod || propStatus == types.StatusDepositPeriod) { - params := govTypes.NewQueryProposalParams(proposalID) + params := govtypes.NewQueryProposalParams(proposalID) resByTxQuery, err := govUtils.QueryDepositsByTxQuery(cliCtx, params) if err != nil { return err } - var dep types.Deposits + var dep govtypes.Deposits // TODO migrate to use JSONCodec (implement MarshalJSONArray // or wrap lists of proto.Message in some other message) cliCtx.LegacyAmino.MustUnmarshalJSON(resByTxQuery, &dep) diff --git a/x/gov/client/rest/query.go b/x/gov/client/rest/query.go index 472070672..981d92074 100644 --- a/x/gov/client/rest/query.go +++ b/x/gov/client/rest/query.go @@ -11,7 +11,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/rest" govUtils "github.com/cosmos/cosmos-sdk/x/gov/client/utils" - govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/certikfoundation/shentu/v2/x/gov/client/utils" @@ -40,7 +40,7 @@ func queryParamsHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - route := fmt.Sprintf("custom/%s/%s/%s", govTypes.QuerierRoute, govTypes.QueryParams, paramType) + route := fmt.Sprintf("custom/%s/%s/%s", govtypes.QuerierRoute, govtypes.QueryParams, paramType) res, height, err := cliCtx.QueryWithData(route, nil) if err != nil { rest.WriteErrorResponse(w, http.StatusNotFound, err.Error()) @@ -73,7 +73,7 @@ func queryProposalHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - params := govTypes.NewQueryProposalParams(proposalID) + params := govtypes.NewQueryProposalParams(proposalID) bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if err != nil { @@ -81,7 +81,7 @@ func queryProposalHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - route := fmt.Sprintf("custom/%s/%s", govTypes.QuerierRoute, govTypes.QueryProposal) + route := fmt.Sprintf("custom/%s/%s", govtypes.QuerierRoute, govtypes.QueryProposal) res, height, err := cliCtx.QueryWithData(route, bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) @@ -108,7 +108,7 @@ func queryDepositsHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - params := govTypes.NewQueryProposalParams(proposalID) + params := govtypes.NewQueryProposalParams(proposalID) bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if err != nil { @@ -163,7 +163,7 @@ func queryProposerHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - res, err := utils.QueryProposerByTxQuery(cliCtx, proposalID, govTypes.StoreKey) + res, err := utils.QueryProposerByTxQuery(cliCtx, proposalID, govtypes.StoreKey) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return @@ -207,7 +207,7 @@ func queryDepositHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - params := govTypes.NewQueryDepositParams(proposalID, depositorAddr) + params := govtypes.NewQueryDepositParams(proposalID, depositorAddr) bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if err != nil { @@ -221,7 +221,7 @@ func queryDepositHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - var deposit types.Deposit + var deposit govtypes.Deposit if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &deposit); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return @@ -231,7 +231,7 @@ func queryDepositHandlerFn(cliCtx client.Context) http.HandlerFunc { // which case the deposit would be removed from state and should be queried // for directly via a txs query. if deposit.Empty() { - bz, err := cliCtx.LegacyAmino.MarshalJSON(govTypes.NewQueryProposalParams(proposalID)) + bz, err := cliCtx.LegacyAmino.MarshalJSON(govtypes.NewQueryProposalParams(proposalID)) if err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return @@ -289,7 +289,7 @@ func queryVoteHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - params := govTypes.NewQueryVoteParams(proposalID, voterAddr) + params := govtypes.NewQueryVoteParams(proposalID, voterAddr) bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if err != nil { @@ -303,7 +303,7 @@ func queryVoteHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - var vote types.Vote + var vote govtypes.Vote if err := cliCtx.LegacyAmino.UnmarshalJSON(res, &vote); err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return @@ -313,7 +313,7 @@ func queryVoteHandlerFn(cliCtx client.Context) http.HandlerFunc { // which case the vote would be removed from state and should be queried for // directly via a txs query. if vote.Empty() { - bz, err := cliCtx.LegacyAmino.MarshalJSON(govTypes.NewQueryProposalParams(proposalID)) + bz, err := cliCtx.LegacyAmino.MarshalJSON(govtypes.NewQueryProposalParams(proposalID)) if err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return @@ -365,7 +365,7 @@ func queryVotesOnProposalHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - params := govTypes.NewQueryProposalVotesParams(proposalID, page, limit) + params := govtypes.NewQueryProposalVotesParams(proposalID, page, limit) bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if err != nil { @@ -408,7 +408,7 @@ func queryVotesOnProposalHandlerFn(cliCtx client.Context) http.HandlerFunc { } func getVotesWithPower(cliCtx client.Context, w http.ResponseWriter, res []byte) (VotesWithPower, http.ResponseWriter) { - votes := types.Votes{} + votes := govtypes.Votes{} err := cliCtx.LegacyAmino.UnmarshalJSON(res, &votes) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) @@ -505,7 +505,7 @@ func queryProposalsWithParameterFn(cliCtx client.Context) http.HandlerFunc { return } - route := fmt.Sprintf("custom/%s/%s", govTypes.QuerierRoute, govTypes.QueryProposals) + route := fmt.Sprintf("custom/%s/%s", govtypes.QuerierRoute, govtypes.QueryProposals) res, height, err := cliCtx.QueryWithData(route, bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) @@ -539,14 +539,14 @@ func queryTallyOnProposalHandlerFn(cliCtx client.Context) http.HandlerFunc { return } - params := govTypes.NewQueryProposalParams(proposalID) + params := govtypes.NewQueryProposalParams(proposalID) bz, err := cliCtx.LegacyAmino.MarshalJSON(params) if err != nil { rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) return } - route := fmt.Sprintf("custom/%s/%s", govTypes.QuerierRoute, govTypes.QueryTally) + route := fmt.Sprintf("custom/%s/%s", govtypes.QuerierRoute, govtypes.QueryTally) res, height, err := cliCtx.QueryWithData(route, bz) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) diff --git a/x/gov/client/rest/rest.go b/x/gov/client/rest/rest.go index d4788cc74..6247d617f 100644 --- a/x/gov/client/rest/rest.go +++ b/x/gov/client/rest/rest.go @@ -9,8 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" govRest "github.com/cosmos/cosmos-sdk/x/gov/client/rest" - - "github.com/certikfoundation/shentu/v2/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) // REST Variable names @@ -36,7 +35,7 @@ func RegisterRoutes(cliCtx client.Context, r *mux.Router, phs []govRest.Proposal } type VoteWithPower struct { - types.Vote + govtypes.Vote VotingPower sdk.Dec `json:"voting_power" yaml:"voting_power"` } diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index bd53d7392..2a44af788 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -1,22 +1,20 @@ package keeper import ( - "encoding/hex" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/tendermint/tendermint/crypto/tmhash" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/certikfoundation/shentu/v2/x/gov/types" shieldtypes "github.com/certikfoundation/shentu/v2/x/shield/types" ) // GetDeposit gets the deposit of a specific depositor on a specific proposal. -func (k Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit types.Deposit, found bool) { +func (k Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit govtypes.Deposit, found bool) { store := ctx.KVStore(k.storeKey) - bz := store.Get(govTypes.DepositKey(proposalID, depositorAddr)) + bz := store.Get(govtypes.DepositKey(proposalID, depositorAddr)) if bz == nil { return deposit, false } @@ -26,14 +24,14 @@ func (k Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk } // SetDeposit sets the deposit to KVStore. -func (k Keeper) SetDeposit(ctx sdk.Context, deposit types.Deposit) { +func (k Keeper) SetDeposit(ctx sdk.Context, deposit govtypes.Deposit) { store := ctx.KVStore(k.storeKey) bz := k.cdc.MustMarshal(&deposit) depositor, err := sdk.AccAddressFromBech32(deposit.Depositor) if err != nil { panic(err) } - store.Set(govTypes.DepositKey(deposit.ProposalId, depositor), bz) + store.Set(govtypes.DepositKey(deposit.ProposalId, depositor), bz) } // AddDeposit adds or updates a deposit of a specific depositor on a specific proposal. @@ -43,15 +41,15 @@ func (k Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk // checks to see if proposal exists proposal, ok := k.GetProposal(ctx, proposalID) if !ok { - return false, sdkerrors.Wrap(govTypes.ErrUnknownProposal, fmt.Sprint(proposalID)) + return false, sdkerrors.Wrap(govtypes.ErrUnknownProposal, fmt.Sprint(proposalID)) } // check if proposal is still depositable or if proposer is council member if (proposal.Status != types.StatusDepositPeriod) || proposal.IsProposerCouncilMember { - return false, sdkerrors.Wrap(govTypes.ErrAlreadyActiveProposal, fmt.Sprint(proposalID)) + return false, sdkerrors.Wrap(govtypes.ErrAlreadyActiveProposal, fmt.Sprint(proposalID)) } // update the governance module's account coins pool - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, depositorAddr, govTypes.ModuleName, depositAmount) + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, depositorAddr, govtypes.ModuleName, depositAmount) if err != nil { return false, err } @@ -69,9 +67,9 @@ func (k Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk ctx.EventManager().EmitEvent( sdk.NewEvent( - govTypes.EventTypeProposalDeposit, + govtypes.EventTypeProposalDeposit, sdk.NewAttribute(sdk.AttributeKeyAmount, depositAmount.String()), - sdk.NewAttribute(govTypes.AttributeKeyProposalID, fmt.Sprintf("%d", proposalID)), + sdk.NewAttribute(govtypes.AttributeKeyProposalID, fmt.Sprintf("%d", proposalID)), sdk.NewAttribute(types.AttributeKeyDepositor, depositorAddr.String()), ), ) @@ -88,15 +86,15 @@ func (k Keeper) upsertDeposit(ctx sdk.Context, proposalID uint64, depositorAddr if found { deposit.Amount = deposit.Amount.Add(depositAmount...) } else { - deposit = types.NewDeposit(proposalID, depositorAddr, depositAmount, hex.EncodeToString(tmhash.Sum(ctx.TxBytes()))) + deposit = govtypes.NewDeposit(proposalID, depositorAddr, depositAmount) } k.SetDeposit(ctx, deposit) } // GetAllDeposits returns all the deposits from the store. -func (k Keeper) GetAllDeposits(ctx sdk.Context) (deposits types.Deposits) { - k.IterateAllDeposits(ctx, func(deposit types.Deposit) bool { +func (k Keeper) GetAllDeposits(ctx sdk.Context) (deposits govtypes.Deposits) { + k.IterateAllDeposits(ctx, func(deposit govtypes.Deposit) bool { deposits = append(deposits, deposit) return false }) @@ -104,8 +102,8 @@ func (k Keeper) GetAllDeposits(ctx sdk.Context) (deposits types.Deposits) { } // GetDepositsByProposalID returns all the deposits from a proposal. -func (k Keeper) GetDepositsByProposalID(ctx sdk.Context, proposalID uint64) (deposits types.Deposits) { - k.IterateDeposits(ctx, proposalID, func(deposit types.Deposit) bool { +func (k Keeper) GetDepositsByProposalID(ctx sdk.Context, proposalID uint64) (deposits govtypes.Deposits) { + k.IterateDeposits(ctx, proposalID, func(deposit govtypes.Deposit) bool { deposits = append(deposits, deposit) return false }) @@ -115,25 +113,25 @@ func (k Keeper) GetDepositsByProposalID(ctx sdk.Context, proposalID uint64) (dep // GetDepositsIteratorByProposalID gets all the deposits on a specific proposal as an sdk.Iterator. func (k Keeper) GetDepositsIteratorByProposalID(ctx sdk.Context, proposalID uint64) sdk.Iterator { store := ctx.KVStore(k.storeKey) - return sdk.KVStorePrefixIterator(store, govTypes.DepositsKey(proposalID)) + return sdk.KVStorePrefixIterator(store, govtypes.DepositsKey(proposalID)) } // RefundDepositsByProposalID refunds and deletes all the deposits on a specific proposal. func (k Keeper) RefundDepositsByProposalID(ctx sdk.Context, proposalID uint64) { store := ctx.KVStore(k.storeKey) - k.IterateDeposits(ctx, proposalID, func(deposit types.Deposit) bool { + k.IterateDeposits(ctx, proposalID, func(deposit govtypes.Deposit) bool { depositor, err := sdk.AccAddressFromBech32(deposit.Depositor) if err != nil { panic(err) } - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, govTypes.ModuleName, depositor, deposit.Amount) + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, govtypes.ModuleName, depositor, deposit.Amount) if err != nil { panic(err) } - store.Delete(govTypes.DepositKey(proposalID, depositor)) + store.Delete(govtypes.DepositKey(proposalID, depositor)) return false }) } @@ -142,8 +140,8 @@ func (k Keeper) RefundDepositsByProposalID(ctx sdk.Context, proposalID uint64) { func (k Keeper) DeleteDepositsByProposalID(ctx sdk.Context, proposalID uint64) { store := ctx.KVStore(k.storeKey) - k.IterateDeposits(ctx, proposalID, func(deposit types.Deposit) bool { - err := k.bankKeeper.BurnCoins(ctx, govTypes.ModuleName, deposit.Amount) + k.IterateDeposits(ctx, proposalID, func(deposit govtypes.Deposit) bool { + err := k.bankKeeper.BurnCoins(ctx, govtypes.ModuleName, deposit.Amount) if err != nil { panic(err) } @@ -153,14 +151,14 @@ func (k Keeper) DeleteDepositsByProposalID(ctx sdk.Context, proposalID uint64) { panic(err) } - store.Delete(govTypes.DepositKey(proposalID, depositor)) + store.Delete(govtypes.DepositKey(proposalID, depositor)) return false }) } // GetDeposits returns all the deposits from a proposal. -func (k Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits types.Deposits) { - k.IterateDeposits(ctx, proposalID, func(deposit types.Deposit) bool { +func (k Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits govtypes.Deposits) { + k.IterateDeposits(ctx, proposalID, func(deposit govtypes.Deposit) bool { deposits = append(deposits, deposit) return false }) @@ -168,12 +166,12 @@ func (k Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits types. } // IterateDeposits iterates over the all the proposals deposits and performs a callback function. -func (k Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func(deposit types.Deposit) (stop bool)) { +func (k Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func(deposit govtypes.Deposit) (stop bool)) { iterator := k.GetDepositsIteratorByProposalID(ctx, proposalID) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var deposit types.Deposit + var deposit govtypes.Deposit k.cdc.MustUnmarshal(iterator.Value(), &deposit) if cb(deposit) { diff --git a/x/gov/keeper/grpc_query.go b/x/gov/keeper/grpc_query.go index 03ee4405e..44da7d60e 100644 --- a/x/gov/keeper/grpc_query.go +++ b/x/gov/keeper/grpc_query.go @@ -133,14 +133,14 @@ func (q Keeper) Votes(c context.Context, req *types.QueryVotesRequest) (*types.Q return nil, status.Error(codes.InvalidArgument, "proposal id can not be 0") } - var votes types.Votes + var votes govtypes.Votes ctx := sdk.UnwrapSDKContext(c) store := ctx.KVStore(q.storeKey) votesStore := prefix.NewStore(store, govtypes.VotesKey(req.ProposalId)) pageRes, err := query.Paginate(votesStore, req.Pagination, func(key []byte, value []byte) error { - var vote types.Vote + var vote govtypes.Vote if err := q.cdc.Unmarshal(value, &vote); err != nil { return err } @@ -222,14 +222,14 @@ func (q Keeper) Deposits(c context.Context, req *types.QueryDepositsRequest) (*t return nil, status.Error(codes.InvalidArgument, "proposal id can not be 0") } - var deposits types.Deposits + var deposits govtypes.Deposits ctx := sdk.UnwrapSDKContext(c) store := ctx.KVStore(q.storeKey) depositStore := prefix.NewStore(store, govtypes.DepositsKey(req.ProposalId)) pageRes, err := query.Paginate(depositStore, req.Pagination, func(key []byte, value []byte) error { - var deposit types.Deposit + var deposit govtypes.Deposit if err := q.cdc.Unmarshal(value, &deposit); err != nil { return err } diff --git a/x/gov/keeper/keeper.go b/x/gov/keeper/keeper.go index 0e0c28160..ba739e718 100644 --- a/x/gov/keeper/keeper.go +++ b/x/gov/keeper/keeper.go @@ -107,13 +107,13 @@ func (k Keeper) IterateInactiveProposalsQueue(ctx sdk.Context, endTime time.Time } // IterateAllDeposits iterates over the all the stored deposits and performs a callback function. -func (k Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit types.Deposit) (stop bool)) { +func (k Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit govtypes.Deposit) (stop bool)) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, govtypes.DepositsKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var deposit types.Deposit + var deposit govtypes.Deposit k.cdc.MustUnmarshal(iterator.Value(), &deposit) if cb(deposit) { diff --git a/x/gov/keeper/keeper_test.go b/x/gov/keeper/keeper_test.go index cde78f308..3228f418b 100644 --- a/x/gov/keeper/keeper_test.go +++ b/x/gov/keeper/keeper_test.go @@ -17,7 +17,6 @@ import ( "github.com/certikfoundation/shentu/v2/simapp" . "github.com/certikfoundation/shentu/v2/x/gov/keeper" - "github.com/certikfoundation/shentu/v2/x/gov/types" ) func TestKeeper_ProposeAndVote(t *testing.T) { @@ -224,7 +223,7 @@ func TestKeeper_DepositOperation(t *testing.T) { app.GovKeeper.RefundDepositsByProposalID(ctx, pp.ProposalId) depositsRemaining := app.GovKeeper.GetAllDeposits(ctx) - require.Equal(t, types.Deposits(nil), depositsRemaining) + require.Equal(t, govtypes.Deposits(nil), depositsRemaining) addr1Amount = app.BankKeeper.GetAllBalances(ctx, addrs[1]) addr2Amount = app.BankKeeper.GetAllBalances(ctx, addrs[2]) addr3Amount = app.BankKeeper.GetAllBalances(ctx, addrs[3]) @@ -254,7 +253,7 @@ func TestKeeper_DepositOperation(t *testing.T) { app.GovKeeper.DeleteDepositsByProposalID(ctx, pp.ProposalId) depositsRemaining := app.GovKeeper.GetAllDeposits(ctx) - require.Equal(t, types.Deposits(nil), depositsRemaining) + require.Equal(t, govtypes.Deposits(nil), depositsRemaining) addr1Amount = app.BankKeeper.GetAllBalances(ctx, addrs[1]) addr2Amount = app.BankKeeper.GetAllBalances(ctx, addrs[2]) diff --git a/x/gov/keeper/migrations.go b/x/gov/keeper/migrations.go new file mode 100644 index 000000000..f7e62c807 --- /dev/null +++ b/x/gov/keeper/migrations.go @@ -0,0 +1,28 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + v043 "github.com/cosmos/cosmos-sdk/x/gov/legacy/v043" + + v220 "github.com/certikfoundation/shentu/v2/x/gov/legacy/v220" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + keeper Keeper +} + +// NewMigrator returns a new Migrator. +func NewMigrator(keeper Keeper) Migrator { + return Migrator{keeper: keeper} +} + +// Migrate1to2 migrates from version 1 to 2. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + err := v220.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) + if err != nil { + return err + } + + return v043.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) +} diff --git a/x/gov/keeper/querier.go b/x/gov/keeper/querier.go index 3c1d799e7..070ddd606 100644 --- a/x/gov/keeper/querier.go +++ b/x/gov/keeper/querier.go @@ -135,7 +135,7 @@ func queryDeposits(ctx sdk.Context, req abci.RequestQuery, keeper Keeper, legacy deposits := keeper.GetDeposits(ctx, params.ProposalID) if deposits == nil { - deposits = types.Deposits{} + deposits = govtypes.Deposits{} } bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, deposits) diff --git a/x/gov/keeper/tally.go b/x/gov/keeper/tally.go index 3ea2b5a7e..668cb405b 100644 --- a/x/gov/keeper/tally.go +++ b/x/gov/keeper/tally.go @@ -28,7 +28,7 @@ func Tally(ctx sdk.Context, k Keeper, proposal types.Proposal) (pass bool, veto fetchBondedValidators(ctx, k, currValidators) - k.IterateVotes(ctx, proposal.ProposalId, func(vote types.Vote) bool { + k.IterateVotes(ctx, proposal.ProposalId, func(vote govtypes.Vote) bool { voter, err := sdk.AccAddressFromBech32(vote.Voter) if err != nil { panic(err) @@ -130,7 +130,7 @@ func fetchBondedValidators(ctx sdk.Context, k Keeper, validators map[string]*val }) } -func delegatorVoting(ctx sdk.Context, k Keeper, vote types.Vote, validators map[string]*validatorGovInfo, results map[govtypes.VoteOption]sdk.Dec, totalVotingPower *sdk.Dec) { +func delegatorVoting(ctx sdk.Context, k Keeper, vote govtypes.Vote, validators map[string]*validatorGovInfo, results map[govtypes.VoteOption]sdk.Dec, totalVotingPower *sdk.Dec) { voter, err := sdk.AccAddressFromBech32(vote.Voter) if err != nil { panic(err) diff --git a/x/gov/keeper/vote.go b/x/gov/keeper/vote.go index faa6099b3..3ec03e557 100644 --- a/x/gov/keeper/vote.go +++ b/x/gov/keeper/vote.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/tendermint/tendermint/crypto/tmhash" "github.com/certikfoundation/shentu/v2/x/gov/types" @@ -14,49 +14,49 @@ import ( ) // AddVote Adds a vote on a specific proposal. -func (k Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, options govTypes.WeightedVoteOptions) error { +func (k Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, options govtypes.WeightedVoteOptions) error { proposal, ok := k.GetProposal(ctx, proposalID) if !ok { - return sdkerrors.Wrapf(govTypes.ErrUnknownProposal, "%v", proposalID) + return sdkerrors.Wrapf(govtypes.ErrUnknownProposal, "%v", proposalID) } if proposal.Status != types.StatusCertifierVotingPeriod && proposal.Status != types.StatusValidatorVotingPeriod { - return sdkerrors.Wrapf(govTypes.ErrInactiveProposal, "%v", proposalID) + return sdkerrors.Wrapf(govtypes.ErrInactiveProposal, "%v", proposalID) } for _, option := range options { - if !govTypes.ValidWeightedVoteOption(option) { - return sdkerrors.Wrapf(govTypes.ErrInvalidVote, "%s", option) + if !govtypes.ValidWeightedVoteOption(option) { + return sdkerrors.Wrapf(govtypes.ErrInvalidVote, "%s", option) } if proposal.Status == types.StatusCertifierVotingPeriod { - if !(option.Option == govTypes.OptionYes || - option.Option == govTypes.OptionNo) { - return sdkerrors.Wrapf(govTypes.ErrInvalidVote, + if !(option.Option == govtypes.OptionYes || + option.Option == govtypes.OptionNo) { + return sdkerrors.Wrapf(govtypes.ErrInvalidVote, "'%s' is not valid option in certifier voting; must be 'yes' or 'no'", option.Option) } } } if proposal.Status == types.StatusCertifierVotingPeriod && !k.IsCertifier(ctx, voterAddr) { - return sdkerrors.Wrapf(govTypes.ErrInvalidVote, "'%s' is not a certifier.", voterAddr) + return sdkerrors.Wrapf(govtypes.ErrInvalidVote, "'%s' is not a certifier.", voterAddr) } if proposal.GetContent().ProposalType() == shieldtypes.ProposalTypeShieldClaim && proposal.Status == types.StatusValidatorVotingPeriod && !k.IsCertifiedIdentity(ctx, voterAddr) { - return sdkerrors.Wrapf(govTypes.ErrInvalidVote, "'%s' is not a certified identity", voterAddr) + return sdkerrors.Wrapf(govtypes.ErrInvalidVote, "'%s' is not a certified identity", voterAddr) } txhash := hex.EncodeToString(tmhash.Sum(ctx.TxBytes())) - vote := types.NewVote(proposalID, voterAddr, options, txhash) + vote := govtypes.NewVote(proposalID, voterAddr, options) k.setVote(ctx, vote) ctx.EventManager().EmitEvent( sdk.NewEvent( - govTypes.EventTypeProposalVote, - sdk.NewAttribute(govTypes.AttributeKeyOption, options.String()), - sdk.NewAttribute(govTypes.AttributeKeyProposalID, fmt.Sprintf("%d", proposalID)), + govtypes.EventTypeProposalVote, + sdk.NewAttribute(govtypes.AttributeKeyOption, options.String()), + sdk.NewAttribute(govtypes.AttributeKeyProposalID, fmt.Sprintf("%d", proposalID)), sdk.NewAttribute(types.AttributeKeyVoter, voterAddr.String()), sdk.NewAttribute(types.AttributeTxHash, txhash), ), @@ -66,8 +66,8 @@ func (k Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAdd } // GetAllVotes returns all the votes from the store. -func (k Keeper) GetAllVotes(ctx sdk.Context) (votes types.Votes) { - k.IterateAllVotes(ctx, func(vote types.Vote) bool { +func (k Keeper) GetAllVotes(ctx sdk.Context) (votes govtypes.Votes) { + k.IterateAllVotes(ctx, func(vote govtypes.Vote) bool { votes = append(votes, vote) return false }) @@ -75,8 +75,8 @@ func (k Keeper) GetAllVotes(ctx sdk.Context) (votes types.Votes) { } // GetVotes returns all votes on a given proposal. -func (k Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes types.Votes) { - k.IterateVotes(ctx, proposalID, func(vote types.Vote) bool { +func (k Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes govtypes.Votes) { + k.IterateVotes(ctx, proposalID, func(vote govtypes.Vote) bool { votes = append(votes, vote) return false }) @@ -84,8 +84,8 @@ func (k Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes types.Votes) } // GetVotesPaginated performs paginated query of votes on a given proposal. -func (k Keeper) GetVotesPaginated(ctx sdk.Context, proposalID uint64, page, limit uint) (votes types.Votes) { - k.IterateVotesPaginated(ctx, proposalID, page, limit, func(vote types.Vote) bool { +func (k Keeper) GetVotesPaginated(ctx sdk.Context, proposalID uint64, page, limit uint) (votes govtypes.Votes) { + k.IterateVotesPaginated(ctx, proposalID, page, limit, func(vote govtypes.Vote) bool { votes = append(votes, vote) return false }) @@ -93,9 +93,9 @@ func (k Keeper) GetVotesPaginated(ctx sdk.Context, proposalID uint64, page, limi } // GetVote gets the vote from an address on a specific proposal. -func (k Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (vote types.Vote, found bool) { +func (k Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (vote govtypes.Vote, found bool) { store := ctx.KVStore(k.storeKey) - bz := store.Get(govTypes.VoteKey(proposalID, voterAddr)) + bz := store.Get(govtypes.VoteKey(proposalID, voterAddr)) if bz == nil { return vote, false } @@ -105,43 +105,43 @@ func (k Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAdd } // setVote set a vote. -func (k Keeper) setVote(ctx sdk.Context, vote types.Vote) { +func (k Keeper) setVote(ctx sdk.Context, vote govtypes.Vote) { store := ctx.KVStore(k.storeKey) bz := k.cdc.MustMarshal(&vote) addr, err := sdk.AccAddressFromBech32(vote.Voter) if err != nil { panic(err) } - store.Set(govTypes.VoteKey(vote.ProposalId, addr), bz) + store.Set(govtypes.VoteKey(vote.ProposalId, addr), bz) } // SetVote set a vote. -func (k Keeper) SetVote(ctx sdk.Context, vote types.Vote) { +func (k Keeper) SetVote(ctx sdk.Context, vote govtypes.Vote) { k.setVote(ctx, vote) } // GetVotesIterator returns an iterator to go over all votes on a given proposal. func (k Keeper) GetVotesIterator(ctx sdk.Context, proposalID uint64) sdk.Iterator { store := ctx.KVStore(k.storeKey) - return sdk.KVStorePrefixIterator(store, govTypes.VotesKey(proposalID)) + return sdk.KVStorePrefixIterator(store, govtypes.VotesKey(proposalID)) } // GetVotesIteratorPaginated returns an iterator to go over // votes on a given proposal based on pagination parameters. func (k Keeper) GetVotesIteratorPaginated(ctx sdk.Context, proposalID uint64, page, limit uint) sdk.Iterator { store := ctx.KVStore(k.storeKey) - return sdk.KVStorePrefixIteratorPaginated(store, govTypes.VotesKey(proposalID), page, limit) + return sdk.KVStorePrefixIteratorPaginated(store, govtypes.VotesKey(proposalID), page, limit) } // deleteVote delete a vote for a proposal. func (k Keeper) deleteVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) { store := ctx.KVStore(k.storeKey) - store.Delete(govTypes.VoteKey(proposalID, voterAddr)) + store.Delete(govtypes.VoteKey(proposalID, voterAddr)) } // DeleteAllVotes deletes all votes for a proposal. func (k Keeper) DeleteAllVotes(ctx sdk.Context, proposalID uint64) { - k.IterateVotes(ctx, proposalID, func(vote types.Vote) bool { + k.IterateVotes(ctx, proposalID, func(vote govtypes.Vote) bool { addr, err := sdk.AccAddressFromBech32(vote.Voter) if err != nil { panic(err) @@ -152,13 +152,13 @@ func (k Keeper) DeleteAllVotes(ctx sdk.Context, proposalID uint64) { } // IterateAllVotes iterates over the all the stored votes and performs a callback function. -func (k Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote types.Vote) (stop bool)) { +func (k Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote govtypes.Vote) (stop bool)) { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, govTypes.VotesKeyPrefix) + iterator := sdk.KVStorePrefixIterator(store, govtypes.VotesKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var vote types.Vote + var vote govtypes.Vote k.cdc.MustUnmarshal(iterator.Value(), &vote) if cb(vote) { @@ -168,12 +168,12 @@ func (k Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote types.Vote) (stop } // IterateVotes iterates over the all votes on a given proposal and performs a callback function. -func (k Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote types.Vote) (stop bool)) { +func (k Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote govtypes.Vote) (stop bool)) { iterator := k.GetVotesIterator(ctx, proposalID) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var vote types.Vote + var vote govtypes.Vote k.cdc.MustUnmarshal(iterator.Value(), &vote) if cb(vote) { @@ -184,12 +184,12 @@ func (k Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote ty // IterateVotesPaginated iterates over votes on a given proposal // based on pagination parameters and performs a callback function. -func (k Keeper) IterateVotesPaginated(ctx sdk.Context, proposalID uint64, page, limit uint, cb func(vote types.Vote) (stop bool)) { +func (k Keeper) IterateVotesPaginated(ctx sdk.Context, proposalID uint64, page, limit uint, cb func(vote govtypes.Vote) (stop bool)) { iterator := k.GetVotesIteratorPaginated(ctx, proposalID, page, limit) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var vote types.Vote + var vote govtypes.Vote k.cdc.MustUnmarshal(iterator.Value(), &vote) if cb(vote) { diff --git a/x/gov/legacy/v220/gov.pb.go b/x/gov/legacy/v220/gov.pb.go new file mode 100644 index 000000000..ee52c1627 --- /dev/null +++ b/x/gov/legacy/v220/gov.pb.go @@ -0,0 +1,2380 @@ +// Package v220 is taken from: +// https://github.com/certikfoundation/shentu/blob/v2.2.0/x/gov/types/gov.pb.go +// nolint + +package v220 + +import ( + fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + time "time" + + types2 "github.com/cosmos/cosmos-sdk/codec/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types1 "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/x/gov/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/regen-network/cosmos-proto" + _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// ProposalStatus enumerates the valid statuses of a proposal. +type ProposalStatus int32 + +const ( + // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. + StatusNil ProposalStatus = 0 + // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + // period. + StatusDepositPeriod ProposalStatus = 1 + // PROPOSAL_STATUS_VOTING_PERIOD defines a certifier voting period status. + StatusCertifierVotingPeriod ProposalStatus = 2 + // PROPOSAL_STATUS_VOTING_PERIOD defines a validator voting period status. + StatusValidatorVotingPeriod ProposalStatus = 3 + // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + // passed. + StatusPassed ProposalStatus = 4 + // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + // been rejected. + StatusRejected ProposalStatus = 5 + // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + // failed. + StatusFailed ProposalStatus = 6 +) + +var ProposalStatus_name = map[int32]string{ + 0: "PROPOSAL_STATUS_UNSPECIFIED", + 1: "PROPOSAL_STATUS_DEPOSIT_PERIOD", + 2: "PROPOSAL_STATUS_CERTIFIER_VOTING_PERIOD", + 3: "PROPOSAL_STATUS_VALIDATOR_VOTING_PERIOD", + 4: "PROPOSAL_STATUS_PASSED", + 5: "PROPOSAL_STATUS_REJECTED", + 6: "PROPOSAL_STATUS_FAILED", +} + +var ProposalStatus_value = map[string]int32{ + "PROPOSAL_STATUS_UNSPECIFIED": 0, + "PROPOSAL_STATUS_DEPOSIT_PERIOD": 1, + "PROPOSAL_STATUS_CERTIFIER_VOTING_PERIOD": 2, + "PROPOSAL_STATUS_VALIDATOR_VOTING_PERIOD": 3, + "PROPOSAL_STATUS_PASSED": 4, + "PROPOSAL_STATUS_REJECTED": 5, + "PROPOSAL_STATUS_FAILED": 6, +} + +func (x ProposalStatus) String() string { + return proto.EnumName(ProposalStatus_name, int32(x)) +} + +func (ProposalStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_3ce5b0b452eb2673, []int{0} +} + +// GenesisState defines the gov module's genesis state. +type GenesisState struct { + // starting_proposal_id is the ID of the starting proposal. + StartingProposalId uint64 `protobuf:"varint,1,opt,name=starting_proposal_id,json=startingProposalId,proto3" json:"starting_proposal_id,omitempty" yaml:"starting_proposal_id"` + // deposits defines all the deposits present at genesis. + Deposits Deposits `protobuf:"bytes,2,rep,name=deposits,proto3,castrepeated=Deposits" json:"deposits"` + // votes defines all the votes present at genesis. + Votes Votes `protobuf:"bytes,3,rep,name=votes,proto3,castrepeated=Votes" json:"votes"` + // proposals defines all the proposals present at genesis. + Proposals Proposals `protobuf:"bytes,4,rep,name=proposals,proto3,castrepeated=Proposals" json:"proposals"` + // params defines all the paramaters of related to deposit. + DepositParams DepositParams `protobuf:"bytes,5,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params" yaml:"deposit_params"` + // params defines all the paramaters of related to voting. + VotingParams types.VotingParams `protobuf:"bytes,6,opt,name=voting_params,json=votingParams,proto3" json:"voting_params" yaml:"voting_params"` + // params defines all the paramaters of related to tally. + TallyParams TallyParams `protobuf:"bytes,7,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params" yaml:"tally_params"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_3ce5b0b452eb2673, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +// Deposit defines an amount deposited by an account address to an active +// proposal. +type Deposit struct { + *types.Deposit `protobuf:"bytes,1,opt,name=deposit,proto3,embedded=deposit" json:"deposit,omitempty"` + TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty" yaml:"txhash"` +} + +func (m *Deposit) Reset() { *m = Deposit{} } +func (*Deposit) ProtoMessage() {} +func (*Deposit) Descriptor() ([]byte, []int) { + return fileDescriptor_3ce5b0b452eb2673, []int{1} +} +func (m *Deposit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Deposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Deposit.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Deposit) XXX_Merge(src proto.Message) { + xxx_messageInfo_Deposit.Merge(m, src) +} +func (m *Deposit) XXX_Size() int { + return m.Size() +} +func (m *Deposit) XXX_DiscardUnknown() { + xxx_messageInfo_Deposit.DiscardUnknown(m) +} + +var xxx_messageInfo_Deposit proto.InternalMessageInfo + +// DepositParams defines the params for deposits on governance proposals. +type DepositParams struct { + // Minimum deposit for a proposal to enter voting period. + MinInitialDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=min_initial_deposit,json=minInitialDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"min_initial_deposit,omitempty" yaml:"min_initial_deposit"` + // Minimum deposit for a proposal to enter voting period. + MinDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=min_deposit,json=minDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"min_deposit,omitempty" yaml:"min_deposit"` + // Maximum period for CTK holders to deposit on a proposal. Initial value: 2 + // months. + MaxDepositPeriod time.Duration `protobuf:"bytes,3,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty" yaml:"max_deposit_period"` +} + +func (m *DepositParams) Reset() { *m = DepositParams{} } +func (*DepositParams) ProtoMessage() {} +func (*DepositParams) Descriptor() ([]byte, []int) { + return fileDescriptor_3ce5b0b452eb2673, []int{2} +} +func (m *DepositParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DepositParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DepositParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DepositParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_DepositParams.Merge(m, src) +} +func (m *DepositParams) XXX_Size() int { + return m.Size() +} +func (m *DepositParams) XXX_DiscardUnknown() { + xxx_messageInfo_DepositParams.DiscardUnknown(m) +} + +var xxx_messageInfo_DepositParams proto.InternalMessageInfo + +// TallyParams defines the params for tallying votes on governance proposals. +type TallyParams struct { + DefaultTally *types.TallyParams `protobuf:"bytes,1,opt,name=default_tally,json=defaultTally,proto3" json:"default_tally,omitempty"` + CertifierUpdateSecurityVoteTally *types.TallyParams `protobuf:"bytes,2,opt,name=certifier_update_security_vote_tally,json=certifierUpdateSecurityVoteTally,proto3" json:"certifier_update_security_vote_tally,omitempty"` + CertifierUpdateStakeVoteTally *types.TallyParams `protobuf:"bytes,3,opt,name=certifier_update_stake_vote_tally,json=certifierUpdateStakeVoteTally,proto3" json:"certifier_update_stake_vote_tally,omitempty"` +} + +func (m *TallyParams) Reset() { *m = TallyParams{} } +func (*TallyParams) ProtoMessage() {} +func (*TallyParams) Descriptor() ([]byte, []int) { + return fileDescriptor_3ce5b0b452eb2673, []int{3} +} +func (m *TallyParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TallyParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TallyParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TallyParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_TallyParams.Merge(m, src) +} +func (m *TallyParams) XXX_Size() int { + return m.Size() +} +func (m *TallyParams) XXX_DiscardUnknown() { + xxx_messageInfo_TallyParams.DiscardUnknown(m) +} + +var xxx_messageInfo_TallyParams proto.InternalMessageInfo + +type Proposal struct { + Content *types2.Any `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` + ProposalId uint64 `protobuf:"varint,2,opt,name=proposal_id,json=proposalId,proto3" json:"id" yaml:"id"` + Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=shentu.gov.v1alpha1.ProposalStatus" json:"status,omitempty" yaml:"proposal_status"` + IsProposerCouncilMember bool `protobuf:"varint,4,opt,name=is_proposer_council_member,json=isProposerCouncilMember,proto3" json:"is_proposer_council_member,omitempty" yaml:"is_proposer_council_member"` + ProposerAddress string `protobuf:"bytes,5,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposer_address,omitempty" yaml:"proposer_address"` + FinalTallyResult types.TallyResult `protobuf:"bytes,6,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result" yaml:"final_tally_result"` + SubmitTime time.Time `protobuf:"bytes,7,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time" yaml:"submit_time"` + DepositEndTime time.Time `protobuf:"bytes,8,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time" yaml:"deposit_end_time"` + TotalDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,9,rep,name=total_deposit,json=totalDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"total_deposit" yaml:"total_deposit"` + VotingStartTime time.Time `protobuf:"bytes,10,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time" yaml:"voting_start_time"` + VotingEndTime time.Time `protobuf:"bytes,11,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time" yaml:"voting_end_time"` +} + +func (m *Proposal) Reset() { *m = Proposal{} } +func (*Proposal) ProtoMessage() {} +func (*Proposal) Descriptor() ([]byte, []int) { + return fileDescriptor_3ce5b0b452eb2673, []int{4} +} +func (m *Proposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Proposal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Proposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_Proposal.Merge(m, src) +} +func (m *Proposal) XXX_Size() int { + return m.Size() +} +func (m *Proposal) XXX_DiscardUnknown() { + xxx_messageInfo_Proposal.DiscardUnknown(m) +} + +var xxx_messageInfo_Proposal proto.InternalMessageInfo + +// Vote defines a vote on a governance proposal. +// A Vote consists of a proposal ID, the voter, and the vote option. +type Vote struct { + *types.Vote `protobuf:"bytes,1,opt,name=deposit,proto3,embedded=deposit" json:"deposit,omitempty"` + TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty" yaml:"txhash"` +} + +func (m *Vote) Reset() { *m = Vote{} } +func (*Vote) ProtoMessage() {} +func (*Vote) Descriptor() ([]byte, []int) { + return fileDescriptor_3ce5b0b452eb2673, []int{5} +} +func (m *Vote) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Vote.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Vote) XXX_Merge(src proto.Message) { + xxx_messageInfo_Vote.Merge(m, src) +} +func (m *Vote) XXX_Size() int { + return m.Size() +} +func (m *Vote) XXX_DiscardUnknown() { + xxx_messageInfo_Vote.DiscardUnknown(m) +} + +var xxx_messageInfo_Vote proto.InternalMessageInfo + +func init() { + // proto.RegisterEnum("shentu.gov.v1alpha1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) + // proto.RegisterType((*GenesisState)(nil), "shentu.gov.v1alpha1.GenesisState") + // proto.RegisterType((*Deposit)(nil), "shentu.gov.v1alpha1.Deposit") + // proto.RegisterType((*DepositParams)(nil), "shentu.gov.v1alpha1.DepositParams") + // proto.RegisterType((*TallyParams)(nil), "shentu.gov.v1alpha1.TallyParams") + // proto.RegisterType((*Proposal)(nil), "shentu.gov.v1alpha1.Proposal") + // proto.RegisterType((*Vote)(nil), "shentu.gov.v1alpha1.Vote") +} + +func init() { proto.RegisterFile("shentu/gov/v1alpha1/gov.proto", fileDescriptor_3ce5b0b452eb2673) } + +var fileDescriptor_3ce5b0b452eb2673 = []byte{ + // 1472 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xcd, 0x4f, 0x1b, 0x47, + 0x1b, 0xf7, 0x1a, 0xf3, 0x35, 0xc6, 0xc4, 0x0c, 0x24, 0x18, 0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16, 0xa6, 0x0c, 0x59, 0x4d, 0x1f, 0x71, 0x30, 0x00, 0xd9, 0xc7, 0xc2, 0x95, 0x19, 0x74, 0x19, + 0xed, 0x16, 0x62, 0xc4, 0x11, 0x52, 0x95, 0xdf, 0x63, 0x60, 0xea, 0x2e, 0xb6, 0x31, 0x25, 0xb4, + 0xca, 0x10, 0xc3, 0xf0, 0x73, 0x30, 0x47, 0x19, 0x6a, 0x31, 0x62, 0xef, 0xbb, 0x0a, 0x9b, 0x0e, + 0x45, 0xa6, 0x4e, 0x8c, 0x94, 0x94, 0x95, 0x56, 0x62, 0xaa, 0xdc, 0xed, 0xc8, 0x8b, 0xc7, 0xc8, + 0x32, 0xd7, 0x95, 0x61, 0x51, 0x8a, 0x06, 0x7d, 0x73, 0x45, 0x58, 0xcb, 0x06, 0xbc, 0x0f, 0x26, + 0x0c, 0xdc, 0x74, 0x28, 0x61, 0x34, 0x15, 0xcd, 0x8e, 0xac, 0xc4, 0xd7, 0x96, 0x72, 0x43, 0xb6, + 0x35, 0x57, 0xe4, 0x41, 0x6a, 0xf2, 0x45, 0x47, 0x8e, 0x3c, 0x7f, 0x2d, 0x4f, 0x08, 0x03, 0xd5, + 0x7a, 0xf9, 0xf0, 0x53, 0x30, 0x7a, 0xe8, 0x30, 0x4c, 0x53, 0x23, 0x1e, 0xd0, 0xc2, 0x50, 0xa0, + 0x5d, 0x87, 0x61, 0x35, 0x21, 0x50, 0x46, 0xdd, 0x2f, 0xaa, 0xf1, 0x34, 0xb8, 0x0d, 0x26, 0x7d, + 0xbd, 0x34, 0x15, 0xf3, 0x30, 0x96, 0x87, 0x62, 0xf8, 0xfa, 0xd5, 0x19, 0x81, 0x33, 0xe9, 0x5b, + 0xa8, 0xd6, 0x87, 0x80, 0x07, 0x60, 0x5a, 0x68, 0xd3, 0x9b, 0xa8, 0x85, 0x2c, 0x9a, 0x1a, 0xcd, + 0x4a, 0x2b, 0xf1, 0x35, 0xe5, 0x43, 0x2b, 0xac, 0x78, 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ba, 0x1d, 0xf9, 0xba, 0xd0, 0x75, + 0x61, 0xac, 0xa2, 0xcd, 0x13, 0x5a, 0x11, 0xbe, 0x0d, 0xee, 0xfa, 0xcc, 0xf3, 0xc0, 0x4d, 0x90, + 0xec, 0x25, 0x21, 0xc3, 0x68, 0x61, 0xca, 0x67, 0xc4, 0xa4, 0xba, 0xd8, 0xed, 0xc8, 0xf3, 0x41, + 0x85, 0xfd, 0x08, 0x45, 0xbb, 0xe2, 0x9b, 0x0a, 0xdc, 0x02, 0x9b, 0x00, 0xee, 0x11, 0x1b, 0x99, + 0xfc, 0x64, 0xf5, 0x16, 0xa6, 0x6d, 0x93, 0x89, 0x21, 0x70, 0xf1, 0x01, 0x6b, 0x5e, 0x98, 0x7a, + 0x5d, 0xf4, 0x67, 0x71, 0x59, 0xce, 0x03, 0x29, 0x5a, 0xd2, 0x33, 0x06, 0x92, 0xe0, 0x57, 0x20, + 0x4e, 0xdb, 0x75, 0x8b, 0x30, 0xdd, 0x7d, 0x70, 0x88, 0x59, 0x90, 0x3e, 0x77, 0xda, 0x35, 0xff, + 0x35, 0xa2, 0x66, 0x04, 0x8b, 0x68, 0x1f, 0x81, 0x64, 0xe5, 0xb1, 0x7b, 0x17, 0x01, 0xb7, 0xb8, + 0x09, 0x90, 0x80, 0xa4, 0x7f, 0x5d, 0xb1, 0x6d, 0x70, 0x86, 0x89, 0x4b, 0x19, 0x6e, 0x08, 0x86, + 0xf9, 0xf0, 0xc8, 0xf4, 0x11, 0x38, 0x8d, 0x3f, 0x91, 0x4b, 0xb6, 0xe1, 0x51, 0x3d, 0x92, 0x40, + 0x82, 0x39, 0x2c, 0xd0, 0xd6, 0x27, 0x2f, 0xeb, 0x90, 0xf7, 0xc2, 0x33, 0x33, 0x94, 0xfd, 0xd7, + 0x5a, 0xe1, 0x94, 0x97, 0xeb, 0x37, 0x43, 0x13, 0xcc, 0x88, 0xf9, 0xeb, 0xbd, 0x93, 0xf8, 0xb2, + 0xc1, 0xa5, 0xc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 0x2c, 0xd4, 0x76, 0x06, 0xd1, 0x46, 0x82, 0x68, 0xbb, + 0xc8, 0x24, 0x06, 0x62, 0x4e, 0x18, 0xed, 0x36, 0xb8, 0x36, 0x88, 0x56, 0x29, 0x54, 0xab, 0xa5, + 0x62, 0x32, 0x96, 0x4e, 0x9e, 0x9c, 0x66, 0xa7, 0x78, 0x72, 0x05, 0x51, 0x8a, 0x0d, 0xf8, 0x1f, + 0x90, 0x1a, 0x8c, 0xd6, 0x4a, 0xf7, 0x4b, 0x1b, 0xb5, 0x52, 0x31, 0x39, 0x9a, 0x86, 0x27, 0xa7, + 0xd9, 0x69, 0x1e, 0xaf, 0xe1, 0x6f, 0x70, 0x83, 0xe1, 0xa1, 0xf8, 0x9b, 0x85, 0xf2, 0x56, 0xa9, + 0x98, 0x1c, 0x0b, 0xe2, 0x6f, 0x22, 0x62, 0x62, 0x23, 0x1d, 0x7b, 0xf4, 0x2c, 0x13, 0x51, 0x6b, + 0x2f, 0xde, 0x64, 0x22, 0xaf, 0xde, 0x64, 0x22, 0xdf, 0x9d, 0x65, 0x22, 0x2f, 0xce, 0x32, 0xd2, + 0xcb, 0xb3, 0x8c, 0xf4, 0xdb, 0x59, 0x46, 0x7a, 0xfc, 0x36, 0x13, 0x79, 0xf9, 0x36, 0x13, 0x79, + 0xf5, 0x36, 0x13, 0xf9, 0x32, 0x17, 0xbc, 0x61, 0xee, 0x4e, 0x3d, 0xdc, 0x73, 0xda, 0xb6, 0xe1, + 0xbd, 0x0d, 0xf2, 0xe2, 0x37, 0xdb, 0x91, 0xf7, 0x0b, 0xcb, 0xbb, 0x6d, 0xf5, 0x31, 0xaf, 0x94, + 0xff, 0xfb, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x11, 0xf5, 0xaf, 0xd0, 0x0d, 0x00, 0x00, +} + +func (this *Proposal) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Proposal) + if !ok { + that2, ok := that.(Proposal) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Content.Equal(that1.Content) { + return false + } + if this.ProposalId != that1.ProposalId { + return false + } + if this.Status != that1.Status { + return false + } + if this.IsProposerCouncilMember != that1.IsProposerCouncilMember { + return false + } + if this.ProposerAddress != that1.ProposerAddress { + return false + } + if !this.FinalTallyResult.Equal(&that1.FinalTallyResult) { + return false + } + if !this.SubmitTime.Equal(that1.SubmitTime) { + return false + } + if !this.DepositEndTime.Equal(that1.DepositEndTime) { + return false + } + if len(this.TotalDeposit) != len(that1.TotalDeposit) { + return false + } + for i := range this.TotalDeposit { + if !this.TotalDeposit[i].Equal(&that1.TotalDeposit[i]) { + return false + } + } + if !this.VotingStartTime.Equal(that1.VotingStartTime) { + return false + } + if !this.VotingEndTime.Equal(that1.VotingEndTime) { + return false + } + return true +} +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.TallyParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size, err := m.VotingParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.Proposals) > 0 { + for iNdEx := len(m.Proposals) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Proposals[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Votes) > 0 { + for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Votes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Deposits) > 0 { + for iNdEx := len(m.Deposits) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Deposits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.StartingProposalId != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.StartingProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Deposit) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Deposit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Deposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = encodeVarintGov(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0x12 + } + if m.Deposit != nil { + { + size, err := m.Deposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DepositParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DepositParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DepositParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxDepositPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxDepositPeriod):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintGov(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x1a + if len(m.MinDeposit) > 0 { + for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.MinInitialDeposit) > 0 { + for iNdEx := len(m.MinInitialDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinInitialDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *TallyParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TallyParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TallyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CertifierUpdateStakeVoteTally != nil { + { + size, err := m.CertifierUpdateStakeVoteTally.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.CertifierUpdateSecurityVoteTally != nil { + { + size, err := m.CertifierUpdateSecurityVoteTally.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.DefaultTally != nil { + { + size, err := m.DefaultTally.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Proposal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Proposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintGov(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0x5a + n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime):]) + if err10 != nil { + return 0, err10 + } + i -= n10 + i = encodeVarintGov(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0x52 + if len(m.TotalDeposit) > 0 { + for iNdEx := len(m.TotalDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TotalDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + } + n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DepositEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime):]) + if err11 != nil { + return 0, err11 + } + i -= n11 + i = encodeVarintGov(dAtA, i, uint64(n11)) + i-- + dAtA[i] = 0x42 + n12, err12 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) + if err12 != nil { + return 0, err12 + } + i -= n12 + i = encodeVarintGov(dAtA, i, uint64(n12)) + i-- + dAtA[i] = 0x3a + { + size, err := m.FinalTallyResult.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + if len(m.ProposerAddress) > 0 { + i -= len(m.ProposerAddress) + copy(dAtA[i:], m.ProposerAddress) + i = encodeVarintGov(dAtA, i, uint64(len(m.ProposerAddress))) + i-- + dAtA[i] = 0x2a + } + if m.IsProposerCouncilMember { + i-- + if m.IsProposerCouncilMember { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.Status != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x18 + } + if m.ProposalId != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x10 + } + if m.Content != nil { + { + size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Vote) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Vote) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = encodeVarintGov(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0x12 + } + if m.Vote != nil { + { + size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGov(dAtA []byte, offset int, v uint64) int { + offset -= sovGov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StartingProposalId != 0 { + n += 1 + sovGov(uint64(m.StartingProposalId)) + } + if len(m.Deposits) > 0 { + for _, e := range m.Deposits { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if len(m.Votes) > 0 { + for _, e := range m.Votes { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if len(m.Proposals) > 0 { + for _, e := range m.Proposals { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + l = m.DepositParams.Size() + n += 1 + l + sovGov(uint64(l)) + l = m.VotingParams.Size() + n += 1 + l + sovGov(uint64(l)) + l = m.TallyParams.Size() + n += 1 + l + sovGov(uint64(l)) + return n +} + +func (m *Deposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Deposit != nil { + l = m.Deposit.Size() + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.TxHash) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *DepositParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.MinInitialDeposit) > 0 { + for _, e := range m.MinInitialDeposit { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if len(m.MinDeposit) > 0 { + for _, e := range m.MinDeposit { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxDepositPeriod) + n += 1 + l + sovGov(uint64(l)) + return n +} + +func (m *TallyParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.DefaultTally != nil { + l = m.DefaultTally.Size() + n += 1 + l + sovGov(uint64(l)) + } + if m.CertifierUpdateSecurityVoteTally != nil { + l = m.CertifierUpdateSecurityVoteTally.Size() + n += 1 + l + sovGov(uint64(l)) + } + if m.CertifierUpdateStakeVoteTally != nil { + l = m.CertifierUpdateStakeVoteTally.Size() + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *Proposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovGov(uint64(l)) + } + if m.ProposalId != 0 { + n += 1 + sovGov(uint64(m.ProposalId)) + } + if m.Status != 0 { + n += 1 + sovGov(uint64(m.Status)) + } + if m.IsProposerCouncilMember { + n += 2 + } + l = len(m.ProposerAddress) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = m.FinalTallyResult.Size() + n += 1 + l + sovGov(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime) + n += 1 + l + sovGov(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime) + n += 1 + l + sovGov(uint64(l)) + if len(m.TotalDeposit) > 0 { + for _, e := range m.TotalDeposit { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime) + n += 1 + l + sovGov(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime) + n += 1 + l + sovGov(uint64(l)) + return n +} + +func (m *Vote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Vote != nil { + l = m.Vote.Size() + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.TxHash) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func sovGov(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGov(x uint64) (n int) { + return sovGov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartingProposalId", wireType) + } + m.StartingProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartingProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Deposits = append(m.Deposits, Deposit{}) + if err := m.Deposits[len(m.Deposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Votes = append(m.Votes, Vote{}) + if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposals", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proposals = append(m.Proposals, Proposal{}) + if err := m.Proposals[len(m.Proposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DepositParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TallyParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TallyParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Deposit) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Deposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Deposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Deposit == nil { + m.Deposit = &types.Deposit{} + } + if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DepositParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DepositParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DepositParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinInitialDeposit = append(m.MinInitialDeposit, types1.Coin{}) + if err := m.MinInitialDeposit[len(m.MinInitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinDeposit = append(m.MinDeposit, types1.Coin{}) + if err := m.MinDeposit[len(m.MinDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxDepositPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.MaxDepositPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TallyParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TallyParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TallyParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultTally", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DefaultTally == nil { + m.DefaultTally = &types.TallyParams{} + } + if err := m.DefaultTally.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CertifierUpdateSecurityVoteTally", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CertifierUpdateSecurityVoteTally == nil { + m.CertifierUpdateSecurityVoteTally = &types.TallyParams{} + } + if err := m.CertifierUpdateSecurityVoteTally.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CertifierUpdateStakeVoteTally", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CertifierUpdateStakeVoteTally == nil { + m.CertifierUpdateStakeVoteTally = &types.TallyParams{} + } + if err := m.CertifierUpdateStakeVoteTally.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Proposal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Proposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Proposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Content == nil { + m.Content = &types2.Any{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= ProposalStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsProposerCouncilMember", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsProposerCouncilMember = bool(v != 0) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProposerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FinalTallyResult", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FinalTallyResult.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubmitTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.SubmitTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositEndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.DepositEndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TotalDeposit = append(m.TotalDeposit, types1.Coin{}) + if err := m.TotalDeposit[len(m.TotalDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingStartTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.VotingStartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingEndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.VotingEndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Vote) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Vote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Vote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Vote == nil { + m.Vote = &types.Vote{} + } + if err := m.Vote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGov(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGov + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGov + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGov + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGov + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGov + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGov + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGov = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGov = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGov = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/gov/legacy/v220/params.go b/x/gov/legacy/v220/params.go new file mode 100644 index 000000000..f6b6b6241 --- /dev/null +++ b/x/gov/legacy/v220/params.go @@ -0,0 +1,149 @@ +package v220 + +import ( + "encoding/json" + "fmt" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + params "github.com/cosmos/cosmos-sdk/x/params/types" +) + +// parameter store keys +var ( + ParamStoreKeyDepositParams = []byte("depositparams") + ParamStoreKeyVotingParams = []byte("votingparams") + ParamStoreKeyTallyParams = []byte("tallyparams") +) + +// ParamKeyTable is the key declaration for parameters. +func ParamKeyTable() params.KeyTable { + return params.NewKeyTable( + params.NewParamSetPair(ParamStoreKeyDepositParams, DepositParams{}, validateDepositParams), + params.NewParamSetPair(ParamStoreKeyVotingParams, govtypes.VotingParams{}, validateVotingParams), + params.NewParamSetPair(ParamStoreKeyTallyParams, TallyParams{}, validateTally), + ) +} + +// NewDepositParams creates a new DepositParams object +func NewDepositParams(minInitialDeposit, minDeposit sdk.Coins, maxDepositPeriod time.Duration) DepositParams { + return DepositParams{ + MinInitialDeposit: minInitialDeposit, + MinDeposit: minDeposit, + MaxDepositPeriod: maxDepositPeriod, + } +} + +func (dp DepositParams) String() string { + return fmt.Sprintf(`Deposit Params: + Min Initial Deposit: %s + Min Deposit: %s + Max Deposit Period: %s`, dp.MinInitialDeposit, dp.MinDeposit, dp.MaxDepositPeriod) +} + +// Equal checks equality of DepositParams +func (dp DepositParams) Equal(dp2 DepositParams) bool { + return dp.MinInitialDeposit.IsEqual(dp2.MinInitialDeposit) && + dp.MinDeposit.IsEqual(dp2.MinDeposit) && + dp.MaxDepositPeriod == dp2.MaxDepositPeriod +} + +func validateDepositParams(i interface{}) error { + v, ok := i.(DepositParams) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if !v.MinDeposit.IsValid() { + return fmt.Errorf("invalid minimum deposit: %s", v.MinDeposit) + } + if v.MaxDepositPeriod <= 0 { + return fmt.Errorf("maximum deposit period must be positive: %d", v.MaxDepositPeriod) + } + + return nil +} + +// Params returns all of the governance params +type Params struct { + VotingParams govtypes.VotingParams `json:"voting_params" yaml:"voting_params"` + TallyParams TallyParams `json:"tally_params" yaml:"tally_params"` + DepositParams DepositParams `json:"deposit_params" yaml:"deposit_parmas"` +} + +func (gp Params) String() string { + return gp.VotingParams.String() + "\n" + + gp.TallyParams.String() + "\n" + gp.DepositParams.String() +} + +// NewParams returns a Params structs including voting, deposit and tally params +func NewParams(vp govtypes.VotingParams, tp TallyParams, dp DepositParams) Params { + return Params{ + VotingParams: vp, + DepositParams: dp, + TallyParams: tp, + } +} + +func (tp TallyParams) String() string { + b, err := json.MarshalIndent(tp, "", " ") + if err != nil { + panic(err) + } + return string(b) +} + +func validateTally(i interface{}) error { + v, ok := i.(TallyParams) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if err := validateTallyParams(*v.CertifierUpdateSecurityVoteTally); err != nil { + return err + } + if err := validateTallyParams(*v.CertifierUpdateStakeVoteTally); err != nil { + return err + } + if err := validateTallyParams(*v.DefaultTally); err != nil { + return err + } + return nil +} + +func validateTallyParams(tallyParams govtypes.TallyParams) error { + if tallyParams.Quorum.IsNegative() { + return fmt.Errorf("quorom cannot be negative: %s", tallyParams.Quorum) + } + if tallyParams.Quorum.GT(sdk.OneDec()) { + return fmt.Errorf("quorom too large: %s", tallyParams) + } + if !tallyParams.Threshold.IsPositive() { + return fmt.Errorf("vote threshold must be positive: %s", tallyParams.Threshold) + } + if tallyParams.Threshold.GT(sdk.OneDec()) { + return fmt.Errorf("vote threshold too large: %s", tallyParams) + } + if !tallyParams.VetoThreshold.IsPositive() { + return fmt.Errorf("veto threshold must be positive: %s", tallyParams.Threshold) + } + if tallyParams.VetoThreshold.GT(sdk.OneDec()) { + return fmt.Errorf("veto threshold too large: %s", tallyParams) + } + + return nil +} + +func validateVotingParams(i interface{}) error { + v, ok := i.(govtypes.VotingParams) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.VotingPeriod <= 0 { + return fmt.Errorf("voting period must be positive: %s", v.VotingPeriod) + } + + return nil +} diff --git a/x/gov/legacy/v220/proposal.go b/x/gov/legacy/v220/proposal.go new file mode 100644 index 000000000..efd43b593 --- /dev/null +++ b/x/gov/legacy/v220/proposal.go @@ -0,0 +1,221 @@ +package v220 + +import ( + "encoding/json" + "fmt" + "strings" + "time" + + yaml "gopkg.in/yaml.v2" + + "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + proto "github.com/gogo/protobuf/proto" + + certtypes "github.com/certikfoundation/shentu/v2/x/cert/types" + shieldtypes "github.com/certikfoundation/shentu/v2/x/shield/types" +) + +// Proposal types implement UnpackInterfaceMessages to unpack +// Content fields. +var _ types.UnpackInterfacesMessage = Proposal{} +var _ types.UnpackInterfacesMessage = Proposals{} + +// NewProposal creates a new Proposal instance +func NewProposal(content govtypes.Content, id uint64, proposerAddress sdk.AccAddress, isProposerCouncilMember bool, submitTime time.Time, depositEndTime time.Time) (Proposal, error) { + p := Proposal{ + ProposalId: id, + Status: StatusDepositPeriod, + IsProposerCouncilMember: isProposerCouncilMember, + ProposerAddress: proposerAddress.String(), + FinalTallyResult: govtypes.EmptyTallyResult(), + TotalDeposit: sdk.NewCoins(), + SubmitTime: submitTime, + DepositEndTime: depositEndTime, + } + + msg, ok := content.(proto.Message) + if !ok { + return Proposal{}, fmt.Errorf("%T does not implement proto.Message", content) + } + + any, err := types.NewAnyWithValue(msg) + if err != nil { + return Proposal{}, err + } + + p.Content = any + + return p, nil +} + +// GetContent returns the proposal Content +func (p Proposal) GetContent() govtypes.Content { + content, ok := p.Content.GetCachedValue().(govtypes.Content) + if !ok { + return nil + } + return content +} + +// String implements stringer interface +func (p Proposal) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (p Proposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { + var content govtypes.Content + return unpacker.UnpackAny(p.Content, &content) +} + +func (p Proposal) GetTitle() string { + content := p.GetContent() + if content == nil { + return "" + } + return content.GetTitle() +} + +func (p Proposal) ProposalType() string { + content := p.GetContent() + if content == nil { + return "" + } + return content.ProposalType() +} + +func (p Proposal) ProposalRoute() string { + content := p.GetContent() + if content == nil { + return "" + } + return content.ProposalRoute() +} + +// HasSecurityVoting returns true if the proposal needs to go through security +// (certifier) voting before stake (validator) voting. +func (p Proposal) HasSecurityVoting() bool { + switch p.GetContent().(type) { + case *upgradetypes.SoftwareUpgradeProposal, *certtypes.CertifierUpdateProposal, shieldtypes.ShieldClaimProposal: + return true + default: + return false + } +} + +// Proposals is an array of proposals. +type Proposals []Proposal + +// String implements stringer interface. +func (p Proposals) String() string { + out := "ID - (Status) [Type] Title\n" + for _, prop := range p { + out += fmt.Sprintf("%d - (%s) [%s] %s\n", + prop.ProposalId, prop.Status, + prop.ProposalType(), prop.GetTitle()) + } + return strings.TrimSpace(out) +} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (p Proposals) UnpackInterfaces(unpacker types.AnyUnpacker) error { + for _, x := range p { + err := x.UnpackInterfaces(unpacker) + if err != nil { + return err + } + } + return nil +} + +type ( + // ProposalQueue is a type alias that represents a list of proposal IDs. + ProposalQueue []uint64 +) + +// ProposalStatusFromString turns a string into a ProposalStatus. +func ProposalStatusFromString(str string) (ProposalStatus, error) { + 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 otherwise. +func ValidProposalStatus(status ProposalStatus) bool { + if status == StatusDepositPeriod || + status == StatusCertifierVotingPeriod || + status == StatusPassed || + status == StatusRejected || + status == StatusFailed || + status == StatusValidatorVotingPeriod { + return true + } + return false +} + +// Marshal implements the Marshal method for protobuf compatibility. +func (status ProposalStatus) Marshal() ([]byte, error) { + return []byte{byte(status)}, nil +} + +// Unmarshal implements the Unmarshal method for protobuf compatibility. +func (status *ProposalStatus) Unmarshal(data []byte) error { + *status = ProposalStatus(data[0]) + return nil +} + +// MarshalJSON marshals to JSON using string. +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 +} + +// Format implements the fmt.Formatter interface. +func (status ProposalStatus) Format(s fmt.State, verb rune) { + switch verb { + case 's': + s.Write([]byte(status.String())) + default: + // TODO: Do this conversion more directly + s.Write([]byte(fmt.Sprintf("%v", byte(status)))) + } +} + +// ProposalHandler implements the Handler interface for governance module-based +// proposals (ie. TextProposal and SoftwareUpgradeProposal). Since these are +// merely signaling mechanisms at the moment and do not affect state, it +// performs a no-op. +func ProposalHandler(_ sdk.Context, c govtypes.Content) error { + switch c.ProposalType() { + case govtypes.ProposalTypeText: + // both proposal types do not change state so this performs a no-op + return nil + + default: + errMsg := fmt.Sprintf("unrecognized gov proposal type: %s", c.ProposalType()) + return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) + } +} diff --git a/x/gov/legacy/v220/store.go b/x/gov/legacy/v220/store.go new file mode 100644 index 000000000..958f152b3 --- /dev/null +++ b/x/gov/legacy/v220/store.go @@ -0,0 +1,32 @@ +package v220 + +import ( + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +// MigrateStore performs migration of votes. Specifically, it performs: +// - Conversion of votes from custom type to Cosmos SDK type +func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, cdc codec.BinaryCodec) error { + store := ctx.KVStore(storeKey) + iterator := sdk.KVStorePrefixIterator(store, govtypes.VotesKeyPrefix) + + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + var oldVote Vote + if err := cdc.Unmarshal(iterator.Value(), &oldVote); err != nil { + return err + } + + newVote := govtypes.Vote{ProposalId: oldVote.ProposalId, Voter: oldVote.Voter, Option: oldVote.Option} + bz, err := cdc.Marshal(&newVote) + if err != nil { + return err + } + + store.Set(iterator.Key(), bz) + } + + return nil +} diff --git a/x/gov/legacy/v220/types.go b/x/gov/legacy/v220/types.go new file mode 100644 index 000000000..fc9d8a97e --- /dev/null +++ b/x/gov/legacy/v220/types.go @@ -0,0 +1,4 @@ +package v220 + +type Deposits []Deposit +type Votes []Vote diff --git a/x/gov/module.go b/x/gov/module.go index de6681b21..9f3a494b9 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -161,6 +161,12 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { //govtypes.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + + m := keeper.NewMigrator(am.keeper) + err := cfg.RegisterMigration(govtypes.ModuleName, 1, m.Migrate1to2) + if err != nil { + panic(err) + } } // InitGenesis performs genesis initialization for the governance module. @@ -178,7 +184,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (am AppModule) ConsensusVersion() uint64 { return 2 } // BeginBlock implements the Cosmos SDK BeginBlock module function. func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/gov/simulation/decoder.go b/x/gov/simulation/decoder.go index 27b57180e..7376d58e6 100644 --- a/x/gov/simulation/decoder.go +++ b/x/gov/simulation/decoder.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/kv" "github.com/cosmos/cosmos-sdk/codec" - govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/certikfoundation/shentu/v2/x/gov/types" ) @@ -17,27 +17,27 @@ import ( func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { return func(kvA, kvB kv.Pair) string { switch { - case bytes.Equal(kvA.Key[:1], govTypes.ProposalsKeyPrefix): + case bytes.Equal(kvA.Key[:1], govtypes.ProposalsKeyPrefix): var proposalA, proposalB types.Proposal cdc.MustUnmarshal(kvA.Value, &proposalA) cdc.MustUnmarshal(kvB.Value, &proposalB) return fmt.Sprintf("%v\n%v", proposalA, proposalB) - case bytes.Equal(kvA.Key[:1], govTypes.ActiveProposalQueuePrefix), - bytes.Equal(kvA.Key[:1], govTypes.InactiveProposalQueuePrefix), - bytes.Equal(kvA.Key[:1], govTypes.ProposalIDKey): + case bytes.Equal(kvA.Key[:1], govtypes.ActiveProposalQueuePrefix), + bytes.Equal(kvA.Key[:1], govtypes.InactiveProposalQueuePrefix), + bytes.Equal(kvA.Key[:1], govtypes.ProposalIDKey): proposalIDA := binary.LittleEndian.Uint64(kvA.Value) proposalIDB := binary.LittleEndian.Uint64(kvB.Value) return fmt.Sprintf("%d\n%d", proposalIDA, proposalIDB) - case bytes.Equal(kvA.Key[:1], govTypes.DepositsKeyPrefix): - var depositA, depositB types.Deposit + case bytes.Equal(kvA.Key[:1], govtypes.DepositsKeyPrefix): + var depositA, depositB govtypes.Deposit cdc.MustUnmarshal(kvA.Value, &depositA) cdc.MustUnmarshal(kvB.Value, &depositB) return fmt.Sprintf("%v\n%v", depositA, depositB) - case bytes.Equal(kvA.Key[:1], govTypes.VotesKeyPrefix): - var voteA, voteB types.Vote + case bytes.Equal(kvA.Key[:1], govtypes.VotesKeyPrefix): + var voteA, voteB govtypes.Vote cdc.MustUnmarshal(kvA.Value, &voteA) cdc.MustUnmarshal(kvB.Value, &voteB) return fmt.Sprintf("%v\n%v", voteA, voteB) diff --git a/x/gov/simulation/decoder_test.go b/x/gov/simulation/decoder_test.go index d7e5bc6d8..cf173d46e 100644 --- a/x/gov/simulation/decoder_test.go +++ b/x/gov/simulation/decoder_test.go @@ -40,11 +40,10 @@ func TestDecodeStore(t *testing.T) { binary.LittleEndian.PutUint64(proposalIDBz, proposalID) depositor := RandomAccount() - txhash := "2300092389009f098099" - deposit := types.NewDeposit(proposalID, depositor.Address, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())), txhash) + deposit := govtypes.NewDeposit(proposalID, depositor.Address, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt()))) voter := RandomAccount() options := govtypes.NewNonSplitVoteOption(govtypes.OptionYes) - vote := types.NewVote(proposalID, voter.Address, options, txhash) + vote := govtypes.NewVote(proposalID, voter.Address, options) kvPairs := kv.Pairs{ Pairs: []kv.Pair{ diff --git a/x/gov/types/deposit.go b/x/gov/types/deposit.go deleted file mode 100644 index 8df6d6122..000000000 --- a/x/gov/types/deposit.go +++ /dev/null @@ -1,18 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/gov/types" -) - -// NewDeposit creates a new Deposit instance. -func NewDeposit(proposalID uint64, depositor sdk.AccAddress, amount sdk.Coins, txhash string) Deposit { - deposit := types.NewDeposit(proposalID, depositor, amount) - return Deposit{ - &deposit, - txhash, - } -} - -// Deposits is a collection of Deposit objects. -type Deposits []Deposit diff --git a/x/gov/types/gov.pb.go b/x/gov/types/gov.pb.go index 4ec19d9b0..2f240c44c 100644 --- a/x/gov/types/gov.pb.go +++ b/x/gov/types/gov.pb.go @@ -90,9 +90,9 @@ type GenesisState struct { // starting_proposal_id is the ID of the starting proposal. StartingProposalId uint64 `protobuf:"varint,1,opt,name=starting_proposal_id,json=startingProposalId,proto3" json:"starting_proposal_id,omitempty" yaml:"starting_proposal_id"` // deposits defines all the deposits present at genesis. - Deposits Deposits `protobuf:"bytes,2,rep,name=deposits,proto3,castrepeated=Deposits" json:"deposits"` + Deposits []types.Deposit `protobuf:"bytes,2,rep,name=deposits,proto3" json:"deposits"` // votes defines all the votes present at genesis. - Votes Votes `protobuf:"bytes,3,rep,name=votes,proto3,castrepeated=Votes" json:"votes"` + Votes []types.Vote `protobuf:"bytes,3,rep,name=votes,proto3" json:"votes"` // proposals defines all the proposals present at genesis. Proposals Proposals `protobuf:"bytes,4,rep,name=proposals,proto3,castrepeated=Proposals" json:"proposals"` // params defines all the paramaters of related to deposit. @@ -136,45 +136,6 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -// Deposit defines an amount deposited by an account address to an active -// proposal. -type Deposit struct { - *types.Deposit `protobuf:"bytes,1,opt,name=deposit,proto3,embedded=deposit" json:"deposit,omitempty"` - TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty" yaml:"txhash"` -} - -func (m *Deposit) Reset() { *m = Deposit{} } -func (*Deposit) ProtoMessage() {} -func (*Deposit) Descriptor() ([]byte, []int) { - return fileDescriptor_3ce5b0b452eb2673, []int{1} -} -func (m *Deposit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Deposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Deposit.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Deposit) XXX_Merge(src proto.Message) { - xxx_messageInfo_Deposit.Merge(m, src) -} -func (m *Deposit) XXX_Size() int { - return m.Size() -} -func (m *Deposit) XXX_DiscardUnknown() { - xxx_messageInfo_Deposit.DiscardUnknown(m) -} - -var xxx_messageInfo_Deposit proto.InternalMessageInfo - // DepositParams defines the params for deposits on governance proposals. type DepositParams struct { // Minimum deposit for a proposal to enter voting period. @@ -189,7 +150,7 @@ type DepositParams struct { func (m *DepositParams) Reset() { *m = DepositParams{} } func (*DepositParams) ProtoMessage() {} func (*DepositParams) Descriptor() ([]byte, []int) { - return fileDescriptor_3ce5b0b452eb2673, []int{2} + return fileDescriptor_3ce5b0b452eb2673, []int{1} } func (m *DepositParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -228,7 +189,7 @@ type TallyParams struct { func (m *TallyParams) Reset() { *m = TallyParams{} } func (*TallyParams) ProtoMessage() {} func (*TallyParams) Descriptor() ([]byte, []int) { - return fileDescriptor_3ce5b0b452eb2673, []int{3} + return fileDescriptor_3ce5b0b452eb2673, []int{2} } func (m *TallyParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -274,7 +235,7 @@ type Proposal struct { func (m *Proposal) Reset() { *m = Proposal{} } func (*Proposal) ProtoMessage() {} func (*Proposal) Descriptor() ([]byte, []int) { - return fileDescriptor_3ce5b0b452eb2673, []int{4} + return fileDescriptor_3ce5b0b452eb2673, []int{3} } func (m *Proposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -303,151 +264,104 @@ func (m *Proposal) XXX_DiscardUnknown() { var xxx_messageInfo_Proposal proto.InternalMessageInfo -// Vote defines a vote on a governance proposal. -// A Vote consists of a proposal ID, the voter, and the vote option. -type Vote struct { - *types.Vote `protobuf:"bytes,1,opt,name=deposit,proto3,embedded=deposit" json:"deposit,omitempty"` - TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty" yaml:"txhash"` -} - -func (m *Vote) Reset() { *m = Vote{} } -func (*Vote) ProtoMessage() {} -func (*Vote) Descriptor() ([]byte, []int) { - return fileDescriptor_3ce5b0b452eb2673, []int{5} -} -func (m *Vote) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Vote.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Vote) XXX_Merge(src proto.Message) { - xxx_messageInfo_Vote.Merge(m, src) -} -func (m *Vote) XXX_Size() int { - return m.Size() -} -func (m *Vote) XXX_DiscardUnknown() { - xxx_messageInfo_Vote.DiscardUnknown(m) -} - -var xxx_messageInfo_Vote proto.InternalMessageInfo - func init() { proto.RegisterEnum("shentu.gov.v1alpha1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) proto.RegisterType((*GenesisState)(nil), "shentu.gov.v1alpha1.GenesisState") - proto.RegisterType((*Deposit)(nil), "shentu.gov.v1alpha1.Deposit") proto.RegisterType((*DepositParams)(nil), "shentu.gov.v1alpha1.DepositParams") proto.RegisterType((*TallyParams)(nil), "shentu.gov.v1alpha1.TallyParams") proto.RegisterType((*Proposal)(nil), "shentu.gov.v1alpha1.Proposal") - proto.RegisterType((*Vote)(nil), "shentu.gov.v1alpha1.Vote") } func init() { proto.RegisterFile("shentu/gov/v1alpha1/gov.proto", fileDescriptor_3ce5b0b452eb2673) } var fileDescriptor_3ce5b0b452eb2673 = []byte{ - // 1472 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xcd, 0x4f, 0x1b, 0x47, - 0x1b, 0xf7, 0x1a, 0xf3, 0x35, 0xc6, 0xc4, 0x0c, 0x24, 0x18, 0x03, 0x5e, 0x67, 0x93, 0x57, 0x2f, - 0x8a, 0x12, 0xfb, 0x85, 0xf7, 0x3d, 0xbc, 0xa2, 0x52, 0x25, 0x2f, 0x36, 0x89, 0x23, 0x0a, 0xee, - 0xda, 0xa1, 0x52, 0x7b, 0xd8, 0x8e, 0xbd, 0x03, 0x4c, 0xb3, 0x1f, 0x96, 0x67, 0x8c, 0x40, 0xea, - 0xa1, 0xc7, 0x88, 0x43, 0x95, 0x63, 0xa4, 0x0a, 0x29, 0x52, 0x6e, 0x91, 0xaa, 0x5e, 0x7a, 0xea, - 0x5f, 0x10, 0xf5, 0x94, 0x63, 0x4e, 0x4e, 0x43, 0x2e, 0x51, 0x8e, 0x56, 0x6f, 0xbd, 0x54, 0xbb, - 0x33, 0x6b, 0xef, 0x1a, 0x13, 0xd2, 0xf6, 0x04, 0xfb, 0x7c, 0xfc, 0x7e, 0xbf, 0x99, 0x79, 0xe6, - 0x79, 0xc6, 0x60, 0x99, 0x1e, 0x60, 0x9b, 0xb5, 0xf3, 0xfb, 0xce, 0x61, 0xfe, 0x70, 0x15, 0x99, - 0xcd, 0x03, 0xb4, 0xea, 0x7e, 0xe4, 0x9a, 0x2d, 0x87, 0x39, 0x70, 0x96, 0xbb, 0x73, 0xae, 0xc5, - 0x77, 0xa7, 0x33, 0x0d, 0x87, 0x5a, 0x0e, 0xcd, 0xd7, 0x11, 0xc5, 0xf9, 0xc3, 0xd5, 0x3a, 0x66, - 0x68, 0x35, 0xdf, 0x70, 0x88, 0xcd, 0x93, 0xd2, 0x4b, 0xc2, 0xcf, 0x31, 0xb9, 0xbb, 0x07, 0x99, - 0x5e, 0xe0, 0x5e, 0xdd, 0xfb, 0xca, 0xf3, 0x0f, 0xe1, 0x9a, 0xdb, 0x77, 0xf6, 0x1d, 0x6e, 0x77, - 0xff, 0x13, 0x56, 0x79, 0xdf, 0x71, 0xf6, 0x4d, 0x9c, 0xf7, 0xbe, 0xea, 0xed, 0xbd, 0x3c, 0x23, - 0x16, 0xa6, 0x0c, 0x59, 0x4d, 0x1f, 0x71, 0x30, 0x00, 0xd9, 0xc7, 0xc2, 0x95, 0x19, 0x74, 0x19, - 0xed, 0x16, 0x62, 0xc4, 0x11, 0x52, 0x95, 0xdf, 0x63, 0x60, 0xea, 0x2e, 0xb6, 0x31, 0x25, 0xb4, - 0xca, 0x10, 0xc3, 0xf0, 0x73, 0x30, 0x47, 0x19, 0x6a, 0x31, 0x62, 0xef, 0xbb, 0x0a, 0x9b, 0x0e, - 0x45, 0xa6, 0x4e, 0x8c, 0x94, 0x94, 0x95, 0x56, 0x62, 0xaa, 0xdc, 0xed, 0xc8, 0x8b, 0xc7, 0xc8, - 0x32, 0xd7, 0x95, 0x61, 0x51, 0x8a, 0x06, 0x7d, 0x73, 0x45, 0x58, 0xcb, 0x06, 0xbc, 0x0f, 0x26, - 0x0c, 0xdc, 0x74, 0x28, 0x61, 0x34, 0x15, 0xcd, 0x8e, 0xac, 0xc4, 0xd7, 0x96, 0x72, 0x43, 0xb6, - 0x35, 0x57, 0xe4, 0x41, 0x6a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, 0x65, 0x22, 0x2f, 0xce, 0x32, 0xd2, - 0xcb, 0xb3, 0x8c, 0xf4, 0xdb, 0x59, 0x46, 0x7a, 0xfc, 0x36, 0x13, 0x79, 0xf9, 0x36, 0x13, 0x79, - 0xf5, 0x36, 0x13, 0xf9, 0x32, 0x17, 0xbc, 0x61, 0xee, 0x4e, 0x3d, 0xdc, 0x73, 0xda, 0xb6, 0xe1, - 0xbd, 0x0d, 0xf2, 0xe2, 0x37, 0xdb, 0x91, 0xf7, 0x0b, 0xcb, 0xbb, 0x6d, 0xf5, 0x31, 0xaf, 0x94, - 0xff, 0xfb, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x11, 0xf5, 0xaf, 0xd0, 0x0d, 0x00, 0x00, + // 1373 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x41, 0x6f, 0x13, 0x47, + 0x14, 0xf6, 0x26, 0x26, 0x24, 0xe3, 0x24, 0x98, 0x4d, 0x20, 0x8e, 0x43, 0x76, 0xcd, 0x42, 0xd5, + 0xa8, 0x02, 0xbb, 0x49, 0x39, 0x51, 0xf5, 0x60, 0xc7, 0x0e, 0x75, 0x95, 0x26, 0xee, 0xda, 0xa4, + 0x52, 0x7b, 0xd8, 0x8e, 0xbd, 0x13, 0x67, 0xca, 0xee, 0x8e, 0xe5, 0x19, 0x47, 0xf8, 0xd6, 0x23, + 0xca, 0xa1, 0xe2, 0x88, 0x54, 0x45, 0x42, 0xe2, 0x86, 0x54, 0xf5, 0xd2, 0x53, 0x7f, 0x01, 0xea, + 0x89, 0x23, 0x97, 0x9a, 0x12, 0x2e, 0x15, 0x47, 0x5f, 0x7b, 0xa9, 0x76, 0x66, 0xd6, 0xde, 0x75, + 0x9c, 0x86, 0xf6, 0x04, 0xfb, 0xe6, 0x7d, 0xdf, 0xf7, 0xde, 0x9b, 0x99, 0x6f, 0x1c, 0xb0, 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, 0x6c, 0xac, 0x64, 0x65, 0xdb, 0x62, 0xac, 0x7c, 0x42, 0xd9, + 0xa2, 0xc8, 0x29, 0xc4, 0x5f, 0xf4, 0xf4, 0x98, 0x39, 0x80, 0xa8, 0x77, 0xc0, 0x85, 0x43, 0xc2, + 0x10, 0x4d, 0x4d, 0x72, 0x6c, 0x6a, 0x1c, 0x76, 0x8f, 0x30, 0x24, 0x81, 0x22, 0x59, 0xdd, 0x01, + 0x33, 0x41, 0x61, 0x34, 0x15, 0xe7, 0xc8, 0xd5, 0xec, 0x98, 0xcd, 0xcc, 0x06, 0x85, 0x16, 0x2e, + 0xfb, 0xf0, 0xe7, 0xaf, 0xf5, 0x99, 0x20, 0x42, 0xcd, 0x21, 0x85, 0x7a, 0x00, 0xe6, 0x65, 0x45, + 0x56, 0x0b, 0xb6, 0xa1, 0x4b, 0x53, 0x17, 0x32, 0xca, 0x5a, 0x62, 0xc3, 0x18, 0x4b, 0x2a, 0x7b, + 0xa9, 0xf0, 0xcc, 0xc2, 0xaa, 0xcf, 0xdc, 0xef, 0xe9, 0x57, 0xc4, 0xe4, 0xa2, 0x3c, 0x86, 0x39, + 0x67, 0x87, 0xb3, 0xd5, 0x06, 0x98, 0x3b, 0x24, 0x62, 0xb2, 0x42, 0x68, 0x8a, 0x0b, 0x65, 0xce, + 0xe8, 0xdb, 0x9f, 0xb5, 0x90, 0xb9, 0x26, 0x65, 0x16, 0x85, 0x4c, 0x84, 0xc4, 0x30, 0x67, 0x0f, + 0x43, 0xb9, 0xea, 0x77, 0x60, 0x96, 0x41, 0xc7, 0xe9, 0x06, 0x1a, 0x17, 0xa5, 0xc6, 0xb8, 0x66, + 0x6a, 0x7e, 0xa2, 0xd4, 0x58, 0x91, 0x1a, 0x0b, 0x42, 0x23, 0xcc, 0x61, 0x98, 0x09, 0x36, 0xcc, + 0xbc, 0x1b, 0x7f, 0xf2, 0x54, 0x57, 0x8c, 0xbf, 0x27, 0xc1, 0x5c, 0x64, 0x18, 0xea,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0x7c, 0x6d, 0x77, 0x94, 0x6d, 0x32, 0xcc, 0xb6, 0x07, 0x1d, + 0x6c, 0x43, 0x46, 0xa2, 0x6c, 0xb7, 0xc0, 0xd5, 0x51, 0xb6, 0x4a, 0xbe, 0x5a, 0x2d, 0x15, 0x93, + 0xf1, 0x74, 0xf2, 0xe8, 0x38, 0x33, 0x2b, 0xc0, 0x15, 0x48, 0x29, 0xb2, 0xd5, 0x8f, 0x41, 0x6a, + 0x34, 0xdb, 0x2c, 0x7d, 0x51, 0xda, 0xac, 0x95, 0x8a, 0xc9, 0x0b, 0x69, 0xf5, 0xe8, 0x38, 0x33, + 0x2f, 0xf2, 0x4d, 0xf4, 0x3d, 0x6a, 0x30, 0x34, 0x96, 0x7f, 0x2b, 0x5f, 0xde, 0x2e, 0x15, 0x93, + 0x53, 0x61, 0xfe, 0x2d, 0x88, 0x1d, 0x64, 0xa7, 0xe3, 0x8f, 0x9e, 0x69, 0xb1, 0x42, 0xed, 0xc5, + 0x1b, 0x2d, 0xf6, 0xea, 0x8d, 0x16, 0xfb, 0xe1, 0x44, 0x8b, 0xbd, 0x38, 0xd1, 0x94, 0x97, 0x27, + 0x9a, 0xf2, 0xe7, 0x89, 0xa6, 0x3c, 0x7e, 0xab, 0xc5, 0x5e, 0xbe, 0xd5, 0x62, 0xaf, 0xde, 0x6a, + 0xb1, 0x6f, 0xb2, 0xe1, 0x93, 0xee, 0x4f, 0xea, 0xc1, 0x3e, 0xe9, 0x78, 0x36, 0x7f, 0xa3, 0x73, + 0xf2, 0xcf, 0x94, 0x87, 0xfc, 0x8f, 0x0a, 0x7e, 0xea, 0xeb, 0x53, 0xfc, 0x48, 0x7d, 0xf2, 0x4f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x86, 0xba, 0x1f, 0x05, 0xc3, 0x0c, 0x00, 0x00, } func (this *Proposal) Equal(that interface{}) bool { @@ -609,48 +523,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Deposit) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Deposit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Deposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.TxHash) > 0 { - i -= len(m.TxHash) - copy(dAtA[i:], m.TxHash) - i = encodeVarintGov(dAtA, i, uint64(len(m.TxHash))) - i-- - dAtA[i] = 0x12 - } - if m.Deposit != nil { - { - size, err := m.Deposit.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *DepositParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -671,12 +543,12 @@ func (m *DepositParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxDepositPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxDepositPeriod):]) - if err5 != nil { - return 0, err5 + n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxDepositPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxDepositPeriod):]) + if err4 != nil { + return 0, err4 } - i -= n5 - i = encodeVarintGov(dAtA, i, uint64(n5)) + i -= n4 + i = encodeVarintGov(dAtA, i, uint64(n4)) i-- dAtA[i] = 0x1a if len(m.MinDeposit) > 0 { @@ -789,21 +661,21 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime):]) + n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime):]) + if err8 != nil { + return 0, err8 + } + i -= n8 + i = encodeVarintGov(dAtA, i, uint64(n8)) + i-- + dAtA[i] = 0x5a + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime):]) if err9 != nil { return 0, err9 } i -= n9 i = encodeVarintGov(dAtA, i, uint64(n9)) i-- - dAtA[i] = 0x5a - n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime):]) - if err10 != nil { - return 0, err10 - } - i -= n10 - i = encodeVarintGov(dAtA, i, uint64(n10)) - i-- dAtA[i] = 0x52 if len(m.TotalDeposit) > 0 { for iNdEx := len(m.TotalDeposit) - 1; iNdEx >= 0; iNdEx-- { @@ -819,21 +691,21 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x4a } } - n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DepositEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime):]) + n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DepositEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime):]) + if err10 != nil { + return 0, err10 + } + i -= n10 + i = encodeVarintGov(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0x42 + n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) if err11 != nil { return 0, err11 } i -= n11 i = encodeVarintGov(dAtA, i, uint64(n11)) i-- - dAtA[i] = 0x42 - n12, err12 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) - if err12 != nil { - return 0, err12 - } - i -= n12 - i = encodeVarintGov(dAtA, i, uint64(n12)) - i-- dAtA[i] = 0x3a { size, err := m.FinalTallyResult.MarshalToSizedBuffer(dAtA[:i]) @@ -887,48 +759,6 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Vote) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Vote) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.TxHash) > 0 { - i -= len(m.TxHash) - copy(dAtA[i:], m.TxHash) - i = encodeVarintGov(dAtA, i, uint64(len(m.TxHash))) - i-- - dAtA[i] = 0x12 - } - if m.Vote != nil { - { - size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func encodeVarintGov(dAtA []byte, offset int, v uint64) int { offset -= sovGov(v) base := offset @@ -976,23 +806,6 @@ func (m *GenesisState) Size() (n int) { return n } -func (m *Deposit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Deposit != nil { - l = m.Deposit.Size() - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.TxHash) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - return n -} - func (m *DepositParams) Size() (n int) { if m == nil { return 0 @@ -1079,23 +892,6 @@ func (m *Proposal) Size() (n int) { return n } -func (m *Vote) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Vote != nil { - l = m.Vote.Size() - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.TxHash) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - return n -} - func sovGov(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1179,7 +975,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Deposits = append(m.Deposits, Deposit{}) + m.Deposits = append(m.Deposits, types.Deposit{}) if err := m.Deposits[len(m.Deposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1213,7 +1009,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Votes = append(m.Votes, Vote{}) + m.Votes = append(m.Votes, types.Vote{}) if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1357,125 +1153,10 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Deposit) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Deposit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Deposit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Deposit == nil { - m.Deposit = &types.Deposit{} - } - if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { + if skippy < 0 { return ErrInvalidLengthGov } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TxHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if (iNdEx + skippy) < 0 { return ErrInvalidLengthGov } if (iNdEx + skippy) > l { @@ -1626,7 +1307,10 @@ func (m *DepositParams) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthGov } if (iNdEx + skippy) > l { @@ -1784,7 +1468,10 @@ func (m *TallyParams) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthGov } if (iNdEx + skippy) > l { @@ -2159,125 +1846,10 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Vote) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Vote: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Vote: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Vote == nil { - m.Vote = &types.Vote{} - } - if err := m.Vote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { + if skippy < 0 { return ErrInvalidLengthGov } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TxHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if (iNdEx + skippy) < 0 { return ErrInvalidLengthGov } if (iNdEx + skippy) > l { diff --git a/x/gov/types/query.pb.go b/x/gov/types/query.pb.go index 5e87ee445..b44d67fb5 100644 --- a/x/gov/types/query.pb.go +++ b/x/gov/types/query.pb.go @@ -266,7 +266,7 @@ var xxx_messageInfo_QueryVoteRequest proto.InternalMessageInfo // QueryVoteResponse is the response type for the Query/Vote RPC method. type QueryVoteResponse struct { // vote defined the queried vote. - Vote Vote `protobuf:"bytes,1,opt,name=vote,proto3" json:"vote"` + Vote types.Vote `protobuf:"bytes,1,opt,name=vote,proto3" json:"vote"` } func (m *QueryVoteResponse) Reset() { *m = QueryVoteResponse{} } @@ -302,11 +302,11 @@ func (m *QueryVoteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryVoteResponse proto.InternalMessageInfo -func (m *QueryVoteResponse) GetVote() Vote { +func (m *QueryVoteResponse) GetVote() types.Vote { if m != nil { return m.Vote } - return Vote{} + return types.Vote{} } // QueryVotesRequest is the request type for the Query/Votes RPC method. @@ -367,7 +367,7 @@ func (m *QueryVotesRequest) GetPagination() *query.PageRequest { // QueryVotesResponse is the response type for the Query/Votes RPC method. type QueryVotesResponse struct { // votes defined the queried votes. - Votes []Vote `protobuf:"bytes,1,rep,name=votes,proto3" json:"votes"` + Votes []types.Vote `protobuf:"bytes,1,rep,name=votes,proto3" json:"votes"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -405,7 +405,7 @@ func (m *QueryVotesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryVotesResponse proto.InternalMessageInfo -func (m *QueryVotesResponse) GetVotes() []Vote { +func (m *QueryVotesResponse) GetVotes() []types.Vote { if m != nil { return m.Votes } @@ -574,7 +574,7 @@ var xxx_messageInfo_QueryDepositRequest proto.InternalMessageInfo // QueryDepositResponse is the response type for the Query/Deposit RPC method. type QueryDepositResponse struct { // deposit defines the requested deposit. - Deposit Deposit `protobuf:"bytes,1,opt,name=deposit,proto3" json:"deposit"` + Deposit types.Deposit `protobuf:"bytes,1,opt,name=deposit,proto3" json:"deposit"` } func (m *QueryDepositResponse) Reset() { *m = QueryDepositResponse{} } @@ -610,11 +610,11 @@ func (m *QueryDepositResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryDepositResponse proto.InternalMessageInfo -func (m *QueryDepositResponse) GetDeposit() Deposit { +func (m *QueryDepositResponse) GetDeposit() types.Deposit { if m != nil { return m.Deposit } - return Deposit{} + return types.Deposit{} } // QueryDepositsRequest is the request type for the Query/Deposits RPC method. @@ -674,7 +674,7 @@ func (m *QueryDepositsRequest) GetPagination() *query.PageRequest { // QueryDepositsResponse is the response type for the Query/Deposits RPC method. type QueryDepositsResponse struct { - Deposits []Deposit `protobuf:"bytes,1,rep,name=deposits,proto3" json:"deposits"` + Deposits []types.Deposit `protobuf:"bytes,1,rep,name=deposits,proto3" json:"deposits"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -712,7 +712,7 @@ func (m *QueryDepositsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryDepositsResponse proto.InternalMessageInfo -func (m *QueryDepositsResponse) GetDeposits() []Deposit { +func (m *QueryDepositsResponse) GetDeposits() []types.Deposit { if m != nil { return m.Deposits } @@ -840,70 +840,70 @@ func init() { func init() { proto.RegisterFile("shentu/gov/v1alpha1/query.proto", fileDescriptor_9f945a4e1db5124e) } var fileDescriptor_9f945a4e1db5124e = []byte{ - // 999 bytes of a gzipped FileDescriptorProto + // 998 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x3d, 0x89, 0xd3, 0xda, 0x2f, 0x6d, 0x80, 0xd7, 0x00, 0xc6, 0x4a, 0xed, 0x68, 0x11, - 0x69, 0xd2, 0x96, 0x5d, 0x39, 0x6d, 0x54, 0x29, 0x14, 0x50, 0x03, 0x2a, 0x8d, 0x40, 0x22, 0xb8, - 0x51, 0x41, 0x1c, 0x88, 0x36, 0xf1, 0xb2, 0xb1, 0x70, 0x3c, 0x5b, 0xcf, 0xd8, 0x22, 0x0a, 0x11, - 0x12, 0x27, 0x0e, 0x08, 0x21, 0x51, 0x09, 0x71, 0xf3, 0x01, 0x21, 0xf1, 0x9f, 0xf4, 0x58, 0x89, - 0x0b, 0x27, 0x84, 0x12, 0x0e, 0x48, 0xf0, 0x37, 0x20, 0xb4, 0x33, 0x6f, 0xd6, 0xbb, 0xee, 0xd6, - 0xde, 0x94, 0xaa, 0xb7, 0x78, 0xf6, 0xfb, 0xde, 0xfb, 0xbc, 0x1f, 0xf3, 0xa6, 0x85, 0xaa, 0xd8, - 0xf5, 0xda, 0xb2, 0xeb, 0xf8, 0xbc, 0xe7, 0xf4, 0x6a, 0x6e, 0x2b, 0xd8, 0x75, 0x6b, 0xce, 0xdd, - 0xae, 0xd7, 0xd9, 0xb7, 0x83, 0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, 0xea, 0x36, 0x81, 0x3e, 0x53, 0xa1, 0xa2, + 0x09, 0x12, 0x9b, 0x67, 0xd4, 0x7f, 0x5f, 0x5e, 0xf9, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x20, + 0x10, 0x6b, 0x93, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2188,7 +2188,10 @@ func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -2271,7 +2274,10 @@ func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -2440,7 +2446,10 @@ func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -2560,7 +2569,10 @@ func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -2661,7 +2673,10 @@ func (m *QueryVoteRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -2744,7 +2759,10 @@ func (m *QueryVoteResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -2849,7 +2867,10 @@ func (m *QueryVotesRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -2922,7 +2943,7 @@ func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Votes = append(m.Votes, Vote{}) + m.Votes = append(m.Votes, types.Vote{}) if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2969,7 +2990,10 @@ func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -3051,7 +3075,10 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -3200,7 +3227,10 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -3301,7 +3331,10 @@ func (m *QueryDepositRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -3384,7 +3417,10 @@ func (m *QueryDepositResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -3489,7 +3525,10 @@ func (m *QueryDepositsRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -3562,7 +3601,7 @@ func (m *QueryDepositsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Deposits = append(m.Deposits, Deposit{}) + m.Deposits = append(m.Deposits, types.Deposit{}) if err := m.Deposits[len(m.Deposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -3609,7 +3648,10 @@ func (m *QueryDepositsResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -3678,7 +3720,10 @@ func (m *QueryTallyResultRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { @@ -3761,7 +3806,10 @@ func (m *QueryTallyResultResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { diff --git a/x/gov/types/query.pb.gw.go b/x/gov/types/query.pb.gw.go index 563430db6..63a67f4a4 100644 --- a/x/gov/types/query.pb.gw.go +++ b/x/gov/types/query.pb.gw.go @@ -20,7 +20,6 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -31,7 +30,6 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage -var _ = metadata.Join func request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryProposalRequest @@ -530,14 +528,12 @@ func local_request_Query_TallyResult_0(ctx context.Context, marshaler runtime.Ma // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Proposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -545,7 +541,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Proposal_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -559,8 +554,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Proposals_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -568,7 +561,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Proposals_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -582,8 +574,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Vote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -591,7 +581,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Vote_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -605,8 +594,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Votes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -614,7 +601,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Votes_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -628,8 +614,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -637,7 +621,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -651,8 +634,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Deposit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -660,7 +641,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Deposit_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -674,8 +654,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Deposits_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -683,7 +661,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Deposits_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -697,8 +674,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_TallyResult_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -706,7 +681,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_TallyResult_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/x/gov/types/vote.go b/x/gov/types/vote.go deleted file mode 100644 index 699f42523..000000000 --- a/x/gov/types/vote.go +++ /dev/null @@ -1,18 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/gov/types" -) - -// NewVote creates a new Vote instance. -func NewVote(proposalID uint64, voter sdk.AccAddress, options types.WeightedVoteOptions, txhash string) Vote { - vote := types.NewVote(proposalID, voter, options) - return Vote{ - &vote, - txhash, - } -} - -// Votes is a collection of Vote objects. -type Votes []Vote diff --git a/x/mint/module.go b/x/mint/module.go index 595062fee..4371b8d96 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -136,7 +136,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (am AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock processes module beginblock. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { diff --git a/x/slashing/module.go b/x/slashing/module.go index f1da87a81..c647f2194 100644 --- a/x/slashing/module.go +++ b/x/slashing/module.go @@ -137,7 +137,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (am AppModule) ConsensusVersion() uint64 { return am.cosmosAppModule.ConsensusVersion() } // BeginBlock returns the begin blocker for the slashing module. func (am AppModule) BeginBlock(ctx sdk.Context, rbb abci.RequestBeginBlock) { diff --git a/x/staking/module.go b/x/staking/module.go index 70ebed1ee..822e4e43f 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -136,7 +136,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (am AppModule) ConsensusVersion() uint64 { return am.cosmosAppModule.ConsensusVersion() } // BeginBlock implements the Cosmos SDK BeginBlock module function. func (am AppModule) BeginBlock(ctx sdk.Context, rbb abci.RequestBeginBlock) {