From 448e30efca65a43b80a346e198c06b5ca0f964ab Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 13 Dec 2021 09:44:52 +0100 Subject: [PATCH 01/12] move legacy gov to v1beta1 --- go.sum | 4 - proto/cosmos/gov/v1beta1/genesis.proto | 2 +- proto/cosmos/gov/v1beta1/gov.proto | 2 +- proto/cosmos/gov/v1beta1/query.proto | 2 +- proto/cosmos/gov/v1beta1/tx.proto | 2 +- simapp/app.go | 5 +- x/auth/client/testutil/suite.go | 2 +- x/auth/middleware/tips_test.go | 2 +- x/authz/client/testutil/tx.go | 2 +- x/distribution/client/cli/tx.go | 2 +- x/distribution/handler.go | 2 +- x/distribution/types/codec.go | 2 +- x/distribution/types/proposal.go | 2 +- x/feegrant/client/testutil/suite.go | 2 +- x/gov/abci.go | 13 +- x/gov/abci_test.go | 33 +- x/gov/client/cli/tx.go | 18 +- x/gov/client/testutil/deposits.go | 20 +- x/gov/client/testutil/suite.go | 58 +- x/gov/client/utils/utils.go | 20 +- x/gov/common_test.go | 4 +- x/gov/genesis.go | 17 +- x/gov/genesis_test.go | 19 +- x/gov/keeper/common_test.go | 4 +- x/gov/keeper/deposit.go | 37 +- x/gov/keeper/grpc_query.go | 67 +- x/gov/keeper/grpc_query_test.go | 232 +- x/gov/keeper/hooks_test.go | 3 +- x/gov/keeper/invariants.go | 3 +- x/gov/keeper/keeper.go | 11 +- x/gov/keeper/keeper_test.go | 7 +- x/gov/keeper/msg_server.go | 31 +- x/gov/keeper/params.go | 19 +- x/gov/keeper/proposal.go | 45 +- x/gov/keeper/proposal_test.go | 51 +- x/gov/keeper/querier.go | 21 +- x/gov/keeper/querier_test.go | 129 +- x/gov/keeper/tally.go | 30 +- x/gov/keeper/tally_test.go | 136 +- x/gov/keeper/vote.go | 37 +- x/gov/keeper/vote_test.go | 48 +- x/gov/migrations/v040/migrate.go | 2 +- x/gov/module.go | 19 +- x/gov/simulation/decoder_test.go | 11 +- x/gov/simulation/operations.go | 81 +- x/gov/simulation/operations_test.go | 54 +- x/gov/simulation/proposals.go | 4 +- x/gov/types/codec.go | 7 - x/gov/types/content.go | 55 - x/gov/types/errors.go | 15 +- x/gov/types/events.go | 3 + x/gov/types/genesis.pb.go | 72 +- x/gov/types/gov.pb.go | 551 +--- x/gov/types/msgs.go | 72 +- x/gov/types/msgs_test.go | 43 +- x/gov/types/proposal.go | 158 +- x/gov/types/proposals_test.go | 7 +- x/gov/types/query.pb.go | 240 +- x/gov/types/query.pb.gw.go | 18 +- x/gov/types/tx.pb.go | 193 +- x/gov/types/v1beta1/codec.go | 63 + x/gov/types/v1beta1/content.go | 27 + x/gov/types/v1beta1/deposit.go | 54 + x/gov/types/v1beta1/errors.go | 13 + x/gov/types/v1beta1/genesis.go | 78 + x/gov/types/v1beta1/genesis.pb.go | 667 ++++ x/gov/types/v1beta1/gov.pb.go | 2822 +++++++++++++++++ x/gov/types/v1beta1/msgs.go | 282 ++ x/gov/types/v1beta1/msgs_test.go | 176 ++ x/gov/types/v1beta1/params.go | 198 ++ x/gov/types/v1beta1/proposal.go | 280 ++ x/gov/types/v1beta1/proposals_test.go | 24 + x/gov/types/v1beta1/querier.go | 102 + x/gov/types/v1beta1/query.pb.go | 3862 ++++++++++++++++++++++++ x/gov/types/v1beta1/query.pb.gw.go | 932 ++++++ x/gov/types/{ => v1beta1}/router.go | 2 +- x/gov/types/v1beta1/tally.go | 68 + x/gov/types/v1beta1/tx.pb.go | 1887 ++++++++++++ x/gov/types/v1beta1/vote.go | 149 + x/gov/types/vote.go | 11 +- x/params/client/cli/tx.go | 2 +- x/params/proposal_handler.go | 2 +- x/params/proposal_handler_test.go | 2 +- x/params/types/proposal/codec.go | 2 +- x/params/types/proposal/proposal.go | 2 +- x/upgrade/abci_test.go | 2 +- x/upgrade/client/cli/tx.go | 2 +- x/upgrade/handler.go | 2 +- x/upgrade/types/codec.go | 2 +- x/upgrade/types/proposal.go | 2 +- x/upgrade/types/proposal_test.go | 2 +- 91 files changed, 12877 insertions(+), 1593 deletions(-) delete mode 100644 x/gov/types/content.go create mode 100644 x/gov/types/v1beta1/codec.go create mode 100644 x/gov/types/v1beta1/content.go create mode 100644 x/gov/types/v1beta1/deposit.go create mode 100644 x/gov/types/v1beta1/errors.go create mode 100644 x/gov/types/v1beta1/genesis.go create mode 100644 x/gov/types/v1beta1/genesis.pb.go create mode 100644 x/gov/types/v1beta1/gov.pb.go create mode 100644 x/gov/types/v1beta1/msgs.go create mode 100644 x/gov/types/v1beta1/msgs_test.go create mode 100644 x/gov/types/v1beta1/params.go create mode 100644 x/gov/types/v1beta1/proposal.go create mode 100644 x/gov/types/v1beta1/proposals_test.go create mode 100644 x/gov/types/v1beta1/querier.go create mode 100644 x/gov/types/v1beta1/query.pb.go create mode 100644 x/gov/types/v1beta1/query.pb.gw.go rename x/gov/types/{ => v1beta1}/router.go (99%) create mode 100644 x/gov/types/v1beta1/tally.go create mode 100644 x/gov/types/v1beta1/tx.pb.go create mode 100644 x/gov/types/v1beta1/vote.go diff --git a/go.sum b/go.sum index 99ec34b9adbb..c2783a9c8ffb 100644 --- a/go.sum +++ b/go.sum @@ -83,7 +83,6 @@ github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/DataDog/zstd v1.4.8/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= @@ -245,7 +244,6 @@ github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOG github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/rosetta-sdk-go v0.6.10/go.mod h1:J/JFMsfcePrjJZkwQFLh+hJErkAmdm9Iyy3D5Y0LfXo= -github.com/coinbase/rosetta-sdk-go v0.7.1/go.mod h1:MZX7tpDNCZOHm1WpydIfNwpHUDXJR1Pt4xeuABqfvQo= github.com/coinbase/rosetta-sdk-go v0.7.2 h1:uCNrASIyt7rV9bA3gzPG3JDlxVP5v/zLgi01GWngncM= github.com/coinbase/rosetta-sdk-go v0.7.2/go.mod h1:wk9dvjZFSZiWSNkFuj3dMleTA1adLFotg5y71PhqKB4= github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= @@ -356,7 +354,6 @@ github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/esimonov/ifshort v1.0.3/go.mod h1:yZqNJUrNn20K8Q9n2CrjTKYyVEmX209Hgu+M1LBpeZE= github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= -github.com/ethereum/go-ethereum v1.10.11/go.mod h1:W3yfrFyL9C1pHcwY5hmRHVDaorTiQxhYBkKyu5mEDHw= github.com/ethereum/go-ethereum v1.10.13/go.mod h1:W3yfrFyL9C1pHcwY5hmRHVDaorTiQxhYBkKyu5mEDHw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= @@ -1260,7 +1257,6 @@ github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1: github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= github.com/tidwall/gjson v1.10.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/gjson v1.11.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.12.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= diff --git a/proto/cosmos/gov/v1beta1/genesis.proto b/proto/cosmos/gov/v1beta1/genesis.proto index bd6de639bf7b..be9b07e46726 100644 --- a/proto/cosmos/gov/v1beta1/genesis.proto +++ b/proto/cosmos/gov/v1beta1/genesis.proto @@ -5,7 +5,7 @@ package cosmos.gov.v1beta1; import "gogoproto/gogo.proto"; import "cosmos/gov/v1beta1/gov.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"; // GenesisState defines the gov module's genesis state. message GenesisState { diff --git a/proto/cosmos/gov/v1beta1/gov.proto b/proto/cosmos/gov/v1beta1/gov.proto index f88087eab2a2..965828b0ba75 100644 --- a/proto/cosmos/gov/v1beta1/gov.proto +++ b/proto/cosmos/gov/v1beta1/gov.proto @@ -8,7 +8,7 @@ import "google/protobuf/any.proto"; import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"; option (gogoproto.goproto_stringer_all) = false; option (gogoproto.stringer_all) = false; diff --git a/proto/cosmos/gov/v1beta1/query.proto b/proto/cosmos/gov/v1beta1/query.proto index 9757f8273c3f..e8837fd275a7 100644 --- a/proto/cosmos/gov/v1beta1/query.proto +++ b/proto/cosmos/gov/v1beta1/query.proto @@ -7,7 +7,7 @@ import "google/api/annotations.proto"; import "cosmos/gov/v1beta1/gov.proto"; import "cosmos_proto/cosmos.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"; // Query defines the gRPC querier service for gov module service Query { diff --git a/proto/cosmos/gov/v1beta1/tx.proto b/proto/cosmos/gov/v1beta1/tx.proto index f8d893363794..35c9669edaf5 100644 --- a/proto/cosmos/gov/v1beta1/tx.proto +++ b/proto/cosmos/gov/v1beta1/tx.proto @@ -7,7 +7,7 @@ import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"; // Msg defines the bank Msg service. service Msg { diff --git a/simapp/app.go b/simapp/app.go index 90a81128619a..a30120528f33 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -66,6 +66,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + oldgovtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/group" groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" @@ -295,8 +296,8 @@ func NewSimApp( app.GroupKeeper = groupkeeper.NewKeeper(keys[group.StoreKey], appCodec, app.msgSvcRouter, app.AccountKeeper) // register the proposal types - govRouter := govtypes.NewRouter() - govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler). + govRouter := oldgovtypes.NewRouter() + govRouter.AddRoute(govtypes.RouterKey, oldgovtypes.ProposalHandler). AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)). AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)) diff --git a/x/auth/client/testutil/suite.go b/x/auth/client/testutil/suite.go index 29d604651754..9120e21a5539 100644 --- a/x/auth/client/testutil/suite.go +++ b/x/auth/client/testutil/suite.go @@ -35,7 +35,7 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" govtestutil "github.com/cosmos/cosmos-sdk/x/gov/client/testutil" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) type IntegrationTestSuite struct { diff --git a/x/auth/middleware/tips_test.go b/x/auth/middleware/tips_test.go index d0b987ad6fc7..f55c2501858c 100644 --- a/x/auth/middleware/tips_test.go +++ b/x/auth/middleware/tips_test.go @@ -13,7 +13,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" ) diff --git a/x/authz/client/testutil/tx.go b/x/authz/client/testutil/tx.go index 48fe9c04ff10..f3f245e1f52c 100644 --- a/x/authz/client/testutil/tx.go +++ b/x/authz/client/testutil/tx.go @@ -19,7 +19,7 @@ import ( bank "github.com/cosmos/cosmos-sdk/x/bank/types" govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" govtestutil "github.com/cosmos/cosmos-sdk/x/gov/client/testutil" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" stakingcli "github.com/cosmos/cosmos-sdk/x/staking/client/cli" ) diff --git a/x/distribution/client/cli/tx.go b/x/distribution/client/cli/tx.go index ccbf5d8c6dbb..d9ec9feeebbc 100644 --- a/x/distribution/client/cli/tx.go +++ b/x/distribution/client/cli/tx.go @@ -13,7 +13,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // Transaction flags for the x/distribution module diff --git a/x/distribution/handler.go b/x/distribution/handler.go index f356aee32845..a8aa8eb3e58f 100644 --- a/x/distribution/handler.go +++ b/x/distribution/handler.go @@ -5,7 +5,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/distribution/keeper" "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) func NewCommunityPoolSpendProposalHandler(k keeper.Keeper) govtypes.Handler { diff --git a/x/distribution/types/codec.go b/x/distribution/types/codec.go index 73aca45060e6..0e1d1df42be3 100644 --- a/x/distribution/types/codec.go +++ b/x/distribution/types/codec.go @@ -6,7 +6,7 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // RegisterLegacyAminoCodec registers the necessary x/distribution interfaces and concrete types diff --git a/x/distribution/types/proposal.go b/x/distribution/types/proposal.go index 070bce7e3818..b903014a8255 100644 --- a/x/distribution/types/proposal.go +++ b/x/distribution/types/proposal.go @@ -5,7 +5,7 @@ import ( "strings" sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) const ( diff --git a/x/feegrant/client/testutil/suite.go b/x/feegrant/client/testutil/suite.go index 74380ab14fba..f30dc2a40e36 100644 --- a/x/feegrant/client/testutil/suite.go +++ b/x/feegrant/client/testutil/suite.go @@ -21,7 +21,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/feegrant" "github.com/cosmos/cosmos-sdk/x/feegrant/client/cli" govtestutil "github.com/cosmos/cosmos-sdk/x/gov/client/testutil" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) const ( diff --git a/x/gov/abci.go b/x/gov/abci.go index c05c261d2d22..f7bdbcfa9710 100644 --- a/x/gov/abci.go +++ b/x/gov/abci.go @@ -8,16 +8,17 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/keeper" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // EndBlocker called every block, process inflation, update validator set. func EndBlocker(ctx sdk.Context, keeper keeper.Keeper) { - defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker) + defer telemetry.ModuleMeasureSince(v1beta1.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker) logger := keeper.Logger(ctx) // delete dead proposals from store and burn theirs deposits. A proposal is dead when it's inactive and didn't get enough deposit on time to get into voting phase. - keeper.IterateInactiveProposalsQueue(ctx, ctx.BlockHeader().Time, func(proposal types.Proposal) bool { + keeper.IterateInactiveProposalsQueue(ctx, ctx.BlockHeader().Time, func(proposal v1beta1.Proposal) bool { keeper.DeleteProposal(ctx, proposal.ProposalId) keeper.DeleteAndBurnDeposits(ctx, proposal.ProposalId) @@ -44,7 +45,7 @@ func EndBlocker(ctx sdk.Context, keeper keeper.Keeper) { }) // fetch active proposals whose voting periods have ended (are passed the block time) - keeper.IterateActiveProposalsQueue(ctx, ctx.BlockHeader().Time, func(proposal types.Proposal) bool { + keeper.IterateActiveProposalsQueue(ctx, ctx.BlockHeader().Time, func(proposal v1beta1.Proposal) bool { var tagValue, logMsg string passes, burnDeposits, tallyResults := keeper.Tally(ctx, proposal) @@ -64,7 +65,7 @@ func EndBlocker(ctx sdk.Context, keeper keeper.Keeper) { // is written and the error message is logged. err := handler(cacheCtx, proposal.GetContent()) if err == nil { - proposal.Status = types.StatusPassed + proposal.Status = v1beta1.StatusPassed tagValue = types.AttributeValueProposalPassed logMsg = "passed" @@ -77,12 +78,12 @@ func EndBlocker(ctx sdk.Context, keeper keeper.Keeper) { // write state to the underlying multi-store writeCache() } else { - proposal.Status = types.StatusFailed + proposal.Status = v1beta1.StatusFailed tagValue = types.AttributeValueProposalFailed logMsg = fmt.Sprintf("passed, but failed on execution: %s", err) } } else { - proposal.Status = types.StatusRejected + proposal.Status = v1beta1.StatusRejected tagValue = types.AttributeValueProposalRejected logMsg = "rejected" } diff --git a/x/gov/abci_test.go b/x/gov/abci_test.go index 99f6768f854c..0bc855bce04f 100644 --- a/x/gov/abci_test.go +++ b/x/gov/abci_test.go @@ -13,6 +13,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/gov/keeper" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -32,8 +33,8 @@ func TestTickExpiredDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() - newProposalMsg, err := types.NewMsgSubmitProposal( - types.ContentFromProposalType("test", "test", types.ProposalTypeText), + newProposalMsg, err := v1beta1.NewMsgSubmitProposal( + v1beta1.ContentFromProposalType("test", "test", v1beta1.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], ) @@ -84,8 +85,8 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() - newProposalMsg, err := types.NewMsgSubmitProposal( - types.ContentFromProposalType("test", "test", types.ProposalTypeText), + newProposalMsg, err := v1beta1.NewMsgSubmitProposal( + v1beta1.ContentFromProposalType("test", "test", v1beta1.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], ) @@ -107,8 +108,8 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() - newProposalMsg2, err := types.NewMsgSubmitProposal( - types.ContentFromProposalType("test2", "test2", types.ProposalTypeText), + newProposalMsg2, err := v1beta1.NewMsgSubmitProposal( + v1beta1.ContentFromProposalType("test2", "test2", v1beta1.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], ) @@ -164,8 +165,8 @@ func TestTickPassedDepositPeriod(t *testing.T) { require.False(t, activeQueue.Valid()) activeQueue.Close() - newProposalMsg, err := types.NewMsgSubmitProposal( - types.ContentFromProposalType("test2", "test2", types.ProposalTypeText), + newProposalMsg, err := v1beta1.NewMsgSubmitProposal( + v1beta1.ContentFromProposalType("test2", "test2", v1beta1.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], ) @@ -189,7 +190,7 @@ func TestTickPassedDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() - newDepositMsg := types.NewMsgDeposit(addrs[1], proposalID, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}) + newDepositMsg := v1beta1.NewMsgDeposit(addrs[1], proposalID, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}) res1, err := govMsgSvr.Deposit(sdk.WrapSDKContext(ctx), newDepositMsg) require.NoError(t, err) @@ -220,7 +221,7 @@ func TestTickPassedVotingPeriod(t *testing.T) { activeQueue.Close() proposalCoins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, app.StakingKeeper.TokensFromConsensusPower(ctx, 5))} - newProposalMsg, err := types.NewMsgSubmitProposal(TestProposal, proposalCoins, addrs[0]) + newProposalMsg, err := v1beta1.NewMsgSubmitProposal(TestProposal, proposalCoins, addrs[0]) require.NoError(t, err) wrapCtx := sdk.WrapSDKContext(ctx) @@ -235,7 +236,7 @@ func TestTickPassedVotingPeriod(t *testing.T) { newHeader.Time = ctx.BlockHeader().Time.Add(time.Duration(1) * time.Second) ctx = ctx.WithBlockHeader(newHeader) - newDepositMsg := types.NewMsgDeposit(addrs[1], proposalID, proposalCoins) + newDepositMsg := v1beta1.NewMsgDeposit(addrs[1], proposalID, proposalCoins) res1, err := govMsgSvr.Deposit(wrapCtx, newDepositMsg) require.NoError(t, err) @@ -255,7 +256,7 @@ func TestTickPassedVotingPeriod(t *testing.T) { activeProposalID := types.GetProposalIDFromBytes(activeQueue.Value()) proposal, ok := app.GovKeeper.GetProposal(ctx, activeProposalID) require.True(t, ok) - require.Equal(t, types.StatusVotingPeriod, proposal.Status) + require.Equal(t, v1beta1.StatusVotingPeriod, proposal.Status) activeQueue.Close() @@ -292,7 +293,7 @@ func TestProposalPassedEndblocker(t *testing.T) { require.NoError(t, err) proposalCoins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, app.StakingKeeper.TokensFromConsensusPower(ctx, 10))} - newDepositMsg := types.NewMsgDeposit(addrs[0], proposal.ProposalId, proposalCoins) + newDepositMsg := v1beta1.NewMsgDeposit(addrs[0], proposal.ProposalId, proposalCoins) res, err := govMsgSvr.Deposit(sdk.WrapSDKContext(ctx), newDepositMsg) require.NoError(t, err) @@ -305,7 +306,7 @@ func TestProposalPassedEndblocker(t *testing.T) { deposits := initialModuleAccCoins.Add(proposal.TotalDeposit...).Add(proposalCoins...) require.True(t, moduleAccCoins.IsEqual(deposits)) - err = app.GovKeeper.AddVote(ctx, proposal.ProposalId, addrs[0], types.NewNonSplitVoteOption(types.OptionYes)) + err = app.GovKeeper.AddVote(ctx, proposal.ProposalId, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)) require.NoError(t, err) newHeader := ctx.BlockHeader() @@ -342,14 +343,14 @@ func TestEndBlockerProposalHandlerFailed(t *testing.T) { require.NoError(t, err) proposalCoins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, app.StakingKeeper.TokensFromConsensusPower(ctx, 10))) - newDepositMsg := types.NewMsgDeposit(addrs[0], proposal.ProposalId, proposalCoins) + newDepositMsg := v1beta1.NewMsgDeposit(addrs[0], proposal.ProposalId, proposalCoins) govMsgSvr := keeper.NewMsgServerImpl(app.GovKeeper) res, err := govMsgSvr.Deposit(sdk.WrapSDKContext(ctx), newDepositMsg) require.NoError(t, err) require.NotNil(t, res) - err = app.GovKeeper.AddVote(ctx, proposal.ProposalId, addrs[0], types.NewNonSplitVoteOption(types.OptionYes)) + err = app.GovKeeper.AddVote(ctx, proposal.ProposalId, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)) require.NoError(t, err) newHeader := ctx.BlockHeader() diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index c20df19f6927..30bede4d6a0e 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -13,7 +13,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" govutils "github.com/cosmos/cosmos-sdk/x/gov/client/utils" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // Proposal flags @@ -52,7 +52,7 @@ var ProposalFlags = []string{ // under the governance CLI (eg. parameter change proposals). func NewTxCmd(propCmds []*cobra.Command) *cobra.Command { govTxCmd := &cobra.Command{ - Use: types.ModuleName, + Use: v1beta1.ModuleName, Short: "Governance transactions subcommands", DisableFlagParsing: true, SuggestionsMinimumDistance: 2, @@ -119,9 +119,9 @@ $ %s tx gov submit-proposal --title="Test Proposal" --description="My awesome pr return err } - content := types.ContentFromProposalType(proposal.Title, proposal.Description, proposal.Type) + content := v1beta1.ContentFromProposalType(proposal.Title, proposal.Description, proposal.Type) - msg, err := types.NewMsgSubmitProposal(content, amount, clientCtx.GetFromAddress()) + msg, err := v1beta1.NewMsgSubmitProposal(content, amount, clientCtx.GetFromAddress()) if err != nil { return fmt.Errorf("invalid message: %w", err) } @@ -177,7 +177,7 @@ $ %s tx gov deposit 1 10stake --from mykey return err } - msg := types.NewMsgDeposit(from, proposalID, amount) + msg := v1beta1.NewMsgDeposit(from, proposalID, amount) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, @@ -219,13 +219,13 @@ $ %s tx gov vote 1 yes --from mykey } // Find out which vote option user chose - byteVoteOption, err := types.VoteOptionFromString(govutils.NormalizeVoteOption(args[1])) + byteVoteOption, err := v1beta1.VoteOptionFromString(govutils.NormalizeVoteOption(args[1])) if err != nil { return err } // Build vote message and run basic validation - msg := types.NewMsgVote(from, proposalID, byteVoteOption) + msg := v1beta1.NewMsgVote(from, proposalID, byteVoteOption) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, @@ -268,13 +268,13 @@ $ %s tx gov weighted-vote 1 yes=0.6,no=0.3,abstain=0.05,no_with_veto=0.05 --from } // Figure out which vote options user chose - options, err := types.WeightedVoteOptionsFromString(govutils.NormalizeWeightedVoteOptions(args[1])) + options, err := v1beta1.WeightedVoteOptionsFromString(govutils.NormalizeWeightedVoteOptions(args[1])) if err != nil { return err } // Build vote message and run basic validation - msg := types.NewMsgVoteWeighted(from, proposalID, options) + msg := v1beta1.NewMsgVoteWeighted(from, proposalID, options) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/gov/client/testutil/deposits.go b/x/gov/client/testutil/deposits.go index e13c005ba8a6..7cd765e7e748 100644 --- a/x/gov/client/testutil/deposits.go +++ b/x/gov/client/testutil/deposits.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) type DepositTestSuite struct { @@ -41,7 +41,7 @@ func (s *DepositTestSuite) SetupSuite() { deposits := sdk.Coins{ sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(0)), - sdk.NewCoin(s.cfg.BondDenom, types.DefaultMinDepositTokens.Sub(sdk.NewInt(50))), + sdk.NewCoin(s.cfg.BondDenom, v1beta1.DefaultMinDepositTokens.Sub(sdk.NewInt(50))), } s.deposits = deposits @@ -78,7 +78,7 @@ func (s *DepositTestSuite) createProposal(val *network.Validator, initialDeposit val.Address.String(), fmt.Sprintf("Text Proposal %d", id), "Where is the title!?", - types.ProposalTypeText, + v1beta1.ProposalTypeText, exactArgs..., ) @@ -98,7 +98,7 @@ func (s *DepositTestSuite) TestQueryDepositsWithoutInitialDeposit() { proposalID := s.proposalIDs[0] // deposit amount - depositAmount := sdk.NewCoin(s.cfg.BondDenom, types.DefaultMinDepositTokens.Add(sdk.NewInt(50))).String() + depositAmount := sdk.NewCoin(s.cfg.BondDenom, v1beta1.DefaultMinDepositTokens.Add(sdk.NewInt(50))).String() _, err := MsgDeposit(clientCtx, val.Address.String(), proposalID, depositAmount) s.Require().NoError(err) @@ -146,14 +146,14 @@ func (s *DepositTestSuite) TestRejectedProposalDeposits() { val := s.network.Validators[0] clientCtx := val.ClientCtx - initialDeposit := sdk.NewCoin(s.cfg.BondDenom, types.DefaultMinDepositTokens) + initialDeposit := sdk.NewCoin(s.cfg.BondDenom, v1beta1.DefaultMinDepositTokens) id := 1 proposalID := fmt.Sprintf("%d", id) s.createProposal(val, initialDeposit, id) // query deposits - var deposits types.QueryDepositsResponse + var deposits v1beta1.QueryDepositsResponse args := []string{proposalID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)} cmd := cli.GetCmdQueryDeposits() out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) @@ -183,9 +183,9 @@ func (s *DepositTestSuite) TestRejectedProposalDeposits() { s.Require().Equal(depositsRes.Deposits[0].Amount.String(), initialDeposit.String()) } -func (s *DepositTestSuite) queryDeposits(val *network.Validator, proposalID string, exceptErr bool, message string) *types.QueryDepositsResponse { +func (s *DepositTestSuite) queryDeposits(val *network.Validator, proposalID string, exceptErr bool, message string) *v1beta1.QueryDepositsResponse { args := []string{proposalID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)} - var depositsRes *types.QueryDepositsResponse + var depositsRes *v1beta1.QueryDepositsResponse cmd := cli.GetCmdQueryDeposits() out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) @@ -200,9 +200,9 @@ func (s *DepositTestSuite) queryDeposits(val *network.Validator, proposalID stri return depositsRes } -func (s *DepositTestSuite) queryDeposit(val *network.Validator, proposalID string, exceptErr bool, message string) *types.Deposit { +func (s *DepositTestSuite) queryDeposit(val *network.Validator, proposalID string, exceptErr bool, message string) *v1beta1.Deposit { args := []string{proposalID, val.Address.String(), fmt.Sprintf("--%s=json", tmcli.OutputFlag)} - var depositRes *types.Deposit + var depositRes *v1beta1.Deposit cmd := cli.GetCmdQueryDeposit() out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) if exceptErr { diff --git a/x/gov/client/testutil/suite.go b/x/gov/client/testutil/suite.go index ba1db3ff6272..0dc7a3cf9175 100644 --- a/x/gov/client/testutil/suite.go +++ b/x/gov/client/testutil/suite.go @@ -16,7 +16,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) type IntegrationTestSuite struct { @@ -44,8 +44,8 @@ func (s *IntegrationTestSuite) SetupSuite() { // create a proposal with deposit _, err = MsgSubmitProposal(val.ClientCtx, val.Address.String(), - "Text Proposal 1", "Where is the title!?", types.ProposalTypeText, - fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, types.DefaultMinDepositTokens).String())) + "Text Proposal 1", "Where is the title!?", v1beta1.ProposalTypeText, + fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, v1beta1.DefaultMinDepositTokens).String())) s.Require().NoError(err) _, err = s.network.WaitForHeight(1) s.Require().NoError(err) @@ -56,15 +56,15 @@ func (s *IntegrationTestSuite) SetupSuite() { // create a proposal without deposit _, err = MsgSubmitProposal(val.ClientCtx, val.Address.String(), - "Text Proposal 2", "Where is the title!?", types.ProposalTypeText) + "Text Proposal 2", "Where is the title!?", v1beta1.ProposalTypeText) s.Require().NoError(err) _, err = s.network.WaitForHeight(1) s.Require().NoError(err) // create a proposal3 with deposit _, err = MsgSubmitProposal(val.ClientCtx, val.Address.String(), - "Text Proposal 3", "Where is the title!?", types.ProposalTypeText, - fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, types.DefaultMinDepositTokens).String())) + "Text Proposal 3", "Where is the title!?", v1beta1.ProposalTypeText, + fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, v1beta1.DefaultMinDepositTokens).String())) s.Require().NoError(err) _, err = s.network.WaitForHeight(1) s.Require().NoError(err) @@ -226,7 +226,7 @@ func (s *IntegrationTestSuite) TestCmdTally() { name string args []string expectErr bool - expectedOutput types.TallyResult + expectedOutput v1beta1.TallyResult }{ { "without proposal id", @@ -234,7 +234,7 @@ func (s *IntegrationTestSuite) TestCmdTally() { fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, true, - types.TallyResult{}, + v1beta1.TallyResult{}, }, { "json output", @@ -243,7 +243,7 @@ func (s *IntegrationTestSuite) TestCmdTally() { fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, false, - types.NewTallyResult(sdk.NewInt(0), sdk.NewInt(0), sdk.NewInt(0), sdk.NewInt(0)), + v1beta1.NewTallyResult(sdk.NewInt(0), sdk.NewInt(0), sdk.NewInt(0), sdk.NewInt(0)), }, { "json output", @@ -252,7 +252,7 @@ func (s *IntegrationTestSuite) TestCmdTally() { fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, false, - types.NewTallyResult(s.cfg.BondedTokens, sdk.NewInt(0), sdk.NewInt(0), sdk.NewInt(0)), + v1beta1.NewTallyResult(s.cfg.BondedTokens, sdk.NewInt(0), sdk.NewInt(0), sdk.NewInt(0)), }, } @@ -267,7 +267,7 @@ func (s *IntegrationTestSuite) TestCmdTally() { if tc.expectErr { s.Require().Error(err) } else { - var tally types.TallyResult + var tally v1beta1.TallyResult s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &tally), out.String()) s.Require().Equal(tally, tc.expectedOutput) } @@ -312,7 +312,7 @@ func (s *IntegrationTestSuite) TestNewCmdSubmitProposal() { "invalid proposal", []string{ fmt.Sprintf("--%s='Where is the title!?'", cli.FlagDescription), - fmt.Sprintf("--%s=%s", cli.FlagProposalType, types.ProposalTypeText), + fmt.Sprintf("--%s=%s", cli.FlagProposalType, v1beta1.ProposalTypeText), fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(5431)).String()), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), @@ -336,7 +336,7 @@ func (s *IntegrationTestSuite) TestNewCmdSubmitProposal() { []string{ fmt.Sprintf("--%s='Text Proposal'", cli.FlagTitle), fmt.Sprintf("--%s='Where is the title!?'", cli.FlagDescription), - fmt.Sprintf("--%s=%s", cli.FlagProposalType, types.ProposalTypeText), + fmt.Sprintf("--%s=%s", cli.FlagProposalType, v1beta1.ProposalTypeText), fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(5431)).String()), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), @@ -407,7 +407,7 @@ func (s *IntegrationTestSuite) TestCmdGetProposal() { s.Require().Error(err) } else { s.Require().NoError(err) - var proposal types.Proposal + var proposal v1beta1.Proposal s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &proposal), out.String()) s.Require().Equal(title, proposal.GetTitle()) } @@ -452,7 +452,7 @@ func (s *IntegrationTestSuite) TestCmdGetProposals() { s.Require().Error(err) } else { s.Require().NoError(err) - var proposals types.QueryProposalsResponse + var proposals v1beta1.QueryProposalsResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &proposals), out.String()) s.Require().Len(proposals.Proposals, 3) @@ -499,7 +499,7 @@ func (s *IntegrationTestSuite) TestCmdQueryDeposits() { } else { s.Require().NoError(err) - var deposits types.QueryDepositsResponse + var deposits v1beta1.QueryDepositsResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &deposits), out.String()) s.Require().Len(deposits.Deposits, 1) } @@ -509,7 +509,7 @@ func (s *IntegrationTestSuite) TestCmdQueryDeposits() { func (s *IntegrationTestSuite) TestCmdQueryDeposit() { val := s.network.Validators[0] - depositAmount := sdk.NewCoin(s.cfg.BondDenom, types.DefaultMinDepositTokens) + depositAmount := sdk.NewCoin(s.cfg.BondDenom, v1beta1.DefaultMinDepositTokens) testCases := []struct { name string @@ -555,7 +555,7 @@ func (s *IntegrationTestSuite) TestCmdQueryDeposit() { } else { s.Require().NoError(err) - var deposit types.Deposit + var deposit v1beta1.Deposit s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &deposit), out.String()) s.Require().Equal(depositAmount.String(), deposit.Amount.String()) } @@ -684,7 +684,7 @@ func (s *IntegrationTestSuite) TestCmdQueryVotes() { } else { s.Require().NoError(err) - var votes types.QueryVotesResponse + var votes v1beta1.QueryVotesResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &votes), out.String()) s.Require().Len(votes.Votes, 1) } @@ -699,7 +699,7 @@ func (s *IntegrationTestSuite) TestCmdQueryVote() { name string args []string expectErr bool - expVoteOptions types.WeightedVoteOptions + expVoteOptions v1beta1.WeightedVoteOptions }{ { "get vote of non existing proposal", @@ -708,7 +708,7 @@ func (s *IntegrationTestSuite) TestCmdQueryVote() { val.Address.String(), }, true, - types.NewNonSplitVoteOption(types.OptionYes), + v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes), }, { "get vote by wrong voter", @@ -717,7 +717,7 @@ func (s *IntegrationTestSuite) TestCmdQueryVote() { "wrong address", }, true, - types.NewNonSplitVoteOption(types.OptionYes), + v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes), }, { "vote for valid proposal", @@ -727,7 +727,7 @@ func (s *IntegrationTestSuite) TestCmdQueryVote() { fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, false, - types.NewNonSplitVoteOption(types.OptionYes), + v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes), }, { "split vote for valid proposal", @@ -737,11 +737,11 @@ func (s *IntegrationTestSuite) TestCmdQueryVote() { fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, false, - types.WeightedVoteOptions{ - types.WeightedVoteOption{Option: types.OptionYes, Weight: sdk.NewDecWithPrec(60, 2)}, - types.WeightedVoteOption{Option: types.OptionNo, Weight: sdk.NewDecWithPrec(30, 2)}, - types.WeightedVoteOption{Option: types.OptionAbstain, Weight: sdk.NewDecWithPrec(5, 2)}, - types.WeightedVoteOption{Option: types.OptionNoWithVeto, Weight: sdk.NewDecWithPrec(5, 2)}, + v1beta1.WeightedVoteOptions{ + v1beta1.WeightedVoteOption{Option: v1beta1.OptionYes, Weight: sdk.NewDecWithPrec(60, 2)}, + v1beta1.WeightedVoteOption{Option: v1beta1.OptionNo, Weight: sdk.NewDecWithPrec(30, 2)}, + v1beta1.WeightedVoteOption{Option: v1beta1.OptionAbstain, Weight: sdk.NewDecWithPrec(5, 2)}, + v1beta1.WeightedVoteOption{Option: v1beta1.OptionNoWithVeto, Weight: sdk.NewDecWithPrec(5, 2)}, }, }, } @@ -759,7 +759,7 @@ func (s *IntegrationTestSuite) TestCmdQueryVote() { } else { s.Require().NoError(err) - var vote types.Vote + var vote v1beta1.Vote s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &vote), out.String()) s.Require().Equal(len(vote.Options), len(tc.expVoteOptions)) for i, option := range tc.expVoteOptions { diff --git a/x/gov/client/utils/utils.go b/x/gov/client/utils/utils.go index f0bf6ead263a..165bf09d13ba 100644 --- a/x/gov/client/utils/utils.go +++ b/x/gov/client/utils/utils.go @@ -3,23 +3,23 @@ package utils import ( "strings" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // NormalizeVoteOption - normalize user specified vote option func NormalizeVoteOption(option string) string { switch option { case "Yes", "yes": - return types.OptionYes.String() + return v1beta1.OptionYes.String() case "Abstain", "abstain": - return types.OptionAbstain.String() + return v1beta1.OptionAbstain.String() case "No", "no": - return types.OptionNo.String() + return v1beta1.OptionNo.String() case "NoWithVeto", "no_with_veto": - return types.OptionNoWithVeto.String() + return v1beta1.OptionNoWithVeto.String() default: return option @@ -44,7 +44,7 @@ func NormalizeWeightedVoteOptions(options string) string { func NormalizeProposalType(proposalType string) string { switch proposalType { case "Text", "text": - return types.ProposalTypeText + return v1beta1.ProposalTypeText default: return "" @@ -55,13 +55,13 @@ func NormalizeProposalType(proposalType string) string { func NormalizeProposalStatus(status string) string { switch status { case "DepositPeriod", "deposit_period": - return types.StatusDepositPeriod.String() + return v1beta1.StatusDepositPeriod.String() case "VotingPeriod", "voting_period": - return types.StatusVotingPeriod.String() + return v1beta1.StatusVotingPeriod.String() case "Passed", "passed": - return types.StatusPassed.String() + return v1beta1.StatusPassed.String() case "Rejected", "rejected": - return types.StatusRejected.String() + return v1beta1.StatusRejected.String() default: return status } diff --git a/x/gov/common_test.go b/x/gov/common_test.go index e0a79835280c..dc1d9ad63e77 100644 --- a/x/gov/common_test.go +++ b/x/gov/common_test.go @@ -8,13 +8,13 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) var ( valTokens = sdk.TokensFromConsensusPower(42, sdk.DefaultPowerReduction) - TestProposal = types.NewTextProposal("Test", "description") + TestProposal = v1beta1.NewTextProposal("Test", "description") TestDescription = stakingtypes.NewDescription("T", "E", "S", "T", "Z") TestCommissionRates = stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()) ) diff --git a/x/gov/genesis.go b/x/gov/genesis.go index 62a194d9c0a9..41030b188ad7 100644 --- a/x/gov/genesis.go +++ b/x/gov/genesis.go @@ -6,10 +6,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/keeper" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // InitGenesis - store genesis parameters -func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, data *types.GenesisState) { +func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, data *v1beta1.GenesisState) { k.SetProposalID(ctx, data.StartingProposalId) k.SetDepositParams(ctx, data.DepositParams) k.SetVotingParams(ctx, data.VotingParams) @@ -18,7 +19,7 @@ func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k // check if the deposits pool account exists moduleAcc := k.GetGovernanceAccount(ctx) if moduleAcc == nil { - panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) + panic(fmt.Sprintf("%s module account has not been set", v1beta1.ModuleName)) } var totalDeposits sdk.Coins @@ -33,9 +34,9 @@ func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k for _, proposal := range data.Proposals { switch proposal.Status { - case types.StatusDepositPeriod: + case v1beta1.StatusDepositPeriod: k.InsertInactiveProposalQueue(ctx, proposal.ProposalId, proposal.DepositEndTime) - case types.StatusVotingPeriod: + case v1beta1.StatusVotingPeriod: k.InsertActiveProposalQueue(ctx, proposal.ProposalId, proposal.VotingEndTime) } k.SetProposal(ctx, proposal) @@ -54,15 +55,15 @@ func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k } // ExportGenesis - output genesis parameters -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *v1beta1.GenesisState { startingProposalID, _ := k.GetProposalID(ctx) depositParams := k.GetDepositParams(ctx) votingParams := k.GetVotingParams(ctx) tallyParams := k.GetTallyParams(ctx) proposals := k.GetProposals(ctx) - var proposalsDeposits types.Deposits - var proposalsVotes types.Votes + var proposalsDeposits v1beta1.Deposits + var proposalsVotes v1beta1.Votes for _, proposal := range proposals { deposits := k.GetDeposits(ctx, proposal.ProposalId) proposalsDeposits = append(proposalsDeposits, deposits...) @@ -71,7 +72,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { proposalsVotes = append(proposalsVotes, votes...) } - return &types.GenesisState{ + return &v1beta1.GenesisState{ StartingProposalId: startingProposalID, Deposits: proposalsDeposits, Votes: proposalsVotes, diff --git a/x/gov/genesis_test.go b/x/gov/genesis_test.go index 38750d7ed3cd..a3eef13f691a 100644 --- a/x/gov/genesis_test.go +++ b/x/gov/genesis_test.go @@ -18,6 +18,7 @@ import ( distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -52,8 +53,8 @@ func TestImportExportQueues(t *testing.T) { require.True(t, ok) proposal2, ok = app.GovKeeper.GetProposal(ctx, proposalID2) require.True(t, ok) - require.True(t, proposal1.Status == types.StatusDepositPeriod) - require.True(t, proposal2.Status == types.StatusVotingPeriod) + require.True(t, proposal1.Status == v1beta1.StatusDepositPeriod) + require.True(t, proposal2.Status == v1beta1.StatusVotingPeriod) authGenState := auth.ExportGenesis(ctx, app.AccountKeeper) bankGenState := app.BankKeeper.ExportGenesis(ctx) @@ -102,8 +103,8 @@ func TestImportExportQueues(t *testing.T) { require.True(t, ok) proposal2, ok = app2.GovKeeper.GetProposal(ctx2, proposalID2) require.True(t, ok) - require.True(t, proposal1.Status == types.StatusDepositPeriod) - require.True(t, proposal2.Status == types.StatusVotingPeriod) + require.True(t, proposal1.Status == v1beta1.StatusDepositPeriod) + require.True(t, proposal2.Status == v1beta1.StatusVotingPeriod) macc := app2.GovKeeper.GetGovernanceAccount(ctx2) require.Equal(t, app2.GovKeeper.GetDepositParams(ctx2).MinDeposit, app2.BankKeeper.GetAllBalances(ctx2, macc.GetAddress())) @@ -116,15 +117,15 @@ func TestImportExportQueues(t *testing.T) { proposal2, ok = app2.GovKeeper.GetProposal(ctx2, proposalID2) require.True(t, ok) - require.True(t, proposal2.Status == types.StatusRejected) + require.True(t, proposal2.Status == v1beta1.StatusRejected) } func TestImportExportQueues_ErrorUnconsistentState(t *testing.T) { app := simapp.Setup(t, false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) require.Panics(t, func() { - gov.InitGenesis(ctx, app.AccountKeeper, app.BankKeeper, app.GovKeeper, &types.GenesisState{ - Deposits: types.Deposits{ + gov.InitGenesis(ctx, app.AccountKeeper, app.BankKeeper, app.GovKeeper, &v1beta1.GenesisState{ + Deposits: v1beta1.Deposits{ { ProposalId: 1234, Depositor: "me", @@ -163,8 +164,8 @@ func TestEqualProposals(t *testing.T) { require.NotEqual(t, proposal1, proposal2) // Now create two genesis blocks - state1 := types.GenesisState{Proposals: []types.Proposal{proposal1}} - state2 := types.GenesisState{Proposals: []types.Proposal{proposal2}} + state1 := v1beta1.GenesisState{Proposals: []v1beta1.Proposal{proposal1}} + state2 := v1beta1.GenesisState{Proposals: []v1beta1.Proposal{proposal2}} require.NotEqual(t, state1, state2) require.False(t, state1.Equal(state2)) diff --git a/x/gov/keeper/common_test.go b/x/gov/keeper/common_test.go index 89da4e06074d..195938860514 100644 --- a/x/gov/keeper/common_test.go +++ b/x/gov/keeper/common_test.go @@ -7,14 +7,14 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) var ( - TestProposal = types.NewTextProposal("Test", "description") + TestProposal = v1beta1.NewTextProposal("Test", "description") ) func createValidators(t *testing.T, ctx sdk.Context, app *simapp.SimApp, powers []int64) ([]sdk.AccAddress, []sdk.ValAddress) { diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 10eca5d511b2..c484fcbdadb4 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -6,10 +6,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // GetDeposit gets the deposit of a specific depositor on a specific proposal -func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit types.Deposit, found bool) { +func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit v1beta1.Deposit, found bool) { store := ctx.KVStore(keeper.storeKey) bz := store.Get(types.DepositKey(proposalID, depositorAddr)) if bz == nil { @@ -22,7 +23,7 @@ func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAdd } // SetDeposit sets a Deposit to the gov store -func (keeper Keeper) SetDeposit(ctx sdk.Context, deposit types.Deposit) { +func (keeper Keeper) SetDeposit(ctx sdk.Context, deposit v1beta1.Deposit) { store := ctx.KVStore(keeper.storeKey) bz := keeper.cdc.MustMarshal(&deposit) depositor, err := sdk.AccAddressFromBech32(deposit.Depositor) @@ -34,8 +35,8 @@ func (keeper Keeper) SetDeposit(ctx sdk.Context, deposit types.Deposit) { } // GetAllDeposits returns all the deposits from the store -func (keeper Keeper) GetAllDeposits(ctx sdk.Context) (deposits types.Deposits) { - keeper.IterateAllDeposits(ctx, func(deposit types.Deposit) bool { +func (keeper Keeper) GetAllDeposits(ctx sdk.Context) (deposits v1beta1.Deposits) { + keeper.IterateAllDeposits(ctx, func(deposit v1beta1.Deposit) bool { deposits = append(deposits, deposit) return false }) @@ -44,8 +45,8 @@ func (keeper Keeper) GetAllDeposits(ctx sdk.Context) (deposits types.Deposits) { } // GetDeposits returns all the deposits from a proposal -func (keeper Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits types.Deposits) { - keeper.IterateDeposits(ctx, proposalID, func(deposit types.Deposit) bool { +func (keeper Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits v1beta1.Deposits) { + keeper.IterateDeposits(ctx, proposalID, func(deposit v1beta1.Deposit) bool { deposits = append(deposits, deposit) return false }) @@ -57,8 +58,8 @@ func (keeper Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits t func (keeper Keeper) DeleteAndBurnDeposits(ctx sdk.Context, proposalID uint64) { store := ctx.KVStore(keeper.storeKey) - keeper.IterateDeposits(ctx, proposalID, func(deposit types.Deposit) bool { - err := keeper.bankKeeper.BurnCoins(ctx, types.ModuleName, deposit.Amount) + keeper.IterateDeposits(ctx, proposalID, func(deposit v1beta1.Deposit) bool { + err := keeper.bankKeeper.BurnCoins(ctx, v1beta1.ModuleName, deposit.Amount) if err != nil { panic(err) } @@ -73,14 +74,14 @@ func (keeper Keeper) DeleteAndBurnDeposits(ctx sdk.Context, proposalID uint64) { } // IterateAllDeposits iterates over the all the stored deposits and performs a callback function -func (keeper Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit types.Deposit) (stop bool)) { +func (keeper Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit v1beta1.Deposit) (stop bool)) { store := ctx.KVStore(keeper.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.DepositsKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var deposit types.Deposit + var deposit v1beta1.Deposit keeper.cdc.MustUnmarshal(iterator.Value(), &deposit) @@ -91,14 +92,14 @@ func (keeper Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit types.D } // IterateDeposits iterates over the all the proposals deposits and performs a callback function -func (keeper Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func(deposit types.Deposit) (stop bool)) { +func (keeper Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func(deposit v1beta1.Deposit) (stop bool)) { store := ctx.KVStore(keeper.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.DepositsKey(proposalID)) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var deposit types.Deposit + var deposit v1beta1.Deposit keeper.cdc.MustUnmarshal(iterator.Value(), &deposit) @@ -118,12 +119,12 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd } // Check if proposal is still depositable - if (proposal.Status != types.StatusDepositPeriod) && (proposal.Status != types.StatusVotingPeriod) { + if (proposal.Status != v1beta1.StatusDepositPeriod) && (proposal.Status != v1beta1.StatusVotingPeriod) { return false, sdkerrors.Wrapf(types.ErrInactiveProposal, "%d", proposalID) } // update the governance module's account coins pool - err := keeper.bankKeeper.SendCoinsFromAccountToModule(ctx, depositorAddr, types.ModuleName, depositAmount) + err := keeper.bankKeeper.SendCoinsFromAccountToModule(ctx, depositorAddr, v1beta1.ModuleName, depositAmount) if err != nil { return false, err } @@ -135,7 +136,7 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd // Check if deposit has provided sufficient total funds to transition the proposal into the voting period activatedVotingPeriod := false - if proposal.Status == types.StatusDepositPeriod && proposal.TotalDeposit.IsAllGTE(keeper.GetDepositParams(ctx).MinDeposit) { + if proposal.Status == v1beta1.StatusDepositPeriod && proposal.TotalDeposit.IsAllGTE(keeper.GetDepositParams(ctx).MinDeposit) { keeper.ActivateVotingPeriod(ctx, proposal) activatedVotingPeriod = true @@ -147,7 +148,7 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd if found { deposit.Amount = deposit.Amount.Add(depositAmount...) } else { - deposit = types.NewDeposit(proposalID, depositorAddr, depositAmount) + deposit = v1beta1.NewDeposit(proposalID, depositorAddr, depositAmount) } // called when deposit has been added to a proposal, however the proposal may not be active @@ -170,13 +171,13 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd func (keeper Keeper) RefundAndDeleteDeposits(ctx sdk.Context, proposalID uint64) { store := ctx.KVStore(keeper.storeKey) - keeper.IterateDeposits(ctx, proposalID, func(deposit types.Deposit) bool { + keeper.IterateDeposits(ctx, proposalID, func(deposit v1beta1.Deposit) bool { depositor, err := sdk.AccAddressFromBech32(deposit.Depositor) if err != nil { panic(err) } - err = keeper.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, depositor, deposit.Amount) + err = keeper.bankKeeper.SendCoinsFromModuleToAccount(ctx, v1beta1.ModuleName, depositor, deposit.Amount) if err != nil { panic(err) } diff --git a/x/gov/keeper/grpc_query.go b/x/gov/keeper/grpc_query.go index 5caf220f77bc..2f1c90ca5bfd 100644 --- a/x/gov/keeper/grpc_query.go +++ b/x/gov/keeper/grpc_query.go @@ -10,12 +10,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) -var _ types.QueryServer = Keeper{} +var _ v1beta1.QueryServer = Keeper{} // Proposal returns proposal details based on ProposalID -func (q Keeper) Proposal(c context.Context, req *types.QueryProposalRequest) (*types.QueryProposalResponse, error) { +func (q Keeper) Proposal(c context.Context, req *v1beta1.QueryProposalRequest) (*v1beta1.QueryProposalResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -31,19 +32,19 @@ func (q Keeper) Proposal(c context.Context, req *types.QueryProposalRequest) (*t return nil, status.Errorf(codes.NotFound, "proposal %d doesn't exist", req.ProposalId) } - return &types.QueryProposalResponse{Proposal: proposal}, nil + return &v1beta1.QueryProposalResponse{Proposal: proposal}, nil } // Proposals implements the Query/Proposals gRPC method -func (q Keeper) Proposals(c context.Context, req *types.QueryProposalsRequest) (*types.QueryProposalsResponse, error) { - var filteredProposals types.Proposals +func (q Keeper) Proposals(c context.Context, req *v1beta1.QueryProposalsRequest) (*v1beta1.QueryProposalsResponse, error) { + var filteredProposals v1beta1.Proposals ctx := sdk.UnwrapSDKContext(c) store := ctx.KVStore(q.storeKey) proposalStore := prefix.NewStore(store, types.ProposalsKeyPrefix) pageRes, err := query.FilteredPaginate(proposalStore, req.Pagination, func(key []byte, value []byte, accumulate bool) (bool, error) { - var p types.Proposal + var p v1beta1.Proposal if err := q.cdc.Unmarshal(value, &p); err != nil { return false, status.Error(codes.Internal, err.Error()) } @@ -51,7 +52,7 @@ func (q Keeper) Proposals(c context.Context, req *types.QueryProposalsRequest) ( matchVoter, matchDepositor, matchStatus := true, true, true // match status (if supplied/valid) - if types.ValidProposalStatus(req.ProposalStatus) { + if v1beta1.ValidProposalStatus(req.ProposalStatus) { matchStatus = p.Status == req.ProposalStatus } @@ -89,11 +90,11 @@ func (q Keeper) Proposals(c context.Context, req *types.QueryProposalsRequest) ( return nil, status.Error(codes.Internal, err.Error()) } - return &types.QueryProposalsResponse{Proposals: filteredProposals, Pagination: pageRes}, nil + return &v1beta1.QueryProposalsResponse{Proposals: filteredProposals, Pagination: pageRes}, nil } // Vote returns Voted information based on proposalID, voterAddr -func (q Keeper) Vote(c context.Context, req *types.QueryVoteRequest) (*types.QueryVoteResponse, error) { +func (q Keeper) Vote(c context.Context, req *v1beta1.QueryVoteRequest) (*v1beta1.QueryVoteResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -118,11 +119,11 @@ func (q Keeper) Vote(c context.Context, req *types.QueryVoteRequest) (*types.Que "voter: %v not found for proposal: %v", req.Voter, req.ProposalId) } - return &types.QueryVoteResponse{Vote: vote}, nil + return &v1beta1.QueryVoteResponse{Vote: vote}, nil } // Votes returns single proposal's votes -func (q Keeper) Votes(c context.Context, req *types.QueryVotesRequest) (*types.QueryVotesResponse, error) { +func (q Keeper) Votes(c context.Context, req *v1beta1.QueryVotesRequest) (*v1beta1.QueryVotesResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -131,14 +132,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 v1beta1.Votes ctx := sdk.UnwrapSDKContext(c) store := ctx.KVStore(q.storeKey) votesStore := prefix.NewStore(store, types.VotesKey(req.ProposalId)) pageRes, err := query.Paginate(votesStore, req.Pagination, func(key []byte, value []byte) error { - var vote types.Vote + var vote v1beta1.Vote if err := q.cdc.Unmarshal(value, &vote); err != nil { return err } @@ -152,11 +153,11 @@ func (q Keeper) Votes(c context.Context, req *types.QueryVotesRequest) (*types.Q return nil, status.Error(codes.Internal, err.Error()) } - return &types.QueryVotesResponse{Votes: votes, Pagination: pageRes}, nil + return &v1beta1.QueryVotesResponse{Votes: votes, Pagination: pageRes}, nil } // Params queries all params -func (q Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (q Keeper) Params(c context.Context, req *v1beta1.QueryParamsRequest) (*v1beta1.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -164,17 +165,17 @@ func (q Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types ctx := sdk.UnwrapSDKContext(c) switch req.ParamsType { - case types.ParamDeposit: + case v1beta1.ParamDeposit: depositParmas := q.GetDepositParams(ctx) - return &types.QueryParamsResponse{DepositParams: depositParmas}, nil + return &v1beta1.QueryParamsResponse{DepositParams: depositParmas}, nil - case types.ParamVoting: + case v1beta1.ParamVoting: votingParmas := q.GetVotingParams(ctx) - return &types.QueryParamsResponse{VotingParams: votingParmas}, nil + return &v1beta1.QueryParamsResponse{VotingParams: votingParmas}, nil - case types.ParamTallying: + case v1beta1.ParamTallying: tallyParams := q.GetTallyParams(ctx) - return &types.QueryParamsResponse{TallyParams: tallyParams}, nil + return &v1beta1.QueryParamsResponse{TallyParams: tallyParams}, nil default: return nil, status.Errorf(codes.InvalidArgument, @@ -183,7 +184,7 @@ func (q Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types } // Deposit queries single deposit information based proposalID, depositAddr -func (q Keeper) Deposit(c context.Context, req *types.QueryDepositRequest) (*types.QueryDepositResponse, error) { +func (q Keeper) Deposit(c context.Context, req *v1beta1.QueryDepositRequest) (*v1beta1.QueryDepositResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -208,11 +209,11 @@ func (q Keeper) Deposit(c context.Context, req *types.QueryDepositRequest) (*typ "depositer: %v not found for proposal: %v", req.Depositor, req.ProposalId) } - return &types.QueryDepositResponse{Deposit: deposit}, nil + return &v1beta1.QueryDepositResponse{Deposit: deposit}, nil } // Deposits returns single proposal's all deposits -func (q Keeper) Deposits(c context.Context, req *types.QueryDepositsRequest) (*types.QueryDepositsResponse, error) { +func (q Keeper) Deposits(c context.Context, req *v1beta1.QueryDepositsRequest) (*v1beta1.QueryDepositsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -221,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 v1beta1.Deposits ctx := sdk.UnwrapSDKContext(c) store := ctx.KVStore(q.storeKey) depositStore := prefix.NewStore(store, types.DepositsKey(req.ProposalId)) pageRes, err := query.Paginate(depositStore, req.Pagination, func(key []byte, value []byte) error { - var deposit types.Deposit + var deposit v1beta1.Deposit if err := q.cdc.Unmarshal(value, &deposit); err != nil { return err } @@ -241,11 +242,11 @@ func (q Keeper) Deposits(c context.Context, req *types.QueryDepositsRequest) (*t return nil, status.Error(codes.Internal, err.Error()) } - return &types.QueryDepositsResponse{Deposits: deposits, Pagination: pageRes}, nil + return &v1beta1.QueryDepositsResponse{Deposits: deposits, Pagination: pageRes}, nil } // TallyResult queries the tally of a proposal vote -func (q Keeper) TallyResult(c context.Context, req *types.QueryTallyResultRequest) (*types.QueryTallyResultResponse, error) { +func (q Keeper) TallyResult(c context.Context, req *v1beta1.QueryTallyResultRequest) (*v1beta1.QueryTallyResultResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -261,13 +262,13 @@ func (q Keeper) TallyResult(c context.Context, req *types.QueryTallyResultReques return nil, status.Errorf(codes.NotFound, "proposal %d doesn't exist", req.ProposalId) } - var tallyResult types.TallyResult + var tallyResult v1beta1.TallyResult switch { - case proposal.Status == types.StatusDepositPeriod: - tallyResult = types.EmptyTallyResult() + case proposal.Status == v1beta1.StatusDepositPeriod: + tallyResult = v1beta1.EmptyTallyResult() - case proposal.Status == types.StatusPassed || proposal.Status == types.StatusRejected: + case proposal.Status == v1beta1.StatusPassed || proposal.Status == v1beta1.StatusRejected: tallyResult = proposal.FinalTallyResult default: @@ -275,5 +276,5 @@ func (q Keeper) TallyResult(c context.Context, req *types.QueryTallyResultReques _, _, tallyResult = q.Tally(ctx, proposal) } - return &types.QueryTallyResultResponse{Tally: tallyResult}, nil + return &v1beta1.QueryTallyResultResponse{Tally: tallyResult}, nil } diff --git a/x/gov/keeper/grpc_query_test.go b/x/gov/keeper/grpc_query_test.go index 0e7d6f251091..5fc4c968bd2e 100644 --- a/x/gov/keeper/grpc_query_test.go +++ b/x/gov/keeper/grpc_query_test.go @@ -8,15 +8,15 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) func (suite *KeeperTestSuite) TestGRPCQueryProposal() { app, ctx, queryClient := suite.app, suite.ctx, suite.queryClient var ( - req *types.QueryProposalRequest - expProposal types.Proposal + req *v1beta1.QueryProposalRequest + expProposal v1beta1.Proposal ) testCases := []struct { @@ -27,29 +27,29 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposal() { { "empty request", func() { - req = &types.QueryProposalRequest{} + req = &v1beta1.QueryProposalRequest{} }, false, }, { "non existing proposal request", func() { - req = &types.QueryProposalRequest{ProposalId: 3} + req = &v1beta1.QueryProposalRequest{ProposalId: 3} }, false, }, { "zero proposal id request", func() { - req = &types.QueryProposalRequest{ProposalId: 0} + req = &v1beta1.QueryProposalRequest{ProposalId: 0} }, false, }, { "valid request", func() { - req = &types.QueryProposalRequest{ProposalId: 1} - testProposal := types.NewTextProposal("Proposal", "testing proposal") + req = &v1beta1.QueryProposalRequest{ProposalId: 1} + testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal") submittedProposal, err := app.GovKeeper.SubmitProposal(ctx, testProposal) suite.Require().NoError(err) suite.Require().NotEmpty(submittedProposal) @@ -80,11 +80,11 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposal() { func (suite *KeeperTestSuite) TestGRPCQueryProposals() { app, ctx, queryClient, addrs := suite.app, suite.ctx, suite.queryClient, suite.addrs - testProposals := []types.Proposal{} + testProposals := []v1beta1.Proposal{} var ( - req *types.QueryProposalsRequest - expRes *types.QueryProposalsResponse + req *v1beta1.QueryProposalsRequest + expRes *v1beta1.QueryProposalsResponse ) testCases := []struct { @@ -95,7 +95,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() { { "empty state request", func() { - req = &types.QueryProposalsRequest{} + req = &v1beta1.QueryProposalsRequest{} }, true, }, @@ -105,18 +105,18 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() { // create 5 test proposals for i := 0; i < 5; i++ { num := strconv.Itoa(i + 1) - testProposal := types.NewTextProposal("Proposal"+num, "testing proposal "+num) + testProposal := v1beta1.NewTextProposal("Proposal"+num, "testing proposal "+num) proposal, err := app.GovKeeper.SubmitProposal(ctx, testProposal) suite.Require().NotEmpty(proposal) suite.Require().NoError(err) testProposals = append(testProposals, proposal) } - req = &types.QueryProposalsRequest{ + req = &v1beta1.QueryProposalsRequest{ Pagination: &query.PageRequest{Limit: 3}, } - expRes = &types.QueryProposalsResponse{ + expRes = &v1beta1.QueryProposalsResponse{ Proposals: testProposals[:3], } }, @@ -125,11 +125,11 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() { { "request 2nd page with limit 4", func() { - req = &types.QueryProposalsRequest{ + req = &v1beta1.QueryProposalsRequest{ Pagination: &query.PageRequest{Offset: 3, Limit: 3}, } - expRes = &types.QueryProposalsResponse{ + expRes = &v1beta1.QueryProposalsResponse{ Proposals: testProposals[3:], } }, @@ -138,11 +138,11 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() { { "request with limit 2 and count true", func() { - req = &types.QueryProposalsRequest{ + req = &v1beta1.QueryProposalsRequest{ Pagination: &query.PageRequest{Limit: 2, CountTotal: true}, } - expRes = &types.QueryProposalsResponse{ + expRes = &v1beta1.QueryProposalsResponse{ Proposals: testProposals[:2], } }, @@ -151,11 +151,11 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() { { "request with filter of status deposit period", func() { - req = &types.QueryProposalsRequest{ - ProposalStatus: types.StatusDepositPeriod, + req = &v1beta1.QueryProposalsRequest{ + ProposalStatus: v1beta1.StatusDepositPeriod, } - expRes = &types.QueryProposalsResponse{ + expRes = &v1beta1.QueryProposalsResponse{ Proposals: testProposals, } }, @@ -165,14 +165,14 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() { "request with filter of deposit address", func() { depositCoins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, app.StakingKeeper.TokensFromConsensusPower(ctx, 20))) - deposit := types.NewDeposit(testProposals[0].ProposalId, addrs[0], depositCoins) + deposit := v1beta1.NewDeposit(testProposals[0].ProposalId, addrs[0], depositCoins) app.GovKeeper.SetDeposit(ctx, deposit) - req = &types.QueryProposalsRequest{ + req = &v1beta1.QueryProposalsRequest{ Depositor: addrs[0].String(), } - expRes = &types.QueryProposalsResponse{ + expRes = &v1beta1.QueryProposalsResponse{ Proposals: testProposals[:1], } }, @@ -181,15 +181,15 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() { { "request with filter of deposit address", func() { - testProposals[1].Status = types.StatusVotingPeriod + testProposals[1].Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, testProposals[1]) - suite.Require().NoError(app.GovKeeper.AddVote(ctx, testProposals[1].ProposalId, addrs[0], types.NewNonSplitVoteOption(types.OptionAbstain))) + suite.Require().NoError(app.GovKeeper.AddVote(ctx, testProposals[1].ProposalId, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionAbstain))) - req = &types.QueryProposalsRequest{ + req = &v1beta1.QueryProposalsRequest{ Voter: addrs[0].String(), } - expRes = &types.QueryProposalsResponse{ + expRes = &v1beta1.QueryProposalsResponse{ Proposals: testProposals[1:2], } }, @@ -223,9 +223,9 @@ func (suite *KeeperTestSuite) TestGRPCQueryVote() { app, ctx, queryClient, addrs := suite.app, suite.ctx, suite.queryClient, suite.addrs var ( - req *types.QueryVoteRequest - expRes *types.QueryVoteResponse - proposal types.Proposal + req *v1beta1.QueryVoteRequest + expRes *v1beta1.QueryVoteResponse + proposal v1beta1.Proposal ) testCases := []struct { @@ -236,14 +236,14 @@ func (suite *KeeperTestSuite) TestGRPCQueryVote() { { "empty request", func() { - req = &types.QueryVoteRequest{} + req = &v1beta1.QueryVoteRequest{} }, false, }, { "zero proposal id request", func() { - req = &types.QueryVoteRequest{ + req = &v1beta1.QueryVoteRequest{ ProposalId: 0, Voter: addrs[0].String(), } @@ -253,7 +253,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVote() { { "empty voter request", func() { - req = &types.QueryVoteRequest{ + req = &v1beta1.QueryVoteRequest{ ProposalId: 1, Voter: "", } @@ -263,7 +263,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVote() { { "non existed proposal", func() { - req = &types.QueryVoteRequest{ + req = &v1beta1.QueryVoteRequest{ ProposalId: 3, Voter: addrs[0].String(), } @@ -277,40 +277,40 @@ func (suite *KeeperTestSuite) TestGRPCQueryVote() { proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal) suite.Require().NoError(err) - req = &types.QueryVoteRequest{ + req = &v1beta1.QueryVoteRequest{ ProposalId: proposal.ProposalId, Voter: addrs[0].String(), } - expRes = &types.QueryVoteResponse{} + expRes = &v1beta1.QueryVoteResponse{} }, false, }, { "valid request", func() { - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.ProposalId, addrs[0], types.NewNonSplitVoteOption(types.OptionAbstain))) + suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.ProposalId, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionAbstain))) - req = &types.QueryVoteRequest{ + req = &v1beta1.QueryVoteRequest{ ProposalId: proposal.ProposalId, Voter: addrs[0].String(), } - expRes = &types.QueryVoteResponse{Vote: types.Vote{ProposalId: proposal.ProposalId, Voter: addrs[0].String(), Option: types.OptionAbstain, Options: []types.WeightedVoteOption{{Option: types.OptionAbstain, Weight: sdk.MustNewDecFromStr("1.0")}}}} + expRes = &v1beta1.QueryVoteResponse{Vote: v1beta1.Vote{ProposalId: proposal.ProposalId, Voter: addrs[0].String(), Option: v1beta1.OptionAbstain, Options: []v1beta1.WeightedVoteOption{{Option: v1beta1.OptionAbstain, Weight: sdk.MustNewDecFromStr("1.0")}}}} }, true, }, { "wrong voter id request", func() { - req = &types.QueryVoteRequest{ + req = &v1beta1.QueryVoteRequest{ ProposalId: proposal.ProposalId, Voter: addrs[1].String(), } - expRes = &types.QueryVoteResponse{} + expRes = &v1beta1.QueryVoteResponse{} }, false, }, @@ -339,10 +339,10 @@ func (suite *KeeperTestSuite) TestGRPCQueryVotes() { addrs := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(30000000)) var ( - req *types.QueryVotesRequest - expRes *types.QueryVotesResponse - proposal types.Proposal - votes types.Votes + req *v1beta1.QueryVotesRequest + expRes *v1beta1.QueryVotesResponse + proposal v1beta1.Proposal + votes v1beta1.Votes ) testCases := []struct { @@ -353,14 +353,14 @@ func (suite *KeeperTestSuite) TestGRPCQueryVotes() { { "empty request", func() { - req = &types.QueryVotesRequest{} + req = &v1beta1.QueryVotesRequest{} }, false, }, { "zero proposal id request", func() { - req = &types.QueryVotesRequest{ + req = &v1beta1.QueryVotesRequest{ ProposalId: 0, } }, @@ -369,7 +369,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVotes() { { "non existed proposals", func() { - req = &types.QueryVotesRequest{ + req = &v1beta1.QueryVotesRequest{ ProposalId: 2, } }, @@ -382,7 +382,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVotes() { proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal) suite.Require().NoError(err) - req = &types.QueryVotesRequest{ + req = &v1beta1.QueryVotesRequest{ ProposalId: proposal.ProposalId, } }, @@ -391,12 +391,12 @@ func (suite *KeeperTestSuite) TestGRPCQueryVotes() { { "request after adding 2 votes", func() { - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - votes = []types.Vote{ - {ProposalId: proposal.ProposalId, Voter: addrs[0].String(), Option: types.OptionAbstain, Options: types.NewNonSplitVoteOption(types.OptionAbstain)}, - {ProposalId: proposal.ProposalId, Voter: addrs[1].String(), Option: types.OptionYes, Options: types.NewNonSplitVoteOption(types.OptionYes)}, + votes = []v1beta1.Vote{ + {ProposalId: proposal.ProposalId, Voter: addrs[0].String(), Option: v1beta1.OptionAbstain, Options: v1beta1.NewNonSplitVoteOption(v1beta1.OptionAbstain)}, + {ProposalId: proposal.ProposalId, Voter: addrs[1].String(), Option: v1beta1.OptionYes, Options: v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)}, } accAddr1, err1 := sdk.AccAddressFromBech32(votes[0].Voter) accAddr2, err2 := sdk.AccAddressFromBech32(votes[1].Voter) @@ -405,11 +405,11 @@ func (suite *KeeperTestSuite) TestGRPCQueryVotes() { suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.ProposalId, accAddr1, votes[0].Options)) suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.ProposalId, accAddr2, votes[1].Options)) - req = &types.QueryVotesRequest{ + req = &v1beta1.QueryVotesRequest{ ProposalId: proposal.ProposalId, } - expRes = &types.QueryVotesResponse{ + expRes = &v1beta1.QueryVotesResponse{ Votes: votes, } }, @@ -438,8 +438,8 @@ func (suite *KeeperTestSuite) TestGRPCQueryParams() { queryClient := suite.queryClient var ( - req *types.QueryParamsRequest - expRes *types.QueryParamsResponse + req *v1beta1.QueryParamsRequest + expRes *v1beta1.QueryParamsResponse ) testCases := []struct { @@ -450,17 +450,17 @@ func (suite *KeeperTestSuite) TestGRPCQueryParams() { { "empty request", func() { - req = &types.QueryParamsRequest{} + req = &v1beta1.QueryParamsRequest{} }, false, }, { "deposit params request", func() { - req = &types.QueryParamsRequest{ParamsType: types.ParamDeposit} - expRes = &types.QueryParamsResponse{ - DepositParams: types.DefaultDepositParams(), - TallyParams: types.NewTallyParams(sdk.NewDec(0), sdk.NewDec(0), sdk.NewDec(0)), + req = &v1beta1.QueryParamsRequest{ParamsType: v1beta1.ParamDeposit} + expRes = &v1beta1.QueryParamsResponse{ + DepositParams: v1beta1.DefaultDepositParams(), + TallyParams: v1beta1.NewTallyParams(sdk.NewDec(0), sdk.NewDec(0), sdk.NewDec(0)), } }, true, @@ -468,10 +468,10 @@ func (suite *KeeperTestSuite) TestGRPCQueryParams() { { "voting params request", func() { - req = &types.QueryParamsRequest{ParamsType: types.ParamVoting} - expRes = &types.QueryParamsResponse{ - VotingParams: types.DefaultVotingParams(), - TallyParams: types.NewTallyParams(sdk.NewDec(0), sdk.NewDec(0), sdk.NewDec(0)), + req = &v1beta1.QueryParamsRequest{ParamsType: v1beta1.ParamVoting} + expRes = &v1beta1.QueryParamsResponse{ + VotingParams: v1beta1.DefaultVotingParams(), + TallyParams: v1beta1.NewTallyParams(sdk.NewDec(0), sdk.NewDec(0), sdk.NewDec(0)), } }, true, @@ -479,9 +479,9 @@ func (suite *KeeperTestSuite) TestGRPCQueryParams() { { "tally params request", func() { - req = &types.QueryParamsRequest{ParamsType: types.ParamTallying} - expRes = &types.QueryParamsResponse{ - TallyParams: types.DefaultTallyParams(), + req = &v1beta1.QueryParamsRequest{ParamsType: v1beta1.ParamTallying} + expRes = &v1beta1.QueryParamsResponse{ + TallyParams: v1beta1.DefaultTallyParams(), } }, true, @@ -489,8 +489,8 @@ func (suite *KeeperTestSuite) TestGRPCQueryParams() { { "invalid request", func() { - req = &types.QueryParamsRequest{ParamsType: "wrongPath"} - expRes = &types.QueryParamsResponse{} + req = &v1beta1.QueryParamsRequest{ParamsType: "wrongPath"} + expRes = &v1beta1.QueryParamsResponse{} }, false, }, @@ -519,9 +519,9 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposit() { app, ctx, queryClient, addrs := suite.app, suite.ctx, suite.queryClient, suite.addrs var ( - req *types.QueryDepositRequest - expRes *types.QueryDepositResponse - proposal types.Proposal + req *v1beta1.QueryDepositRequest + expRes *v1beta1.QueryDepositResponse + proposal v1beta1.Proposal ) testCases := []struct { @@ -532,14 +532,14 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposit() { { "empty request", func() { - req = &types.QueryDepositRequest{} + req = &v1beta1.QueryDepositRequest{} }, false, }, { "zero proposal id request", func() { - req = &types.QueryDepositRequest{ + req = &v1beta1.QueryDepositRequest{ ProposalId: 0, Depositor: addrs[0].String(), } @@ -549,7 +549,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposit() { { "empty deposit address request", func() { - req = &types.QueryDepositRequest{ + req = &v1beta1.QueryDepositRequest{ ProposalId: 1, Depositor: "", } @@ -559,7 +559,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposit() { { "non existed proposal", func() { - req = &types.QueryDepositRequest{ + req = &v1beta1.QueryDepositRequest{ ProposalId: 2, Depositor: addrs[0].String(), } @@ -574,7 +574,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposit() { suite.Require().NoError(err) suite.Require().NotNil(proposal) - req = &types.QueryDepositRequest{ + req = &v1beta1.QueryDepositRequest{ ProposalId: proposal.ProposalId, Depositor: addrs[0].String(), } @@ -585,15 +585,15 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposit() { "valid request", func() { depositCoins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, app.StakingKeeper.TokensFromConsensusPower(ctx, 20))) - deposit := types.NewDeposit(proposal.ProposalId, addrs[0], depositCoins) + deposit := v1beta1.NewDeposit(proposal.ProposalId, addrs[0], depositCoins) app.GovKeeper.SetDeposit(ctx, deposit) - req = &types.QueryDepositRequest{ + req = &v1beta1.QueryDepositRequest{ ProposalId: proposal.ProposalId, Depositor: addrs[0].String(), } - expRes = &types.QueryDepositResponse{Deposit: deposit} + expRes = &v1beta1.QueryDepositResponse{Deposit: deposit} }, true, }, @@ -620,9 +620,9 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposits() { app, ctx, queryClient, addrs := suite.app, suite.ctx, suite.queryClient, suite.addrs var ( - req *types.QueryDepositsRequest - expRes *types.QueryDepositsResponse - proposal types.Proposal + req *v1beta1.QueryDepositsRequest + expRes *v1beta1.QueryDepositsResponse + proposal v1beta1.Proposal ) testCases := []struct { @@ -633,14 +633,14 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposits() { { "empty request", func() { - req = &types.QueryDepositsRequest{} + req = &v1beta1.QueryDepositsRequest{} }, false, }, { "zero proposal id request", func() { - req = &types.QueryDepositsRequest{ + req = &v1beta1.QueryDepositsRequest{ ProposalId: 0, } }, @@ -649,7 +649,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposits() { { "non existed proposal", func() { - req = &types.QueryDepositsRequest{ + req = &v1beta1.QueryDepositsRequest{ ProposalId: 2, } }, @@ -662,7 +662,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposits() { proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal) suite.Require().NoError(err) - req = &types.QueryDepositsRequest{ + req = &v1beta1.QueryDepositsRequest{ ProposalId: proposal.ProposalId, } }, @@ -672,20 +672,20 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposits() { "get deposits with default limit", func() { depositAmount1 := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, app.StakingKeeper.TokensFromConsensusPower(ctx, 20))) - deposit1 := types.NewDeposit(proposal.ProposalId, addrs[0], depositAmount1) + deposit1 := v1beta1.NewDeposit(proposal.ProposalId, addrs[0], depositAmount1) app.GovKeeper.SetDeposit(ctx, deposit1) depositAmount2 := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, app.StakingKeeper.TokensFromConsensusPower(ctx, 30))) - deposit2 := types.NewDeposit(proposal.ProposalId, addrs[1], depositAmount2) + deposit2 := v1beta1.NewDeposit(proposal.ProposalId, addrs[1], depositAmount2) app.GovKeeper.SetDeposit(ctx, deposit2) - deposits := types.Deposits{deposit1, deposit2} + deposits := v1beta1.Deposits{deposit1, deposit2} - req = &types.QueryDepositsRequest{ + req = &v1beta1.QueryDepositsRequest{ ProposalId: proposal.ProposalId, } - expRes = &types.QueryDepositsResponse{ + expRes = &v1beta1.QueryDepositsResponse{ Deposits: deposits, } }, @@ -716,9 +716,9 @@ func (suite *KeeperTestSuite) TestGRPCQueryTally() { addrs, _ := createValidators(suite.T(), ctx, app, []int64{5, 5, 5}) var ( - req *types.QueryTallyResultRequest - expRes *types.QueryTallyResultResponse - proposal types.Proposal + req *v1beta1.QueryTallyResultRequest + expRes *v1beta1.QueryTallyResultResponse + proposal v1beta1.Proposal ) testCases := []struct { @@ -729,21 +729,21 @@ func (suite *KeeperTestSuite) TestGRPCQueryTally() { { "empty request", func() { - req = &types.QueryTallyResultRequest{} + req = &v1beta1.QueryTallyResultRequest{} }, false, }, { "zero proposal id request", func() { - req = &types.QueryTallyResultRequest{ProposalId: 0} + req = &v1beta1.QueryTallyResultRequest{ProposalId: 0} }, false, }, { "query non existed proposal", func() { - req = &types.QueryTallyResultRequest{ProposalId: 1} + req = &v1beta1.QueryTallyResultRequest{ProposalId: 1} }, false, }, @@ -755,10 +755,10 @@ func (suite *KeeperTestSuite) TestGRPCQueryTally() { suite.Require().NoError(err) suite.Require().NotNil(proposal) - req = &types.QueryTallyResultRequest{ProposalId: proposal.ProposalId} + req = &v1beta1.QueryTallyResultRequest{ProposalId: proposal.ProposalId} - expRes = &types.QueryTallyResultResponse{ - Tally: types.EmptyTallyResult(), + expRes = &v1beta1.QueryTallyResultResponse{ + Tally: v1beta1.EmptyTallyResult(), } }, true, @@ -766,17 +766,17 @@ func (suite *KeeperTestSuite) TestGRPCQueryTally() { { "request tally after few votes", func() { - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.ProposalId, addrs[0], types.NewNonSplitVoteOption(types.OptionYes))) - suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.ProposalId, addrs[1], types.NewNonSplitVoteOption(types.OptionYes))) - suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.ProposalId, addrs[2], types.NewNonSplitVoteOption(types.OptionYes))) + suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.ProposalId, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.ProposalId, addrs[1], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.ProposalId, addrs[2], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) - req = &types.QueryTallyResultRequest{ProposalId: proposal.ProposalId} + req = &v1beta1.QueryTallyResultRequest{ProposalId: proposal.ProposalId} - expRes = &types.QueryTallyResultResponse{ - Tally: types.TallyResult{ + expRes = &v1beta1.QueryTallyResultResponse{ + Tally: v1beta1.TallyResult{ Yes: sdk.NewInt(3 * 5 * 1000000), }, } @@ -786,13 +786,13 @@ func (suite *KeeperTestSuite) TestGRPCQueryTally() { { "request final tally after status changed", func() { - proposal.Status = types.StatusPassed + proposal.Status = v1beta1.StatusPassed app.GovKeeper.SetProposal(ctx, proposal) proposal, _ = app.GovKeeper.GetProposal(ctx, proposal.ProposalId) - req = &types.QueryTallyResultRequest{ProposalId: proposal.ProposalId} + req = &v1beta1.QueryTallyResultRequest{ProposalId: proposal.ProposalId} - expRes = &types.QueryTallyResultResponse{ + expRes = &v1beta1.QueryTallyResultResponse{ Tally: proposal.FinalTallyResult, } }, diff --git a/x/gov/keeper/hooks_test.go b/x/gov/keeper/hooks_test.go index 2e38b386bb26..6edb6733e16e 100644 --- a/x/gov/keeper/hooks_test.go +++ b/x/gov/keeper/hooks_test.go @@ -12,6 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/gov/keeper" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) var _ types.GovHooks = &MockGovHooksReceiver{} @@ -82,7 +83,7 @@ func TestHooks(t *testing.T) { require.NoError(t, err) require.True(t, govHooksReceiver.AfterProposalDepositValid) - err = app.GovKeeper.AddVote(ctx, p2.ProposalId, addrs[0], types.NewNonSplitVoteOption(types.OptionYes)) + err = app.GovKeeper.AddVote(ctx, p2.ProposalId, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)) require.NoError(t, err) require.True(t, govHooksReceiver.AfterProposalVoteValid) diff --git a/x/gov/keeper/invariants.go b/x/gov/keeper/invariants.go index d0ec4dbfacc8..e30d2f1e64a1 100644 --- a/x/gov/keeper/invariants.go +++ b/x/gov/keeper/invariants.go @@ -7,6 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // RegisterInvariants registers all governance invariants @@ -27,7 +28,7 @@ func ModuleAccountInvariant(keeper Keeper, bk types.BankKeeper) sdk.Invariant { return func(ctx sdk.Context) (string, bool) { var expectedDeposits sdk.Coins - keeper.IterateAllDeposits(ctx, func(deposit types.Deposit) bool { + keeper.IterateAllDeposits(ctx, func(deposit v1beta1.Deposit) bool { expectedDeposits = expectedDeposits.Add(deposit.Amount...) return false }) diff --git a/x/gov/keeper/keeper.go b/x/gov/keeper/keeper.go index dc2a2e6bfa25..646493b12530 100644 --- a/x/gov/keeper/keeper.go +++ b/x/gov/keeper/keeper.go @@ -11,6 +11,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // Keeper defines the governance module Keeper @@ -34,7 +35,7 @@ type Keeper struct { cdc codec.BinaryCodec // Proposal router - router types.Router + router v1beta1.Router } // NewKeeper returns a governance keeper. It handles: @@ -46,7 +47,7 @@ type Keeper struct { // CONTRACT: the parameter Subspace must have the param key table already initialized func NewKeeper( cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace types.ParamSubspace, - authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, sk types.StakingKeeper, rtr types.Router, + authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, sk types.StakingKeeper, rtr v1beta1.Router, ) Keeper { // ensure governance module account is set @@ -87,7 +88,7 @@ func (keeper Keeper) Logger(ctx sdk.Context) log.Logger { } // Router returns the gov Keeper's Router -func (keeper Keeper) Router() types.Router { +func (keeper Keeper) Router() v1beta1.Router { return keeper.router } @@ -128,7 +129,7 @@ func (keeper Keeper) RemoveFromInactiveProposalQueue(ctx sdk.Context, proposalID // IterateActiveProposalsQueue iterates over the proposals in the active proposal queue // and performs a callback function -func (keeper Keeper) IterateActiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal types.Proposal) (stop bool)) { +func (keeper Keeper) IterateActiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal v1beta1.Proposal) (stop bool)) { iterator := keeper.ActiveProposalQueueIterator(ctx, endTime) defer iterator.Close() @@ -147,7 +148,7 @@ func (keeper Keeper) IterateActiveProposalsQueue(ctx sdk.Context, endTime time.T // IterateInactiveProposalsQueue iterates over the proposals in the inactive proposal queue // and performs a callback function -func (keeper Keeper) IterateInactiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal types.Proposal) (stop bool)) { +func (keeper Keeper) IterateInactiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal v1beta1.Proposal) (stop bool)) { iterator := keeper.InactiveProposalQueueIterator(ctx, endTime) defer iterator.Close() diff --git a/x/gov/keeper/keeper_test.go b/x/gov/keeper/keeper_test.go index e4e0b2cd97fc..db1791953853 100644 --- a/x/gov/keeper/keeper_test.go +++ b/x/gov/keeper/keeper_test.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) type KeeperTestSuite struct { @@ -18,7 +19,7 @@ type KeeperTestSuite struct { app *simapp.SimApp ctx sdk.Context - queryClient types.QueryClient + queryClient v1beta1.QueryClient addrs []sdk.AccAddress } @@ -27,8 +28,8 @@ func (suite *KeeperTestSuite) SetupTest() { ctx := app.BaseApp.NewContext(false, tmproto.Header{}) queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, app.GovKeeper) - queryClient := types.NewQueryClient(queryHelper) + v1beta1.RegisterQueryServer(queryHelper, app.GovKeeper) + queryClient := v1beta1.NewQueryClient(queryHelper) suite.app = app suite.ctx = ctx diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index a3b42b9b3a39..30826d554a5b 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) type msgServer struct { @@ -19,13 +20,13 @@ type msgServer struct { // NewMsgServerImpl returns an implementation of the gov MsgServer interface // for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { +func NewMsgServerImpl(keeper Keeper) v1beta1.MsgServer { return &msgServer{Keeper: keeper} } -var _ types.MsgServer = msgServer{} +var _ v1beta1.MsgServer = msgServer{} -func (k msgServer) SubmitProposal(goCtx context.Context, msg *types.MsgSubmitProposal) (*types.MsgSubmitProposalResponse, error) { +func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1beta1.MsgSubmitProposal) (*v1beta1.MsgSubmitProposalResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) proposal, err := k.Keeper.SubmitProposal(ctx, msg.GetContent()) if err != nil { @@ -43,7 +44,7 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *types.MsgSubmitPro "submit proposal", ) - defer telemetry.IncrCounter(1, types.ModuleName, "proposal") + defer telemetry.IncrCounter(1, v1beta1.ModuleName, "proposal") votingStarted, err := k.Keeper.AddDeposit(ctx, proposal.ProposalId, msg.GetProposer(), msg.GetInitialDeposit()) if err != nil { @@ -66,24 +67,24 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *types.MsgSubmitPro } ctx.EventManager().EmitEvent(submitEvent) - return &types.MsgSubmitProposalResponse{ + return &v1beta1.MsgSubmitProposalResponse{ ProposalId: proposal.ProposalId, }, nil } -func (k msgServer) Vote(goCtx context.Context, msg *types.MsgVote) (*types.MsgVoteResponse, error) { +func (k msgServer) Vote(goCtx context.Context, msg *v1beta1.MsgVote) (*v1beta1.MsgVoteResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) accAddr, accErr := sdk.AccAddressFromBech32(msg.Voter) if accErr != nil { return nil, accErr } - err := k.Keeper.AddVote(ctx, msg.ProposalId, accAddr, types.NewNonSplitVoteOption(msg.Option)) + err := k.Keeper.AddVote(ctx, msg.ProposalId, accAddr, v1beta1.NewNonSplitVoteOption(msg.Option)) if err != nil { return nil, err } defer telemetry.IncrCounterWithLabels( - []string{types.ModuleName, "vote"}, + []string{v1beta1.ModuleName, "vote"}, 1, []metrics.Label{ telemetry.NewLabel("proposal_id", strconv.Itoa(int(msg.ProposalId))), @@ -98,10 +99,10 @@ func (k msgServer) Vote(goCtx context.Context, msg *types.MsgVote) (*types.MsgVo ), ) - return &types.MsgVoteResponse{}, nil + return &v1beta1.MsgVoteResponse{}, nil } -func (k msgServer) VoteWeighted(goCtx context.Context, msg *types.MsgVoteWeighted) (*types.MsgVoteWeightedResponse, error) { +func (k msgServer) VoteWeighted(goCtx context.Context, msg *v1beta1.MsgVoteWeighted) (*v1beta1.MsgVoteWeightedResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) accAddr, accErr := sdk.AccAddressFromBech32(msg.Voter) if accErr != nil { @@ -113,7 +114,7 @@ func (k msgServer) VoteWeighted(goCtx context.Context, msg *types.MsgVoteWeighte } defer telemetry.IncrCounterWithLabels( - []string{types.ModuleName, "vote"}, + []string{v1beta1.ModuleName, "vote"}, 1, []metrics.Label{ telemetry.NewLabel("proposal_id", strconv.Itoa(int(msg.ProposalId))), @@ -128,10 +129,10 @@ func (k msgServer) VoteWeighted(goCtx context.Context, msg *types.MsgVoteWeighte ), ) - return &types.MsgVoteWeightedResponse{}, nil + return &v1beta1.MsgVoteWeightedResponse{}, nil } -func (k msgServer) Deposit(goCtx context.Context, msg *types.MsgDeposit) (*types.MsgDepositResponse, error) { +func (k msgServer) Deposit(goCtx context.Context, msg *v1beta1.MsgDeposit) (*v1beta1.MsgDepositResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) accAddr, err := sdk.AccAddressFromBech32(msg.Depositor) if err != nil { @@ -143,7 +144,7 @@ func (k msgServer) Deposit(goCtx context.Context, msg *types.MsgDeposit) (*types } defer telemetry.IncrCounterWithLabels( - []string{types.ModuleName, "deposit"}, + []string{v1beta1.ModuleName, "deposit"}, 1, []metrics.Label{ telemetry.NewLabel("proposal_id", strconv.Itoa(int(msg.ProposalId))), @@ -167,5 +168,5 @@ func (k msgServer) Deposit(goCtx context.Context, msg *types.MsgDeposit) (*types ) } - return &types.MsgDepositResponse{}, nil + return &v1beta1.MsgDepositResponse{}, nil } diff --git a/x/gov/keeper/params.go b/x/gov/keeper/params.go index 0c6fc4338b9f..4ff77cf39216 100644 --- a/x/gov/keeper/params.go +++ b/x/gov/keeper/params.go @@ -3,40 +3,41 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // GetDepositParams returns the current DepositParams from the global param store -func (keeper Keeper) GetDepositParams(ctx sdk.Context) types.DepositParams { - var depositParams types.DepositParams +func (keeper Keeper) GetDepositParams(ctx sdk.Context) v1beta1.DepositParams { + var depositParams v1beta1.DepositParams keeper.paramSpace.Get(ctx, types.ParamStoreKeyDepositParams, &depositParams) return depositParams } // GetVotingParams returns the current VotingParams from the global param store -func (keeper Keeper) GetVotingParams(ctx sdk.Context) types.VotingParams { - var votingParams types.VotingParams +func (keeper Keeper) GetVotingParams(ctx sdk.Context) v1beta1.VotingParams { + var votingParams v1beta1.VotingParams keeper.paramSpace.Get(ctx, types.ParamStoreKeyVotingParams, &votingParams) return votingParams } // GetTallyParams returns the current TallyParam from the global param store -func (keeper Keeper) GetTallyParams(ctx sdk.Context) types.TallyParams { - var tallyParams types.TallyParams +func (keeper Keeper) GetTallyParams(ctx sdk.Context) v1beta1.TallyParams { + var tallyParams v1beta1.TallyParams keeper.paramSpace.Get(ctx, types.ParamStoreKeyTallyParams, &tallyParams) return tallyParams } // SetDepositParams sets DepositParams to the global param store -func (keeper Keeper) SetDepositParams(ctx sdk.Context, depositParams types.DepositParams) { +func (keeper Keeper) SetDepositParams(ctx sdk.Context, depositParams v1beta1.DepositParams) { keeper.paramSpace.Set(ctx, types.ParamStoreKeyDepositParams, &depositParams) } // SetVotingParams sets VotingParams to the global param store -func (keeper Keeper) SetVotingParams(ctx sdk.Context, votingParams types.VotingParams) { +func (keeper Keeper) SetVotingParams(ctx sdk.Context, votingParams v1beta1.VotingParams) { keeper.paramSpace.Set(ctx, types.ParamStoreKeyVotingParams, &votingParams) } // SetTallyParams sets TallyParams to the global param store -func (keeper Keeper) SetTallyParams(ctx sdk.Context, tallyParams types.TallyParams) { +func (keeper Keeper) SetTallyParams(ctx sdk.Context, tallyParams v1beta1.TallyParams) { keeper.paramSpace.Set(ctx, types.ParamStoreKeyTallyParams, &tallyParams) } diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index f7c58cf095e6..a3cbb2a4d7b5 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -7,12 +7,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // SubmitProposal create new proposal given a content -func (keeper Keeper) SubmitProposal(ctx sdk.Context, content types.Content) (types.Proposal, error) { +func (keeper Keeper) SubmitProposal(ctx sdk.Context, content v1beta1.Content) (v1beta1.Proposal, error) { if !keeper.router.HasRoute(content.ProposalRoute()) { - return types.Proposal{}, sdkerrors.Wrap(types.ErrNoProposalHandlerExists, content.ProposalRoute()) + return v1beta1.Proposal{}, sdkerrors.Wrap(types.ErrNoProposalHandlerExists, content.ProposalRoute()) } // Execute the proposal content in a new context branch (with branched store) @@ -21,20 +22,20 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, content types.Content) (typ cacheCtx, _ := ctx.CacheContext() handler := keeper.router.GetRoute(content.ProposalRoute()) if err := handler(cacheCtx, content); err != nil { - return types.Proposal{}, sdkerrors.Wrap(types.ErrInvalidProposalContent, err.Error()) + return v1beta1.Proposal{}, sdkerrors.Wrap(v1beta1.ErrInvalidProposalContent, err.Error()) } proposalID, err := keeper.GetProposalID(ctx) if err != nil { - return types.Proposal{}, err + return v1beta1.Proposal{}, err } submitTime := ctx.BlockHeader().Time depositPeriod := keeper.GetDepositParams(ctx).MaxDepositPeriod - proposal, err := types.NewProposal(content, proposalID, submitTime, submitTime.Add(depositPeriod)) + proposal, err := v1beta1.NewProposal(content, proposalID, submitTime, submitTime.Add(depositPeriod)) if err != nil { - return types.Proposal{}, err + return v1beta1.Proposal{}, err } keeper.SetProposal(ctx, proposal) @@ -56,15 +57,15 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, content types.Content) (typ // GetProposal get proposal from store by ProposalID. // Panics if can't unmarshal the proposal. -func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Proposal, bool) { +func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (v1beta1.Proposal, bool) { store := ctx.KVStore(keeper.storeKey) bz := store.Get(types.ProposalKey(proposalID)) if bz == nil { - return types.Proposal{}, false + return v1beta1.Proposal{}, false } - var proposal types.Proposal + var proposal v1beta1.Proposal if err := keeper.UnmarshalProposal(bz, &proposal); err != nil { panic(err) } @@ -74,7 +75,7 @@ func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Prop // SetProposal set a proposal to store. // Panics if can't marshal the proposal. -func (keeper Keeper) SetProposal(ctx sdk.Context, proposal types.Proposal) { +func (keeper Keeper) SetProposal(ctx sdk.Context, proposal v1beta1.Proposal) { bz, err := keeper.MarshalProposal(proposal) if err != nil { panic(err) @@ -99,14 +100,14 @@ func (keeper Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64) { // IterateProposals iterates over the all the proposals and performs a callback function. // Panics when the iterator encounters a proposal which can't be unmarshaled. -func (keeper Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.Proposal) (stop bool)) { +func (keeper Keeper) IterateProposals(ctx sdk.Context, cb func(proposal v1beta1.Proposal) (stop bool)) { store := ctx.KVStore(keeper.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.ProposalsKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var proposal types.Proposal + var proposal v1beta1.Proposal err := keeper.UnmarshalProposal(iterator.Value(), &proposal) if err != nil { panic(err) @@ -119,8 +120,8 @@ func (keeper Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.Pr } // GetProposals returns all the proposals from store -func (keeper Keeper) GetProposals(ctx sdk.Context) (proposals types.Proposals) { - keeper.IterateProposals(ctx, func(proposal types.Proposal) bool { +func (keeper Keeper) GetProposals(ctx sdk.Context) (proposals v1beta1.Proposals) { + keeper.IterateProposals(ctx, func(proposal v1beta1.Proposal) bool { proposals = append(proposals, proposal) return false }) @@ -136,15 +137,15 @@ func (keeper Keeper) GetProposals(ctx sdk.Context) (proposals types.Proposals) { // // NOTE: If no filters are provided, all proposals will be returned in paginated // form. -func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, params types.QueryProposalsParams) types.Proposals { +func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, params v1beta1.QueryProposalsParams) v1beta1.Proposals { proposals := keeper.GetProposals(ctx) - filteredProposals := make([]types.Proposal, 0, len(proposals)) + filteredProposals := make([]v1beta1.Proposal, 0, len(proposals)) for _, p := range proposals { matchVoter, matchDepositor, matchStatus := true, true, true // match status (if supplied/valid) - if types.ValidProposalStatus(params.ProposalStatus) { + if v1beta1.ValidProposalStatus(params.ProposalStatus) { matchStatus = p.Status == params.ProposalStatus } @@ -165,7 +166,7 @@ func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, params types.QueryPro start, end := client.Paginate(len(filteredProposals), params.Page, params.Limit, 100) if start < 0 || end < 0 { - filteredProposals = []types.Proposal{} + filteredProposals = []v1beta1.Proposal{} } else { filteredProposals = filteredProposals[start:end] } @@ -191,18 +192,18 @@ func (keeper Keeper) SetProposalID(ctx sdk.Context, proposalID uint64) { store.Set(types.ProposalIDKey, types.GetProposalIDBytes(proposalID)) } -func (keeper Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal types.Proposal) { +func (keeper Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal v1beta1.Proposal) { proposal.VotingStartTime = ctx.BlockHeader().Time votingPeriod := keeper.GetVotingParams(ctx).VotingPeriod proposal.VotingEndTime = proposal.VotingStartTime.Add(votingPeriod) - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod keeper.SetProposal(ctx, proposal) keeper.RemoveFromInactiveProposalQueue(ctx, proposal.ProposalId, proposal.DepositEndTime) keeper.InsertActiveProposalQueue(ctx, proposal.ProposalId, proposal.VotingEndTime) } -func (keeper Keeper) MarshalProposal(proposal types.Proposal) ([]byte, error) { +func (keeper Keeper) MarshalProposal(proposal v1beta1.Proposal) ([]byte, error) { bz, err := keeper.cdc.Marshal(&proposal) if err != nil { return nil, err @@ -210,7 +211,7 @@ func (keeper Keeper) MarshalProposal(proposal types.Proposal) ([]byte, error) { return bz, nil } -func (keeper Keeper) UnmarshalProposal(bz []byte, proposal *types.Proposal) error { +func (keeper Keeper) UnmarshalProposal(bz []byte, proposal *v1beta1.Proposal) error { err := keeper.cdc.Unmarshal(bz, proposal) if err != nil { return err diff --git a/x/gov/keeper/proposal_test.go b/x/gov/keeper/proposal_test.go index a40303fceb31..9e22a42f541f 100644 --- a/x/gov/keeper/proposal_test.go +++ b/x/gov/keeper/proposal_test.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) func (suite *KeeperTestSuite) TestGetSetProposal() { @@ -44,21 +45,21 @@ func (suite *KeeperTestSuite) TestActivateVotingPeriod() { activeIterator.Close() } -type invalidProposalRoute struct{ types.TextProposal } +type invalidProposalRoute struct{ v1beta1.TextProposal } func (invalidProposalRoute) ProposalRoute() string { return "nonexistingroute" } func (suite *KeeperTestSuite) TestSubmitProposal() { testCases := []struct { - content types.Content + content v1beta1.Content expectedErr error }{ - {&types.TextProposal{Title: "title", Description: "description"}, nil}, + {&v1beta1.TextProposal{Title: "title", Description: "description"}, nil}, // Keeper does not check the validity of title and description, no error - {&types.TextProposal{Title: "", Description: "description"}, nil}, - {&types.TextProposal{Title: strings.Repeat("1234567890", 100), Description: "description"}, nil}, - {&types.TextProposal{Title: "title", Description: ""}, nil}, - {&types.TextProposal{Title: "title", Description: strings.Repeat("1234567890", 1000)}, nil}, + {&v1beta1.TextProposal{Title: "", Description: "description"}, nil}, + {&v1beta1.TextProposal{Title: strings.Repeat("1234567890", 100), Description: "description"}, nil}, + {&v1beta1.TextProposal{Title: "title", Description: ""}, nil}, + {&v1beta1.TextProposal{Title: "title", Description: strings.Repeat("1234567890", 1000)}, nil}, // error only when invalid route {&invalidProposalRoute{}, types.ErrNoProposalHandlerExists}, } @@ -71,20 +72,20 @@ func (suite *KeeperTestSuite) TestSubmitProposal() { func (suite *KeeperTestSuite) TestGetProposalsFiltered() { proposalID := uint64(1) - status := []types.ProposalStatus{types.StatusDepositPeriod, types.StatusVotingPeriod} + status := []v1beta1.ProposalStatus{v1beta1.StatusDepositPeriod, v1beta1.StatusVotingPeriod} addr1 := sdk.AccAddress("foo_________________") for _, s := range status { for i := 0; i < 50; i++ { - p, err := types.NewProposal(TestProposal, proposalID, time.Now(), time.Now()) + p, err := v1beta1.NewProposal(TestProposal, proposalID, time.Now(), time.Now()) suite.Require().NoError(err) p.Status = s if i%2 == 0 { - d := types.NewDeposit(proposalID, addr1, nil) - v := types.NewVote(proposalID, addr1, types.NewNonSplitVoteOption(types.OptionYes)) + d := v1beta1.NewDeposit(proposalID, addr1, nil) + v := v1beta1.NewVote(proposalID, addr1, v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)) suite.app.GovKeeper.SetDeposit(suite.ctx, d) suite.app.GovKeeper.SetVote(suite.ctx, v) } @@ -95,21 +96,21 @@ func (suite *KeeperTestSuite) TestGetProposalsFiltered() { } testCases := []struct { - params types.QueryProposalsParams + params v1beta1.QueryProposalsParams expectedNumResults int }{ - {types.NewQueryProposalsParams(1, 50, types.StatusNil, nil, nil), 50}, - {types.NewQueryProposalsParams(1, 50, types.StatusDepositPeriod, nil, nil), 50}, - {types.NewQueryProposalsParams(1, 50, types.StatusVotingPeriod, nil, nil), 50}, - {types.NewQueryProposalsParams(1, 25, types.StatusNil, nil, nil), 25}, - {types.NewQueryProposalsParams(2, 25, types.StatusNil, nil, nil), 25}, - {types.NewQueryProposalsParams(1, 50, types.StatusRejected, nil, nil), 0}, - {types.NewQueryProposalsParams(1, 50, types.StatusNil, addr1, nil), 50}, - {types.NewQueryProposalsParams(1, 50, types.StatusNil, nil, addr1), 50}, - {types.NewQueryProposalsParams(1, 50, types.StatusNil, addr1, addr1), 50}, - {types.NewQueryProposalsParams(1, 50, types.StatusDepositPeriod, addr1, addr1), 25}, - {types.NewQueryProposalsParams(1, 50, types.StatusDepositPeriod, nil, nil), 50}, - {types.NewQueryProposalsParams(1, 50, types.StatusVotingPeriod, nil, nil), 50}, + {v1beta1.NewQueryProposalsParams(1, 50, v1beta1.StatusNil, nil, nil), 50}, + {v1beta1.NewQueryProposalsParams(1, 50, v1beta1.StatusDepositPeriod, nil, nil), 50}, + {v1beta1.NewQueryProposalsParams(1, 50, v1beta1.StatusVotingPeriod, nil, nil), 50}, + {v1beta1.NewQueryProposalsParams(1, 25, v1beta1.StatusNil, nil, nil), 25}, + {v1beta1.NewQueryProposalsParams(2, 25, v1beta1.StatusNil, nil, nil), 25}, + {v1beta1.NewQueryProposalsParams(1, 50, v1beta1.StatusRejected, nil, nil), 0}, + {v1beta1.NewQueryProposalsParams(1, 50, v1beta1.StatusNil, addr1, nil), 50}, + {v1beta1.NewQueryProposalsParams(1, 50, v1beta1.StatusNil, nil, addr1), 50}, + {v1beta1.NewQueryProposalsParams(1, 50, v1beta1.StatusNil, addr1, addr1), 50}, + {v1beta1.NewQueryProposalsParams(1, 50, v1beta1.StatusDepositPeriod, addr1, addr1), 25}, + {v1beta1.NewQueryProposalsParams(1, 50, v1beta1.StatusDepositPeriod, nil, nil), 50}, + {v1beta1.NewQueryProposalsParams(1, 50, v1beta1.StatusVotingPeriod, nil, nil), 50}, } for i, tc := range testCases { @@ -118,7 +119,7 @@ func (suite *KeeperTestSuite) TestGetProposalsFiltered() { suite.Require().Len(proposals, tc.expectedNumResults) for _, p := range proposals { - if types.ValidProposalStatus(tc.params.ProposalStatus) { + if v1beta1.ValidProposalStatus(tc.params.ProposalStatus) { suite.Require().Equal(tc.params.ProposalStatus, p.Status) } } diff --git a/x/gov/keeper/querier.go b/x/gov/keeper/querier.go index 6eb343d070a7..ff37b1184240 100644 --- a/x/gov/keeper/querier.go +++ b/x/gov/keeper/querier.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // NewQuerier creates a new gov Querier instance @@ -137,7 +138,7 @@ func queryDeposits(ctx sdk.Context, path []string, req abci.RequestQuery, keeper deposits := keeper.GetDeposits(ctx, params.ProposalID) if deposits == nil { - deposits = types.Deposits{} + deposits = v1beta1.Deposits{} } bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, deposits) @@ -163,13 +164,13 @@ func queryTally(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Ke return nil, sdkerrors.Wrapf(types.ErrUnknownProposal, "%d", proposalID) } - var tallyResult types.TallyResult + var tallyResult v1beta1.TallyResult switch { - case proposal.Status == types.StatusDepositPeriod: - tallyResult = types.EmptyTallyResult() + case proposal.Status == v1beta1.StatusDepositPeriod: + tallyResult = v1beta1.EmptyTallyResult() - case proposal.Status == types.StatusPassed || proposal.Status == types.StatusRejected: + case proposal.Status == v1beta1.StatusPassed || proposal.Status == v1beta1.StatusRejected: tallyResult = proposal.FinalTallyResult default: @@ -187,7 +188,7 @@ func queryTally(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Ke // nolint: unparam func queryVotes(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { - var params types.QueryProposalVotesParams + var params v1beta1.QueryProposalVotesParams err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) @@ -195,11 +196,11 @@ func queryVotes(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Ke votes := keeper.GetVotes(ctx, params.ProposalID) if votes == nil { - votes = types.Votes{} + votes = v1beta1.Votes{} } else { start, end := client.Paginate(len(votes), params.Page, params.Limit, 100) if start < 0 || end < 0 { - votes = types.Votes{} + votes = v1beta1.Votes{} } else { votes = votes[start:end] } @@ -214,7 +215,7 @@ func queryVotes(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Ke } func queryProposals(ctx sdk.Context, _ []string, req abci.RequestQuery, keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { - var params types.QueryProposalsParams + var params v1beta1.QueryProposalsParams err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) @@ -222,7 +223,7 @@ func queryProposals(ctx sdk.Context, _ []string, req abci.RequestQuery, keeper K proposals := keeper.GetProposalsFiltered(ctx, params) if proposals == nil { - proposals = types.Proposals{} + proposals = v1beta1.Proposals{} } bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, proposals) diff --git a/x/gov/keeper/querier_test.go b/x/gov/keeper/querier_test.go index 8f658a218164..6b8cab612df2 100644 --- a/x/gov/keeper/querier_test.go +++ b/x/gov/keeper/querier_test.go @@ -15,45 +15,46 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/keeper" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) const custom = "custom" -func getQueriedParams(t *testing.T, ctx sdk.Context, cdc *codec.LegacyAmino, querier sdk.Querier) (types.DepositParams, types.VotingParams, types.TallyParams) { +func getQueriedParams(t *testing.T, ctx sdk.Context, cdc *codec.LegacyAmino, querier sdk.Querier) (v1beta1.DepositParams, v1beta1.VotingParams, v1beta1.TallyParams) { query := abci.RequestQuery{ - Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryParams, types.ParamDeposit}, "/"), + Path: strings.Join([]string{custom, types.QuerierRoute, v1beta1.QueryParams, v1beta1.ParamDeposit}, "/"), Data: []byte{}, } - bz, err := querier(ctx, []string{types.QueryParams, types.ParamDeposit}, query) + bz, err := querier(ctx, []string{v1beta1.QueryParams, v1beta1.ParamDeposit}, query) require.NoError(t, err) require.NotNil(t, bz) - var depositParams types.DepositParams + var depositParams v1beta1.DepositParams require.NoError(t, cdc.UnmarshalJSON(bz, &depositParams)) query = abci.RequestQuery{ - Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryParams, types.ParamVoting}, "/"), + Path: strings.Join([]string{custom, types.QuerierRoute, v1beta1.QueryParams, v1beta1.ParamVoting}, "/"), Data: []byte{}, } - bz, err = querier(ctx, []string{types.QueryParams, types.ParamVoting}, query) + bz, err = querier(ctx, []string{v1beta1.QueryParams, v1beta1.ParamVoting}, query) require.NoError(t, err) require.NotNil(t, bz) - var votingParams types.VotingParams + var votingParams v1beta1.VotingParams require.NoError(t, cdc.UnmarshalJSON(bz, &votingParams)) query = abci.RequestQuery{ - Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryParams, types.ParamTallying}, "/"), + Path: strings.Join([]string{custom, types.QuerierRoute, v1beta1.QueryParams, v1beta1.ParamTallying}, "/"), Data: []byte{}, } - bz, err = querier(ctx, []string{types.QueryParams, types.ParamTallying}, query) + bz, err = querier(ctx, []string{v1beta1.QueryParams, v1beta1.ParamTallying}, query) require.NoError(t, err) require.NotNil(t, bz) - var tallyParams types.TallyParams + var tallyParams v1beta1.TallyParams require.NoError(t, cdc.UnmarshalJSON(bz, &tallyParams)) return depositParams, votingParams, tallyParams @@ -61,84 +62,84 @@ func getQueriedParams(t *testing.T, ctx sdk.Context, cdc *codec.LegacyAmino, que func getQueriedProposals( t *testing.T, ctx sdk.Context, cdc *codec.LegacyAmino, querier sdk.Querier, - depositor, voter sdk.AccAddress, status types.ProposalStatus, page, limit int, -) []types.Proposal { + depositor, voter sdk.AccAddress, status v1beta1.ProposalStatus, page, limit int, +) []v1beta1.Proposal { query := abci.RequestQuery{ - Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryProposals}, "/"), - Data: cdc.MustMarshalJSON(types.NewQueryProposalsParams(page, limit, status, voter, depositor)), + Path: strings.Join([]string{custom, types.QuerierRoute, v1beta1.QueryProposals}, "/"), + Data: cdc.MustMarshalJSON(v1beta1.NewQueryProposalsParams(page, limit, status, voter, depositor)), } - bz, err := querier(ctx, []string{types.QueryProposals}, query) + bz, err := querier(ctx, []string{v1beta1.QueryProposals}, query) require.NoError(t, err) require.NotNil(t, bz) - var proposals types.Proposals + var proposals v1beta1.Proposals require.NoError(t, cdc.UnmarshalJSON(bz, &proposals)) return proposals } -func getQueriedDeposit(t *testing.T, ctx sdk.Context, cdc *codec.LegacyAmino, querier sdk.Querier, proposalID uint64, depositor sdk.AccAddress) types.Deposit { +func getQueriedDeposit(t *testing.T, ctx sdk.Context, cdc *codec.LegacyAmino, querier sdk.Querier, proposalID uint64, depositor sdk.AccAddress) v1beta1.Deposit { query := abci.RequestQuery{ - Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryDeposit}, "/"), - Data: cdc.MustMarshalJSON(types.NewQueryDepositParams(proposalID, depositor)), + Path: strings.Join([]string{custom, types.QuerierRoute, v1beta1.QueryDeposit}, "/"), + Data: cdc.MustMarshalJSON(v1beta1.NewQueryDepositParams(proposalID, depositor)), } - bz, err := querier(ctx, []string{types.QueryDeposit}, query) + bz, err := querier(ctx, []string{v1beta1.QueryDeposit}, query) require.NoError(t, err) require.NotNil(t, bz) - var deposit types.Deposit + var deposit v1beta1.Deposit require.NoError(t, cdc.UnmarshalJSON(bz, &deposit)) return deposit } -func getQueriedDeposits(t *testing.T, ctx sdk.Context, cdc *codec.LegacyAmino, querier sdk.Querier, proposalID uint64) []types.Deposit { +func getQueriedDeposits(t *testing.T, ctx sdk.Context, cdc *codec.LegacyAmino, querier sdk.Querier, proposalID uint64) []v1beta1.Deposit { query := abci.RequestQuery{ - Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryDeposits}, "/"), - Data: cdc.MustMarshalJSON(types.NewQueryProposalParams(proposalID)), + Path: strings.Join([]string{custom, types.QuerierRoute, v1beta1.QueryDeposits}, "/"), + Data: cdc.MustMarshalJSON(v1beta1.NewQueryProposalParams(proposalID)), } - bz, err := querier(ctx, []string{types.QueryDeposits}, query) + bz, err := querier(ctx, []string{v1beta1.QueryDeposits}, query) require.NoError(t, err) require.NotNil(t, bz) - var deposits []types.Deposit + var deposits []v1beta1.Deposit require.NoError(t, cdc.UnmarshalJSON(bz, &deposits)) return deposits } -func getQueriedVote(t *testing.T, ctx sdk.Context, cdc *codec.LegacyAmino, querier sdk.Querier, proposalID uint64, voter sdk.AccAddress) types.Vote { +func getQueriedVote(t *testing.T, ctx sdk.Context, cdc *codec.LegacyAmino, querier sdk.Querier, proposalID uint64, voter sdk.AccAddress) v1beta1.Vote { query := abci.RequestQuery{ - Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryVote}, "/"), - Data: cdc.MustMarshalJSON(types.NewQueryVoteParams(proposalID, voter)), + Path: strings.Join([]string{custom, types.QuerierRoute, v1beta1.QueryVote}, "/"), + Data: cdc.MustMarshalJSON(v1beta1.NewQueryVoteParams(proposalID, voter)), } - bz, err := querier(ctx, []string{types.QueryVote}, query) + bz, err := querier(ctx, []string{v1beta1.QueryVote}, query) require.NoError(t, err) require.NotNil(t, bz) - var vote types.Vote + var vote v1beta1.Vote require.NoError(t, cdc.UnmarshalJSON(bz, &vote)) return vote } func getQueriedVotes(t *testing.T, ctx sdk.Context, cdc *codec.LegacyAmino, querier sdk.Querier, - proposalID uint64, page, limit int) []types.Vote { + proposalID uint64, page, limit int) []v1beta1.Vote { query := abci.RequestQuery{ - Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryVote}, "/"), - Data: cdc.MustMarshalJSON(types.NewQueryProposalVotesParams(proposalID, page, limit)), + Path: strings.Join([]string{custom, types.QuerierRoute, v1beta1.QueryVote}, "/"), + Data: cdc.MustMarshalJSON(v1beta1.NewQueryProposalVotesParams(proposalID, page, limit)), } - bz, err := querier(ctx, []string{types.QueryVotes}, query) + bz, err := querier(ctx, []string{v1beta1.QueryVotes}, query) require.NoError(t, err) require.NotNil(t, bz) - var votes []types.Vote + var votes []v1beta1.Vote require.NoError(t, cdc.UnmarshalJSON(bz, &votes)) return votes @@ -162,7 +163,7 @@ func TestQueries(t *testing.T) { // TestAddrs[0] proposes (and deposits) proposals #1 and #2 proposal1, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) - deposit1 := types.NewDeposit(proposal1.ProposalId, TestAddrs[0], oneCoins) + deposit1 := v1beta1.NewDeposit(proposal1.ProposalId, TestAddrs[0], oneCoins) depositer1, err := sdk.AccAddressFromBech32(deposit1.Depositor) require.NoError(t, err) _, err = app.GovKeeper.AddDeposit(ctx, deposit1.ProposalId, depositer1, deposit1.Amount) @@ -172,7 +173,7 @@ func TestQueries(t *testing.T) { proposal2, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) - deposit2 := types.NewDeposit(proposal2.ProposalId, TestAddrs[0], consCoins) + deposit2 := v1beta1.NewDeposit(proposal2.ProposalId, TestAddrs[0], consCoins) depositer2, err := sdk.AccAddressFromBech32(deposit2.Depositor) require.NoError(t, err) _, err = app.GovKeeper.AddDeposit(ctx, deposit2.ProposalId, depositer2, deposit2.Amount) @@ -183,7 +184,7 @@ func TestQueries(t *testing.T) { // TestAddrs[1] proposes (and deposits) on proposal #3 proposal3, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) - deposit3 := types.NewDeposit(proposal3.ProposalId, TestAddrs[1], oneCoins) + deposit3 := v1beta1.NewDeposit(proposal3.ProposalId, TestAddrs[1], oneCoins) depositer3, err := sdk.AccAddressFromBech32(deposit3.Depositor) require.NoError(t, err) @@ -193,24 +194,24 @@ func TestQueries(t *testing.T) { proposal3.TotalDeposit = proposal3.TotalDeposit.Add(deposit3.Amount...) // TestAddrs[1] deposits on proposals #2 & #3 - deposit4 := types.NewDeposit(proposal2.ProposalId, TestAddrs[1], depositParams.MinDeposit) + deposit4 := v1beta1.NewDeposit(proposal2.ProposalId, TestAddrs[1], depositParams.MinDeposit) depositer4, err := sdk.AccAddressFromBech32(deposit4.Depositor) require.NoError(t, err) _, err = app.GovKeeper.AddDeposit(ctx, deposit4.ProposalId, depositer4, deposit4.Amount) require.NoError(t, err) proposal2.TotalDeposit = proposal2.TotalDeposit.Add(deposit4.Amount...) - proposal2.Status = types.StatusVotingPeriod + proposal2.Status = v1beta1.StatusVotingPeriod proposal2.VotingEndTime = proposal2.VotingEndTime.Add(types.DefaultPeriod) - deposit5 := types.NewDeposit(proposal3.ProposalId, TestAddrs[1], depositParams.MinDeposit) + deposit5 := v1beta1.NewDeposit(proposal3.ProposalId, TestAddrs[1], depositParams.MinDeposit) depositer5, err := sdk.AccAddressFromBech32(deposit5.Depositor) require.NoError(t, err) _, err = app.GovKeeper.AddDeposit(ctx, deposit5.ProposalId, depositer5, deposit5.Amount) require.NoError(t, err) proposal3.TotalDeposit = proposal3.TotalDeposit.Add(deposit5.Amount...) - proposal3.Status = types.StatusVotingPeriod + proposal3.Status = v1beta1.StatusVotingPeriod proposal3.VotingEndTime = proposal3.VotingEndTime.Add(types.DefaultPeriod) // total deposit of TestAddrs[1] on proposal #3 is worth the proposal deposit + individual deposit deposit5.Amount = deposit5.Amount.Add(deposit3.Amount...) @@ -239,33 +240,33 @@ func TestQueries(t *testing.T) { deposit = getQueriedDeposit(t, ctx, legacyQuerierCdc, querier, proposal3.ProposalId, TestAddrs[1]) require.Equal(t, deposit5, deposit) - // Only proposal #1 should be in types.Deposit Period - proposals := getQueriedProposals(t, ctx, legacyQuerierCdc, querier, nil, nil, types.StatusDepositPeriod, 1, 0) + // Only proposal #1 should be in v1beta1.Deposit Period + proposals := getQueriedProposals(t, ctx, legacyQuerierCdc, querier, nil, nil, v1beta1.StatusDepositPeriod, 1, 0) require.Len(t, proposals, 1) require.Equal(t, proposal1, proposals[0]) // Only proposals #2 and #3 should be in Voting Period - proposals = getQueriedProposals(t, ctx, legacyQuerierCdc, querier, nil, nil, types.StatusVotingPeriod, 1, 0) + proposals = getQueriedProposals(t, ctx, legacyQuerierCdc, querier, nil, nil, v1beta1.StatusVotingPeriod, 1, 0) require.Len(t, proposals, 2) require.Equal(t, proposal2, proposals[0]) require.Equal(t, proposal3, proposals[1]) // Addrs[0] votes on proposals #2 & #3 - vote1 := types.NewVote(proposal2.ProposalId, TestAddrs[0], types.NewNonSplitVoteOption(types.OptionYes)) - vote2 := types.NewVote(proposal3.ProposalId, TestAddrs[0], types.NewNonSplitVoteOption(types.OptionYes)) + vote1 := v1beta1.NewVote(proposal2.ProposalId, TestAddrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)) + vote2 := v1beta1.NewVote(proposal3.ProposalId, TestAddrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)) app.GovKeeper.SetVote(ctx, vote1) app.GovKeeper.SetVote(ctx, vote2) // Addrs[1] votes on proposal #3 - vote3 := types.NewVote(proposal3.ProposalId, TestAddrs[1], types.NewNonSplitVoteOption(types.OptionYes)) + vote3 := v1beta1.NewVote(proposal3.ProposalId, TestAddrs[1], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)) app.GovKeeper.SetVote(ctx, vote3) // Test query voted by TestAddrs[0] - proposals = getQueriedProposals(t, ctx, legacyQuerierCdc, querier, nil, TestAddrs[0], types.StatusNil, 1, 0) + proposals = getQueriedProposals(t, ctx, legacyQuerierCdc, querier, nil, TestAddrs[0], v1beta1.StatusNil, 1, 0) require.Equal(t, proposal2, proposals[0]) require.Equal(t, proposal3, proposals[1]) - // Test query votes on types.Proposal 2 + // Test query votes on v1beta1.Proposal 2 votes := getQueriedVotes(t, ctx, legacyQuerierCdc, querier, proposal2.ProposalId, 1, 0) require.Len(t, votes, 1) checkEqualVotes(t, vote1, votes[0]) @@ -273,33 +274,33 @@ func TestQueries(t *testing.T) { vote := getQueriedVote(t, ctx, legacyQuerierCdc, querier, proposal2.ProposalId, TestAddrs[0]) checkEqualVotes(t, vote1, vote) - // Test query votes on types.Proposal 3 + // Test query votes on v1beta1.Proposal 3 votes = getQueriedVotes(t, ctx, legacyQuerierCdc, querier, proposal3.ProposalId, 1, 0) require.Len(t, votes, 2) checkEqualVotes(t, vote2, votes[0]) checkEqualVotes(t, vote3, votes[1]) // Test query all proposals - proposals = getQueriedProposals(t, ctx, legacyQuerierCdc, querier, nil, nil, types.StatusNil, 1, 0) + proposals = getQueriedProposals(t, ctx, legacyQuerierCdc, querier, nil, nil, v1beta1.StatusNil, 1, 0) require.Equal(t, proposal1, proposals[0]) require.Equal(t, proposal2, proposals[1]) require.Equal(t, proposal3, proposals[2]) // Test query voted by TestAddrs[1] - proposals = getQueriedProposals(t, ctx, legacyQuerierCdc, querier, nil, TestAddrs[1], types.StatusNil, 1, 0) + proposals = getQueriedProposals(t, ctx, legacyQuerierCdc, querier, nil, TestAddrs[1], v1beta1.StatusNil, 1, 0) require.Equal(t, proposal3.ProposalId, proposals[0].ProposalId) // Test query deposited by TestAddrs[0] - proposals = getQueriedProposals(t, ctx, legacyQuerierCdc, querier, TestAddrs[0], nil, types.StatusNil, 1, 0) + proposals = getQueriedProposals(t, ctx, legacyQuerierCdc, querier, TestAddrs[0], nil, v1beta1.StatusNil, 1, 0) require.Equal(t, proposal1.ProposalId, proposals[0].ProposalId) // Test query deposited by addr2 - proposals = getQueriedProposals(t, ctx, legacyQuerierCdc, querier, TestAddrs[1], nil, types.StatusNil, 1, 0) + proposals = getQueriedProposals(t, ctx, legacyQuerierCdc, querier, TestAddrs[1], nil, v1beta1.StatusNil, 1, 0) require.Equal(t, proposal2.ProposalId, proposals[0].ProposalId) require.Equal(t, proposal3.ProposalId, proposals[1].ProposalId) // Test query voted AND deposited by addr1 - proposals = getQueriedProposals(t, ctx, legacyQuerierCdc, querier, TestAddrs[0], TestAddrs[0], types.StatusNil, 1, 0) + proposals = getQueriedProposals(t, ctx, legacyQuerierCdc, querier, TestAddrs[0], TestAddrs[0], v1beta1.StatusNil, 1, 0) require.Equal(t, proposal2.ProposalId, proposals[0].ProposalId) } @@ -308,14 +309,14 @@ func TestPaginatedVotesQuery(t *testing.T) { ctx := app.BaseApp.NewContext(false, tmproto.Header{}) legacyQuerierCdc := app.LegacyAmino() - proposal := types.Proposal{ + proposal := v1beta1.Proposal{ ProposalId: 100, - Status: types.StatusVotingPeriod, + Status: v1beta1.StatusVotingPeriod, } app.GovKeeper.SetProposal(ctx, proposal) - votes := make([]types.Vote, 20) + votes := make([]v1beta1.Vote, 20) random := rand.New(rand.NewSource(time.Now().UnixNano())) addrMap := make(map[string]struct{}) genAddr := func() string { @@ -330,10 +331,10 @@ func TestPaginatedVotesQuery(t *testing.T) { } } for i := range votes { - vote := types.Vote{ + vote := v1beta1.Vote{ ProposalId: proposal.ProposalId, Voter: genAddr(), - Options: types.NewNonSplitVoteOption(types.OptionYes), + Options: v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes), } votes[i] = vote app.GovKeeper.SetVote(ctx, vote) @@ -349,7 +350,7 @@ func TestPaginatedVotesQuery(t *testing.T) { description string page int limit int - votes []types.Vote + votes []v1beta1.Vote } for _, tc := range []testCase{ { @@ -390,7 +391,7 @@ func TestPaginatedVotesQuery(t *testing.T) { // When querying, the keeper populates the `vote.Option` field when there's // only 1 vote, this function checks equality of structs while skipping that // field. -func checkEqualVotes(t *testing.T, vote1, vote2 types.Vote) { +func checkEqualVotes(t *testing.T, vote1, vote2 v1beta1.Vote) { require.Equal(t, vote1.Options, vote2.Options) require.Equal(t, vote1.Voter, vote2.Voter) require.Equal(t, vote1.ProposalId, vote2.ProposalId) diff --git a/x/gov/keeper/tally.go b/x/gov/keeper/tally.go index f1f1f325455c..cea608d5200c 100644 --- a/x/gov/keeper/tally.go +++ b/x/gov/keeper/tally.go @@ -2,7 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -10,30 +10,30 @@ import ( // Tally iterates over the votes and updates the tally of a proposal based on the voting power of the // voters -func (keeper Keeper) Tally(ctx sdk.Context, proposal types.Proposal) (passes bool, burnDeposits bool, tallyResults types.TallyResult) { - results := make(map[types.VoteOption]sdk.Dec) - results[types.OptionYes] = sdk.ZeroDec() - results[types.OptionAbstain] = sdk.ZeroDec() - results[types.OptionNo] = sdk.ZeroDec() - results[types.OptionNoWithVeto] = sdk.ZeroDec() +func (keeper Keeper) Tally(ctx sdk.Context, proposal v1beta1.Proposal) (passes bool, burnDeposits bool, tallyResults v1beta1.TallyResult) { + results := make(map[v1beta1.VoteOption]sdk.Dec) + results[v1beta1.OptionYes] = sdk.ZeroDec() + results[v1beta1.OptionAbstain] = sdk.ZeroDec() + results[v1beta1.OptionNo] = sdk.ZeroDec() + results[v1beta1.OptionNoWithVeto] = sdk.ZeroDec() totalVotingPower := sdk.ZeroDec() - currValidators := make(map[string]types.ValidatorGovInfo) + currValidators := make(map[string]v1beta1.ValidatorGovInfo) // fetch all the bonded validators, insert them into currValidators keeper.sk.IterateBondedValidatorsByPower(ctx, func(index int64, validator stakingtypes.ValidatorI) (stop bool) { - currValidators[validator.GetOperator().String()] = types.NewValidatorGovInfo( + currValidators[validator.GetOperator().String()] = v1beta1.NewValidatorGovInfo( validator.GetOperator(), validator.GetBondedTokens(), validator.GetDelegatorShares(), sdk.ZeroDec(), - types.WeightedVoteOptions{}, + v1beta1.WeightedVoteOptions{}, ) return false }) - keeper.IterateVotes(ctx, proposal.ProposalId, func(vote types.Vote) bool { + keeper.IterateVotes(ctx, proposal.ProposalId, func(vote v1beta1.Vote) bool { // if validator, just record it in the map voter, err := sdk.AccAddressFromBech32(vote.Voter) @@ -91,7 +91,7 @@ func (keeper Keeper) Tally(ctx sdk.Context, proposal types.Proposal) (passes boo } tallyParams := keeper.GetTallyParams(ctx) - tallyResults = types.NewTallyResultFromMap(results) + tallyResults = v1beta1.NewTallyResultFromMap(results) // TODO: Upgrade the spec to cover all of these cases & remove pseudocode. // If there is no staked coins, the proposal fails @@ -106,17 +106,17 @@ func (keeper Keeper) Tally(ctx sdk.Context, proposal types.Proposal) (passes boo } // If no one votes (everyone abstains), proposal fails - if totalVotingPower.Sub(results[types.OptionAbstain]).Equal(sdk.ZeroDec()) { + if totalVotingPower.Sub(results[v1beta1.OptionAbstain]).Equal(sdk.ZeroDec()) { return false, false, tallyResults } // If more than 1/3 of voters veto, proposal fails - if results[types.OptionNoWithVeto].Quo(totalVotingPower).GT(tallyParams.VetoThreshold) { + if results[v1beta1.OptionNoWithVeto].Quo(totalVotingPower).GT(tallyParams.VetoThreshold) { return false, true, tallyResults } // If more than 1/2 of non-abstaining voters vote Yes, proposal passes - if results[types.OptionYes].Quo(totalVotingPower.Sub(results[types.OptionAbstain])).GT(tallyParams.Threshold) { + if results[v1beta1.OptionYes].Quo(totalVotingPower.Sub(results[v1beta1.OptionAbstain])).GT(tallyParams.Threshold) { return true, false, tallyResults } diff --git a/x/gov/keeper/tally_test.go b/x/gov/keeper/tally_test.go index 3ddec4613d37..0aef68fc0b00 100644 --- a/x/gov/keeper/tally_test.go +++ b/x/gov/keeper/tally_test.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -23,7 +23,7 @@ func TestTallyNoOneVotes(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) @@ -32,7 +32,7 @@ func TestTallyNoOneVotes(t *testing.T) { require.False(t, passes) require.True(t, burnDeposits) - require.True(t, tallyResults.Equals(types.EmptyTallyResult())) + require.True(t, tallyResults.Equals(v1beta1.EmptyTallyResult())) } func TestTallyNoQuorum(t *testing.T) { @@ -47,10 +47,10 @@ func TestTallyNoQuorum(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - err = app.GovKeeper.AddVote(ctx, proposalID, addrs[0], types.NewNonSplitVoteOption(types.OptionYes)) + err = app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)) require.Nil(t, err) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) @@ -70,12 +70,12 @@ func TestTallyOnlyValidatorsAllYes(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], types.NewNonSplitVoteOption(types.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) require.True(t, ok) @@ -83,7 +83,7 @@ func TestTallyOnlyValidatorsAllYes(t *testing.T) { require.True(t, passes) require.False(t, burnDeposits) - require.False(t, tallyResults.Equals(types.EmptyTallyResult())) + require.False(t, tallyResults.Equals(v1beta1.EmptyTallyResult())) } func TestTallyOnlyValidators51No(t *testing.T) { @@ -96,11 +96,11 @@ func TestTallyOnlyValidators51No(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], types.NewNonSplitVoteOption(types.OptionNo))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta1.NewNonSplitVoteOption(v1beta1.OptionNo))) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) require.True(t, ok) @@ -120,11 +120,11 @@ func TestTallyOnlyValidators51Yes(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], types.NewNonSplitVoteOption(types.OptionNo))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], types.NewNonSplitVoteOption(types.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionNo))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) require.True(t, ok) @@ -132,7 +132,7 @@ func TestTallyOnlyValidators51Yes(t *testing.T) { require.True(t, passes) require.False(t, burnDeposits) - require.False(t, tallyResults.Equals(types.EmptyTallyResult())) + require.False(t, tallyResults.Equals(v1beta1.EmptyTallyResult())) } func TestTallyOnlyValidatorsVetoed(t *testing.T) { @@ -145,12 +145,12 @@ func TestTallyOnlyValidatorsVetoed(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[2], types.NewNonSplitVoteOption(types.OptionNoWithVeto))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[2], v1beta1.NewNonSplitVoteOption(v1beta1.OptionNoWithVeto))) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) require.True(t, ok) @@ -158,7 +158,7 @@ func TestTallyOnlyValidatorsVetoed(t *testing.T) { require.False(t, passes) require.True(t, burnDeposits) - require.False(t, tallyResults.Equals(types.EmptyTallyResult())) + require.False(t, tallyResults.Equals(v1beta1.EmptyTallyResult())) } func TestTallyOnlyValidatorsAbstainPasses(t *testing.T) { @@ -171,12 +171,12 @@ func TestTallyOnlyValidatorsAbstainPasses(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], types.NewNonSplitVoteOption(types.OptionAbstain))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], types.NewNonSplitVoteOption(types.OptionNo))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[2], types.NewNonSplitVoteOption(types.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionAbstain))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta1.NewNonSplitVoteOption(v1beta1.OptionNo))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[2], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) require.True(t, ok) @@ -184,7 +184,7 @@ func TestTallyOnlyValidatorsAbstainPasses(t *testing.T) { require.True(t, passes) require.False(t, burnDeposits) - require.False(t, tallyResults.Equals(types.EmptyTallyResult())) + require.False(t, tallyResults.Equals(v1beta1.EmptyTallyResult())) } func TestTallyOnlyValidatorsAbstainFails(t *testing.T) { @@ -197,12 +197,12 @@ func TestTallyOnlyValidatorsAbstainFails(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], types.NewNonSplitVoteOption(types.OptionAbstain))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[2], types.NewNonSplitVoteOption(types.OptionNo))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionAbstain))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[1], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddrs[2], v1beta1.NewNonSplitVoteOption(v1beta1.OptionNo))) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) require.True(t, ok) @@ -210,7 +210,7 @@ func TestTallyOnlyValidatorsAbstainFails(t *testing.T) { require.False(t, passes) require.False(t, burnDeposits) - require.False(t, tallyResults.Equals(types.EmptyTallyResult())) + require.False(t, tallyResults.Equals(v1beta1.EmptyTallyResult())) } func TestTallyOnlyValidatorsNonVoter(t *testing.T) { @@ -224,11 +224,11 @@ func TestTallyOnlyValidatorsNonVoter(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddr1, types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddr2, types.NewNonSplitVoteOption(types.OptionNo))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddr1, v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, valAccAddr2, v1beta1.NewNonSplitVoteOption(v1beta1.OptionNo))) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) require.True(t, ok) @@ -236,7 +236,7 @@ func TestTallyOnlyValidatorsNonVoter(t *testing.T) { require.False(t, passes) require.False(t, burnDeposits) - require.False(t, tallyResults.Equals(types.EmptyTallyResult())) + require.False(t, tallyResults.Equals(v1beta1.EmptyTallyResult())) } func TestTallyDelgatorOverride(t *testing.T) { @@ -258,13 +258,13 @@ func TestTallyDelgatorOverride(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[3], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[4], types.NewNonSplitVoteOption(types.OptionNo))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[3], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[4], v1beta1.NewNonSplitVoteOption(v1beta1.OptionNo))) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) require.True(t, ok) @@ -272,7 +272,7 @@ func TestTallyDelgatorOverride(t *testing.T) { require.False(t, passes) require.False(t, burnDeposits) - require.False(t, tallyResults.Equals(types.EmptyTallyResult())) + require.False(t, tallyResults.Equals(v1beta1.EmptyTallyResult())) } func TestTallyDelgatorInherit(t *testing.T) { @@ -294,12 +294,12 @@ func TestTallyDelgatorInherit(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], types.NewNonSplitVoteOption(types.OptionNo))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], types.NewNonSplitVoteOption(types.OptionNo))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], types.NewNonSplitVoteOption(types.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionNo))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta1.NewNonSplitVoteOption(v1beta1.OptionNo))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) require.True(t, ok) @@ -307,7 +307,7 @@ func TestTallyDelgatorInherit(t *testing.T) { require.True(t, passes) require.False(t, burnDeposits) - require.False(t, tallyResults.Equals(types.EmptyTallyResult())) + require.False(t, tallyResults.Equals(v1beta1.EmptyTallyResult())) } func TestTallyDelgatorMultipleOverride(t *testing.T) { @@ -333,13 +333,13 @@ func TestTallyDelgatorMultipleOverride(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[3], types.NewNonSplitVoteOption(types.OptionNo))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[3], v1beta1.NewNonSplitVoteOption(v1beta1.OptionNo))) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) require.True(t, ok) @@ -347,7 +347,7 @@ func TestTallyDelgatorMultipleOverride(t *testing.T) { require.False(t, passes) require.False(t, burnDeposits) - require.False(t, tallyResults.Equals(types.EmptyTallyResult())) + require.False(t, tallyResults.Equals(v1beta1.EmptyTallyResult())) } func TestTallyDelgatorMultipleInherit(t *testing.T) { @@ -375,12 +375,12 @@ func TestTallyDelgatorMultipleInherit(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], types.NewNonSplitVoteOption(types.OptionNo))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], types.NewNonSplitVoteOption(types.OptionNo))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta1.NewNonSplitVoteOption(v1beta1.OptionNo))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta1.NewNonSplitVoteOption(v1beta1.OptionNo))) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) require.True(t, ok) @@ -388,7 +388,7 @@ func TestTallyDelgatorMultipleInherit(t *testing.T) { require.False(t, passes) require.False(t, burnDeposits) - require.False(t, tallyResults.Equals(types.EmptyTallyResult())) + require.False(t, tallyResults.Equals(v1beta1.EmptyTallyResult())) } func TestTallyJailedValidator(t *testing.T) { @@ -418,12 +418,12 @@ func TestTallyJailedValidator(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], types.NewNonSplitVoteOption(types.OptionNo))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], types.NewNonSplitVoteOption(types.OptionNo))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta1.NewNonSplitVoteOption(v1beta1.OptionNo))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta1.NewNonSplitVoteOption(v1beta1.OptionNo))) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) require.True(t, ok) @@ -431,7 +431,7 @@ func TestTallyJailedValidator(t *testing.T) { require.True(t, passes) require.False(t, burnDeposits) - require.False(t, tallyResults.Equals(types.EmptyTallyResult())) + require.False(t, tallyResults.Equals(v1beta1.EmptyTallyResult())) } func TestTallyValidatorMultipleDelegations(t *testing.T) { @@ -451,12 +451,12 @@ func TestTallyValidatorMultipleDelegations(t *testing.T) { proposal, err := app.GovKeeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalId - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], types.NewNonSplitVoteOption(types.OptionYes))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], types.NewNonSplitVoteOption(types.OptionNo))) - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], types.NewNonSplitVoteOption(types.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta1.NewNonSplitVoteOption(v1beta1.OptionNo))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[2], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) proposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) require.True(t, ok) @@ -469,7 +469,7 @@ func TestTallyValidatorMultipleDelegations(t *testing.T) { expectedAbstain := app.StakingKeeper.TokensFromConsensusPower(ctx, 0) expectedNo := app.StakingKeeper.TokensFromConsensusPower(ctx, 10) expectedNoWithVeto := app.StakingKeeper.TokensFromConsensusPower(ctx, 0) - expectedTallyResult := types.NewTallyResult(expectedYes, expectedAbstain, expectedNo, expectedNoWithVeto) + expectedTallyResult := v1beta1.NewTallyResult(expectedYes, expectedAbstain, expectedNo, expectedNoWithVeto) require.True(t, tallyResults.Equals(expectedTallyResult)) } diff --git a/x/gov/keeper/vote.go b/x/gov/keeper/vote.go index 7dfeb4404b30..92ff4a489474 100644 --- a/x/gov/keeper/vote.go +++ b/x/gov/keeper/vote.go @@ -6,25 +6,26 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // AddVote adds a vote on a specific proposal -func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, options types.WeightedVoteOptions) error { +func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, options v1beta1.WeightedVoteOptions) error { proposal, ok := keeper.GetProposal(ctx, proposalID) if !ok { return sdkerrors.Wrapf(types.ErrUnknownProposal, "%d", proposalID) } - if proposal.Status != types.StatusVotingPeriod { + if proposal.Status != v1beta1.StatusVotingPeriod { return sdkerrors.Wrapf(types.ErrInactiveProposal, "%d", proposalID) } for _, option := range options { - if !types.ValidWeightedVoteOption(option) { - return sdkerrors.Wrap(types.ErrInvalidVote, option.String()) + if !v1beta1.ValidWeightedVoteOption(option) { + return sdkerrors.Wrap(v1beta1.ErrInvalidVote, option.String()) } } - vote := types.NewVote(proposalID, voterAddr, options) + vote := v1beta1.NewVote(proposalID, voterAddr, options) keeper.SetVote(ctx, vote) // called after a vote on a proposal is cast @@ -42,8 +43,8 @@ func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.A } // GetAllVotes returns all the votes from the store -func (keeper Keeper) GetAllVotes(ctx sdk.Context) (votes types.Votes) { - keeper.IterateAllVotes(ctx, func(vote types.Vote) bool { +func (keeper Keeper) GetAllVotes(ctx sdk.Context) (votes v1beta1.Votes) { + keeper.IterateAllVotes(ctx, func(vote v1beta1.Vote) bool { populateLegacyOption(&vote) votes = append(votes, vote) return false @@ -52,8 +53,8 @@ func (keeper Keeper) GetAllVotes(ctx sdk.Context) (votes types.Votes) { } // GetVotes returns all the votes from a proposal -func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes types.Votes) { - keeper.IterateVotes(ctx, proposalID, func(vote types.Vote) bool { +func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes v1beta1.Votes) { + keeper.IterateVotes(ctx, proposalID, func(vote v1beta1.Vote) bool { populateLegacyOption(&vote) votes = append(votes, vote) return false @@ -62,7 +63,7 @@ func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes types.V } // GetVote gets the vote from an address on a specific proposal -func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (vote types.Vote, found bool) { +func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (vote v1beta1.Vote, found bool) { store := ctx.KVStore(keeper.storeKey) bz := store.Get(types.VoteKey(proposalID, voterAddr)) if bz == nil { @@ -76,10 +77,10 @@ func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.A } // SetVote sets a Vote to the gov store -func (keeper Keeper) SetVote(ctx sdk.Context, vote types.Vote) { +func (keeper Keeper) SetVote(ctx sdk.Context, vote v1beta1.Vote) { // vote.Option is a deprecated field, we don't set it in state - if vote.Option != types.OptionEmpty { // nolint - vote.Option = types.OptionEmpty // nolint + if vote.Option != v1beta1.OptionEmpty { // nolint + vote.Option = v1beta1.OptionEmpty // nolint } store := ctx.KVStore(keeper.storeKey) @@ -92,13 +93,13 @@ func (keeper Keeper) SetVote(ctx sdk.Context, vote types.Vote) { } // IterateAllVotes iterates over the all the stored votes and performs a callback function -func (keeper Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote types.Vote) (stop bool)) { +func (keeper Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote v1beta1.Vote) (stop bool)) { store := ctx.KVStore(keeper.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.VotesKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var vote types.Vote + var vote v1beta1.Vote keeper.cdc.MustUnmarshal(iterator.Value(), &vote) populateLegacyOption(&vote) @@ -109,13 +110,13 @@ func (keeper Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote types.Vote) ( } // IterateVotes iterates over the all the proposals votes and performs a callback function -func (keeper Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote types.Vote) (stop bool)) { +func (keeper Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote v1beta1.Vote) (stop bool)) { store := ctx.KVStore(keeper.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.VotesKey(proposalID)) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var vote types.Vote + var vote v1beta1.Vote keeper.cdc.MustUnmarshal(iterator.Value(), &vote) populateLegacyOption(&vote) @@ -133,7 +134,7 @@ func (keeper Keeper) deleteVote(ctx sdk.Context, proposalID uint64, voterAddr sd // populateLegacyOption adds graceful fallback of deprecated `Option` field, in case // there's only 1 VoteOption. -func populateLegacyOption(vote *types.Vote) { +func populateLegacyOption(vote *v1beta1.Vote) { if len(vote.Options) == 1 && vote.Options[0].Weight.Equal(sdk.MustNewDecFromStr("1.0")) { vote.Option = vote.Options[0].Option // nolint } diff --git a/x/gov/keeper/vote_test.go b/x/gov/keeper/vote_test.go index 2db792fb5873..61e18ae457ce 100644 --- a/x/gov/keeper/vote_test.go +++ b/x/gov/keeper/vote_test.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) func TestVotes(t *testing.T) { @@ -22,57 +22,57 @@ func TestVotes(t *testing.T) { require.NoError(t, err) proposalID := proposal.ProposalId - var invalidOption types.VoteOption = 0x10 + var invalidOption v1beta1.VoteOption = 0x10 - require.Error(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], types.NewNonSplitVoteOption(types.OptionYes)), "proposal not on voting period") - require.Error(t, app.GovKeeper.AddVote(ctx, 10, addrs[0], types.NewNonSplitVoteOption(types.OptionYes)), "invalid proposal ID") + require.Error(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)), "proposal not on voting period") + require.Error(t, app.GovKeeper.AddVote(ctx, 10, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)), "invalid proposal ID") - proposal.Status = types.StatusVotingPeriod + proposal.Status = v1beta1.StatusVotingPeriod app.GovKeeper.SetProposal(ctx, proposal) - require.Error(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], types.NewNonSplitVoteOption(invalidOption)), "invalid option") + require.Error(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta1.NewNonSplitVoteOption(invalidOption)), "invalid option") // Test first vote - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], types.NewNonSplitVoteOption(types.OptionAbstain))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionAbstain))) vote, found := app.GovKeeper.GetVote(ctx, proposalID, addrs[0]) require.True(t, found) require.Equal(t, addrs[0].String(), vote.Voter) require.Equal(t, proposalID, vote.ProposalId) require.True(t, len(vote.Options) == 1) - require.Equal(t, types.OptionAbstain, vote.Options[0].Option) - require.Equal(t, types.OptionAbstain, vote.Option) + require.Equal(t, v1beta1.OptionAbstain, vote.Options[0].Option) + require.Equal(t, v1beta1.OptionAbstain, vote.Option) // Test change of vote - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], types.NewNonSplitVoteOption(types.OptionYes))) + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[0], v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))) vote, found = app.GovKeeper.GetVote(ctx, proposalID, addrs[0]) require.True(t, found) require.Equal(t, addrs[0].String(), vote.Voter) require.Equal(t, proposalID, vote.ProposalId) require.True(t, len(vote.Options) == 1) - require.Equal(t, types.OptionYes, vote.Options[0].Option) - require.Equal(t, types.OptionYes, vote.Option) + require.Equal(t, v1beta1.OptionYes, vote.Options[0].Option) + require.Equal(t, v1beta1.OptionYes, vote.Option) // Test second vote - require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], types.WeightedVoteOptions{ - types.WeightedVoteOption{Option: types.OptionYes, Weight: sdk.NewDecWithPrec(60, 2)}, - types.WeightedVoteOption{Option: types.OptionNo, Weight: sdk.NewDecWithPrec(30, 2)}, - types.WeightedVoteOption{Option: types.OptionAbstain, Weight: sdk.NewDecWithPrec(5, 2)}, - types.WeightedVoteOption{Option: types.OptionNoWithVeto, Weight: sdk.NewDecWithPrec(5, 2)}, + require.NoError(t, app.GovKeeper.AddVote(ctx, proposalID, addrs[1], v1beta1.WeightedVoteOptions{ + v1beta1.WeightedVoteOption{Option: v1beta1.OptionYes, Weight: sdk.NewDecWithPrec(60, 2)}, + v1beta1.WeightedVoteOption{Option: v1beta1.OptionNo, Weight: sdk.NewDecWithPrec(30, 2)}, + v1beta1.WeightedVoteOption{Option: v1beta1.OptionAbstain, Weight: sdk.NewDecWithPrec(5, 2)}, + v1beta1.WeightedVoteOption{Option: v1beta1.OptionNoWithVeto, Weight: sdk.NewDecWithPrec(5, 2)}, })) vote, found = app.GovKeeper.GetVote(ctx, proposalID, addrs[1]) require.True(t, found) require.Equal(t, addrs[1].String(), vote.Voter) require.Equal(t, proposalID, vote.ProposalId) require.True(t, len(vote.Options) == 4) - require.Equal(t, types.OptionYes, vote.Options[0].Option) - require.Equal(t, types.OptionNo, vote.Options[1].Option) - require.Equal(t, types.OptionAbstain, vote.Options[2].Option) - require.Equal(t, types.OptionNoWithVeto, vote.Options[3].Option) + require.Equal(t, v1beta1.OptionYes, vote.Options[0].Option) + require.Equal(t, v1beta1.OptionNo, vote.Options[1].Option) + require.Equal(t, v1beta1.OptionAbstain, vote.Options[2].Option) + require.Equal(t, v1beta1.OptionNoWithVeto, vote.Options[3].Option) require.True(t, vote.Options[0].Weight.Equal(sdk.NewDecWithPrec(60, 2))) require.True(t, vote.Options[1].Weight.Equal(sdk.NewDecWithPrec(30, 2))) require.True(t, vote.Options[2].Weight.Equal(sdk.NewDecWithPrec(5, 2))) require.True(t, vote.Options[3].Weight.Equal(sdk.NewDecWithPrec(5, 2))) - require.Equal(t, types.OptionEmpty, vote.Option) + require.Equal(t, v1beta1.OptionEmpty, vote.Option) // Test vote iterator // NOTE order of deposits is determined by the addresses @@ -82,7 +82,7 @@ func TestVotes(t *testing.T) { require.Equal(t, addrs[0].String(), votes[0].Voter) require.Equal(t, proposalID, votes[0].ProposalId) require.True(t, len(votes[0].Options) == 1) - require.Equal(t, types.OptionYes, votes[0].Options[0].Option) + require.Equal(t, v1beta1.OptionYes, votes[0].Options[0].Option) require.Equal(t, addrs[1].String(), votes[1].Voter) require.Equal(t, proposalID, votes[1].ProposalId) require.True(t, len(votes[1].Options) == 4) @@ -90,5 +90,5 @@ func TestVotes(t *testing.T) { require.True(t, votes[1].Options[1].Weight.Equal(sdk.NewDecWithPrec(30, 2))) require.True(t, votes[1].Options[2].Weight.Equal(sdk.NewDecWithPrec(5, 2))) require.True(t, votes[1].Options[3].Weight.Equal(sdk.NewDecWithPrec(5, 2))) - require.Equal(t, types.OptionEmpty, vote.Option) + require.Equal(t, v1beta1.OptionEmpty, vote.Option) } diff --git a/x/gov/migrations/v040/migrate.go b/x/gov/migrations/v040/migrate.go index 86d3e2b39a24..fff6adb103a1 100644 --- a/x/gov/migrations/v040/migrate.go +++ b/x/gov/migrations/v040/migrate.go @@ -10,7 +10,7 @@ import ( v040distr "github.com/cosmos/cosmos-sdk/x/distribution/types" v034gov "github.com/cosmos/cosmos-sdk/x/gov/migrations/v034" v036gov "github.com/cosmos/cosmos-sdk/x/gov/migrations/v036" - v040gov "github.com/cosmos/cosmos-sdk/x/gov/types" + v040gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" v036params "github.com/cosmos/cosmos-sdk/x/params/migrations/v036" v040params "github.com/cosmos/cosmos-sdk/x/params/types/proposal" v038upgrade "github.com/cosmos/cosmos-sdk/x/upgrade/migrations/v038" diff --git a/x/gov/module.go b/x/gov/module.go index 311ef7ffa0df..7525a5429ad5 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -24,6 +24,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov/keeper" "github.com/cosmos/cosmos-sdk/x/gov/simulation" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) var ( @@ -52,23 +53,23 @@ func (AppModuleBasic) Name() string { // RegisterLegacyAminoCodec registers the gov module's types for the given codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) + v1beta1.RegisterLegacyAminoCodec(cdc) } // DefaultGenesis returns default genesis state as raw bytes for the gov // module. func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) + return cdc.MustMarshalJSON(v1beta1.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the gov module. func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var data types.GenesisState + var data v1beta1.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } - return types.ValidateGenesis(&data) + return v1beta1.ValidateGenesis(&data) } // RegisterRESTRoutes registers the REST routes for the gov module. @@ -78,7 +79,7 @@ func (a AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Ro // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the gov module. func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + if err := v1beta1.RegisterQueryHandlerClient(context.Background(), mux, v1beta1.NewQueryClient(clientCtx)); err != nil { panic(err) } } @@ -100,7 +101,7 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { // RegisterInterfaces implements InterfaceModule.RegisterInterfaces func (a AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { - types.RegisterInterfaces(registry) + v1beta1.RegisterInterfaces(registry) } // AppModule implements an application module for the gov module. @@ -149,8 +150,8 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd // RegisterServices registers module services. func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + v1beta1.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + v1beta1.RegisterQueryServer(cfg.QueryServer(), am.keeper) m := keeper.NewMigrator(am.keeper) err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) @@ -162,7 +163,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { // InitGenesis performs genesis initialization for the gov module. It returns // no validator updates. func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { - var genesisState types.GenesisState + var genesisState v1beta1.GenesisState cdc.MustUnmarshalJSON(data, &genesisState) InitGenesis(ctx, am.accountKeeper, am.bankKeeper, am.keeper, &genesisState) return []abci.ValidatorUpdate{} diff --git a/x/gov/simulation/decoder_test.go b/x/gov/simulation/decoder_test.go index 44752440f041..3f0d68a38263 100644 --- a/x/gov/simulation/decoder_test.go +++ b/x/gov/simulation/decoder_test.go @@ -14,6 +14,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/kv" "github.com/cosmos/cosmos-sdk/x/gov/simulation" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) var ( @@ -26,16 +27,16 @@ func TestDecodeStore(t *testing.T) { dec := simulation.NewDecodeStore(cdc) endTime := time.Now().UTC() - content := types.ContentFromProposalType("test", "test", types.ProposalTypeText) - proposalA, err := types.NewProposal(content, 1, endTime, endTime.Add(24*time.Hour)) + content := v1beta1.ContentFromProposalType("test", "test", v1beta1.ProposalTypeText) + proposalA, err := v1beta1.NewProposal(content, 1, endTime, endTime.Add(24*time.Hour)) require.NoError(t, err) - proposalB, err := types.NewProposal(content, 2, endTime, endTime.Add(24*time.Hour)) + proposalB, err := v1beta1.NewProposal(content, 2, endTime, endTime.Add(24*time.Hour)) require.NoError(t, err) proposalIDBz := make([]byte, 8) binary.LittleEndian.PutUint64(proposalIDBz, 1) - deposit := types.NewDeposit(1, delAddr1, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt()))) - vote := types.NewVote(1, delAddr1, types.NewNonSplitVoteOption(types.OptionYes)) + deposit := v1beta1.NewDeposit(1, delAddr1, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt()))) + vote := v1beta1.NewVote(1, delAddr1, v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)) proposalBzA, err := cdc.Marshal(&proposalA) require.NoError(t, err) diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index 022613277668..7e1752b6c075 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -13,6 +13,7 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/gov/keeper" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/simulation" ) @@ -125,21 +126,21 @@ func SimulateMsgSubmitProposal( // 1) submit proposal now content := contentSim(r, ctx, accs) if content == nil { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgSubmitProposal, "content is nil"), nil, nil + return simtypes.NoOpMsg(v1beta1.ModuleName, v1beta1.TypeMsgSubmitProposal, "content is nil"), nil, nil } simAccount, _ := simtypes.RandomAcc(r, accs) deposit, skip, err := randomDeposit(r, ctx, ak, bk, k, simAccount.Address) switch { case skip: - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgSubmitProposal, "skip deposit"), nil, nil + return simtypes.NoOpMsg(v1beta1.ModuleName, v1beta1.TypeMsgSubmitProposal, "skip deposit"), nil, nil case err != nil: - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgSubmitProposal, "unable to generate deposit"), nil, err + return simtypes.NoOpMsg(v1beta1.ModuleName, v1beta1.TypeMsgSubmitProposal, "unable to generate deposit"), nil, err } - msg, err := types.NewMsgSubmitProposal(content, deposit, simAccount.Address) + msg, err := v1beta1.NewMsgSubmitProposal(content, deposit, simAccount.Address) if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate a submit proposal msg"), nil, err + return simtypes.NoOpMsg(v1beta1.ModuleName, msg.Type(), "unable to generate a submit proposal msg"), nil, err } account := ak.GetAccount(ctx, simAccount.Address) @@ -150,7 +151,7 @@ func SimulateMsgSubmitProposal( if !hasNeg { fees, err = simtypes.RandomFees(r, ctx, coins) if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate fees"), nil, err + return simtypes.NoOpMsg(v1beta1.ModuleName, msg.Type(), "unable to generate fees"), nil, err } } @@ -166,12 +167,12 @@ func SimulateMsgSubmitProposal( simAccount.PrivKey, ) if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate mock tx"), nil, err + return simtypes.NoOpMsg(v1beta1.ModuleName, msg.Type(), "unable to generate mock tx"), nil, err } _, _, err = app.SimDeliver(txGen.TxEncoder(), tx) if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to deliver tx"), nil, err + return simtypes.NoOpMsg(v1beta1.ModuleName, msg.Type(), "unable to deliver tx"), nil, err } opMsg := simtypes.NewOperationMsg(msg, true, "", nil) @@ -179,7 +180,7 @@ func SimulateMsgSubmitProposal( // get the submitted proposal ID proposalID, err := k.GetProposalID(ctx) if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate proposalID"), nil, err + return simtypes.NoOpMsg(v1beta1.ModuleName, msg.Type(), "unable to generate proposalID"), nil, err } // 2) Schedule operations for votes @@ -214,20 +215,20 @@ func SimulateMsgDeposit(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Ke accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) - proposalID, ok := randomProposalID(r, k, ctx, types.StatusDepositPeriod) + proposalID, ok := randomProposalID(r, k, ctx, v1beta1.StatusDepositPeriod) if !ok { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgDeposit, "unable to generate proposalID"), nil, nil + return simtypes.NoOpMsg(v1beta1.ModuleName, v1beta1.TypeMsgDeposit, "unable to generate proposalID"), nil, nil } deposit, skip, err := randomDeposit(r, ctx, ak, bk, k, simAccount.Address) switch { case skip: - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgDeposit, "skip deposit"), nil, nil + return simtypes.NoOpMsg(v1beta1.ModuleName, v1beta1.TypeMsgDeposit, "skip deposit"), nil, nil case err != nil: - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgDeposit, "unable to generate deposit"), nil, err + return simtypes.NoOpMsg(v1beta1.ModuleName, v1beta1.TypeMsgDeposit, "unable to generate deposit"), nil, err } - msg := types.NewMsgDeposit(simAccount.Address, proposalID, deposit) + msg := v1beta1.NewMsgDeposit(simAccount.Address, proposalID, deposit) account := ak.GetAccount(ctx, simAccount.Address) spendable := bk.SpendableCoins(ctx, account.GetAddress()) @@ -237,7 +238,7 @@ func SimulateMsgDeposit(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Ke if !hasNeg { fees, err = simtypes.RandomFees(r, ctx, coins) if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate fees"), nil, err + return simtypes.NoOpMsg(v1beta1.ModuleName, msg.Type(), "unable to generate fees"), nil, err } } @@ -250,7 +251,7 @@ func SimulateMsgDeposit(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Ke Context: ctx, SimAccount: simAccount, AccountKeeper: ak, - ModuleName: types.ModuleName, + ModuleName: v1beta1.ModuleName, } return simulation.GenAndDeliverTx(txCtx, fees) @@ -277,16 +278,16 @@ func operationSimulateMsgVote(ak types.AccountKeeper, bk types.BankKeeper, k kee switch { case proposalIDInt < 0: var ok bool - proposalID, ok = randomProposalID(r, k, ctx, types.StatusVotingPeriod) + proposalID, ok = randomProposalID(r, k, ctx, v1beta1.StatusVotingPeriod) if !ok { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgVote, "unable to generate proposalID"), nil, nil + return simtypes.NoOpMsg(v1beta1.ModuleName, v1beta1.TypeMsgVote, "unable to generate proposalID"), nil, nil } default: proposalID = uint64(proposalIDInt) } option := randomVotingOption(r) - msg := types.NewMsgVote(simAccount.Address, proposalID, option) + msg := v1beta1.NewMsgVote(simAccount.Address, proposalID, option) account := ak.GetAccount(ctx, simAccount.Address) spendable := bk.SpendableCoins(ctx, account.GetAddress()) @@ -302,7 +303,7 @@ func operationSimulateMsgVote(ak types.AccountKeeper, bk types.BankKeeper, k kee SimAccount: simAccount, AccountKeeper: ak, Bankkeeper: bk, - ModuleName: types.ModuleName, + ModuleName: v1beta1.ModuleName, CoinsSpentInMsg: spendable, } @@ -330,16 +331,16 @@ func operationSimulateMsgVoteWeighted(ak types.AccountKeeper, bk types.BankKeepe switch { case proposalIDInt < 0: var ok bool - proposalID, ok = randomProposalID(r, k, ctx, types.StatusVotingPeriod) + proposalID, ok = randomProposalID(r, k, ctx, v1beta1.StatusVotingPeriod) if !ok { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgVoteWeighted, "unable to generate proposalID"), nil, nil + return simtypes.NoOpMsg(v1beta1.ModuleName, v1beta1.TypeMsgVoteWeighted, "unable to generate proposalID"), nil, nil } default: proposalID = uint64(proposalIDInt) } options := randomWeightedVotingOptions(r) - msg := types.NewMsgVoteWeighted(simAccount.Address, proposalID, options) + msg := v1beta1.NewMsgVoteWeighted(simAccount.Address, proposalID, options) account := ak.GetAccount(ctx, simAccount.Address) spendable := bk.SpendableCoins(ctx, account.GetAddress()) @@ -355,7 +356,7 @@ func operationSimulateMsgVoteWeighted(ak types.AccountKeeper, bk types.BankKeepe SimAccount: simAccount, AccountKeeper: ak, Bankkeeper: bk, - ModuleName: types.ModuleName, + ModuleName: v1beta1.ModuleName, CoinsSpentInMsg: spendable, } @@ -404,7 +405,7 @@ func randomDeposit(r *rand.Rand, ctx sdk.Context, // that matches a given Status. // It does not provide a default ID. func randomProposalID(r *rand.Rand, k keeper.Keeper, - ctx sdk.Context, status types.ProposalStatus) (proposalID uint64, found bool) { + ctx sdk.Context, status v1beta1.ProposalStatus) (proposalID uint64, found bool) { proposalID, _ = k.GetProposalID(ctx) switch { @@ -427,49 +428,49 @@ func randomProposalID(r *rand.Rand, k keeper.Keeper, } // Pick a random voting option -func randomVotingOption(r *rand.Rand) types.VoteOption { +func randomVotingOption(r *rand.Rand) v1beta1.VoteOption { switch r.Intn(4) { case 0: - return types.OptionYes + return v1beta1.OptionYes case 1: - return types.OptionAbstain + return v1beta1.OptionAbstain case 2: - return types.OptionNo + return v1beta1.OptionNo case 3: - return types.OptionNoWithVeto + return v1beta1.OptionNoWithVeto default: panic("invalid vote option") } } // Pick a random weighted voting options -func randomWeightedVotingOptions(r *rand.Rand) types.WeightedVoteOptions { +func randomWeightedVotingOptions(r *rand.Rand) v1beta1.WeightedVoteOptions { w1 := r.Intn(100 + 1) w2 := r.Intn(100 - w1 + 1) w3 := r.Intn(100 - w1 - w2 + 1) w4 := 100 - w1 - w2 - w3 - weightedVoteOptions := types.WeightedVoteOptions{} + weightedVoteOptions := v1beta1.WeightedVoteOptions{} if w1 > 0 { - weightedVoteOptions = append(weightedVoteOptions, types.WeightedVoteOption{ - Option: types.OptionYes, + weightedVoteOptions = append(weightedVoteOptions, v1beta1.WeightedVoteOption{ + Option: v1beta1.OptionYes, Weight: sdk.NewDecWithPrec(int64(w1), 2), }) } if w2 > 0 { - weightedVoteOptions = append(weightedVoteOptions, types.WeightedVoteOption{ - Option: types.OptionAbstain, + weightedVoteOptions = append(weightedVoteOptions, v1beta1.WeightedVoteOption{ + Option: v1beta1.OptionAbstain, Weight: sdk.NewDecWithPrec(int64(w2), 2), }) } if w3 > 0 { - weightedVoteOptions = append(weightedVoteOptions, types.WeightedVoteOption{ - Option: types.OptionNo, + weightedVoteOptions = append(weightedVoteOptions, v1beta1.WeightedVoteOption{ + Option: v1beta1.OptionNo, Weight: sdk.NewDecWithPrec(int64(w3), 2), }) } if w4 > 0 { - weightedVoteOptions = append(weightedVoteOptions, types.WeightedVoteOption{ - Option: types.OptionNoWithVeto, + weightedVoteOptions = append(weightedVoteOptions, v1beta1.WeightedVoteOption{ + Option: v1beta1.OptionNoWithVeto, Weight: sdk.NewDecWithPrec(int64(w4), 2), }) } diff --git a/x/gov/simulation/operations_test.go b/x/gov/simulation/operations_test.go index bce345de0556..dc12482f5145 100644 --- a/x/gov/simulation/operations_test.go +++ b/x/gov/simulation/operations_test.go @@ -16,7 +16,7 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/bank/testutil" "github.com/cosmos/cosmos-sdk/x/gov/simulation" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" ) @@ -34,7 +34,7 @@ func (m MockWeightedProposalContent) DefaultWeight() int { func (m MockWeightedProposalContent) ContentSimulatorFn() simtypes.ContentSimulatorFn { return func(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) simtypes.Content { - return types.NewTextProposal( + return v1beta1.NewTextProposal( fmt.Sprintf("title-%d: %s", m.n, simtypes.RandStringOfLength(r, 100)), fmt.Sprintf("description-%d: %s", m.n, simtypes.RandStringOfLength(r, 4000)), ) @@ -76,12 +76,12 @@ func TestWeightedOperations(t *testing.T) { opMsgRoute string opMsgName string }{ - {0, types.ModuleName, "submit_proposal"}, - {1, types.ModuleName, "submit_proposal"}, - {2, types.ModuleName, "submit_proposal"}, - {simappparams.DefaultWeightMsgDeposit, types.ModuleName, types.TypeMsgDeposit}, - {simappparams.DefaultWeightMsgVote, types.ModuleName, types.TypeMsgVote}, - {simappparams.DefaultWeightMsgVoteWeighted, types.ModuleName, types.TypeMsgVoteWeighted}, + {0, v1beta1.ModuleName, "submit_proposal"}, + {1, v1beta1.ModuleName, "submit_proposal"}, + {2, v1beta1.ModuleName, "submit_proposal"}, + {simappparams.DefaultWeightMsgDeposit, v1beta1.ModuleName, v1beta1.TypeMsgDeposit}, + {simappparams.DefaultWeightMsgVote, v1beta1.ModuleName, v1beta1.TypeMsgVote}, + {simappparams.DefaultWeightMsgVoteWeighted, v1beta1.ModuleName, v1beta1.TypeMsgVoteWeighted}, } for i, w := range weightesOps { @@ -113,8 +113,8 @@ func TestSimulateMsgSubmitProposal(t *testing.T) { operationMsg, _, err := op(r, app.BaseApp, ctx, accounts, "") require.NoError(t, err) - var msg types.MsgSubmitProposal - types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) + var msg v1beta1.MsgSubmitProposal + v1beta1.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) require.True(t, operationMsg.OK) require.Equal(t, "cosmos1p8wcgrjr4pjju90xg6u9cgq55dxwq8j7u4x9a0", msg.Proposer) @@ -122,7 +122,7 @@ func TestSimulateMsgSubmitProposal(t *testing.T) { require.Equal(t, "title-3: ZBSpYuLyYggwexjxusrBqDOTtGTOWeLrQKjLxzIivHSlcxgdXhhuTSkuxKGLwQvuyNhYFmBZHeAerqyNEUzXPFGkqEGqiQWIXnku", msg.GetContent().GetTitle()) require.Equal(t, "description-3: NJWzHdBNpAXKJPHWQdrGYcAHSctgVlqwqHoLfHsXUdStwfefwzqLuKEhmMyYLdbZrcPgYqjNHxPexsruwEGStAneKbWkQDDIlCWBLSiAASNhZqNFlPtfqPJoxKsgMdzjWqLWdqKQuJqWPMvwPQWZUtVMOTMYKJbfdlZsjdsomuScvDmbDkgRualsxDvRJuCAmPOXitIbcyWsKGSdrEunFAOdmXnsuyFVgJqEjbklvmwrUlsxjRSfKZxGcpayDdgoFcnVSutxjRgOSFzPwidAjubMncNweqpbxhXGchpZUxuFDOtpnhNUycJICRYqsPhPSCjPTWZFLkstHWJxvdPEAyEIxXgLwbNOjrgzmaujiBABBIXvcXpLrbcEWNNQsbjvgJFgJkflpRohHUutvnaUqoopuKjTDaemDeSdqbnOzcfJpcTuAQtZoiLZOoAIlboFDAeGmSNwkvObPRvRWQgWkGkxwtPauYgdkmypLjbqhlHJIQTntgWjXwZdOyYEdQRRLfMSdnxqppqUofqLbLQDUjwKVKfZJUJQPsWIPwIVaSTrmKskoAhvmZyJgeRpkaTfGgrJzAigcxtfshmiDCFkuiluqtMOkidknnTBtumyJYlIsWLnCQclqdVmikUoMOPdPWwYbJxXyqUVicNxFxyqJTenNblyyKSdlCbiXxUiYUiMwXZASYfvMDPFgxniSjWaZTjHkqlJvtBsXqwPpyVxnJVGFWhfSxgOcduoxkiopJvFjMmFabrGYeVtTXLhxVUEiGwYUvndjFGzDVntUvibiyZhfMQdMhgsiuysLMiePBNXifRLMsSmXPkwlPloUbJveCvUlaalhZHuvdkCnkSHbMbmOnrfEGPwQiACiPlnihiaOdbjPqPiTXaHDoJXjSlZmltGqNHHNrcKdlFSCdmVOuvDcBLdSklyGJmcLTbSFtALdGlPkqqecJrpLCXNPWefoTJNgEJlyMEPneVaxxduAAEqQpHWZodWyRkDAxzyMnFMcjSVqeRXLqsNyNtQBbuRvunZflWSbbvXXdkyLikYqutQhLPONXbvhcQZJPS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oYBEpmrlAxrUxYMUekKbpjPNfjUCjhbdMAnJmYQVZBQZkFVweHDAlaqJjRqoQPoOMLhyvYCzqEuQsAFoxWrzRnTVjStPadhsESlERnKhpEPsfDxNvxqcOyIulaCkmPdambLHvGhTZzysvqFauEgkFRItPfvisehFmoBhQqmkfbHVsgfHXDPJVyhwPllQpuYLRYvGodxKjkarnSNgsXoKEMlaSKxKdcVgvOkuLcfLFfdtXGTclqfPOfeoVLbqcjcXCUEBgAGplrkgsmIEhWRZLlGPGCwKWRaCKMkBHTAcypUrYjWwCLtOPVygMwMANGoQwFnCqFrUGMCRZUGJKTZIGPyldsifauoMnJPLTcDHmilcmahlqOELaAUYDBuzsVywnDQfwRLGIWozYaOAilMBcObErwgTDNGWnwQMUgFFSKtPDMEoEQCTKVREqrXZSGLqwTMcxHfWotDllNkIJPMbXzjDVjPOOjCFuIvTyhXKLyhUScOXvYthRXpPfKwMhptXaxIxgqBoUqzrWbaoLTVpQoottZyPFfNOoMioXHRuFwMRYUiKvcWPkrayyTLOCFJlAyslDameIuqVAuxErqFPEWIScKpBORIuZqoXlZuTvAjEdlEWDODFRregDTqGNoFBIHxvimmIZwLfFyKUfEWAnNBdtdzDmTPXtpHRGdIbuucfTjOygZsTxPjfweXhSUkMhPjMaxKlMIJMOXcnQfyzeOcbWwNbeH", msg.GetContent().GetDescription()) require.Equal(t, "gov", msg.Route()) - require.Equal(t, types.TypeMsgSubmitProposal, msg.Type()) + require.Equal(t, v1beta1.TypeMsgSubmitProposal, msg.Type()) } // TestSimulateMsgDeposit tests the normal scenario of a valid message of type TypeMsgDeposit. @@ -138,12 +138,12 @@ func TestSimulateMsgDeposit(t *testing.T) { accounts := getTestingAccounts(t, r, app, ctx, 3) // setup a proposal - content := types.NewTextProposal("Test", "description") + content := v1beta1.NewTextProposal("Test", "description") submitTime := ctx.BlockHeader().Time depositPeriod := app.GovKeeper.GetDepositParams(ctx).MaxDepositPeriod - proposal, err := types.NewProposal(content, 1, submitTime, submitTime.Add(depositPeriod)) + proposal, err := v1beta1.NewProposal(content, 1, submitTime, submitTime.Add(depositPeriod)) require.NoError(t, err) app.GovKeeper.SetProposal(ctx, proposal) @@ -156,15 +156,15 @@ func TestSimulateMsgDeposit(t *testing.T) { operationMsg, _, err := op(r, app.BaseApp, ctx, accounts, "") require.NoError(t, err) - var msg types.MsgDeposit - types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) + var msg v1beta1.MsgDeposit + v1beta1.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) require.True(t, operationMsg.OK) require.Equal(t, uint64(1), msg.ProposalId) require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.Depositor) require.Equal(t, "560969stake", msg.Amount.String()) require.Equal(t, "gov", msg.Route()) - require.Equal(t, types.TypeMsgDeposit, msg.Type()) + require.Equal(t, v1beta1.TypeMsgDeposit, msg.Type()) } // TestSimulateMsgVote tests the normal scenario of a valid message of type TypeMsgVote. @@ -180,12 +180,12 @@ func TestSimulateMsgVote(t *testing.T) { accounts := getTestingAccounts(t, r, app, ctx, 3) // setup a proposal - content := types.NewTextProposal("Test", "description") + content := v1beta1.NewTextProposal("Test", "description") submitTime := ctx.BlockHeader().Time depositPeriod := app.GovKeeper.GetDepositParams(ctx).MaxDepositPeriod - proposal, err := types.NewProposal(content, 1, submitTime, submitTime.Add(depositPeriod)) + proposal, err := v1beta1.NewProposal(content, 1, submitTime, submitTime.Add(depositPeriod)) require.NoError(t, err) app.GovKeeper.ActivateVotingPeriod(ctx, proposal) @@ -198,15 +198,15 @@ func TestSimulateMsgVote(t *testing.T) { operationMsg, _, err := op(r, app.BaseApp, ctx, accounts, "") require.NoError(t, err) - var msg types.MsgVote - types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) + var msg v1beta1.MsgVote + v1beta1.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) require.True(t, operationMsg.OK) require.Equal(t, uint64(1), msg.ProposalId) require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.Voter) - require.Equal(t, types.OptionYes, msg.Option) + require.Equal(t, v1beta1.OptionYes, msg.Option) require.Equal(t, "gov", msg.Route()) - require.Equal(t, types.TypeMsgVote, msg.Type()) + require.Equal(t, v1beta1.TypeMsgVote, msg.Type()) } // TestSimulateMsgVoteWeighted tests the normal scenario of a valid message of type TypeMsgVoteWeighted. @@ -222,12 +222,12 @@ func TestSimulateMsgVoteWeighted(t *testing.T) { accounts := getTestingAccounts(t, r, app, ctx, 3) // setup a proposal - content := types.NewTextProposal("Test", "description") + content := v1beta1.NewTextProposal("Test", "description") submitTime := ctx.BlockHeader().Time depositPeriod := app.GovKeeper.GetDepositParams(ctx).MaxDepositPeriod - proposal, err := types.NewProposal(content, 1, submitTime, submitTime.Add(depositPeriod)) + proposal, err := v1beta1.NewProposal(content, 1, submitTime, submitTime.Add(depositPeriod)) require.NoError(t, err) app.GovKeeper.ActivateVotingPeriod(ctx, proposal) @@ -240,15 +240,15 @@ func TestSimulateMsgVoteWeighted(t *testing.T) { operationMsg, _, err := op(r, app.BaseApp, ctx, accounts, "") require.NoError(t, err) - var msg types.MsgVoteWeighted - types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) + var msg v1beta1.MsgVoteWeighted + v1beta1.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) require.True(t, operationMsg.OK) require.Equal(t, uint64(1), msg.ProposalId) require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.Voter) require.True(t, len(msg.Options) >= 1) require.Equal(t, "gov", msg.Route()) - require.Equal(t, types.TypeMsgVoteWeighted, msg.Type()) + require.Equal(t, v1beta1.TypeMsgVoteWeighted, msg.Type()) } // returns context and an app with updated mint keeper diff --git a/x/gov/simulation/proposals.go b/x/gov/simulation/proposals.go index 322774c984eb..41da53b6dce4 100644 --- a/x/gov/simulation/proposals.go +++ b/x/gov/simulation/proposals.go @@ -6,7 +6,7 @@ import ( simappparams "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/simulation" ) @@ -26,7 +26,7 @@ func ProposalContents() []simtypes.WeightedProposalContent { // SimulateTextProposalContent returns a random text proposal content. func SimulateTextProposalContent(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) simtypes.Content { - return types.NewTextProposal( + return v1beta1.NewTextProposal( simtypes.RandStringOfLength(r, 140), simtypes.RandStringOfLength(r, 5000), ) diff --git a/x/gov/types/codec.go b/x/gov/types/codec.go index e59e0ef49c66..62da2c5b227b 100644 --- a/x/gov/types/codec.go +++ b/x/gov/types/codec.go @@ -11,12 +11,10 @@ import ( // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the // governance module. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterInterface((*Content)(nil), nil) cdc.RegisterConcrete(&MsgSubmitProposal{}, "cosmos-sdk/MsgSubmitProposal", nil) cdc.RegisterConcrete(&MsgDeposit{}, "cosmos-sdk/MsgDeposit", nil) cdc.RegisterConcrete(&MsgVote{}, "cosmos-sdk/MsgVote", nil) cdc.RegisterConcrete(&MsgVoteWeighted{}, "cosmos-sdk/MsgVoteWeighted", nil) - cdc.RegisterConcrete(&TextProposal{}, "cosmos-sdk/TextProposal", nil) } func RegisterInterfaces(registry types.InterfaceRegistry) { @@ -26,11 +24,6 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgVoteWeighted{}, &MsgDeposit{}, ) - registry.RegisterInterface( - "cosmos.gov.v1beta1.Content", - (*Content)(nil), - &TextProposal{}, - ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/gov/types/content.go b/x/gov/types/content.go deleted file mode 100644 index 44cbe6af7547..000000000000 --- a/x/gov/types/content.go +++ /dev/null @@ -1,55 +0,0 @@ -package types - -import ( - "strings" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// Constants pertaining to a Content object -const ( - MaxDescriptionLength int = 5000 - MaxTitleLength int = 140 -) - -// Content defines an interface that a proposal must implement. It contains -// information such as the title and description along with the type and routing -// information for the appropriate handler to process the proposal. Content can -// have additional fields, which will handled by a proposal's Handler. -// TODO Try to unify this interface with types/module/simulation -// https://github.com/cosmos/cosmos-sdk/issues/5853 -type Content interface { - GetTitle() string - GetDescription() string - ProposalRoute() string - ProposalType() string - ValidateBasic() error - String() string -} - -// Handler defines a function that handles a proposal after it has passed the -// governance process. -type Handler func(ctx sdk.Context, content Content) error - -// ValidateAbstract validates a proposal's abstract contents returning an error -// if invalid. -func ValidateAbstract(c Content) error { - title := c.GetTitle() - if len(strings.TrimSpace(title)) == 0 { - return sdkerrors.Wrap(ErrInvalidProposalContent, "proposal title cannot be blank") - } - if len(title) > MaxTitleLength { - return sdkerrors.Wrapf(ErrInvalidProposalContent, "proposal title is longer than max length of %d", MaxTitleLength) - } - - description := c.GetDescription() - if len(description) == 0 { - return sdkerrors.Wrap(ErrInvalidProposalContent, "proposal description cannot be blank") - } - if len(description) > MaxDescriptionLength { - return sdkerrors.Wrapf(ErrInvalidProposalContent, "proposal description is longer than max length of %d", MaxDescriptionLength) - } - - return nil -} diff --git a/x/gov/types/errors.go b/x/gov/types/errors.go index 96973f1751a2..9f86b4383175 100644 --- a/x/gov/types/errors.go +++ b/x/gov/types/errors.go @@ -6,12 +6,17 @@ import ( // x/gov module sentinel errors var ( - ErrUnknownProposal = sdkerrors.Register(ModuleName, 2, "unknown proposal") - ErrInactiveProposal = sdkerrors.Register(ModuleName, 3, "inactive proposal") - ErrAlreadyActiveProposal = sdkerrors.Register(ModuleName, 4, "proposal already active") - ErrInvalidProposalContent = sdkerrors.Register(ModuleName, 5, "invalid proposal content") - ErrInvalidProposalType = sdkerrors.Register(ModuleName, 6, "invalid proposal type") + ErrUnknownProposal = sdkerrors.Register(ModuleName, 2, "unknown proposal") + ErrInactiveProposal = sdkerrors.Register(ModuleName, 3, "inactive proposal") + ErrAlreadyActiveProposal = sdkerrors.Register(ModuleName, 4, "proposal already active") + // Errors 5 & 6 are reserved as legacy errors + // See x/gov/types/v1beta1/errors.go ErrInvalidVote = sdkerrors.Register(ModuleName, 7, "invalid vote option") ErrInvalidGenesis = sdkerrors.Register(ModuleName, 8, "invalid genesis state") ErrNoProposalHandlerExists = sdkerrors.Register(ModuleName, 9, "no handler exists for proposal type") + ErrUnroutableProposalMsg = sdkerrors.Register(ModuleName, 10, "proposal message not recognized by router") + ErrNoProposalMsgs = sdkerrors.Register(ModuleName, 11, "no messages proposed") + ErrInvalidProposalMsg = sdkerrors.Register(ModuleName, 12, "invalid proposal message") + ErrInvalidSigner = sdkerrors.Register(ModuleName, 13, "expected gov account as only signer for proposal message") + ErrInvalidSignalMsg = sdkerrors.Register(ModuleName, 14, "signal message is invalid") ) diff --git a/x/gov/types/events.go b/x/gov/types/events.go index 19f8857f3a1c..b34c48ac99af 100644 --- a/x/gov/types/events.go +++ b/x/gov/types/events.go @@ -7,6 +7,7 @@ const ( EventTypeProposalVote = "proposal_vote" EventTypeInactiveProposal = "inactive_proposal" EventTypeActiveProposal = "active_proposal" + EventTypeSignalProposal = "signal_proposal" AttributeKeyProposalResult = "proposal_result" AttributeKeyOption = "option" @@ -18,4 +19,6 @@ const ( AttributeValueProposalRejected = "proposal_rejected" // didn't meet vote quorum AttributeValueProposalFailed = "proposal_failed" // error on proposal handler AttributeKeyProposalType = "proposal_type" + AttributeSignalTitle = "signal_title" + AttributeSignalDescription = "signal_description" ) diff --git a/x/gov/types/genesis.pb.go b/x/gov/types/genesis.pb.go index 27f91f1c03ac..4eb8a5da2d47 100644 --- a/x/gov/types/genesis.pb.go +++ b/x/gov/types/genesis.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/gov/v1beta1/genesis.proto +// source: cosmos/gov/v1beta2/genesis.proto package types @@ -26,7 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // 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"` + 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. @@ -34,18 +34,18 @@ type GenesisState struct { // 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"` + 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 VotingParams `protobuf:"bytes,6,opt,name=voting_params,json=votingParams,proto3" json:"voting_params"` + VotingParams 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"` + 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_43cd825e0fa7a627, []int{0} + return fileDescriptor_7915ab39bb5aa171, []int{0} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -124,38 +124,40 @@ func (m *GenesisState) GetTallyParams() TallyParams { } func init() { - proto.RegisterType((*GenesisState)(nil), "cosmos.gov.v1beta1.GenesisState") + proto.RegisterType((*GenesisState)(nil), "cosmos.gov.v1beta2.GenesisState") } -func init() { proto.RegisterFile("cosmos/gov/v1beta1/genesis.proto", fileDescriptor_43cd825e0fa7a627) } +func init() { proto.RegisterFile("cosmos/gov/v1beta2/genesis.proto", fileDescriptor_7915ab39bb5aa171) } -var fileDescriptor_43cd825e0fa7a627 = []byte{ - // 389 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xc1, 0x6e, 0xda, 0x40, - 0x14, 0x45, 0xed, 0x62, 0x28, 0x0c, 0x50, 0xb5, 0x23, 0x16, 0x16, 0x45, 0xc6, 0xed, 0xca, 0x9b, - 0xda, 0x85, 0xae, 0xbb, 0xb1, 0x2a, 0xb5, 0xa8, 0x6a, 0x85, 0xdc, 0x2a, 0x8b, 0x6c, 0x90, 0xc1, - 0x23, 0xc7, 0x0a, 0xf0, 0x2c, 0xbf, 0x89, 0x15, 0x76, 0xf9, 0x84, 0x7c, 0x47, 0xbe, 0x84, 0x25, - 0xcb, 0xac, 0x92, 0x08, 0x7e, 0x24, 0xf2, 0x8c, 0x9d, 0x38, 0x8a, 0x93, 0x95, 0x3d, 0xf7, 0xde, - 0x39, 0xba, 0xf3, 0xf4, 0x88, 0xb9, 0x00, 0x5c, 0x01, 0x3a, 0x21, 0xa4, 0x4e, 0x3a, 0x9a, 0x33, - 0xee, 0x8f, 0x9c, 0x90, 0xad, 0x19, 0x46, 0x68, 0xc7, 0x09, 0x70, 0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, 0x38, 0xf3, 0x85, 0x57, 0x66, 0x53, 0x2e, 0xd3, 0x3a, 0x69, 0x49, 0xa3, 0xbf, - 0x48, 0x87, 0xfb, 0xcb, 0xe5, 0xa6, 0x60, 0xbd, 0x15, 0xac, 0x61, 0x15, 0xeb, 0x7f, 0x96, 0x7b, - 0x82, 0x6a, 0xf3, 0x92, 0xe4, 0x6e, 0xf7, 0x86, 0xba, 0xdb, 0x1b, 0xea, 0xdd, 0xde, 0x50, 0x2f, - 0x0f, 0x86, 0xb2, 0x3b, 0x18, 0xca, 0xf5, 0xc1, 0x50, 0x8e, 0xad, 0x30, 0xe2, 0x27, 0x67, 0x73, - 0x7b, 0x01, 0x2b, 0x27, 0xdf, 0x22, 0xf9, 0xf9, 0x82, 0xc1, 0xa9, 0x73, 0x2e, 0x56, 0x8a, 0x6f, - 0x62, 0x86, 0xf3, 0x86, 0xd8, 0xa6, 0x6f, 0xf7, 0x01, 0x00, 0x00, 0xff, 0xff, 0x2d, 0x3b, 0x1a, - 0xbf, 0xb9, 0x02, 0x00, 0x00, +var fileDescriptor_7915ab39bb5aa171 = []byte{ + // 430 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xb1, 0x8e, 0xd3, 0x40, + 0x10, 0x86, 0x63, 0x2e, 0x39, 0xee, 0x36, 0x09, 0x82, 0x25, 0x48, 0xd6, 0x25, 0xd8, 0xc6, 0x55, + 0x1a, 0x6c, 0x11, 0x3a, 0x24, 0x1a, 0x0b, 0x09, 0x5d, 0x81, 0x74, 0x18, 0x44, 0x41, 0x13, 0x6d, + 0xe2, 0xd5, 0x62, 0x61, 0xdf, 0x58, 0x9e, 0xc5, 0x22, 0x6f, 0xc1, 0x73, 0xf0, 0x24, 0x57, 0x5e, + 0x49, 0x15, 0x50, 0x52, 0xd1, 0xde, 0x13, 0x20, 0xef, 0xae, 0xc1, 0x11, 0x86, 0x2a, 0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0x73, 0xda, 0x54, 0x30, 0xfe, 0x43, 0xa0, 0x82, 0xdc, 0x31, 0x9d, + 0x2d, 0x0b, 0x56, 0xb2, 0x1c, 0xed, 0x81, 0x67, 0xcd, 0x87, 0x8b, 0x47, 0xff, 0x79, 0xde, 0x85, + 0x0a, 0x46, 0x0f, 0x6b, 0xf0, 0xcd, 0xd6, 0x7d, 0xa0, 0x87, 0x79, 0x88, 0xf1, 0xe3, 0x71, 0xd2, + 0x4e, 0xd3, 0x35, 0x19, 0x57, 0xa0, 0x87, 0xad, 0x3d, 0xc7, 0xca, 0xe3, 0xfd, 0xe3, 0xf9, 0xf5, + 0xf8, 0xb5, 0x66, 0x66, 0x34, 0x13, 0xad, 0x39, 0x80, 0xf8, 0xf1, 0xa8, 0x6a, 0x65, 0xe9, 0x92, + 0x8c, 0x24, 0xcb, 0xb2, 0x4d, 0xe3, 0xb8, 0xad, 0x1c, 0x6e, 0x97, 0xe3, 0x6d, 0x9d, 0x33, 0x8a, + 0xa9, 0x51, 0xdc, 0xd7, 0x8a, 0x36, 0xc2, 0x8f, 0x87, 0xb2, 0x95, 0x8c, 0xae, 0x76, 0x8e, 0x75, + 0xbd, 0x73, 0xac, 0x1f, 0x3b, 0xc7, 0xfa, 0xb2, 0x77, 0x7a, 0xd7, 0x7b, 0xa7, 0xf7, 0x6d, 0xef, + 0xf4, 0xde, 0xcf, 0x45, 0x2a, 0x3f, 0x7c, 0x5a, 0x05, 0x6b, 0xc8, 0x43, 0xb3, 0xae, 0xfa, 0xe7, + 0x31, 0x26, 0x1f, 0xc3, 0xcf, 0x6a, 0x77, 0xe5, 0xa6, 0xe0, 0xb8, 0x3a, 0x56, 0x6b, 0xfb, 0xf4, + 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x59, 0xfd, 0x9f, 0x57, 0x22, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/gov/types/gov.pb.go b/x/gov/types/gov.pb.go index 4b32cf249afe..e6ec82ef985d 100644 --- a/x/gov/types/gov.pb.go +++ b/x/gov/types/gov.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/gov/v1beta1/gov.proto +// source: cosmos/gov/v1beta2/gov.proto package types @@ -69,7 +69,7 @@ func (x VoteOption) String() string { } func (VoteOption) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{0} + return fileDescriptor_5abf7b8852811c49, []int{0} } // ProposalStatus enumerates the valid statuses of a proposal. @@ -118,21 +118,19 @@ func (x ProposalStatus) String() string { } func (ProposalStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{1} + return fileDescriptor_5abf7b8852811c49, []int{1} } // WeightedVoteOption defines a unit of vote for vote split. -// -// Since: cosmos-sdk 0.43 type WeightedVoteOption struct { - Option VoteOption `protobuf:"varint,1,opt,name=option,proto3,enum=cosmos.gov.v1beta1.VoteOption" json:"option,omitempty"` + Option VoteOption `protobuf:"varint,1,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"` Weight github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"weight"` } func (m *WeightedVoteOption) Reset() { *m = WeightedVoteOption{} } func (*WeightedVoteOption) ProtoMessage() {} func (*WeightedVoteOption) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{0} + return fileDescriptor_5abf7b8852811c49, []int{0} } func (m *WeightedVoteOption) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -161,45 +159,6 @@ func (m *WeightedVoteOption) XXX_DiscardUnknown() { var xxx_messageInfo_WeightedVoteOption proto.InternalMessageInfo -// TextProposal defines a standard text proposal whose changes need to be -// manually updated in case of approval. -type TextProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` -} - -func (m *TextProposal) Reset() { *m = TextProposal{} } -func (*TextProposal) ProtoMessage() {} -func (*TextProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{1} -} -func (m *TextProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TextProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TextProposal.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 *TextProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_TextProposal.Merge(m, src) -} -func (m *TextProposal) XXX_Size() int { - return m.Size() -} -func (m *TextProposal) XXX_DiscardUnknown() { - xxx_messageInfo_TextProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_TextProposal proto.InternalMessageInfo - // Deposit defines an amount deposited by an account address to an active // proposal. type Deposit struct { @@ -211,7 +170,7 @@ type Deposit struct { func (m *Deposit) Reset() { *m = Deposit{} } func (*Deposit) ProtoMessage() {} func (*Deposit) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{2} + return fileDescriptor_5abf7b8852811c49, []int{1} } func (m *Deposit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -242,21 +201,21 @@ var xxx_messageInfo_Deposit proto.InternalMessageInfo // Proposal defines the core field members of a governance proposal. type Proposal struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"id"` - Content *types1.Any `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` - Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=cosmos.gov.v1beta1.ProposalStatus" json:"status,omitempty"` - FinalTallyResult TallyResult `protobuf:"bytes,4,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result"` - SubmitTime time.Time `protobuf:"bytes,5,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time"` - DepositEndTime time.Time `protobuf:"bytes,6,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time"` - TotalDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,7,rep,name=total_deposit,json=totalDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"total_deposit"` - VotingStartTime time.Time `protobuf:"bytes,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time"` - VotingEndTime time.Time `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time"` + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"id" yaml:"id"` + Messages []*types1.Any `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"` + Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=cosmos.gov.v1beta2.ProposalStatus" json:"status,omitempty" yaml:"proposal_status"` + FinalTallyResult TallyResult `protobuf:"bytes,4,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result" yaml:"final_tally_result"` + SubmitTime time.Time `protobuf:"bytes,5,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time" yaml:"submit_time"` + DepositEndTime time.Time `protobuf:"bytes,6,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,7,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,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time" yaml:"voting_start_time"` + VotingEndTime time.Time `protobuf:"bytes,9,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_6e82113c1a9a4b7c, []int{3} + return fileDescriptor_5abf7b8852811c49, []int{2} } func (m *Proposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -296,7 +255,7 @@ type TallyResult struct { func (m *TallyResult) Reset() { *m = TallyResult{} } func (*TallyResult) ProtoMessage() {} func (*TallyResult) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{4} + return fileDescriptor_5abf7b8852811c49, []int{3} } func (m *TallyResult) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -333,15 +292,14 @@ type Vote struct { // Deprecated: Prefer to use `options` instead. This field is set in queries // if and only if `len(options) == 1` and that option has weight 1. In all // other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta1.VoteOption" json:"option,omitempty"` // Deprecated: Do not use. - // Since: cosmos-sdk 0.43 + Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"` // Deprecated: Do not use. Options []WeightedVoteOption `protobuf:"bytes,4,rep,name=options,proto3" json:"options"` } func (m *Vote) Reset() { *m = Vote{} } func (*Vote) ProtoMessage() {} func (*Vote) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{5} + return fileDescriptor_5abf7b8852811c49, []int{4} } func (m *Vote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -382,7 +340,7 @@ type DepositParams struct { func (m *DepositParams) Reset() { *m = DepositParams{} } func (*DepositParams) ProtoMessage() {} func (*DepositParams) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{6} + return fileDescriptor_5abf7b8852811c49, []int{5} } func (m *DepositParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -420,7 +378,7 @@ type VotingParams struct { func (m *VotingParams) Reset() { *m = VotingParams{} } func (*VotingParams) ProtoMessage() {} func (*VotingParams) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{7} + return fileDescriptor_5abf7b8852811c49, []int{6} } func (m *VotingParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -464,7 +422,7 @@ type TallyParams struct { func (m *TallyParams) Reset() { *m = TallyParams{} } func (*TallyParams) ProtoMessage() {} func (*TallyParams) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{8} + return fileDescriptor_5abf7b8852811c49, []int{7} } func (m *TallyParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -494,137 +452,111 @@ func (m *TallyParams) XXX_DiscardUnknown() { var xxx_messageInfo_TallyParams proto.InternalMessageInfo func init() { - proto.RegisterEnum("cosmos.gov.v1beta1.VoteOption", VoteOption_name, VoteOption_value) - proto.RegisterEnum("cosmos.gov.v1beta1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) - proto.RegisterType((*WeightedVoteOption)(nil), "cosmos.gov.v1beta1.WeightedVoteOption") - proto.RegisterType((*TextProposal)(nil), "cosmos.gov.v1beta1.TextProposal") - proto.RegisterType((*Deposit)(nil), "cosmos.gov.v1beta1.Deposit") - proto.RegisterType((*Proposal)(nil), "cosmos.gov.v1beta1.Proposal") - proto.RegisterType((*TallyResult)(nil), "cosmos.gov.v1beta1.TallyResult") - proto.RegisterType((*Vote)(nil), "cosmos.gov.v1beta1.Vote") - proto.RegisterType((*DepositParams)(nil), "cosmos.gov.v1beta1.DepositParams") - proto.RegisterType((*VotingParams)(nil), "cosmos.gov.v1beta1.VotingParams") - proto.RegisterType((*TallyParams)(nil), "cosmos.gov.v1beta1.TallyParams") -} - -func init() { proto.RegisterFile("cosmos/gov/v1beta1/gov.proto", fileDescriptor_6e82113c1a9a4b7c) } - -var fileDescriptor_6e82113c1a9a4b7c = []byte{ - // 1352 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcf, 0x6f, 0x13, 0xc7, - 0x17, 0xf7, 0xda, 0x8e, 0x93, 0x3c, 0x3b, 0xc9, 0x32, 0xe4, 0x0b, 0x8e, 0xbf, 0x7c, 0xed, 0x95, - 0xbf, 0x12, 0x8d, 0x10, 0x71, 0x20, 0x95, 0x90, 0x1a, 0x7a, 0xb1, 0xe3, 0x4d, 0x6b, 0x14, 0xd9, - 0xd6, 0x7a, 0x71, 0x04, 0x87, 0xae, 0x36, 0xde, 0xc1, 0xd9, 0xd6, 0xbb, 0x63, 0xbc, 0xe3, 0x90, - 0xdc, 0x7a, 0xa9, 0x84, 0x7c, 0xe2, 0xc8, 0xc5, 0x12, 0x6a, 0x6f, 0x3d, 0xf5, 0xc0, 0x3f, 0xd0, - 0x1b, 0xaa, 0x7a, 0xa0, 0x9c, 0x50, 0x0f, 0xa1, 0x04, 0xb5, 0xa2, 0xfc, 0x15, 0xd5, 0xce, 0xcc, - 0x26, 0x1b, 0x27, 0x6a, 0x70, 0xe9, 0x29, 0xbb, 0x33, 0x9f, 0x1f, 0xf3, 0x9e, 0xdf, 0x7b, 0xb3, - 0x81, 0x4b, 0x2d, 0xe2, 0x39, 0xc4, 0x5b, 0x6e, 0x93, 0x9d, 0xe5, 0x9d, 0xeb, 0x5b, 0x98, 0x9a, - 0xd7, 0xfd, 0xe7, 0x42, 0xb7, 0x47, 0x28, 0x41, 0x88, 0xef, 0x16, 0xfc, 0x15, 0xb1, 0x9b, 0xc9, - 0x0a, 0xc6, 0x96, 0xe9, 0xe1, 0x43, 0x4a, 0x8b, 0xd8, 0x2e, 0xe7, 0x64, 0xe6, 0xdb, 0xa4, 0x4d, - 0xd8, 0xe3, 0xb2, 0xff, 0x24, 0x56, 0x73, 0x6d, 0x42, 0xda, 0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x9a, - 0x5c, 0x23, 0x2e, 0xc5, 0x2e, 0xcd, 0xff, 0x22, 0xc1, 0x64, 0x19, 0x77, 0x89, 0x67, 0x53, 0x94, - 0x83, 0x64, 0x57, 0x18, 0x18, 0xb6, 0xc5, 0xa4, 0xe3, 0x1a, 0x04, 0x4b, 0x15, 0x0b, 0xdd, 0x80, - 0x69, 0x8b, 0x63, 0x49, 0x4f, 0x84, 0x97, 0x7e, 0xf1, 0x74, 0x69, 0x5e, 0x1c, 0xb8, 0x68, 0x59, - 0x3d, 0xec, 0x79, 0x0d, 0xda, 0xb3, 0xdd, 0xb6, 0x76, 0x04, 0x45, 0x2d, 0x48, 0x98, 0x0e, 0xe9, - 0xbb, 0x34, 0x1d, 0x53, 0x62, 0x8b, 0xc9, 0x95, 0x85, 0x20, 0x97, 0x7e, 0x81, 0x1c, 0x26, 0x73, - 0x8d, 0xd8, 0x6e, 0xe9, 0x9a, 0x9f, 0xae, 0xef, 0x5f, 0xe5, 0x16, 0xdf, 0x23, 0x5d, 0x3e, 0xc1, - 0xd3, 0x84, 0xf4, 0xea, 0xd4, 0xc3, 0x27, 0xb9, 0xc8, 0xdb, 0x27, 0xb9, 0x48, 0xfe, 0x87, 0x09, - 0x98, 0x3a, 0xcc, 0xd4, 0x47, 0xa7, 0x04, 0x55, 0x4a, 0xbc, 0xdb, 0xcf, 0x45, 0x6d, 0xeb, 0x58, - 0x70, 0x37, 0x61, 0xb2, 0xc5, 0x93, 0xc2, 0x42, 0x4b, 0xae, 0xcc, 0x17, 0x78, 0x51, 0x15, 0x82, - 0xa2, 0x2a, 0x14, 0xdd, 0xbd, 0x52, 0x32, 0x94, 0x3d, 0x2d, 0x60, 0xa0, 0x55, 0x48, 0x78, 0xd4, - 0xa4, 0x7d, 0x2f, 0x1d, 0x63, 0xd5, 0x92, 0x3f, 0xad, 0x5a, 0x82, 0x33, 0x35, 0x18, 0x52, 0x13, - 0x0c, 0xd4, 0x00, 0x74, 0xcf, 0x76, 0xcd, 0x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0x90, 0xf0, 0x97, - 0xb8, 0x45, 0xf1, 0xa9, 0xfa, 0xeb, 0xc5, 0xca, 0x86, 0x5a, 0x96, 0x27, 0xc2, 0xfa, 0xeb, 0xa6, - 0xdd, 0xc1, 0x16, 0x4f, 0x67, 0xa9, 0xfa, 0xec, 0x75, 0x36, 0xf2, 0xf2, 0x75, 0x36, 0xf2, 0xf5, - 0x41, 0x36, 0xf2, 0xec, 0x20, 0x2b, 0x3d, 0x3f, 0xc8, 0x4a, 0xbf, 0x1d, 0x64, 0xa5, 0x47, 0x6f, - 0xb2, 0x91, 0xe7, 0x6f, 0xb2, 0x91, 0x97, 0x6f, 0xb2, 0x91, 0xbb, 0x7f, 0x3f, 0xbf, 0x76, 0xd9, - 0xff, 0x3c, 0xac, 0x6c, 0xb7, 0x12, 0x6c, 0x22, 0x7c, 0xfc, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x8c, 0x21, 0xa9, 0x1b, 0x0e, 0x0d, 0x00, 0x00, -} - -func (this *TextProposal) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*TextProposal) - if !ok { - that2, ok := that.(TextProposal) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Title != that1.Title { - return false - } - if this.Description != that1.Description { - return false - } - return true + proto.RegisterEnum("cosmos.gov.v1beta2.VoteOption", VoteOption_name, VoteOption_value) + proto.RegisterEnum("cosmos.gov.v1beta2.ProposalStatus", ProposalStatus_name, ProposalStatus_value) + proto.RegisterType((*WeightedVoteOption)(nil), "cosmos.gov.v1beta2.WeightedVoteOption") + proto.RegisterType((*Deposit)(nil), "cosmos.gov.v1beta2.Deposit") + proto.RegisterType((*Proposal)(nil), "cosmos.gov.v1beta2.Proposal") + proto.RegisterType((*TallyResult)(nil), "cosmos.gov.v1beta2.TallyResult") + proto.RegisterType((*Vote)(nil), "cosmos.gov.v1beta2.Vote") + proto.RegisterType((*DepositParams)(nil), "cosmos.gov.v1beta2.DepositParams") + proto.RegisterType((*VotingParams)(nil), "cosmos.gov.v1beta2.VotingParams") + proto.RegisterType((*TallyParams)(nil), "cosmos.gov.v1beta2.TallyParams") +} + +func init() { proto.RegisterFile("cosmos/gov/v1beta2/gov.proto", fileDescriptor_5abf7b8852811c49) } + +var fileDescriptor_5abf7b8852811c49 = []byte{ + // 1386 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0x4f, 0x6f, 0x13, 0x47, + 0x1b, 0xf7, 0xda, 0xc6, 0x49, 0x26, 0x4e, 0x58, 0x26, 0x79, 0x93, 0x8d, 0x5f, 0xde, 0xdd, 0x7d, + 0x97, 0x0a, 0x45, 0x08, 0x1c, 0x48, 0x2b, 0xa4, 0xa6, 0xbd, 0x78, 0xf1, 0xa6, 0x18, 0x21, 0xdb, + 0x5a, 0x2f, 0x46, 0x50, 0xa9, 0xab, 0x8d, 0x77, 0x70, 0xb6, 0xf5, 0xee, 0x18, 0xef, 0x38, 0x90, + 0x5b, 0x2f, 0x95, 0x90, 0x4f, 0x1c, 0xb9, 0x58, 0x42, 0xed, 0xad, 0x67, 0xbe, 0x40, 0x6f, 0x1c, + 0x7a, 0xa0, 0x9c, 0x50, 0x0f, 0xa6, 0x04, 0xb5, 0xa2, 0xf4, 0xc6, 0x27, 0xa8, 0x76, 0x66, 0x36, + 0xb1, 0x9d, 0xa8, 0x26, 0xe5, 0x94, 0xf5, 0xcc, 0xef, 0xcf, 0xf3, 0x3c, 0x3b, 0xcf, 0xb3, 0x13, + 0x70, 0xba, 0x81, 0x43, 0x1f, 0x87, 0x6b, 0x4d, 0xbc, 0xb3, 0xb6, 0x73, 0x69, 0x0b, 0x11, 0x67, + 0x3d, 0x7a, 0xce, 0xb7, 0x3b, 0x98, 0x60, 0x08, 0xd9, 0x6e, 0x3e, 0x5a, 0xe1, 0xbb, 0x39, 0x99, + 0x33, 0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, 0x4e, 0xcb, 0x26, + 0x4e, 0xab, 0xb5, 0x6b, 0x77, 0x50, 0xd8, 0x6d, 0x11, 0x29, 0xad, 0x0a, 0xab, 0xb3, 0xeb, 0xca, + 0x51, 0x1e, 0x56, 0x84, 0x33, 0x29, 0x4c, 0xff, 0x7f, 0x54, 0xcd, 0x77, 0x03, 0x65, 0x85, 0x99, + 0x1c, 0x16, 0xd2, 0x4c, 0x91, 0x2e, 0x0e, 0x91, 0xe0, 0x97, 0x60, 0x36, 0xec, 0x6e, 0xf9, 0x1e, + 0xb1, 0xa3, 0x3e, 0x91, 0x4e, 0x50, 0xab, 0xdc, 0xa1, 0xf4, 0xad, 0xb8, 0x89, 0x74, 0x99, 0xbb, + 0x40, 0xe6, 0x32, 0x44, 0xd6, 0x1e, 0xbe, 0x54, 0x04, 0x13, 0xb0, 0x95, 0x88, 0x00, 0x3d, 0x20, + 0xf2, 0x73, 0x61, 0xa3, 0xc0, 0x65, 0x0e, 0x99, 0x89, 0x0e, 0x67, 0xb8, 0xc3, 0x32, 0x73, 0x18, + 0x57, 0x60, 0x36, 0xf3, 0x7c, 0xd9, 0x08, 0x5c, 0x6a, 0xf5, 0x40, 0x00, 0x73, 0x04, 0x13, 0xa7, + 0x65, 0xf3, 0x0d, 0x69, 0x6a, 0xd2, 0xe9, 0xbb, 0xca, 0x7d, 0x16, 0x99, 0xcf, 0x08, 0x5b, 0x3b, + 0xd6, 0xa9, 0xcc, 0x52, 0x6e, 0xdc, 0x59, 0x2d, 0x70, 0x6a, 0x07, 0x13, 0x2f, 0x68, 0x46, 0xaf, + 0xb7, 0xc3, 0x0b, 0x3b, 0x3d, 0x31, 0xed, 0x8f, 0x78, 0x38, 0x12, 0x0b, 0xe7, 0x90, 0x04, 0xcb, + 0xfb, 0x24, 0x5b, 0xaf, 0x45, 0xcb, 0x34, 0xf1, 0x3b, 0x80, 0x2f, 0x1d, 0x94, 0x78, 0x66, 0xa2, + 0x97, 0xc6, 0xbd, 0x96, 0x46,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2f, 0x62, 0x6e, 0x32, 0xb7, 0xd4, 0xeb, 0xab, + 0x90, 0x71, 0xeb, 0x43, 0xe7, 0x1c, 0x9e, 0x07, 0x4b, 0xe3, 0xd4, 0x6a, 0xa1, 0x56, 0x33, 0x8a, + 0x62, 0x2a, 0x27, 0xf6, 0xfa, 0x6a, 0x96, 0x71, 0xaa, 0x4e, 0x18, 0xa2, 0xe8, 0x5a, 0x28, 0x8d, + 0xa3, 0x4d, 0xe3, 0x9a, 0x71, 0xc5, 0x32, 0x8a, 0x62, 0x3a, 0x07, 0x7b, 0x7d, 0x75, 0x9e, 0xe1, + 0x4d, 0xf4, 0x35, 0x6a, 0x10, 0x74, 0xa4, 0xfe, 0x66, 0xa1, 0x74, 0xdd, 0x28, 0x8a, 0x27, 0x86, + 0xf5, 0x37, 0x1d, 0xaf, 0x85, 0x5c, 0x56, 0x4e, 0xbd, 0xfc, 0xf4, 0x95, 0x9c, 0x78, 0xf1, 0x4a, + 0x4e, 0x7c, 0xbb, 0x27, 0x27, 0x9e, 0xee, 0xc9, 0xc2, 0xb3, 0x3d, 0x59, 0xf8, 0x6d, 0x4f, 0x16, + 0x1e, 0xbe, 0x96, 0x13, 0xcf, 0x5e, 0xcb, 0x89, 0x17, 0xaf, 0xe5, 0xc4, 0xed, 0x7f, 0x9e, 0x5f, + 0xf7, 0xe9, 0x7f, 0x55, 0xf4, 0xd8, 0x6e, 0x65, 0xe8, 0x44, 0xf8, 0xf8, 0xef, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x0c, 0xf2, 0xd0, 0x1b, 0x70, 0x0d, 0x00, 0x00, } + func (this *Proposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -647,9 +579,14 @@ func (this *Proposal) Equal(that interface{}) bool { if this.ProposalId != that1.ProposalId { return false } - if !this.Content.Equal(that1.Content) { + if len(this.Messages) != len(that1.Messages) { return false } + for i := range this.Messages { + if !this.Messages[i].Equal(that1.Messages[i]) { + return false + } + } if this.Status != that1.Status { return false } @@ -749,43 +686,6 @@ func (m *WeightedVoteOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *TextProposal) 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 *TextProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TextProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintGov(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *Deposit) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -916,17 +816,19 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - if m.Content != nil { - { - size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Messages) > 0 { + for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 } if m.ProposalId != 0 { i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) @@ -1073,12 +975,12 @@ func (m *DepositParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxDepositPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxDepositPeriod):]) - if err7 != nil { - return 0, err7 + n6, err6 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxDepositPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxDepositPeriod):]) + if err6 != nil { + return 0, err6 } - i -= n7 - i = encodeVarintGov(dAtA, i, uint64(n7)) + i -= n6 + i = encodeVarintGov(dAtA, i, uint64(n6)) i-- dAtA[i] = 0x12 if len(m.MinDeposit) > 0 { @@ -1118,12 +1020,12 @@ func (m *VotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n8, err8 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.VotingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod):]) - if err8 != nil { - return 0, err8 + n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.VotingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod):]) + if err7 != nil { + return 0, err7 } - i -= n8 - i = encodeVarintGov(dAtA, i, uint64(n8)) + i -= n7 + i = encodeVarintGov(dAtA, i, uint64(n7)) i-- dAtA[i] = 0xa return len(dAtA) - i, nil @@ -1207,23 +1109,6 @@ func (m *WeightedVoteOption) Size() (n int) { return n } -func (m *TextProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - return n -} - func (m *Deposit) Size() (n int) { if m == nil { return 0 @@ -1255,9 +1140,11 @@ func (m *Proposal) Size() (n int) { if m.ProposalId != 0 { n += 1 + sovGov(uint64(m.ProposalId)) } - if m.Content != nil { - l = m.Content.Size() - n += 1 + l + sovGov(uint64(l)) + if len(m.Messages) > 0 { + for _, e := range m.Messages { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } } if m.Status != 0 { n += 1 + sovGov(uint64(m.Status)) @@ -1475,120 +1362,6 @@ func (m *WeightedVoteOption) Unmarshal(dAtA []byte) error { } return nil } -func (m *TextProposal) 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: TextProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TextProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", 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.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", 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.Description = 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 *Deposit) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1774,7 +1547,7 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1801,10 +1574,8 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Content == nil { - m.Content = &types1.Any{} - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Messages = append(m.Messages, &types1.Any{}) + if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index 5ab560ccf915..3357d3f032a9 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -10,6 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdktx "github.com/cosmos/cosmos-sdk/types/tx" ) // Governance message types and routes @@ -18,6 +19,11 @@ const ( TypeMsgVote = "vote" TypeMsgVoteWeighted = "weighted_vote" TypeMsgSubmitProposal = "submit_proposal" + TypeMsgSignal = "signal" + + // Constants pertaining to a Signal message + MaxDescriptionLength int = 5000 + MaxTitleLength int = 140 ) var ( @@ -27,15 +33,16 @@ var ( // NewMsgSubmitProposal creates a new MsgSubmitProposal. //nolint:interfacer -func NewMsgSubmitProposal(content Content, initialDeposit sdk.Coins, proposer sdk.AccAddress) (*MsgSubmitProposal, error) { +func NewMsgSubmitProposal(messages []sdk.Msg, initialDeposit sdk.Coins, proposer sdk.AccAddress) (*MsgSubmitProposal, error) { m := &MsgSubmitProposal{ InitialDeposit: initialDeposit, Proposer: proposer.String(), } - err := m.SetContent(content) - if err != nil { - return nil, err + + if err := m.SetMessages(messages); err != nil { + return &MsgSubmitProposal{}, err } + return m, nil } @@ -46,12 +53,8 @@ func (m *MsgSubmitProposal) GetProposer() sdk.AccAddress { return proposer } -func (m *MsgSubmitProposal) GetContent() Content { - content, ok := m.Content.GetCachedValue().(Content) - if !ok { - return nil - } - return content +func (m *MsgSubmitProposal) GetMessages() ([]sdk.Msg, error) { + return sdktx.GetMsgs(m.Messages, "sdk.MsgProposal") } func (m *MsgSubmitProposal) SetInitialDeposit(coins sdk.Coins) { @@ -62,16 +65,21 @@ func (m *MsgSubmitProposal) SetProposer(address fmt.Stringer) { m.Proposer = address.String() } -func (m *MsgSubmitProposal) SetContent(content Content) error { - msg, ok := content.(proto.Message) - if !ok { - return fmt.Errorf("can't proto marshal %T", msg) - } - any, err := types.NewAnyWithValue(msg) - if err != nil { - return err +func (m *MsgSubmitProposal) SetMessages(messages []sdk.Msg) error { + msgs := make([]*types.Any, len(messages)) + for i, msg := range messages { + m, ok := msg.(proto.Message) + if !ok { + return fmt.Errorf("can't proto marshal %T", msg) + } + any, err := types.NewAnyWithValue(m) + if err != nil { + return err + } + + msgs[i] = any } - m.Content = any + m.Messages = msgs return nil } @@ -93,17 +101,24 @@ func (m MsgSubmitProposal) ValidateBasic() error { return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.InitialDeposit.String()) } - content := m.GetContent() - if content == nil { - return sdkerrors.Wrap(ErrInvalidProposalContent, "missing content") - } - if !IsValidProposalType(content.ProposalType()) { - return sdkerrors.Wrap(ErrInvalidProposalType, content.ProposalType()) - } - if err := content.ValidateBasic(); err != nil { + // Empty messages are not allowed + // TODO: ValidateBasic should check that either metadata or length is non nil + // if m.Messages == nil || len(m.Messages) == 0 { + // return ErrNoProposalMsgs + // } + + msgs, err := m.GetMessages() + if err != nil { return err } + for idx, msg := range msgs { + if err := msg.ValidateBasic(); err != nil { + return sdkerrors.Wrap(ErrInvalidProposalMsg, + fmt.Sprintf("msg: %d, err: %s", idx, err.Error())) + } + } + return nil } @@ -127,8 +142,7 @@ func (m MsgSubmitProposal) String() string { // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (m MsgSubmitProposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { - var content Content - return unpacker.UnpackAny(m.Content, &content) + return sdktx.UnpackInterfaces(unpacker, m.Messages) } // NewMsgDeposit creates a new MsgDeposit instance diff --git a/x/gov/types/msgs_test.go b/x/gov/types/msgs_test.go index 2a8fd5275895..6f426937e93c 100644 --- a/x/gov/types/msgs_test.go +++ b/x/gov/types/msgs_test.go @@ -1,7 +1,6 @@ package types import ( - "strings" "testing" "github.com/stretchr/testify/require" @@ -23,42 +22,6 @@ func init() { coinsMulti.Sort() } -// test ValidateBasic for MsgCreateValidator -func TestMsgSubmitProposal(t *testing.T) { - tests := []struct { - title, description string - proposalType string - proposerAddr sdk.AccAddress - initialDeposit sdk.Coins - expectPass bool - }{ - {"Test Proposal", "the purpose of this proposal is to test", ProposalTypeText, addrs[0], coinsPos, true}, - {"", "the purpose of this proposal is to test", ProposalTypeText, addrs[0], coinsPos, false}, - {"Test Proposal", "", ProposalTypeText, addrs[0], coinsPos, false}, - {"Test Proposal", "the purpose of this proposal is to test", ProposalTypeText, sdk.AccAddress{}, coinsPos, false}, - {"Test Proposal", "the purpose of this proposal is to test", ProposalTypeText, addrs[0], coinsZero, true}, - {"Test Proposal", "the purpose of this proposal is to test", ProposalTypeText, addrs[0], coinsMulti, true}, - {strings.Repeat("#", MaxTitleLength*2), "the purpose of this proposal is to test", ProposalTypeText, addrs[0], coinsMulti, false}, - {"Test Proposal", strings.Repeat("#", MaxDescriptionLength*2), ProposalTypeText, addrs[0], coinsMulti, false}, - } - - for i, tc := range tests { - msg, err := NewMsgSubmitProposal( - ContentFromProposalType(tc.title, tc.description, tc.proposalType), - tc.initialDeposit, - tc.proposerAddr, - ) - - require.NoError(t, err) - - if tc.expectPass { - require.NoError(t, msg.ValidateBasic(), "test: %v", i) - } else { - require.Error(t, msg.ValidateBasic(), "test: %v", i) - } - } -} - func TestMsgDepositGetSignBytes(t *testing.T) { addr := sdk.AccAddress("addr1") msg := NewMsgDeposit(addr, 0, coinsPos) @@ -164,13 +127,13 @@ func TestMsgVoteWeighted(t *testing.T) { // this tests that Amino JSON MsgSubmitProposal.GetSignBytes() still works with Content as Any using the ModuleCdc func TestMsgSubmitProposal_GetSignBytes(t *testing.T) { - msg, err := NewMsgSubmitProposal(NewTextProposal("test", "abcd"), sdk.NewCoins(), sdk.AccAddress{}) + proposal := []sdk.Msg{NewMsgVote(addrs[0], 1, OptionYes)} + msg, err := NewMsgSubmitProposal(proposal, sdk.NewCoins(), sdk.AccAddress{}) require.NoError(t, err) var bz []byte require.NotPanics(t, func() { bz = msg.GetSignBytes() }) - require.Equal(t, - `{"type":"cosmos-sdk/MsgSubmitProposal","value":{"content":{"type":"cosmos-sdk/TextProposal","value":{"description":"abcd","title":"test"}},"initial_deposit":[]}}`, + require.Equal(t, "{\"type\":\"cosmos-sdk/MsgSubmitProposal\",\"value\":{\"initial_deposit\":[],\"messages\":[{\"type\":\"cosmos-sdk/MsgVote\",\"value\":{\"option\":1,\"proposal_id\":\"1\",\"voter\":\"cosmos1w3jhxap3gempvr\"}}]}}", string(bz)) } diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index 66e9c28fbcb5..0f106b69d6bc 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -5,32 +5,27 @@ import ( "strings" "time" - "github.com/gogo/protobuf/proto" "sigs.k8s.io/yaml" "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdktx "github.com/cosmos/cosmos-sdk/types/tx" ) // DefaultStartingProposalID is 1 const DefaultStartingProposalID uint64 = 1 // NewProposal creates a new Proposal instance -func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Time) (Proposal, error) { - msg, ok := content.(proto.Message) - if !ok { - return Proposal{}, fmt.Errorf("%T does not implement proto.Message", content) - } +func NewProposal(messages []sdk.Msg, id uint64, submitTime, depositEndTime time.Time) (Proposal, error) { - any, err := types.NewAnyWithValue(msg) + msgs, err := sdktx.SetMsgs(messages) if err != nil { return Proposal{}, err } p := Proposal{ - Content: any, ProposalId: id, + Messages: msgs, Status: StatusDepositPeriod, FinalTallyResult: EmptyTallyResult(), TotalDeposit: sdk.NewCoins(), @@ -47,43 +42,14 @@ func (p Proposal) String() string { return string(out) } -// GetContent returns the proposal Content -func (p Proposal) GetContent() Content { - content, ok := p.Content.GetCachedValue().(Content) - if !ok { - return nil - } - return content -} - -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() -} - -func (p Proposal) GetTitle() string { - content := p.GetContent() - if content == nil { - return "" - } - return content.GetTitle() +// GetMessages returns the proposal messages +func (p Proposal) GetMessages() ([]sdk.Msg, error) { + return sdktx.GetMsgs(p.Messages, "sdk.MsgProposal") } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (p Proposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { - var content Content - return unpacker.UnpackAny(p.Content, &content) + return sdktx.UnpackInterfaces(unpacker, p.Messages) } // Proposals is an array of proposal @@ -110,9 +76,8 @@ func (p Proposals) Equal(other Proposals) bool { 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()) + out += fmt.Sprintf("%d - %s\n", + prop.ProposalId, prop.Status) } return strings.TrimSpace(out) } @@ -142,19 +107,6 @@ func ProposalStatusFromString(str string) (ProposalStatus, error) { 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 == StatusVotingPeriod || - status == StatusPassed || - status == StatusRejected || - status == StatusFailed { - return true - } - return false -} - // Marshal needed for protobuf compatibility func (status ProposalStatus) Marshal() ([]byte, error) { return []byte{byte(status)}, nil @@ -178,85 +130,15 @@ func (status ProposalStatus) Format(s fmt.State, verb rune) { } } -// Proposal types -const ( - ProposalTypeText string = "Text" -) - -// Implements Content Interface -var _ Content = &TextProposal{} - -// NewTextProposal creates a text proposal Content -func NewTextProposal(title, description string) Content { - return &TextProposal{title, description} -} - -// GetTitle returns the proposal title -func (tp *TextProposal) GetTitle() string { return tp.Title } - -// GetDescription returns the proposal description -func (tp *TextProposal) GetDescription() string { return tp.Description } - -// ProposalRoute returns the proposal router key -func (tp *TextProposal) ProposalRoute() string { return RouterKey } - -// ProposalType is "Text" -func (tp *TextProposal) ProposalType() string { return ProposalTypeText } - -// ValidateBasic validates the content's title and description of the proposal -func (tp *TextProposal) ValidateBasic() error { return ValidateAbstract(tp) } - -// String implements Stringer interface -func (tp TextProposal) String() string { - out, _ := yaml.Marshal(tp) - return string(out) -} - -var validProposalTypes = map[string]struct{}{ - ProposalTypeText: {}, -} - -// RegisterProposalType registers a proposal type. It will panic if the type is -// already registered. -func RegisterProposalType(ty string) { - if _, ok := validProposalTypes[ty]; ok { - panic(fmt.Sprintf("already registered proposal type: %s", ty)) - } - - validProposalTypes[ty] = struct{}{} -} - -// ContentFromProposalType returns a Content object based on the proposal type. -func ContentFromProposalType(title, desc, ty string) Content { - switch ty { - case ProposalTypeText: - return NewTextProposal(title, desc) - - default: - return nil - } -} - -// IsValidProposalType returns a boolean determining if the proposal type is -// valid. -// -// NOTE: Modules with their own proposal types must register them. -func IsValidProposalType(ty string) bool { - _, ok := validProposalTypes[ty] - return ok -} - -// ProposalHandler implements the Handler interface for governance module-based -// proposals (ie. TextProposal ). Since these are -// merely signaling mechanisms at the moment and do not affect state, it -// performs a no-op. -func ProposalHandler(_ sdk.Context, c Content) error { - switch c.ProposalType() { - case ProposalTypeText: - // both proposal types do not change state so this performs a no-op - return nil - - default: - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized gov proposal type: %s", c.ProposalType()) +// ValidProposalStatus returns true if the proposal status is valid and false +// otherwise. +func ValidProposalStatus(status ProposalStatus) bool { + if status == StatusDepositPeriod || + status == StatusVotingPeriod || + status == StatusPassed || + status == StatusRejected || + status == StatusFailed { + return true } + return false } diff --git a/x/gov/types/proposals_test.go b/x/gov/types/proposals_test.go index 7f6a2b23bfae..ca670e91e9ab 100644 --- a/x/gov/types/proposals_test.go +++ b/x/gov/types/proposals_test.go @@ -1,16 +1,17 @@ -package types +package types_test import ( "fmt" "testing" + "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/stretchr/testify/require" ) func TestProposalStatus_Format(t *testing.T) { - statusDepositPeriod, _ := ProposalStatusFromString("PROPOSAL_STATUS_DEPOSIT_PERIOD") + statusDepositPeriod, _ := types.ProposalStatusFromString("PROPOSAL_STATUS_DEPOSIT_PERIOD") tests := []struct { - pt ProposalStatus + pt types.ProposalStatus sprintFArgs string expectedStringOutput string }{ diff --git a/x/gov/types/query.pb.go b/x/gov/types/query.pb.go index 3edf14389cf5..606cc1ff783d 100644 --- a/x/gov/types/query.pb.go +++ b/x/gov/types/query.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/gov/v1beta1/query.proto +// source: cosmos/gov/v1beta2/query.proto package types @@ -41,7 +41,7 @@ func (m *QueryProposalRequest) Reset() { *m = QueryProposalRequest{} } func (m *QueryProposalRequest) String() string { return proto.CompactTextString(m) } func (*QueryProposalRequest) ProtoMessage() {} func (*QueryProposalRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{0} + return fileDescriptor_3efdc0c4615c3665, []int{0} } func (m *QueryProposalRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -86,7 +86,7 @@ func (m *QueryProposalResponse) Reset() { *m = QueryProposalResponse{} } func (m *QueryProposalResponse) String() string { return proto.CompactTextString(m) } func (*QueryProposalResponse) ProtoMessage() {} func (*QueryProposalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{1} + return fileDescriptor_3efdc0c4615c3665, []int{1} } func (m *QueryProposalResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -125,7 +125,7 @@ func (m *QueryProposalResponse) GetProposal() Proposal { // QueryProposalsRequest is the request type for the Query/Proposals RPC method. type QueryProposalsRequest struct { // proposal_status defines the status of the proposals. - ProposalStatus ProposalStatus `protobuf:"varint,1,opt,name=proposal_status,json=proposalStatus,proto3,enum=cosmos.gov.v1beta1.ProposalStatus" json:"proposal_status,omitempty"` + ProposalStatus ProposalStatus `protobuf:"varint,1,opt,name=proposal_status,json=proposalStatus,proto3,enum=cosmos.gov.v1beta2.ProposalStatus" json:"proposal_status,omitempty"` // voter defines the voter address for the proposals. Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` // depositor defines the deposit addresses from the proposals. @@ -138,7 +138,7 @@ func (m *QueryProposalsRequest) Reset() { *m = QueryProposalsRequest{} } func (m *QueryProposalsRequest) String() string { return proto.CompactTextString(m) } func (*QueryProposalsRequest) ProtoMessage() {} func (*QueryProposalsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{2} + return fileDescriptor_3efdc0c4615c3665, []int{2} } func (m *QueryProposalsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -179,7 +179,7 @@ func (m *QueryProposalsResponse) Reset() { *m = QueryProposalsResponse{} func (m *QueryProposalsResponse) String() string { return proto.CompactTextString(m) } func (*QueryProposalsResponse) ProtoMessage() {} func (*QueryProposalsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{3} + return fileDescriptor_3efdc0c4615c3665, []int{3} } func (m *QueryProposalsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -234,7 +234,7 @@ func (m *QueryVoteRequest) Reset() { *m = QueryVoteRequest{} } func (m *QueryVoteRequest) String() string { return proto.CompactTextString(m) } func (*QueryVoteRequest) ProtoMessage() {} func (*QueryVoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{4} + return fileDescriptor_3efdc0c4615c3665, []int{4} } func (m *QueryVoteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -273,7 +273,7 @@ func (m *QueryVoteResponse) Reset() { *m = QueryVoteResponse{} } func (m *QueryVoteResponse) String() string { return proto.CompactTextString(m) } func (*QueryVoteResponse) ProtoMessage() {} func (*QueryVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{5} + return fileDescriptor_3efdc0c4615c3665, []int{5} } func (m *QueryVoteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -321,7 +321,7 @@ func (m *QueryVotesRequest) Reset() { *m = QueryVotesRequest{} } func (m *QueryVotesRequest) String() string { return proto.CompactTextString(m) } func (*QueryVotesRequest) ProtoMessage() {} func (*QueryVotesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{6} + return fileDescriptor_3efdc0c4615c3665, []int{6} } func (m *QueryVotesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -376,7 +376,7 @@ func (m *QueryVotesResponse) Reset() { *m = QueryVotesResponse{} } func (m *QueryVotesResponse) String() string { return proto.CompactTextString(m) } func (*QueryVotesResponse) ProtoMessage() {} func (*QueryVotesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{7} + return fileDescriptor_3efdc0c4615c3665, []int{7} } func (m *QueryVotesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -430,7 +430,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{8} + return fileDescriptor_3efdc0c4615c3665, []int{8} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -480,7 +480,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{9} + return fileDescriptor_3efdc0c4615c3665, []int{9} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -542,7 +542,7 @@ func (m *QueryDepositRequest) Reset() { *m = QueryDepositRequest{} } func (m *QueryDepositRequest) String() string { return proto.CompactTextString(m) } func (*QueryDepositRequest) ProtoMessage() {} func (*QueryDepositRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{10} + return fileDescriptor_3efdc0c4615c3665, []int{10} } func (m *QueryDepositRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -581,7 +581,7 @@ func (m *QueryDepositResponse) Reset() { *m = QueryDepositResponse{} } func (m *QueryDepositResponse) String() string { return proto.CompactTextString(m) } func (*QueryDepositResponse) ProtoMessage() {} func (*QueryDepositResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{11} + return fileDescriptor_3efdc0c4615c3665, []int{11} } func (m *QueryDepositResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -629,7 +629,7 @@ func (m *QueryDepositsRequest) Reset() { *m = QueryDepositsRequest{} } func (m *QueryDepositsRequest) String() string { return proto.CompactTextString(m) } func (*QueryDepositsRequest) ProtoMessage() {} func (*QueryDepositsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{12} + return fileDescriptor_3efdc0c4615c3665, []int{12} } func (m *QueryDepositsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -683,7 +683,7 @@ func (m *QueryDepositsResponse) Reset() { *m = QueryDepositsResponse{} } func (m *QueryDepositsResponse) String() string { return proto.CompactTextString(m) } func (*QueryDepositsResponse) ProtoMessage() {} func (*QueryDepositsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{13} + return fileDescriptor_3efdc0c4615c3665, []int{13} } func (m *QueryDepositsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -736,7 +736,7 @@ func (m *QueryTallyResultRequest) Reset() { *m = QueryTallyResultRequest func (m *QueryTallyResultRequest) String() string { return proto.CompactTextString(m) } func (*QueryTallyResultRequest) ProtoMessage() {} func (*QueryTallyResultRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{14} + return fileDescriptor_3efdc0c4615c3665, []int{14} } func (m *QueryTallyResultRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -782,7 +782,7 @@ func (m *QueryTallyResultResponse) Reset() { *m = QueryTallyResultRespon func (m *QueryTallyResultResponse) String() string { return proto.CompactTextString(m) } func (*QueryTallyResultResponse) ProtoMessage() {} func (*QueryTallyResultResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{15} + return fileDescriptor_3efdc0c4615c3665, []int{15} } func (m *QueryTallyResultResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -819,91 +819,91 @@ func (m *QueryTallyResultResponse) GetTally() TallyResult { } func init() { - proto.RegisterType((*QueryProposalRequest)(nil), "cosmos.gov.v1beta1.QueryProposalRequest") - proto.RegisterType((*QueryProposalResponse)(nil), "cosmos.gov.v1beta1.QueryProposalResponse") - proto.RegisterType((*QueryProposalsRequest)(nil), "cosmos.gov.v1beta1.QueryProposalsRequest") - proto.RegisterType((*QueryProposalsResponse)(nil), "cosmos.gov.v1beta1.QueryProposalsResponse") - proto.RegisterType((*QueryVoteRequest)(nil), "cosmos.gov.v1beta1.QueryVoteRequest") - proto.RegisterType((*QueryVoteResponse)(nil), "cosmos.gov.v1beta1.QueryVoteResponse") - proto.RegisterType((*QueryVotesRequest)(nil), "cosmos.gov.v1beta1.QueryVotesRequest") - proto.RegisterType((*QueryVotesResponse)(nil), "cosmos.gov.v1beta1.QueryVotesResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.gov.v1beta1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.gov.v1beta1.QueryParamsResponse") - proto.RegisterType((*QueryDepositRequest)(nil), "cosmos.gov.v1beta1.QueryDepositRequest") - proto.RegisterType((*QueryDepositResponse)(nil), "cosmos.gov.v1beta1.QueryDepositResponse") - proto.RegisterType((*QueryDepositsRequest)(nil), "cosmos.gov.v1beta1.QueryDepositsRequest") - proto.RegisterType((*QueryDepositsResponse)(nil), "cosmos.gov.v1beta1.QueryDepositsResponse") - proto.RegisterType((*QueryTallyResultRequest)(nil), "cosmos.gov.v1beta1.QueryTallyResultRequest") - proto.RegisterType((*QueryTallyResultResponse)(nil), "cosmos.gov.v1beta1.QueryTallyResultResponse") -} - -func init() { proto.RegisterFile("cosmos/gov/v1beta1/query.proto", fileDescriptor_e35c0d133e91c0a2) } - -var fileDescriptor_e35c0d133e91c0a2 = []byte{ - // 994 bytes of a gzipped FileDescriptorProto + proto.RegisterType((*QueryProposalRequest)(nil), "cosmos.gov.v1beta2.QueryProposalRequest") + proto.RegisterType((*QueryProposalResponse)(nil), "cosmos.gov.v1beta2.QueryProposalResponse") + proto.RegisterType((*QueryProposalsRequest)(nil), "cosmos.gov.v1beta2.QueryProposalsRequest") + proto.RegisterType((*QueryProposalsResponse)(nil), "cosmos.gov.v1beta2.QueryProposalsResponse") + proto.RegisterType((*QueryVoteRequest)(nil), "cosmos.gov.v1beta2.QueryVoteRequest") + proto.RegisterType((*QueryVoteResponse)(nil), "cosmos.gov.v1beta2.QueryVoteResponse") + proto.RegisterType((*QueryVotesRequest)(nil), "cosmos.gov.v1beta2.QueryVotesRequest") + proto.RegisterType((*QueryVotesResponse)(nil), "cosmos.gov.v1beta2.QueryVotesResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.gov.v1beta2.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.gov.v1beta2.QueryParamsResponse") + proto.RegisterType((*QueryDepositRequest)(nil), "cosmos.gov.v1beta2.QueryDepositRequest") + proto.RegisterType((*QueryDepositResponse)(nil), "cosmos.gov.v1beta2.QueryDepositResponse") + proto.RegisterType((*QueryDepositsRequest)(nil), "cosmos.gov.v1beta2.QueryDepositsRequest") + proto.RegisterType((*QueryDepositsResponse)(nil), "cosmos.gov.v1beta2.QueryDepositsResponse") + proto.RegisterType((*QueryTallyResultRequest)(nil), "cosmos.gov.v1beta2.QueryTallyResultRequest") + proto.RegisterType((*QueryTallyResultResponse)(nil), "cosmos.gov.v1beta2.QueryTallyResultResponse") +} + +func init() { proto.RegisterFile("cosmos/gov/v1beta2/query.proto", fileDescriptor_3efdc0c4615c3665) } + +var fileDescriptor_3efdc0c4615c3665 = []byte{ + // 998 bytes of a gzipped FileDescriptorProto 0x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24, 0xd6, 0xda, 0x89, 0x3d, + 0x3f, 0xbb, 0xf0, 0x13, 0xa1, 0xc7, 0xf1, 0x86, 0xc3, 0xf8, 0x34, 0xc9, 0x61, 0x5c, 0x6b, 0x66, + 0x03, 0x51, 0xd0, 0x0d, 0x29, 0xa8, 0x0d, 0x57, 0xa6, 0xf1, 0x49, 0x8f, 0x18, 0x6b, 0x27, 0x1a, + 0xd3, 0xbb, 0xf0, 0x3d, 0xa1, 0x65, 0x3d, 0xc2, 0x20, 0x53, 0x00, 0xcf, 0xbe, 0x86, 0x07, 0xe7, + 0xa1, 0xf1, 0xa6, 0xd4, 0x7a, 0x01, 0xce, 0x3f, 0x8e, 0x56, 0x78, 0x40, 0xe8, 0x5c, 0x6c, 0x9a, + 0xc0, 0xb9, 0xb1, 0x89, 0x0f, 0xcf, 0xb9, 0xda, 0xab, 0xf9, 0xc0, 0xff, 0xa5, 0xf9, 0xe4, 0x58, + 0x6b, 0xb7, 0x1f, 0xee, 0xd5, 0xc9, 0xa3, 0xbd, 0x3a, 0xf9, 0x73, 0xaf, 0x4e, 0xbe, 0xde, 0xaf, + 0x17, 0x1e, 0xed, 0xd7, 0x0b, 0xbf, 0xef, 0xd7, 0x0b, 0x1f, 0x35, 0x5d, 0x4f, 0x7c, 0x3c, 0xd8, + 0x34, 0x6f, 0xb3, 0x2d, 0x1d, 0x56, 0xfd, 0x59, 0xe6, 0xdd, 0x4f, 0xac, 0xbb, 0x32, 0x47, 0xd8, + 0x32, 0x7c, 0xf3, 0x98, 0xfc, 0x1f, 0x68, 0xf5, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xaf, 0xda, + 0x91, 0x66, 0xd2, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -946,7 +946,7 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) { out := new(QueryProposalResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Proposal", in, out, opts...) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/Proposal", in, out, opts...) if err != nil { return nil, err } @@ -955,7 +955,7 @@ func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, op func (c *queryClient) Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) { out := new(QueryProposalsResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Proposals", in, out, opts...) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/Proposals", in, out, opts...) if err != nil { return nil, err } @@ -964,7 +964,7 @@ func (c *queryClient) Proposals(ctx context.Context, in *QueryProposalsRequest, func (c *queryClient) Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) { out := new(QueryVoteResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Vote", in, out, opts...) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/Vote", in, out, opts...) if err != nil { return nil, err } @@ -973,7 +973,7 @@ func (c *queryClient) Vote(ctx context.Context, in *QueryVoteRequest, opts ...gr func (c *queryClient) Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) { out := new(QueryVotesResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Votes", in, out, opts...) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/Votes", in, out, opts...) if err != nil { return nil, err } @@ -982,7 +982,7 @@ func (c *queryClient) Votes(ctx context.Context, in *QueryVotesRequest, opts ... func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Params", in, out, opts...) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/Params", in, out, opts...) if err != nil { return nil, err } @@ -991,7 +991,7 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . func (c *queryClient) Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) { out := new(QueryDepositResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Deposit", in, out, opts...) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/Deposit", in, out, opts...) if err != nil { return nil, err } @@ -1000,7 +1000,7 @@ func (c *queryClient) Deposit(ctx context.Context, in *QueryDepositRequest, opts func (c *queryClient) Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) { out := new(QueryDepositsResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Deposits", in, out, opts...) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/Deposits", in, out, opts...) if err != nil { return nil, err } @@ -1009,7 +1009,7 @@ func (c *queryClient) Deposits(ctx context.Context, in *QueryDepositsRequest, op func (c *queryClient) TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) { out := new(QueryTallyResultResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/TallyResult", in, out, opts...) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/TallyResult", in, out, opts...) if err != nil { return nil, err } @@ -1079,7 +1079,7 @@ func _Query_Proposal_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/Proposal", + FullMethod: "/cosmos.gov.v1beta2.Query/Proposal", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).Proposal(ctx, req.(*QueryProposalRequest)) @@ -1097,7 +1097,7 @@ func _Query_Proposals_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/Proposals", + FullMethod: "/cosmos.gov.v1beta2.Query/Proposals", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).Proposals(ctx, req.(*QueryProposalsRequest)) @@ -1115,7 +1115,7 @@ func _Query_Vote_Handler(srv interface{}, ctx context.Context, dec func(interfac } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/Vote", + FullMethod: "/cosmos.gov.v1beta2.Query/Vote", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).Vote(ctx, req.(*QueryVoteRequest)) @@ -1133,7 +1133,7 @@ func _Query_Votes_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/Votes", + FullMethod: "/cosmos.gov.v1beta2.Query/Votes", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).Votes(ctx, req.(*QueryVotesRequest)) @@ -1151,7 +1151,7 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/Params", + FullMethod: "/cosmos.gov.v1beta2.Query/Params", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) @@ -1169,7 +1169,7 @@ func _Query_Deposit_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/Deposit", + FullMethod: "/cosmos.gov.v1beta2.Query/Deposit", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).Deposit(ctx, req.(*QueryDepositRequest)) @@ -1187,7 +1187,7 @@ func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/Deposits", + FullMethod: "/cosmos.gov.v1beta2.Query/Deposits", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).Deposits(ctx, req.(*QueryDepositsRequest)) @@ -1205,7 +1205,7 @@ func _Query_TallyResult_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/TallyResult", + FullMethod: "/cosmos.gov.v1beta2.Query/TallyResult", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).TallyResult(ctx, req.(*QueryTallyResultRequest)) @@ -1214,7 +1214,7 @@ func _Query_TallyResult_Handler(srv interface{}, ctx context.Context, dec func(i } var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.gov.v1beta1.Query", + ServiceName: "cosmos.gov.v1beta2.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { @@ -1251,7 +1251,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/gov/v1beta1/query.proto", + Metadata: "cosmos/gov/v1beta2/query.proto", } func (m *QueryProposalRequest) Marshal() (dAtA []byte, err error) { diff --git a/x/gov/types/query.pb.gw.go b/x/gov/types/query.pb.gw.go index 4b6832d41e7b..7145295e7e10 100644 --- a/x/gov/types/query.pb.gw.go +++ b/x/gov/types/query.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: cosmos/gov/v1beta1/query.proto +// source: cosmos/gov/v1beta2/query.proto /* Package types is a reverse proxy. @@ -896,21 +896,21 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Proposal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "gov", "v1beta1", "proposals", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Proposal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "gov", "v1beta2", "proposals", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Proposals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "gov", "v1beta1", "proposals"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Proposals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "gov", "v1beta2", "proposals"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Vote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"cosmos", "gov", "v1beta1", "proposals", "proposal_id", "votes", "voter"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Vote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"cosmos", "gov", "v1beta2", "proposals", "proposal_id", "votes", "voter"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Votes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"cosmos", "gov", "v1beta1", "proposals", "proposal_id", "votes"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Votes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"cosmos", "gov", "v1beta2", "proposals", "proposal_id", "votes"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "gov", "v1beta1", "params", "params_type"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "gov", "v1beta2", "params", "params_type"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Deposit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"cosmos", "gov", "v1beta1", "proposals", "proposal_id", "deposits", "depositor"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Deposit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"cosmos", "gov", "v1beta2", "proposals", "proposal_id", "deposits", "depositor"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Deposits_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"cosmos", "gov", "v1beta1", "proposals", "proposal_id", "deposits"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Deposits_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"cosmos", "gov", "v1beta2", "proposals", "proposal_id", "deposits"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_TallyResult_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"cosmos", "gov", "v1beta1", "proposals", "proposal_id", "tally"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_TallyResult_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"cosmos", "gov", "v1beta2", "proposals", "proposal_id", "tally"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( diff --git a/x/gov/types/tx.pb.go b/x/gov/types/tx.pb.go index 1326c6575c9d..1ba0d1d0c49a 100644 --- a/x/gov/types/tx.pb.go +++ b/x/gov/types/tx.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/gov/v1beta1/tx.proto +// source: cosmos/gov/v1beta2/tx.proto package types @@ -35,7 +35,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary // proposal Content. type MsgSubmitProposal struct { - Content *types.Any `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` + Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` InitialDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"initial_deposit"` Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` } @@ -43,7 +43,7 @@ type MsgSubmitProposal struct { func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } func (*MsgSubmitProposal) ProtoMessage() {} func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_3c053992595e3dce, []int{0} + return fileDescriptor_4214261f6b3f9ed4, []int{0} } func (m *MsgSubmitProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -81,7 +81,7 @@ func (m *MsgSubmitProposalResponse) Reset() { *m = MsgSubmitProposalResp func (m *MsgSubmitProposalResponse) String() string { return proto.CompactTextString(m) } func (*MsgSubmitProposalResponse) ProtoMessage() {} func (*MsgSubmitProposalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3c053992595e3dce, []int{1} + return fileDescriptor_4214261f6b3f9ed4, []int{1} } func (m *MsgSubmitProposalResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -119,15 +119,15 @@ func (m *MsgSubmitProposalResponse) GetProposalId() uint64 { // MsgVote defines a message to cast a vote. type MsgVote struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id"` + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id" yaml:"proposal_id"` Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` - Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta1.VoteOption" json:"option,omitempty"` + Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"` } func (m *MsgVote) Reset() { *m = MsgVote{} } func (*MsgVote) ProtoMessage() {} func (*MsgVote) Descriptor() ([]byte, []int) { - return fileDescriptor_3c053992595e3dce, []int{2} + return fileDescriptor_4214261f6b3f9ed4, []int{2} } func (m *MsgVote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -164,7 +164,7 @@ func (m *MsgVoteResponse) Reset() { *m = MsgVoteResponse{} } func (m *MsgVoteResponse) String() string { return proto.CompactTextString(m) } func (*MsgVoteResponse) ProtoMessage() {} func (*MsgVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3c053992595e3dce, []int{3} + return fileDescriptor_4214261f6b3f9ed4, []int{3} } func (m *MsgVoteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -197,7 +197,7 @@ var xxx_messageInfo_MsgVoteResponse proto.InternalMessageInfo // // Since: cosmos-sdk 0.43 type MsgVoteWeighted struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty" yaml:"proposal_id"` Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` Options []WeightedVoteOption `protobuf:"bytes,3,rep,name=options,proto3" json:"options"` } @@ -205,7 +205,7 @@ type MsgVoteWeighted struct { func (m *MsgVoteWeighted) Reset() { *m = MsgVoteWeighted{} } func (*MsgVoteWeighted) ProtoMessage() {} func (*MsgVoteWeighted) Descriptor() ([]byte, []int) { - return fileDescriptor_3c053992595e3dce, []int{4} + return fileDescriptor_4214261f6b3f9ed4, []int{4} } func (m *MsgVoteWeighted) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -244,7 +244,7 @@ func (m *MsgVoteWeightedResponse) Reset() { *m = MsgVoteWeightedResponse func (m *MsgVoteWeightedResponse) String() string { return proto.CompactTextString(m) } func (*MsgVoteWeightedResponse) ProtoMessage() {} func (*MsgVoteWeightedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3c053992595e3dce, []int{5} + return fileDescriptor_4214261f6b3f9ed4, []int{5} } func (m *MsgVoteWeightedResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -283,7 +283,7 @@ type MsgDeposit struct { func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } func (*MsgDeposit) ProtoMessage() {} func (*MsgDeposit) Descriptor() ([]byte, []int) { - return fileDescriptor_3c053992595e3dce, []int{6} + return fileDescriptor_4214261f6b3f9ed4, []int{6} } func (m *MsgDeposit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -320,7 +320,7 @@ func (m *MsgDepositResponse) Reset() { *m = MsgDepositResponse{} } func (m *MsgDepositResponse) String() string { return proto.CompactTextString(m) } func (*MsgDepositResponse) ProtoMessage() {} func (*MsgDepositResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3c053992595e3dce, []int{7} + return fileDescriptor_4214261f6b3f9ed4, []int{7} } func (m *MsgDepositResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -350,61 +350,62 @@ func (m *MsgDepositResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDepositResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos.gov.v1beta1.MsgSubmitProposal") - proto.RegisterType((*MsgSubmitProposalResponse)(nil), "cosmos.gov.v1beta1.MsgSubmitProposalResponse") - proto.RegisterType((*MsgVote)(nil), "cosmos.gov.v1beta1.MsgVote") - proto.RegisterType((*MsgVoteResponse)(nil), "cosmos.gov.v1beta1.MsgVoteResponse") - proto.RegisterType((*MsgVoteWeighted)(nil), "cosmos.gov.v1beta1.MsgVoteWeighted") - proto.RegisterType((*MsgVoteWeightedResponse)(nil), "cosmos.gov.v1beta1.MsgVoteWeightedResponse") - proto.RegisterType((*MsgDeposit)(nil), "cosmos.gov.v1beta1.MsgDeposit") - proto.RegisterType((*MsgDepositResponse)(nil), "cosmos.gov.v1beta1.MsgDepositResponse") -} - -func init() { proto.RegisterFile("cosmos/gov/v1beta1/tx.proto", fileDescriptor_3c053992595e3dce) } - -var fileDescriptor_3c053992595e3dce = []byte{ - // 648 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xb6, 0x93, 0xd2, 0xd0, 0x17, 0xd4, 0x52, 0x2b, 0x12, 0x49, 0x8a, 0xec, 0x28, 0x88, 0x2a, - 0x12, 0x8a, 0xdd, 0x06, 0xd4, 0x01, 0xa6, 0xba, 0x08, 0xc1, 0x10, 0x01, 0xae, 0x04, 0x12, 0x4b, - 0x49, 0xe2, 0xeb, 0xd5, 0xa2, 0xf1, 0xb3, 0x72, 0x97, 0xa8, 0xdd, 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 0x7d, 0x53, - 0x7f, 0x75, 0x60, 0x6a, 0xbb, 0x07, 0xa6, 0xf6, 0xf1, 0xc0, 0xd4, 0x9e, 0x8c, 0x3e, 0xe2, 0x8d, - 0xf8, 0xab, 0x10, 0x1f, 0x74, 0x7b, 0x3c, 0x7e, 0x8e, 0xaf, 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, - 0x8a, 0xac, 0xbf, 0x61, 0x81, 0x06, 0x00, 0x00, + proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos.gov.v1beta2.MsgSubmitProposal") + proto.RegisterType((*MsgSubmitProposalResponse)(nil), "cosmos.gov.v1beta2.MsgSubmitProposalResponse") + proto.RegisterType((*MsgVote)(nil), "cosmos.gov.v1beta2.MsgVote") + proto.RegisterType((*MsgVoteResponse)(nil), "cosmos.gov.v1beta2.MsgVoteResponse") + proto.RegisterType((*MsgVoteWeighted)(nil), "cosmos.gov.v1beta2.MsgVoteWeighted") + proto.RegisterType((*MsgVoteWeightedResponse)(nil), "cosmos.gov.v1beta2.MsgVoteWeightedResponse") + proto.RegisterType((*MsgDeposit)(nil), "cosmos.gov.v1beta2.MsgDeposit") + proto.RegisterType((*MsgDepositResponse)(nil), "cosmos.gov.v1beta2.MsgDepositResponse") +} + +func init() { proto.RegisterFile("cosmos/gov/v1beta2/tx.proto", fileDescriptor_4214261f6b3f9ed4) } + +var fileDescriptor_4214261f6b3f9ed4 = []byte{ + // 667 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xcf, 0x4f, 0x13, 0x4f, + 0x14, 0xdf, 0x6d, 0xf9, 0xf2, 0xe3, 0xf1, 0x0d, 0xc8, 0xa4, 0xd1, 0x6d, 0x31, 0xbb, 0x4d, 0x0d, + 0xa4, 0x89, 0x61, 0x17, 0xaa, 0xc1, 0x84, 0x1b, 0xd5, 0x10, 0x3d, 0x34, 0xea, 0x92, 0x68, 0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0xf0, 0x5f, 0x9f, 0x09, 0xdc, 0x35, 0x72, + 0xe7, 0xf8, 0x8c, 0x69, 0x68, 0x19, 0x46, 0x59, 0x28, 0x28, 0x0b, 0x64, 0x63, 0xa6, 0x6a, 0xa6, + 0x7d, 0x7a, 0x0e, 0xed, 0xa8, 0xc2, 0xfb, 0x92, 0xe5, 0x2a, 0x76, 0x46, 0x73, 0x66, 0x60, 0x5a, + 0x99, 0x49, 0x5a, 0x52, 0xf9, 0xa0, 0xa7, 0xb1, 0xc7, 0x98, 0x92, 0x2d, 0x81, 0x7d, 0x74, 0x2b, + 0xcb, 0xe8, 0xe5, 0x7f, 0xe0, 0x6c, 0x0d, 0xc6, 0xe2, 0x5a, 0xb9, 0x91, 0x97, 0x23, 0x36, 0x9f, + 0x65, 0x2d, 0xa9, 0xeb, 0xc8, 0x62, 0x7d, 0x24, 0x9a, 0x37, 0x37, 0x11, 0x67, 0x38, 0x2d, 0xc2, + 0x95, 0x13, 0xae, 0x52, 0xc7, 0x3f, 0x74, 0x80, 0x06, 0x27, 0xc9, 0xe0, 0xfd, 0xf1, 0x4c, 0xa0, + 0x65, 0x98, 0x50, 0x8b, 0xc1, 0xce, 0x77, 0x7a, 0x44, 0x45, 0x2d, 0x18, 0xf5, 0x3a, 0xac, 0x17, + 0x08, 0x65, 0xf6, 0xaf, 0xee, 0x93, 0x4a, 0x9d, 0xd1, 0x8a, 0x02, 0xa0, 0x23, 0xbb, 0x49, 0x17, + 0x6a, 0xdf, 0x73, 0x90, 0x6f, 0x70, 0x82, 0x36, 0x61, 0xea, 0xc4, 0x17, 0x63, 0x2e, 0xeb, 0x0d, + 0x4e, 0xed, 0x54, 0x69, 0xe1, 0x42, 0xb4, 0x74, 0xf5, 0xee, 0xc2, 0x88, 0x5c, 0xa2, 0xd9, 0x33, + 0x64, 0x11, 0x58, 0xba, 0x36, 0x04, 0x4c, 0x33, 0x3d, 0x85, 0xff, 0x7f, 0x9b, 0xd6, 0x61, 0xa2, + 0x84, 0x54, 0xba, 0x7e, 0x01, 0x52, 0x7a, 0xc3, 0x43, 0x18, 0x4b, 0xa6, 0xc3, 0x3c, 0x43, 0xa7, + 0xf0, 0xd2, 0xfc, 0x70, 0x3c, 0x49, 0x59, 0xaf, 0xef, 0x1e, 0x98, 0xfa, 0xde, 0x81, 0xa9, 0x7f, + 0x39, 0x30, 0xf5, 0x57, 0x87, 0xa6, 0xb6, 0x77, 0x68, 0x6a, 0x1f, 0x0f, 0x4d, 0xed, 0xc9, 0xf0, + 0x27, 0xde, 0x96, 0x3f, 0x1c, 0xf2, 0xa1, 0x9b, 0xa3, 0xf2, 0x83, 0x7d, 0xe3, 0x57, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x5d, 0x24, 0xb4, 0x1c, 0xa4, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -441,7 +442,7 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { func (c *msgClient) SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) { out := new(MsgSubmitProposalResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Msg/SubmitProposal", in, out, opts...) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Msg/SubmitProposal", in, out, opts...) if err != nil { return nil, err } @@ -450,7 +451,7 @@ func (c *msgClient) SubmitProposal(ctx context.Context, in *MsgSubmitProposal, o func (c *msgClient) Vote(ctx context.Context, in *MsgVote, opts ...grpc.CallOption) (*MsgVoteResponse, error) { out := new(MsgVoteResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Msg/Vote", in, out, opts...) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Msg/Vote", in, out, opts...) if err != nil { return nil, err } @@ -459,7 +460,7 @@ func (c *msgClient) Vote(ctx context.Context, in *MsgVote, opts ...grpc.CallOpti func (c *msgClient) VoteWeighted(ctx context.Context, in *MsgVoteWeighted, opts ...grpc.CallOption) (*MsgVoteWeightedResponse, error) { out := new(MsgVoteWeightedResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Msg/VoteWeighted", in, out, opts...) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Msg/VoteWeighted", in, out, opts...) if err != nil { return nil, err } @@ -468,7 +469,7 @@ func (c *msgClient) VoteWeighted(ctx context.Context, in *MsgVoteWeighted, opts func (c *msgClient) Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) { out := new(MsgDepositResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Msg/Deposit", in, out, opts...) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Msg/Deposit", in, out, opts...) if err != nil { return nil, err } @@ -520,7 +521,7 @@ func _Msg_SubmitProposal_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Msg/SubmitProposal", + FullMethod: "/cosmos.gov.v1beta2.Msg/SubmitProposal", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).SubmitProposal(ctx, req.(*MsgSubmitProposal)) @@ -538,7 +539,7 @@ func _Msg_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{ } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Msg/Vote", + FullMethod: "/cosmos.gov.v1beta2.Msg/Vote", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).Vote(ctx, req.(*MsgVote)) @@ -556,7 +557,7 @@ func _Msg_VoteWeighted_Handler(srv interface{}, ctx context.Context, dec func(in } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Msg/VoteWeighted", + FullMethod: "/cosmos.gov.v1beta2.Msg/VoteWeighted", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).VoteWeighted(ctx, req.(*MsgVoteWeighted)) @@ -574,7 +575,7 @@ func _Msg_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Msg/Deposit", + FullMethod: "/cosmos.gov.v1beta2.Msg/Deposit", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).Deposit(ctx, req.(*MsgDeposit)) @@ -583,7 +584,7 @@ func _Msg_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interfa } var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.gov.v1beta1.Msg", + ServiceName: "cosmos.gov.v1beta2.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { @@ -604,7 +605,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/gov/v1beta1/tx.proto", + Metadata: "cosmos/gov/v1beta2/tx.proto", } func (m *MsgSubmitProposal) Marshal() (dAtA []byte, err error) { @@ -648,17 +649,19 @@ func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - if m.Content != nil { - { - size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Messages) > 0 { + for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -915,9 +918,11 @@ func (m *MsgSubmitProposal) Size() (n int) { } var l int _ = l - if m.Content != nil { - l = m.Content.Size() - n += 1 + l + sovTx(uint64(l)) + if len(m.Messages) > 0 { + for _, e := range m.Messages { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } } if len(m.InitialDeposit) > 0 { for _, e := range m.InitialDeposit { @@ -1071,7 +1076,7 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1098,10 +1103,8 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Content == nil { - m.Content = &types.Any{} - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Messages = append(m.Messages, &types.Any{}) + if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/gov/types/v1beta1/codec.go b/x/gov/types/v1beta1/codec.go new file mode 100644 index 000000000000..6509735cdfc9 --- /dev/null +++ b/x/gov/types/v1beta1/codec.go @@ -0,0 +1,63 @@ +package v1beta1 + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the +// governance module. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterInterface((*Content)(nil), nil) + cdc.RegisterConcrete(&MsgSubmitProposal{}, "cosmos-sdk/MsgSubmitProposal", nil) + cdc.RegisterConcrete(&MsgDeposit{}, "cosmos-sdk/MsgDeposit", nil) + cdc.RegisterConcrete(&MsgVote{}, "cosmos-sdk/MsgVote", nil) + cdc.RegisterConcrete(&MsgVoteWeighted{}, "cosmos-sdk/MsgVoteWeighted", nil) + cdc.RegisterConcrete(&TextProposal{}, "cosmos-sdk/TextProposal", nil) +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgSubmitProposal{}, + &MsgVote{}, + &MsgVoteWeighted{}, + &MsgDeposit{}, + ) + registry.RegisterInterface( + "cosmos.gov.v1beta1.Content", + (*Content)(nil), + &TextProposal{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +// RegisterProposalTypeCodec registers an external proposal content type defined +// in another module for the internal ModuleCdc. This allows the MsgSubmitProposal +// to be correctly Amino encoded and decoded. +// +// NOTE: This should only be used for applications that are still using a concrete +// Amino codec for serialization. +func RegisterProposalTypeCodec(o interface{}, name string) { + amino.RegisterConcrete(o, name, nil) +} + +var ( + amino = codec.NewLegacyAmino() + + // ModuleCdc references the global x/gov module codec. Note, the codec should + // ONLY be used in certain instances of tests and for JSON encoding as Amino is + // still used for that purpose. + // + // The actual codec used for serialization should be provided to x/gov and + // defined at the application level. + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) +} diff --git a/x/gov/types/v1beta1/content.go b/x/gov/types/v1beta1/content.go new file mode 100644 index 000000000000..9bdeec13322b --- /dev/null +++ b/x/gov/types/v1beta1/content.go @@ -0,0 +1,27 @@ +package v1beta1 + +import sdk "github.com/cosmos/cosmos-sdk/types" + +// Copied over from /x/gov/types/keys.go to avoid circular imports +const ( + ModuleName = "gov" + + RouterKey = ModuleName +) + +// Content defines an interface that a proposal must implement. It contains +// information such as the title and description along with the type and routing +// information for the appropriate handler to process the proposal. Content can +// have additional fields, which will handled by a proposal's Handler. +type Content interface { + GetTitle() string + GetDescription() string + ProposalRoute() string + ProposalType() string + ValidateBasic() error + String() string +} + +// Handler defines a function that handles a proposal after it has passed the +// governance process. +type Handler func(ctx sdk.Context, content Content) error diff --git a/x/gov/types/v1beta1/deposit.go b/x/gov/types/v1beta1/deposit.go new file mode 100644 index 000000000000..92d6ab1cb707 --- /dev/null +++ b/x/gov/types/v1beta1/deposit.go @@ -0,0 +1,54 @@ +package v1beta1 + +import ( + "fmt" + + "sigs.k8s.io/yaml" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// NewDeposit creates a new Deposit instance +//nolint:interfacer +func NewDeposit(proposalID uint64, depositor sdk.AccAddress, amount sdk.Coins) Deposit { + return Deposit{proposalID, depositor.String(), amount} +} + +func (d Deposit) String() string { + out, _ := yaml.Marshal(d) + return string(out) +} + +// Empty returns whether a deposit is empty. +func (d Deposit) Empty() bool { + return d.String() == Deposit{}.String() +} + +// Deposits is a collection of Deposit objects +type Deposits []Deposit + +// Equal returns true if two slices (order-dependant) of deposits are equal. +func (d Deposits) Equal(other Deposits) bool { + if len(d) != len(other) { + return false + } + + for i, deposit := range d { + if deposit.String() != other[i].String() { + return false + } + } + + return true +} + +func (d Deposits) String() string { + if len(d) == 0 { + return "[]" + } + out := fmt.Sprintf("Deposits for Proposal %d:", d[0].ProposalId) + for _, dep := range d { + out += fmt.Sprintf("\n %s: %s", dep.Depositor, dep.Amount) + } + return out +} diff --git a/x/gov/types/v1beta1/errors.go b/x/gov/types/v1beta1/errors.go new file mode 100644 index 000000000000..c7ad74a728f0 --- /dev/null +++ b/x/gov/types/v1beta1/errors.go @@ -0,0 +1,13 @@ +package v1beta1 + +import ( + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var ( + // Deprecated + ErrInvalidProposalContent = sdkerrors.Register(ModuleName, 5, "invalid proposal content") + // Deprecated + ErrInvalidProposalType = sdkerrors.Register(ModuleName, 6, "invalid proposal type") + ErrInvalidVote = sdkerrors.Register(ModuleName, 7, "invalid vote option") +) diff --git a/x/gov/types/v1beta1/genesis.go b/x/gov/types/v1beta1/genesis.go new file mode 100644 index 000000000000..5ed81ea70dc1 --- /dev/null +++ b/x/gov/types/v1beta1/genesis.go @@ -0,0 +1,78 @@ +package v1beta1 + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// NewGenesisState creates a new genesis state for the governance module +func NewGenesisState(startingProposalID uint64, dp DepositParams, vp VotingParams, tp TallyParams) *GenesisState { + return &GenesisState{ + StartingProposalId: startingProposalID, + DepositParams: dp, + VotingParams: vp, + TallyParams: tp, + } +} + +// DefaultGenesisState defines the default governance genesis state +func DefaultGenesisState() *GenesisState { + return NewGenesisState( + DefaultStartingProposalID, + DefaultDepositParams(), + DefaultVotingParams(), + DefaultTallyParams(), + ) +} + +func (data GenesisState) Equal(other GenesisState) bool { + return data.StartingProposalId == other.StartingProposalId && + data.Deposits.Equal(other.Deposits) && + data.Votes.Equal(other.Votes) && + data.Proposals.Equal(other.Proposals) && + data.DepositParams.Equal(other.DepositParams) && + data.TallyParams.Equal(other.TallyParams) && + data.VotingParams.Equal(other.VotingParams) +} + +// Empty returns true if a GenesisState is empty +func (data GenesisState) Empty() bool { + return data.Equal(GenesisState{}) +} + +// ValidateGenesis checks if parameters are within valid ranges +func ValidateGenesis(data *GenesisState) error { + threshold := data.TallyParams.Threshold + if threshold.IsNegative() || threshold.GT(sdk.OneDec()) { + return fmt.Errorf("governance vote threshold should be positive and less or equal to one, is %s", + threshold.String()) + } + + veto := data.TallyParams.VetoThreshold + if veto.IsNegative() || veto.GT(sdk.OneDec()) { + return fmt.Errorf("governance vote veto threshold should be positive and less or equal to one, is %s", + veto.String()) + } + + if !data.DepositParams.MinDeposit.IsValid() { + return fmt.Errorf("governance deposit amount must be a valid sdk.Coins amount, is %s", + data.DepositParams.MinDeposit.String()) + } + + return nil +} + +var _ types.UnpackInterfacesMessage = GenesisState{} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error { + for _, p := range data.Proposals { + err := p.UnpackInterfaces(unpacker) + if err != nil { + return err + } + } + return nil +} diff --git a/x/gov/types/v1beta1/genesis.pb.go b/x/gov/types/v1beta1/genesis.pb.go new file mode 100644 index 000000000000..0efefab9c4cf --- /dev/null +++ b/x/gov/types/v1beta1/genesis.pb.go @@ -0,0 +1,667 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/gov/v1beta1/genesis.proto + +package v1beta1 + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// 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 + +// 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"` + // 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"` + // params defines all the paramaters of related to voting. + VotingParams VotingParams `protobuf:"bytes,6,opt,name=voting_params,json=votingParams,proto3" json:"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"` +} + +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_43cd825e0fa7a627, []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 + +func (m *GenesisState) GetStartingProposalId() uint64 { + if m != nil { + return m.StartingProposalId + } + return 0 +} + +func (m *GenesisState) GetDeposits() Deposits { + if m != nil { + return m.Deposits + } + return nil +} + +func (m *GenesisState) GetVotes() Votes { + if m != nil { + return m.Votes + } + return nil +} + +func (m *GenesisState) GetProposals() Proposals { + if m != nil { + return m.Proposals + } + return nil +} + +func (m *GenesisState) GetDepositParams() DepositParams { + if m != nil { + return m.DepositParams + } + return DepositParams{} +} + +func (m *GenesisState) GetVotingParams() VotingParams { + if m != nil { + return m.VotingParams + } + return VotingParams{} +} + +func (m *GenesisState) GetTallyParams() TallyParams { + if m != nil { + return m.TallyParams + } + return TallyParams{} +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "cosmos.gov.v1beta1.GenesisState") +} + +func init() { proto.RegisterFile("cosmos/gov/v1beta1/genesis.proto", fileDescriptor_43cd825e0fa7a627) } + +var fileDescriptor_43cd825e0fa7a627 = []byte{ + // 391 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x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 0xf5, 0xf5, 0x3e, 0x00, 0x00, 0xff, 0xff, 0x9c, + 0xc0, 0x6c, 0xbd, 0xc1, 0x02, 0x00, 0x00, +} + +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 = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size, err := m.VotingParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(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 = encodeVarintGenesis(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 = encodeVarintGenesis(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 = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.StartingProposalId != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.StartingProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(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 + sovGenesis(uint64(m.StartingProposalId)) + } + if len(m.Deposits) > 0 { + for _, e := range m.Deposits { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.Votes) > 0 { + for _, e := range m.Votes { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.Proposals) > 0 { + for _, e := range m.Proposals { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + l = m.DepositParams.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = m.VotingParams.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = m.TallyParams.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(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 ErrIntOverflowGenesis + } + 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 ErrIntOverflowGenesis + } + 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 ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + 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 ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + 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 ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + 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 ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + 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 ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + 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 ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + 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 := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/gov/types/v1beta1/gov.pb.go b/x/gov/types/v1beta1/gov.pb.go new file mode 100644 index 000000000000..019673127f7e --- /dev/null +++ b/x/gov/types/v1beta1/gov.pb.go @@ -0,0 +1,2822 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/gov/v1beta1/gov.proto + +package v1beta1 + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types1 "github.com/cosmos/cosmos-sdk/codec/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// 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 + +// VoteOption enumerates the valid vote options for a given governance proposal. +type VoteOption int32 + +const ( + // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + OptionEmpty VoteOption = 0 + // VOTE_OPTION_YES defines a yes vote option. + OptionYes VoteOption = 1 + // VOTE_OPTION_ABSTAIN defines an abstain vote option. + OptionAbstain VoteOption = 2 + // VOTE_OPTION_NO defines a no vote option. + OptionNo VoteOption = 3 + // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + OptionNoWithVeto VoteOption = 4 +) + +var VoteOption_name = map[int32]string{ + 0: "VOTE_OPTION_UNSPECIFIED", + 1: "VOTE_OPTION_YES", + 2: "VOTE_OPTION_ABSTAIN", + 3: "VOTE_OPTION_NO", + 4: "VOTE_OPTION_NO_WITH_VETO", +} + +var VoteOption_value = map[string]int32{ + "VOTE_OPTION_UNSPECIFIED": 0, + "VOTE_OPTION_YES": 1, + "VOTE_OPTION_ABSTAIN": 2, + "VOTE_OPTION_NO": 3, + "VOTE_OPTION_NO_WITH_VETO": 4, +} + +func (x VoteOption) String() string { + return proto.EnumName(VoteOption_name, int32(x)) +} + +func (VoteOption) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{0} +} + +// 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 proposal status during the voting + // period. + StatusVotingPeriod ProposalStatus = 2 + // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + // passed. + StatusPassed ProposalStatus = 3 + // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + // been rejected. + StatusRejected ProposalStatus = 4 + // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + // failed. + StatusFailed ProposalStatus = 5 +) + +var ProposalStatus_name = map[int32]string{ + 0: "PROPOSAL_STATUS_UNSPECIFIED", + 1: "PROPOSAL_STATUS_DEPOSIT_PERIOD", + 2: "PROPOSAL_STATUS_VOTING_PERIOD", + 3: "PROPOSAL_STATUS_PASSED", + 4: "PROPOSAL_STATUS_REJECTED", + 5: "PROPOSAL_STATUS_FAILED", +} + +var ProposalStatus_value = map[string]int32{ + "PROPOSAL_STATUS_UNSPECIFIED": 0, + "PROPOSAL_STATUS_DEPOSIT_PERIOD": 1, + "PROPOSAL_STATUS_VOTING_PERIOD": 2, + "PROPOSAL_STATUS_PASSED": 3, + "PROPOSAL_STATUS_REJECTED": 4, + "PROPOSAL_STATUS_FAILED": 5, +} + +func (x ProposalStatus) String() string { + return proto.EnumName(ProposalStatus_name, int32(x)) +} + +func (ProposalStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{1} +} + +// WeightedVoteOption defines a unit of vote for vote split. +// +// Since: cosmos-sdk 0.43 +type WeightedVoteOption struct { + Option VoteOption `protobuf:"varint,1,opt,name=option,proto3,enum=cosmos.gov.v1beta1.VoteOption" json:"option,omitempty"` + Weight github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"weight"` +} + +func (m *WeightedVoteOption) Reset() { *m = WeightedVoteOption{} } +func (*WeightedVoteOption) ProtoMessage() {} +func (*WeightedVoteOption) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{0} +} +func (m *WeightedVoteOption) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WeightedVoteOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WeightedVoteOption.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 *WeightedVoteOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_WeightedVoteOption.Merge(m, src) +} +func (m *WeightedVoteOption) XXX_Size() int { + return m.Size() +} +func (m *WeightedVoteOption) XXX_DiscardUnknown() { + xxx_messageInfo_WeightedVoteOption.DiscardUnknown(m) +} + +var xxx_messageInfo_WeightedVoteOption proto.InternalMessageInfo + +// TextProposal defines a standard text proposal whose changes need to be +// manually updated in case of approval. +type TextProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` +} + +func (m *TextProposal) Reset() { *m = TextProposal{} } +func (*TextProposal) ProtoMessage() {} +func (*TextProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{1} +} +func (m *TextProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TextProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TextProposal.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 *TextProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_TextProposal.Merge(m, src) +} +func (m *TextProposal) XXX_Size() int { + return m.Size() +} +func (m *TextProposal) XXX_DiscardUnknown() { + xxx_messageInfo_TextProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_TextProposal proto.InternalMessageInfo + +// Deposit defines an amount deposited by an account address to an active +// proposal. +type Deposit struct { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` +} + +func (m *Deposit) Reset() { *m = Deposit{} } +func (*Deposit) ProtoMessage() {} +func (*Deposit) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{2} +} +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 + +// Proposal defines the core field members of a governance proposal. +type Proposal struct { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"id"` + Content *types1.Any `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` + Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=cosmos.gov.v1beta1.ProposalStatus" json:"status,omitempty"` + FinalTallyResult TallyResult `protobuf:"bytes,4,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result"` + SubmitTime time.Time `protobuf:"bytes,5,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time"` + DepositEndTime time.Time `protobuf:"bytes,6,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time"` + TotalDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,7,rep,name=total_deposit,json=totalDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"total_deposit"` + VotingStartTime time.Time `protobuf:"bytes,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time"` + VotingEndTime time.Time `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time"` +} + +func (m *Proposal) Reset() { *m = Proposal{} } +func (*Proposal) ProtoMessage() {} +func (*Proposal) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{3} +} +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 + +// TallyResult defines a standard tally for a governance proposal. +type TallyResult struct { + Yes github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=yes,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"yes"` + Abstain github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=abstain,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"abstain"` + No github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=no,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"no"` + NoWithVeto github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=no_with_veto,json=noWithVeto,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"no_with_veto"` +} + +func (m *TallyResult) Reset() { *m = TallyResult{} } +func (*TallyResult) ProtoMessage() {} +func (*TallyResult) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{4} +} +func (m *TallyResult) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TallyResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TallyResult.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 *TallyResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_TallyResult.Merge(m, src) +} +func (m *TallyResult) XXX_Size() int { + return m.Size() +} +func (m *TallyResult) XXX_DiscardUnknown() { + xxx_messageInfo_TallyResult.DiscardUnknown(m) +} + +var xxx_messageInfo_TallyResult 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 { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` + // Deprecated: Prefer to use `options` instead. This field is set in queries + // if and only if `len(options) == 1` and that option has weight 1. In all + // other cases, this field will default to VOTE_OPTION_UNSPECIFIED. + Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta1.VoteOption" json:"option,omitempty"` // Deprecated: Do not use. + // Since: cosmos-sdk 0.43 + Options []WeightedVoteOption `protobuf:"bytes,4,rep,name=options,proto3" json:"options"` +} + +func (m *Vote) Reset() { *m = Vote{} } +func (*Vote) ProtoMessage() {} +func (*Vote) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []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 + +// DepositParams defines the params for deposits on governance proposals. +type DepositParams struct { + // Minimum deposit for a proposal to enter voting period. + MinDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"min_deposit,omitempty"` + // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + // months. + MaxDepositPeriod time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty"` +} + +func (m *DepositParams) Reset() { *m = DepositParams{} } +func (*DepositParams) ProtoMessage() {} +func (*DepositParams) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{6} +} +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 + +// VotingParams defines the params for voting on governance proposals. +type VotingParams struct { + // Length of the voting period. + VotingPeriod time.Duration `protobuf:"bytes,1,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty"` +} + +func (m *VotingParams) Reset() { *m = VotingParams{} } +func (*VotingParams) ProtoMessage() {} +func (*VotingParams) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{7} +} +func (m *VotingParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VotingParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VotingParams.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 *VotingParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_VotingParams.Merge(m, src) +} +func (m *VotingParams) XXX_Size() int { + return m.Size() +} +func (m *VotingParams) XXX_DiscardUnknown() { + xxx_messageInfo_VotingParams.DiscardUnknown(m) +} + +var xxx_messageInfo_VotingParams proto.InternalMessageInfo + +// TallyParams defines the params for tallying votes on governance proposals. +type TallyParams struct { + // Minimum percentage of total stake needed to vote for a result to be + // considered valid. + Quorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=quorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"quorum,omitempty"` + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. + Threshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=threshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"threshold,omitempty"` + // Minimum value of Veto votes to Total votes ratio for proposal to be + // vetoed. Default value: 1/3. + VetoThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=veto_threshold,json=vetoThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"veto_threshold,omitempty"` +} + +func (m *TallyParams) Reset() { *m = TallyParams{} } +func (*TallyParams) ProtoMessage() {} +func (*TallyParams) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{8} +} +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 + +func init() { + proto.RegisterEnum("cosmos.gov.v1beta1.VoteOption", VoteOption_name, VoteOption_value) + proto.RegisterEnum("cosmos.gov.v1beta1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) + proto.RegisterType((*WeightedVoteOption)(nil), "cosmos.gov.v1beta1.WeightedVoteOption") + proto.RegisterType((*TextProposal)(nil), "cosmos.gov.v1beta1.TextProposal") + proto.RegisterType((*Deposit)(nil), "cosmos.gov.v1beta1.Deposit") + proto.RegisterType((*Proposal)(nil), "cosmos.gov.v1beta1.Proposal") + proto.RegisterType((*TallyResult)(nil), "cosmos.gov.v1beta1.TallyResult") + proto.RegisterType((*Vote)(nil), "cosmos.gov.v1beta1.Vote") + proto.RegisterType((*DepositParams)(nil), "cosmos.gov.v1beta1.DepositParams") + proto.RegisterType((*VotingParams)(nil), "cosmos.gov.v1beta1.VotingParams") + proto.RegisterType((*TallyParams)(nil), "cosmos.gov.v1beta1.TallyParams") +} + +func init() { proto.RegisterFile("cosmos/gov/v1beta1/gov.proto", fileDescriptor_6e82113c1a9a4b7c) } + +var fileDescriptor_6e82113c1a9a4b7c = []byte{ + // 1356 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcf, 0x6f, 0x13, 0x47, + 0x1b, 0xf6, 0xda, 0x8e, 0x93, 0xbc, 0x76, 0x92, 0x65, 0xc8, 0x07, 0x8e, 0x3f, 0x3e, 0x7b, 0xe5, + 0x4f, 0xa2, 0x11, 0x22, 0x0e, 0xa4, 0x12, 0x52, 0x43, 0x2f, 0x76, 0xbc, 0x69, 0x8d, 0x22, 0xdb, + 0x5a, 0x2f, 0x8e, 0xe0, 0xd0, 0xd5, 0xc6, 0x3b, 0x38, 0xdb, 0x7a, 0x77, 0x8c, 0x77, 0x1c, 0x92, + 0x5b, 0x2f, 0x95, 0x90, 0x4f, 0x1c, 0xb9, 0x58, 0x42, 0xed, 0xad, 0xa7, 0x1e, 0xf8, 0x07, 0x7a, + 0x43, 0x55, 0x0f, 0x94, 0x13, 0xea, 0x21, 0x94, 0xa0, 0x56, 0x94, 0xbf, 0xa2, 0xda, 0x99, 0xd9, + 0x64, 0xe3, 0x44, 0x0d, 0x2e, 0x3d, 0x79, 0x76, 0xe6, 0x79, 0x9e, 0xf7, 0x87, 0xdf, 0xf7, 0x9d, + 0x5d, 0xb8, 0xd4, 0x22, 0x9e, 0x43, 0xbc, 0xe5, 0x36, 0xd9, 0x59, 0xde, 0xb9, 0xbe, 0x85, 0xa9, + 0x79, 0xdd, 0x5f, 0x17, 0xba, 0x3d, 0x42, 0x09, 0x42, 0xfc, 0xb4, 0xe0, 0xef, 0x88, 0xd3, 0x4c, + 0x56, 0x30, 0xb6, 0x4c, 0x0f, 0x1f, 0x52, 0x5a, 0xc4, 0x76, 0x39, 0x27, 0x33, 0xdf, 0x26, 0x6d, + 0xc2, 0x96, 0xcb, 0xfe, 0x4a, 0xec, 0xe6, 0xda,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a0, 0xc1, 0x50, 0x99, 0x15, 0x6f, 0x48, 0xf8, + 0x4b, 0xdc, 0xa2, 0xf8, 0x54, 0xfd, 0xf5, 0x62, 0x65, 0x43, 0x2d, 0xcb, 0x13, 0x61, 0xfd, 0x75, + 0xd3, 0xee, 0x60, 0x8b, 0xa7, 0xb3, 0xd4, 0x7c, 0xf6, 0x3a, 0x1b, 0x79, 0xf9, 0x3a, 0x1b, 0xf9, + 0xfa, 0x20, 0x1b, 0x79, 0x76, 0x90, 0x95, 0x9e, 0x1f, 0x64, 0xa5, 0xdf, 0x0e, 0xb2, 0xd2, 0xa3, + 0x37, 0xd9, 0xc8, 0xf3, 0x37, 0xd9, 0xc8, 0xcb, 0x37, 0xd9, 0xc8, 0xdd, 0x6b, 0x7f, 0x5b, 0xb0, + 0xbb, 0xec, 0x9b, 0x87, 0x95, 0x6d, 0xf0, 0x19, 0xb3, 0x95, 0x60, 0x93, 0xe1, 0xe3, 0xbf, 0x02, + 0x00, 0x00, 0xff, 0xff, 0x14, 0x1f, 0x45, 0x67, 0x16, 0x0d, 0x00, 0x00, +} + +func (this *TextProposal) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TextProposal) + if !ok { + that2, ok := that.(TextProposal) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Title != that1.Title { + return false + } + if this.Description != that1.Description { + return false + } + return true +} +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.ProposalId != that1.ProposalId { + return false + } + if !this.Content.Equal(that1.Content) { + return false + } + if this.Status != that1.Status { + 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 (this *TallyResult) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TallyResult) + if !ok { + that2, ok := that.(TallyResult) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Yes.Equal(that1.Yes) { + return false + } + if !this.Abstain.Equal(that1.Abstain) { + return false + } + if !this.No.Equal(that1.No) { + return false + } + if !this.NoWithVeto.Equal(that1.NoWithVeto) { + return false + } + return true +} +func (m *WeightedVoteOption) 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 *WeightedVoteOption) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WeightedVoteOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Weight.Size() + i -= size + if _, err := m.Weight.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Option != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.Option)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *TextProposal) 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 *TextProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TextProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintGov(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + 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.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[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.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintGov(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + 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 + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintGov(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x4a + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintGov(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x42 + 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] = 0x3a + } + } + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DepositEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintGov(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x32 + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintGov(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x2a + { + size, err := m.FinalTallyResult.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if m.Status != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x18 + } + 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] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *TallyResult) 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 *TallyResult) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TallyResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.NoWithVeto.Size() + i -= size + if _, err := m.NoWithVeto.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.No.Size() + i -= size + if _, err := m.No.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.Abstain.Size() + i -= size + if _, err := m.Abstain.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.Yes.Size() + i -= size + if _, err := m.Yes.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + 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.Options) > 0 { + for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.Option != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.Option)) + i-- + dAtA[i] = 0x18 + } + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintGov(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + 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 + n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxDepositPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxDepositPeriod):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintGov(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x12 + 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] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *VotingParams) 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 *VotingParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n8, err8 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.VotingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod):]) + if err8 != nil { + return 0, err8 + } + i -= n8 + i = encodeVarintGov(dAtA, i, uint64(n8)) + 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 + { + size := m.VetoThreshold.Size() + i -= size + if _, err := m.VetoThreshold.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.Threshold.Size() + i -= size + if _, err := m.Threshold.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.Quorum.Size() + i -= size + if _, err := m.Quorum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + 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 *WeightedVoteOption) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Option != 0 { + n += 1 + sovGov(uint64(m.Option)) + } + l = m.Weight.Size() + n += 1 + l + sovGov(uint64(l)) + return n +} + +func (m *TextProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Description) + if l > 0 { + 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.ProposalId != 0 { + n += 1 + sovGov(uint64(m.ProposalId)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.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.ProposalId != 0 { + n += 1 + sovGov(uint64(m.ProposalId)) + } + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovGov(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovGov(uint64(m.Status)) + } + 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 *TallyResult) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Yes.Size() + n += 1 + l + sovGov(uint64(l)) + l = m.Abstain.Size() + n += 1 + l + sovGov(uint64(l)) + l = m.No.Size() + n += 1 + l + sovGov(uint64(l)) + l = m.NoWithVeto.Size() + 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.ProposalId != 0 { + n += 1 + sovGov(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if m.Option != 0 { + n += 1 + sovGov(uint64(m.Option)) + } + if len(m.Options) > 0 { + for _, e := range m.Options { + l = e.Size() + 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.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 *VotingParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod) + n += 1 + l + sovGov(uint64(l)) + return n +} + +func (m *TallyParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Quorum.Size() + n += 1 + l + sovGov(uint64(l)) + l = m.Threshold.Size() + n += 1 + l + sovGov(uint64(l)) + l = m.VetoThreshold.Size() + 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 *WeightedVoteOption) 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: WeightedVoteOption: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WeightedVoteOption: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) + } + m.Option = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Option |= VoteOption(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Weight", 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 + } + if err := m.Weight.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 *TextProposal) 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: TextProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TextProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", 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.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", 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.Description = 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 *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 != 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 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", 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.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].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 != 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 2: + 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 = &types1.Any{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + 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 != 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 5: + 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 6: + 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 7: + 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, types.Coin{}) + if err := m.TotalDeposit[len(m.TotalDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + 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 9: + 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 *TallyResult) 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: TallyResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TallyResult: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Yes", 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 + } + if err := m.Yes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Abstain", 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 + } + if err := m.Abstain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field No", 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 + } + if err := m.No.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NoWithVeto", 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 + } + if err := m.NoWithVeto.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 *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 != 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 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", 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.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) + } + m.Option = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Option |= VoteOption(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", 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.Options = append(m.Options, WeightedVoteOption{}) + if err := m.Options[len(m.Options)-1].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 *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 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, types.Coin{}) + if err := m.MinDeposit[len(m.MinDeposit)-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 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 *VotingParams) 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: VotingParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VotingParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingPeriod", 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.VotingPeriod, 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 Quorum", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Quorum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Threshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VetoThreshold", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VetoThreshold.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 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/types/v1beta1/msgs.go b/x/gov/types/v1beta1/msgs.go new file mode 100644 index 000000000000..4a9653570a88 --- /dev/null +++ b/x/gov/types/v1beta1/msgs.go @@ -0,0 +1,282 @@ +package v1beta1 + +import ( + "fmt" + + "sigs.k8s.io/yaml" + + "github.com/gogo/protobuf/proto" + + "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// Governance message types and routes +const ( + TypeMsgDeposit = "deposit" + TypeMsgVote = "vote" + TypeMsgVoteWeighted = "weighted_vote" + TypeMsgSubmitProposal = "submit_proposal" +) + +var ( + _, _, _, _ sdk.Msg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{} + _ types.UnpackInterfacesMessage = &MsgSubmitProposal{} +) + +// NewMsgSubmitProposal creates a new MsgSubmitProposal. +//nolint:interfacer +func NewMsgSubmitProposal(content Content, initialDeposit sdk.Coins, proposer sdk.AccAddress) (*MsgSubmitProposal, error) { + m := &MsgSubmitProposal{ + InitialDeposit: initialDeposit, + Proposer: proposer.String(), + } + err := m.SetContent(content) + if err != nil { + return nil, err + } + return m, nil +} + +func (m *MsgSubmitProposal) GetInitialDeposit() sdk.Coins { return m.InitialDeposit } + +func (m *MsgSubmitProposal) GetProposer() sdk.AccAddress { + proposer, _ := sdk.AccAddressFromBech32(m.Proposer) + return proposer +} + +func (m *MsgSubmitProposal) GetContent() Content { + content, ok := m.Content.GetCachedValue().(Content) + if !ok { + return nil + } + return content +} + +func (m *MsgSubmitProposal) SetInitialDeposit(coins sdk.Coins) { + m.InitialDeposit = coins +} + +func (m *MsgSubmitProposal) SetProposer(address fmt.Stringer) { + m.Proposer = address.String() +} + +func (m *MsgSubmitProposal) SetContent(content Content) error { + msg, ok := content.(proto.Message) + if !ok { + return fmt.Errorf("can't proto marshal %T", msg) + } + any, err := types.NewAnyWithValue(msg) + if err != nil { + return err + } + m.Content = any + return nil +} + +// Route implements Msg +func (m MsgSubmitProposal) Route() string { return RouterKey } + +// Type implements Msg +func (m MsgSubmitProposal) Type() string { return TypeMsgSubmitProposal } + +// ValidateBasic implements Msg +func (m MsgSubmitProposal) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Proposer); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid proposer address: %s", err) + } + if !m.InitialDeposit.IsValid() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.InitialDeposit.String()) + } + if m.InitialDeposit.IsAnyNegative() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.InitialDeposit.String()) + } + + content := m.GetContent() + if content == nil { + return sdkerrors.Wrap(ErrInvalidProposalContent, "missing content") + } + if !IsValidProposalType(content.ProposalType()) { + return sdkerrors.Wrap(ErrInvalidProposalType, content.ProposalType()) + } + if err := content.ValidateBasic(); err != nil { + return err + } + + return nil +} + +// GetSignBytes implements Msg +func (m MsgSubmitProposal) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&m) + return sdk.MustSortJSON(bz) +} + +// GetSigners implements Msg +func (m MsgSubmitProposal) GetSigners() []sdk.AccAddress { + proposer, _ := sdk.AccAddressFromBech32(m.Proposer) + return []sdk.AccAddress{proposer} +} + +// String implements the Stringer interface +func (m MsgSubmitProposal) String() string { + out, _ := yaml.Marshal(m) + return string(out) +} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (m MsgSubmitProposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { + var content Content + return unpacker.UnpackAny(m.Content, &content) +} + +// NewMsgDeposit creates a new MsgDeposit instance +//nolint:interfacer +func NewMsgDeposit(depositor sdk.AccAddress, proposalID uint64, amount sdk.Coins) *MsgDeposit { + return &MsgDeposit{proposalID, depositor.String(), amount} +} + +// Route implements Msg +func (msg MsgDeposit) Route() string { return RouterKey } + +// Type implements Msg +func (msg MsgDeposit) Type() string { return TypeMsgDeposit } + +// ValidateBasic implements Msg +func (msg MsgDeposit) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Depositor); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid depositor address: %s", err) + } + if !msg.Amount.IsValid() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.Amount.String()) + } + if msg.Amount.IsAnyNegative() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.Amount.String()) + } + + return nil +} + +// String implements the Stringer interface +func (msg MsgDeposit) String() string { + out, _ := yaml.Marshal(msg) + return string(out) +} + +// GetSignBytes implements Msg +func (msg MsgDeposit) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners implements Msg +func (msg MsgDeposit) GetSigners() []sdk.AccAddress { + depositor, _ := sdk.AccAddressFromBech32(msg.Depositor) + return []sdk.AccAddress{depositor} +} + +// NewMsgVote creates a message to cast a vote on an active proposal +//nolint:interfacer +func NewMsgVote(voter sdk.AccAddress, proposalID uint64, option VoteOption) *MsgVote { + return &MsgVote{proposalID, voter.String(), option} +} + +// Route implements Msg +func (msg MsgVote) Route() string { return RouterKey } + +// Type implements Msg +func (msg MsgVote) Type() string { return TypeMsgVote } + +// ValidateBasic implements Msg +func (msg MsgVote) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Voter); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid voter address: %s", err) + } + if !ValidVoteOption(msg.Option) { + return sdkerrors.Wrap(ErrInvalidVote, msg.Option.String()) + } + + return nil +} + +// String implements the Stringer interface +func (msg MsgVote) String() string { + out, _ := yaml.Marshal(msg) + return string(out) +} + +// GetSignBytes implements Msg +func (msg MsgVote) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners implements Msg +func (msg MsgVote) GetSigners() []sdk.AccAddress { + voter, _ := sdk.AccAddressFromBech32(msg.Voter) + return []sdk.AccAddress{voter} +} + +// NewMsgVoteWeighted creates a message to cast a vote on an active proposal +//nolint:interfacer +func NewMsgVoteWeighted(voter sdk.AccAddress, proposalID uint64, options WeightedVoteOptions) *MsgVoteWeighted { + return &MsgVoteWeighted{proposalID, voter.String(), options} +} + +// Route implements Msg +func (msg MsgVoteWeighted) Route() string { return RouterKey } + +// Type implements Msg +func (msg MsgVoteWeighted) Type() string { return TypeMsgVoteWeighted } + +// ValidateBasic implements Msg +func (msg MsgVoteWeighted) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Voter); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid voter address: %s", err) + } + if len(msg.Options) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, WeightedVoteOptions(msg.Options).String()) + } + + totalWeight := sdk.NewDec(0) + usedOptions := make(map[VoteOption]bool) + for _, option := range msg.Options { + if !ValidWeightedVoteOption(option) { + return sdkerrors.Wrap(ErrInvalidVote, option.String()) + } + totalWeight = totalWeight.Add(option.Weight) + if usedOptions[option.Option] { + return sdkerrors.Wrap(ErrInvalidVote, "Duplicated vote option") + } + usedOptions[option.Option] = true + } + + if totalWeight.GT(sdk.NewDec(1)) { + return sdkerrors.Wrap(ErrInvalidVote, "Total weight overflow 1.00") + } + + if totalWeight.LT(sdk.NewDec(1)) { + return sdkerrors.Wrap(ErrInvalidVote, "Total weight lower than 1.00") + } + + return nil +} + +// String implements the Stringer interface +func (msg MsgVoteWeighted) String() string { + out, _ := yaml.Marshal(msg) + return string(out) +} + +// GetSignBytes implements Msg +func (msg MsgVoteWeighted) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners implements Msg +func (msg MsgVoteWeighted) GetSigners() []sdk.AccAddress { + voter, _ := sdk.AccAddressFromBech32(msg.Voter) + return []sdk.AccAddress{voter} +} diff --git a/x/gov/types/v1beta1/msgs_test.go b/x/gov/types/v1beta1/msgs_test.go new file mode 100644 index 000000000000..3d571a6559fc --- /dev/null +++ b/x/gov/types/v1beta1/msgs_test.go @@ -0,0 +1,176 @@ +package v1beta1 + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var ( + coinsPos = sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 1000)) + coinsZero = sdk.NewCoins() + coinsMulti = sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 1000), sdk.NewInt64Coin("foo", 10000)) + addrs = []sdk.AccAddress{ + sdk.AccAddress("test1"), + sdk.AccAddress("test2"), + } +) + +func init() { + coinsMulti.Sort() +} + +// test ValidateBasic for MsgCreateValidator +func TestMsgSubmitProposal(t *testing.T) { + tests := []struct { + title, description string + proposalType string + proposerAddr sdk.AccAddress + initialDeposit sdk.Coins + expectPass bool + }{ + {"Test Proposal", "the purpose of this proposal is to test", ProposalTypeText, addrs[0], coinsPos, true}, + {"", "the purpose of this proposal is to test", ProposalTypeText, addrs[0], coinsPos, false}, + {"Test Proposal", "", ProposalTypeText, addrs[0], coinsPos, false}, + {"Test Proposal", "the purpose of this proposal is to test", ProposalTypeText, sdk.AccAddress{}, coinsPos, false}, + {"Test Proposal", "the purpose of this proposal is to test", ProposalTypeText, addrs[0], coinsZero, true}, + {"Test Proposal", "the purpose of this proposal is to test", ProposalTypeText, addrs[0], coinsMulti, true}, + {strings.Repeat("#", MaxTitleLength*2), "the purpose of this proposal is to test", ProposalTypeText, addrs[0], coinsMulti, false}, + {"Test Proposal", strings.Repeat("#", MaxDescriptionLength*2), ProposalTypeText, addrs[0], coinsMulti, false}, + } + + for i, tc := range tests { + msg, err := NewMsgSubmitProposal( + ContentFromProposalType(tc.title, tc.description, tc.proposalType), + tc.initialDeposit, + tc.proposerAddr, + ) + + require.NoError(t, err) + + if tc.expectPass { + require.NoError(t, msg.ValidateBasic(), "test: %v", i) + } else { + require.Error(t, msg.ValidateBasic(), "test: %v", i) + } + } +} + +func TestMsgDepositGetSignBytes(t *testing.T) { + addr := sdk.AccAddress("addr1") + msg := NewMsgDeposit(addr, 0, coinsPos) + res := msg.GetSignBytes() + + expected := `{"type":"cosmos-sdk/MsgDeposit","value":{"amount":[{"amount":"1000","denom":"stake"}],"depositor":"cosmos1v9jxgu33kfsgr5","proposal_id":"0"}}` + require.Equal(t, expected, string(res)) +} + +// test ValidateBasic for MsgDeposit +func TestMsgDeposit(t *testing.T) { + tests := []struct { + proposalID uint64 + depositorAddr sdk.AccAddress + depositAmount sdk.Coins + expectPass bool + }{ + {0, addrs[0], coinsPos, true}, + {1, sdk.AccAddress{}, coinsPos, false}, + {1, addrs[0], coinsZero, true}, + {1, addrs[0], coinsMulti, true}, + } + + for i, tc := range tests { + msg := NewMsgDeposit(tc.depositorAddr, tc.proposalID, tc.depositAmount) + if tc.expectPass { + require.NoError(t, msg.ValidateBasic(), "test: %v", i) + } else { + require.Error(t, msg.ValidateBasic(), "test: %v", i) + } + } +} + +// test ValidateBasic for MsgVote +func TestMsgVote(t *testing.T) { + tests := []struct { + proposalID uint64 + voterAddr sdk.AccAddress + option VoteOption + expectPass bool + }{ + {0, addrs[0], OptionYes, true}, + {0, sdk.AccAddress{}, OptionYes, false}, + {0, addrs[0], OptionNo, true}, + {0, addrs[0], OptionNoWithVeto, true}, + {0, addrs[0], OptionAbstain, true}, + {0, addrs[0], VoteOption(0x13), false}, + } + + for i, tc := range tests { + msg := NewMsgVote(tc.voterAddr, tc.proposalID, tc.option) + if tc.expectPass { + require.Nil(t, msg.ValidateBasic(), "test: %v", i) + } else { + require.NotNil(t, msg.ValidateBasic(), "test: %v", i) + } + } +} + +// test ValidateBasic for MsgVoteWeighted +func TestMsgVoteWeighted(t *testing.T) { + tests := []struct { + proposalID uint64 + voterAddr sdk.AccAddress + options WeightedVoteOptions + expectPass bool + }{ + {0, addrs[0], NewNonSplitVoteOption(OptionYes), true}, + {0, sdk.AccAddress{}, NewNonSplitVoteOption(OptionYes), false}, + {0, addrs[0], NewNonSplitVoteOption(OptionNo), true}, + {0, addrs[0], NewNonSplitVoteOption(OptionNoWithVeto), true}, + {0, addrs[0], NewNonSplitVoteOption(OptionAbstain), true}, + {0, addrs[0], WeightedVoteOptions{ // weight sum > 1 + WeightedVoteOption{Option: OptionYes, Weight: sdk.NewDec(1)}, + WeightedVoteOption{Option: OptionAbstain, Weight: sdk.NewDec(1)}, + }, false}, + {0, addrs[0], WeightedVoteOptions{ // duplicate option + WeightedVoteOption{Option: OptionYes, Weight: sdk.NewDecWithPrec(5, 1)}, + WeightedVoteOption{Option: OptionYes, Weight: sdk.NewDecWithPrec(5, 1)}, + }, false}, + {0, addrs[0], WeightedVoteOptions{ // zero weight + WeightedVoteOption{Option: OptionYes, Weight: sdk.NewDec(0)}, + }, false}, + {0, addrs[0], WeightedVoteOptions{ // negative weight + WeightedVoteOption{Option: OptionYes, Weight: sdk.NewDec(-1)}, + }, false}, + {0, addrs[0], WeightedVoteOptions{}, false}, + {0, addrs[0], NewNonSplitVoteOption(VoteOption(0x13)), false}, + {0, addrs[0], WeightedVoteOptions{ // weight sum <1 + WeightedVoteOption{Option: OptionYes, Weight: sdk.NewDecWithPrec(5, 1)}, + }, false}, + } + + for i, tc := range tests { + msg := NewMsgVoteWeighted(tc.voterAddr, tc.proposalID, tc.options) + if tc.expectPass { + require.Nil(t, msg.ValidateBasic(), "test: %v", i) + } else { + require.NotNil(t, msg.ValidateBasic(), "test: %v", i) + } + } +} + +// this tests that Amino JSON MsgSubmitProposal.GetSignBytes() still works with Content as Any using the ModuleCdc +func TestMsgSubmitProposal_GetSignBytes(t *testing.T) { + msg, err := NewMsgSubmitProposal(NewTextProposal("test", "abcd"), sdk.NewCoins(), sdk.AccAddress{}) + require.NoError(t, err) + var bz []byte + require.NotPanics(t, func() { + bz = msg.GetSignBytes() + }) + require.Equal(t, + `{"type":"cosmos-sdk/MsgSubmitProposal","value":{"content":{"type":"cosmos-sdk/TextProposal","value":{"description":"abcd","title":"test"}},"initial_deposit":[]}}`, + string(bz)) +} diff --git a/x/gov/types/v1beta1/params.go b/x/gov/types/v1beta1/params.go new file mode 100644 index 000000000000..f9c90b251357 --- /dev/null +++ b/x/gov/types/v1beta1/params.go @@ -0,0 +1,198 @@ +package v1beta1 + +import ( + "fmt" + "time" + + "sigs.k8s.io/yaml" + + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +// Default period for deposits & voting +const ( + DefaultPeriod time.Duration = time.Hour * 24 * 2 // 2 days +) + +// Default governance params +var ( + DefaultMinDepositTokens = sdk.NewInt(10000000) + DefaultQuorum = sdk.NewDecWithPrec(334, 3) + DefaultThreshold = sdk.NewDecWithPrec(5, 1) + DefaultVetoThreshold = sdk.NewDecWithPrec(334, 3) +) + +// Parameter store key +var ( + ParamStoreKeyDepositParams = []byte("depositparams") + ParamStoreKeyVotingParams = []byte("votingparams") + ParamStoreKeyTallyParams = []byte("tallyparams") +) + +// ParamKeyTable - Key declaration for parameters +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable( + paramtypes.NewParamSetPair(ParamStoreKeyDepositParams, DepositParams{}, validateDepositParams), + paramtypes.NewParamSetPair(ParamStoreKeyVotingParams, VotingParams{}, validateVotingParams), + paramtypes.NewParamSetPair(ParamStoreKeyTallyParams, TallyParams{}, validateTallyParams), + ) +} + +// NewDepositParams creates a new DepositParams object +func NewDepositParams(minDeposit sdk.Coins, maxDepositPeriod time.Duration) DepositParams { + return DepositParams{ + MinDeposit: minDeposit, + MaxDepositPeriod: maxDepositPeriod, + } +} + +// DefaultDepositParams default parameters for deposits +func DefaultDepositParams() DepositParams { + return NewDepositParams( + sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinDepositTokens)), + DefaultPeriod, + ) +} + +// String implements stringer insterface +func (dp DepositParams) String() string { + out, _ := yaml.Marshal(dp) + return string(out) +} + +// Equal checks equality of DepositParams +func (dp DepositParams) Equal(dp2 DepositParams) bool { + return 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 +} + +// NewTallyParams creates a new TallyParams object +func NewTallyParams(quorum, threshold, vetoThreshold sdk.Dec) TallyParams { + return TallyParams{ + Quorum: quorum, + Threshold: threshold, + VetoThreshold: vetoThreshold, + } +} + +// DefaultTallyParams default parameters for tallying +func DefaultTallyParams() TallyParams { + return NewTallyParams(DefaultQuorum, DefaultThreshold, DefaultVetoThreshold) +} + +// Equal checks equality of TallyParams +func (tp TallyParams) Equal(other TallyParams) bool { + return tp.Quorum.Equal(other.Quorum) && tp.Threshold.Equal(other.Threshold) && tp.VetoThreshold.Equal(other.VetoThreshold) +} + +// String implements stringer insterface +func (tp TallyParams) String() string { + out, _ := yaml.Marshal(tp) + return string(out) +} + +func validateTallyParams(i interface{}) error { + v, ok := i.(TallyParams) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.Quorum.IsNegative() { + return fmt.Errorf("quorom cannot be negative: %s", v.Quorum) + } + if v.Quorum.GT(sdk.OneDec()) { + return fmt.Errorf("quorom too large: %s", v) + } + if !v.Threshold.IsPositive() { + return fmt.Errorf("vote threshold must be positive: %s", v.Threshold) + } + if v.Threshold.GT(sdk.OneDec()) { + return fmt.Errorf("vote threshold too large: %s", v) + } + if !v.VetoThreshold.IsPositive() { + return fmt.Errorf("veto threshold must be positive: %s", v.Threshold) + } + if v.VetoThreshold.GT(sdk.OneDec()) { + return fmt.Errorf("veto threshold too large: %s", v) + } + + return nil +} + +// NewVotingParams creates a new VotingParams object +func NewVotingParams(votingPeriod time.Duration) VotingParams { + return VotingParams{ + VotingPeriod: votingPeriod, + } +} + +// DefaultVotingParams default parameters for voting +func DefaultVotingParams() VotingParams { + return NewVotingParams(DefaultPeriod) +} + +// Equal checks equality of TallyParams +func (vp VotingParams) Equal(other VotingParams) bool { + return vp.VotingPeriod == other.VotingPeriod +} + +// String implements stringer interface +func (vp VotingParams) String() string { + out, _ := yaml.Marshal(vp) + return string(out) +} + +func validateVotingParams(i interface{}) error { + v, ok := i.(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 +} + +// Params returns all of the governance params +type Params struct { + VotingParams VotingParams `json:"voting_params" yaml:"voting_params"` + TallyParams TallyParams `json:"tally_params" yaml:"tally_params"` + DepositParams DepositParams `json:"deposit_params" yaml:"deposit_params"` +} + +func (gp Params) String() string { + return gp.VotingParams.String() + "\n" + + gp.TallyParams.String() + "\n" + gp.DepositParams.String() +} + +// NewParams creates a new gov Params instance +func NewParams(vp VotingParams, tp TallyParams, dp DepositParams) Params { + return Params{ + VotingParams: vp, + DepositParams: dp, + TallyParams: tp, + } +} + +// DefaultParams default governance params +func DefaultParams() Params { + return NewParams(DefaultVotingParams(), DefaultTallyParams(), DefaultDepositParams()) +} diff --git a/x/gov/types/v1beta1/proposal.go b/x/gov/types/v1beta1/proposal.go new file mode 100644 index 000000000000..0975f76881fe --- /dev/null +++ b/x/gov/types/v1beta1/proposal.go @@ -0,0 +1,280 @@ +package v1beta1 + +import ( + "fmt" + "strings" + "time" + + "github.com/gogo/protobuf/proto" + "sigs.k8s.io/yaml" + + "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// DefaultStartingProposalID is 1 +const DefaultStartingProposalID uint64 = 1 + +func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Time) (Proposal, error) { + 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 := Proposal{ + Content: any, + ProposalId: id, + Status: StatusDepositPeriod, + FinalTallyResult: EmptyTallyResult(), + TotalDeposit: sdk.NewCoins(), + SubmitTime: submitTime, + DepositEndTime: depositEndTime, + } + + return p, nil +} + +// String implements stringer interface +func (p Proposal) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} + +// GetContent returns the proposal Content +func (p Proposal) GetContent() Content { + content, ok := p.Content.GetCachedValue().(Content) + if !ok { + return nil + } + return content +} + +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() +} + +func (p Proposal) GetTitle() string { + content := p.GetContent() + if content == nil { + return "" + } + return content.GetTitle() +} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (p Proposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { + var content Content + return unpacker.UnpackAny(p.Content, &content) +} + +// Proposals is an array of proposal +type Proposals []Proposal + +var _ types.UnpackInterfacesMessage = Proposals{} + +// Equal returns true if two slices (order-dependant) of proposals are equal. +func (p Proposals) Equal(other Proposals) bool { + if len(p) != len(other) { + return false + } + + for i, proposal := range p { + if !proposal.Equal(other[i]) { + return false + } + } + + return true +} + +// 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 +} + +// 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 +} + +// Marshal needed for protobuf compatibility +func (status ProposalStatus) Marshal() ([]byte, error) { + return []byte{byte(status)}, nil +} + +// Unmarshal needed for protobuf compatibility +func (status *ProposalStatus) Unmarshal(data []byte) error { + *status = ProposalStatus(data[0]) + return nil +} + +// Format implements the fmt.Formatter interface. +// nolint: errcheck +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)))) + } +} + +// Proposal types +const ( + ProposalTypeText string = "Text" + + // Constants pertaining to a Content object + MaxDescriptionLength int = 5000 + MaxTitleLength int = 140 +) + +// Implements Content Interface +var _ Content = &TextProposal{} + +// NewTextProposal creates a text proposal Content +func NewTextProposal(title, description string) Content { + return &TextProposal{title, description} +} + +// GetTitle returns the proposal title +func (tp *TextProposal) GetTitle() string { return tp.Title } + +// GetDescription returns the proposal description +func (tp *TextProposal) GetDescription() string { return tp.Description } + +// ProposalRoute returns the proposal router key +func (tp *TextProposal) ProposalRoute() string { return RouterKey } + +// ProposalType is "Text" +func (tp *TextProposal) ProposalType() string { return ProposalTypeText } + +// ValidateBasic validates the content's title and description of the proposal +func (tp *TextProposal) ValidateBasic() error { return ValidateAbstract(tp) } + +// String implements Stringer interface +func (tp TextProposal) String() string { + out, _ := yaml.Marshal(tp) + return string(out) +} + +func ValidProposalStatus(status ProposalStatus) bool { + if status == StatusDepositPeriod || + status == StatusVotingPeriod || + status == StatusPassed || + status == StatusRejected || + status == StatusFailed { + return true + } + return false +} + +// ValidateAbstract validates a proposal's abstract contents returning an error +// if invalid. +func ValidateAbstract(c Content) error { + title := c.GetTitle() + if len(strings.TrimSpace(title)) == 0 { + return sdkerrors.Wrap(ErrInvalidProposalContent, "proposal title cannot be blank") + } + if len(title) > MaxTitleLength { + return sdkerrors.Wrapf(ErrInvalidProposalContent, "proposal title is longer than max length of %d", MaxTitleLength) + } + + description := c.GetDescription() + if len(description) == 0 { + return sdkerrors.Wrap(ErrInvalidProposalContent, "proposal description cannot be blank") + } + if len(description) > MaxDescriptionLength { + return sdkerrors.Wrapf(ErrInvalidProposalContent, "proposal description is longer than max length of %d", MaxDescriptionLength) + } + + return nil +} + +var validProposalTypes = map[string]struct{}{ + ProposalTypeText: {}, +} + +// RegisterProposalType registers a proposal type. It will panic if the type is +// already registered. +func RegisterProposalType(ty string) { + if _, ok := validProposalTypes[ty]; ok { + panic(fmt.Sprintf("already registered proposal type: %s", ty)) + } + + validProposalTypes[ty] = struct{}{} +} + +// ContentFromProposalType returns a Content object based on the proposal type. +func ContentFromProposalType(title, desc, ty string) Content { + switch ty { + case ProposalTypeText: + return NewTextProposal(title, desc) + + default: + return nil + } +} + +// IsValidProposalType returns a boolean determining if the proposal type is +// valid. +// +// NOTE: Modules with their own proposal types must register them. +func IsValidProposalType(ty string) bool { + _, ok := validProposalTypes[ty] + return ok +} + +// ProposalHandler implements the Handler interface for governance module-based +// proposals (ie. TextProposal ). Since these are +// merely signaling mechanisms at the moment and do not affect state, it +// performs a no-op. +func ProposalHandler(_ sdk.Context, c Content) error { + switch c.ProposalType() { + case ProposalTypeText: + // both proposal types do not change state so this performs a no-op + return nil + + default: + return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized gov proposal type: %s", c.ProposalType()) + } +} diff --git a/x/gov/types/v1beta1/proposals_test.go b/x/gov/types/v1beta1/proposals_test.go new file mode 100644 index 000000000000..fd328b3ca471 --- /dev/null +++ b/x/gov/types/v1beta1/proposals_test.go @@ -0,0 +1,24 @@ +package v1beta1 + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestProposalStatus_Format(t *testing.T) { + statusDepositPeriod, _ := ProposalStatusFromString("PROPOSAL_STATUS_DEPOSIT_PERIOD") + tests := []struct { + pt ProposalStatus + sprintFArgs string + expectedStringOutput string + }{ + {statusDepositPeriod, "%s", "PROPOSAL_STATUS_DEPOSIT_PERIOD"}, + {statusDepositPeriod, "%v", "1"}, + } + for _, tt := range tests { + got := fmt.Sprintf(tt.sprintFArgs, tt.pt) + require.Equal(t, tt.expectedStringOutput, got) + } +} diff --git a/x/gov/types/v1beta1/querier.go b/x/gov/types/v1beta1/querier.go new file mode 100644 index 000000000000..f08c4898b1f6 --- /dev/null +++ b/x/gov/types/v1beta1/querier.go @@ -0,0 +1,102 @@ +package v1beta1 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// DONTCOVER + +// query endpoints supported by the governance Querier +const ( + QueryParams = "params" + QueryProposals = "proposals" + QueryProposal = "proposal" + QueryDeposits = "deposits" + QueryDeposit = "deposit" + QueryVotes = "votes" + QueryVote = "vote" + QueryTally = "tally" + + ParamDeposit = "deposit" + ParamVoting = "voting" + ParamTallying = "tallying" +) + +// QueryProposalParams Params for queries: +// - 'custom/gov/proposal' +// - 'custom/gov/deposits' +// - 'custom/gov/tally' +type QueryProposalParams struct { + ProposalID uint64 +} + +// NewQueryProposalParams creates a new instance of QueryProposalParams +func NewQueryProposalParams(proposalID uint64) QueryProposalParams { + return QueryProposalParams{ + ProposalID: proposalID, + } +} + +// QueryProposalVotesParams used for queries to 'custom/gov/votes'. +type QueryProposalVotesParams struct { + ProposalID uint64 + Page int + Limit int +} + +// NewQueryProposalVotesParams creates new instance of the QueryProposalVotesParams. +func NewQueryProposalVotesParams(proposalID uint64, page, limit int) QueryProposalVotesParams { + return QueryProposalVotesParams{ + ProposalID: proposalID, + Page: page, + Limit: limit, + } +} + +// QueryDepositParams params for query 'custom/gov/deposit' +type QueryDepositParams struct { + ProposalID uint64 + Depositor sdk.AccAddress +} + +// NewQueryDepositParams creates a new instance of QueryDepositParams +func NewQueryDepositParams(proposalID uint64, depositor sdk.AccAddress) QueryDepositParams { + return QueryDepositParams{ + ProposalID: proposalID, + Depositor: depositor, + } +} + +// QueryVoteParams Params for query 'custom/gov/vote' +type QueryVoteParams struct { + ProposalID uint64 + Voter sdk.AccAddress +} + +// NewQueryVoteParams creates a new instance of QueryVoteParams +func NewQueryVoteParams(proposalID uint64, voter sdk.AccAddress) QueryVoteParams { + return QueryVoteParams{ + ProposalID: proposalID, + Voter: voter, + } +} + +// QueryProposalsParams Params for query 'custom/gov/proposals' +type QueryProposalsParams struct { + Page int + Limit int + Voter sdk.AccAddress + Depositor sdk.AccAddress + ProposalStatus ProposalStatus +} + +// NewQueryProposalsParams creates a new instance of QueryProposalsParams +func NewQueryProposalsParams(page, limit int, status ProposalStatus, voter, depositor sdk.AccAddress) QueryProposalsParams { + return QueryProposalsParams{ + Page: page, + Limit: limit, + Voter: voter, + Depositor: depositor, + ProposalStatus: status, + } +} diff --git a/x/gov/types/v1beta1/query.pb.go b/x/gov/types/v1beta1/query.pb.go new file mode 100644 index 000000000000..3d3ccae4bfad --- /dev/null +++ b/x/gov/types/v1beta1/query.pb.go @@ -0,0 +1,3862 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/gov/v1beta1/query.proto + +package v1beta1 + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// 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 + +// QueryProposalRequest is the request type for the Query/Proposal RPC method. +type QueryProposalRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` +} + +func (m *QueryProposalRequest) Reset() { *m = QueryProposalRequest{} } +func (m *QueryProposalRequest) String() string { return proto.CompactTextString(m) } +func (*QueryProposalRequest) ProtoMessage() {} +func (*QueryProposalRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{0} +} +func (m *QueryProposalRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProposalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProposalRequest.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 *QueryProposalRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProposalRequest.Merge(m, src) +} +func (m *QueryProposalRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryProposalRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProposalRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProposalRequest proto.InternalMessageInfo + +func (m *QueryProposalRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +// QueryProposalResponse is the response type for the Query/Proposal RPC method. +type QueryProposalResponse struct { + Proposal Proposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal"` +} + +func (m *QueryProposalResponse) Reset() { *m = QueryProposalResponse{} } +func (m *QueryProposalResponse) String() string { return proto.CompactTextString(m) } +func (*QueryProposalResponse) ProtoMessage() {} +func (*QueryProposalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{1} +} +func (m *QueryProposalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProposalResponse.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 *QueryProposalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProposalResponse.Merge(m, src) +} +func (m *QueryProposalResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryProposalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProposalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProposalResponse proto.InternalMessageInfo + +func (m *QueryProposalResponse) GetProposal() Proposal { + if m != nil { + return m.Proposal + } + return Proposal{} +} + +// QueryProposalsRequest is the request type for the Query/Proposals RPC method. +type QueryProposalsRequest struct { + // proposal_status defines the status of the proposals. + ProposalStatus ProposalStatus `protobuf:"varint,1,opt,name=proposal_status,json=proposalStatus,proto3,enum=cosmos.gov.v1beta1.ProposalStatus" json:"proposal_status,omitempty"` + // voter defines the voter address for the proposals. + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` + // depositor defines the deposit addresses from the proposals. + Depositor string `protobuf:"bytes,3,opt,name=depositor,proto3" json:"depositor,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,4,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryProposalsRequest) Reset() { *m = QueryProposalsRequest{} } +func (m *QueryProposalsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryProposalsRequest) ProtoMessage() {} +func (*QueryProposalsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{2} +} +func (m *QueryProposalsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProposalsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProposalsRequest.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 *QueryProposalsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProposalsRequest.Merge(m, src) +} +func (m *QueryProposalsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryProposalsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProposalsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProposalsRequest proto.InternalMessageInfo + +// QueryProposalsResponse is the response type for the Query/Proposals RPC +// method. +type QueryProposalsResponse struct { + Proposals []Proposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryProposalsResponse) Reset() { *m = QueryProposalsResponse{} } +func (m *QueryProposalsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryProposalsResponse) ProtoMessage() {} +func (*QueryProposalsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{3} +} +func (m *QueryProposalsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProposalsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProposalsResponse.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 *QueryProposalsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProposalsResponse.Merge(m, src) +} +func (m *QueryProposalsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryProposalsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProposalsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProposalsResponse proto.InternalMessageInfo + +func (m *QueryProposalsResponse) GetProposals() []Proposal { + if m != nil { + return m.Proposals + } + return nil +} + +func (m *QueryProposalsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryVoteRequest is the request type for the Query/Vote RPC method. +type QueryVoteRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // voter defines the oter address for the proposals. + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` +} + +func (m *QueryVoteRequest) Reset() { *m = QueryVoteRequest{} } +func (m *QueryVoteRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVoteRequest) ProtoMessage() {} +func (*QueryVoteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{4} +} +func (m *QueryVoteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVoteRequest.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 *QueryVoteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVoteRequest.Merge(m, src) +} +func (m *QueryVoteRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVoteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVoteRequest.DiscardUnknown(m) +} + +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"` +} + +func (m *QueryVoteResponse) Reset() { *m = QueryVoteResponse{} } +func (m *QueryVoteResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVoteResponse) ProtoMessage() {} +func (*QueryVoteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{5} +} +func (m *QueryVoteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVoteResponse.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 *QueryVoteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVoteResponse.Merge(m, src) +} +func (m *QueryVoteResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVoteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVoteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVoteResponse proto.InternalMessageInfo + +func (m *QueryVoteResponse) GetVote() Vote { + if m != nil { + return m.Vote + } + return Vote{} +} + +// QueryVotesRequest is the request type for the Query/Votes RPC method. +type QueryVotesRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryVotesRequest) Reset() { *m = QueryVotesRequest{} } +func (m *QueryVotesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVotesRequest) ProtoMessage() {} +func (*QueryVotesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{6} +} +func (m *QueryVotesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVotesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVotesRequest.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 *QueryVotesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVotesRequest.Merge(m, src) +} +func (m *QueryVotesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVotesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVotesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVotesRequest proto.InternalMessageInfo + +func (m *QueryVotesRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *QueryVotesRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// 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"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryVotesResponse) Reset() { *m = QueryVotesResponse{} } +func (m *QueryVotesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVotesResponse) ProtoMessage() {} +func (*QueryVotesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{7} +} +func (m *QueryVotesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVotesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVotesResponse.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 *QueryVotesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVotesResponse.Merge(m, src) +} +func (m *QueryVotesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVotesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVotesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVotesResponse proto.InternalMessageInfo + +func (m *QueryVotesResponse) GetVotes() []Vote { + if m != nil { + return m.Votes + } + return nil +} + +func (m *QueryVotesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +type QueryParamsRequest struct { + // params_type defines which parameters to query for, can be one of "voting", + // "tallying" or "deposit". + ParamsType string `protobuf:"bytes,1,opt,name=params_type,json=paramsType,proto3" json:"params_type,omitempty"` +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{8} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +func (m *QueryParamsRequest) GetParamsType() string { + if m != nil { + return m.ParamsType + } + return "" +} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // voting_params defines the parameters related to voting. + VotingParams VotingParams `protobuf:"bytes,1,opt,name=voting_params,json=votingParams,proto3" json:"voting_params"` + // deposit_params defines the parameters related to deposit. + DepositParams DepositParams `protobuf:"bytes,2,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params"` + // tally_params defines the parameters related to tally. + TallyParams TallyParams `protobuf:"bytes,3,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{9} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetVotingParams() VotingParams { + if m != nil { + return m.VotingParams + } + return VotingParams{} +} + +func (m *QueryParamsResponse) GetDepositParams() DepositParams { + if m != nil { + return m.DepositParams + } + return DepositParams{} +} + +func (m *QueryParamsResponse) GetTallyParams() TallyParams { + if m != nil { + return m.TallyParams + } + return TallyParams{} +} + +// QueryDepositRequest is the request type for the Query/Deposit RPC method. +type QueryDepositRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // depositor defines the deposit addresses from the proposals. + Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` +} + +func (m *QueryDepositRequest) Reset() { *m = QueryDepositRequest{} } +func (m *QueryDepositRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDepositRequest) ProtoMessage() {} +func (*QueryDepositRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{10} +} +func (m *QueryDepositRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDepositRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDepositRequest.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 *QueryDepositRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDepositRequest.Merge(m, src) +} +func (m *QueryDepositRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDepositRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDepositRequest.DiscardUnknown(m) +} + +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"` +} + +func (m *QueryDepositResponse) Reset() { *m = QueryDepositResponse{} } +func (m *QueryDepositResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDepositResponse) ProtoMessage() {} +func (*QueryDepositResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{11} +} +func (m *QueryDepositResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDepositResponse.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 *QueryDepositResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDepositResponse.Merge(m, src) +} +func (m *QueryDepositResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDepositResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDepositResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDepositResponse proto.InternalMessageInfo + +func (m *QueryDepositResponse) GetDeposit() Deposit { + if m != nil { + return m.Deposit + } + return Deposit{} +} + +// QueryDepositsRequest is the request type for the Query/Deposits RPC method. +type QueryDepositsRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDepositsRequest) Reset() { *m = QueryDepositsRequest{} } +func (m *QueryDepositsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDepositsRequest) ProtoMessage() {} +func (*QueryDepositsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{12} +} +func (m *QueryDepositsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDepositsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDepositsRequest.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 *QueryDepositsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDepositsRequest.Merge(m, src) +} +func (m *QueryDepositsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDepositsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDepositsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDepositsRequest proto.InternalMessageInfo + +func (m *QueryDepositsRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *QueryDepositsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// 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"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDepositsResponse) Reset() { *m = QueryDepositsResponse{} } +func (m *QueryDepositsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDepositsResponse) ProtoMessage() {} +func (*QueryDepositsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{13} +} +func (m *QueryDepositsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDepositsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDepositsResponse.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 *QueryDepositsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDepositsResponse.Merge(m, src) +} +func (m *QueryDepositsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDepositsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDepositsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDepositsResponse proto.InternalMessageInfo + +func (m *QueryDepositsResponse) GetDeposits() []Deposit { + if m != nil { + return m.Deposits + } + return nil +} + +func (m *QueryDepositsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryTallyResultRequest is the request type for the Query/Tally RPC method. +type QueryTallyResultRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` +} + +func (m *QueryTallyResultRequest) Reset() { *m = QueryTallyResultRequest{} } +func (m *QueryTallyResultRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTallyResultRequest) ProtoMessage() {} +func (*QueryTallyResultRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{14} +} +func (m *QueryTallyResultRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTallyResultRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTallyResultRequest.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 *QueryTallyResultRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTallyResultRequest.Merge(m, src) +} +func (m *QueryTallyResultRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTallyResultRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTallyResultRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTallyResultRequest proto.InternalMessageInfo + +func (m *QueryTallyResultRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +// QueryTallyResultResponse is the response type for the Query/Tally RPC method. +type QueryTallyResultResponse struct { + // tally defines the requested tally. + Tally TallyResult `protobuf:"bytes,1,opt,name=tally,proto3" json:"tally"` +} + +func (m *QueryTallyResultResponse) Reset() { *m = QueryTallyResultResponse{} } +func (m *QueryTallyResultResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTallyResultResponse) ProtoMessage() {} +func (*QueryTallyResultResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{15} +} +func (m *QueryTallyResultResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTallyResultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTallyResultResponse.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 *QueryTallyResultResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTallyResultResponse.Merge(m, src) +} +func (m *QueryTallyResultResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTallyResultResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTallyResultResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTallyResultResponse proto.InternalMessageInfo + +func (m *QueryTallyResultResponse) GetTally() TallyResult { + if m != nil { + return m.Tally + } + return TallyResult{} +} + +func init() { + proto.RegisterType((*QueryProposalRequest)(nil), "cosmos.gov.v1beta1.QueryProposalRequest") + proto.RegisterType((*QueryProposalResponse)(nil), "cosmos.gov.v1beta1.QueryProposalResponse") + proto.RegisterType((*QueryProposalsRequest)(nil), "cosmos.gov.v1beta1.QueryProposalsRequest") + proto.RegisterType((*QueryProposalsResponse)(nil), "cosmos.gov.v1beta1.QueryProposalsResponse") + proto.RegisterType((*QueryVoteRequest)(nil), "cosmos.gov.v1beta1.QueryVoteRequest") + proto.RegisterType((*QueryVoteResponse)(nil), "cosmos.gov.v1beta1.QueryVoteResponse") + proto.RegisterType((*QueryVotesRequest)(nil), "cosmos.gov.v1beta1.QueryVotesRequest") + proto.RegisterType((*QueryVotesResponse)(nil), "cosmos.gov.v1beta1.QueryVotesResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.gov.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.gov.v1beta1.QueryParamsResponse") + proto.RegisterType((*QueryDepositRequest)(nil), "cosmos.gov.v1beta1.QueryDepositRequest") + proto.RegisterType((*QueryDepositResponse)(nil), "cosmos.gov.v1beta1.QueryDepositResponse") + proto.RegisterType((*QueryDepositsRequest)(nil), "cosmos.gov.v1beta1.QueryDepositsRequest") + proto.RegisterType((*QueryDepositsResponse)(nil), "cosmos.gov.v1beta1.QueryDepositsResponse") + proto.RegisterType((*QueryTallyResultRequest)(nil), "cosmos.gov.v1beta1.QueryTallyResultRequest") + proto.RegisterType((*QueryTallyResultResponse)(nil), "cosmos.gov.v1beta1.QueryTallyResultResponse") +} + +func init() { proto.RegisterFile("cosmos/gov/v1beta1/query.proto", fileDescriptor_e35c0d133e91c0a2) } + +var fileDescriptor_e35c0d133e91c0a2 = []byte{ + // 997 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x41, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xb8, 0x4e, 0x6b, 0xbf, 0xb4, 0x01, 0x1e, 0x01, 0x8c, 0x29, 0x76, 0x58, 0xd1, 0xd6, + 0xa4, 0xc4, 0xdb, 0x24, 0xa5, 0xa8, 0x2d, 0xa0, 0x36, 0x42, 0x6d, 0xa1, 0x12, 0x2a, 0x4e, 0x05, + 0x12, 0x97, 0x68, 0x53, 0xaf, 0x96, 0x15, 0x8e, 0x67, 0xeb, 0x19, 0x5b, 0x8d, 0x42, 0x84, 0xc4, + 0x09, 0xc4, 0x05, 0x54, 0xc4, 0x0d, 0xa8, 0x54, 0x89, 0x5f, 0xc0, 0x8f, 0xe8, 0xb1, 0x02, 0x0e, + 0x9c, 0x10, 0x4a, 0x38, 0xf0, 0x23, 0x38, 0xa0, 0x9d, 0x79, 0xb3, 0xde, 0x4d, 0xd6, 0xd9, 0x75, + 0xa9, 0x38, 0xc5, 0x9e, 0xf9, 0xbe, 0xf7, 0xbe, 0xf7, 0xcd, 0x9b, 0x37, 0x0e, 0xd4, 0x6f, 0x71, + 0xb1, 0xc1, 0x85, 0xed, 0xf1, 0xa1, 0x3d, 0x5c, 0x5c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0xe0, 0x08, 0xdd, 0x70, 0x1c, 0x9f, 0x26, 0x39, 0x8c, 0x6b, 0xcd, 0x6c, 0x20, 0x09, 0xba, + 0xa6, 0x04, 0xad, 0xe0, 0xa5, 0x49, 0x7c, 0x32, 0x23, 0xc6, 0xde, 0x8a, 0xc6, 0xf4, 0x36, 0x7e, + 0xcf, 0xa0, 0x6c, 0x46, 0x18, 0x66, 0x0a, 0x10, 0xd9, 0xd7, 0x70, 0xef, 0x3c, 0xb4, 0xde, 0x50, + 0x5a, 0xcf, 0xe1, 0xd9, 0x47, 0xd1, 0x8a, 0xf7, 0x19, 0x4c, 0xc7, 0xa6, 0x09, 0x9e, 0x1e, 0x9b, + 0x78, 0xff, 0x9c, 0xab, 0xbd, 0x9a, 0x0f, 0xfc, 0x5f, 0x9a, 0x4f, 0x8d, 0xb5, 0x95, 0x77, 0x1f, + 0xec, 0xd4, 0xd9, 0xc3, 0x9d, 0x3a, 0xfb, 0x73, 0xa7, 0xce, 0xbe, 0xde, 0xad, 0x17, 0x1e, 0xee, + 0xd6, 0x0b, 0xbf, 0xef, 0xd6, 0x0b, 0x1f, 0x9d, 0xf1, 0x7c, 0xf9, 0xf1, 0x60, 0xbd, 0x75, 0x8b, + 0x6f, 0x98, 0xb0, 0xfa, 0xcf, 0x82, 0xe8, 0x7c, 0x62, 0xdf, 0x51, 0x39, 0xc2, 0x96, 0x11, 0x26, + 0xd3, 0xfa, 0x61, 0xf5, 0xbf, 0xd0, 0xf2, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe5, 0x69, 0xc4, + 0x93, 0xda, 0x0d, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Proposal queries proposal details based on ProposalID. + Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) + // Proposals queries all proposals based on given status. + Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) + // Vote queries voted information based on proposalID, voterAddr. + Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) + // Votes queries votes of a given proposal. + Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) + // Params queries all parameters of the gov module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Deposit queries single deposit information based proposalID, depositAddr. + Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) + // Deposits queries all deposits of a single proposal. + Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) + // TallyResult queries the tally of a proposal vote. + TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) { + out := new(QueryProposalResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Proposal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) { + out := new(QueryProposalsResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Proposals", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) { + out := new(QueryVoteResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Vote", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) { + out := new(QueryVotesResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Votes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) { + out := new(QueryDepositResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Deposit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) { + out := new(QueryDepositsResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Deposits", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) { + out := new(QueryTallyResultResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/TallyResult", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Proposal queries proposal details based on ProposalID. + Proposal(context.Context, *QueryProposalRequest) (*QueryProposalResponse, error) + // Proposals queries all proposals based on given status. + Proposals(context.Context, *QueryProposalsRequest) (*QueryProposalsResponse, error) + // Vote queries voted information based on proposalID, voterAddr. + Vote(context.Context, *QueryVoteRequest) (*QueryVoteResponse, error) + // Votes queries votes of a given proposal. + Votes(context.Context, *QueryVotesRequest) (*QueryVotesResponse, error) + // Params queries all parameters of the gov module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Deposit queries single deposit information based proposalID, depositAddr. + Deposit(context.Context, *QueryDepositRequest) (*QueryDepositResponse, error) + // Deposits queries all deposits of a single proposal. + Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error) + // TallyResult queries the tally of a proposal vote. + TallyResult(context.Context, *QueryTallyResultRequest) (*QueryTallyResultResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Proposal(ctx context.Context, req *QueryProposalRequest) (*QueryProposalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Proposal not implemented") +} +func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryProposalsRequest) (*QueryProposalsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Proposals not implemented") +} +func (*UnimplementedQueryServer) Vote(ctx context.Context, req *QueryVoteRequest) (*QueryVoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") +} +func (*UnimplementedQueryServer) Votes(ctx context.Context, req *QueryVotesRequest) (*QueryVotesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Votes not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Deposit(ctx context.Context, req *QueryDepositRequest) (*QueryDepositResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") +} +func (*UnimplementedQueryServer) Deposits(ctx context.Context, req *QueryDepositsRequest) (*QueryDepositsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deposits not implemented") +} +func (*UnimplementedQueryServer) TallyResult(ctx context.Context, req *QueryTallyResultRequest) (*QueryTallyResultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TallyResult not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Proposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProposalRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Proposal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/Proposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Proposal(ctx, req.(*QueryProposalRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Proposals_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProposalsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Proposals(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/Proposals", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Proposals(ctx, req.(*QueryProposalsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVoteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Vote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/Vote", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Vote(ctx, req.(*QueryVoteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Votes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVotesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Votes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/Votes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Votes(ctx, req.(*QueryVotesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDepositRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Deposit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/Deposit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Deposit(ctx, req.(*QueryDepositRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDepositsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Deposits(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/Deposits", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Deposits(ctx, req.(*QueryDepositsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TallyResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTallyResultRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TallyResult(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/TallyResult", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TallyResult(ctx, req.(*QueryTallyResultRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.gov.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Proposal", + Handler: _Query_Proposal_Handler, + }, + { + MethodName: "Proposals", + Handler: _Query_Proposals_Handler, + }, + { + MethodName: "Vote", + Handler: _Query_Vote_Handler, + }, + { + MethodName: "Votes", + Handler: _Query_Votes_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Deposit", + Handler: _Query_Deposit_Handler, + }, + { + MethodName: "Deposits", + Handler: _Query_Deposits_Handler, + }, + { + MethodName: "TallyResult", + Handler: _Query_TallyResult_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/gov/v1beta1/query.proto", +} + +func (m *QueryProposalRequest) 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 *QueryProposalRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryProposalResponse) 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 *QueryProposalResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryProposalsRequest) 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 *QueryProposalsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x1a + } + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalStatus != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalStatus)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryProposalsResponse) 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 *QueryProposalsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + 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 = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryVoteRequest) 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 *QueryVoteRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryVoteResponse) 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 *QueryVoteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryVotesRequest) 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 *QueryVotesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryVotesResponse) 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 *QueryVotesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + 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 = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ParamsType) > 0 { + i -= len(m.ParamsType) + copy(dAtA[i:], m.ParamsType) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ParamsType))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) 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 = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.VotingParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryDepositRequest) 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 *QueryDepositRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryDepositResponse) 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 *QueryDepositResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Deposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryDepositsRequest) 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 *QueryDepositsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDepositsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryDepositsResponse) 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 *QueryDepositsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDepositsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + 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 = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryTallyResultRequest) 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 *QueryTallyResultRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTallyResultRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryTallyResultResponse) 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 *QueryTallyResultResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTallyResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Tally.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryProposalRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + return n +} + +func (m *QueryProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Proposal.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryProposalsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalStatus != 0 { + n += 1 + sovQuery(uint64(m.ProposalStatus)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryProposalsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Proposals) > 0 { + for _, e := range m.Proposals { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVoteRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVoteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Vote.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryVotesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVotesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Votes) > 0 { + for _, e := range m.Votes { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ParamsType) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.VotingParams.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.DepositParams.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.TallyParams.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryDepositRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDepositResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Deposit.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryDepositsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDepositsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Deposits) > 0 { + for _, e := range m.Deposits { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTallyResultRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + return n +} + +func (m *QueryTallyResultResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Tally.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryProposalRequest) 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 ErrIntOverflowQuery + } + 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: QueryProposalRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalResponse) 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 ErrIntOverflowQuery + } + 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: QueryProposalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Proposal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalsRequest) 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 ErrIntOverflowQuery + } + 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: QueryProposalsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalStatus", wireType) + } + m.ProposalStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalStatus |= ProposalStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalsResponse) 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 ErrIntOverflowQuery + } + 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: QueryProposalsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + 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 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVoteRequest) 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 ErrIntOverflowQuery + } + 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: QueryVoteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVoteResponse) 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 ErrIntOverflowQuery + } + 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: QueryVoteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVoteResponse: 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Vote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVotesRequest) 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 ErrIntOverflowQuery + } + 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: QueryVotesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVotesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVotesResponse) 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 ErrIntOverflowQuery + } + 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: QueryVotesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVotesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + 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 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsRequest) 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 ErrIntOverflowQuery + } + 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParamsType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ParamsType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) 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 ErrIntOverflowQuery + } + 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DepositParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + 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 := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDepositRequest) 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 ErrIntOverflowQuery + } + 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: QueryDepositRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDepositResponse) 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 ErrIntOverflowQuery + } + 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: QueryDepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDepositResponse: 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDepositsRequest) 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 ErrIntOverflowQuery + } + 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: QueryDepositsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDepositsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDepositsResponse) 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 ErrIntOverflowQuery + } + 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: QueryDepositsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDepositsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + 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 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTallyResultRequest) 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 ErrIntOverflowQuery + } + 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: QueryTallyResultRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTallyResultRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTallyResultResponse) 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 ErrIntOverflowQuery + } + 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: QueryTallyResultResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTallyResultResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tally", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Tally.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/gov/types/v1beta1/query.pb.gw.go b/x/gov/types/v1beta1/query.pb.gw.go new file mode 100644 index 000000000000..f53f467d4a46 --- /dev/null +++ b/x/gov/types/v1beta1/query.pb.gw.go @@ -0,0 +1,932 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: cosmos/gov/v1beta1/query.proto + +/* +Package v1beta1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package v1beta1 + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage + +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 + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + msg, err := client.Proposal(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProposalRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + msg, err := server.Proposal(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Proposals_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Proposals_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProposalsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Proposals_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Proposals(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Proposals_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProposalsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Proposals_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Proposals(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Vote_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVoteRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + val, ok = pathParams["voter"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "voter") + } + + protoReq.Voter, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "voter", err) + } + + msg, err := client.Vote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Vote_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVoteRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + val, ok = pathParams["voter"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "voter") + } + + protoReq.Voter, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "voter", err) + } + + msg, err := server.Vote(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Votes_0 = &utilities.DoubleArray{Encoding: map[string]int{"proposal_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_Votes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVotesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Votes_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Votes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Votes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVotesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Votes_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Votes(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["params_type"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "params_type") + } + + protoReq.ParamsType, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "params_type", err) + } + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["params_type"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "params_type") + } + + protoReq.ParamsType, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "params_type", err) + } + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Deposit_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDepositRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + val, ok = pathParams["depositor"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "depositor") + } + + protoReq.Depositor, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "depositor", err) + } + + msg, err := client.Deposit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Deposit_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDepositRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + val, ok = pathParams["depositor"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "depositor") + } + + protoReq.Depositor, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "depositor", err) + } + + msg, err := server.Deposit(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Deposits_0 = &utilities.DoubleArray{Encoding: map[string]int{"proposal_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_Deposits_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDepositsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Deposits_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Deposits(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Deposits_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDepositsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Deposits_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Deposits(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_TallyResult_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTallyResultRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + msg, err := client.TallyResult(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TallyResult_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTallyResultRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + msg, err := server.TallyResult(ctx, &protoReq) + return msg, metadata, err + +} + +// 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 (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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Proposal_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Proposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Proposals_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Proposals_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Vote_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Vote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Votes_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Votes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Deposit_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Deposit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Deposits_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Deposits_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_TallyResult_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TallyResult_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Proposal_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Proposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Proposals_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Proposals_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Vote_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Vote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Votes_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Votes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Deposit_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Deposit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Deposits_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Deposits_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + 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() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_TallyResult_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TallyResult_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Proposal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "gov", "v1beta1", "proposals", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Proposals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "gov", "v1beta1", "proposals"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Vote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"cosmos", "gov", "v1beta1", "proposals", "proposal_id", "votes", "voter"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Votes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"cosmos", "gov", "v1beta1", "proposals", "proposal_id", "votes"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "gov", "v1beta1", "params", "params_type"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Deposit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"cosmos", "gov", "v1beta1", "proposals", "proposal_id", "deposits", "depositor"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Deposits_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"cosmos", "gov", "v1beta1", "proposals", "proposal_id", "deposits"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TallyResult_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"cosmos", "gov", "v1beta1", "proposals", "proposal_id", "tally"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Proposal_0 = runtime.ForwardResponseMessage + + forward_Query_Proposals_0 = runtime.ForwardResponseMessage + + forward_Query_Vote_0 = runtime.ForwardResponseMessage + + forward_Query_Votes_0 = runtime.ForwardResponseMessage + + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_Deposit_0 = runtime.ForwardResponseMessage + + forward_Query_Deposits_0 = runtime.ForwardResponseMessage + + forward_Query_TallyResult_0 = runtime.ForwardResponseMessage +) diff --git a/x/gov/types/router.go b/x/gov/types/v1beta1/router.go similarity index 99% rename from x/gov/types/router.go rename to x/gov/types/v1beta1/router.go index bc4d51251d56..41e7eaaacd13 100644 --- a/x/gov/types/router.go +++ b/x/gov/types/v1beta1/router.go @@ -1,4 +1,4 @@ -package types +package v1beta1 import ( "fmt" diff --git a/x/gov/types/v1beta1/tally.go b/x/gov/types/v1beta1/tally.go new file mode 100644 index 000000000000..c0f09a88ba0b --- /dev/null +++ b/x/gov/types/v1beta1/tally.go @@ -0,0 +1,68 @@ +package v1beta1 + +import ( + "sigs.k8s.io/yaml" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// ValidatorGovInfo used for tallying +type ValidatorGovInfo struct { + Address sdk.ValAddress // address of the validator operator + BondedTokens sdk.Int // Power of a Validator + DelegatorShares sdk.Dec // Total outstanding delegator shares + DelegatorDeductions sdk.Dec // Delegator deductions from validator's delegators voting independently + Vote WeightedVoteOptions // Vote of the validator +} + +// NewValidatorGovInfo creates a ValidatorGovInfo instance +func NewValidatorGovInfo(address sdk.ValAddress, bondedTokens sdk.Int, delegatorShares, + delegatorDeductions sdk.Dec, options WeightedVoteOptions) ValidatorGovInfo { + + return ValidatorGovInfo{ + Address: address, + BondedTokens: bondedTokens, + DelegatorShares: delegatorShares, + DelegatorDeductions: delegatorDeductions, + Vote: options, + } +} + +// NewTallyResult creates a new TallyResult instance +func NewTallyResult(yes, abstain, no, noWithVeto sdk.Int) TallyResult { + return TallyResult{ + Yes: yes, + Abstain: abstain, + No: no, + NoWithVeto: noWithVeto, + } +} + +// NewTallyResultFromMap creates a new TallyResult instance from a Option -> Dec map +func NewTallyResultFromMap(results map[VoteOption]sdk.Dec) TallyResult { + return NewTallyResult( + results[OptionYes].TruncateInt(), + results[OptionAbstain].TruncateInt(), + results[OptionNo].TruncateInt(), + results[OptionNoWithVeto].TruncateInt(), + ) +} + +// EmptyTallyResult returns an empty TallyResult. +func EmptyTallyResult() TallyResult { + return NewTallyResult(sdk.ZeroInt(), sdk.ZeroInt(), sdk.ZeroInt(), sdk.ZeroInt()) +} + +// Equals returns if two proposals are equal. +func (tr TallyResult) Equals(comp TallyResult) bool { + return tr.Yes.Equal(comp.Yes) && + tr.Abstain.Equal(comp.Abstain) && + tr.No.Equal(comp.No) && + tr.NoWithVeto.Equal(comp.NoWithVeto) +} + +// String implements stringer interface +func (tr TallyResult) String() string { + out, _ := yaml.Marshal(tr) + return string(out) +} diff --git a/x/gov/types/v1beta1/tx.pb.go b/x/gov/types/v1beta1/tx.pb.go new file mode 100644 index 000000000000..e10538a0f3d5 --- /dev/null +++ b/x/gov/types/v1beta1/tx.pb.go @@ -0,0 +1,1887 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/gov/v1beta1/tx.proto + +package v1beta1 + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "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" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// 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 + +// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary +// proposal Content. +type MsgSubmitProposal struct { + Content *types.Any `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` + InitialDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"initial_deposit"` + Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` +} + +func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } +func (*MsgSubmitProposal) ProtoMessage() {} +func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_3c053992595e3dce, []int{0} +} +func (m *MsgSubmitProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitProposal.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 *MsgSubmitProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitProposal.Merge(m, src) +} +func (m *MsgSubmitProposal) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitProposal) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitProposal proto.InternalMessageInfo + +// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. +type MsgSubmitProposalResponse struct { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id"` +} + +func (m *MsgSubmitProposalResponse) Reset() { *m = MsgSubmitProposalResponse{} } +func (m *MsgSubmitProposalResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitProposalResponse) ProtoMessage() {} +func (*MsgSubmitProposalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3c053992595e3dce, []int{1} +} +func (m *MsgSubmitProposalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitProposalResponse.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 *MsgSubmitProposalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitProposalResponse.Merge(m, src) +} +func (m *MsgSubmitProposalResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitProposalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitProposalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitProposalResponse proto.InternalMessageInfo + +func (m *MsgSubmitProposalResponse) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +// MsgVote defines a message to cast a vote. +type MsgVote struct { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id"` + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` + Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta1.VoteOption" json:"option,omitempty"` +} + +func (m *MsgVote) Reset() { *m = MsgVote{} } +func (*MsgVote) ProtoMessage() {} +func (*MsgVote) Descriptor() ([]byte, []int) { + return fileDescriptor_3c053992595e3dce, []int{2} +} +func (m *MsgVote) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgVote.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 *MsgVote) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgVote.Merge(m, src) +} +func (m *MsgVote) XXX_Size() int { + return m.Size() +} +func (m *MsgVote) XXX_DiscardUnknown() { + xxx_messageInfo_MsgVote.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgVote proto.InternalMessageInfo + +// MsgVoteResponse defines the Msg/Vote response type. +type MsgVoteResponse struct { +} + +func (m *MsgVoteResponse) Reset() { *m = MsgVoteResponse{} } +func (m *MsgVoteResponse) String() string { return proto.CompactTextString(m) } +func (*MsgVoteResponse) ProtoMessage() {} +func (*MsgVoteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3c053992595e3dce, []int{3} +} +func (m *MsgVoteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgVoteResponse.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 *MsgVoteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgVoteResponse.Merge(m, src) +} +func (m *MsgVoteResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgVoteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgVoteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgVoteResponse proto.InternalMessageInfo + +// MsgVoteWeighted defines a message to cast a vote. +// +// Since: cosmos-sdk 0.43 +type MsgVoteWeighted struct { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` + Options []WeightedVoteOption `protobuf:"bytes,3,rep,name=options,proto3" json:"options"` +} + +func (m *MsgVoteWeighted) Reset() { *m = MsgVoteWeighted{} } +func (*MsgVoteWeighted) ProtoMessage() {} +func (*MsgVoteWeighted) Descriptor() ([]byte, []int) { + return fileDescriptor_3c053992595e3dce, []int{4} +} +func (m *MsgVoteWeighted) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgVoteWeighted) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgVoteWeighted.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 *MsgVoteWeighted) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgVoteWeighted.Merge(m, src) +} +func (m *MsgVoteWeighted) XXX_Size() int { + return m.Size() +} +func (m *MsgVoteWeighted) XXX_DiscardUnknown() { + xxx_messageInfo_MsgVoteWeighted.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgVoteWeighted proto.InternalMessageInfo + +// MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. +// +// Since: cosmos-sdk 0.43 +type MsgVoteWeightedResponse struct { +} + +func (m *MsgVoteWeightedResponse) Reset() { *m = MsgVoteWeightedResponse{} } +func (m *MsgVoteWeightedResponse) String() string { return proto.CompactTextString(m) } +func (*MsgVoteWeightedResponse) ProtoMessage() {} +func (*MsgVoteWeightedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3c053992595e3dce, []int{5} +} +func (m *MsgVoteWeightedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgVoteWeightedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgVoteWeightedResponse.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 *MsgVoteWeightedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgVoteWeightedResponse.Merge(m, src) +} +func (m *MsgVoteWeightedResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgVoteWeightedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgVoteWeightedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgVoteWeightedResponse proto.InternalMessageInfo + +// MsgDeposit defines a message to submit a deposit to an existing proposal. +type MsgDeposit struct { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id"` + Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` +} + +func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } +func (*MsgDeposit) ProtoMessage() {} +func (*MsgDeposit) Descriptor() ([]byte, []int) { + return fileDescriptor_3c053992595e3dce, []int{6} +} +func (m *MsgDeposit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeposit.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 *MsgDeposit) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeposit.Merge(m, src) +} +func (m *MsgDeposit) XXX_Size() int { + return m.Size() +} +func (m *MsgDeposit) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeposit.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeposit proto.InternalMessageInfo + +// MsgDepositResponse defines the Msg/Deposit response type. +type MsgDepositResponse struct { +} + +func (m *MsgDepositResponse) Reset() { *m = MsgDepositResponse{} } +func (m *MsgDepositResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDepositResponse) ProtoMessage() {} +func (*MsgDepositResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3c053992595e3dce, []int{7} +} +func (m *MsgDepositResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDepositResponse.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 *MsgDepositResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDepositResponse.Merge(m, src) +} +func (m *MsgDepositResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDepositResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDepositResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDepositResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos.gov.v1beta1.MsgSubmitProposal") + proto.RegisterType((*MsgSubmitProposalResponse)(nil), "cosmos.gov.v1beta1.MsgSubmitProposalResponse") + proto.RegisterType((*MsgVote)(nil), "cosmos.gov.v1beta1.MsgVote") + proto.RegisterType((*MsgVoteResponse)(nil), "cosmos.gov.v1beta1.MsgVoteResponse") + proto.RegisterType((*MsgVoteWeighted)(nil), "cosmos.gov.v1beta1.MsgVoteWeighted") + proto.RegisterType((*MsgVoteWeightedResponse)(nil), "cosmos.gov.v1beta1.MsgVoteWeightedResponse") + proto.RegisterType((*MsgDeposit)(nil), "cosmos.gov.v1beta1.MsgDeposit") + proto.RegisterType((*MsgDepositResponse)(nil), "cosmos.gov.v1beta1.MsgDepositResponse") +} + +func init() { proto.RegisterFile("cosmos/gov/v1beta1/tx.proto", fileDescriptor_3c053992595e3dce) } + +var fileDescriptor_3c053992595e3dce = []byte{ + // 654 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x6f, 0xd3, 0x4e, + 0x10, 0xb5, 0x93, 0xfe, 0x9a, 0x5f, 0x27, 0xa8, 0xa5, 0x56, 0x24, 0x92, 0x14, 0xd9, 0x51, 0x10, + 0x55, 0x24, 0x14, 0xbb, 0x0d, 0xa8, 0x07, 0x38, 0x35, 0x45, 0x08, 0x90, 0x22, 0xc0, 0x95, 0x40, + 0xe2, 0x52, 0x92, 0x78, 0xbb, 0xb5, 0x68, 0x3c, 0x56, 0x76, 0x13, 0xb5, 0x37, 0x8e, 0x9c, 0x10, + 0x47, 0x8e, 0x3d, 0x73, 0x2e, 0x37, 0x3e, 0x40, 0xc5, 0xa9, 0xe2, 0xc4, 0x01, 0x15, 0xd4, 0x5e, + 0x10, 0x82, 0xef, 0x80, 0xec, 0xdd, 0x75, 0xa1, 0x75, 0xd3, 0xf2, 0xe7, 0x94, 0xec, 0xbe, 0xf7, + 0x66, 0xe6, 0xcd, 0xce, 0x7a, 0x61, 0xa6, 0x8b, 0xac, 0x87, 0xcc, 0xa1, 0x38, 0x74, 0x86, 0xf3, + 0x1d, 0xc2, 0xdb, 0xf3, 0x0e, 0xdf, 0xb0, 0xc3, 0x3e, 0x72, 0x34, 0x0c, 0x01, 0xda, 0x14, 0x87, + 0xb6, 0x04, 0xcb, 0xa6, 0x14, 0x74, 0xda, 0x8c, 0x24, 0x8a, 0x2e, 0xfa, 0x81, 0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x52, 0x8d, 0x2e, 0x8c, 0xb7, 0x7b, 0x38, 0x08, + 0xb8, 0x34, 0xfb, 0x4f, 0x6f, 0x88, 0x0c, 0x9d, 0xd2, 0x8a, 0x02, 0x18, 0x87, 0x76, 0x55, 0x17, + 0x1a, 0xdf, 0x32, 0x90, 0x6d, 0x31, 0x6a, 0xac, 0xc2, 0xe4, 0x91, 0xcf, 0xc1, 0xe5, 0xb4, 0x33, + 0x38, 0x76, 0x4b, 0xca, 0xf5, 0x33, 0xd1, 0x92, 0xcb, 0x74, 0x1b, 0xc6, 0xe2, 0x6b, 0x31, 0x73, + 0x82, 0x2c, 0x02, 0xcb, 0x97, 0x46, 0x80, 0x49, 0xa4, 0x27, 0x70, 0xee, 0x97, 0xa9, 0x1c, 0x25, + 0x52, 0xa4, 0xf2, 0x95, 0x33, 0x90, 0x92, 0x0c, 0x0f, 0x20, 0xa7, 0xa6, 0xc3, 0x3c, 0x41, 0x27, + 0xf1, 0xf2, 0xec, 0x68, 0x5c, 0x85, 0x6c, 0xde, 0xdd, 0xd9, 0x37, 0xf5, 0xdd, 0x7d, 0x53, 0xff, + 0xbc, 0x6f, 0xea, 0x2f, 0x0f, 0x4c, 0x6d, 0xf7, 0xc0, 0xd4, 0x3e, 0x1c, 0x98, 0xda, 0xe3, 0xb9, + 0x91, 0x47, 0xbc, 0x11, 0xbf, 0x0a, 0xf1, 0x41, 0xab, 0xb7, 0xa1, 0x33, 0x1e, 0x7f, 0x96, 0xaf, + 0xfe, 0x08, 0x00, 0x00, 0xff, 0xff, 0xde, 0x27, 0x9f, 0x48, 0x89, 0x06, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // SubmitProposal defines a method to create new proposal given a content. + SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) + // Vote defines a method to add a vote on a specific proposal. + Vote(ctx context.Context, in *MsgVote, opts ...grpc.CallOption) (*MsgVoteResponse, error) + // VoteWeighted defines a method to add a weighted vote on a specific proposal. + // + // Since: cosmos-sdk 0.43 + VoteWeighted(ctx context.Context, in *MsgVoteWeighted, opts ...grpc.CallOption) (*MsgVoteWeightedResponse, error) + // Deposit defines a method to add deposit on a specific proposal. + Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) { + out := new(MsgSubmitProposalResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Msg/SubmitProposal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Vote(ctx context.Context, in *MsgVote, opts ...grpc.CallOption) (*MsgVoteResponse, error) { + out := new(MsgVoteResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Msg/Vote", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) VoteWeighted(ctx context.Context, in *MsgVoteWeighted, opts ...grpc.CallOption) (*MsgVoteWeightedResponse, error) { + out := new(MsgVoteWeightedResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Msg/VoteWeighted", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) { + out := new(MsgDepositResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Msg/Deposit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // SubmitProposal defines a method to create new proposal given a content. + SubmitProposal(context.Context, *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) + // Vote defines a method to add a vote on a specific proposal. + Vote(context.Context, *MsgVote) (*MsgVoteResponse, error) + // VoteWeighted defines a method to add a weighted vote on a specific proposal. + // + // Since: cosmos-sdk 0.43 + VoteWeighted(context.Context, *MsgVoteWeighted) (*MsgVoteWeightedResponse, error) + // Deposit defines a method to add deposit on a specific proposal. + Deposit(context.Context, *MsgDeposit) (*MsgDepositResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) SubmitProposal(ctx context.Context, req *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitProposal not implemented") +} +func (*UnimplementedMsgServer) Vote(ctx context.Context, req *MsgVote) (*MsgVoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") +} +func (*UnimplementedMsgServer) VoteWeighted(ctx context.Context, req *MsgVoteWeighted) (*MsgVoteWeightedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method VoteWeighted not implemented") +} +func (*UnimplementedMsgServer) Deposit(ctx context.Context, req *MsgDeposit) (*MsgDepositResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_SubmitProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitProposal) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitProposal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Msg/SubmitProposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitProposal(ctx, req.(*MsgSubmitProposal)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgVote) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Vote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Msg/Vote", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Vote(ctx, req.(*MsgVote)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_VoteWeighted_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgVoteWeighted) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).VoteWeighted(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Msg/VoteWeighted", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).VoteWeighted(ctx, req.(*MsgVoteWeighted)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeposit) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Deposit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Msg/Deposit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Deposit(ctx, req.(*MsgDeposit)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.gov.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SubmitProposal", + Handler: _Msg_SubmitProposal_Handler, + }, + { + MethodName: "Vote", + Handler: _Msg_Vote_Handler, + }, + { + MethodName: "VoteWeighted", + Handler: _Msg_VoteWeighted_Handler, + }, + { + MethodName: "Deposit", + Handler: _Msg_Deposit_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/gov/v1beta1/tx.proto", +} + +func (m *MsgSubmitProposal) 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 *MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Proposer) > 0 { + i -= len(m.Proposer) + copy(dAtA[i:], m.Proposer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Proposer))) + i-- + dAtA[i] = 0x1a + } + if len(m.InitialDeposit) > 0 { + for iNdEx := len(m.InitialDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.InitialDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Content != nil { + { + size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitProposalResponse) 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 *MsgSubmitProposalResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProposalId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgVote) 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 *MsgVote) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Option != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Option)) + i-- + dAtA[i] = 0x18 + } + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintTx(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgVoteResponse) 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 *MsgVoteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgVoteWeighted) 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 *MsgVoteWeighted) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgVoteWeighted) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Options) > 0 { + for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintTx(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgVoteWeightedResponse) 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 *MsgVoteWeightedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgVoteWeightedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDeposit) 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 *MsgDeposit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintTx(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgDepositResponse) 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 *MsgDepositResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgSubmitProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovTx(uint64(l)) + } + if len(m.InitialDeposit) > 0 { + for _, e := range m.InitialDeposit { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Proposer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovTx(uint64(m.ProposalId)) + } + return n +} + +func (m *MsgVote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovTx(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Option != 0 { + n += 1 + sovTx(uint64(m.Option)) + } + return n +} + +func (m *MsgVoteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgVoteWeighted) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovTx(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Options) > 0 { + for _, e := range m.Options { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgVoteWeightedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDeposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovTx(uint64(m.ProposalId)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgDepositResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgSubmitProposal) 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 ErrIntOverflowTx + } + 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: MsgSubmitProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitProposal: 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Content == nil { + m.Content = &types.Any{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitialDeposit = append(m.InitialDeposit, types1.Coin{}) + if err := m.InitialDeposit[len(m.InitialDeposit)-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 Proposer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proposer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitProposalResponse) 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 ErrIntOverflowTx + } + 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: MsgSubmitProposalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgVote) 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 ErrIntOverflowTx + } + 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: MsgVote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) + } + m.Option = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Option |= VoteOption(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgVoteResponse) 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 ErrIntOverflowTx + } + 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: MsgVoteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgVoteWeighted) 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 ErrIntOverflowTx + } + 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: MsgVoteWeighted: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVoteWeighted: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = append(m.Options, WeightedVoteOption{}) + if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgVoteWeightedResponse) 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 ErrIntOverflowTx + } + 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: MsgVoteWeightedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVoteWeightedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDeposit) 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 ErrIntOverflowTx + } + 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: MsgDeposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types1.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDepositResponse) 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 ErrIntOverflowTx + } + 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: MsgDepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/gov/types/v1beta1/vote.go b/x/gov/types/v1beta1/vote.go new file mode 100644 index 000000000000..fcaee3556d34 --- /dev/null +++ b/x/gov/types/v1beta1/vote.go @@ -0,0 +1,149 @@ +package v1beta1 + +import ( + "fmt" + "strings" + + "sigs.k8s.io/yaml" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// NewVote creates a new Vote instance +//nolint:interfacer +func NewVote(proposalID uint64, voter sdk.AccAddress, options WeightedVoteOptions) Vote { + return Vote{ProposalId: proposalID, Voter: voter.String(), Options: options} +} + +// String returns the string representation of the vote +func (v Vote) String() string { + out, _ := yaml.Marshal(v) + return string(out) +} + +// Empty returns whether a vote is empty. +func (v Vote) Empty() bool { + return v.String() == Vote{}.String() +} + +// Votes is an array of vote +type Votes []Vote + +// Equal returns true if two slices (order-dependant) of votes are equal. +func (v Votes) Equal(other Votes) bool { + if len(v) != len(other) { + return false + } + + for i, vote := range v { + if vote.String() != other[i].String() { + return false + } + } + + return true +} + +func (v Votes) String() string { + if len(v) == 0 { + return "[]" + } + out := fmt.Sprintf("Votes for Proposal %d:", v[0].ProposalId) + for _, vot := range v { + out += fmt.Sprintf("\n %s: %s", vot.Voter, vot.Options) + } + return out +} + +// NewNonSplitVoteOption creates a single option vote with weight 1 +func NewNonSplitVoteOption(option VoteOption) WeightedVoteOptions { + return WeightedVoteOptions{{option, sdk.NewDec(1)}} +} + +func (v WeightedVoteOption) String() string { + out, _ := yaml.Marshal(v) + return string(out) +} + +// WeightedVoteOptions describes array of WeightedVoteOptions +type WeightedVoteOptions []WeightedVoteOption + +func (v WeightedVoteOptions) String() (out string) { + for _, opt := range v { + out += opt.String() + "\n" + } + + return strings.TrimSpace(out) +} + +// ValidWeightedVoteOption returns true if the sub vote is valid and false otherwise. +func ValidWeightedVoteOption(option WeightedVoteOption) bool { + if !option.Weight.IsPositive() || option.Weight.GT(sdk.NewDec(1)) { + return false + } + return ValidVoteOption(option.Option) +} + +// VoteOptionFromString returns a VoteOption from a string. It returns an error +// if the string is invalid. +func VoteOptionFromString(str string) (VoteOption, error) { + option, ok := VoteOption_value[str] + if !ok { + return OptionEmpty, fmt.Errorf("'%s' is not a valid vote option, available options: yes/no/no_with_veto/abstain", str) + } + return VoteOption(option), nil +} + +// WeightedVoteOptionsFromString returns weighted vote options from string. It returns an error +// if the string is invalid. +func WeightedVoteOptionsFromString(str string) (WeightedVoteOptions, error) { + options := WeightedVoteOptions{} + for _, option := range strings.Split(str, ",") { + fields := strings.Split(option, "=") + option, err := VoteOptionFromString(fields[0]) + if err != nil { + return options, err + } + if len(fields) < 2 { + return options, fmt.Errorf("weight field does not exist for %s option", fields[0]) + } + weight, err := sdk.NewDecFromStr(fields[1]) + if err != nil { + return options, err + } + options = append(options, WeightedVoteOption{option, weight}) + } + return options, nil +} + +// ValidVoteOption returns true if the vote option is valid and false otherwise. +func ValidVoteOption(option VoteOption) bool { + if option == OptionYes || + option == OptionAbstain || + option == OptionNo || + option == OptionNoWithVeto { + return true + } + return false +} + +// Marshal needed for protobuf compatibility. +func (vo VoteOption) Marshal() ([]byte, error) { + return []byte{byte(vo)}, nil +} + +// Unmarshal needed for protobuf compatibility. +func (vo *VoteOption) Unmarshal(data []byte) error { + *vo = VoteOption(data[0]) + return nil +} + +// Format implements the fmt.Formatter interface. +func (vo VoteOption) Format(s fmt.State, verb rune) { + switch verb { + case 's': + s.Write([]byte(vo.String())) + default: + s.Write([]byte(fmt.Sprintf("%v", byte(vo)))) + } +} diff --git a/x/gov/types/vote.go b/x/gov/types/vote.go index cfe448fc7925..d68eea8a4fc8 100644 --- a/x/gov/types/vote.go +++ b/x/gov/types/vote.go @@ -16,11 +16,17 @@ func NewVote(proposalID uint64, voter sdk.AccAddress, options WeightedVoteOption return Vote{ProposalId: proposalID, Voter: voter.String(), Options: options} } +// String returns a string representation of Vote func (v Vote) String() string { out, _ := yaml.Marshal(v) return string(out) } +// Empty returns whether a vote is empty. +func (v Vote) Empty() bool { + return v.String() == Vote{}.String() +} + // Votes is a collection of Vote objects type Votes []Vote @@ -50,11 +56,6 @@ func (v Votes) String() string { return out } -// Empty returns whether a vote is empty. -func (v Vote) Empty() bool { - return v.String() == Vote{}.String() -} - // NewNonSplitVoteOption creates a single option vote with weight 1 func NewNonSplitVoteOption(option VoteOption) WeightedVoteOptions { return WeightedVoteOptions{{option, sdk.NewDec(1)}} diff --git a/x/params/client/cli/tx.go b/x/params/client/cli/tx.go index 9c263a2c2b27..0189b969d28f 100644 --- a/x/params/client/cli/tx.go +++ b/x/params/client/cli/tx.go @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" paramscutils "github.com/cosmos/cosmos-sdk/x/params/client/utils" paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" ) diff --git a/x/params/proposal_handler.go b/x/params/proposal_handler.go index 173cc292df49..a5c0166e4358 100644 --- a/x/params/proposal_handler.go +++ b/x/params/proposal_handler.go @@ -5,7 +5,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/v1beta1" "github.com/cosmos/cosmos-sdk/x/params/keeper" "github.com/cosmos/cosmos-sdk/x/params/types/proposal" ) diff --git a/x/params/proposal_handler_test.go b/x/params/proposal_handler_test.go index 39f72fb6d603..572e1adfd86f 100644 --- a/x/params/proposal_handler_test.go +++ b/x/params/proposal_handler_test.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/params" "github.com/cosmos/cosmos-sdk/x/params/types/proposal" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" diff --git a/x/params/types/proposal/codec.go b/x/params/types/proposal/codec.go index d638caccaf65..028c0686e3eb 100644 --- a/x/params/types/proposal/codec.go +++ b/x/params/types/proposal/codec.go @@ -3,7 +3,7 @@ package proposal import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // RegisterLegacyAminoCodec registers all necessary param module types with a given LegacyAmino codec. diff --git a/x/params/types/proposal/proposal.go b/x/params/types/proposal/proposal.go index e1d4ac0d175f..f25ab0ed0b1b 100644 --- a/x/params/types/proposal/proposal.go +++ b/x/params/types/proposal/proposal.go @@ -6,7 +6,7 @@ import ( "sigs.k8s.io/yaml" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) const ( diff --git a/x/upgrade/abci_test.go b/x/upgrade/abci_test.go index 16206447ac53..915f5c36cafe 100644 --- a/x/upgrade/abci_test.go +++ b/x/upgrade/abci_test.go @@ -17,7 +17,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/module" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/upgrade" "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" "github.com/cosmos/cosmos-sdk/x/upgrade/types" diff --git a/x/upgrade/client/cli/tx.go b/x/upgrade/client/cli/tx.go index fbeeb3d9ee5b..aaafe83b82dc 100644 --- a/x/upgrade/client/cli/tx.go +++ b/x/upgrade/client/cli/tx.go @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - gov "github.com/cosmos/cosmos-sdk/x/gov/types" + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/upgrade/plan" "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) diff --git a/x/upgrade/handler.go b/x/upgrade/handler.go index 413217dc7206..355952ff1e21 100644 --- a/x/upgrade/handler.go +++ b/x/upgrade/handler.go @@ -3,7 +3,7 @@ package upgrade 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/v1beta1" "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) diff --git a/x/upgrade/types/codec.go b/x/upgrade/types/codec.go index 59703f57a8f9..5ef751d16f3f 100644 --- a/x/upgrade/types/codec.go +++ b/x/upgrade/types/codec.go @@ -3,7 +3,7 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec diff --git a/x/upgrade/types/proposal.go b/x/upgrade/types/proposal.go index 38b2295556de..1729139f79c5 100644 --- a/x/upgrade/types/proposal.go +++ b/x/upgrade/types/proposal.go @@ -3,7 +3,7 @@ package types import ( "fmt" - gov "github.com/cosmos/cosmos-sdk/x/gov/types" + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) const ( diff --git a/x/upgrade/types/proposal_test.go b/x/upgrade/types/proposal_test.go index 716e201091bd..7f56c6beaac9 100644 --- a/x/upgrade/types/proposal_test.go +++ b/x/upgrade/types/proposal_test.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - gov "github.com/cosmos/cosmos-sdk/x/gov/types" + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) From 75840489dcaa55ce974468da4dde5fbbb9b732ef Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 13 Dec 2021 10:25:23 +0100 Subject: [PATCH 02/12] fix tests --- simapp/app.go | 2 +- x/gov/client/cli/query.go | 65 ++++++++++++----------- x/gov/client/testutil/grpc.go | 60 ++++++++++----------- x/gov/client/utils/query.go | 91 ++++++++++++++++---------------- x/gov/client/utils/query_test.go | 36 ++++++------- x/gov/genesis.go | 2 +- x/gov/simulation/decoder.go | 9 ++-- x/gov/types/errors.go | 2 +- 8 files changed, 135 insertions(+), 132 deletions(-) diff --git a/simapp/app.go b/simapp/app.go index a30120528f33..62bf27771c9a 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -616,7 +616,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(minttypes.ModuleName) paramsKeeper.Subspace(distrtypes.ModuleName) paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable()) + paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(oldgovtypes.ParamKeyTable()) paramsKeeper.Subspace(crisistypes.ModuleName) return paramsKeeper diff --git a/x/gov/client/cli/query.go b/x/gov/client/cli/query.go index 7c9ac93b76f6..d9b059d0ac69 100644 --- a/x/gov/client/cli/query.go +++ b/x/gov/client/cli/query.go @@ -12,6 +12,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" gcutils "github.com/cosmos/cosmos-sdk/x/gov/client/utils" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/gov/types" ) @@ -63,7 +64,7 @@ $ %s query gov proposal 1 if err != nil { return err } - queryClient := types.NewQueryClient(clientCtx) + queryClient := v1beta1.NewQueryClient(clientCtx) // validate that the proposal id is a uint proposalID, err := strconv.ParseUint(args[0], 10, 64) @@ -74,7 +75,7 @@ $ %s query gov proposal 1 // Query the proposal res, err := queryClient.Proposal( cmd.Context(), - &types.QueryProposalRequest{ProposalId: proposalID}, + &v1beta1.QueryProposalRequest{ProposalId: proposalID}, ) if err != nil { return err @@ -112,7 +113,7 @@ $ %s query gov proposals --page=2 --limit=100 bechVoterAddr, _ := cmd.Flags().GetString(flagVoter) strProposalStatus, _ := cmd.Flags().GetString(flagStatus) - var proposalStatus types.ProposalStatus + var proposalStatus v1beta1.ProposalStatus if len(bechDepositorAddr) != 0 { _, err := sdk.AccAddressFromBech32(bechDepositorAddr) @@ -129,7 +130,7 @@ $ %s query gov proposals --page=2 --limit=100 } if len(strProposalStatus) != 0 { - proposalStatus1, err := types.ProposalStatusFromString(gcutils.NormalizeProposalStatus(strProposalStatus)) + proposalStatus1, err := v1beta1.ProposalStatusFromString(gcutils.NormalizeProposalStatus(strProposalStatus)) proposalStatus = proposalStatus1 if err != nil { return err @@ -140,7 +141,7 @@ $ %s query gov proposals --page=2 --limit=100 if err != nil { return err } - queryClient := types.NewQueryClient(clientCtx) + queryClient := v1beta1.NewQueryClient(clientCtx) pageReq, err := client.ReadPageRequest(cmd.Flags()) if err != nil { @@ -149,7 +150,7 @@ $ %s query gov proposals --page=2 --limit=100 res, err := queryClient.Proposals( cmd.Context(), - &types.QueryProposalsRequest{ + &v1beta1.QueryProposalsRequest{ ProposalStatus: proposalStatus, Voter: bechVoterAddr, Depositor: bechDepositorAddr, @@ -198,7 +199,7 @@ $ %s query gov vote 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk if err != nil { return err } - queryClient := types.NewQueryClient(clientCtx) + queryClient := v1beta1.NewQueryClient(clientCtx) // validate that the proposal id is a uint proposalID, err := strconv.ParseUint(args[0], 10, 64) @@ -210,7 +211,7 @@ $ %s query gov vote 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk ctx := cmd.Context() _, err = queryClient.Proposal( ctx, - &types.QueryProposalRequest{ProposalId: proposalID}, + &v1beta1.QueryProposalRequest{ProposalId: proposalID}, ) if err != nil { return fmt.Errorf("failed to fetch proposal-id %d: %s", proposalID, err) @@ -223,7 +224,7 @@ $ %s query gov vote 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk res, err := queryClient.Vote( ctx, - &types.QueryVoteRequest{ProposalId: proposalID, Voter: args[1]}, + &v1beta1.QueryVoteRequest{ProposalId: proposalID, Voter: args[1]}, ) if err != nil { return err @@ -231,7 +232,7 @@ $ %s query gov vote 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk vote := res.GetVote() if vote.Empty() { - params := types.NewQueryVoteParams(proposalID, voterAddr) + params := v1beta1.NewQueryVoteParams(proposalID, voterAddr) resByTxQuery, err := gcutils.QueryVoteByTxQuery(clientCtx, params) if err != nil { @@ -273,7 +274,7 @@ $ %[1]s query gov votes 1 --page=2 --limit=100 if err != nil { return err } - queryClient := types.NewQueryClient(clientCtx) + queryClient := v1beta1.NewQueryClient(clientCtx) // validate that the proposal id is a uint proposalID, err := strconv.ParseUint(args[0], 10, 64) @@ -285,24 +286,24 @@ $ %[1]s query gov votes 1 --page=2 --limit=100 ctx := cmd.Context() proposalRes, err := queryClient.Proposal( ctx, - &types.QueryProposalRequest{ProposalId: proposalID}, + &v1beta1.QueryProposalRequest{ProposalId: proposalID}, ) if err != nil { return fmt.Errorf("failed to fetch proposal-id %d: %s", proposalID, err) } propStatus := proposalRes.GetProposal().Status - if !(propStatus == types.StatusVotingPeriod || propStatus == types.StatusDepositPeriod) { + if !(propStatus == v1beta1.StatusVotingPeriod || propStatus == v1beta1.StatusDepositPeriod) { page, _ := cmd.Flags().GetInt(flags.FlagPage) limit, _ := cmd.Flags().GetInt(flags.FlagLimit) - params := types.NewQueryProposalVotesParams(proposalID, page, limit) + params := v1beta1.NewQueryProposalVotesParams(proposalID, page, limit) resByTxQuery, err := gcutils.QueryVotesByTxQuery(clientCtx, params) if err != nil { return err } - var votes types.Votes + var votes v1beta1.Votes // TODO migrate to use JSONCodec (implement MarshalJSONArray // or wrap lists of proto.Message in some other message) clientCtx.LegacyAmino.MustUnmarshalJSON(resByTxQuery, &votes) @@ -317,7 +318,7 @@ $ %[1]s query gov votes 1 --page=2 --limit=100 res, err := queryClient.Votes( ctx, - &types.QueryVotesRequest{ProposalId: proposalID, Pagination: pageReq}, + &v1beta1.QueryVotesRequest{ProposalId: proposalID, Pagination: pageReq}, ) if err != nil { @@ -356,7 +357,7 @@ $ %s query gov deposit 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk if err != nil { return err } - queryClient := types.NewQueryClient(clientCtx) + queryClient := v1beta1.NewQueryClient(clientCtx) // validate that the proposal id is a uint proposalID, err := strconv.ParseUint(args[0], 10, 64) @@ -368,7 +369,7 @@ $ %s query gov deposit 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk ctx := cmd.Context() _, err = queryClient.Proposal( ctx, - &types.QueryProposalRequest{ProposalId: proposalID}, + &v1beta1.QueryProposalRequest{ProposalId: proposalID}, ) if err != nil { return fmt.Errorf("failed to fetch proposal-id %d: %s", proposalID, err) @@ -376,7 +377,7 @@ $ %s query gov deposit 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk res, err := queryClient.Deposit( ctx, - &types.QueryDepositRequest{ProposalId: proposalID, Depositor: args[1]}, + &v1beta1.QueryDepositRequest{ProposalId: proposalID, Depositor: args[1]}, ) if err != nil { return err @@ -412,7 +413,7 @@ $ %s query gov deposits 1 if err != nil { return err } - queryClient := types.NewQueryClient(clientCtx) + queryClient := v1beta1.NewQueryClient(clientCtx) // validate that the proposal id is a uint proposalID, err := strconv.ParseUint(args[0], 10, 64) @@ -424,7 +425,7 @@ $ %s query gov deposits 1 ctx := cmd.Context() _, err = queryClient.Proposal( ctx, - &types.QueryProposalRequest{ProposalId: proposalID}, + &v1beta1.QueryProposalRequest{ProposalId: proposalID}, ) if err != nil { return fmt.Errorf("failed to fetch proposal-id %d: %s", proposalID, err) @@ -437,7 +438,7 @@ $ %s query gov deposits 1 res, err := queryClient.Deposits( ctx, - &types.QueryDepositsRequest{ProposalId: proposalID, Pagination: pageReq}, + &v1beta1.QueryDepositsRequest{ProposalId: proposalID, Pagination: pageReq}, ) if err != nil { @@ -475,7 +476,7 @@ $ %s query gov tally 1 if err != nil { return err } - queryClient := types.NewQueryClient(clientCtx) + queryClient := v1beta1.NewQueryClient(clientCtx) // validate that the proposal id is a uint proposalID, err := strconv.ParseUint(args[0], 10, 64) @@ -487,7 +488,7 @@ $ %s query gov tally 1 ctx := cmd.Context() _, err = queryClient.Proposal( ctx, - &types.QueryProposalRequest{ProposalId: proposalID}, + &v1beta1.QueryProposalRequest{ProposalId: proposalID}, ) if err != nil { return fmt.Errorf("failed to fetch proposal-id %d: %s", proposalID, err) @@ -496,7 +497,7 @@ $ %s query gov tally 1 // Query store res, err := queryClient.TallyResult( ctx, - &types.QueryTallyResultRequest{ProposalId: proposalID}, + &v1beta1.QueryTallyResultRequest{ProposalId: proposalID}, ) if err != nil { return err @@ -531,13 +532,13 @@ $ %s query gov params if err != nil { return err } - queryClient := types.NewQueryClient(clientCtx) + queryClient := v1beta1.NewQueryClient(clientCtx) // Query store for all 3 params ctx := cmd.Context() votingRes, err := queryClient.Params( ctx, - &types.QueryParamsRequest{ParamsType: "voting"}, + &v1beta1.QueryParamsRequest{ParamsType: "voting"}, ) if err != nil { return err @@ -545,7 +546,7 @@ $ %s query gov params tallyRes, err := queryClient.Params( ctx, - &types.QueryParamsRequest{ParamsType: "tallying"}, + &v1beta1.QueryParamsRequest{ParamsType: "tallying"}, ) if err != nil { return err @@ -553,13 +554,13 @@ $ %s query gov params depositRes, err := queryClient.Params( ctx, - &types.QueryParamsRequest{ParamsType: "deposit"}, + &v1beta1.QueryParamsRequest{ParamsType: "deposit"}, ) if err != nil { return err } - params := types.NewParams( + params := v1beta1.NewParams( votingRes.GetVotingParams(), tallyRes.GetTallyParams(), depositRes.GetDepositParams(), @@ -596,12 +597,12 @@ $ %s query gov param deposit if err != nil { return err } - queryClient := types.NewQueryClient(clientCtx) + queryClient := v1beta1.NewQueryClient(clientCtx) // Query store res, err := queryClient.Params( cmd.Context(), - &types.QueryParamsRequest{ParamsType: args[0]}, + &v1beta1.QueryParamsRequest{ParamsType: args[0]}, ) if err != nil { return err diff --git a/x/gov/client/testutil/grpc.go b/x/gov/client/testutil/grpc.go index 3b5312f3f3cd..83cb2828b6c7 100644 --- a/x/gov/client/testutil/grpc.go +++ b/x/gov/client/testutil/grpc.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/rest" sdk "github.com/cosmos/cosmos-sdk/types" grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) func (s *IntegrationTestSuite) TestGetProposalGRPC() { @@ -43,7 +43,7 @@ func (s *IntegrationTestSuite) TestGetProposalGRPC() { resp, err := rest.GetRequest(tc.url) s.Require().NoError(err) - var proposal types.QueryProposalResponse + var proposal v1beta1.QueryProposalResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &proposal) if tc.expErr { @@ -97,7 +97,7 @@ func (s *IntegrationTestSuite) TestGetProposalsGRPC() { resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) s.Require().NoError(err) - var proposals types.QueryProposalsResponse + var proposals v1beta1.QueryProposalsResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &proposals) if tc.expErr { @@ -119,41 +119,41 @@ func (s *IntegrationTestSuite) TestGetProposalVoteGRPC() { name string url string expErr bool - expVoteOptions types.WeightedVoteOptions + expVoteOptions v1beta1.WeightedVoteOptions }{ { "empty proposal", fmt.Sprintf("%s/cosmos/gov/v1beta1/proposals/%s/votes/%s", val.APIAddress, "", voterAddressBech32), true, - types.NewNonSplitVoteOption(types.OptionYes), + v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes), }, { "get non existing proposal", fmt.Sprintf("%s/cosmos/gov/v1beta1/proposals/%s/votes/%s", val.APIAddress, "10", voterAddressBech32), true, - types.NewNonSplitVoteOption(types.OptionYes), + v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes), }, { "get proposal with wrong voter address", fmt.Sprintf("%s/cosmos/gov/v1beta1/proposals/%s/votes/%s", val.APIAddress, "1", "wrongVoterAddress"), true, - types.NewNonSplitVoteOption(types.OptionYes), + v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes), }, { "get proposal with id", fmt.Sprintf("%s/cosmos/gov/v1beta1/proposals/%s/votes/%s", val.APIAddress, "1", voterAddressBech32), false, - types.NewNonSplitVoteOption(types.OptionYes), + v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes), }, { "get proposal with id for split vote", fmt.Sprintf("%s/cosmos/gov/v1beta1/proposals/%s/votes/%s", val.APIAddress, "3", voterAddressBech32), false, - types.WeightedVoteOptions{ - types.WeightedVoteOption{Option: types.OptionYes, Weight: sdk.NewDecWithPrec(60, 2)}, - types.WeightedVoteOption{Option: types.OptionNo, Weight: sdk.NewDecWithPrec(30, 2)}, - types.WeightedVoteOption{Option: types.OptionAbstain, Weight: sdk.NewDecWithPrec(5, 2)}, - types.WeightedVoteOption{Option: types.OptionNoWithVeto, Weight: sdk.NewDecWithPrec(5, 2)}, + v1beta1.WeightedVoteOptions{ + v1beta1.WeightedVoteOption{Option: v1beta1.OptionYes, Weight: sdk.NewDecWithPrec(60, 2)}, + v1beta1.WeightedVoteOption{Option: v1beta1.OptionNo, Weight: sdk.NewDecWithPrec(30, 2)}, + v1beta1.WeightedVoteOption{Option: v1beta1.OptionAbstain, Weight: sdk.NewDecWithPrec(5, 2)}, + v1beta1.WeightedVoteOption{Option: v1beta1.OptionNoWithVeto, Weight: sdk.NewDecWithPrec(5, 2)}, }, }, } @@ -164,7 +164,7 @@ func (s *IntegrationTestSuite) TestGetProposalVoteGRPC() { resp, err := rest.GetRequest(tc.url) s.Require().NoError(err) - var vote types.QueryVoteResponse + var vote v1beta1.QueryVoteResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &vote) if tc.expErr { @@ -208,7 +208,7 @@ func (s *IntegrationTestSuite) TestGetProposalVotesGRPC() { resp, err := rest.GetRequest(tc.url) s.Require().NoError(err) - var votes types.QueryVotesResponse + var votes v1beta1.QueryVotesResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &votes) if tc.expErr { @@ -257,7 +257,7 @@ func (s *IntegrationTestSuite) TestGetProposalDepositGRPC() { resp, err := rest.GetRequest(tc.url) s.Require().NoError(err) - var deposit types.QueryDepositResponse + var deposit v1beta1.QueryDepositResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &deposit) if tc.expErr { @@ -296,7 +296,7 @@ func (s *IntegrationTestSuite) TestGetProposalDepositsGRPC() { resp, err := rest.GetRequest(tc.url) s.Require().NoError(err) - var deposits types.QueryDepositsResponse + var deposits v1beta1.QueryDepositsResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &deposits) if tc.expErr { @@ -341,7 +341,7 @@ func (s *IntegrationTestSuite) TestGetTallyGRPC() { resp, err := rest.GetRequest(tc.url) s.Require().NoError(err) - var tally types.QueryTallyResultResponse + var tally v1beta1.QueryTallyResultResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &tally) if tc.expErr { @@ -371,29 +371,29 @@ func (s *IntegrationTestSuite) TestGetParamsGRPC() { }, { "get deposit params", - fmt.Sprintf("%s/cosmos/gov/v1beta1/params/%s", val.APIAddress, types.ParamDeposit), + fmt.Sprintf("%s/cosmos/gov/v1beta1/params/%s", val.APIAddress, v1beta1.ParamDeposit), false, - &types.QueryParamsResponse{}, - &types.QueryParamsResponse{ - DepositParams: types.DefaultDepositParams(), + &v1beta1.QueryParamsResponse{}, + &v1beta1.QueryParamsResponse{ + DepositParams: v1beta1.DefaultDepositParams(), }, }, { "get vote params", - fmt.Sprintf("%s/cosmos/gov/v1beta1/params/%s", val.APIAddress, types.ParamVoting), + fmt.Sprintf("%s/cosmos/gov/v1beta1/params/%s", val.APIAddress, v1beta1.ParamVoting), false, - &types.QueryParamsResponse{}, - &types.QueryParamsResponse{ - VotingParams: types.DefaultVotingParams(), + &v1beta1.QueryParamsResponse{}, + &v1beta1.QueryParamsResponse{ + VotingParams: v1beta1.DefaultVotingParams(), }, }, { "get tally params", - fmt.Sprintf("%s/cosmos/gov/v1beta1/params/%s", val.APIAddress, types.ParamTallying), + fmt.Sprintf("%s/cosmos/gov/v1beta1/params/%s", val.APIAddress, v1beta1.ParamTallying), false, - &types.QueryParamsResponse{}, - &types.QueryParamsResponse{ - TallyParams: types.DefaultTallyParams(), + &v1beta1.QueryParamsResponse{}, + &v1beta1.QueryParamsResponse{ + TallyParams: v1beta1.DefaultTallyParams(), }, }, } diff --git a/x/gov/client/utils/query.go b/x/gov/client/utils/query.go index f773c49c7b60..c5f7a8b28f64 100644 --- a/x/gov/client/utils/query.go +++ b/x/gov/client/utils/query.go @@ -8,6 +8,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) const ( @@ -37,8 +38,8 @@ func (p Proposer) String() string { // // NOTE: SearchTxs is used to facilitate the txs query which does not currently // support configurable pagination. -func QueryDepositsByTxQuery(clientCtx client.Context, params types.QueryProposalParams) ([]byte, error) { - var deposits []types.Deposit +func QueryDepositsByTxQuery(clientCtx client.Context, params v1beta1.QueryProposalParams) ([]byte, error) { + var deposits []v1beta1.Deposit // initial deposit was submitted with proposal, so must be queried separately initialDeposit, err := queryInitialDepositByTxQuery(clientCtx, params.ProposalID) @@ -54,12 +55,12 @@ func QueryDepositsByTxQuery(clientCtx client.Context, params types.QueryProposal clientCtx, defaultPage, // Query legacy Msgs event action []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, types.TypeMsgDeposit), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgDeposit), fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalDeposit, types.AttributeKeyProposalID, params.ProposalID), }, // Query proto Msgs event action []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&types.MsgDeposit{})), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&v1beta1.MsgDeposit{})), fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalDeposit, types.AttributeKeyProposalID, params.ProposalID), }, ) @@ -69,8 +70,8 @@ func QueryDepositsByTxQuery(clientCtx client.Context, params types.QueryProposal for _, info := range searchResult.Txs { for _, msg := range info.GetTx().GetMsgs() { - if depMsg, ok := msg.(*types.MsgDeposit); ok { - deposits = append(deposits, types.Deposit{ + if depMsg, ok := msg.(*v1beta1.MsgDeposit); ok { + deposits = append(deposits, v1beta1.Deposit{ Depositor: depMsg.Depositor, ProposalId: params.ProposalID, Amount: depMsg.Amount, @@ -90,9 +91,9 @@ func QueryDepositsByTxQuery(clientCtx client.Context, params types.QueryProposal // QueryVotesByTxQuery will query for votes via a direct txs tags query. It // will fetch and build votes directly from the returned txs and return a JSON // marshalled result or any error that occurred. -func QueryVotesByTxQuery(clientCtx client.Context, params types.QueryProposalVotesParams) ([]byte, error) { +func QueryVotesByTxQuery(clientCtx client.Context, params v1beta1.QueryProposalVotesParams) ([]byte, error) { var ( - votes []types.Vote + votes []v1beta1.Vote nextTxPage = defaultPage totalLimit = params.Limit * params.Page ) @@ -104,22 +105,22 @@ func QueryVotesByTxQuery(clientCtx client.Context, params types.QueryProposalVot clientCtx, nextTxPage, // Query legacy Vote Msgs []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, types.TypeMsgVote), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgVote), fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalVote, types.AttributeKeyProposalID, params.ProposalID), }, // Query Vote proto Msgs []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&types.MsgVote{})), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&v1beta1.MsgVote{})), fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalVote, types.AttributeKeyProposalID, params.ProposalID), }, // Query legacy VoteWeighted Msgs []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, types.TypeMsgVoteWeighted), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgVoteWeighted), fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalVote, types.AttributeKeyProposalID, params.ProposalID), }, // Query VoteWeighted proto Msgs []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&types.MsgVoteWeighted{})), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&v1beta1.MsgVoteWeighted{})), fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalVote, types.AttributeKeyProposalID, params.ProposalID), }, ) @@ -129,16 +130,16 @@ func QueryVotesByTxQuery(clientCtx client.Context, params types.QueryProposalVot for _, info := range searchResult.Txs { for _, msg := range info.GetTx().GetMsgs() { - if voteMsg, ok := msg.(*types.MsgVote); ok { - votes = append(votes, types.Vote{ + if voteMsg, ok := msg.(*v1beta1.MsgVote); ok { + votes = append(votes, v1beta1.Vote{ Voter: voteMsg.Voter, ProposalId: params.ProposalID, - Options: types.NewNonSplitVoteOption(voteMsg.Option), + Options: v1beta1.NewNonSplitVoteOption(voteMsg.Option), }) } - if voteWeightedMsg, ok := msg.(*types.MsgVoteWeighted); ok { - votes = append(votes, types.Vote{ + if voteWeightedMsg, ok := msg.(*v1beta1.MsgVoteWeighted); ok { + votes = append(votes, v1beta1.Vote{ Voter: voteWeightedMsg.Voter, ProposalId: params.ProposalID, Options: voteWeightedMsg.Options, @@ -154,7 +155,7 @@ func QueryVotesByTxQuery(clientCtx client.Context, params types.QueryProposalVot } start, end := client.Paginate(len(votes), params.Page, params.Limit, 100) if start < 0 || end < 0 { - votes = []types.Vote{} + votes = []v1beta1.Vote{} } else { votes = votes[start:end] } @@ -168,30 +169,30 @@ func QueryVotesByTxQuery(clientCtx client.Context, params types.QueryProposalVot } // QueryVoteByTxQuery will query for a single vote via a direct txs tags query. -func QueryVoteByTxQuery(clientCtx client.Context, params types.QueryVoteParams) ([]byte, error) { +func QueryVoteByTxQuery(clientCtx client.Context, params v1beta1.QueryVoteParams) ([]byte, error) { searchResult, err := combineEvents( clientCtx, defaultPage, // Query legacy Vote Msgs []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, types.TypeMsgVote), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgVote), fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalVote, types.AttributeKeyProposalID, params.ProposalID), fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeySender, params.Voter), }, // Query Vote proto Msgs []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&types.MsgVote{})), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&v1beta1.MsgVote{})), fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalVote, types.AttributeKeyProposalID, params.ProposalID), fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeySender, params.Voter.String()), }, // Query legacy VoteWeighted Msgs []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, types.TypeMsgVoteWeighted), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgVoteWeighted), fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalVote, types.AttributeKeyProposalID, params.ProposalID), fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeySender, params.Voter.String()), }, // Query VoteWeighted proto Msgs []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&types.MsgVoteWeighted{})), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&v1beta1.MsgVoteWeighted{})), fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalVote, types.AttributeKeyProposalID, params.ProposalID), fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeySender, params.Voter), }, @@ -203,17 +204,17 @@ func QueryVoteByTxQuery(clientCtx client.Context, params types.QueryVoteParams) for _, info := range searchResult.Txs { for _, msg := range info.GetTx().GetMsgs() { // there should only be a single vote under the given conditions - var vote *types.Vote - if voteMsg, ok := msg.(*types.MsgVote); ok { - vote = &types.Vote{ + var vote *v1beta1.Vote + if voteMsg, ok := msg.(*v1beta1.MsgVote); ok { + vote = &v1beta1.Vote{ Voter: voteMsg.Voter, ProposalId: params.ProposalID, - Options: types.NewNonSplitVoteOption(voteMsg.Option), + Options: v1beta1.NewNonSplitVoteOption(voteMsg.Option), } } - if voteWeightedMsg, ok := msg.(*types.MsgVoteWeighted); ok { - vote = &types.Vote{ + if voteWeightedMsg, ok := msg.(*v1beta1.MsgVoteWeighted); ok { + vote = &v1beta1.Vote{ Voter: voteWeightedMsg.Voter, ProposalId: params.ProposalID, Options: voteWeightedMsg.Options, @@ -236,7 +237,7 @@ func QueryVoteByTxQuery(clientCtx client.Context, params types.QueryVoteParams) // QueryDepositByTxQuery will query for a single deposit via a direct txs tags // query. -func QueryDepositByTxQuery(clientCtx client.Context, params types.QueryDepositParams) ([]byte, error) { +func QueryDepositByTxQuery(clientCtx client.Context, params v1beta1.QueryDepositParams) ([]byte, error) { // initial deposit was submitted with proposal, so must be queried separately initialDeposit, err := queryInitialDepositByTxQuery(clientCtx, params.ProposalID) @@ -257,13 +258,13 @@ func QueryDepositByTxQuery(clientCtx client.Context, params types.QueryDepositPa clientCtx, defaultPage, // Query legacy Msgs event action []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, types.TypeMsgDeposit), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgDeposit), fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalDeposit, types.AttributeKeyProposalID, params.ProposalID), fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeySender, params.Depositor.String()), }, // Query proto Msgs event action []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&types.MsgDeposit{})), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&v1beta1.MsgDeposit{})), fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalDeposit, types.AttributeKeyProposalID, params.ProposalID), fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeySender, params.Depositor.String()), }, @@ -275,8 +276,8 @@ func QueryDepositByTxQuery(clientCtx client.Context, params types.QueryDepositPa for _, info := range searchResult.Txs { for _, msg := range info.GetTx().GetMsgs() { // there should only be a single deposit under the given conditions - if depMsg, ok := msg.(*types.MsgDeposit); ok { - deposit := types.Deposit{ + if depMsg, ok := msg.(*v1beta1.MsgDeposit); ok { + deposit := v1beta1.Deposit{ Depositor: depMsg.Depositor, ProposalId: params.ProposalID, Amount: depMsg.Amount, @@ -303,12 +304,12 @@ func QueryProposerByTxQuery(clientCtx client.Context, proposalID uint64) (Propos defaultPage, // Query legacy Msgs event action []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, types.TypeMsgSubmitProposal), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgSubmitProposal), fmt.Sprintf("%s.%s='%d'", types.EventTypeSubmitProposal, types.AttributeKeyProposalID, proposalID), }, // Query proto Msgs event action []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&types.MsgSubmitProposal{})), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&v1beta1.MsgSubmitProposal{})), fmt.Sprintf("%s.%s='%d'", types.EventTypeSubmitProposal, types.AttributeKeyProposalID, proposalID), }, ) @@ -319,7 +320,7 @@ func QueryProposerByTxQuery(clientCtx client.Context, proposalID uint64) (Propos for _, info := range searchResult.Txs { for _, msg := range info.GetTx().GetMsgs() { // there should only be a single proposal under the given conditions - if subMsg, ok := msg.(*types.MsgSubmitProposal); ok { + if subMsg, ok := msg.(*v1beta1.MsgSubmitProposal); ok { return NewProposer(proposalID, subMsg.Proposer), nil } } @@ -330,7 +331,7 @@ func QueryProposerByTxQuery(clientCtx client.Context, proposalID uint64) (Propos // QueryProposalByID takes a proposalID and returns a proposal func QueryProposalByID(proposalID uint64, clientCtx client.Context, queryRoute string) ([]byte, error) { - params := types.NewQueryProposalParams(proposalID) + params := v1beta1.NewQueryProposalParams(proposalID) bz, err := clientCtx.LegacyAmino.MarshalJSON(params) if err != nil { return nil, err @@ -368,30 +369,30 @@ func combineEvents(clientCtx client.Context, page int, eventGroups ...[]string) // queryInitialDepositByTxQuery will query for a initial deposit of a governance proposal by // ID. -func queryInitialDepositByTxQuery(clientCtx client.Context, proposalID uint64) (types.Deposit, error) { +func queryInitialDepositByTxQuery(clientCtx client.Context, proposalID uint64) (v1beta1.Deposit, error) { searchResult, err := combineEvents( clientCtx, defaultPage, // Query legacy Msgs event action []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, types.TypeMsgSubmitProposal), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgSubmitProposal), fmt.Sprintf("%s.%s='%d'", types.EventTypeSubmitProposal, types.AttributeKeyProposalID, proposalID), }, // Query proto Msgs event action []string{ - fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&types.MsgSubmitProposal{})), + fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, sdk.MsgTypeURL(&v1beta1.MsgSubmitProposal{})), fmt.Sprintf("%s.%s='%d'", types.EventTypeSubmitProposal, types.AttributeKeyProposalID, proposalID), }, ) if err != nil { - return types.Deposit{}, err + return v1beta1.Deposit{}, err } for _, info := range searchResult.Txs { for _, msg := range info.GetTx().GetMsgs() { // there should only be a single proposal under the given conditions - if subMsg, ok := msg.(*types.MsgSubmitProposal); ok { - return types.Deposit{ + if subMsg, ok := msg.(*v1beta1.MsgSubmitProposal); ok { + return v1beta1.Deposit{ ProposalId: proposalID, Depositor: subMsg.Proposer, Amount: subMsg.InitialDeposit, @@ -400,5 +401,5 @@ func queryInitialDepositByTxQuery(clientCtx client.Context, proposalID uint64) ( } } - return types.Deposit{}, sdkerrors.ErrNotFound.Wrapf("failed to find the initial deposit for proposalID %d", proposalID) + return v1beta1.Deposit{}, sdkerrors.ErrNotFound.Wrapf("failed to find the initial deposit for proposalID %d", proposalID) } diff --git a/x/gov/client/utils/query_test.go b/x/gov/client/utils/query_test.go index 251ce50da7f1..091dc7a1fd5e 100644 --- a/x/gov/client/utils/query_test.go +++ b/x/gov/client/utils/query_test.go @@ -15,7 +15,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" "github.com/cosmos/cosmos-sdk/x/gov/client/utils" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) type TxSearchMock struct { @@ -81,19 +81,19 @@ func TestGetPaginatedVotes(t *testing.T) { description string page, limit int msgs [][]sdk.Msg - votes []types.Vote + votes []v1beta1.Vote } acc1 := make(sdk.AccAddress, 20) acc1[0] = 1 acc2 := make(sdk.AccAddress, 20) acc2[0] = 2 acc1Msgs := []sdk.Msg{ - types.NewMsgVote(acc1, 0, types.OptionYes), - types.NewMsgVote(acc1, 0, types.OptionYes), + v1beta1.NewMsgVote(acc1, 0, v1beta1.OptionYes), + v1beta1.NewMsgVote(acc1, 0, v1beta1.OptionYes), } acc2Msgs := []sdk.Msg{ - types.NewMsgVote(acc2, 0, types.OptionYes), - types.NewMsgVoteWeighted(acc2, 0, types.NewNonSplitVoteOption(types.OptionYes)), + v1beta1.NewMsgVote(acc2, 0, v1beta1.OptionYes), + v1beta1.NewMsgVoteWeighted(acc2, 0, v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)), } for _, tc := range []testCase{ { @@ -104,9 +104,9 @@ func TestGetPaginatedVotes(t *testing.T) { acc1Msgs[:1], acc2Msgs[:1], }, - votes: []types.Vote{ - types.NewVote(0, acc1, types.NewNonSplitVoteOption(types.OptionYes)), - types.NewVote(0, acc2, types.NewNonSplitVoteOption(types.OptionYes))}, + votes: []v1beta1.Vote{ + v1beta1.NewVote(0, acc1, v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)), + v1beta1.NewVote(0, acc2, v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))}, }, { description: "2MsgPerTx1Chunk", @@ -116,9 +116,9 @@ func TestGetPaginatedVotes(t *testing.T) { acc1Msgs, acc2Msgs, }, - votes: []types.Vote{ - types.NewVote(0, acc1, types.NewNonSplitVoteOption(types.OptionYes)), - types.NewVote(0, acc1, types.NewNonSplitVoteOption(types.OptionYes)), + votes: []v1beta1.Vote{ + v1beta1.NewVote(0, acc1, v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)), + v1beta1.NewVote(0, acc1, v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)), }, }, { @@ -129,9 +129,9 @@ func TestGetPaginatedVotes(t *testing.T) { acc1Msgs, acc2Msgs, }, - votes: []types.Vote{ - types.NewVote(0, acc2, types.NewNonSplitVoteOption(types.OptionYes)), - types.NewVote(0, acc2, types.NewNonSplitVoteOption(types.OptionYes)), + votes: []v1beta1.Vote{ + v1beta1.NewVote(0, acc2, v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)), + v1beta1.NewVote(0, acc2, v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes)), }, }, { @@ -141,7 +141,7 @@ func TestGetPaginatedVotes(t *testing.T) { msgs: [][]sdk.Msg{ acc1Msgs[:1], }, - votes: []types.Vote{types.NewVote(0, acc1, types.NewNonSplitVoteOption(types.OptionYes))}, + votes: []v1beta1.Vote{v1beta1.NewVote(0, acc1, v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes))}, }, { description: "InvalidPage", @@ -179,10 +179,10 @@ func TestGetPaginatedVotes(t *testing.T) { marshalled[i] = tx } - params := types.NewQueryProposalVotesParams(0, tc.page, tc.limit) + params := v1beta1.NewQueryProposalVotesParams(0, tc.page, tc.limit) votesData, err := utils.QueryVotesByTxQuery(clientCtx, params) require.NoError(t, err) - votes := []types.Vote{} + votes := []v1beta1.Vote{} require.NoError(t, clientCtx.LegacyAmino.UnmarshalJSON(votesData, &votes)) require.Equal(t, len(tc.votes), len(votes)) for i := range votes { diff --git a/x/gov/genesis.go b/x/gov/genesis.go index 41030b188ad7..f826028258a3 100644 --- a/x/gov/genesis.go +++ b/x/gov/genesis.go @@ -19,7 +19,7 @@ func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k // check if the deposits pool account exists moduleAcc := k.GetGovernanceAccount(ctx) if moduleAcc == nil { - panic(fmt.Sprintf("%s module account has not been set", v1beta1.ModuleName)) + panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) } var totalDeposits sdk.Coins diff --git a/x/gov/simulation/decoder.go b/x/gov/simulation/decoder.go index 762b8ffb13eb..cc2ec72b63cf 100644 --- a/x/gov/simulation/decoder.go +++ b/x/gov/simulation/decoder.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/types/kv" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // NewDecodeStore returns a decoder function closure that unmarshals the KVPair's @@ -16,12 +17,12 @@ 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], types.ProposalsKeyPrefix): - var proposalA types.Proposal + var proposalA v1beta1.Proposal err := cdc.Unmarshal(kvA.Value, &proposalA) if err != nil { panic(err) } - var proposalB types.Proposal + var proposalB v1beta1.Proposal err = cdc.Unmarshal(kvB.Value, &proposalB) if err != nil { panic(err) @@ -36,13 +37,13 @@ func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { return fmt.Sprintf("proposalIDA: %d\nProposalIDB: %d", proposalIDA, proposalIDB) case bytes.Equal(kvA.Key[:1], types.DepositsKeyPrefix): - var depositA, depositB types.Deposit + var depositA, depositB v1beta1.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], types.VotesKeyPrefix): - var voteA, voteB types.Vote + var voteA, voteB v1beta1.Vote cdc.MustUnmarshal(kvA.Value, &voteA) cdc.MustUnmarshal(kvB.Value, &voteB) return fmt.Sprintf("%v\n%v", voteA, voteB) diff --git a/x/gov/types/errors.go b/x/gov/types/errors.go index 9f86b4383175..386f79ab35d4 100644 --- a/x/gov/types/errors.go +++ b/x/gov/types/errors.go @@ -11,7 +11,6 @@ var ( ErrAlreadyActiveProposal = sdkerrors.Register(ModuleName, 4, "proposal already active") // Errors 5 & 6 are reserved as legacy errors // See x/gov/types/v1beta1/errors.go - ErrInvalidVote = sdkerrors.Register(ModuleName, 7, "invalid vote option") ErrInvalidGenesis = sdkerrors.Register(ModuleName, 8, "invalid genesis state") ErrNoProposalHandlerExists = sdkerrors.Register(ModuleName, 9, "no handler exists for proposal type") ErrUnroutableProposalMsg = sdkerrors.Register(ModuleName, 10, "proposal message not recognized by router") @@ -19,4 +18,5 @@ var ( ErrInvalidProposalMsg = sdkerrors.Register(ModuleName, 12, "invalid proposal message") ErrInvalidSigner = sdkerrors.Register(ModuleName, 13, "expected gov account as only signer for proposal message") ErrInvalidSignalMsg = sdkerrors.Register(ModuleName, 14, "signal message is invalid") + ErrInvalidVote = sdkerrors.Register(ModuleName, 15, "invalid vote option") ) From 324de6e47eedca4230eda1123b3993beee137f24 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 13 Dec 2021 11:59:25 +0100 Subject: [PATCH 03/12] add changelog entry --- CHANGELOG.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c007f1c3dff..f900b7099731 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,14 +58,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [\#10507](https://github.com/cosmos/cosmos-sdk/pull/10507) Add middleware for tx priority. * [\#10311](https://github.com/cosmos/cosmos-sdk/pull/10311) Adds cli to use tips transactions. It adds an `--aux` flag to all CLI tx commands to generate the aux signer data (with optional tip), and a new `tx aux-to-fee` subcommand to let the fee payer gather aux signer data and broadcast the tx -### Improvements - -* (deps) [\#10210](https://github.com/cosmos/cosmos-sdk/pull/10210) Bump Tendermint to [v0.35.0](https://github.com/tendermint/tendermint/releases/tag/v0.35.0). -* [\#10486](https://github.com/cosmos/cosmos-sdk/pull/10486) store/cachekv's `Store.Write` conservatively looks up keys, but also uses the [map clearing idiom](https://bencher.orijtech.com/perfclinic/mapclearing/) to reduce the RAM usage, CPU time usage, and garbage collection pressure from clearing maps, instead of allocating new maps. -* (types) [\#10630](https://github.com/cosmos/cosmos-sdk/pull/10630) Add an `Events` field to the `TxResponse` type that captures _all_ events emitted by a transaction, unlike `Logs` which only contains events emitted during message execution. -* (deps) [\#10706](https://github.com/cosmos/cosmos-sdk/issues/10706) Bump rosetta-sdk-go to v0.7.2 and rosetta-cli to v0.7.3 -* (module) [\#10711](https://github.com/cosmos/cosmos-sdk/pull/10711) Panic at startup if the app developer forgot to add modules in the `SetOrder{BeginBlocker, EndBlocker, InitGenesis, ExportGenesis}` functions. This means that all modules, even those who have empty implementations for those methods, need to be added to `SetOrder*`. - ### API Breaking Changes * (x/mint) [\#10441](https://github.com/cosmos/cosmos-sdk/pull/10441) The `NewAppModule` function now accepts an inflation calculation function as an argument. @@ -119,6 +111,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [\#10208](https://github.com/cosmos/cosmos-sdk/pull/10208) The `x/auth/signing.Tx` interface now also includes a new `GetTip() *tx.Tip` method for verifying tipped transactions. The `x/auth/types` expected BankKeeper interface now expects the `SendCoins` method too. * [\#10612](https://github.com/cosmos/cosmos-sdk/pull/10612) `baseapp.NewBaseApp` constructor function doesn't take the `sdk.TxDecoder` anymore. This logic has been moved into the TxDecoderMiddleware. * [\#10692](https://github.com/cosmos/cosmos-sdk/pull/10612) `SignerData` takes 2 new fields, `Address` and `PubKey`, which need to get populated when using SIGN_MODE_DIRECT_AUX. +* [\#10748](https://github.com/cosmos/cosmos-sdk/pull/10748) Move legacy `x/gov` api to `v1beta1` directory. ### Client Breaking Changes @@ -151,6 +144,11 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (cli) [\#10683](https://github.com/cosmos/cosmos-sdk/pull/10683) In CLI, allow 1 SIGN_MODE_DIRECT signer in transactions with multiple signers. * (x/gov) [\#10740](https://github.com/cosmos/cosmos-sdk/pull/10740) Increase maximum proposal description size from 5k characters to 10k characters. * (store) [\#10741](https://github.com/cosmos/cosmos-sdk/pull/10741) Significantly speedup iterator creation after delete heavy workloads. Significantly improves IBC migration times. +* (deps) [\#10210](https://github.com/cosmos/cosmos-sdk/pull/10210) Bump Tendermint to [v0.35.0](https://github.com/tendermint/tendermint/releases/tag/v0.35.0). +* [\#10486](https://github.com/cosmos/cosmos-sdk/pull/10486) store/cachekv's `Store.Write` conservatively looks up keys, but also uses the [map clearing idiom](https://bencher.orijtech.com/perfclinic/mapclearing/) to reduce the RAM usage, CPU time usage, and garbage collection pressure from clearing maps, instead of allocating new maps. +* (types) [\#10630](https://github.com/cosmos/cosmos-sdk/pull/10630) Add an `Events` field to the `TxResponse` type that captures _all_ events emitted by a transaction, unlike `Logs` which only contains events emitted during message execution. +* (deps) [\#10706](https://github.com/cosmos/cosmos-sdk/issues/10706) Bump rosetta-sdk-go to v0.7.2 and rosetta-cli to v0.7.3 +* (module) [\#10711](https://github.com/cosmos/cosmos-sdk/pull/10711) Panic at startup if the app developer forgot to add modules in the `SetOrder{BeginBlocker, EndBlocker, InitGenesis, ExportGenesis}` functions. This means that all modules, even those who have empty implementations for those methods, need to be added to `SetOrder*`. ### Bug Fixes From 096d429176413a875a8471abb914b07edb2c1330 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 13 Dec 2021 14:46:52 +0100 Subject: [PATCH 04/12] refactor: move v1beta2 gov types into types dir --- proto/cosmos/gov/v1beta2/genesis.proto | 2 +- proto/cosmos/gov/v1beta2/gov.proto | 2 +- proto/cosmos/gov/v1beta2/query.proto | 2 +- proto/cosmos/gov/v1beta2/tx.proto | 2 +- x/gov/types/genesis.pb.go | 171 +- x/gov/types/gov.pb.go | 982 +++--- x/gov/types/query.pb.go | 431 ++- x/gov/types/tx.pb.go | 214 +- x/gov/types/v1beta2/genesis.pb.go | 684 ---- x/gov/types/v1beta2/gov.pb.go | 2717 ---------------- x/gov/types/v1beta2/query.pb.go | 3963 ------------------------ x/gov/types/v1beta2/query.pb.gw.go | 932 ------ x/gov/types/v1beta2/tx.pb.go | 1970 ------------ 13 files changed, 1063 insertions(+), 11009 deletions(-) delete mode 100644 x/gov/types/v1beta2/genesis.pb.go delete mode 100644 x/gov/types/v1beta2/gov.pb.go delete mode 100644 x/gov/types/v1beta2/query.pb.go delete mode 100644 x/gov/types/v1beta2/query.pb.gw.go delete mode 100644 x/gov/types/v1beta2/tx.pb.go diff --git a/proto/cosmos/gov/v1beta2/genesis.proto b/proto/cosmos/gov/v1beta2/genesis.proto index edb68877f452..082def6ab26d 100644 --- a/proto/cosmos/gov/v1beta2/genesis.proto +++ b/proto/cosmos/gov/v1beta2/genesis.proto @@ -4,7 +4,7 @@ package cosmos.gov.v1beta2; import "cosmos/gov/v1beta2/gov.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2"; +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; // GenesisState defines the gov module's genesis state. message GenesisState { diff --git a/proto/cosmos/gov/v1beta2/gov.proto b/proto/cosmos/gov/v1beta2/gov.proto index 9f84ffcf803a..89c5617fb746 100644 --- a/proto/cosmos/gov/v1beta2/gov.proto +++ b/proto/cosmos/gov/v1beta2/gov.proto @@ -8,7 +8,7 @@ import "google/protobuf/any.proto"; import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2"; +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; // VoteOption enumerates the valid vote options for a given governance proposal. enum VoteOption { diff --git a/proto/cosmos/gov/v1beta2/query.proto b/proto/cosmos/gov/v1beta2/query.proto index 944a21566fbc..14e97dfb932d 100644 --- a/proto/cosmos/gov/v1beta2/query.proto +++ b/proto/cosmos/gov/v1beta2/query.proto @@ -6,7 +6,7 @@ import "google/api/annotations.proto"; import "cosmos/gov/v1beta2/gov.proto"; import "cosmos_proto/cosmos.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2"; +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; // Query defines the gRPC querier service for gov module service Query { diff --git a/proto/cosmos/gov/v1beta2/tx.proto b/proto/cosmos/gov/v1beta2/tx.proto index c13172ea12f4..c03a0fdf60d3 100644 --- a/proto/cosmos/gov/v1beta2/tx.proto +++ b/proto/cosmos/gov/v1beta2/tx.proto @@ -6,7 +6,7 @@ import "cosmos/gov/v1beta2/gov.proto"; import "cosmos_proto/cosmos.proto"; import "google/protobuf/any.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2"; +option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; // Msg defines the gov Msg service. service Msg { diff --git a/x/gov/types/genesis.pb.go b/x/gov/types/genesis.pb.go index 4eb8a5da2d47..8f6fece87aa8 100644 --- a/x/gov/types/genesis.pb.go +++ b/x/gov/types/genesis.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -26,19 +25,19 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // 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"` + StartingProposalId uint64 `protobuf:"varint,1,opt,name=starting_proposal_id,json=startingProposalId,proto3" json:"starting_proposal_id,omitempty"` // deposits defines all the deposits present at genesis. - Deposits Deposits `protobuf:"bytes,2,rep,name=deposits,proto3,castrepeated=Deposits" json:"deposits"` + Deposits []*Deposit `protobuf:"bytes,2,rep,name=deposits,proto3" json:"deposits,omitempty"` // votes defines all the votes present at genesis. - Votes Votes `protobuf:"bytes,3,rep,name=votes,proto3,castrepeated=Votes" json:"votes"` + Votes []*Vote `protobuf:"bytes,3,rep,name=votes,proto3" json:"votes,omitempty"` // proposals defines all the proposals present at genesis. - Proposals Proposals `protobuf:"bytes,4,rep,name=proposals,proto3,castrepeated=Proposals" json:"proposals"` + Proposals []*Proposal `protobuf:"bytes,4,rep,name=proposals,proto3" json:"proposals,omitempty"` // 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"` + DepositParams *DepositParams `protobuf:"bytes,5,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params,omitempty"` // params defines all the paramaters of related to voting. - VotingParams VotingParams `protobuf:"bytes,6,opt,name=voting_params,json=votingParams,proto3" json:"voting_params" yaml:"voting_params"` + VotingParams *VotingParams `protobuf:"bytes,6,opt,name=voting_params,json=votingParams,proto3" json:"voting_params,omitempty"` // 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"` + TallyParams *TallyParams `protobuf:"bytes,7,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -81,46 +80,46 @@ func (m *GenesisState) GetStartingProposalId() uint64 { return 0 } -func (m *GenesisState) GetDeposits() Deposits { +func (m *GenesisState) GetDeposits() []*Deposit { if m != nil { return m.Deposits } return nil } -func (m *GenesisState) GetVotes() Votes { +func (m *GenesisState) GetVotes() []*Vote { if m != nil { return m.Votes } return nil } -func (m *GenesisState) GetProposals() Proposals { +func (m *GenesisState) GetProposals() []*Proposal { if m != nil { return m.Proposals } return nil } -func (m *GenesisState) GetDepositParams() DepositParams { +func (m *GenesisState) GetDepositParams() *DepositParams { if m != nil { return m.DepositParams } - return DepositParams{} + return nil } -func (m *GenesisState) GetVotingParams() VotingParams { +func (m *GenesisState) GetVotingParams() *VotingParams { if m != nil { return m.VotingParams } - return VotingParams{} + return nil } -func (m *GenesisState) GetTallyParams() TallyParams { +func (m *GenesisState) GetTallyParams() *TallyParams { if m != nil { return m.TallyParams } - return TallyParams{} + return nil } func init() { @@ -130,34 +129,29 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1beta2/genesis.proto", fileDescriptor_7915ab39bb5aa171) } var fileDescriptor_7915ab39bb5aa171 = []byte{ - // 430 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xb1, 0x8e, 0xd3, 0x40, - 0x10, 0x86, 0x63, 0x2e, 0x39, 0xee, 0x36, 0x09, 0x82, 0x25, 0x48, 0xd6, 0x25, 0xd8, 0xc6, 0x55, - 0x1a, 0x6c, 0x11, 0x3a, 0x24, 0x1a, 0x0b, 0x09, 0x5d, 0x81, 0x74, 0x18, 0x44, 0x41, 0x13, 0x6d, - 0xe2, 0xd5, 0x62, 0x61, 0xdf, 0x58, 0x9e, 0xc5, 0x22, 0x6f, 0xc1, 0x73, 0xf0, 0x24, 0x57, 0x5e, - 0x49, 0x15, 0x50, 0x52, 0xd1, 0xde, 0x13, 0x20, 0xef, 0xae, 0xc1, 0x11, 0x86, 0x2a, 0xf1, 0xec, - 0xbf, 0xdf, 0x37, 0x3b, 0x1a, 0xe2, 0xad, 0x01, 0x73, 0xc0, 0x50, 0x40, 0x15, 0x56, 0x4f, 0x56, - 0x5c, 0xb2, 0x45, 0x28, 0xf8, 0x25, 0xc7, 0x14, 0x83, 0xa2, 0x04, 0x09, 0x94, 0xea, 0x44, 0x20, - 0xa0, 0x0a, 0x4c, 0xe2, 0x6c, 0x22, 0x40, 0x80, 0x3a, 0x0e, 0xeb, 0x7f, 0x3a, 0x79, 0x36, 0xeb, - 0x62, 0x41, 0xa5, 0x4f, 0xfd, 0x9f, 0x7d, 0x32, 0x7a, 0xa9, 0xc9, 0x6f, 0x24, 0x93, 0x9c, 0xbe, - 0x26, 0x13, 0x94, 0xac, 0x94, 0xe9, 0xa5, 0x58, 0x16, 0x25, 0x14, 0x80, 0x2c, 0x5b, 0xa6, 0x89, - 0x6d, 0x79, 0xd6, 0xbc, 0x1f, 0xb9, 0x37, 0x5b, 0x77, 0xba, 0x61, 0x79, 0xf6, 0xcc, 0xef, 0x4a, - 0xf9, 0x31, 0x6d, 0xca, 0x17, 0xa6, 0x7a, 0x9e, 0xd0, 0x73, 0x72, 0x92, 0xf0, 0x02, 0x30, 0x95, - 0x68, 0xdf, 0xf2, 0x8e, 0xe6, 0xc3, 0xc5, 0x34, 0xf8, 0xbb, 0xfd, 0xe0, 0x85, 0xce, 0x44, 0x77, - 0xaf, 0xb6, 0x6e, 0xef, 0xeb, 0x77, 0xf7, 0xc4, 0x14, 0x30, 0xfe, 0x7d, 0x9d, 0x3e, 0x27, 0x83, - 0x0a, 0x24, 0x47, 0xfb,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 0xe0, 0xb8, 0x3a, 0x56, 0x6b, 0xfb, 0xf4, - 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x59, 0xfd, 0x9f, 0x57, 0x22, 0x03, 0x00, 0x00, + // 341 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xbd, 0x4e, 0xc3, 0x30, + 0x14, 0x85, 0x1b, 0xfa, 0x03, 0xb8, 0x2d, 0x83, 0xc5, 0x10, 0x41, 0x15, 0x02, 0x53, 0x16, 0x1c, + 0x28, 0x03, 0x12, 0x63, 0x05, 0x02, 0xb6, 0x2a, 0x20, 0x06, 0x96, 0xca, 0x6d, 0xac, 0x10, 0xd1, + 0xf6, 0x46, 0xf1, 0xc5, 0xa2, 0x6f, 0xc1, 0xf3, 0xf0, 0x04, 0x8c, 0x1d, 0x19, 0x51, 0xf3, 0x22, + 0xa8, 0x76, 0x42, 0x2b, 0x11, 0x98, 0xa2, 0x2b, 0x7f, 0xe7, 0xcb, 0x91, 0x7d, 0x89, 0x3b, 0x02, + 0x39, 0x01, 0xe9, 0x47, 0xa0, 0x7c, 0x75, 0x3a, 0x14, 0xc8, 0xbb, 0x7e, 0x24, 0xa6, 0x42, 0xc6, + 0x92, 0x25, 0x29, 0x20, 0x50, 0x6a, 0x08, 0x16, 0x81, 0x62, 0x39, 0xb1, 0xd7, 0x29, 0x4b, 0x81, + 0x32, 0x89, 0xa3, 0xf7, 0x2a, 0x69, 0x5d, 0x1b, 0xc7, 0x1d, 0x72, 0x14, 0xf4, 0x84, 0xec, 0x4a, + 0xe4, 0x29, 0xc6, 0xd3, 0x68, 0x90, 0xa4, 0x90, 0x80, 0xe4, 0xe3, 0x41, 0x1c, 0xda, 0x96, 0x6b, + 0x79, 0xb5, 0x80, 0x16, 0x67, 0xfd, 0xfc, 0xe8, 0x36, 0xa4, 0xe7, 0x64, 0x2b, 0x14, 0x09, 0xc8, + 0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GenesisState) Marshal() (dAtA []byte, err error) { @@ -180,36 +174,42 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.TallyParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.TallyParams != nil { + { + size, err := m.TallyParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x3a } - i-- - dAtA[i] = 0x3a - { - size, err := m.VotingParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.VotingParams != nil { + { + size, err := m.VotingParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 } - i-- - dAtA[i] = 0x32 - { - size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.DepositParams != nil { + { + size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a } - i-- - dAtA[i] = 0x2a if len(m.Proposals) > 0 { for iNdEx := len(m.Proposals) - 1; iNdEx >= 0; iNdEx-- { { @@ -298,12 +298,18 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - l = m.DepositParams.Size() - n += 1 + l + sovGenesis(uint64(l)) - l = m.VotingParams.Size() - n += 1 + l + sovGenesis(uint64(l)) - l = m.TallyParams.Size() - n += 1 + l + sovGenesis(uint64(l)) + if m.DepositParams != nil { + l = m.DepositParams.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if m.VotingParams != nil { + l = m.VotingParams.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if m.TallyParams != nil { + l = m.TallyParams.Size() + n += 1 + l + sovGenesis(uint64(l)) + } return n } @@ -390,7 +396,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, &Deposit{}) if err := m.Deposits[len(m.Deposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -424,7 +430,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, &Vote{}) if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -458,7 +464,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Proposals = append(m.Proposals, Proposal{}) + m.Proposals = append(m.Proposals, &Proposal{}) if err := m.Proposals[len(m.Proposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -492,6 +498,9 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.DepositParams == nil { + m.DepositParams = &DepositParams{} + } if err := m.DepositParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -525,6 +534,9 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.VotingParams == nil { + m.VotingParams = &VotingParams{} + } if err := m.VotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -558,6 +570,9 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.TallyParams == nil { + m.TallyParams = &TallyParams{} + } if err := m.TallyParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/gov/types/gov.pb.go b/x/gov/types/gov.pb.go index e6ec82ef985d..8cb346dfe89f 100644 --- a/x/gov/types/gov.pb.go +++ b/x/gov/types/gov.pb.go @@ -7,7 +7,6 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" types1 "github.com/cosmos/cosmos-sdk/codec/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -37,15 +36,15 @@ type VoteOption int32 const ( // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. - OptionEmpty VoteOption = 0 + VoteOption_VOTE_OPTION_UNSPECIFIED VoteOption = 0 // VOTE_OPTION_YES defines a yes vote option. - OptionYes VoteOption = 1 + VoteOption_VOTE_OPTION_YES VoteOption = 1 // VOTE_OPTION_ABSTAIN defines an abstain vote option. - OptionAbstain VoteOption = 2 + VoteOption_VOTE_OPTION_ABSTAIN VoteOption = 2 // VOTE_OPTION_NO defines a no vote option. - OptionNo VoteOption = 3 + VoteOption_VOTE_OPTION_NO VoteOption = 3 // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. - OptionNoWithVeto VoteOption = 4 + VoteOption_VOTE_OPTION_NO_WITH_VETO VoteOption = 4 ) var VoteOption_name = map[int32]string{ @@ -77,22 +76,22 @@ type ProposalStatus int32 const ( // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. - StatusNil ProposalStatus = 0 + ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED ProposalStatus = 0 // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit // period. - StatusDepositPeriod ProposalStatus = 1 + ProposalStatus_PROPOSAL_STATUS_DEPOSIT_PERIOD ProposalStatus = 1 // PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting // period. - StatusVotingPeriod ProposalStatus = 2 + ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD ProposalStatus = 2 // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has // passed. - StatusPassed ProposalStatus = 3 + ProposalStatus_PROPOSAL_STATUS_PASSED ProposalStatus = 3 // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has // been rejected. - StatusRejected ProposalStatus = 4 + ProposalStatus_PROPOSAL_STATUS_REJECTED ProposalStatus = 4 // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has // failed. - StatusFailed ProposalStatus = 5 + ProposalStatus_PROPOSAL_STATUS_FAILED ProposalStatus = 5 ) var ProposalStatus_name = map[int32]string{ @@ -123,12 +122,13 @@ func (ProposalStatus) EnumDescriptor() ([]byte, []int) { // WeightedVoteOption defines a unit of vote for vote split. type WeightedVoteOption struct { - Option VoteOption `protobuf:"varint,1,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"` - Weight github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"weight"` + Option VoteOption `protobuf:"varint,1,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"` + Weight string `protobuf:"bytes,2,opt,name=weight,proto3" json:"weight,omitempty"` } -func (m *WeightedVoteOption) Reset() { *m = WeightedVoteOption{} } -func (*WeightedVoteOption) ProtoMessage() {} +func (m *WeightedVoteOption) Reset() { *m = WeightedVoteOption{} } +func (m *WeightedVoteOption) String() string { return proto.CompactTextString(m) } +func (*WeightedVoteOption) ProtoMessage() {} func (*WeightedVoteOption) Descriptor() ([]byte, []int) { return fileDescriptor_5abf7b8852811c49, []int{0} } @@ -159,16 +159,31 @@ func (m *WeightedVoteOption) XXX_DiscardUnknown() { var xxx_messageInfo_WeightedVoteOption proto.InternalMessageInfo +func (m *WeightedVoteOption) GetOption() VoteOption { + if m != nil { + return m.Option + } + return VoteOption_VOTE_OPTION_UNSPECIFIED +} + +func (m *WeightedVoteOption) GetWeight() string { + if m != nil { + return m.Weight + } + return "" +} + // Deposit defines an amount deposited by an account address to an active // proposal. type Deposit struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` + Amount []*types.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount,omitempty"` } -func (m *Deposit) Reset() { *m = Deposit{} } -func (*Deposit) ProtoMessage() {} +func (m *Deposit) Reset() { *m = Deposit{} } +func (m *Deposit) String() string { return proto.CompactTextString(m) } +func (*Deposit) ProtoMessage() {} func (*Deposit) Descriptor() ([]byte, []int) { return fileDescriptor_5abf7b8852811c49, []int{1} } @@ -199,21 +214,43 @@ func (m *Deposit) XXX_DiscardUnknown() { var xxx_messageInfo_Deposit proto.InternalMessageInfo +func (m *Deposit) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *Deposit) GetDepositor() string { + if m != nil { + return m.Depositor + } + return "" +} + +func (m *Deposit) GetAmount() []*types.Coin { + if m != nil { + return m.Amount + } + return nil +} + // Proposal defines the core field members of a governance proposal. type Proposal struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"id" yaml:"id"` - Messages []*types1.Any `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"` - Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=cosmos.gov.v1beta2.ProposalStatus" json:"status,omitempty" yaml:"proposal_status"` - FinalTallyResult TallyResult `protobuf:"bytes,4,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result" yaml:"final_tally_result"` - SubmitTime time.Time `protobuf:"bytes,5,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time" yaml:"submit_time"` - DepositEndTime time.Time `protobuf:"bytes,6,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,7,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,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time" yaml:"voting_start_time"` - VotingEndTime time.Time `protobuf:"bytes,9,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() {} + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + Messages []*types1.Any `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"` + Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=cosmos.gov.v1beta2.ProposalStatus" json:"status,omitempty"` + FinalTallyResult *TallyResult `protobuf:"bytes,4,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result,omitempty"` + SubmitTime *time.Time `protobuf:"bytes,5,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time,omitempty"` + DepositEndTime *time.Time `protobuf:"bytes,6,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time,omitempty"` + TotalDeposit []*types.Coin `protobuf:"bytes,7,rep,name=total_deposit,json=totalDeposit,proto3" json:"total_deposit,omitempty"` + VotingStartTime *time.Time `protobuf:"bytes,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time,omitempty"` + VotingEndTime *time.Time `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time,omitempty"` +} + +func (m *Proposal) Reset() { *m = Proposal{} } +func (m *Proposal) String() string { return proto.CompactTextString(m) } +func (*Proposal) ProtoMessage() {} func (*Proposal) Descriptor() ([]byte, []int) { return fileDescriptor_5abf7b8852811c49, []int{2} } @@ -244,16 +281,80 @@ func (m *Proposal) XXX_DiscardUnknown() { var xxx_messageInfo_Proposal proto.InternalMessageInfo +func (m *Proposal) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *Proposal) GetMessages() []*types1.Any { + if m != nil { + return m.Messages + } + return nil +} + +func (m *Proposal) GetStatus() ProposalStatus { + if m != nil { + return m.Status + } + return ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED +} + +func (m *Proposal) GetFinalTallyResult() *TallyResult { + if m != nil { + return m.FinalTallyResult + } + return nil +} + +func (m *Proposal) GetSubmitTime() *time.Time { + if m != nil { + return m.SubmitTime + } + return nil +} + +func (m *Proposal) GetDepositEndTime() *time.Time { + if m != nil { + return m.DepositEndTime + } + return nil +} + +func (m *Proposal) GetTotalDeposit() []*types.Coin { + if m != nil { + return m.TotalDeposit + } + return nil +} + +func (m *Proposal) GetVotingStartTime() *time.Time { + if m != nil { + return m.VotingStartTime + } + return nil +} + +func (m *Proposal) GetVotingEndTime() *time.Time { + if m != nil { + return m.VotingEndTime + } + return nil +} + // TallyResult defines a standard tally for a governance proposal. type TallyResult struct { - Yes github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=yes,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"yes"` - Abstain github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=abstain,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"abstain"` - No github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=no,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"no"` - NoWithVeto github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=no_with_veto,json=noWithVeto,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"no_with_veto"` + Yes string `protobuf:"bytes,1,opt,name=yes,proto3" json:"yes,omitempty"` + Abstain string `protobuf:"bytes,2,opt,name=abstain,proto3" json:"abstain,omitempty"` + No string `protobuf:"bytes,3,opt,name=no,proto3" json:"no,omitempty"` + NoWithVeto string `protobuf:"bytes,4,opt,name=no_with_veto,json=noWithVeto,proto3" json:"no_with_veto,omitempty"` } -func (m *TallyResult) Reset() { *m = TallyResult{} } -func (*TallyResult) ProtoMessage() {} +func (m *TallyResult) Reset() { *m = TallyResult{} } +func (m *TallyResult) String() string { return proto.CompactTextString(m) } +func (*TallyResult) ProtoMessage() {} func (*TallyResult) Descriptor() ([]byte, []int) { return fileDescriptor_5abf7b8852811c49, []int{3} } @@ -284,6 +385,34 @@ func (m *TallyResult) XXX_DiscardUnknown() { var xxx_messageInfo_TallyResult proto.InternalMessageInfo +func (m *TallyResult) GetYes() string { + if m != nil { + return m.Yes + } + return "" +} + +func (m *TallyResult) GetAbstain() string { + if m != nil { + return m.Abstain + } + return "" +} + +func (m *TallyResult) GetNo() string { + if m != nil { + return m.No + } + return "" +} + +func (m *TallyResult) GetNoWithVeto() string { + if m != nil { + return m.NoWithVeto + } + return "" +} + // Vote defines a vote on a governance proposal. // A Vote consists of a proposal ID, the voter, and the vote option. type Vote struct { @@ -292,12 +421,13 @@ type Vote struct { // Deprecated: Prefer to use `options` instead. This field is set in queries // if and only if `len(options) == 1` and that option has weight 1. In all // other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"` // Deprecated: Do not use. - Options []WeightedVoteOption `protobuf:"bytes,4,rep,name=options,proto3" json:"options"` + Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"` // Deprecated: Do not use. + Options []*WeightedVoteOption `protobuf:"bytes,4,rep,name=options,proto3" json:"options,omitempty"` } -func (m *Vote) Reset() { *m = Vote{} } -func (*Vote) ProtoMessage() {} +func (m *Vote) Reset() { *m = Vote{} } +func (m *Vote) String() string { return proto.CompactTextString(m) } +func (*Vote) ProtoMessage() {} func (*Vote) Descriptor() ([]byte, []int) { return fileDescriptor_5abf7b8852811c49, []int{4} } @@ -328,17 +458,47 @@ func (m *Vote) XXX_DiscardUnknown() { var xxx_messageInfo_Vote proto.InternalMessageInfo +func (m *Vote) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *Vote) GetVoter() string { + if m != nil { + return m.Voter + } + return "" +} + +// Deprecated: Do not use. +func (m *Vote) GetOption() VoteOption { + if m != nil { + return m.Option + } + return VoteOption_VOTE_OPTION_UNSPECIFIED +} + +func (m *Vote) GetOptions() []*WeightedVoteOption { + if m != nil { + return m.Options + } + return nil +} + // DepositParams defines the params for deposits on governance proposals. type DepositParams struct { // Minimum deposit for a proposal to enter voting period. - MinDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"min_deposit,omitempty"` + MinDeposit []*types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit,omitempty"` // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 // months. - MaxDepositPeriod time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty"` + MaxDepositPeriod *time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty"` } -func (m *DepositParams) Reset() { *m = DepositParams{} } -func (*DepositParams) ProtoMessage() {} +func (m *DepositParams) Reset() { *m = DepositParams{} } +func (m *DepositParams) String() string { return proto.CompactTextString(m) } +func (*DepositParams) ProtoMessage() {} func (*DepositParams) Descriptor() ([]byte, []int) { return fileDescriptor_5abf7b8852811c49, []int{5} } @@ -369,14 +529,29 @@ func (m *DepositParams) XXX_DiscardUnknown() { var xxx_messageInfo_DepositParams proto.InternalMessageInfo +func (m *DepositParams) GetMinDeposit() []*types.Coin { + if m != nil { + return m.MinDeposit + } + return nil +} + +func (m *DepositParams) GetMaxDepositPeriod() *time.Duration { + if m != nil { + return m.MaxDepositPeriod + } + return nil +} + // VotingParams defines the params for voting on governance proposals. type VotingParams struct { // Length of the voting period. - VotingPeriod time.Duration `protobuf:"bytes,1,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty"` + VotingPeriod *time.Duration `protobuf:"bytes,1,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty"` } -func (m *VotingParams) Reset() { *m = VotingParams{} } -func (*VotingParams) ProtoMessage() {} +func (m *VotingParams) Reset() { *m = VotingParams{} } +func (m *VotingParams) String() string { return proto.CompactTextString(m) } +func (*VotingParams) ProtoMessage() {} func (*VotingParams) Descriptor() ([]byte, []int) { return fileDescriptor_5abf7b8852811c49, []int{6} } @@ -407,20 +582,28 @@ func (m *VotingParams) XXX_DiscardUnknown() { var xxx_messageInfo_VotingParams proto.InternalMessageInfo +func (m *VotingParams) GetVotingPeriod() *time.Duration { + if m != nil { + return m.VotingPeriod + } + return nil +} + // TallyParams defines the params for tallying votes on governance proposals. type TallyParams struct { // Minimum percentage of total stake needed to vote for a result to be // considered valid. - Quorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=quorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"quorum,omitempty"` + Quorum []byte `protobuf:"bytes,1,opt,name=quorum,proto3" json:"quorum,omitempty"` // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. - Threshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=threshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"threshold,omitempty"` + Threshold []byte `protobuf:"bytes,2,opt,name=threshold,proto3" json:"threshold,omitempty"` // Minimum value of Veto votes to Total votes ratio for proposal to be // vetoed. Default value: 1/3. - VetoThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=veto_threshold,json=vetoThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"veto_threshold,omitempty"` + VetoThreshold []byte `protobuf:"bytes,3,opt,name=veto_threshold,json=vetoThreshold,proto3" json:"veto_threshold,omitempty"` } -func (m *TallyParams) Reset() { *m = TallyParams{} } -func (*TallyParams) ProtoMessage() {} +func (m *TallyParams) Reset() { *m = TallyParams{} } +func (m *TallyParams) String() string { return proto.CompactTextString(m) } +func (*TallyParams) ProtoMessage() {} func (*TallyParams) Descriptor() ([]byte, []int) { return fileDescriptor_5abf7b8852811c49, []int{7} } @@ -451,6 +634,27 @@ func (m *TallyParams) XXX_DiscardUnknown() { var xxx_messageInfo_TallyParams proto.InternalMessageInfo +func (m *TallyParams) GetQuorum() []byte { + if m != nil { + return m.Quorum + } + return nil +} + +func (m *TallyParams) GetThreshold() []byte { + if m != nil { + return m.Threshold + } + return nil +} + +func (m *TallyParams) GetVetoThreshold() []byte { + if m != nil { + return m.VetoThreshold + } + return nil +} + func init() { proto.RegisterEnum("cosmos.gov.v1beta2.VoteOption", VoteOption_name, VoteOption_value) proto.RegisterEnum("cosmos.gov.v1beta2.ProposalStatus", ProposalStatus_name, ProposalStatus_value) @@ -467,187 +671,73 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1beta2/gov.proto", fileDescriptor_5abf7b8852811c49) } var fileDescriptor_5abf7b8852811c49 = []byte{ - // 1386 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0x4f, 0x6f, 0x13, 0x47, - 0x1b, 0xf7, 0xda, 0xc6, 0x49, 0x26, 0x4e, 0x58, 0x26, 0x79, 0x93, 0x8d, 0x5f, 0xde, 0xdd, 0x7d, - 0x97, 0x0a, 0x45, 0x08, 0x1c, 0x48, 0x2b, 0xa4, 0xa6, 0xbd, 0x78, 0xf1, 0xa6, 0x18, 0x21, 0xdb, - 0x5a, 0x2f, 0x46, 0x50, 0xa9, 0xab, 0x8d, 0x77, 0x70, 0xb6, 0xf5, 0xee, 0x18, 0xef, 0x38, 0x90, - 0x5b, 0x2f, 0x95, 0x90, 0x4f, 0x1c, 0xb9, 0x58, 0x42, 0xed, 0xad, 0x67, 0xbe, 0x40, 0x6f, 0x1c, - 0x7a, 0xa0, 0x9c, 0x50, 0x0f, 0xa6, 0x04, 0xb5, 0xa2, 0xf4, 0xc6, 0x27, 0xa8, 0x76, 0x66, 0x36, - 0xb1, 0x9d, 0xa8, 0x26, 0xe5, 0x94, 0xf5, 0xcc, 0xef, 0xcf, 0xf3, 0x3c, 0x3b, 0xcf, 0xb3, 0x13, - 0x70, 0xba, 0x81, 0x43, 0x1f, 0x87, 0x6b, 0x4d, 0xbc, 0xb3, 0xb6, 0x73, 0x69, 0x0b, 0x11, 0x67, - 0x3d, 0x7a, 0xce, 0xb7, 0x3b, 0x98, 0x60, 0x08, 0xd9, 0x6e, 0x3e, 0x5a, 0xe1, 0xbb, 0x39, 0x99, - 0x33, 0xb6, 0x9c, 0x10, 0x71, 0xca, 0xa5, 0xb5, 0x06, 0xf6, 0x02, 0xc6, 0xc9, 0x2d, 0x36, 0x71, - 0x13, 0xd3, 0xc7, 0xb5, 0xe8, 0x89, 0xaf, 0x2a, 0x4d, 0x8c, 0x9b, 0x2d, 0xb4, 0x46, 0x7f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0x77, 0x03, 0x65, 0x85, 0x99, - 0x1c, 0x16, 0xd2, 0x4c, 0x91, 0x2e, 0x0e, 0x91, 0xe0, 0x97, 0x60, 0x36, 0xec, 0x6e, 0xf9, 0x1e, - 0xb1, 0xa3, 0x3e, 0x91, 0x4e, 0x50, 0xab, 0xdc, 0xa1, 0xf4, 0xad, 0xb8, 0x89, 0x74, 0x99, 0xbb, - 0x40, 0xe6, 0x32, 0x44, 0xd6, 0x1e, 0xbe, 0x54, 0x04, 0x13, 0xb0, 0x95, 0x88, 0x00, 0x3d, 0x20, - 0xf2, 0x73, 0x61, 0xa3, 0xc0, 0x65, 0x0e, 0x99, 0x89, 0x0e, 0x67, 0xb8, 0xc3, 0x32, 0x73, 0x18, - 0x57, 0x60, 0x36, 0xf3, 0x7c, 0xd9, 0x08, 0x5c, 0x6a, 0xf5, 0x40, 0x00, 0x73, 0x04, 0x13, 0xa7, - 0x65, 0xf3, 0x0d, 0x69, 0x6a, 0xd2, 0xe9, 0xbb, 0xca, 0x7d, 0x16, 0x99, 0xcf, 0x08, 0x5b, 0x3b, - 0xd6, 0xa9, 0xcc, 0x52, 0x6e, 0xdc, 0x59, 0x2d, 0x70, 0x6a, 0x07, 0x13, 0x2f, 0x68, 0x46, 0xaf, - 0xb7, 0xc3, 0x0b, 0x3b, 0x3d, 0x31, 0xed, 0x8f, 0x78, 0x38, 0x12, 0x0b, 0xe7, 0x90, 0x04, 0xcb, - 0xfb, 0x24, 0x5b, 0xaf, 0x45, 0xcb, 0x34, 0xf1, 0x3b, 0x80, 0x2f, 0x1d, 0x94, 0x78, 0x66, 0xa2, - 0x97, 0xc6, 0xbd, 0x96, 0x46, 0xbc, 0x46, 0x2b, 0x3c, 0xc7, 0x56, 0x79, 0x81, 0x37, 0xd2, 0x6f, - 0x1e, 0x2b, 0x82, 0xf6, 0x67, 0x12, 0xcc, 0x0e, 0x1f, 0x9f, 0x32, 0x48, 0xed, 0xa2, 0x90, 0x36, - 0xda, 0xf1, 0x86, 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 0x96, 0x71, 0xaa, 0x4e, 0x18, 0xa2, 0xe8, 0x5a, 0x28, 0x8d, - 0xa3, 0x4d, 0xe3, 0x9a, 0x71, 0xc5, 0x32, 0x8a, 0x62, 0x3a, 0x07, 0x7b, 0x7d, 0x75, 0x9e, 0xe1, - 0x4d, 0xf4, 0x35, 0x6a, 0x10, 0x74, 0xa4, 0xfe, 0x66, 0xa1, 0x74, 0xdd, 0x28, 0x8a, 0x27, 0x86, - 0xf5, 0x37, 0x1d, 0xaf, 0x85, 0x5c, 0x56, 0x4e, 0xbd, 0xfc, 0xf4, 0x95, 0x9c, 0x78, 0xf1, 0x4a, - 0x4e, 0x7c, 0xbb, 0x27, 0x27, 0x9e, 0xee, 0xc9, 0xc2, 0xb3, 0x3d, 0x59, 0xf8, 0x6d, 0x4f, 0x16, - 0x1e, 0xbe, 0x96, 0x13, 0xcf, 0x5e, 0xcb, 0x89, 0x17, 0xaf, 0xe5, 0xc4, 0xed, 0x7f, 0x9e, 0x5f, - 0xf7, 0xe9, 0x7f, 0x55, 0xf4, 0xd8, 0x6e, 0x65, 0xe8, 0x44, 0xf8, 0xf8, 0xef, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x0c, 0xf2, 0xd0, 0x1b, 0x70, 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.ProposalId != that1.ProposalId { - return false - } - if len(this.Messages) != len(that1.Messages) { - return false - } - for i := range this.Messages { - if !this.Messages[i].Equal(that1.Messages[i]) { - return false - } - } - if this.Status != that1.Status { - 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 + // 1010 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0x41, 0x6f, 0xdb, 0x36, + 0x14, 0x8e, 0x6c, 0xc7, 0x49, 0x9e, 0x1d, 0x57, 0x63, 0x83, 0x56, 0x49, 0x33, 0x25, 0x33, 0xb0, + 0xc2, 0x28, 0x10, 0xb9, 0xc9, 0x80, 0x1e, 0x76, 0x18, 0x66, 0x47, 0xea, 0xaa, 0x22, 0x8d, 0x0c, + 0x49, 0x75, 0xb0, 0x5d, 0x04, 0x39, 0x62, 0x65, 0x6d, 0x96, 0xe8, 0x89, 0x74, 0x9a, 0xfc, 0x84, + 0xdd, 0x7a, 0x19, 0x30, 0xec, 0x2f, 0xec, 0xda, 0x1f, 0xb1, 0xd3, 0x56, 0x14, 0x18, 0xb0, 0xdb, + 0x86, 0xe4, 0x8f, 0x14, 0xa2, 0xa8, 0xc4, 0x71, 0x02, 0xc4, 0x27, 0x93, 0xef, 0x7d, 0xdf, 0xc7, + 0xf7, 0xc8, 0x8f, 0x94, 0x61, 0xf3, 0x98, 0xd0, 0x98, 0xd0, 0x76, 0x48, 0x4e, 0xda, 0x27, 0xbb, + 0x03, 0xcc, 0xfc, 0xbd, 0x6c, 0xac, 0x8d, 0x53, 0xc2, 0x08, 0x42, 0x79, 0x56, 0xcb, 0x22, 0x22, + 0xbb, 0xa1, 0x0a, 0xc6, 0xc0, 0xa7, 0x58, 0x50, 0x76, 0xdb, 0xc7, 0x24, 0x4a, 0x72, 0xce, 0xc6, + 0x5a, 0x48, 0x42, 0xc2, 0x87, 0xed, 0x6c, 0x24, 0xa2, 0x5b, 0x21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f, 0xe6, 0x05, 0x88, 0xd0, 0x55, 0x63, 0x2b, 0x73, 0x6a, + 0xad, 0xe6, 0x44, 0xd1, 0x57, 0xf3, 0x0f, 0x09, 0x6a, 0xd3, 0xdb, 0xbe, 0x0d, 0xe5, 0x33, 0x4c, + 0xb9, 0x99, 0xae, 0x5f, 0x0f, 0x33, 0x61, 0x76, 0x96, 0x42, 0x2d, 0x58, 0xf2, 0x07, 0x94, 0xf9, + 0x51, 0x72, 0xcb, 0x25, 0xca, 0x50, 0x45, 0x1a, 0xa9, 0x50, 0x4a, 0x08, 0x77, 0xd2, 0x4d, 0x50, + 0x29, 0x21, 0xe8, 0x29, 0xd4, 0x13, 0xe2, 0xbd, 0x8d, 0xd8, 0xd0, 0x3b, 0xc1, 0x8c, 0x70, 0xaf, + 0xdc, 0x44, 0x42, 0x42, 0x8e, 0x22, 0x36, 0xec, 0x63, 0x46, 0x9a, 0xff, 0x48, 0x50, 0xc9, 0xae, + 0xf5, 0xdd, 0xde, 0xd7, 0x60, 0xf1, 0x84, 0x30, 0x7c, 0xf7, 0x85, 0xcc, 0x61, 0x99, 0xf3, 0xc5, + 0x8b, 0x52, 0x9e, 0xe7, 0x45, 0xe9, 0x96, 0x14, 0xe9, 0xf2, 0x55, 0xf9, 0x16, 0x96, 0xf2, 0x11, + 0x55, 0x2a, 0xdc, 0x15, 0x8f, 0x6f, 0x23, 0xdf, 0x7c, 0xc6, 0xec, 0x82, 0xd6, 0xfc, 0x5d, 0x82, + 0x55, 0xe1, 0x94, 0x9e, 0x9f, 0xfa, 0x71, 0x76, 0x13, 0x6b, 0x71, 0x94, 0x5c, 0xba, 0x4d, 0xba, + 0xcb, 0x6d, 0x10, 0x47, 0x49, 0xe1, 0xb5, 0x57, 0x80, 0x62, 0xff, 0xb4, 0xe0, 0x7a, 0x63, 0x9c, + 0x46, 0x24, 0xe0, 0x1b, 0x91, 0x49, 0xcc, 0x1a, 0x44, 0x17, 0x6f, 0x71, 0xb7, 0xf2, 0x5b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0xd0, 0x8d, 0x9e, 0xe5, 0x98, 0xae, 0xd7, 0x33, 0x6c, 0xd3, 0xd2, 0x65, 0x09, + 0x7d, 0x01, 0x9f, 0xcf, 0x62, 0xfa, 0x96, 0x6b, 0x1e, 0x7e, 0x57, 0x40, 0x4a, 0x68, 0x03, 0x1e, + 0xcc, 0x42, 0x7a, 0x1d, 0xc7, 0x31, 0xf4, 0xbc, 0xe8, 0xd9, 0x9c, 0x6d, 0xbc, 0x34, 0xf6, 0x5d, + 0x43, 0x97, 0x2b, 0xb7, 0x31, 0x9f, 0x77, 0xcc, 0x03, 0x43, 0x97, 0x17, 0xbb, 0xdd, 0x3f, 0xcf, + 0x55, 0xe9, 0xc3, 0xb9, 0x2a, 0xfd, 0x7f, 0xae, 0x4a, 0xef, 0x2e, 0xd4, 0x85, 0x0f, 0x17, 0xea, + 0xc2, 0xbf, 0x17, 0xea, 0xc2, 0x0f, 0xad, 0x30, 0x62, 0xc3, 0xc9, 0x40, 0x3b, 0x26, 0xb1, 0xf8, + 0xa8, 0x8b, 0x9f, 0x1d, 0x1a, 0xfc, 0xd4, 0x3e, 0xe5, 0x7f, 0x59, 0xd8, 0xd9, 0x18, 0xd3, 0x41, + 0x95, 0x7b, 0xe6, 0xab, 0x4f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xe3, 0x04, 0xa9, 0xcd, 0x08, + 0x00, 0x00, } -func (this *TallyResult) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*TallyResult) - if !ok { - that2, ok := that.(TallyResult) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Yes.Equal(that1.Yes) { - return false - } - if !this.Abstain.Equal(that1.Abstain) { - return false - } - if !this.No.Equal(that1.No) { - return false - } - if !this.NoWithVeto.Equal(that1.NoWithVeto) { - return false - } - return true -} func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -668,16 +758,13 @@ func (m *WeightedVoteOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size := m.Weight.Size() - i -= size - if _, err := m.Weight.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) + if len(m.Weight) > 0 { + i -= len(m.Weight) + copy(dAtA[i:], m.Weight) + i = encodeVarintGov(dAtA, i, uint64(len(m.Weight))) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 if m.Option != 0 { i = encodeVarintGov(dAtA, i, uint64(m.Option)) i-- @@ -755,22 +842,26 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintGov(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x4a - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintGov(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x42 + if m.VotingEndTime != nil { + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.VotingEndTime):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintGov(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x4a + } + if m.VotingStartTime != nil { + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.VotingStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.VotingStartTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintGov(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x42 + } if len(m.TotalDeposit) > 0 { for iNdEx := len(m.TotalDeposit) - 1; iNdEx >= 0; iNdEx-- { { @@ -785,32 +876,38 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x3a } } - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DepositEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintGov(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0x32 - n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) - if err4 != nil { - return 0, err4 - } - i -= n4 - i = encodeVarintGov(dAtA, i, uint64(n4)) - i-- - dAtA[i] = 0x2a - { - size, err := m.FinalTallyResult.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.DepositEndTime != nil { + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.DepositEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.DepositEndTime):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintGov(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x32 + } + if m.SubmitTime != nil { + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.SubmitTime):]) + if err4 != nil { + return 0, err4 } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) + i -= n4 + i = encodeVarintGov(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x2a + } + if m.FinalTallyResult != nil { + { + size, err := m.FinalTallyResult.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 } - i-- - dAtA[i] = 0x22 if m.Status != 0 { i = encodeVarintGov(dAtA, i, uint64(m.Status)) i-- @@ -858,46 +955,34 @@ func (m *TallyResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size := m.NoWithVeto.Size() - i -= size - if _, err := m.NoWithVeto.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size := m.No.Size() - i -= size - if _, err := m.No.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.Abstain.Size() - i -= size - if _, err := m.Abstain.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Yes.Size() - i -= size - if _, err := m.Yes.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) + if len(m.NoWithVeto) > 0 { + i -= len(m.NoWithVeto) + copy(dAtA[i:], m.NoWithVeto) + i = encodeVarintGov(dAtA, i, uint64(len(m.NoWithVeto))) + i-- + dAtA[i] = 0x22 + } + if len(m.No) > 0 { + i -= len(m.No) + copy(dAtA[i:], m.No) + i = encodeVarintGov(dAtA, i, uint64(len(m.No))) + i-- + dAtA[i] = 0x1a + } + if len(m.Abstain) > 0 { + i -= len(m.Abstain) + copy(dAtA[i:], m.Abstain) + i = encodeVarintGov(dAtA, i, uint64(len(m.Abstain))) + i-- + dAtA[i] = 0x12 + } + if len(m.Yes) > 0 { + i -= len(m.Yes) + copy(dAtA[i:], m.Yes) + i = encodeVarintGov(dAtA, i, uint64(len(m.Yes))) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -975,14 +1060,16 @@ func (m *DepositParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n6, err6 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxDepositPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxDepositPeriod):]) - if err6 != nil { - return 0, err6 - } - i -= n6 - i = encodeVarintGov(dAtA, i, uint64(n6)) - i-- - dAtA[i] = 0x12 + if m.MaxDepositPeriod != nil { + n6, err6 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) + if err6 != nil { + return 0, err6 + } + i -= n6 + i = encodeVarintGov(dAtA, i, uint64(n6)) + i-- + dAtA[i] = 0x12 + } if len(m.MinDeposit) > 0 { for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { { @@ -1020,14 +1107,16 @@ func (m *VotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.VotingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod):]) - if err7 != nil { - return 0, err7 - } - i -= n7 - i = encodeVarintGov(dAtA, i, uint64(n7)) - i-- - dAtA[i] = 0xa + if m.VotingPeriod != nil { + n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.VotingPeriod):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintGov(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -1051,36 +1140,27 @@ func (m *TallyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size := m.VetoThreshold.Size() - i -= size - if _, err := m.VetoThreshold.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.Threshold.Size() - i -= size - if _, err := m.Threshold.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Quorum.Size() - i -= size - if _, err := m.Quorum.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) + if len(m.VetoThreshold) > 0 { + i -= len(m.VetoThreshold) + copy(dAtA[i:], m.VetoThreshold) + i = encodeVarintGov(dAtA, i, uint64(len(m.VetoThreshold))) + i-- + dAtA[i] = 0x1a + } + if len(m.Threshold) > 0 { + i -= len(m.Threshold) + copy(dAtA[i:], m.Threshold) + i = encodeVarintGov(dAtA, i, uint64(len(m.Threshold))) + i-- + dAtA[i] = 0x12 + } + if len(m.Quorum) > 0 { + i -= len(m.Quorum) + copy(dAtA[i:], m.Quorum) + i = encodeVarintGov(dAtA, i, uint64(len(m.Quorum))) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1104,8 +1184,10 @@ func (m *WeightedVoteOption) Size() (n int) { if m.Option != 0 { n += 1 + sovGov(uint64(m.Option)) } - l = m.Weight.Size() - n += 1 + l + sovGov(uint64(l)) + l = len(m.Weight) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } return n } @@ -1149,22 +1231,32 @@ func (m *Proposal) Size() (n int) { if m.Status != 0 { n += 1 + sovGov(uint64(m.Status)) } - 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 m.FinalTallyResult != nil { + l = m.FinalTallyResult.Size() + n += 1 + l + sovGov(uint64(l)) + } + if m.SubmitTime != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.SubmitTime) + n += 1 + l + sovGov(uint64(l)) + } + if m.DepositEndTime != nil { + 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)) + if m.VotingStartTime != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.VotingStartTime) + n += 1 + l + sovGov(uint64(l)) + } + if m.VotingEndTime != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.VotingEndTime) + n += 1 + l + sovGov(uint64(l)) + } return n } @@ -1174,14 +1266,22 @@ func (m *TallyResult) Size() (n int) { } var l int _ = l - l = m.Yes.Size() - n += 1 + l + sovGov(uint64(l)) - l = m.Abstain.Size() - n += 1 + l + sovGov(uint64(l)) - l = m.No.Size() - n += 1 + l + sovGov(uint64(l)) - l = m.NoWithVeto.Size() - n += 1 + l + sovGov(uint64(l)) + l = len(m.Yes) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Abstain) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.No) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.NoWithVeto) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } return n } @@ -1222,8 +1322,10 @@ func (m *DepositParams) Size() (n int) { n += 1 + l + sovGov(uint64(l)) } } - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxDepositPeriod) - n += 1 + l + sovGov(uint64(l)) + if m.MaxDepositPeriod != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.MaxDepositPeriod) + n += 1 + l + sovGov(uint64(l)) + } return n } @@ -1233,8 +1335,10 @@ func (m *VotingParams) Size() (n int) { } var l int _ = l - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod) - n += 1 + l + sovGov(uint64(l)) + if m.VotingPeriod != nil { + l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.VotingPeriod) + n += 1 + l + sovGov(uint64(l)) + } return n } @@ -1244,12 +1348,18 @@ func (m *TallyParams) Size() (n int) { } var l int _ = l - l = m.Quorum.Size() - n += 1 + l + sovGov(uint64(l)) - l = m.Threshold.Size() - n += 1 + l + sovGov(uint64(l)) - l = m.VetoThreshold.Size() - n += 1 + l + sovGov(uint64(l)) + l = len(m.Quorum) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Threshold) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.VetoThreshold) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } return n } @@ -1337,9 +1447,7 @@ func (m *WeightedVoteOption) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Weight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Weight = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1471,7 +1579,7 @@ func (m *Deposit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types.Coin{}) + m.Amount = append(m.Amount, &types.Coin{}) if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1627,6 +1735,9 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.FinalTallyResult == nil { + m.FinalTallyResult = &TallyResult{} + } if err := m.FinalTallyResult.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1660,7 +1771,10 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.SubmitTime, dAtA[iNdEx:postIndex]); err != nil { + if m.SubmitTime == nil { + m.SubmitTime = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.SubmitTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1693,7 +1807,10 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.DepositEndTime, dAtA[iNdEx:postIndex]); err != nil { + if m.DepositEndTime == nil { + m.DepositEndTime = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.DepositEndTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1726,7 +1843,7 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TotalDeposit = append(m.TotalDeposit, types.Coin{}) + m.TotalDeposit = append(m.TotalDeposit, &types.Coin{}) if err := m.TotalDeposit[len(m.TotalDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1760,7 +1877,10 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.VotingStartTime, dAtA[iNdEx:postIndex]); err != nil { + if m.VotingStartTime == nil { + m.VotingStartTime = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.VotingStartTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1793,7 +1913,10 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.VotingEndTime, dAtA[iNdEx:postIndex]); err != nil { + if m.VotingEndTime == nil { + m.VotingEndTime = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.VotingEndTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1877,9 +2000,7 @@ func (m *TallyResult) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Yes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Yes = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -1911,9 +2032,7 @@ func (m *TallyResult) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Abstain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Abstain = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -1945,9 +2064,7 @@ func (m *TallyResult) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.No.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.No = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { @@ -1979,9 +2096,7 @@ func (m *TallyResult) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.NoWithVeto.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.NoWithVeto = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2132,7 +2247,7 @@ func (m *Vote) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Options = append(m.Options, WeightedVoteOption{}) + m.Options = append(m.Options, &WeightedVoteOption{}) if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2216,7 +2331,7 @@ func (m *DepositParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MinDeposit = append(m.MinDeposit, types.Coin{}) + m.MinDeposit = append(m.MinDeposit, &types.Coin{}) if err := m.MinDeposit[len(m.MinDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2250,7 +2365,10 @@ func (m *DepositParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.MaxDepositPeriod, dAtA[iNdEx:postIndex]); err != nil { + if m.MaxDepositPeriod == nil { + m.MaxDepositPeriod = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.MaxDepositPeriod, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2333,7 +2451,10 @@ func (m *VotingParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.VotingPeriod, dAtA[iNdEx:postIndex]); err != nil { + if m.VotingPeriod == nil { + m.VotingPeriod = new(time.Duration) + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.VotingPeriod, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2416,8 +2537,9 @@ func (m *TallyParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Quorum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Quorum = append(m.Quorum[:0], dAtA[iNdEx:postIndex]...) + if m.Quorum == nil { + m.Quorum = []byte{} } iNdEx = postIndex case 2: @@ -2449,8 +2571,9 @@ func (m *TallyParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Threshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Threshold = append(m.Threshold[:0], dAtA[iNdEx:postIndex]...) + if m.Threshold == nil { + m.Threshold = []byte{} } iNdEx = postIndex case 3: @@ -2482,8 +2605,9 @@ func (m *TallyParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.VetoThreshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.VetoThreshold = append(m.VetoThreshold[:0], dAtA[iNdEx:postIndex]...) + if m.VetoThreshold == nil { + m.VetoThreshold = []byte{} } iNdEx = postIndex default: diff --git a/x/gov/types/query.pb.go b/x/gov/types/query.pb.go index 606cc1ff783d..d696f322c0c7 100644 --- a/x/gov/types/query.pb.go +++ b/x/gov/types/query.pb.go @@ -8,7 +8,6 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" query "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -79,7 +78,7 @@ func (m *QueryProposalRequest) GetProposalId() uint64 { // QueryProposalResponse is the response type for the Query/Proposal RPC method. type QueryProposalResponse struct { - Proposal Proposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal"` + Proposal *Proposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal,omitempty"` } func (m *QueryProposalResponse) Reset() { *m = QueryProposalResponse{} } @@ -115,11 +114,11 @@ func (m *QueryProposalResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryProposalResponse proto.InternalMessageInfo -func (m *QueryProposalResponse) GetProposal() Proposal { +func (m *QueryProposalResponse) GetProposal() *Proposal { if m != nil { return m.Proposal } - return Proposal{} + return nil } // QueryProposalsRequest is the request type for the Query/Proposals RPC method. @@ -167,10 +166,38 @@ func (m *QueryProposalsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryProposalsRequest proto.InternalMessageInfo +func (m *QueryProposalsRequest) GetProposalStatus() ProposalStatus { + if m != nil { + return m.ProposalStatus + } + return ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED +} + +func (m *QueryProposalsRequest) GetVoter() string { + if m != nil { + return m.Voter + } + return "" +} + +func (m *QueryProposalsRequest) GetDepositor() string { + if m != nil { + return m.Depositor + } + return "" +} + +func (m *QueryProposalsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + // QueryProposalsResponse is the response type for the Query/Proposals RPC // method. type QueryProposalsResponse struct { - Proposals []Proposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals"` + Proposals []*Proposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals,omitempty"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -208,7 +235,7 @@ func (m *QueryProposalsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryProposalsResponse proto.InternalMessageInfo -func (m *QueryProposalsResponse) GetProposals() []Proposal { +func (m *QueryProposalsResponse) GetProposals() []*Proposal { if m != nil { return m.Proposals } @@ -263,10 +290,24 @@ func (m *QueryVoteRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryVoteRequest proto.InternalMessageInfo +func (m *QueryVoteRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *QueryVoteRequest) GetVoter() string { + if m != nil { + return m.Voter + } + return "" +} + // 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 *Vote `protobuf:"bytes,1,opt,name=vote,proto3" json:"vote,omitempty"` } func (m *QueryVoteResponse) Reset() { *m = QueryVoteResponse{} } @@ -302,11 +343,11 @@ func (m *QueryVoteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryVoteResponse proto.InternalMessageInfo -func (m *QueryVoteResponse) GetVote() Vote { +func (m *QueryVoteResponse) GetVote() *Vote { if m != nil { return m.Vote } - return Vote{} + return nil } // QueryVotesRequest is the request type for the Query/Votes RPC method. @@ -367,7 +408,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 []*Vote `protobuf:"bytes,1,rep,name=votes,proto3" json:"votes,omitempty"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -405,7 +446,7 @@ func (m *QueryVotesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryVotesResponse proto.InternalMessageInfo -func (m *QueryVotesResponse) GetVotes() []Vote { +func (m *QueryVotesResponse) GetVotes() []*Vote { if m != nil { return m.Votes } @@ -469,11 +510,11 @@ func (m *QueryParamsRequest) GetParamsType() string { // QueryParamsResponse is the response type for the Query/Params RPC method. type QueryParamsResponse struct { // voting_params defines the parameters related to voting. - VotingParams VotingParams `protobuf:"bytes,1,opt,name=voting_params,json=votingParams,proto3" json:"voting_params"` + VotingParams *VotingParams `protobuf:"bytes,1,opt,name=voting_params,json=votingParams,proto3" json:"voting_params,omitempty"` // deposit_params defines the parameters related to deposit. - DepositParams DepositParams `protobuf:"bytes,2,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params"` + DepositParams *DepositParams `protobuf:"bytes,2,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params,omitempty"` // tally_params defines the parameters related to tally. - TallyParams TallyParams `protobuf:"bytes,3,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params"` + TallyParams *TallyParams `protobuf:"bytes,3,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params,omitempty"` } func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } @@ -509,25 +550,25 @@ func (m *QueryParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo -func (m *QueryParamsResponse) GetVotingParams() VotingParams { +func (m *QueryParamsResponse) GetVotingParams() *VotingParams { if m != nil { return m.VotingParams } - return VotingParams{} + return nil } -func (m *QueryParamsResponse) GetDepositParams() DepositParams { +func (m *QueryParamsResponse) GetDepositParams() *DepositParams { if m != nil { return m.DepositParams } - return DepositParams{} + return nil } -func (m *QueryParamsResponse) GetTallyParams() TallyParams { +func (m *QueryParamsResponse) GetTallyParams() *TallyParams { if m != nil { return m.TallyParams } - return TallyParams{} + return nil } // QueryDepositRequest is the request type for the Query/Deposit RPC method. @@ -571,10 +612,24 @@ func (m *QueryDepositRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryDepositRequest proto.InternalMessageInfo +func (m *QueryDepositRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *QueryDepositRequest) GetDepositor() string { + if m != nil { + return m.Depositor + } + return "" +} + // 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 *Deposit `protobuf:"bytes,1,opt,name=deposit,proto3" json:"deposit,omitempty"` } func (m *QueryDepositResponse) Reset() { *m = QueryDepositResponse{} } @@ -610,11 +665,11 @@ func (m *QueryDepositResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryDepositResponse proto.InternalMessageInfo -func (m *QueryDepositResponse) GetDeposit() Deposit { +func (m *QueryDepositResponse) GetDeposit() *Deposit { if m != nil { return m.Deposit } - return Deposit{} + return nil } // QueryDepositsRequest is the request type for the Query/Deposits RPC method. @@ -674,7 +729,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 []*Deposit `protobuf:"bytes,1,rep,name=deposits,proto3" json:"deposits,omitempty"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -712,7 +767,7 @@ func (m *QueryDepositsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryDepositsResponse proto.InternalMessageInfo -func (m *QueryDepositsResponse) GetDeposits() []Deposit { +func (m *QueryDepositsResponse) GetDeposits() []*Deposit { if m != nil { return m.Deposits } @@ -775,7 +830,7 @@ func (m *QueryTallyResultRequest) GetProposalId() uint64 { // QueryTallyResultResponse is the response type for the Query/Tally RPC method. type QueryTallyResultResponse struct { // tally defines the requested tally. - Tally TallyResult `protobuf:"bytes,1,opt,name=tally,proto3" json:"tally"` + Tally *TallyResult `protobuf:"bytes,1,opt,name=tally,proto3" json:"tally,omitempty"` } func (m *QueryTallyResultResponse) Reset() { *m = QueryTallyResultResponse{} } @@ -811,11 +866,11 @@ func (m *QueryTallyResultResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryTallyResultResponse proto.InternalMessageInfo -func (m *QueryTallyResultResponse) GetTally() TallyResult { +func (m *QueryTallyResultResponse) GetTally() *TallyResult { if m != nil { return m.Tally } - return TallyResult{} + return nil } func init() { @@ -840,70 +895,67 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1beta2/query.proto", fileDescriptor_3efdc0c4615c3665) } var fileDescriptor_3efdc0c4615c3665 = []byte{ - // 998 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x41, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0x38, 0x4e, 0x6b, 0x4f, 0xda, 0x00, 0x8f, 0x00, 0xc6, 0x14, 0x3b, 0xac, 0x68, 0x6b, - 0x52, 0xb2, 0x4b, 0x9c, 0x52, 0xd4, 0x16, 0x50, 0x6b, 0xa1, 0xb6, 0xa8, 0x12, 0x0a, 0x4e, 0x05, - 0x12, 0x97, 0x68, 0x53, 0xaf, 0x96, 0x15, 0x8e, 0x67, 0xbb, 0x33, 0xb6, 0x1a, 0x85, 0x08, 0x89, - 0x13, 0x88, 0x0b, 0xa8, 0x88, 0x1b, 0x50, 0xa9, 0x12, 0xbf, 0x80, 0x1f, 0xd1, 0x63, 0x05, 0x1c, - 0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0xff, 0xaf, 0xda, - 0x91, 0x66, 0xd2, 0x0d, 0x00, 0x00, + // 952 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0x38, 0x49, 0x1b, 0xbf, 0xb4, 0x01, 0x1e, 0x05, 0x8c, 0x29, 0x4e, 0x58, 0xd1, 0xd6, + 0xa4, 0xcd, 0x2e, 0x49, 0x68, 0x4b, 0x0b, 0x07, 0x62, 0x41, 0x29, 0x42, 0x48, 0xa9, 0x5b, 0x71, + 0xe0, 0x12, 0x6d, 0xe2, 0xd5, 0xb2, 0xc2, 0xd9, 0xd9, 0x7a, 0xc6, 0x16, 0x51, 0x88, 0x90, 0xb8, + 0x21, 0x84, 0x04, 0xa2, 0x42, 0xe2, 0xd0, 0x13, 0x12, 0x9f, 0x80, 0x0f, 0xc1, 0xb1, 0x02, 0x0e, + 0x1c, 0x51, 0xc2, 0x89, 0x4f, 0x81, 0x76, 0xe6, 0xcd, 0x7a, 0xd7, 0x59, 0x7b, 0xed, 0x12, 0xf5, + 0x14, 0xcd, 0xcc, 0xef, 0xbd, 0xf7, 0x7b, 0x7f, 0xf6, 0xf7, 0x62, 0xa8, 0xed, 0x70, 0xb1, 0xcb, + 0x85, 0xe3, 0xf3, 0x9e, 0xd3, 0x5b, 0xdd, 0xf6, 0xa4, 0xbb, 0xe6, 0xdc, 0xef, 0x7a, 0x9d, 0x3d, + 0x3b, 0xea, 0x70, 0xc9, 0x11, 0xf5, 0xbb, 0xed, 0xf3, 0x9e, 0x4d, 0xef, 0xd5, 0x65, 0xb2, 0xd9, + 0x76, 0x85, 0xa7, 0xc1, 0x64, 0xba, 0xea, 0x44, 0xae, 0x1f, 0x84, 0xae, 0x0c, 0x78, 0xa8, 0xed, + 0xab, 0xe7, 0x7d, 0xce, 0xfd, 0xb6, 0xe7, 0xb8, 0x51, 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be, + 0x3b, 0xaa, 0x4d, 0x3d, 0x3a, 0xaa, 0x4d, 0xfd, 0x75, 0x54, 0x9b, 0xfa, 0xa4, 0xee, 0x07, 0xf2, + 0xd3, 0xee, 0xb6, 0xbd, 0xc3, 0x77, 0x8d, 0x5b, 0xfd, 0x67, 0x45, 0xb4, 0x3e, 0x73, 0x3e, 0x57, + 0x31, 0xe2, 0x91, 0x11, 0xdb, 0xa7, 0xd4, 0x2f, 0x95, 0xf5, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, + 0x6d, 0xa1, 0x92, 0x20, 0x62, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1302,16 +1354,18 @@ func (m *QueryProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Proposal != nil { + { + size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1473,16 +1527,18 @@ func (m *QueryVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Vote != nil { + { + size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1625,36 +1681,42 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.TallyParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.TallyParams != nil { + { + size, err := m.TallyParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a } - i-- - dAtA[i] = 0x1a - { - size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.DepositParams != nil { + { + size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 - { - size, err := m.VotingParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.VotingParams != nil { + { + size, err := m.VotingParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1713,16 +1775,18 @@ func (m *QueryDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.Deposit.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Deposit != nil { + { + size, err := m.Deposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1863,16 +1927,18 @@ func (m *QueryTallyResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - { - size, err := m.Tally.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Tally != nil { + { + size, err := m.Tally.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1905,8 +1971,10 @@ func (m *QueryProposalResponse) Size() (n int) { } var l int _ = l - l = m.Proposal.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Proposal != nil { + l = m.Proposal.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -1975,8 +2043,10 @@ func (m *QueryVoteResponse) Size() (n int) { } var l int _ = l - l = m.Vote.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Vote != nil { + l = m.Vote.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -2034,12 +2104,18 @@ func (m *QueryParamsResponse) Size() (n int) { } var l int _ = l - l = m.VotingParams.Size() - n += 1 + l + sovQuery(uint64(l)) - l = m.DepositParams.Size() - n += 1 + l + sovQuery(uint64(l)) - l = m.TallyParams.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.VotingParams != nil { + l = m.VotingParams.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.DepositParams != nil { + l = m.DepositParams.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.TallyParams != nil { + l = m.TallyParams.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -2065,8 +2141,10 @@ func (m *QueryDepositResponse) Size() (n int) { } var l int _ = l - l = m.Deposit.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Deposit != nil { + l = m.Deposit.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -2123,8 +2201,10 @@ func (m *QueryTallyResultResponse) Size() (n int) { } var l int _ = l - l = m.Tally.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Tally != nil { + l = m.Tally.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -2261,6 +2341,9 @@ func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.Proposal == nil { + m.Proposal = &Proposal{} + } if err := m.Proposal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2513,7 +2596,7 @@ func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Proposals = append(m.Proposals, Proposal{}) + m.Proposals = append(m.Proposals, &Proposal{}) if err := m.Proposals[len(m.Proposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2734,6 +2817,9 @@ func (m *QueryVoteResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.Vote == nil { + m.Vote = &Vote{} + } if err := m.Vote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2922,7 +3008,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, &Vote{}) if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -3124,6 +3210,9 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.VotingParams == nil { + m.VotingParams = &VotingParams{} + } if err := m.VotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -3157,6 +3246,9 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.DepositParams == nil { + m.DepositParams = &DepositParams{} + } if err := m.DepositParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -3190,6 +3282,9 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.TallyParams == nil { + m.TallyParams = &TallyParams{} + } if err := m.TallyParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -3374,6 +3469,9 @@ func (m *QueryDepositResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.Deposit == nil { + m.Deposit = &Deposit{} + } if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -3562,7 +3660,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, &Deposit{}) if err := m.Deposits[len(m.Deposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -3751,6 +3849,9 @@ func (m *QueryTallyResultResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.Tally == nil { + m.Tally = &TallyResult{} + } if err := m.Tally.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/gov/types/tx.pb.go b/x/gov/types/tx.pb.go index 1ba0d1d0c49a..5c520165c837 100644 --- a/x/gov/types/tx.pb.go +++ b/x/gov/types/tx.pb.go @@ -8,9 +8,7 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" types "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" - _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" @@ -35,13 +33,14 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary // proposal Content. type MsgSubmitProposal struct { - Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` - InitialDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"initial_deposit"` - Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` + Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` + InitialDeposit []*types1.Coin `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3" json:"initial_deposit,omitempty"` + Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` } -func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } -func (*MsgSubmitProposal) ProtoMessage() {} +func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } +func (m *MsgSubmitProposal) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitProposal) ProtoMessage() {} func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { return fileDescriptor_4214261f6b3f9ed4, []int{0} } @@ -72,9 +71,30 @@ func (m *MsgSubmitProposal) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSubmitProposal proto.InternalMessageInfo +func (m *MsgSubmitProposal) GetMessages() []*types.Any { + if m != nil { + return m.Messages + } + return nil +} + +func (m *MsgSubmitProposal) GetInitialDeposit() []*types1.Coin { + if m != nil { + return m.InitialDeposit + } + return nil +} + +func (m *MsgSubmitProposal) GetProposer() string { + if m != nil { + return m.Proposer + } + return "" +} + // MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. type MsgSubmitProposalResponse struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id"` + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` } func (m *MsgSubmitProposalResponse) Reset() { *m = MsgSubmitProposalResponse{} } @@ -119,13 +139,14 @@ func (m *MsgSubmitProposalResponse) GetProposalId() uint64 { // MsgVote defines a message to cast a vote. type MsgVote struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id" yaml:"proposal_id"` + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"` } -func (m *MsgVote) Reset() { *m = MsgVote{} } -func (*MsgVote) ProtoMessage() {} +func (m *MsgVote) Reset() { *m = MsgVote{} } +func (m *MsgVote) String() string { return proto.CompactTextString(m) } +func (*MsgVote) ProtoMessage() {} func (*MsgVote) Descriptor() ([]byte, []int) { return fileDescriptor_4214261f6b3f9ed4, []int{2} } @@ -156,6 +177,27 @@ func (m *MsgVote) XXX_DiscardUnknown() { var xxx_messageInfo_MsgVote proto.InternalMessageInfo +func (m *MsgVote) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *MsgVote) GetVoter() string { + if m != nil { + return m.Voter + } + return "" +} + +func (m *MsgVote) GetOption() VoteOption { + if m != nil { + return m.Option + } + return VoteOption_VOTE_OPTION_UNSPECIFIED +} + // MsgVoteResponse defines the Msg/Vote response type. type MsgVoteResponse struct { } @@ -197,13 +239,14 @@ var xxx_messageInfo_MsgVoteResponse proto.InternalMessageInfo // // Since: cosmos-sdk 0.43 type MsgVoteWeighted struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty" yaml:"proposal_id"` - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` - Options []WeightedVoteOption `protobuf:"bytes,3,rep,name=options,proto3" json:"options"` + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` + Options []*WeightedVoteOption `protobuf:"bytes,3,rep,name=options,proto3" json:"options,omitempty"` } -func (m *MsgVoteWeighted) Reset() { *m = MsgVoteWeighted{} } -func (*MsgVoteWeighted) ProtoMessage() {} +func (m *MsgVoteWeighted) Reset() { *m = MsgVoteWeighted{} } +func (m *MsgVoteWeighted) String() string { return proto.CompactTextString(m) } +func (*MsgVoteWeighted) ProtoMessage() {} func (*MsgVoteWeighted) Descriptor() ([]byte, []int) { return fileDescriptor_4214261f6b3f9ed4, []int{4} } @@ -234,6 +277,27 @@ func (m *MsgVoteWeighted) XXX_DiscardUnknown() { var xxx_messageInfo_MsgVoteWeighted proto.InternalMessageInfo +func (m *MsgVoteWeighted) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *MsgVoteWeighted) GetVoter() string { + if m != nil { + return m.Voter + } + return "" +} + +func (m *MsgVoteWeighted) GetOptions() []*WeightedVoteOption { + if m != nil { + return m.Options + } + return nil +} + // MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. // // Since: cosmos-sdk 0.43 @@ -275,13 +339,14 @@ var xxx_messageInfo_MsgVoteWeightedResponse proto.InternalMessageInfo // MsgDeposit defines a message to submit a deposit to an existing proposal. type MsgDeposit struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id"` - Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` + Amount []*types1.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount,omitempty"` } -func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } -func (*MsgDeposit) ProtoMessage() {} +func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } +func (m *MsgDeposit) String() string { return proto.CompactTextString(m) } +func (*MsgDeposit) ProtoMessage() {} func (*MsgDeposit) Descriptor() ([]byte, []int) { return fileDescriptor_4214261f6b3f9ed4, []int{6} } @@ -312,6 +377,27 @@ func (m *MsgDeposit) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDeposit proto.InternalMessageInfo +func (m *MsgDeposit) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *MsgDeposit) GetDepositor() string { + if m != nil { + return m.Depositor + } + return "" +} + +func (m *MsgDeposit) GetAmount() []*types1.Coin { + if m != nil { + return m.Amount + } + return nil +} + // MsgDepositResponse defines the Msg/Deposit response type. type MsgDepositResponse struct { } @@ -363,49 +449,43 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1beta2/tx.proto", fileDescriptor_4214261f6b3f9ed4) } var fileDescriptor_4214261f6b3f9ed4 = []byte{ - // 667 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xcf, 0x4f, 0x13, 0x4f, - 0x14, 0xdf, 0x6d, 0xf9, 0xf2, 0xe3, 0xf1, 0x0d, 0xc8, 0xa4, 0xd1, 0x6d, 0x31, 0xbb, 0x4d, 0x0d, - 0xa4, 0x89, 0x61, 0x17, 0xaa, 0xc1, 0x84, 0x1b, 0xd5, 0x10, 0x3d, 0x34, 0xea, 0x92, 0x68, 0xe2, - 0x05, 0xb7, 0xdd, 0x61, 0x98, 0xd8, 0xee, 0x6c, 0x3a, 0xd3, 0x86, 0xde, 0x4c, 0xbc, 0x78, 0xf4, - 0xe8, 0x91, 0xb3, 0x67, 0xff, 0x08, 0x12, 0x2f, 0xc4, 0x78, 0xf0, 0x60, 0xd0, 0xc0, 0xc5, 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 0x2a, 0x76, 0x46, 0x73, 0x66, 0x60, 0x5a, - 0x99, 0x49, 0x5a, 0x52, 0xf9, 0xa0, 0xa7, 0xb1, 0xc7, 0x98, 0x92, 0x2d, 0x81, 0x7d, 0x74, 0x2b, - 0xcb, 0xe8, 0xe5, 0x7f, 0xe0, 0x6c, 0x0d, 0xc6, 0xe2, 0x5a, 0xb9, 0x91, 0x97, 0x23, 0x36, 0x9f, - 0x65, 0x2d, 0xa9, 0xeb, 0xc8, 0x62, 0x7d, 0x24, 0x9a, 0x37, 0x37, 0x11, 0x67, 0x38, 0x2d, 0xc2, - 0x95, 0x13, 0xae, 0x52, 0xc7, 0x3f, 0x74, 0x80, 0x06, 0x27, 0xc9, 0xe0, 0xfd, 0xf1, 0x4c, 0xa0, - 0x65, 0x98, 0x50, 0x8b, 0xc1, 0xce, 0x77, 0x7a, 0x44, 0x45, 0x2d, 0x18, 0xf5, 0x3a, 0xac, 0x17, - 0x08, 0x65, 0xf6, 0xaf, 0xee, 0x93, 0x4a, 0x9d, 0xd1, 0x8a, 0x02, 0xa0, 0x23, 0xbb, 0x49, 0x17, - 0x6a, 0xdf, 0x73, 0x90, 0x6f, 0x70, 0x82, 0x36, 0x61, 0xea, 0xc4, 0x17, 0x63, 0x2e, 0xeb, 0x0d, - 0x4e, 0xed, 0x54, 0x69, 0xe1, 0x42, 0xb4, 0x74, 0xf5, 0xee, 0xc2, 0x88, 0x5c, 0xa2, 0xd9, 0x33, - 0x64, 0x11, 0x58, 0xba, 0x36, 0x04, 0x4c, 0x33, 0x3d, 0x85, 0xff, 0x7f, 0x9b, 0xd6, 0x61, 0xa2, - 0x84, 0x54, 0xba, 0x7e, 0x01, 0x52, 0x7a, 0xc3, 0x43, 0x18, 0x4b, 0xa6, 0xc3, 0x3c, 0x43, 0xa7, - 0xf0, 0xd2, 0xfc, 0x70, 0x3c, 0x49, 0x59, 0xaf, 0xef, 0x1e, 0x98, 0xfa, 0xde, 0x81, 0xa9, 0x7f, - 0x39, 0x30, 0xf5, 0x57, 0x87, 0xa6, 0xb6, 0x77, 0x68, 0x6a, 0x1f, 0x0f, 0x4d, 0xed, 0xc9, 0xf0, - 0x27, 0xde, 0x96, 0x3f, 0x1c, 0xf2, 0xa1, 0x9b, 0xa3, 0xf2, 0x83, 0x7d, 0xe3, 0x57, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x5d, 0x24, 0xb4, 0x1c, 0xa4, 0x06, 0x00, 0x00, + // 565 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xee, 0x25, 0x25, 0x69, 0x5f, 0x51, 0xaa, 0x9e, 0x22, 0xe1, 0xb8, 0xc8, 0x44, 0x46, 0x54, + 0x91, 0x50, 0xce, 0x24, 0xa0, 0x4e, 0x0c, 0x34, 0x30, 0xc0, 0x10, 0x01, 0xae, 0x04, 0x12, 0x4b, + 0xb0, 0xe3, 0xeb, 0xf5, 0x44, 0xe2, 0xb3, 0x7c, 0x97, 0xa8, 0xf9, 0x17, 0x88, 0x89, 0x1f, 0xc0, + 0x4f, 0x60, 0x67, 0x65, 0xac, 0x98, 0x18, 0x51, 0xb2, 0xf2, 0x23, 0x50, 0xec, 0xb3, 0x0b, 0x4d, + 0x9a, 0x74, 0x60, 0x8a, 0xee, 0xbe, 0xef, 0x7b, 0xf7, 0x7d, 0x79, 0xcf, 0x0f, 0xf6, 0xfb, 0x42, + 0x0e, 0x85, 0x74, 0x98, 0x18, 0x3b, 0xe3, 0x96, 0x4f, 0x95, 0xd7, 0x76, 0xd4, 0x19, 0x89, 0x62, + 0xa1, 0x04, 0xc6, 0x29, 0x48, 0x98, 0x18, 0x13, 0x0d, 0x9a, 0x96, 0x16, 0xf8, 0x9e, 0xa4, 0x5a, + 0xd1, 0x72, 0xfa, 0x82, 0x87, 0xa9, 0xc6, 0xbc, 0xbd, 0xa4, 0xe0,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7, 0x16, 0xfa, 0x35, 0xb5, 0xd0, 0xc7, + 0x99, 0xb5, 0x71, 0x3e, 0xb3, 0x36, 0x7e, 0xce, 0xac, 0x8d, 0x77, 0x0d, 0xc6, 0xd5, 0xe9, 0xc8, + 0x27, 0x7d, 0x31, 0xd4, 0x7b, 0x4d, 0xff, 0x34, 0x65, 0xf0, 0xc1, 0x39, 0x4b, 0xf6, 0xa1, 0x9a, + 0x44, 0x54, 0xfa, 0xa5, 0x64, 0x3b, 0x3d, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x12, 0x5c, + 0x07, 0x7b, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1137,7 +1217,7 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.InitialDeposit = append(m.InitialDeposit, types1.Coin{}) + m.InitialDeposit = append(m.InitialDeposit, &types1.Coin{}) if err := m.InitialDeposit[len(m.InitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1543,7 +1623,7 @@ func (m *MsgVoteWeighted) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Options = append(m.Options, WeightedVoteOption{}) + m.Options = append(m.Options, &WeightedVoteOption{}) if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1728,7 +1808,7 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types1.Coin{}) + m.Amount = append(m.Amount, &types1.Coin{}) if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/gov/types/v1beta2/genesis.pb.go b/x/gov/types/v1beta2/genesis.pb.go deleted file mode 100644 index 36df7540052d..000000000000 --- a/x/gov/types/v1beta2/genesis.pb.go +++ /dev/null @@ -1,684 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/gov/v1beta2/genesis.proto - -package v1beta2 - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// 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 - -// 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"` - // deposits defines all the deposits present at genesis. - Deposits []*Deposit `protobuf:"bytes,2,rep,name=deposits,proto3" json:"deposits,omitempty"` - // votes defines all the votes present at genesis. - Votes []*Vote `protobuf:"bytes,3,rep,name=votes,proto3" json:"votes,omitempty"` - // proposals defines all the proposals present at genesis. - Proposals []*Proposal `protobuf:"bytes,4,rep,name=proposals,proto3" json:"proposals,omitempty"` - // params defines all the paramaters of related to deposit. - DepositParams *DepositParams `protobuf:"bytes,5,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params,omitempty"` - // params defines all the paramaters of related to voting. - VotingParams *VotingParams `protobuf:"bytes,6,opt,name=voting_params,json=votingParams,proto3" json:"voting_params,omitempty"` - // params defines all the paramaters of related to tally. - TallyParams *TallyParams `protobuf:"bytes,7,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params,omitempty"` -} - -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_7915ab39bb5aa171, []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 - -func (m *GenesisState) GetStartingProposalId() uint64 { - if m != nil { - return m.StartingProposalId - } - return 0 -} - -func (m *GenesisState) GetDeposits() []*Deposit { - if m != nil { - return m.Deposits - } - return nil -} - -func (m *GenesisState) GetVotes() []*Vote { - if m != nil { - return m.Votes - } - return nil -} - -func (m *GenesisState) GetProposals() []*Proposal { - if m != nil { - return m.Proposals - } - return nil -} - -func (m *GenesisState) GetDepositParams() *DepositParams { - if m != nil { - return m.DepositParams - } - return nil -} - -func (m *GenesisState) GetVotingParams() *VotingParams { - if m != nil { - return m.VotingParams - } - return nil -} - -func (m *GenesisState) GetTallyParams() *TallyParams { - if m != nil { - return m.TallyParams - } - return nil -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "cosmos.gov.v1beta2.GenesisState") -} - -func init() { proto.RegisterFile("cosmos/gov/v1beta2/genesis.proto", fileDescriptor_7915ab39bb5aa171) } - -var fileDescriptor_7915ab39bb5aa171 = []byte{ - // 345 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xbb, 0x4e, 0xc3, 0x30, - 0x14, 0x86, 0x1b, 0x7a, 0x01, 0xdc, 0x96, 0xc1, 0x62, 0x88, 0xa0, 0x0a, 0x81, 0xa9, 0x0b, 0x4e, - 0x29, 0x03, 0x12, 0x63, 0x05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, 0x55, 0xd7, 0x6a, - 0xd7, 0xbb, 0x87, 0xff, 0x54, 0xed, 0x6b, 0xd0, 0x6f, 0x06, 0xeb, 0x23, 0xbd, 0x24, 0x4d, 0x05, - 0xe6, 0x7a, 0x8c, 0xa8, 0xa6, 0x45, 0xee, 0x1f, 0xed, 0x97, 0x77, 0x65, 0x3c, 0x0d, 0xb5, 0x36, - 0xd1, 0x1e, 0x69, 0x20, 0x1f, 0x8f, 0x67, 0xb9, 0x65, 0x53, 0x5b, 0x0e, 0x8a, 0x2c, 0xf7, 0x4b, - 0x2e, 0x93, 0xd4, 0x71, 0x35, 0xf4, 0x6e, 0x3f, 0x16, 0x8e, 0x35, 0x5f, 0x38, 0xd6, 0xd7, 0xc2, - 0xb1, 0xde, 0x52, 0xa7, 0x34, 0x4f, 0x9d, 0xd2, 0x67, 0xea, 0x94, 0x1e, 0x3b, 0x61, 0x84, 0x4f, - 0x2f, 0x43, 0x36, 0x82, 0x89, 0x97, 0xbd, 0xbf, 0xf9, 0x1c, 0xcb, 0xe0, 0xd9, 0x7b, 0xd5, 0xcb, - 0x80, 0xb3, 0x58, 0xc8, 0x7c, 0x25, 0x86, 0x35, 0xbd, 0x0f, 0xa7, 0xdf, 0x01, 0x00, 0x00, 0xff, - 0xff, 0xb6, 0x88, 0x7e, 0xc1, 0x65, 0x02, 0x00, 0x00, -} - -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 - if m.TallyParams != nil { - { - size, err := m.TallyParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - if m.VotingParams != nil { - { - size, err := m.VotingParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - if m.DepositParams != nil { - { - size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(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 = encodeVarintGenesis(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 = encodeVarintGenesis(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 = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.StartingProposalId != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.StartingProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(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 + sovGenesis(uint64(m.StartingProposalId)) - } - if len(m.Deposits) > 0 { - for _, e := range m.Deposits { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.Votes) > 0 { - for _, e := range m.Votes { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.Proposals) > 0 { - for _, e := range m.Proposals { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if m.DepositParams != nil { - l = m.DepositParams.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - if m.VotingParams != nil { - l = m.VotingParams.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - if m.TallyParams != nil { - l = m.TallyParams.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(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 ErrIntOverflowGenesis - } - 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 ErrIntOverflowGenesis - } - 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 ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - 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 ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - 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 ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - 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 ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DepositParams == nil { - m.DepositParams = &DepositParams{} - } - 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 ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VotingParams == nil { - m.VotingParams = &VotingParams{} - } - 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 ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TallyParams == nil { - m.TallyParams = &TallyParams{} - } - if err := m.TallyParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(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, ErrIntOverflowGenesis - } - 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, ErrIntOverflowGenesis - } - 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, ErrIntOverflowGenesis - } - 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, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/gov/types/v1beta2/gov.pb.go b/x/gov/types/v1beta2/gov.pb.go deleted file mode 100644 index 7b97c7318e52..000000000000 --- a/x/gov/types/v1beta2/gov.pb.go +++ /dev/null @@ -1,2717 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/gov/v1beta2/gov.proto - -package v1beta2 - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - types1 "github.com/cosmos/cosmos-sdk/codec/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/protobuf/types/known/durationpb" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// 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 - -// VoteOption enumerates the valid vote options for a given governance proposal. -type VoteOption int32 - -const ( - // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. - VoteOption_VOTE_OPTION_UNSPECIFIED VoteOption = 0 - // VOTE_OPTION_YES defines a yes vote option. - VoteOption_VOTE_OPTION_YES VoteOption = 1 - // VOTE_OPTION_ABSTAIN defines an abstain vote option. - VoteOption_VOTE_OPTION_ABSTAIN VoteOption = 2 - // VOTE_OPTION_NO defines a no vote option. - VoteOption_VOTE_OPTION_NO VoteOption = 3 - // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. - VoteOption_VOTE_OPTION_NO_WITH_VETO VoteOption = 4 -) - -var VoteOption_name = map[int32]string{ - 0: "VOTE_OPTION_UNSPECIFIED", - 1: "VOTE_OPTION_YES", - 2: "VOTE_OPTION_ABSTAIN", - 3: "VOTE_OPTION_NO", - 4: "VOTE_OPTION_NO_WITH_VETO", -} - -var VoteOption_value = map[string]int32{ - "VOTE_OPTION_UNSPECIFIED": 0, - "VOTE_OPTION_YES": 1, - "VOTE_OPTION_ABSTAIN": 2, - "VOTE_OPTION_NO": 3, - "VOTE_OPTION_NO_WITH_VETO": 4, -} - -func (x VoteOption) String() string { - return proto.EnumName(VoteOption_name, int32(x)) -} - -func (VoteOption) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_5abf7b8852811c49, []int{0} -} - -// ProposalStatus enumerates the valid statuses of a proposal. -type ProposalStatus int32 - -const ( - // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. - ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED ProposalStatus = 0 - // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - // period. - ProposalStatus_PROPOSAL_STATUS_DEPOSIT_PERIOD ProposalStatus = 1 - // PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - // period. - ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD ProposalStatus = 2 - // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - // passed. - ProposalStatus_PROPOSAL_STATUS_PASSED ProposalStatus = 3 - // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - // been rejected. - ProposalStatus_PROPOSAL_STATUS_REJECTED ProposalStatus = 4 - // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - // failed. - ProposalStatus_PROPOSAL_STATUS_FAILED ProposalStatus = 5 -) - -var ProposalStatus_name = map[int32]string{ - 0: "PROPOSAL_STATUS_UNSPECIFIED", - 1: "PROPOSAL_STATUS_DEPOSIT_PERIOD", - 2: "PROPOSAL_STATUS_VOTING_PERIOD", - 3: "PROPOSAL_STATUS_PASSED", - 4: "PROPOSAL_STATUS_REJECTED", - 5: "PROPOSAL_STATUS_FAILED", -} - -var ProposalStatus_value = map[string]int32{ - "PROPOSAL_STATUS_UNSPECIFIED": 0, - "PROPOSAL_STATUS_DEPOSIT_PERIOD": 1, - "PROPOSAL_STATUS_VOTING_PERIOD": 2, - "PROPOSAL_STATUS_PASSED": 3, - "PROPOSAL_STATUS_REJECTED": 4, - "PROPOSAL_STATUS_FAILED": 5, -} - -func (x ProposalStatus) String() string { - return proto.EnumName(ProposalStatus_name, int32(x)) -} - -func (ProposalStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_5abf7b8852811c49, []int{1} -} - -// WeightedVoteOption defines a unit of vote for vote split. -type WeightedVoteOption struct { - Option VoteOption `protobuf:"varint,1,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"` - Weight string `protobuf:"bytes,2,opt,name=weight,proto3" json:"weight,omitempty"` -} - -func (m *WeightedVoteOption) Reset() { *m = WeightedVoteOption{} } -func (m *WeightedVoteOption) String() string { return proto.CompactTextString(m) } -func (*WeightedVoteOption) ProtoMessage() {} -func (*WeightedVoteOption) Descriptor() ([]byte, []int) { - return fileDescriptor_5abf7b8852811c49, []int{0} -} -func (m *WeightedVoteOption) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WeightedVoteOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_WeightedVoteOption.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 *WeightedVoteOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_WeightedVoteOption.Merge(m, src) -} -func (m *WeightedVoteOption) XXX_Size() int { - return m.Size() -} -func (m *WeightedVoteOption) XXX_DiscardUnknown() { - xxx_messageInfo_WeightedVoteOption.DiscardUnknown(m) -} - -var xxx_messageInfo_WeightedVoteOption proto.InternalMessageInfo - -func (m *WeightedVoteOption) GetOption() VoteOption { - if m != nil { - return m.Option - } - return VoteOption_VOTE_OPTION_UNSPECIFIED -} - -func (m *WeightedVoteOption) GetWeight() string { - if m != nil { - return m.Weight - } - return "" -} - -// Deposit defines an amount deposited by an account address to an active -// proposal. -type Deposit struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` - Amount []*types.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *Deposit) Reset() { *m = Deposit{} } -func (m *Deposit) String() string { return proto.CompactTextString(m) } -func (*Deposit) ProtoMessage() {} -func (*Deposit) Descriptor() ([]byte, []int) { - return fileDescriptor_5abf7b8852811c49, []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 - -func (m *Deposit) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -func (m *Deposit) GetDepositor() string { - if m != nil { - return m.Depositor - } - return "" -} - -func (m *Deposit) GetAmount() []*types.Coin { - if m != nil { - return m.Amount - } - return nil -} - -// Proposal defines the core field members of a governance proposal. -type Proposal struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - Messages []*types1.Any `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"` - Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=cosmos.gov.v1beta2.ProposalStatus" json:"status,omitempty"` - FinalTallyResult *TallyResult `protobuf:"bytes,4,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result,omitempty"` - SubmitTime *time.Time `protobuf:"bytes,5,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time,omitempty"` - DepositEndTime *time.Time `protobuf:"bytes,6,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time,omitempty"` - TotalDeposit []*types.Coin `protobuf:"bytes,7,rep,name=total_deposit,json=totalDeposit,proto3" json:"total_deposit,omitempty"` - VotingStartTime *time.Time `protobuf:"bytes,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time,omitempty"` - VotingEndTime *time.Time `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time,omitempty"` -} - -func (m *Proposal) Reset() { *m = Proposal{} } -func (m *Proposal) String() string { return proto.CompactTextString(m) } -func (*Proposal) ProtoMessage() {} -func (*Proposal) Descriptor() ([]byte, []int) { - return fileDescriptor_5abf7b8852811c49, []int{2} -} -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 - -func (m *Proposal) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -func (m *Proposal) GetMessages() []*types1.Any { - if m != nil { - return m.Messages - } - return nil -} - -func (m *Proposal) GetStatus() ProposalStatus { - if m != nil { - return m.Status - } - return ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED -} - -func (m *Proposal) GetFinalTallyResult() *TallyResult { - if m != nil { - return m.FinalTallyResult - } - return nil -} - -func (m *Proposal) GetSubmitTime() *time.Time { - if m != nil { - return m.SubmitTime - } - return nil -} - -func (m *Proposal) GetDepositEndTime() *time.Time { - if m != nil { - return m.DepositEndTime - } - return nil -} - -func (m *Proposal) GetTotalDeposit() []*types.Coin { - if m != nil { - return m.TotalDeposit - } - return nil -} - -func (m *Proposal) GetVotingStartTime() *time.Time { - if m != nil { - return m.VotingStartTime - } - return nil -} - -func (m *Proposal) GetVotingEndTime() *time.Time { - if m != nil { - return m.VotingEndTime - } - return nil -} - -// TallyResult defines a standard tally for a governance proposal. -type TallyResult struct { - Yes string `protobuf:"bytes,1,opt,name=yes,proto3" json:"yes,omitempty"` - Abstain string `protobuf:"bytes,2,opt,name=abstain,proto3" json:"abstain,omitempty"` - No string `protobuf:"bytes,3,opt,name=no,proto3" json:"no,omitempty"` - NoWithVeto string `protobuf:"bytes,4,opt,name=no_with_veto,json=noWithVeto,proto3" json:"no_with_veto,omitempty"` -} - -func (m *TallyResult) Reset() { *m = TallyResult{} } -func (m *TallyResult) String() string { return proto.CompactTextString(m) } -func (*TallyResult) ProtoMessage() {} -func (*TallyResult) Descriptor() ([]byte, []int) { - return fileDescriptor_5abf7b8852811c49, []int{3} -} -func (m *TallyResult) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TallyResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TallyResult.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 *TallyResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_TallyResult.Merge(m, src) -} -func (m *TallyResult) XXX_Size() int { - return m.Size() -} -func (m *TallyResult) XXX_DiscardUnknown() { - xxx_messageInfo_TallyResult.DiscardUnknown(m) -} - -var xxx_messageInfo_TallyResult proto.InternalMessageInfo - -func (m *TallyResult) GetYes() string { - if m != nil { - return m.Yes - } - return "" -} - -func (m *TallyResult) GetAbstain() string { - if m != nil { - return m.Abstain - } - return "" -} - -func (m *TallyResult) GetNo() string { - if m != nil { - return m.No - } - return "" -} - -func (m *TallyResult) GetNoWithVeto() string { - if m != nil { - return m.NoWithVeto - } - return "" -} - -// Vote defines a vote on a governance proposal. -// A Vote consists of a proposal ID, the voter, and the vote option. -type Vote struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` - // Deprecated: Prefer to use `options` instead. This field is set in queries - // if and only if `len(options) == 1` and that option has weight 1. In all - // other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"` // Deprecated: Do not use. - Options []*WeightedVoteOption `protobuf:"bytes,4,rep,name=options,proto3" json:"options,omitempty"` -} - -func (m *Vote) Reset() { *m = Vote{} } -func (m *Vote) String() string { return proto.CompactTextString(m) } -func (*Vote) ProtoMessage() {} -func (*Vote) Descriptor() ([]byte, []int) { - return fileDescriptor_5abf7b8852811c49, []int{4} -} -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 (m *Vote) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -func (m *Vote) GetVoter() string { - if m != nil { - return m.Voter - } - return "" -} - -// Deprecated: Do not use. -func (m *Vote) GetOption() VoteOption { - if m != nil { - return m.Option - } - return VoteOption_VOTE_OPTION_UNSPECIFIED -} - -func (m *Vote) GetOptions() []*WeightedVoteOption { - if m != nil { - return m.Options - } - return nil -} - -// DepositParams defines the params for deposits on governance proposals. -type DepositParams struct { - // Minimum deposit for a proposal to enter voting period. - MinDeposit []*types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit,omitempty"` - // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 - // months. - MaxDepositPeriod *time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty"` -} - -func (m *DepositParams) Reset() { *m = DepositParams{} } -func (m *DepositParams) String() string { return proto.CompactTextString(m) } -func (*DepositParams) ProtoMessage() {} -func (*DepositParams) Descriptor() ([]byte, []int) { - return fileDescriptor_5abf7b8852811c49, []int{5} -} -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 - -func (m *DepositParams) GetMinDeposit() []*types.Coin { - if m != nil { - return m.MinDeposit - } - return nil -} - -func (m *DepositParams) GetMaxDepositPeriod() *time.Duration { - if m != nil { - return m.MaxDepositPeriod - } - return nil -} - -// VotingParams defines the params for voting on governance proposals. -type VotingParams struct { - // Length of the voting period. - VotingPeriod *time.Duration `protobuf:"bytes,1,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty"` -} - -func (m *VotingParams) Reset() { *m = VotingParams{} } -func (m *VotingParams) String() string { return proto.CompactTextString(m) } -func (*VotingParams) ProtoMessage() {} -func (*VotingParams) Descriptor() ([]byte, []int) { - return fileDescriptor_5abf7b8852811c49, []int{6} -} -func (m *VotingParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VotingParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_VotingParams.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 *VotingParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_VotingParams.Merge(m, src) -} -func (m *VotingParams) XXX_Size() int { - return m.Size() -} -func (m *VotingParams) XXX_DiscardUnknown() { - xxx_messageInfo_VotingParams.DiscardUnknown(m) -} - -var xxx_messageInfo_VotingParams proto.InternalMessageInfo - -func (m *VotingParams) GetVotingPeriod() *time.Duration { - if m != nil { - return m.VotingPeriod - } - return nil -} - -// TallyParams defines the params for tallying votes on governance proposals. -type TallyParams struct { - // Minimum percentage of total stake needed to vote for a result to be - // considered valid. - Quorum []byte `protobuf:"bytes,1,opt,name=quorum,proto3" json:"quorum,omitempty"` - // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. - Threshold []byte `protobuf:"bytes,2,opt,name=threshold,proto3" json:"threshold,omitempty"` - // Minimum value of Veto votes to Total votes ratio for proposal to be - // vetoed. Default value: 1/3. - VetoThreshold []byte `protobuf:"bytes,3,opt,name=veto_threshold,json=vetoThreshold,proto3" json:"veto_threshold,omitempty"` -} - -func (m *TallyParams) Reset() { *m = TallyParams{} } -func (m *TallyParams) String() string { return proto.CompactTextString(m) } -func (*TallyParams) ProtoMessage() {} -func (*TallyParams) Descriptor() ([]byte, []int) { - return fileDescriptor_5abf7b8852811c49, []int{7} -} -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 - -func (m *TallyParams) GetQuorum() []byte { - if m != nil { - return m.Quorum - } - return nil -} - -func (m *TallyParams) GetThreshold() []byte { - if m != nil { - return m.Threshold - } - return nil -} - -func (m *TallyParams) GetVetoThreshold() []byte { - if m != nil { - return m.VetoThreshold - } - return nil -} - -func init() { - proto.RegisterEnum("cosmos.gov.v1beta2.VoteOption", VoteOption_name, VoteOption_value) - proto.RegisterEnum("cosmos.gov.v1beta2.ProposalStatus", ProposalStatus_name, ProposalStatus_value) - proto.RegisterType((*WeightedVoteOption)(nil), "cosmos.gov.v1beta2.WeightedVoteOption") - proto.RegisterType((*Deposit)(nil), "cosmos.gov.v1beta2.Deposit") - proto.RegisterType((*Proposal)(nil), "cosmos.gov.v1beta2.Proposal") - proto.RegisterType((*TallyResult)(nil), "cosmos.gov.v1beta2.TallyResult") - proto.RegisterType((*Vote)(nil), "cosmos.gov.v1beta2.Vote") - proto.RegisterType((*DepositParams)(nil), "cosmos.gov.v1beta2.DepositParams") - proto.RegisterType((*VotingParams)(nil), "cosmos.gov.v1beta2.VotingParams") - proto.RegisterType((*TallyParams)(nil), "cosmos.gov.v1beta2.TallyParams") -} - -func init() { proto.RegisterFile("cosmos/gov/v1beta2/gov.proto", fileDescriptor_5abf7b8852811c49) } - -var fileDescriptor_5abf7b8852811c49 = []byte{ - // 1013 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0x41, 0x4f, 0xe3, 0x46, - 0x14, 0xc6, 0x49, 0x08, 0xf0, 0x12, 0xb2, 0xee, 0x2c, 0xda, 0x35, 0x2c, 0x35, 0x34, 0x52, 0x57, - 0x68, 0x25, 0x1c, 0xa0, 0xd2, 0x1e, 0x7a, 0xa8, 0x9a, 0x60, 0x6f, 0xd7, 0x88, 0xc5, 0x91, 0xed, - 0x0d, 0x6a, 0x2f, 0x96, 0x83, 0x67, 0x1d, 0xb7, 0xb1, 0x27, 0xf5, 0x4c, 0x58, 0xf8, 0x09, 0xbd, - 0xed, 0xa5, 0x52, 0xd5, 0xbf, 0xd0, 0xeb, 0xfe, 0x88, 0x9e, 0xda, 0xd5, 0x4a, 0x95, 0x7a, 0x6b, - 0x05, 0x7f, 0x64, 0xe5, 0xf1, 0x18, 0x42, 0x40, 0x22, 0xa7, 0xcc, 0xbc, 0xf7, 0x7d, 0x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0x86, 0x85, - 0x38, 0xd5, 0x08, 0x00, 0x00, -} - -func (m *WeightedVoteOption) 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 *WeightedVoteOption) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WeightedVoteOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Weight) > 0 { - i -= len(m.Weight) - copy(dAtA[i:], m.Weight) - i = encodeVarintGov(dAtA, i, uint64(len(m.Weight))) - i-- - dAtA[i] = 0x12 - } - if m.Option != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.Option)) - 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.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[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.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintGov(dAtA, i, uint64(len(m.Depositor))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - 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 - if m.VotingEndTime != nil { - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.VotingEndTime):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintGov(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x4a - } - if m.VotingStartTime != nil { - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.VotingStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.VotingStartTime):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintGov(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x42 - } - 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] = 0x3a - } - } - if m.DepositEndTime != nil { - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.DepositEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.DepositEndTime):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintGov(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0x32 - } - if m.SubmitTime != nil { - n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.SubmitTime):]) - if err4 != nil { - return 0, err4 - } - i -= n4 - i = encodeVarintGov(dAtA, i, uint64(n4)) - i-- - dAtA[i] = 0x2a - } - if m.FinalTallyResult != nil { - { - size, err := m.FinalTallyResult.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.Status != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x18 - } - if len(m.Messages) > 0 { - for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.ProposalId != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *TallyResult) 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 *TallyResult) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TallyResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NoWithVeto) > 0 { - i -= len(m.NoWithVeto) - copy(dAtA[i:], m.NoWithVeto) - i = encodeVarintGov(dAtA, i, uint64(len(m.NoWithVeto))) - i-- - dAtA[i] = 0x22 - } - if len(m.No) > 0 { - i -= len(m.No) - copy(dAtA[i:], m.No) - i = encodeVarintGov(dAtA, i, uint64(len(m.No))) - i-- - dAtA[i] = 0x1a - } - if len(m.Abstain) > 0 { - i -= len(m.Abstain) - copy(dAtA[i:], m.Abstain) - i = encodeVarintGov(dAtA, i, uint64(len(m.Abstain))) - i-- - dAtA[i] = 0x12 - } - if len(m.Yes) > 0 { - i -= len(m.Yes) - copy(dAtA[i:], m.Yes) - i = encodeVarintGov(dAtA, i, uint64(len(m.Yes))) - 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.Options) > 0 { - for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if m.Option != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.Option)) - i-- - dAtA[i] = 0x18 - } - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintGov(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - 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 - if m.MaxDepositPeriod != nil { - n6, err6 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) - if err6 != nil { - return 0, err6 - } - i -= n6 - i = encodeVarintGov(dAtA, i, uint64(n6)) - i-- - dAtA[i] = 0x12 - } - 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] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *VotingParams) 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 *VotingParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.VotingPeriod != nil { - n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.VotingPeriod):]) - if err7 != nil { - return 0, err7 - } - i -= n7 - i = encodeVarintGov(dAtA, i, uint64(n7)) - 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 len(m.VetoThreshold) > 0 { - i -= len(m.VetoThreshold) - copy(dAtA[i:], m.VetoThreshold) - i = encodeVarintGov(dAtA, i, uint64(len(m.VetoThreshold))) - i-- - dAtA[i] = 0x1a - } - if len(m.Threshold) > 0 { - i -= len(m.Threshold) - copy(dAtA[i:], m.Threshold) - i = encodeVarintGov(dAtA, i, uint64(len(m.Threshold))) - i-- - dAtA[i] = 0x12 - } - if len(m.Quorum) > 0 { - i -= len(m.Quorum) - copy(dAtA[i:], m.Quorum) - i = encodeVarintGov(dAtA, i, uint64(len(m.Quorum))) - 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 *WeightedVoteOption) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Option != 0 { - n += 1 + sovGov(uint64(m.Option)) - } - l = len(m.Weight) - if l > 0 { - 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.ProposalId != 0 { - n += 1 + sovGov(uint64(m.ProposalId)) - } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.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.ProposalId != 0 { - n += 1 + sovGov(uint64(m.ProposalId)) - } - if len(m.Messages) > 0 { - for _, e := range m.Messages { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) - } - } - if m.Status != 0 { - n += 1 + sovGov(uint64(m.Status)) - } - if m.FinalTallyResult != nil { - l = m.FinalTallyResult.Size() - n += 1 + l + sovGov(uint64(l)) - } - if m.SubmitTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.SubmitTime) - n += 1 + l + sovGov(uint64(l)) - } - if m.DepositEndTime != nil { - 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)) - } - } - if m.VotingStartTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.VotingStartTime) - n += 1 + l + sovGov(uint64(l)) - } - if m.VotingEndTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.VotingEndTime) - n += 1 + l + sovGov(uint64(l)) - } - return n -} - -func (m *TallyResult) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Yes) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Abstain) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.No) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.NoWithVeto) - if l > 0 { - 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.ProposalId != 0 { - n += 1 + sovGov(uint64(m.ProposalId)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - if m.Option != 0 { - n += 1 + sovGov(uint64(m.Option)) - } - if len(m.Options) > 0 { - for _, e := range m.Options { - l = e.Size() - 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.MinDeposit) > 0 { - for _, e := range m.MinDeposit { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) - } - } - if m.MaxDepositPeriod != nil { - l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.MaxDepositPeriod) - n += 1 + l + sovGov(uint64(l)) - } - return n -} - -func (m *VotingParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.VotingPeriod != nil { - l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.VotingPeriod) - n += 1 + l + sovGov(uint64(l)) - } - return n -} - -func (m *TallyParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Quorum) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Threshold) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.VetoThreshold) - 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 *WeightedVoteOption) 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: WeightedVoteOption: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WeightedVoteOption: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) - } - m.Option = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Option |= VoteOption(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Weight", 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.Weight = 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 *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 != 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 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", 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.Depositor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount = append(m.Amount, &types.Coin{}) - if err := m.Amount[len(m.Amount)-1].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 != 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 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Messages", 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.Messages = append(m.Messages, &types1.Any{}) - if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - 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 != 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 m.FinalTallyResult == nil { - m.FinalTallyResult = &TallyResult{} - } - if err := m.FinalTallyResult.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - 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 m.SubmitTime == nil { - m.SubmitTime = new(time.Time) - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.SubmitTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - 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 m.DepositEndTime == nil { - m.DepositEndTime = new(time.Time) - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.DepositEndTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - 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, &types.Coin{}) - if err := m.TotalDeposit[len(m.TotalDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - 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 m.VotingStartTime == nil { - m.VotingStartTime = new(time.Time) - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.VotingStartTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - 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 m.VotingEndTime == nil { - m.VotingEndTime = new(time.Time) - } - 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 *TallyResult) 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: TallyResult: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TallyResult: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Yes", 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.Yes = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Abstain", 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.Abstain = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field No", 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.No = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NoWithVeto", 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.NoWithVeto = 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 *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 != 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 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", 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.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) - } - m.Option = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Option |= VoteOption(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Options", 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.Options = append(m.Options, &WeightedVoteOption{}) - if err := m.Options[len(m.Options)-1].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 *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 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, &types.Coin{}) - if err := m.MinDeposit[len(m.MinDeposit)-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 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 m.MaxDepositPeriod == nil { - m.MaxDepositPeriod = new(time.Duration) - } - 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 *VotingParams) 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: VotingParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VotingParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VotingPeriod", 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.VotingPeriod == nil { - m.VotingPeriod = new(time.Duration) - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.VotingPeriod, 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 Quorum", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Quorum = append(m.Quorum[:0], dAtA[iNdEx:postIndex]...) - if m.Quorum == nil { - m.Quorum = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Threshold = append(m.Threshold[:0], dAtA[iNdEx:postIndex]...) - if m.Threshold == nil { - m.Threshold = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VetoThreshold", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VetoThreshold = append(m.VetoThreshold[:0], dAtA[iNdEx:postIndex]...) - if m.VetoThreshold == nil { - m.VetoThreshold = []byte{} - } - 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/types/v1beta2/query.pb.go b/x/gov/types/v1beta2/query.pb.go deleted file mode 100644 index 7605012ba695..000000000000 --- a/x/gov/types/v1beta2/query.pb.go +++ /dev/null @@ -1,3963 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/gov/v1beta2/query.proto - -package v1beta2 - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - query "github.com/cosmos/cosmos-sdk/types/query" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// 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 - -// QueryProposalRequest is the request type for the Query/Proposal RPC method. -type QueryProposalRequest struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` -} - -func (m *QueryProposalRequest) Reset() { *m = QueryProposalRequest{} } -func (m *QueryProposalRequest) String() string { return proto.CompactTextString(m) } -func (*QueryProposalRequest) ProtoMessage() {} -func (*QueryProposalRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{0} -} -func (m *QueryProposalRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryProposalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryProposalRequest.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 *QueryProposalRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryProposalRequest.Merge(m, src) -} -func (m *QueryProposalRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryProposalRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryProposalRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryProposalRequest proto.InternalMessageInfo - -func (m *QueryProposalRequest) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -// QueryProposalResponse is the response type for the Query/Proposal RPC method. -type QueryProposalResponse struct { - Proposal *Proposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal,omitempty"` -} - -func (m *QueryProposalResponse) Reset() { *m = QueryProposalResponse{} } -func (m *QueryProposalResponse) String() string { return proto.CompactTextString(m) } -func (*QueryProposalResponse) ProtoMessage() {} -func (*QueryProposalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{1} -} -func (m *QueryProposalResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryProposalResponse.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 *QueryProposalResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryProposalResponse.Merge(m, src) -} -func (m *QueryProposalResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryProposalResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryProposalResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryProposalResponse proto.InternalMessageInfo - -func (m *QueryProposalResponse) GetProposal() *Proposal { - if m != nil { - return m.Proposal - } - return nil -} - -// QueryProposalsRequest is the request type for the Query/Proposals RPC method. -type QueryProposalsRequest struct { - // proposal_status defines the status of the proposals. - ProposalStatus ProposalStatus `protobuf:"varint,1,opt,name=proposal_status,json=proposalStatus,proto3,enum=cosmos.gov.v1beta2.ProposalStatus" json:"proposal_status,omitempty"` - // voter defines the voter address for the proposals. - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` - // depositor defines the deposit addresses from the proposals. - Depositor string `protobuf:"bytes,3,opt,name=depositor,proto3" json:"depositor,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,4,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryProposalsRequest) Reset() { *m = QueryProposalsRequest{} } -func (m *QueryProposalsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryProposalsRequest) ProtoMessage() {} -func (*QueryProposalsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{2} -} -func (m *QueryProposalsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryProposalsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryProposalsRequest.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 *QueryProposalsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryProposalsRequest.Merge(m, src) -} -func (m *QueryProposalsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryProposalsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryProposalsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryProposalsRequest proto.InternalMessageInfo - -func (m *QueryProposalsRequest) GetProposalStatus() ProposalStatus { - if m != nil { - return m.ProposalStatus - } - return ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED -} - -func (m *QueryProposalsRequest) GetVoter() string { - if m != nil { - return m.Voter - } - return "" -} - -func (m *QueryProposalsRequest) GetDepositor() string { - if m != nil { - return m.Depositor - } - return "" -} - -func (m *QueryProposalsRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryProposalsResponse is the response type for the Query/Proposals RPC -// method. -type QueryProposalsResponse struct { - Proposals []*Proposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals,omitempty"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryProposalsResponse) Reset() { *m = QueryProposalsResponse{} } -func (m *QueryProposalsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryProposalsResponse) ProtoMessage() {} -func (*QueryProposalsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{3} -} -func (m *QueryProposalsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryProposalsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryProposalsResponse.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 *QueryProposalsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryProposalsResponse.Merge(m, src) -} -func (m *QueryProposalsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryProposalsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryProposalsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryProposalsResponse proto.InternalMessageInfo - -func (m *QueryProposalsResponse) GetProposals() []*Proposal { - if m != nil { - return m.Proposals - } - return nil -} - -func (m *QueryProposalsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryVoteRequest is the request type for the Query/Vote RPC method. -type QueryVoteRequest struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // voter defines the oter address for the proposals. - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` -} - -func (m *QueryVoteRequest) Reset() { *m = QueryVoteRequest{} } -func (m *QueryVoteRequest) String() string { return proto.CompactTextString(m) } -func (*QueryVoteRequest) ProtoMessage() {} -func (*QueryVoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{4} -} -func (m *QueryVoteRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryVoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryVoteRequest.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 *QueryVoteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryVoteRequest.Merge(m, src) -} -func (m *QueryVoteRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryVoteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryVoteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryVoteRequest proto.InternalMessageInfo - -func (m *QueryVoteRequest) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -func (m *QueryVoteRequest) GetVoter() string { - if m != nil { - return m.Voter - } - return "" -} - -// 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,omitempty"` -} - -func (m *QueryVoteResponse) Reset() { *m = QueryVoteResponse{} } -func (m *QueryVoteResponse) String() string { return proto.CompactTextString(m) } -func (*QueryVoteResponse) ProtoMessage() {} -func (*QueryVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{5} -} -func (m *QueryVoteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryVoteResponse.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 *QueryVoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryVoteResponse.Merge(m, src) -} -func (m *QueryVoteResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryVoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryVoteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryVoteResponse proto.InternalMessageInfo - -func (m *QueryVoteResponse) GetVote() *Vote { - if m != nil { - return m.Vote - } - return nil -} - -// QueryVotesRequest is the request type for the Query/Votes RPC method. -type QueryVotesRequest struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryVotesRequest) Reset() { *m = QueryVotesRequest{} } -func (m *QueryVotesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryVotesRequest) ProtoMessage() {} -func (*QueryVotesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{6} -} -func (m *QueryVotesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryVotesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryVotesRequest.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 *QueryVotesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryVotesRequest.Merge(m, src) -} -func (m *QueryVotesRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryVotesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryVotesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryVotesRequest proto.InternalMessageInfo - -func (m *QueryVotesRequest) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -func (m *QueryVotesRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// 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,omitempty"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryVotesResponse) Reset() { *m = QueryVotesResponse{} } -func (m *QueryVotesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryVotesResponse) ProtoMessage() {} -func (*QueryVotesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{7} -} -func (m *QueryVotesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryVotesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryVotesResponse.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 *QueryVotesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryVotesResponse.Merge(m, src) -} -func (m *QueryVotesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryVotesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryVotesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryVotesResponse proto.InternalMessageInfo - -func (m *QueryVotesResponse) GetVotes() []*Vote { - if m != nil { - return m.Votes - } - return nil -} - -func (m *QueryVotesResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct { - // params_type defines which parameters to query for, can be one of "voting", - // "tallying" or "deposit". - ParamsType string `protobuf:"bytes,1,opt,name=params_type,json=paramsType,proto3" json:"params_type,omitempty"` -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{8} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -func (m *QueryParamsRequest) GetParamsType() string { - if m != nil { - return m.ParamsType - } - return "" -} - -// QueryParamsResponse is the response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // voting_params defines the parameters related to voting. - VotingParams *VotingParams `protobuf:"bytes,1,opt,name=voting_params,json=votingParams,proto3" json:"voting_params,omitempty"` - // deposit_params defines the parameters related to deposit. - DepositParams *DepositParams `protobuf:"bytes,2,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params,omitempty"` - // tally_params defines the parameters related to tally. - TallyParams *TallyParams `protobuf:"bytes,3,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params,omitempty"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{9} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetVotingParams() *VotingParams { - if m != nil { - return m.VotingParams - } - return nil -} - -func (m *QueryParamsResponse) GetDepositParams() *DepositParams { - if m != nil { - return m.DepositParams - } - return nil -} - -func (m *QueryParamsResponse) GetTallyParams() *TallyParams { - if m != nil { - return m.TallyParams - } - return nil -} - -// QueryDepositRequest is the request type for the Query/Deposit RPC method. -type QueryDepositRequest struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // depositor defines the deposit addresses from the proposals. - Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` -} - -func (m *QueryDepositRequest) Reset() { *m = QueryDepositRequest{} } -func (m *QueryDepositRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDepositRequest) ProtoMessage() {} -func (*QueryDepositRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{10} -} -func (m *QueryDepositRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDepositRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDepositRequest.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 *QueryDepositRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDepositRequest.Merge(m, src) -} -func (m *QueryDepositRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDepositRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDepositRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDepositRequest proto.InternalMessageInfo - -func (m *QueryDepositRequest) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -func (m *QueryDepositRequest) GetDepositor() string { - if m != nil { - return m.Depositor - } - return "" -} - -// 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,omitempty"` -} - -func (m *QueryDepositResponse) Reset() { *m = QueryDepositResponse{} } -func (m *QueryDepositResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDepositResponse) ProtoMessage() {} -func (*QueryDepositResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{11} -} -func (m *QueryDepositResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDepositResponse.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 *QueryDepositResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDepositResponse.Merge(m, src) -} -func (m *QueryDepositResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDepositResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDepositResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDepositResponse proto.InternalMessageInfo - -func (m *QueryDepositResponse) GetDeposit() *Deposit { - if m != nil { - return m.Deposit - } - return nil -} - -// QueryDepositsRequest is the request type for the Query/Deposits RPC method. -type QueryDepositsRequest struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryDepositsRequest) Reset() { *m = QueryDepositsRequest{} } -func (m *QueryDepositsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDepositsRequest) ProtoMessage() {} -func (*QueryDepositsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{12} -} -func (m *QueryDepositsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDepositsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDepositsRequest.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 *QueryDepositsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDepositsRequest.Merge(m, src) -} -func (m *QueryDepositsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDepositsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDepositsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDepositsRequest proto.InternalMessageInfo - -func (m *QueryDepositsRequest) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -func (m *QueryDepositsRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// 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,omitempty"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryDepositsResponse) Reset() { *m = QueryDepositsResponse{} } -func (m *QueryDepositsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDepositsResponse) ProtoMessage() {} -func (*QueryDepositsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{13} -} -func (m *QueryDepositsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDepositsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDepositsResponse.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 *QueryDepositsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDepositsResponse.Merge(m, src) -} -func (m *QueryDepositsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDepositsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDepositsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDepositsResponse proto.InternalMessageInfo - -func (m *QueryDepositsResponse) GetDeposits() []*Deposit { - if m != nil { - return m.Deposits - } - return nil -} - -func (m *QueryDepositsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryTallyResultRequest is the request type for the Query/Tally RPC method. -type QueryTallyResultRequest struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` -} - -func (m *QueryTallyResultRequest) Reset() { *m = QueryTallyResultRequest{} } -func (m *QueryTallyResultRequest) String() string { return proto.CompactTextString(m) } -func (*QueryTallyResultRequest) ProtoMessage() {} -func (*QueryTallyResultRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{14} -} -func (m *QueryTallyResultRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTallyResultRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTallyResultRequest.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 *QueryTallyResultRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTallyResultRequest.Merge(m, src) -} -func (m *QueryTallyResultRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryTallyResultRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTallyResultRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTallyResultRequest proto.InternalMessageInfo - -func (m *QueryTallyResultRequest) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -// QueryTallyResultResponse is the response type for the Query/Tally RPC method. -type QueryTallyResultResponse struct { - // tally defines the requested tally. - Tally *TallyResult `protobuf:"bytes,1,opt,name=tally,proto3" json:"tally,omitempty"` -} - -func (m *QueryTallyResultResponse) Reset() { *m = QueryTallyResultResponse{} } -func (m *QueryTallyResultResponse) String() string { return proto.CompactTextString(m) } -func (*QueryTallyResultResponse) ProtoMessage() {} -func (*QueryTallyResultResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3efdc0c4615c3665, []int{15} -} -func (m *QueryTallyResultResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTallyResultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTallyResultResponse.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 *QueryTallyResultResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTallyResultResponse.Merge(m, src) -} -func (m *QueryTallyResultResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryTallyResultResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTallyResultResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTallyResultResponse proto.InternalMessageInfo - -func (m *QueryTallyResultResponse) GetTally() *TallyResult { - if m != nil { - return m.Tally - } - return nil -} - -func init() { - proto.RegisterType((*QueryProposalRequest)(nil), "cosmos.gov.v1beta2.QueryProposalRequest") - proto.RegisterType((*QueryProposalResponse)(nil), "cosmos.gov.v1beta2.QueryProposalResponse") - proto.RegisterType((*QueryProposalsRequest)(nil), "cosmos.gov.v1beta2.QueryProposalsRequest") - proto.RegisterType((*QueryProposalsResponse)(nil), "cosmos.gov.v1beta2.QueryProposalsResponse") - proto.RegisterType((*QueryVoteRequest)(nil), "cosmos.gov.v1beta2.QueryVoteRequest") - proto.RegisterType((*QueryVoteResponse)(nil), "cosmos.gov.v1beta2.QueryVoteResponse") - proto.RegisterType((*QueryVotesRequest)(nil), "cosmos.gov.v1beta2.QueryVotesRequest") - proto.RegisterType((*QueryVotesResponse)(nil), "cosmos.gov.v1beta2.QueryVotesResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.gov.v1beta2.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.gov.v1beta2.QueryParamsResponse") - proto.RegisterType((*QueryDepositRequest)(nil), "cosmos.gov.v1beta2.QueryDepositRequest") - proto.RegisterType((*QueryDepositResponse)(nil), "cosmos.gov.v1beta2.QueryDepositResponse") - proto.RegisterType((*QueryDepositsRequest)(nil), "cosmos.gov.v1beta2.QueryDepositsRequest") - proto.RegisterType((*QueryDepositsResponse)(nil), "cosmos.gov.v1beta2.QueryDepositsResponse") - proto.RegisterType((*QueryTallyResultRequest)(nil), "cosmos.gov.v1beta2.QueryTallyResultRequest") - proto.RegisterType((*QueryTallyResultResponse)(nil), "cosmos.gov.v1beta2.QueryTallyResultResponse") -} - -func init() { proto.RegisterFile("cosmos/gov/v1beta2/query.proto", fileDescriptor_3efdc0c4615c3665) } - -var fileDescriptor_3efdc0c4615c3665 = []byte{ - // 955 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0x38, 0x49, 0x1b, 0xbf, 0xb4, 0x01, 0x1e, 0x05, 0x8c, 0x29, 0x4e, 0x58, 0xd1, 0xd6, - 0xa4, 0xcd, 0x6e, 0x93, 0xd0, 0x96, 0x16, 0x0e, 0x24, 0x82, 0x52, 0x40, 0x48, 0xa9, 0x5b, 0x71, - 0xe0, 0x12, 0x6d, 0xe2, 0xd5, 0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0x47, 0xcb, 0x6d, - 0x81, 0xfa, 0x85, 0x52, 0x1c, 0xd1, 0xba, 0xac, 0x68, 0x2d, 0x62, 0xb3, 0x90, 0x96, 0xc2, 0x3a, - 0x7b, 0x99, 0x85, 0xb2, 0x8f, 0xbf, 0x30, 0x38, 0x49, 0x5f, 0x35, 0x0e, 0x0e, 0x93, 0x17, 0xdc, - 0x7a, 0xb3, 0x1c, 0x48, 0x84, 0x6e, 0x29, 0x42, 0xeb, 0xf8, 0xf6, 0x38, 0x75, 0x32, 0xe2, 0xe2, - 0xec, 0xa5, 0x52, 0xbc, 0x8f, 0x0f, 0x18, 0xcc, 0x18, 0xd9, 0xc2, 0x52, 0x02, 0xa2, 0xfc, 0x33, - 0x3c, 0xaa, 0x81, 0xd6, 0x5b, 0x8a, 0xeb, 0x55, 0x7c, 0xfd, 0x51, 0xb8, 0xe2, 0xcf, 0x0c, 0x66, - 0x33, 0x3a, 0x82, 0x17, 0x07, 0x06, 0x3e, 0xae, 0x70, 0xf5, 0x4b, 0xa3, 0x81, 0xff, 0xcf, 0xf0, - 0x29, 0x59, 0x5b, 0xff, 0xe0, 0xb7, 0x83, 0x06, 0x7b, 0x78, 0xd0, 0x60, 0x7f, 0x1f, 0x34, 0xd8, - 0x77, 0x87, 0x8d, 0x89, 0x87, 0x87, 0x8d, 0x89, 0xbf, 0x0e, 0x1b, 0x13, 0x9f, 0x5c, 0xf6, 0x03, - 0xf9, 0x69, 0x77, 0xcb, 0xde, 0xe6, 0x3b, 0xc6, 0xad, 0xfe, 0xb3, 0x24, 0xda, 0x9f, 0x39, 0x9f, - 0xab, 0x18, 0xc9, 0xc8, 0x08, 0x13, 0x69, 0xeb, 0x84, 0xfa, 0xc5, 0xb2, 0xfa, 0x5f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xb2, 0x31, 0x71, 0x47, 0x6a, 0x0d, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // Proposal queries proposal details based on ProposalID. - Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) - // Proposals queries all proposals based on given status. - Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) - // Vote queries voted information based on proposalID, voterAddr. - Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) - // Votes queries votes of a given proposal. - Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) - // Params queries all parameters of the gov module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // Deposit queries single deposit information based proposalID, depositAddr. - Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) - // Deposits queries all deposits of a single proposal. - Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) - // TallyResult queries the tally of a proposal vote. - TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) { - out := new(QueryProposalResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/Proposal", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) { - out := new(QueryProposalsResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/Proposals", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) { - out := new(QueryVoteResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/Vote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) { - out := new(QueryVotesResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/Votes", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) { - out := new(QueryDepositResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/Deposit", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) { - out := new(QueryDepositsResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/Deposits", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) { - out := new(QueryTallyResultResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Query/TallyResult", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Proposal queries proposal details based on ProposalID. - Proposal(context.Context, *QueryProposalRequest) (*QueryProposalResponse, error) - // Proposals queries all proposals based on given status. - Proposals(context.Context, *QueryProposalsRequest) (*QueryProposalsResponse, error) - // Vote queries voted information based on proposalID, voterAddr. - Vote(context.Context, *QueryVoteRequest) (*QueryVoteResponse, error) - // Votes queries votes of a given proposal. - Votes(context.Context, *QueryVotesRequest) (*QueryVotesResponse, error) - // Params queries all parameters of the gov module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Deposit queries single deposit information based proposalID, depositAddr. - Deposit(context.Context, *QueryDepositRequest) (*QueryDepositResponse, error) - // Deposits queries all deposits of a single proposal. - Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error) - // TallyResult queries the tally of a proposal vote. - TallyResult(context.Context, *QueryTallyResultRequest) (*QueryTallyResultResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Proposal(ctx context.Context, req *QueryProposalRequest) (*QueryProposalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Proposal not implemented") -} -func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryProposalsRequest) (*QueryProposalsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Proposals not implemented") -} -func (*UnimplementedQueryServer) Vote(ctx context.Context, req *QueryVoteRequest) (*QueryVoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") -} -func (*UnimplementedQueryServer) Votes(ctx context.Context, req *QueryVotesRequest) (*QueryVotesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Votes not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedQueryServer) Deposit(ctx context.Context, req *QueryDepositRequest) (*QueryDepositResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") -} -func (*UnimplementedQueryServer) Deposits(ctx context.Context, req *QueryDepositsRequest) (*QueryDepositsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deposits not implemented") -} -func (*UnimplementedQueryServer) TallyResult(ctx context.Context, req *QueryTallyResultRequest) (*QueryTallyResultResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TallyResult not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Proposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryProposalRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Proposal(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta2.Query/Proposal", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Proposal(ctx, req.(*QueryProposalRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Proposals_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryProposalsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Proposals(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta2.Query/Proposals", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Proposals(ctx, req.(*QueryProposalsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryVoteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Vote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta2.Query/Vote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Vote(ctx, req.(*QueryVoteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Votes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryVotesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Votes(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta2.Query/Votes", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Votes(ctx, req.(*QueryVotesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta2.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDepositRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Deposit(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta2.Query/Deposit", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Deposit(ctx, req.(*QueryDepositRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDepositsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Deposits(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta2.Query/Deposits", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Deposits(ctx, req.(*QueryDepositsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_TallyResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTallyResultRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).TallyResult(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta2.Query/TallyResult", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).TallyResult(ctx, req.(*QueryTallyResultRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.gov.v1beta2.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Proposal", - Handler: _Query_Proposal_Handler, - }, - { - MethodName: "Proposals", - Handler: _Query_Proposals_Handler, - }, - { - MethodName: "Vote", - Handler: _Query_Vote_Handler, - }, - { - MethodName: "Votes", - Handler: _Query_Votes_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "Deposit", - Handler: _Query_Deposit_Handler, - }, - { - MethodName: "Deposits", - Handler: _Query_Deposits_Handler, - }, - { - MethodName: "TallyResult", - Handler: _Query_TallyResult_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/gov/v1beta2/query.proto", -} - -func (m *QueryProposalRequest) 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 *QueryProposalRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryProposalResponse) 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 *QueryProposalResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proposal != nil { - { - size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryProposalsRequest) 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 *QueryProposalsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) - i-- - dAtA[i] = 0x1a - } - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalStatus != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalStatus)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryProposalsResponse) 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 *QueryProposalsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - 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 = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryVoteRequest) 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 *QueryVoteRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryVoteResponse) 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 *QueryVoteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Vote != nil { - { - size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryVotesRequest) 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 *QueryVotesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryVotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryVotesResponse) 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 *QueryVotesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryVotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - 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 = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ParamsType) > 0 { - i -= len(m.ParamsType) - copy(dAtA[i:], m.ParamsType) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ParamsType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TallyParams != nil { - { - size, err := m.TallyParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.DepositParams != nil { - { - size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.VotingParams != nil { - { - size, err := m.VotingParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryDepositRequest) 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 *QueryDepositRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryDepositResponse) 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 *QueryDepositResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Deposit != nil { - { - size, err := m.Deposit.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryDepositsRequest) 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 *QueryDepositsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDepositsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryDepositsResponse) 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 *QueryDepositsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDepositsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - 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 = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryTallyResultRequest) 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 *QueryTallyResultRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryTallyResultRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryTallyResultResponse) 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 *QueryTallyResultResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryTallyResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Tally != nil { - { - size, err := m.Tally.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryProposalRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - return n -} - -func (m *QueryProposalResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Proposal != nil { - l = m.Proposal.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryProposalsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalStatus != 0 { - n += 1 + sovQuery(uint64(m.ProposalStatus)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryProposalsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Proposals) > 0 { - for _, e := range m.Proposals { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryVoteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryVoteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Vote != nil { - l = m.Vote.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryVotesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryVotesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Votes) > 0 { - for _, e := range m.Votes { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ParamsType) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.VotingParams != nil { - l = m.VotingParams.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if m.DepositParams != nil { - l = m.DepositParams.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if m.TallyParams != nil { - l = m.TallyParams.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDepositRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDepositResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Deposit != nil { - l = m.Deposit.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDepositsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDepositsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Deposits) > 0 { - for _, e := range m.Deposits { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryTallyResultRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - return n -} - -func (m *QueryTallyResultResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Tally != nil { - l = m.Tally.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryProposalRequest) 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 ErrIntOverflowQuery - } - 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: QueryProposalRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryProposalResponse) 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 ErrIntOverflowQuery - } - 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: QueryProposalResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Proposal == nil { - m.Proposal = &Proposal{} - } - if err := m.Proposal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryProposalsRequest) 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 ErrIntOverflowQuery - } - 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: QueryProposalsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalStatus", wireType) - } - m.ProposalStatus = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalStatus |= ProposalStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Depositor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryProposalsResponse) 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 ErrIntOverflowQuery - } - 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: QueryProposalsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - 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 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryVoteRequest) 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 ErrIntOverflowQuery - } - 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: QueryVoteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryVoteResponse) 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 ErrIntOverflowQuery - } - 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: QueryVoteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVoteResponse: 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Vote == nil { - m.Vote = &Vote{} - } - if err := m.Vote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryVotesRequest) 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 ErrIntOverflowQuery - } - 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: QueryVotesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVotesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryVotesResponse) 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 ErrIntOverflowQuery - } - 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: QueryVotesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVotesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - 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 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsRequest) 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 ErrIntOverflowQuery - } - 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: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParamsType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ParamsType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) 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 ErrIntOverflowQuery - } - 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: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VotingParams == nil { - m.VotingParams = &VotingParams{} - } - if err := m.VotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DepositParams == nil { - m.DepositParams = &DepositParams{} - } - if err := m.DepositParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TallyParams == nil { - m.TallyParams = &TallyParams{} - } - if err := m.TallyParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDepositRequest) 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 ErrIntOverflowQuery - } - 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: QueryDepositRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Depositor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDepositResponse) 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 ErrIntOverflowQuery - } - 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: QueryDepositResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositResponse: 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Deposit == nil { - m.Deposit = &Deposit{} - } - if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDepositsRequest) 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 ErrIntOverflowQuery - } - 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: QueryDepositsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDepositsResponse) 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 ErrIntOverflowQuery - } - 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: QueryDepositsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - 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 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryTallyResultRequest) 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 ErrIntOverflowQuery - } - 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: QueryTallyResultRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTallyResultRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryTallyResultResponse) 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 ErrIntOverflowQuery - } - 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: QueryTallyResultResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTallyResultResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tally", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Tally == nil { - m.Tally = &TallyResult{} - } - if err := m.Tally.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(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, ErrIntOverflowQuery - } - 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, ErrIntOverflowQuery - } - 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, ErrIntOverflowQuery - } - 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, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/gov/types/v1beta2/query.pb.gw.go b/x/gov/types/v1beta2/query.pb.gw.go deleted file mode 100644 index 73fbf22e789d..000000000000 --- a/x/gov/types/v1beta2/query.pb.gw.go +++ /dev/null @@ -1,932 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: cosmos/gov/v1beta2/query.proto - -/* -Package v1beta2 is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package v1beta2 - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage - -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 - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["proposal_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") - } - - protoReq.ProposalId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) - } - - msg, err := client.Proposal(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryProposalRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["proposal_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") - } - - protoReq.ProposalId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) - } - - msg, err := server.Proposal(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_Proposals_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_Proposals_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryProposalsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Proposals_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Proposals(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Proposals_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryProposalsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Proposals_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Proposals(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Vote_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryVoteRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["proposal_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") - } - - protoReq.ProposalId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) - } - - val, ok = pathParams["voter"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "voter") - } - - protoReq.Voter, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "voter", err) - } - - msg, err := client.Vote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Vote_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryVoteRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["proposal_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") - } - - protoReq.ProposalId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) - } - - val, ok = pathParams["voter"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "voter") - } - - protoReq.Voter, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "voter", err) - } - - msg, err := server.Vote(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_Votes_0 = &utilities.DoubleArray{Encoding: map[string]int{"proposal_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) - -func request_Query_Votes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryVotesRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["proposal_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") - } - - protoReq.ProposalId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Votes_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Votes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Votes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryVotesRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["proposal_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") - } - - protoReq.ProposalId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Votes_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Votes(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["params_type"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "params_type") - } - - protoReq.ParamsType, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "params_type", err) - } - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["params_type"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "params_type") - } - - protoReq.ParamsType, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "params_type", err) - } - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Deposit_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDepositRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["proposal_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") - } - - protoReq.ProposalId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) - } - - val, ok = pathParams["depositor"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "depositor") - } - - protoReq.Depositor, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "depositor", err) - } - - msg, err := client.Deposit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Deposit_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDepositRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["proposal_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") - } - - protoReq.ProposalId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) - } - - val, ok = pathParams["depositor"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "depositor") - } - - protoReq.Depositor, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "depositor", err) - } - - msg, err := server.Deposit(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_Deposits_0 = &utilities.DoubleArray{Encoding: map[string]int{"proposal_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) - -func request_Query_Deposits_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDepositsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["proposal_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") - } - - protoReq.ProposalId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Deposits_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Deposits(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Deposits_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDepositsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["proposal_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") - } - - protoReq.ProposalId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Deposits_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Deposits(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_TallyResult_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryTallyResultRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["proposal_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") - } - - protoReq.ProposalId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) - } - - msg, err := client.TallyResult(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_TallyResult_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryTallyResultRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["proposal_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") - } - - protoReq.ProposalId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) - } - - msg, err := server.TallyResult(ctx, &protoReq) - return msg, metadata, err - -} - -// 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 (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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Proposal_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Proposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Proposals_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Proposals_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Vote_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Vote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Votes_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Votes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Deposit_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Deposit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Deposits_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Deposits_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_TallyResult_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_TallyResult_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Proposal_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Proposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Proposals_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Proposals_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Vote_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Vote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Votes_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Votes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Deposit_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Deposit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Deposits_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Deposits_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - 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() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_TallyResult_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_TallyResult_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_Proposal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "gov", "v1beta2", "proposals", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Proposals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "gov", "v1beta2", "proposals"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Vote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"cosmos", "gov", "v1beta2", "proposals", "proposal_id", "votes", "voter"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Votes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"cosmos", "gov", "v1beta2", "proposals", "proposal_id", "votes"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "gov", "v1beta2", "params", "params_type"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Deposit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"cosmos", "gov", "v1beta2", "proposals", "proposal_id", "deposits", "depositor"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Deposits_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"cosmos", "gov", "v1beta2", "proposals", "proposal_id", "deposits"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_TallyResult_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"cosmos", "gov", "v1beta2", "proposals", "proposal_id", "tally"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Proposal_0 = runtime.ForwardResponseMessage - - forward_Query_Proposals_0 = runtime.ForwardResponseMessage - - forward_Query_Vote_0 = runtime.ForwardResponseMessage - - forward_Query_Votes_0 = runtime.ForwardResponseMessage - - forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_Deposit_0 = runtime.ForwardResponseMessage - - forward_Query_Deposits_0 = runtime.ForwardResponseMessage - - forward_Query_TallyResult_0 = runtime.ForwardResponseMessage -) diff --git a/x/gov/types/v1beta2/tx.pb.go b/x/gov/types/v1beta2/tx.pb.go deleted file mode 100644 index ef0634f82118..000000000000 --- a/x/gov/types/v1beta2/tx.pb.go +++ /dev/null @@ -1,1970 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/gov/v1beta2/tx.proto - -package v1beta2 - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - types "github.com/cosmos/cosmos-sdk/codec/types" - types1 "github.com/cosmos/cosmos-sdk/types" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// 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 - -// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary -// proposal Content. -type MsgSubmitProposal struct { - Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` - InitialDeposit []*types1.Coin `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3" json:"initial_deposit,omitempty"` - Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` -} - -func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } -func (m *MsgSubmitProposal) String() string { return proto.CompactTextString(m) } -func (*MsgSubmitProposal) ProtoMessage() {} -func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_4214261f6b3f9ed4, []int{0} -} -func (m *MsgSubmitProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSubmitProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSubmitProposal.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 *MsgSubmitProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSubmitProposal.Merge(m, src) -} -func (m *MsgSubmitProposal) XXX_Size() int { - return m.Size() -} -func (m *MsgSubmitProposal) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSubmitProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSubmitProposal proto.InternalMessageInfo - -func (m *MsgSubmitProposal) GetMessages() []*types.Any { - if m != nil { - return m.Messages - } - return nil -} - -func (m *MsgSubmitProposal) GetInitialDeposit() []*types1.Coin { - if m != nil { - return m.InitialDeposit - } - return nil -} - -func (m *MsgSubmitProposal) GetProposer() string { - if m != nil { - return m.Proposer - } - return "" -} - -// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. -type MsgSubmitProposalResponse struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` -} - -func (m *MsgSubmitProposalResponse) Reset() { *m = MsgSubmitProposalResponse{} } -func (m *MsgSubmitProposalResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSubmitProposalResponse) ProtoMessage() {} -func (*MsgSubmitProposalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4214261f6b3f9ed4, []int{1} -} -func (m *MsgSubmitProposalResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSubmitProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSubmitProposalResponse.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 *MsgSubmitProposalResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSubmitProposalResponse.Merge(m, src) -} -func (m *MsgSubmitProposalResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgSubmitProposalResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSubmitProposalResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSubmitProposalResponse proto.InternalMessageInfo - -func (m *MsgSubmitProposalResponse) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -// MsgVote defines a message to cast a vote. -type MsgVote struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` - Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta2.VoteOption" json:"option,omitempty"` -} - -func (m *MsgVote) Reset() { *m = MsgVote{} } -func (m *MsgVote) String() string { return proto.CompactTextString(m) } -func (*MsgVote) ProtoMessage() {} -func (*MsgVote) Descriptor() ([]byte, []int) { - return fileDescriptor_4214261f6b3f9ed4, []int{2} -} -func (m *MsgVote) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgVote.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 *MsgVote) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgVote.Merge(m, src) -} -func (m *MsgVote) XXX_Size() int { - return m.Size() -} -func (m *MsgVote) XXX_DiscardUnknown() { - xxx_messageInfo_MsgVote.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgVote proto.InternalMessageInfo - -func (m *MsgVote) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -func (m *MsgVote) GetVoter() string { - if m != nil { - return m.Voter - } - return "" -} - -func (m *MsgVote) GetOption() VoteOption { - if m != nil { - return m.Option - } - return VoteOption_VOTE_OPTION_UNSPECIFIED -} - -// MsgVoteResponse defines the Msg/Vote response type. -type MsgVoteResponse struct { -} - -func (m *MsgVoteResponse) Reset() { *m = MsgVoteResponse{} } -func (m *MsgVoteResponse) String() string { return proto.CompactTextString(m) } -func (*MsgVoteResponse) ProtoMessage() {} -func (*MsgVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4214261f6b3f9ed4, []int{3} -} -func (m *MsgVoteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgVoteResponse.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 *MsgVoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgVoteResponse.Merge(m, src) -} -func (m *MsgVoteResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgVoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgVoteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgVoteResponse proto.InternalMessageInfo - -// MsgVoteWeighted defines a message to cast a vote. -// -// Since: cosmos-sdk 0.43 -type MsgVoteWeighted struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` - Options []*WeightedVoteOption `protobuf:"bytes,3,rep,name=options,proto3" json:"options,omitempty"` -} - -func (m *MsgVoteWeighted) Reset() { *m = MsgVoteWeighted{} } -func (m *MsgVoteWeighted) String() string { return proto.CompactTextString(m) } -func (*MsgVoteWeighted) ProtoMessage() {} -func (*MsgVoteWeighted) Descriptor() ([]byte, []int) { - return fileDescriptor_4214261f6b3f9ed4, []int{4} -} -func (m *MsgVoteWeighted) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgVoteWeighted) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgVoteWeighted.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 *MsgVoteWeighted) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgVoteWeighted.Merge(m, src) -} -func (m *MsgVoteWeighted) XXX_Size() int { - return m.Size() -} -func (m *MsgVoteWeighted) XXX_DiscardUnknown() { - xxx_messageInfo_MsgVoteWeighted.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgVoteWeighted proto.InternalMessageInfo - -func (m *MsgVoteWeighted) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -func (m *MsgVoteWeighted) GetVoter() string { - if m != nil { - return m.Voter - } - return "" -} - -func (m *MsgVoteWeighted) GetOptions() []*WeightedVoteOption { - if m != nil { - return m.Options - } - return nil -} - -// MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. -// -// Since: cosmos-sdk 0.43 -type MsgVoteWeightedResponse struct { -} - -func (m *MsgVoteWeightedResponse) Reset() { *m = MsgVoteWeightedResponse{} } -func (m *MsgVoteWeightedResponse) String() string { return proto.CompactTextString(m) } -func (*MsgVoteWeightedResponse) ProtoMessage() {} -func (*MsgVoteWeightedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4214261f6b3f9ed4, []int{5} -} -func (m *MsgVoteWeightedResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgVoteWeightedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgVoteWeightedResponse.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 *MsgVoteWeightedResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgVoteWeightedResponse.Merge(m, src) -} -func (m *MsgVoteWeightedResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgVoteWeightedResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgVoteWeightedResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgVoteWeightedResponse proto.InternalMessageInfo - -// MsgDeposit defines a message to submit a deposit to an existing proposal. -type MsgDeposit struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` - Amount []*types1.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } -func (m *MsgDeposit) String() string { return proto.CompactTextString(m) } -func (*MsgDeposit) ProtoMessage() {} -func (*MsgDeposit) Descriptor() ([]byte, []int) { - return fileDescriptor_4214261f6b3f9ed4, []int{6} -} -func (m *MsgDeposit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDeposit.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 *MsgDeposit) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDeposit.Merge(m, src) -} -func (m *MsgDeposit) XXX_Size() int { - return m.Size() -} -func (m *MsgDeposit) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDeposit.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDeposit proto.InternalMessageInfo - -func (m *MsgDeposit) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -func (m *MsgDeposit) GetDepositor() string { - if m != nil { - return m.Depositor - } - return "" -} - -func (m *MsgDeposit) GetAmount() []*types1.Coin { - if m != nil { - return m.Amount - } - return nil -} - -// MsgDepositResponse defines the Msg/Deposit response type. -type MsgDepositResponse struct { -} - -func (m *MsgDepositResponse) Reset() { *m = MsgDepositResponse{} } -func (m *MsgDepositResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDepositResponse) ProtoMessage() {} -func (*MsgDepositResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4214261f6b3f9ed4, []int{7} -} -func (m *MsgDepositResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDepositResponse.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 *MsgDepositResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDepositResponse.Merge(m, src) -} -func (m *MsgDepositResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgDepositResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDepositResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDepositResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos.gov.v1beta2.MsgSubmitProposal") - proto.RegisterType((*MsgSubmitProposalResponse)(nil), "cosmos.gov.v1beta2.MsgSubmitProposalResponse") - proto.RegisterType((*MsgVote)(nil), "cosmos.gov.v1beta2.MsgVote") - proto.RegisterType((*MsgVoteResponse)(nil), "cosmos.gov.v1beta2.MsgVoteResponse") - proto.RegisterType((*MsgVoteWeighted)(nil), "cosmos.gov.v1beta2.MsgVoteWeighted") - proto.RegisterType((*MsgVoteWeightedResponse)(nil), "cosmos.gov.v1beta2.MsgVoteWeightedResponse") - proto.RegisterType((*MsgDeposit)(nil), "cosmos.gov.v1beta2.MsgDeposit") - proto.RegisterType((*MsgDepositResponse)(nil), "cosmos.gov.v1beta2.MsgDepositResponse") -} - -func init() { proto.RegisterFile("cosmos/gov/v1beta2/tx.proto", fileDescriptor_4214261f6b3f9ed4) } - -var fileDescriptor_4214261f6b3f9ed4 = []byte{ - // 569 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0xad, 0x9b, 0x92, 0xb4, 0x53, 0x94, 0xaa, 0xab, 0x48, 0x38, 0x2e, 0x32, 0x91, 0x11, 0x55, - 0x24, 0x94, 0x75, 0x13, 0x50, 0x4f, 0x1c, 0x68, 0xe0, 0x00, 0x48, 0x11, 0xe0, 0x4a, 0x20, 0x71, - 0x09, 0x76, 0xbc, 0xdd, 0xae, 0x48, 0xbc, 0x96, 0x77, 0x13, 0x35, 0x7f, 0x81, 0x38, 0xf1, 0x01, - 0x7c, 0x02, 0x77, 0xae, 0x1c, 0x2b, 0x4e, 0x1c, 0x51, 0x72, 0xe5, 0x23, 0x50, 0xec, 0x5d, 0x17, - 0x9a, 0x34, 0xe9, 0x81, 0x53, 0xb4, 0xfb, 0xde, 0x9b, 0x7d, 0x2f, 0x33, 0x1e, 0xd8, 0xeb, 0x71, - 0x31, 0xe0, 0xc2, 0xa5, 0x7c, 0xe4, 0x8e, 0x9a, 0x01, 0x91, 0x7e, 0xcb, 0x95, 0x67, 0x38, 0x4e, - 0xb8, 0xe4, 0x08, 0x65, 0x20, 0xa6, 0x7c, 0x84, 0x15, 0x68, 0xd9, 0x4a, 0x10, 0xf8, 0x82, 0x28, - 0x45, 0xd3, 0xed, 0x71, 0x16, 0x65, 0x1a, 0xeb, 0xf6, 0x82, 0x82, 0x33, 0x7d, 0x86, 0x56, 0x33, - 0xb4, 0x9b, 0x9e, 0x5c, 0x55, 0x5e, 0x41, 0x94, 0x73, 0xda, 0x27, 0x6e,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x3f, 0xa7, 0xf6, 0xda, 0xbb, 0x03, 0xca, 0xe4, 0xe9, - 0x30, 0xc0, 0x3d, 0x3e, 0x50, 0x7b, 0x4d, 0xfd, 0x34, 0x44, 0xf8, 0xc1, 0x3d, 0x4b, 0xf7, 0xa1, - 0x1c, 0xc7, 0x44, 0xe8, 0xad, 0x18, 0x14, 0xd3, 0x2d, 0xf5, 0xe0, 0x4f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x35, 0x23, 0x1d, 0xe1, 0x83, 0x05, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - // SubmitProposal defines a method to create new proposal given a content. - SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) - // Vote defines a method to add a vote on a specific proposal. - Vote(ctx context.Context, in *MsgVote, opts ...grpc.CallOption) (*MsgVoteResponse, error) - // VoteWeighted defines a method to add a weighted vote on a specific proposal. - // - // Since: cosmos-sdk 0.43 - VoteWeighted(ctx context.Context, in *MsgVoteWeighted, opts ...grpc.CallOption) (*MsgVoteWeightedResponse, error) - // Deposit defines a method to add deposit on a specific proposal. - Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) { - out := new(MsgSubmitProposalResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Msg/SubmitProposal", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Vote(ctx context.Context, in *MsgVote, opts ...grpc.CallOption) (*MsgVoteResponse, error) { - out := new(MsgVoteResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Msg/Vote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) VoteWeighted(ctx context.Context, in *MsgVoteWeighted, opts ...grpc.CallOption) (*MsgVoteWeightedResponse, error) { - out := new(MsgVoteWeightedResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Msg/VoteWeighted", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) { - out := new(MsgDepositResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta2.Msg/Deposit", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // SubmitProposal defines a method to create new proposal given a content. - SubmitProposal(context.Context, *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) - // Vote defines a method to add a vote on a specific proposal. - Vote(context.Context, *MsgVote) (*MsgVoteResponse, error) - // VoteWeighted defines a method to add a weighted vote on a specific proposal. - // - // Since: cosmos-sdk 0.43 - VoteWeighted(context.Context, *MsgVoteWeighted) (*MsgVoteWeightedResponse, error) - // Deposit defines a method to add deposit on a specific proposal. - Deposit(context.Context, *MsgDeposit) (*MsgDepositResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) SubmitProposal(ctx context.Context, req *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SubmitProposal not implemented") -} -func (*UnimplementedMsgServer) Vote(ctx context.Context, req *MsgVote) (*MsgVoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") -} -func (*UnimplementedMsgServer) VoteWeighted(ctx context.Context, req *MsgVoteWeighted) (*MsgVoteWeightedResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method VoteWeighted not implemented") -} -func (*UnimplementedMsgServer) Deposit(ctx context.Context, req *MsgDeposit) (*MsgDepositResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_SubmitProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSubmitProposal) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).SubmitProposal(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta2.Msg/SubmitProposal", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SubmitProposal(ctx, req.(*MsgSubmitProposal)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgVote) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Vote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta2.Msg/Vote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Vote(ctx, req.(*MsgVote)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_VoteWeighted_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgVoteWeighted) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).VoteWeighted(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta2.Msg/VoteWeighted", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).VoteWeighted(ctx, req.(*MsgVoteWeighted)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDeposit) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Deposit(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta2.Msg/Deposit", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Deposit(ctx, req.(*MsgDeposit)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.gov.v1beta2.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "SubmitProposal", - Handler: _Msg_SubmitProposal_Handler, - }, - { - MethodName: "Vote", - Handler: _Msg_Vote_Handler, - }, - { - MethodName: "VoteWeighted", - Handler: _Msg_VoteWeighted_Handler, - }, - { - MethodName: "Deposit", - Handler: _Msg_Deposit_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/gov/v1beta2/tx.proto", -} - -func (m *MsgSubmitProposal) 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 *MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Proposer) > 0 { - i -= len(m.Proposer) - copy(dAtA[i:], m.Proposer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Proposer))) - i-- - dAtA[i] = 0x1a - } - if len(m.InitialDeposit) > 0 { - for iNdEx := len(m.InitialDeposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.InitialDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Messages) > 0 { - for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *MsgSubmitProposalResponse) 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 *MsgSubmitProposalResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSubmitProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ProposalId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgVote) 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 *MsgVote) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Option != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Option)) - i-- - dAtA[i] = 0x18 - } - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintTx(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgVoteResponse) 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 *MsgVoteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgVoteWeighted) 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 *MsgVoteWeighted) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgVoteWeighted) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Options) > 0 { - for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintTx(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgVoteWeightedResponse) 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 *MsgVoteWeightedResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgVoteWeightedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgDeposit) 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 *MsgDeposit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintTx(dAtA, i, uint64(len(m.Depositor))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgDepositResponse) 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 *MsgDepositResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgSubmitProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Messages) > 0 { - for _, e := range m.Messages { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if len(m.InitialDeposit) > 0 { - for _, e := range m.InitialDeposit { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Proposer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgSubmitProposalResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovTx(uint64(m.ProposalId)) - } - return n -} - -func (m *MsgVote) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovTx(uint64(m.ProposalId)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Option != 0 { - n += 1 + sovTx(uint64(m.Option)) - } - return n -} - -func (m *MsgVoteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgVoteWeighted) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovTx(uint64(m.ProposalId)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Options) > 0 { - for _, e := range m.Options { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgVoteWeightedResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgDeposit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovTx(uint64(m.ProposalId)) - } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgDepositResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgSubmitProposal) 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 ErrIntOverflowTx - } - 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: MsgSubmitProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Messages = append(m.Messages, &types.Any{}) - if err := m.Messages[len(m.Messages)-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 InitialDeposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InitialDeposit = append(m.InitialDeposit, &types1.Coin{}) - if err := m.InitialDeposit[len(m.InitialDeposit)-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 Proposer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Proposer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSubmitProposalResponse) 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 ErrIntOverflowTx - } - 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: MsgSubmitProposalResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgVote) 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 ErrIntOverflowTx - } - 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: MsgVote: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVote: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) - } - m.Option = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Option |= VoteOption(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgVoteResponse) 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 ErrIntOverflowTx - } - 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: MsgVoteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgVoteWeighted) 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 ErrIntOverflowTx - } - 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: MsgVoteWeighted: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVoteWeighted: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Options = append(m.Options, &WeightedVoteOption{}) - if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgVoteWeightedResponse) 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 ErrIntOverflowTx - } - 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: MsgVoteWeightedResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVoteWeightedResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDeposit) 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 ErrIntOverflowTx - } - 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: MsgDeposit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Depositor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, &types1.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDepositResponse) 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 ErrIntOverflowTx - } - 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: MsgDepositResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(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, ErrIntOverflowTx - } - 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, ErrIntOverflowTx - } - 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, ErrIntOverflowTx - } - 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, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) From 48eecc73eef0025797db1fec715fc20cdc72d234 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Wed, 15 Dec 2021 16:56:43 +0100 Subject: [PATCH 05/12] fix compiling errors --- docs/core/proto-docs.md | 6 +- proto/cosmos/gov/v1beta2/gov.proto | 6 +- x/gov/client/cli/query.go | 2 +- x/gov/client/testutil/cli_test.go | 6 +- x/gov/migrations/v043/json.go | 2 +- x/gov/migrations/v043/json_test.go | 2 +- x/gov/migrations/v043/store.go | 9 +- x/gov/migrations/v043/store_test.go | 2 +- x/gov/simulation/genesis_test.go | 2 +- x/gov/types/deposit.go | 11 +- x/gov/types/genesis.go | 39 ++---- x/gov/types/genesis_test.go | 15 +-- x/gov/types/gov.pb.go | 190 ++++++++++++++-------------- x/gov/types/msgs.go | 89 ++++++------- x/gov/types/msgs_test.go | 14 +- x/gov/types/params.go | 80 ++++++------ x/gov/types/proposal.go | 46 +++---- x/gov/types/tally.go | 34 ++--- x/gov/types/vote.go | 58 +++++---- 19 files changed, 280 insertions(+), 333 deletions(-) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 7f88de540350..a89bdf60dc30 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -6165,9 +6165,9 @@ TallyParams defines the params for tallying votes on governance proposals. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `quorum` | [bytes](#bytes) | | Minimum percentage of total stake needed to vote for a result to be considered valid. | -| `threshold` | [bytes](#bytes) | | Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. | -| `veto_threshold` | [bytes](#bytes) | | Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Default value: 1/3. | +| `quorum` | [string](#string) | | Minimum percentage of total stake needed to vote for a result to be considered valid. | +| `threshold` | [string](#string) | | Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. | +| `veto_threshold` | [string](#string) | | Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Default value: 1/3. | diff --git a/proto/cosmos/gov/v1beta2/gov.proto b/proto/cosmos/gov/v1beta2/gov.proto index 89c5617fb746..33a7e6d8082d 100644 --- a/proto/cosmos/gov/v1beta2/gov.proto +++ b/proto/cosmos/gov/v1beta2/gov.proto @@ -112,12 +112,12 @@ message VotingParams { message TallyParams { // Minimum percentage of total stake needed to vote for a result to be // considered valid. - bytes quorum = 1; + string quorum = 1 [(cosmos_proto.scalar) = "cosmos.Dec"]; // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. - bytes threshold = 2; + string threshold = 2 [(cosmos_proto.scalar) = "cosmos.Dec"]; // Minimum value of Veto votes to Total votes ratio for proposal to be // vetoed. Default value: 1/3. - bytes veto_threshold = 3; + string veto_threshold = 3 [(cosmos_proto.scalar) = "cosmos.Dec"]; } diff --git a/x/gov/client/cli/query.go b/x/gov/client/cli/query.go index d9b059d0ac69..ffd31d816415 100644 --- a/x/gov/client/cli/query.go +++ b/x/gov/client/cli/query.go @@ -12,8 +12,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" gcutils "github.com/cosmos/cosmos-sdk/x/gov/client/utils" - "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // GetQueryCmd returns the cli query commands for this module diff --git a/x/gov/client/testutil/cli_test.go b/x/gov/client/testutil/cli_test.go index 1376be6c2b21..907879f502b6 100644 --- a/x/gov/client/testutil/cli_test.go +++ b/x/gov/client/testutil/cli_test.go @@ -17,9 +17,11 @@ func TestIntegrationTestSuite(t *testing.T) { cfg.NumValidators = 1 suite.Run(t, NewIntegrationTestSuite(cfg)) + dp := types.NewDepositParams(sdk.NewCoins(sdk.NewCoin(cfg.BondDenom, types.DefaultMinDepositTokens)), time.Duration(15)*time.Second) + vp := types.NewVotingParams(time.Duration(5) * time.Second) genesisState := types.DefaultGenesisState() - genesisState.DepositParams = types.NewDepositParams(sdk.NewCoins(sdk.NewCoin(cfg.BondDenom, types.DefaultMinDepositTokens)), time.Duration(15)*time.Second) - genesisState.VotingParams = types.NewVotingParams(time.Duration(5) * time.Second) + genesisState.DepositParams = &dp + genesisState.VotingParams = &vp bz, err := cfg.Codec.MarshalJSON(genesisState) require.NoError(t, err) cfg.GenesisState["gov"] = bz diff --git a/x/gov/migrations/v043/json.go b/x/gov/migrations/v043/json.go index 16de6cdf4743..b3bff9e50bc8 100644 --- a/x/gov/migrations/v043/json.go +++ b/x/gov/migrations/v043/json.go @@ -1,7 +1,7 @@ package v043 import ( - "github.com/cosmos/cosmos-sdk/x/gov/types" + types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // migrateWeightedVotes migrates the ADR-037 weighted votes. diff --git a/x/gov/migrations/v043/json_test.go b/x/gov/migrations/v043/json_test.go index 13762858e707..608146250e81 100644 --- a/x/gov/migrations/v043/json_test.go +++ b/x/gov/migrations/v043/json_test.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" v043gov "github.com/cosmos/cosmos-sdk/x/gov/migrations/v043" - "github.com/cosmos/cosmos-sdk/x/gov/types" + types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) func TestMigrateJSON(t *testing.T) { diff --git a/x/gov/migrations/v043/store.go b/x/gov/migrations/v043/store.go index b71c6b8d7430..886279ac93eb 100644 --- a/x/gov/migrations/v043/store.go +++ b/x/gov/migrations/v043/store.go @@ -9,6 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) const proposalIDLen = 8 @@ -37,11 +38,11 @@ func migratePrefixProposalAddress(store sdk.KVStore, prefixBz []byte) { // migrateStoreWeightedVotes migrates a legacy vote to an ADR-037 weighted vote. // Important: the `oldVote` has its `Option` field set, whereas the new weighted // vote has its `Options` field set. -func migrateVote(oldVote types.Vote) types.Vote { - return types.Vote{ +func migrateVote(oldVote v1beta1.Vote) v1beta1.Vote { + return v1beta1.Vote{ ProposalId: oldVote.ProposalId, Voter: oldVote.Voter, - Options: types.NewNonSplitVoteOption(oldVote.Option), + Options: v1beta1.NewNonSplitVoteOption(oldVote.Option), } } @@ -51,7 +52,7 @@ func migrateStoreWeightedVotes(store sdk.KVStore, cdc codec.BinaryCodec) error { defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var oldVote types.Vote + var oldVote v1beta1.Vote err := cdc.Unmarshal(iterator.Value(), &oldVote) if err != nil { return err diff --git a/x/gov/migrations/v043/store_test.go b/x/gov/migrations/v043/store_test.go index 63c8a7257744..b97c126a781e 100644 --- a/x/gov/migrations/v043/store_test.go +++ b/x/gov/migrations/v043/store_test.go @@ -30,7 +30,7 @@ func TestMigrateStore(t *testing.T) { // Use real values for votes, as we're testing weighted votes. oldVote := types.Vote{ProposalId: 1, Voter: "foobar", Option: types.OptionNoWithVeto} oldVoteValue := cdc.MustMarshal(&oldVote) - newVote := types.Vote{ProposalId: 1, Voter: "foobar", Options: types.WeightedVoteOptions{{Option: types.OptionNoWithVeto, Weight: sdk.NewDec(1)}}} + newVote := types.Vote{ProposalId: 1, Voter: "foobar", Options: types.WeightedVoteOptions{{Option: types.OptionNoWithVeto, Weight: sdk.NewDec(1).String()}}} newVoteValue := cdc.MustMarshal(&newVote) testCases := []struct { diff --git a/x/gov/simulation/genesis_test.go b/x/gov/simulation/genesis_test.go index db8b98bff103..941f1fb8d5bf 100644 --- a/x/gov/simulation/genesis_test.go +++ b/x/gov/simulation/genesis_test.go @@ -44,7 +44,7 @@ func TestRandomizedGenState(t *testing.T) { dec2, _ := sdk.NewDecFromStr("0.512000000000000000") dec3, _ := sdk.NewDecFromStr("0.267000000000000000") - require.Equal(t, "905stake", govGenesis.DepositParams.MinDeposit.String()) + require.Equal(t, "905stake", govGenesis.DepositParams.MinDeposit[0].String()) require.Equal(t, "77h26m10s", govGenesis.DepositParams.MaxDepositPeriod.String()) require.Equal(t, float64(148296), govGenesis.VotingParams.VotingPeriod.Seconds()) require.Equal(t, dec1, govGenesis.TallyParams.Quorum) diff --git a/x/gov/types/deposit.go b/x/gov/types/deposit.go index 9cd16f4777c0..1e188f9711f3 100644 --- a/x/gov/types/deposit.go +++ b/x/gov/types/deposit.go @@ -3,20 +3,13 @@ package types import ( "fmt" - "sigs.k8s.io/yaml" - sdk "github.com/cosmos/cosmos-sdk/types" ) // NewDeposit creates a new Deposit instance //nolint:interfacer func NewDeposit(proposalID uint64, depositor sdk.AccAddress, amount sdk.Coins) Deposit { - return Deposit{proposalID, depositor.String(), amount} -} - -func (d Deposit) String() string { - out, _ := yaml.Marshal(d) - return string(out) + return Deposit{proposalID, depositor.String(), ToCoinSlice(amount)} } // Deposits is a collection of Deposit objects @@ -50,5 +43,5 @@ func (d Deposits) String() string { // Empty returns whether a deposit is empty. func (d Deposit) Empty() bool { - return d.String() == Deposit{}.String() + return NewCoins(d.Amount).Empty() } diff --git a/x/gov/types/genesis.go b/x/gov/types/genesis.go index 7f2d138ae300..392fc6b878ea 100644 --- a/x/gov/types/genesis.go +++ b/x/gov/types/genesis.go @@ -4,16 +4,15 @@ import ( "fmt" "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" ) // NewGenesisState creates a new genesis state for the governance module func NewGenesisState(startingProposalID uint64, dp DepositParams, vp VotingParams, tp TallyParams) *GenesisState { return &GenesisState{ StartingProposalId: startingProposalID, - DepositParams: dp, - VotingParams: vp, - TallyParams: tp, + DepositParams: &dp, + VotingParams: &vp, + TallyParams: &tp, } } @@ -27,38 +26,26 @@ func DefaultGenesisState() *GenesisState { ) } -func (data GenesisState) Equal(other GenesisState) bool { - return data.StartingProposalId == other.StartingProposalId && - data.Deposits.Equal(other.Deposits) && - data.Votes.Equal(other.Votes) && - data.Proposals.Equal(other.Proposals) && - data.DepositParams.Equal(other.DepositParams) && - data.TallyParams.Equal(other.TallyParams) && - data.VotingParams.Equal(other.VotingParams) -} - // Empty returns true if a GenesisState is empty func (data GenesisState) Empty() bool { - return data.Equal(GenesisState{}) + return data.StartingProposalId == 0 || + data.DepositParams == nil || + data.VotingParams == nil || + data.TallyParams == nil } // ValidateGenesis checks if parameters are within valid ranges func ValidateGenesis(data *GenesisState) error { - threshold := data.TallyParams.Threshold - if threshold.IsNegative() || threshold.GT(sdk.OneDec()) { - return fmt.Errorf("governance vote threshold should be positive and less or equal to one, is %s", - threshold.String()) + if err := validateTallyParams(data.TallyParams); err != nil { + return fmt.Errorf("invalid tally params: %w", err) } - veto := data.TallyParams.VetoThreshold - if veto.IsNegative() || veto.GT(sdk.OneDec()) { - return fmt.Errorf("governance vote veto threshold should be positive and less or equal to one, is %s", - veto.String()) + if err := validateVotingParams(data.VotingParams); err != nil { + return fmt.Errorf("invalid voting params: %w", err) } - if !data.DepositParams.MinDeposit.IsValid() { - return fmt.Errorf("governance deposit amount must be a valid sdk.Coins amount, is %s", - data.DepositParams.MinDeposit.String()) + if err := validateDepositParams(data.DepositParams); err != nil { + return fmt.Errorf("invalid deposit params: %w", err) } return nil diff --git a/x/gov/types/genesis_test.go b/x/gov/types/genesis_test.go index 3a3e6e4282e3..6f13c5ebae42 100644 --- a/x/gov/types/genesis_test.go +++ b/x/gov/types/genesis_test.go @@ -6,17 +6,10 @@ import ( "github.com/stretchr/testify/require" ) -func TestEqualProposalID(t *testing.T) { +func TestEmptyGenesis(t *testing.T) { state1 := GenesisState{} - state2 := GenesisState{} - require.Equal(t, state1, state2) + require.True(t, state1.Empty()) - // Proposals - state1.StartingProposalId = 1 - require.NotEqual(t, state1, state2) - require.False(t, state1.Equal(state2)) - - state2.StartingProposalId = 1 - require.Equal(t, state1, state2) - require.True(t, state1.Equal(state2)) + state2 := DefaultGenesisState() + require.False(t, state2.Empty()) } diff --git a/x/gov/types/gov.pb.go b/x/gov/types/gov.pb.go index 8cb346dfe89f..8b4cfea3f4e3 100644 --- a/x/gov/types/gov.pb.go +++ b/x/gov/types/gov.pb.go @@ -593,12 +593,12 @@ func (m *VotingParams) GetVotingPeriod() *time.Duration { type TallyParams struct { // Minimum percentage of total stake needed to vote for a result to be // considered valid. - Quorum []byte `protobuf:"bytes,1,opt,name=quorum,proto3" json:"quorum,omitempty"` + Quorum string `protobuf:"bytes,1,opt,name=quorum,proto3" json:"quorum,omitempty"` // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. - Threshold []byte `protobuf:"bytes,2,opt,name=threshold,proto3" json:"threshold,omitempty"` + Threshold string `protobuf:"bytes,2,opt,name=threshold,proto3" json:"threshold,omitempty"` // Minimum value of Veto votes to Total votes ratio for proposal to be // vetoed. Default value: 1/3. - VetoThreshold []byte `protobuf:"bytes,3,opt,name=veto_threshold,json=vetoThreshold,proto3" json:"veto_threshold,omitempty"` + VetoThreshold string `protobuf:"bytes,3,opt,name=veto_threshold,json=vetoThreshold,proto3" json:"veto_threshold,omitempty"` } func (m *TallyParams) Reset() { *m = TallyParams{} } @@ -634,25 +634,25 @@ func (m *TallyParams) XXX_DiscardUnknown() { var xxx_messageInfo_TallyParams proto.InternalMessageInfo -func (m *TallyParams) GetQuorum() []byte { +func (m *TallyParams) GetQuorum() string { if m != nil { return m.Quorum } - return nil + return "" } -func (m *TallyParams) GetThreshold() []byte { +func (m *TallyParams) GetThreshold() string { if m != nil { return m.Threshold } - return nil + return "" } -func (m *TallyParams) GetVetoThreshold() []byte { +func (m *TallyParams) GetVetoThreshold() string { if m != nil { return m.VetoThreshold } - return nil + return "" } func init() { @@ -671,71 +671,71 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1beta2/gov.proto", fileDescriptor_5abf7b8852811c49) } var fileDescriptor_5abf7b8852811c49 = []byte{ - // 1010 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0x41, 0x6f, 0xdb, 0x36, - 0x14, 0x8e, 0x6c, 0xc7, 0x49, 0x9e, 0x1d, 0x57, 0x63, 0x83, 0x56, 0x49, 0x33, 0x25, 0x33, 0xb0, - 0xc2, 0x28, 0x10, 0xb9, 0xc9, 0x80, 0x1e, 0x76, 0x18, 0x66, 0x47, 0xea, 0xaa, 0x22, 0x8d, 0x0c, - 0x49, 0x75, 0xb0, 0x5d, 0x04, 0x39, 0x62, 0x65, 0x6d, 0x96, 0xe8, 0x89, 0x74, 0x9a, 0xfc, 0x84, - 0xdd, 0x7a, 0x19, 0x30, 0xec, 0x2f, 0xec, 0xda, 0x1f, 0xb1, 0xd3, 0x56, 0x14, 0x18, 0xb0, 0xdb, - 0x86, 0xe4, 0x8f, 0x14, 0xa2, 0xa8, 0xc4, 0x71, 0x02, 0xc4, 0x27, 0x93, 0xef, 0x7d, 0xdf, 0xc7, - 0xf7, 0xc8, 0x8f, 0x94, 0x61, 0xf3, 0x98, 0xd0, 0x98, 0xd0, 0x76, 0x48, 0x4e, 0xda, 0x27, 0xbb, - 0x03, 0xcc, 0xfc, 0xbd, 0x6c, 0xac, 0x8d, 0x53, 0xc2, 0x08, 0x42, 0x79, 0x56, 0xcb, 0x22, 0x22, - 0xbb, 0xa1, 0x0a, 0xc6, 0xc0, 0xa7, 0x58, 0x50, 0x76, 0xdb, 0xc7, 0x24, 0x4a, 0x72, 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9f, 0x8a, 0xa6, 0x96, 0xe7, 0x2c, - 0xe6, 0x5e, 0x4e, 0x75, 0x32, 0x26, 0xaf, 0xe6, 0x05, 0x88, 0xd0, 0x55, 0x63, 0x2b, 0x73, 0x6a, - 0xad, 0xe6, 0x44, 0xd1, 0x57, 0xf3, 0x0f, 0x09, 0x6a, 0xd3, 0xdb, 0xbe, 0x0d, 0xe5, 0x33, 0x4c, - 0xb9, 0x99, 0xae, 0x5f, 0x0f, 0x33, 0x61, 0x76, 0x96, 0x42, 0x2d, 0x58, 0xf2, 0x07, 0x94, 0xf9, - 0x51, 0x72, 0xcb, 0x25, 0xca, 0x50, 0x45, 0x1a, 0xa9, 0x50, 0x4a, 0x08, 0x77, 0xd2, 0x4d, 0x50, - 0x29, 0x21, 0xe8, 0x29, 0xd4, 0x13, 0xe2, 0xbd, 0x8d, 0xd8, 0xd0, 0x3b, 0xc1, 0x8c, 0x70, 0xaf, - 0xdc, 0x44, 0x42, 0x42, 0x8e, 0x22, 0x36, 0xec, 0x63, 0x46, 0x9a, 0xff, 0x48, 0x50, 0xc9, 0xae, - 0xf5, 0xdd, 0xde, 0xd7, 0x60, 0xf1, 0x84, 0x30, 0x7c, 0xf7, 0x85, 0xcc, 0x61, 0x99, 0xf3, 0xc5, - 0x8b, 0x52, 0x9e, 0xe7, 0x45, 0xe9, 0x96, 0x14, 0xe9, 0xf2, 0x55, 0xf9, 0x16, 0x96, 0xf2, 0x11, - 0x55, 0x2a, 0xdc, 0x15, 0x8f, 0x6f, 0x23, 0xdf, 0x7c, 0xc6, 0xec, 0x82, 0xd6, 0xfc, 0x5d, 0x82, - 0x55, 0xe1, 0x94, 0x9e, 0x9f, 0xfa, 0x71, 0x76, 0x13, 0x6b, 0x71, 0x94, 0x5c, 0xba, 0x4d, 0xba, - 0xcb, 0x6d, 0x10, 0x47, 0x49, 0xe1, 0xb5, 0x57, 0x80, 0x62, 0xff, 0xb4, 0xe0, 0x7a, 0x63, 0x9c, - 0x46, 0x24, 0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0xf0, 0x1c, 0xb7, 0xe3, 0xbe, 0x76, 0x66, 0x6a, 0x6a, - 0x82, 0x3a, 0x0b, 0xd0, 0x8d, 0x9e, 0xe5, 0x98, 0xae, 0xd7, 0x33, 0x6c, 0xd3, 0xd2, 0x65, 0x09, - 0x7d, 0x01, 0x9f, 0xcf, 0x62, 0xfa, 0x96, 0x6b, 0x1e, 0x7e, 0x57, 0x40, 0x4a, 0x68, 0x03, 0x1e, - 0xcc, 0x42, 0x7a, 0x1d, 0xc7, 0x31, 0xf4, 0xbc, 0xe8, 0xd9, 0x9c, 0x6d, 0xbc, 0x34, 0xf6, 0x5d, - 0x43, 0x97, 0x2b, 0xb7, 0x31, 0x9f, 0x77, 0xcc, 0x03, 0x43, 0x97, 0x17, 0xbb, 0xdd, 0x3f, 0xcf, - 0x55, 0xe9, 0xc3, 0xb9, 0x2a, 0xfd, 0x7f, 0xae, 0x4a, 0xef, 0x2e, 0xd4, 0x85, 0x0f, 0x17, 0xea, - 0xc2, 0xbf, 0x17, 0xea, 0xc2, 0x0f, 0xad, 0x30, 0x62, 0xc3, 0xc9, 0x40, 0x3b, 0x26, 0xb1, 0xf8, - 0xa8, 0x8b, 0x9f, 0x1d, 0x1a, 0xfc, 0xd4, 0x3e, 0xe5, 0x7f, 0x59, 0xd8, 0xd9, 0x18, 0xd3, 0x41, - 0x95, 0x7b, 0xe6, 0xab, 0x4f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xe3, 0x04, 0xa9, 0xcd, 0x08, - 0x00, 0x00, + // 1012 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xc1, 0x6e, 0xdb, 0x46, + 0x10, 0x35, 0x25, 0x59, 0xb6, 0x47, 0xb6, 0xc2, 0x6e, 0x8c, 0x86, 0x76, 0x52, 0xda, 0xd5, 0xc1, + 0x10, 0x82, 0x9a, 0x8a, 0x5d, 0x34, 0x87, 0x1e, 0x8a, 0x4a, 0x26, 0xd3, 0x30, 0x70, 0x4c, 0x81, + 0x64, 0x64, 0xb4, 0x17, 0x82, 0x32, 0x37, 0x14, 0x51, 0x91, 0xab, 0x72, 0x57, 0x8e, 0xfd, 0x09, + 0xbd, 0xe5, 0x52, 0xa0, 0xc8, 0x2f, 0xf4, 0x9a, 0x8f, 0xe8, 0xa9, 0x0d, 0x02, 0x14, 0xe8, 0xad, + 0x85, 0xfd, 0x23, 0x05, 0x97, 0x4b, 0x5b, 0x96, 0x55, 0x58, 0x27, 0xaf, 0x66, 0xde, 0x7b, 0x3b, + 0xb3, 0xfb, 0x76, 0x4c, 0x78, 0x74, 0x42, 0x68, 0x4c, 0x68, 0x2b, 0x24, 0xa7, 0xad, 0xd3, 0xbd, + 0x3e, 0x66, 0xfe, 0x7e, 0xb6, 0xd6, 0x46, 0x29, 0x61, 0x04, 0xa1, 0x3c, 0xab, 0x65, 0x11, 0x91, + 0xdd, 0x54, 0x05, 0xa3, 0xef, 0x53, 0x2c, 0x28, 0x7b, 0xad, 0x13, 0x12, 0x25, 0x39, 0x67, 0x73, + 0x3d, 0x24, 0x21, 0xe1, 0xcb, 0x56, 0xb6, 0x12, 0xd1, 0xad, 0x90, 0x90, 0x70, 0x88, 0x5b, 0xfc, + 0x57, 0x7f, 0xfc, 0xba, 0xc5, 0xa2, 0x18, 0x53, 0xe6, 0xc7, 0x23, 0x01, 0xd8, 0x98, 0x06, 0xf8, + 0xc9, 0xb9, 0x48, 0xa9, 0xd3, 0xa9, 0x60, 0x9c, 0xfa, 0x2c, 0x22, 0xc5, 0x8e, 0x1b, 0x79, 0x45, + 0x5e, 0xbe, 0xa9, 0x28, 0x99, 0xff, 0x68, 0x30, 0x40, 0xc7, 0x38, 0x0a, 0x07, 0x0c, 0x07, 0x3d, + 0xc2, 0xb0, 0x35, 0xca, 0x68, 0xe8, 0x29, 0x54, 0x09, 0x5f, 0x29, 0xd2, 0xb6, 0xd4, 0xac, 0xef,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d2, 0x87, 0x0b, 0x55, 0xfa, 0xf7, 0x42, 0x95, 0xde, 0x5e, 0xaa, 0x0b, 0x1f, + 0x2e, 0xd5, 0x85, 0xbf, 0x2f, 0xd5, 0x85, 0x1f, 0x9a, 0x61, 0xc4, 0x06, 0xe3, 0xbe, 0x76, 0x42, + 0x62, 0xf1, 0x15, 0x20, 0xfe, 0xec, 0xd2, 0xe0, 0xc7, 0xd6, 0x19, 0xff, 0xc6, 0x61, 0xe7, 0x23, + 0x4c, 0xfb, 0x55, 0x6e, 0xb2, 0x2f, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x7b, 0x12, 0x44, 0xf8, + 0xfe, 0x08, 0x00, 0x00, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { @@ -2512,7 +2512,7 @@ func (m *TallyParams) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGov @@ -2522,31 +2522,29 @@ func (m *TallyParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGov } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGov } if postIndex > l { return io.ErrUnexpectedEOF } - m.Quorum = append(m.Quorum[:0], dAtA[iNdEx:postIndex]...) - if m.Quorum == nil { - m.Quorum = []byte{} - } + m.Quorum = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGov @@ -2556,31 +2554,29 @@ func (m *TallyParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGov } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGov } if postIndex > l { return io.ErrUnexpectedEOF } - m.Threshold = append(m.Threshold[:0], dAtA[iNdEx:postIndex]...) - if m.Threshold == nil { - m.Threshold = []byte{} - } + m.Threshold = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VetoThreshold", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGov @@ -2590,25 +2586,23 @@ func (m *TallyParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGov } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGov } if postIndex > l { return io.ErrUnexpectedEOF } - m.VetoThreshold = append(m.VetoThreshold[:0], dAtA[iNdEx:postIndex]...) - if m.VetoThreshold == nil { - m.VetoThreshold = []byte{} - } + m.VetoThreshold = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index 3de923fd6d90..8dea1790f773 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -3,8 +3,6 @@ package types import ( "fmt" - "sigs.k8s.io/yaml" - "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" @@ -31,7 +29,7 @@ var ( //nolint:interfacer func NewMsgSubmitProposal(messages []sdk.Msg, initialDeposit sdk.Coins, proposer sdk.AccAddress) (*MsgSubmitProposal, error) { m := &MsgSubmitProposal{ - InitialDeposit: initialDeposit, + InitialDeposit: ToCoinSlice(initialDeposit), Proposer: proposer.String(), } @@ -42,19 +40,12 @@ func NewMsgSubmitProposal(messages []sdk.Msg, initialDeposit sdk.Coins, proposer return m, nil } -func (m *MsgSubmitProposal) GetInitialDeposit() sdk.Coins { return m.InitialDeposit } - -func (m *MsgSubmitProposal) GetProposer() sdk.AccAddress { - proposer, _ := sdk.AccAddressFromBech32(m.Proposer) - return proposer -} - -func (m *MsgSubmitProposal) GetMessages() ([]sdk.Msg, error) { +func (m *MsgSubmitProposal) GetMsgs() ([]sdk.Msg, error) { return sdktx.GetMsgs(m.Messages, "sdk.MsgProposal") } func (m *MsgSubmitProposal) SetInitialDeposit(coins sdk.Coins) { - m.InitialDeposit = coins + m.InitialDeposit = ToCoinSlice(coins) } func (m *MsgSubmitProposal) SetProposer(address fmt.Stringer) { @@ -90,11 +81,14 @@ func (m MsgSubmitProposal) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Proposer); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid proposer address: %s", err) } - if !m.InitialDeposit.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.InitialDeposit.String()) + + deposit := NewCoins(m.InitialDeposit) + if !deposit.IsValid() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, deposit.String()) } - if m.InitialDeposit.IsAnyNegative() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.InitialDeposit.String()) + + if deposit.IsAnyNegative() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, deposit.String()) } // Empty messages are not allowed @@ -103,7 +97,7 @@ func (m MsgSubmitProposal) ValidateBasic() error { // return ErrNoProposalMsgs // } - msgs, err := m.GetMessages() + msgs, err := m.GetMsgs() if err != nil { return err } @@ -130,12 +124,6 @@ func (m MsgSubmitProposal) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{proposer} } -// String implements the Stringer interface -func (m MsgSubmitProposal) String() string { - out, _ := yaml.Marshal(m) - return string(out) -} - // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (m MsgSubmitProposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { return sdktx.UnpackInterfaces(unpacker, m.Messages) @@ -144,7 +132,7 @@ func (m MsgSubmitProposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { // NewMsgDeposit creates a new MsgDeposit instance //nolint:interfacer func NewMsgDeposit(depositor sdk.AccAddress, proposalID uint64, amount sdk.Coins) *MsgDeposit { - return &MsgDeposit{proposalID, depositor.String(), amount} + return &MsgDeposit{proposalID, depositor.String(), ToCoinSlice(amount)} } // Route implements Msg @@ -158,22 +146,17 @@ func (msg MsgDeposit) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Depositor); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid depositor address: %s", err) } - if !msg.Amount.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.Amount.String()) + amount := NewCoins(msg.Amount) + if !amount.IsValid() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, amount.String()) } - if msg.Amount.IsAnyNegative() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.Amount.String()) + if amount.IsAnyNegative() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, amount.String()) } return nil } -// String implements the Stringer interface -func (msg MsgDeposit) String() string { - out, _ := yaml.Marshal(msg) - return string(out) -} - // GetSignBytes implements Msg func (msg MsgDeposit) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(&msg) @@ -210,12 +193,6 @@ func (msg MsgVote) ValidateBasic() error { return nil } -// String implements the Stringer interface -func (msg MsgVote) String() string { - out, _ := yaml.Marshal(msg) - return string(out) -} - // GetSignBytes implements Msg func (msg MsgVote) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(&msg) @@ -252,10 +229,14 @@ func (msg MsgVoteWeighted) ValidateBasic() error { totalWeight := sdk.NewDec(0) usedOptions := make(map[VoteOption]bool) for _, option := range msg.Options { - if !ValidWeightedVoteOption(option) { + if !option.IsValid() { return sdkerrors.Wrap(ErrInvalidVote, option.String()) } - totalWeight = totalWeight.Add(option.Weight) + weight, err := sdk.NewDecFromStr(option.Weight) + if err != nil { + return sdkerrors.Wrapf(ErrInvalidVote, "Invalid weight: %w", err) + } + totalWeight = totalWeight.Add(weight) if usedOptions[option.Option] { return sdkerrors.Wrap(ErrInvalidVote, "Duplicated vote option") } @@ -273,12 +254,6 @@ func (msg MsgVoteWeighted) ValidateBasic() error { return nil } -// String implements the Stringer interface -func (msg MsgVoteWeighted) String() string { - out, _ := yaml.Marshal(msg) - return string(out) -} - // GetSignBytes implements Msg func (msg MsgVoteWeighted) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(&msg) @@ -290,3 +265,21 @@ func (msg MsgVoteWeighted) GetSigners() []sdk.AccAddress { voter, _ := sdk.AccAddressFromBech32(msg.Voter) return []sdk.AccAddress{voter} } + +func NewCoins(coins []*sdk.Coin) sdk.Coins { + var c []sdk.Coin + for _, coin := range coins { + if coin != nil { + c = append(c, *coin) + } + } + return sdk.NewCoins(c...) +} + +func ToCoinSlice(coins sdk.Coins) []*sdk.Coin { + slice := make([]*sdk.Coin, 0, len(coins)) + for idx, coin := range coins { + slice[idx] = &coin + } + return slice +} diff --git a/x/gov/types/msgs_test.go b/x/gov/types/msgs_test.go index 6f426937e93c..81ea2716f28b 100644 --- a/x/gov/types/msgs_test.go +++ b/x/gov/types/msgs_test.go @@ -95,23 +95,23 @@ func TestMsgVoteWeighted(t *testing.T) { {0, addrs[0], NewNonSplitVoteOption(OptionNoWithVeto), true}, {0, addrs[0], NewNonSplitVoteOption(OptionAbstain), true}, {0, addrs[0], WeightedVoteOptions{ // weight sum > 1 - WeightedVoteOption{Option: OptionYes, Weight: sdk.NewDec(1)}, - WeightedVoteOption{Option: OptionAbstain, Weight: sdk.NewDec(1)}, + NewWeightedVoteOption(OptionYes, sdk.NewDec(1)), + NewWeightedVoteOption(OptionAbstain, sdk.NewDec(1)), }, false}, {0, addrs[0], WeightedVoteOptions{ // duplicate option - WeightedVoteOption{Option: OptionYes, Weight: sdk.NewDecWithPrec(5, 1)}, - WeightedVoteOption{Option: OptionYes, Weight: sdk.NewDecWithPrec(5, 1)}, + NewWeightedVoteOption(OptionYes, sdk.NewDecWithPrec(5, 1)), + NewWeightedVoteOption(OptionYes, sdk.NewDecWithPrec(5, 1)), }, false}, {0, addrs[0], WeightedVoteOptions{ // zero weight - WeightedVoteOption{Option: OptionYes, Weight: sdk.NewDec(0)}, + NewWeightedVoteOption(OptionYes, sdk.NewDec(0)), }, false}, {0, addrs[0], WeightedVoteOptions{ // negative weight - WeightedVoteOption{Option: OptionYes, Weight: sdk.NewDec(-1)}, + NewWeightedVoteOption(OptionYes, sdk.NewDec(-1)), }, false}, {0, addrs[0], WeightedVoteOptions{}, false}, {0, addrs[0], NewNonSplitVoteOption(VoteOption(0x13)), false}, {0, addrs[0], WeightedVoteOptions{ // weight sum <1 - WeightedVoteOption{Option: OptionYes, Weight: sdk.NewDecWithPrec(5, 1)}, + NewWeightedVoteOption(OptionYes, sdk.NewDecWithPrec(5, 1)), }, false}, } diff --git a/x/gov/types/params.go b/x/gov/types/params.go index 0313076d81bf..e78f92fcadd5 100644 --- a/x/gov/types/params.go +++ b/x/gov/types/params.go @@ -1,11 +1,10 @@ package types import ( + "errors" "fmt" "time" - "sigs.k8s.io/yaml" - sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) @@ -42,8 +41,8 @@ func ParamKeyTable() paramtypes.KeyTable { // NewDepositParams creates a new DepositParams object func NewDepositParams(minDeposit sdk.Coins, maxDepositPeriod time.Duration) DepositParams { return DepositParams{ - MinDeposit: minDeposit, - MaxDepositPeriod: maxDepositPeriod, + MinDeposit: ToCoinSlice(minDeposit), + MaxDepositPeriod: &maxDepositPeriod, } } @@ -55,15 +54,9 @@ func DefaultDepositParams() DepositParams { ) } -// String implements stringer insterface -func (dp DepositParams) String() string { - out, _ := yaml.Marshal(dp) - return string(out) -} - // Equal checks equality of DepositParams func (dp DepositParams) Equal(dp2 DepositParams) bool { - return dp.MinDeposit.IsEqual(dp2.MinDeposit) && dp.MaxDepositPeriod == dp2.MaxDepositPeriod + return NewCoins(dp.MinDeposit).IsEqual(NewCoins(dp2.MinDeposit)) && dp.MaxDepositPeriod == dp2.MaxDepositPeriod } func validateDepositParams(i interface{}) error { @@ -72,10 +65,11 @@ func validateDepositParams(i interface{}) error { return fmt.Errorf("invalid parameter type: %T", i) } - if !v.MinDeposit.IsValid() { + minDeposit := NewCoins(v.MinDeposit) + if !minDeposit.IsValid() { return fmt.Errorf("invalid minimum deposit: %s", v.MinDeposit) } - if v.MaxDepositPeriod <= 0 { + if v.MaxDepositPeriod == nil || v.MaxDepositPeriod.Seconds() <= 0 { return fmt.Errorf("maximum deposit period must be positive: %d", v.MaxDepositPeriod) } @@ -85,9 +79,9 @@ func validateDepositParams(i interface{}) error { // NewTallyParams creates a new TallyParams object func NewTallyParams(quorum, threshold, vetoThreshold sdk.Dec) TallyParams { return TallyParams{ - Quorum: quorum, - Threshold: threshold, - VetoThreshold: vetoThreshold, + Quorum: quorum.String(), + Threshold: threshold.String(), + VetoThreshold: vetoThreshold.String(), } } @@ -98,13 +92,7 @@ func DefaultTallyParams() TallyParams { // Equal checks equality of TallyParams func (tp TallyParams) Equal(other TallyParams) bool { - return tp.Quorum.Equal(other.Quorum) && tp.Threshold.Equal(other.Threshold) && tp.VetoThreshold.Equal(other.VetoThreshold) -} - -// String implements stringer insterface -func (tp TallyParams) String() string { - out, _ := yaml.Marshal(tp) - return string(out) + return tp.Quorum == other.Quorum && tp.Threshold == other.Threshold && tp.VetoThreshold == other.VetoThreshold } func validateTallyParams(i interface{}) error { @@ -113,22 +101,36 @@ func validateTallyParams(i interface{}) error { return fmt.Errorf("invalid parameter type: %T", i) } - if v.Quorum.IsNegative() { - return fmt.Errorf("quorom cannot be negative: %s", v.Quorum) + quorum, err := sdk.NewDecFromStr(v.Quorum) + if err != nil { + return fmt.Errorf("invalid quorum string: %w", err) + } + if quorum.IsNegative() { + return fmt.Errorf("quorom cannot be negative: %s", quorum) } - if v.Quorum.GT(sdk.OneDec()) { + if quorum.GT(sdk.OneDec()) { return fmt.Errorf("quorom too large: %s", v) } - if !v.Threshold.IsPositive() { - return fmt.Errorf("vote threshold must be positive: %s", v.Threshold) + + threshold, err := sdk.NewDecFromStr(v.Threshold) + if err != nil { + return fmt.Errorf("invalid threshold string: %w", err) + } + if !threshold.IsPositive() { + return fmt.Errorf("vote threshold must be positive: %s", threshold) } - if v.Threshold.GT(sdk.OneDec()) { + if threshold.GT(sdk.OneDec()) { return fmt.Errorf("vote threshold too large: %s", v) } - if !v.VetoThreshold.IsPositive() { - return fmt.Errorf("veto threshold must be positive: %s", v.Threshold) + + vetoThreshold, err := sdk.NewDecFromStr(v.VetoThreshold) + if err != nil { + return fmt.Errorf("invalid vetoThreshold string: %w", err) + } + if !vetoThreshold.IsPositive() { + return fmt.Errorf("veto threshold must be positive: %s", vetoThreshold) } - if v.VetoThreshold.GT(sdk.OneDec()) { + if vetoThreshold.GT(sdk.OneDec()) { return fmt.Errorf("veto threshold too large: %s", v) } @@ -138,7 +140,7 @@ func validateTallyParams(i interface{}) error { // NewVotingParams creates a new VotingParams object func NewVotingParams(votingPeriod time.Duration) VotingParams { return VotingParams{ - VotingPeriod: votingPeriod, + VotingPeriod: &votingPeriod, } } @@ -152,19 +154,17 @@ func (vp VotingParams) Equal(other VotingParams) bool { return vp.VotingPeriod == other.VotingPeriod } -// String implements stringer interface -func (vp VotingParams) String() string { - out, _ := yaml.Marshal(vp) - return string(out) -} - func validateVotingParams(i interface{}) error { v, ok := i.(VotingParams) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } - if v.VotingPeriod <= 0 { + if v.VotingPeriod == nil { + return errors.New("voting period must not be nil") + } + + if v.VotingPeriod.Seconds() <= 0 { return fmt.Errorf("voting period must be positive: %s", v.VotingPeriod) } diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index 0f106b69d6bc..4d47e2983bb2 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -5,15 +5,24 @@ import ( "strings" "time" - "sigs.k8s.io/yaml" - "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdktx "github.com/cosmos/cosmos-sdk/types/tx" ) -// DefaultStartingProposalID is 1 -const DefaultStartingProposalID uint64 = 1 +const () + +const ( + // DefaultStartingProposalID is 1 + DefaultStartingProposalID uint64 = 1 + + StatusNil = ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED + StatusDepositPeriod = ProposalStatus_PROPOSAL_STATUS_DEPOSIT_PERIOD + StatusVotingPeriod = ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD + StatusPassed = ProposalStatus_PROPOSAL_STATUS_PASSED + StatusRejected = ProposalStatus_PROPOSAL_STATUS_REJECTED + StatusFailed = ProposalStatus_PROPOSAL_STATUS_FAILED +) // NewProposal creates a new Proposal instance func NewProposal(messages []sdk.Msg, id uint64, submitTime, depositEndTime time.Time) (Proposal, error) { @@ -28,22 +37,16 @@ func NewProposal(messages []sdk.Msg, id uint64, submitTime, depositEndTime time. Messages: msgs, Status: StatusDepositPeriod, FinalTallyResult: EmptyTallyResult(), - TotalDeposit: sdk.NewCoins(), - SubmitTime: submitTime, - DepositEndTime: depositEndTime, + TotalDeposit: make([]*sdk.Coin, 0), + SubmitTime: &submitTime, + DepositEndTime: &depositEndTime, } return p, nil } -// String implements stringer interface -func (p Proposal) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} - // GetMessages returns the proposal messages -func (p Proposal) GetMessages() ([]sdk.Msg, error) { +func (p Proposal) GetMsgs() ([]sdk.Msg, error) { return sdktx.GetMsgs(p.Messages, "sdk.MsgProposal") } @@ -57,21 +60,6 @@ type Proposals []Proposal var _ types.UnpackInterfacesMessage = Proposals{} -// Equal returns true if two slices (order-dependant) of proposals are equal. -func (p Proposals) Equal(other Proposals) bool { - if len(p) != len(other) { - return false - } - - for i, proposal := range p { - if !proposal.Equal(other[i]) { - return false - } - } - - return true -} - // String implements stringer interface func (p Proposals) String() string { out := "ID - (Status) [Type] Title\n" diff --git a/x/gov/types/tally.go b/x/gov/types/tally.go index 247bcecbc8a1..25d1e35846f5 100644 --- a/x/gov/types/tally.go +++ b/x/gov/types/tally.go @@ -1,8 +1,6 @@ package types import ( - "sigs.k8s.io/yaml" - sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -29,17 +27,17 @@ func NewValidatorGovInfo(address sdk.ValAddress, bondedTokens sdk.Int, delegator } // NewTallyResult creates a new TallyResult instance -func NewTallyResult(yes, abstain, no, noWithVeto sdk.Int) TallyResult { - return TallyResult{ - Yes: yes, - Abstain: abstain, - No: no, - NoWithVeto: noWithVeto, +func NewTallyResult(yes, abstain, no, noWithVeto sdk.Int) *TallyResult { + return &TallyResult{ + Yes: yes.String(), + Abstain: abstain.String(), + No: no.String(), + NoWithVeto: noWithVeto.String(), } } // NewTallyResultFromMap creates a new TallyResult instance from a Option -> Dec map -func NewTallyResultFromMap(results map[VoteOption]sdk.Dec) TallyResult { +func NewTallyResultFromMap(results map[VoteOption]sdk.Dec) *TallyResult { return NewTallyResult( results[OptionYes].TruncateInt(), results[OptionAbstain].TruncateInt(), @@ -49,20 +47,14 @@ func NewTallyResultFromMap(results map[VoteOption]sdk.Dec) TallyResult { } // EmptyTallyResult returns an empty TallyResult. -func EmptyTallyResult() TallyResult { +func EmptyTallyResult() *TallyResult { return NewTallyResult(sdk.ZeroInt(), sdk.ZeroInt(), sdk.ZeroInt(), sdk.ZeroInt()) } -// Equals returns if two proposals are equal. +// Equals returns if two tally results are equal. func (tr TallyResult) Equals(comp TallyResult) bool { - return tr.Yes.Equal(comp.Yes) && - tr.Abstain.Equal(comp.Abstain) && - tr.No.Equal(comp.No) && - tr.NoWithVeto.Equal(comp.NoWithVeto) -} - -// String implements stringer interface -func (tr TallyResult) String() string { - out, _ := yaml.Marshal(tr) - return string(out) + return tr.Yes == comp.Yes && + tr.Abstain == comp.Abstain && + tr.No == comp.No && + tr.NoWithVeto == comp.NoWithVeto } diff --git a/x/gov/types/vote.go b/x/gov/types/vote.go index d68eea8a4fc8..4b83d3ac325d 100644 --- a/x/gov/types/vote.go +++ b/x/gov/types/vote.go @@ -1,34 +1,33 @@ package types import ( - "encoding/json" "fmt" "strings" - "sigs.k8s.io/yaml" - sdk "github.com/cosmos/cosmos-sdk/types" ) +const ( + OptionEmpty = VoteOption_VOTE_OPTION_UNSPECIFIED + OptionYes = VoteOption_VOTE_OPTION_YES + OptionNo = VoteOption_VOTE_OPTION_NO + OptionNoWithVeto = VoteOption_VOTE_OPTION_NO_WITH_VETO + OptionAbstain = VoteOption_VOTE_OPTION_ABSTAIN +) + // NewVote creates a new Vote instance //nolint:interfacer func NewVote(proposalID uint64, voter sdk.AccAddress, options WeightedVoteOptions) Vote { return Vote{ProposalId: proposalID, Voter: voter.String(), Options: options} } -// String returns a string representation of Vote -func (v Vote) String() string { - out, _ := yaml.Marshal(v) - return string(out) -} - // Empty returns whether a vote is empty. func (v Vote) Empty() bool { - return v.String() == Vote{}.String() + return v.ProposalId == 0 || v.Voter == "" || len(v.Options) == 0 } // Votes is a collection of Vote objects -type Votes []Vote +type Votes []*Vote // Equal returns true if two slices (order-dependant) of votes are equal. func (v Votes) Equal(other Votes) bool { @@ -56,18 +55,31 @@ func (v Votes) String() string { return out } -// NewNonSplitVoteOption creates a single option vote with weight 1 -func NewNonSplitVoteOption(option VoteOption) WeightedVoteOptions { - return WeightedVoteOptions{{option, sdk.NewDec(1)}} +func NewWeightedVoteOption(option VoteOption, weight sdk.Dec) *WeightedVoteOption { + return &WeightedVoteOption{Option: option, Weight: weight.String()} } -func (v WeightedVoteOption) String() string { - out, _ := json.Marshal(v) - return string(out) +// IsValid returns true if the sub vote is valid and false otherwise. +func (w *WeightedVoteOption) IsValid() bool { + weight, err := sdk.NewDecFromStr(w.Weight) + if err != nil { + return false + } + + if !weight.IsPositive() || weight.GT(sdk.NewDec(1)) { + return false + } + + return ValidVoteOption(w.Option) +} + +// NewNonSplitVoteOption creates a single option vote with weight 1 +func NewNonSplitVoteOption(option VoteOption) WeightedVoteOptions { + return WeightedVoteOptions{{option, sdk.NewDec(1).String()}} } // WeightedVoteOptions describes array of WeightedVoteOptions -type WeightedVoteOptions []WeightedVoteOption +type WeightedVoteOptions []*WeightedVoteOption func (v WeightedVoteOptions) String() (out string) { for _, opt := range v { @@ -77,14 +89,6 @@ func (v WeightedVoteOptions) String() (out string) { return strings.TrimSpace(out) } -// ValidWeightedVoteOption returns true if the sub vote is valid and false otherwise. -func ValidWeightedVoteOption(option WeightedVoteOption) bool { - if !option.Weight.IsPositive() || option.Weight.GT(sdk.NewDec(1)) { - return false - } - return ValidVoteOption(option.Option) -} - // VoteOptionFromString returns a VoteOption from a string. It returns an error // if the string is invalid. func VoteOptionFromString(str string) (VoteOption, error) { @@ -112,7 +116,7 @@ func WeightedVoteOptionsFromString(str string) (WeightedVoteOptions, error) { if err != nil { return options, err } - options = append(options, WeightedVoteOption{option, weight}) + options = append(options, NewWeightedVoteOption(option, weight)) } return options, nil } From d50c793d1d6f0b2780967241e2e88aa4d6d57c3e Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Wed, 15 Dec 2021 17:27:42 +0100 Subject: [PATCH 06/12] fix a few more errors --- .gitignore | 2 ++ x/genutil/migrations/v043/migrate.go | 2 +- x/gov/migrations/v043/store_test.go | 5 +++-- x/gov/simulation/genesis_test.go | 12 ++++++------ x/gov/types/msgs.go | 4 ++-- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 14e117b3bad6..e3083e55dc26 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,8 @@ client/lcd/keys/* coverage.txt profile.out sim_log_file +x/genutil/config +x/genutil/data # Vagrant .vagrant/ diff --git a/x/genutil/migrations/v043/migrate.go b/x/genutil/migrations/v043/migrate.go index 20669b826852..8c37ee61d456 100644 --- a/x/genutil/migrations/v043/migrate.go +++ b/x/genutil/migrations/v043/migrate.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/genutil/types" v040gov "github.com/cosmos/cosmos-sdk/x/gov/migrations/v040" v043gov "github.com/cosmos/cosmos-sdk/x/gov/migrations/v043" - gov "github.com/cosmos/cosmos-sdk/x/gov/types" + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // Migrate migrates exported state from v0.40 to a v0.43 genesis state. diff --git a/x/gov/migrations/v043/store_test.go b/x/gov/migrations/v043/store_test.go index b97c126a781e..56d2ae2d815b 100644 --- a/x/gov/migrations/v043/store_test.go +++ b/x/gov/migrations/v043/store_test.go @@ -14,6 +14,7 @@ import ( v040gov "github.com/cosmos/cosmos-sdk/x/gov/migrations/v040" v043gov "github.com/cosmos/cosmos-sdk/x/gov/migrations/v043" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) func TestMigrateStore(t *testing.T) { @@ -28,9 +29,9 @@ func TestMigrateStore(t *testing.T) { // Use dummy value for keys where we don't test values. dummyValue := []byte("foo") // Use real values for votes, as we're testing weighted votes. - oldVote := types.Vote{ProposalId: 1, Voter: "foobar", Option: types.OptionNoWithVeto} + oldVote := v1beta1.Vote{ProposalId: 1, Voter: "foobar", Option: v1beta1.OptionNoWithVeto} oldVoteValue := cdc.MustMarshal(&oldVote) - newVote := types.Vote{ProposalId: 1, Voter: "foobar", Options: types.WeightedVoteOptions{{Option: types.OptionNoWithVeto, Weight: sdk.NewDec(1).String()}}} + newVote := v1beta1.Vote{ProposalId: 1, Voter: "foobar", Options: v1beta1.WeightedVoteOptions{{Option: v1beta1.OptionNoWithVeto, Weight: sdk.NewDec(1)}}} newVoteValue := cdc.MustMarshal(&newVote) testCases := []struct { diff --git a/x/gov/simulation/genesis_test.go b/x/gov/simulation/genesis_test.go index 941f1fb8d5bf..a7e7e4bd4145 100644 --- a/x/gov/simulation/genesis_test.go +++ b/x/gov/simulation/genesis_test.go @@ -47,13 +47,13 @@ func TestRandomizedGenState(t *testing.T) { require.Equal(t, "905stake", govGenesis.DepositParams.MinDeposit[0].String()) require.Equal(t, "77h26m10s", govGenesis.DepositParams.MaxDepositPeriod.String()) require.Equal(t, float64(148296), govGenesis.VotingParams.VotingPeriod.Seconds()) - require.Equal(t, dec1, govGenesis.TallyParams.Quorum) - require.Equal(t, dec2, govGenesis.TallyParams.Threshold) - require.Equal(t, dec3, govGenesis.TallyParams.VetoThreshold) + require.Equal(t, dec1.String(), govGenesis.TallyParams.Quorum) + require.Equal(t, dec2.String(), govGenesis.TallyParams.Threshold) + require.Equal(t, dec3.String(), govGenesis.TallyParams.VetoThreshold) require.Equal(t, uint64(0x28), govGenesis.StartingProposalId) - require.Equal(t, types.Deposits{}, govGenesis.Deposits) - require.Equal(t, types.Votes{}, govGenesis.Votes) - require.Equal(t, types.Proposals{}, govGenesis.Proposals) + require.Equal(t, []*types.Deposit{}, govGenesis.Deposits) + require.Equal(t, []*types.Vote{}, govGenesis.Votes) + require.Equal(t, []*types.Proposal{}, govGenesis.Proposals) } // TestRandomizedGenState tests abnormal scenarios of applying RandomizedGenState. diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index 8dea1790f773..ab7e0871cc4c 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -234,7 +234,7 @@ func (msg MsgVoteWeighted) ValidateBasic() error { } weight, err := sdk.NewDecFromStr(option.Weight) if err != nil { - return sdkerrors.Wrapf(ErrInvalidVote, "Invalid weight: %w", err) + return sdkerrors.Wrapf(ErrInvalidVote, "Invalid weight: %s", err) } totalWeight = totalWeight.Add(weight) if usedOptions[option.Option] { @@ -277,7 +277,7 @@ func NewCoins(coins []*sdk.Coin) sdk.Coins { } func ToCoinSlice(coins sdk.Coins) []*sdk.Coin { - slice := make([]*sdk.Coin, 0, len(coins)) + slice := make([]*sdk.Coin, len(coins)) for idx, coin := range coins { slice[idx] = &coin } From 95803d979e84318d5e8f3014724e84a3996afdb2 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 16 Dec 2021 11:54:12 +0100 Subject: [PATCH 07/12] restore gogoproto for non nullable sdk Coins --- proto/cosmos/gov/v1beta2/gov.proto | 6 +- proto/cosmos/gov/v1beta2/tx.proto | 5 +- x/gov/migrations/v043/json.go | 10 +- x/gov/migrations/v043/json_test.go | 16 +-- x/gov/types/deposit.go | 7 +- x/gov/types/gov.pb.go | 150 ++++++++++++++--------------- x/gov/types/msgs.go | 28 +----- x/gov/types/params.go | 6 +- x/gov/types/proposal.go | 2 +- x/gov/types/tx.pb.go | 96 +++++++++--------- 10 files changed, 153 insertions(+), 173 deletions(-) diff --git a/proto/cosmos/gov/v1beta2/gov.proto b/proto/cosmos/gov/v1beta2/gov.proto index 33a7e6d8082d..81fc4ebee083 100644 --- a/proto/cosmos/gov/v1beta2/gov.proto +++ b/proto/cosmos/gov/v1beta2/gov.proto @@ -35,7 +35,7 @@ message WeightedVoteOption { message Deposit { uint64 proposal_id = 1; string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated cosmos.base.v1beta1.Coin amount = 3; + repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; } // Proposal defines the core field members of a governance proposal. @@ -46,7 +46,7 @@ message Proposal { TallyResult final_tally_result = 4; google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true]; google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true]; - repeated cosmos.base.v1beta1.Coin total_deposit = 7; + repeated cosmos.base.v1beta1.Coin total_deposit = 7 [(gogoproto.nullable) = false]; google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true]; google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true]; } @@ -95,7 +95,7 @@ message Vote { // DepositParams defines the params for deposits on governance proposals. message DepositParams { // Minimum deposit for a proposal to enter voting period. - repeated cosmos.base.v1beta1.Coin min_deposit = 1; + repeated cosmos.base.v1beta1.Coin min_deposit = 1 [(gogoproto.nullable) = false]; // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 // months. diff --git a/proto/cosmos/gov/v1beta2/tx.proto b/proto/cosmos/gov/v1beta2/tx.proto index c03a0fdf60d3..cb60a3e9c38b 100644 --- a/proto/cosmos/gov/v1beta2/tx.proto +++ b/proto/cosmos/gov/v1beta2/tx.proto @@ -3,6 +3,7 @@ package cosmos.gov.v1beta2; import "cosmos/base/v1beta1/coin.proto"; import "cosmos/gov/v1beta2/gov.proto"; +import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "google/protobuf/any.proto"; @@ -29,7 +30,7 @@ service Msg { // proposal Content. message MsgSubmitProposal { repeated google.protobuf.Any messages = 1; - repeated cosmos.base.v1beta1.Coin initial_deposit = 2; + repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [(gogoproto.nullable) = false]; string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } @@ -66,7 +67,7 @@ message MsgVoteWeightedResponse {} message MsgDeposit { uint64 proposal_id = 1; string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated cosmos.base.v1beta1.Coin amount = 3; + repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; } // MsgDepositResponse defines the Msg/Deposit response type. diff --git a/x/gov/migrations/v043/json.go b/x/gov/migrations/v043/json.go index b3bff9e50bc8..f5eca24d9a39 100644 --- a/x/gov/migrations/v043/json.go +++ b/x/gov/migrations/v043/json.go @@ -1,12 +1,12 @@ package v043 import ( - types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // migrateWeightedVotes migrates the ADR-037 weighted votes. -func migrateJSONWeightedVotes(oldVotes types.Votes) types.Votes { - newVotes := make(types.Votes, len(oldVotes)) +func migrateJSONWeightedVotes(oldVotes v1beta1.Votes) v1beta1.Votes { + newVotes := make(v1beta1.Votes, len(oldVotes)) for i, oldVote := range oldVotes { newVotes[i] = migrateVote(oldVote) } @@ -18,8 +18,8 @@ func migrateJSONWeightedVotes(oldVotes types.Votes) types.Votes { // v0.43 x/gov genesis state. The migration includes: // // - Gov weighted votes. -func MigrateJSON(oldState *types.GenesisState) *types.GenesisState { - return &types.GenesisState{ +func MigrateJSON(oldState *v1beta1.GenesisState) *v1beta1.GenesisState { + return &v1beta1.GenesisState{ StartingProposalId: oldState.StartingProposalId, Deposits: oldState.Deposits, Votes: migrateJSONWeightedVotes(oldState.Votes), diff --git a/x/gov/migrations/v043/json_test.go b/x/gov/migrations/v043/json_test.go index 608146250e81..abe85162429e 100644 --- a/x/gov/migrations/v043/json_test.go +++ b/x/gov/migrations/v043/json_test.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" v043gov "github.com/cosmos/cosmos-sdk/x/gov/migrations/v043" - types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) func TestMigrateJSON(t *testing.T) { @@ -23,13 +23,13 @@ func TestMigrateJSON(t *testing.T) { voter, err := sdk.AccAddressFromBech32("cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh") require.NoError(t, err) - govGenState := &types.GenesisState{ - Votes: types.Votes{ - types.Vote{ProposalId: 1, Voter: voter.String(), Option: types.OptionAbstain}, - types.Vote{ProposalId: 2, Voter: voter.String(), Option: types.OptionEmpty}, - types.Vote{ProposalId: 3, Voter: voter.String(), Option: types.OptionNo}, - types.Vote{ProposalId: 4, Voter: voter.String(), Option: types.OptionNoWithVeto}, - types.Vote{ProposalId: 5, Voter: voter.String(), Option: types.OptionYes}, + govGenState := &v1beta1.GenesisState{ + Votes: v1beta1.Votes{ + v1beta1.Vote{ProposalId: 1, Voter: voter.String(), Option: v1beta1.OptionAbstain}, + v1beta1.Vote{ProposalId: 2, Voter: voter.String(), Option: v1beta1.OptionEmpty}, + v1beta1.Vote{ProposalId: 3, Voter: voter.String(), Option: v1beta1.OptionNo}, + v1beta1.Vote{ProposalId: 4, Voter: voter.String(), Option: v1beta1.OptionNoWithVeto}, + v1beta1.Vote{ProposalId: 5, Voter: voter.String(), Option: v1beta1.OptionYes}, }, } diff --git a/x/gov/types/deposit.go b/x/gov/types/deposit.go index 1e188f9711f3..5f106859f1d3 100644 --- a/x/gov/types/deposit.go +++ b/x/gov/types/deposit.go @@ -9,7 +9,7 @@ import ( // NewDeposit creates a new Deposit instance //nolint:interfacer func NewDeposit(proposalID uint64, depositor sdk.AccAddress, amount sdk.Coins) Deposit { - return Deposit{proposalID, depositor.String(), ToCoinSlice(amount)} + return Deposit{proposalID, depositor.String(), amount} } // Deposits is a collection of Deposit objects @@ -40,8 +40,3 @@ func (d Deposits) String() string { } return out } - -// Empty returns whether a deposit is empty. -func (d Deposit) Empty() bool { - return NewCoins(d.Amount).Empty() -} diff --git a/x/gov/types/gov.pb.go b/x/gov/types/gov.pb.go index 8b4cfea3f4e3..0a9ad1dac4c4 100644 --- a/x/gov/types/gov.pb.go +++ b/x/gov/types/gov.pb.go @@ -176,9 +176,9 @@ func (m *WeightedVoteOption) GetWeight() string { // Deposit defines an amount deposited by an account address to an active // proposal. type Deposit struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` - Amount []*types.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount,omitempty"` + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` + Amount []types.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount"` } func (m *Deposit) Reset() { *m = Deposit{} } @@ -228,7 +228,7 @@ func (m *Deposit) GetDepositor() string { return "" } -func (m *Deposit) GetAmount() []*types.Coin { +func (m *Deposit) GetAmount() []types.Coin { if m != nil { return m.Amount } @@ -243,7 +243,7 @@ type Proposal struct { FinalTallyResult *TallyResult `protobuf:"bytes,4,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result,omitempty"` SubmitTime *time.Time `protobuf:"bytes,5,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time,omitempty"` DepositEndTime *time.Time `protobuf:"bytes,6,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time,omitempty"` - TotalDeposit []*types.Coin `protobuf:"bytes,7,rep,name=total_deposit,json=totalDeposit,proto3" json:"total_deposit,omitempty"` + TotalDeposit []types.Coin `protobuf:"bytes,7,rep,name=total_deposit,json=totalDeposit,proto3" json:"total_deposit"` VotingStartTime *time.Time `protobuf:"bytes,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time,omitempty"` VotingEndTime *time.Time `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time,omitempty"` } @@ -323,7 +323,7 @@ func (m *Proposal) GetDepositEndTime() *time.Time { return nil } -func (m *Proposal) GetTotalDeposit() []*types.Coin { +func (m *Proposal) GetTotalDeposit() []types.Coin { if m != nil { return m.TotalDeposit } @@ -490,7 +490,7 @@ func (m *Vote) GetOptions() []*WeightedVoteOption { // DepositParams defines the params for deposits on governance proposals. type DepositParams struct { // Minimum deposit for a proposal to enter voting period. - MinDeposit []*types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit,omitempty"` + MinDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit"` // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 // months. MaxDepositPeriod *time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty"` @@ -529,7 +529,7 @@ func (m *DepositParams) XXX_DiscardUnknown() { var xxx_messageInfo_DepositParams proto.InternalMessageInfo -func (m *DepositParams) GetMinDeposit() []*types.Coin { +func (m *DepositParams) GetMinDeposit() []types.Coin { if m != nil { return m.MinDeposit } @@ -671,71 +671,71 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1beta2/gov.proto", fileDescriptor_5abf7b8852811c49) } var fileDescriptor_5abf7b8852811c49 = []byte{ - // 1012 bytes of a gzipped FileDescriptorProto + // 1019 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xc1, 0x6e, 0xdb, 0x46, - 0x10, 0x35, 0x25, 0x59, 0xb6, 0x47, 0xb6, 0xc2, 0x6e, 0x8c, 0x86, 0x76, 0x52, 0xda, 0xd5, 0xc1, - 0x10, 0x82, 0x9a, 0x8a, 0x5d, 0x34, 0x87, 0x1e, 0x8a, 0x4a, 0x26, 0xd3, 0x30, 0x70, 0x4c, 0x81, - 0x64, 0x64, 0xb4, 0x17, 0x82, 0x32, 0x37, 0x14, 0x51, 0x91, 0xab, 0x72, 0x57, 0x8e, 0xfd, 0x09, - 0xbd, 0xe5, 0x52, 0xa0, 0xc8, 0x2f, 0xf4, 0x9a, 0x8f, 0xe8, 0xa9, 0x0d, 0x02, 0x14, 0xe8, 0xad, - 0x85, 0xfd, 0x23, 0x05, 0x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c, 0xfb, 0x55, 0x6e, 0xb2, 0x2f, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x7b, 0x12, 0x44, 0xf8, - 0xfe, 0x08, 0x00, 0x00, + 0x10, 0x35, 0x25, 0x59, 0xb6, 0x47, 0xb6, 0xc2, 0x6e, 0x8c, 0x86, 0x76, 0x52, 0xca, 0xd5, 0xc1, + 0x10, 0x82, 0x5a, 0x8a, 0x5d, 0x34, 0x05, 0x7a, 0x8a, 0x64, 0x32, 0x0d, 0x03, 0xc7, 0x14, 0x48, + 0x46, 0x46, 0x7b, 0x21, 0x28, 0x73, 0x43, 0x11, 0x15, 0xb9, 0x2a, 0x77, 0xe5, 0xd8, 0x9f, 0xd0, + 0x5b, 0x8e, 0x45, 0x7b, 0xe9, 0xbd, 0xd7, 0x7c, 0x44, 0x4e, 0x45, 0x10, 0x20, 0x40, 0x4f, 0x6d, + 0x61, 0xff, 0x48, 0xc1, 0xe5, 0xd2, 0x96, 0x65, 0x05, 0xd6, 0xc9, 0xab, 0x99, 0xf7, 0xde, 0xce, + 0xec, 0xbe, 0x1d, 0x13, 0x1e, 0x1c, 0x13, 0x1a, 0x11, 0xda, 0x0a, 0xc8, 0x49, 0xeb, 0x64, 0xb7, + 0x8f, 0x99, 0xb7, 0x97, 0xae, 0x9b, 0xa3, 0x84, 0x30, 0x82, 0x50, 0x96, 0x6d, 0xa6, 0x11, 0x91, + 0xdd, 0x54, 0x05, 0xa3, 0xef, 0x51, 0x2c, 0x28, 0xbb, 0xad, 0x63, 0x12, 0xc6, 0x19, 0x67, 0x73, + 0x3d, 0x20, 0x01, 0xe1, 0xcb, 0x56, 0xba, 0x12, 0xd1, 0x5a, 0x40, 0x48, 0x30, 0xc4, 0x2d, 0xfe, + 0xab, 0x3f, 0x7e, 0xd5, 0x62, 0x61, 0x84, 0x29, 0xf3, 0xa2, 0x91, 0x00, 0x6c, 0x4c, 0x03, 0xbc, + 0xf8, 0x4c, 0xa4, 0xd4, 0xe9, 0x94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x96, 0xe6, 0x53, 0x5e, 0xcd, 0x58, + 0x42, 0xf5, 0xb7, 0xdc, 0x7e, 0x42, 0x75, 0x1b, 0xca, 0x3f, 0x8f, 0x49, 0x32, 0x8e, 0x66, 0x38, + 0x90, 0x0f, 0xeb, 0x2c, 0x8b, 0xbe, 0x82, 0x15, 0x36, 0x48, 0x30, 0x1d, 0x90, 0xa1, 0xff, 0x89, + 0xb9, 0x7e, 0x05, 0x40, 0xdf, 0x40, 0x35, 0x35, 0x98, 0x7b, 0x45, 0x29, 0xce, 0xa4, 0xac, 0xa5, + 0x28, 0x27, 0x07, 0x3d, 0xfc, 0x45, 0x02, 0x98, 0xf8, 0x07, 0x74, 0x1f, 0xee, 0xf5, 0x4c, 0x47, + 0x77, 0xcd, 0xae, 0x63, 0x98, 0x87, 0xee, 0xcb, 0x43, 0xbb, 0xab, 0xef, 0x1b, 0x4f, 0x0d, 0x5d, + 0x93, 0x17, 0xd0, 0x5d, 0xb8, 0x33, 0x99, 0xfc, 0x41, 0xb7, 0x65, 0x09, 0xdd, 0x83, 0xbb, 0x93, + 0xc1, 0x76, 0xc7, 0x76, 0xda, 0xc6, 0xa1, 0x5c, 0x40, 0x08, 0xaa, 0x93, 0x89, 0x43, 0x53, 0x2e, + 0xa2, 0x07, 0xa0, 0x5c, 0x8f, 0xb9, 0x47, 0x86, 0xf3, 0xcc, 0xed, 0xe9, 0x8e, 0x29, 0x97, 0x1e, + 0xfe, 0x25, 0x41, 0xf5, 0xfa, 0xf8, 0x45, 0x35, 0xb8, 0xdf, 0xb5, 0xcc, 0xae, 0x69, 0xb7, 0x0f, + 0x5c, 0xdb, 0x69, 0x3b, 0x2f, 0xed, 0xa9, 0x9a, 0xea, 0xa0, 0x4e, 0x03, 0x34, 0xbd, 0x6b, 0xda, + 0x86, 0xe3, 0x76, 0x75, 0xcb, 0x30, 0x35, 0x59, 0x42, 0x5f, 0xc2, 0x17, 0xd3, 0x98, 0x9e, 0xe9, + 0x18, 0x87, 0xdf, 0xe7, 0x90, 0x02, 0xda, 0x84, 0xcf, 0xa7, 0x21, 0xdd, 0xb6, 0x6d, 0xeb, 0x5a, + 0x56, 0xf4, 0x74, 0xce, 0xd2, 0x9f, 0xeb, 0xfb, 0x8e, 0xae, 0xc9, 0xa5, 0x59, 0xcc, 0xa7, 0x6d, + 0xe3, 0x40, 0xd7, 0xe4, 0xc5, 0x4e, 0xe7, 0xdd, 0xb9, 0x2a, 0xbd, 0x3f, 0x57, 0xa5, 0xff, 0xce, + 0x55, 0xe9, 0xcd, 0x85, 0xba, 0xf0, 0xfe, 0x42, 0x5d, 0xf8, 0xfb, 0x42, 0x5d, 0xf8, 0xb1, 0x11, + 0x84, 0x6c, 0x30, 0xee, 0x37, 0x8f, 0x49, 0x24, 0xbe, 0x0b, 0xc4, 0x9f, 0x1d, 0xea, 0xff, 0xd4, + 0x3a, 0xe5, 0x5f, 0x3d, 0xec, 0x6c, 0x84, 0x69, 0xbf, 0xcc, 0x4d, 0xf6, 0xf5, 0xff, 0x01, 0x00, + 0x00, 0xff, 0xff, 0xa4, 0x3d, 0x7c, 0xd7, 0x10, 0x09, 0x00, 0x00, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { @@ -1579,7 +1579,7 @@ func (m *Deposit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, &types.Coin{}) + m.Amount = append(m.Amount, types.Coin{}) if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1843,7 +1843,7 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TotalDeposit = append(m.TotalDeposit, &types.Coin{}) + m.TotalDeposit = append(m.TotalDeposit, types.Coin{}) if err := m.TotalDeposit[len(m.TotalDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2331,7 +2331,7 @@ func (m *DepositParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MinDeposit = append(m.MinDeposit, &types.Coin{}) + m.MinDeposit = append(m.MinDeposit, types.Coin{}) if err := m.MinDeposit[len(m.MinDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index ab7e0871cc4c..8b9a6e58bb8b 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -29,7 +29,7 @@ var ( //nolint:interfacer func NewMsgSubmitProposal(messages []sdk.Msg, initialDeposit sdk.Coins, proposer sdk.AccAddress) (*MsgSubmitProposal, error) { m := &MsgSubmitProposal{ - InitialDeposit: ToCoinSlice(initialDeposit), + InitialDeposit: initialDeposit, Proposer: proposer.String(), } @@ -45,7 +45,7 @@ func (m *MsgSubmitProposal) GetMsgs() ([]sdk.Msg, error) { } func (m *MsgSubmitProposal) SetInitialDeposit(coins sdk.Coins) { - m.InitialDeposit = ToCoinSlice(coins) + m.InitialDeposit = coins } func (m *MsgSubmitProposal) SetProposer(address fmt.Stringer) { @@ -82,7 +82,7 @@ func (m MsgSubmitProposal) ValidateBasic() error { return sdkerrors.ErrInvalidAddress.Wrapf("invalid proposer address: %s", err) } - deposit := NewCoins(m.InitialDeposit) + deposit := sdk.NewCoins(m.InitialDeposit...) if !deposit.IsValid() { return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, deposit.String()) } @@ -132,7 +132,7 @@ func (m MsgSubmitProposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { // NewMsgDeposit creates a new MsgDeposit instance //nolint:interfacer func NewMsgDeposit(depositor sdk.AccAddress, proposalID uint64, amount sdk.Coins) *MsgDeposit { - return &MsgDeposit{proposalID, depositor.String(), ToCoinSlice(amount)} + return &MsgDeposit{proposalID, depositor.String(), amount} } // Route implements Msg @@ -146,7 +146,7 @@ func (msg MsgDeposit) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Depositor); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid depositor address: %s", err) } - amount := NewCoins(msg.Amount) + amount := sdk.NewCoins(msg.Amount...) if !amount.IsValid() { return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, amount.String()) } @@ -265,21 +265,3 @@ func (msg MsgVoteWeighted) GetSigners() []sdk.AccAddress { voter, _ := sdk.AccAddressFromBech32(msg.Voter) return []sdk.AccAddress{voter} } - -func NewCoins(coins []*sdk.Coin) sdk.Coins { - var c []sdk.Coin - for _, coin := range coins { - if coin != nil { - c = append(c, *coin) - } - } - return sdk.NewCoins(c...) -} - -func ToCoinSlice(coins sdk.Coins) []*sdk.Coin { - slice := make([]*sdk.Coin, len(coins)) - for idx, coin := range coins { - slice[idx] = &coin - } - return slice -} diff --git a/x/gov/types/params.go b/x/gov/types/params.go index e78f92fcadd5..a4ab8d965927 100644 --- a/x/gov/types/params.go +++ b/x/gov/types/params.go @@ -41,7 +41,7 @@ func ParamKeyTable() paramtypes.KeyTable { // NewDepositParams creates a new DepositParams object func NewDepositParams(minDeposit sdk.Coins, maxDepositPeriod time.Duration) DepositParams { return DepositParams{ - MinDeposit: ToCoinSlice(minDeposit), + MinDeposit: minDeposit, MaxDepositPeriod: &maxDepositPeriod, } } @@ -56,7 +56,7 @@ func DefaultDepositParams() DepositParams { // Equal checks equality of DepositParams func (dp DepositParams) Equal(dp2 DepositParams) bool { - return NewCoins(dp.MinDeposit).IsEqual(NewCoins(dp2.MinDeposit)) && dp.MaxDepositPeriod == dp2.MaxDepositPeriod + return sdk.NewCoins(dp.MinDeposit...).IsEqual(sdk.NewCoins(dp2.MinDeposit...)) && dp.MaxDepositPeriod == dp2.MaxDepositPeriod } func validateDepositParams(i interface{}) error { @@ -65,7 +65,7 @@ func validateDepositParams(i interface{}) error { return fmt.Errorf("invalid parameter type: %T", i) } - minDeposit := NewCoins(v.MinDeposit) + minDeposit := sdk.NewCoins(v.MinDeposit...) if !minDeposit.IsValid() { return fmt.Errorf("invalid minimum deposit: %s", v.MinDeposit) } diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index 4d47e2983bb2..791dfd904d22 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -37,7 +37,7 @@ func NewProposal(messages []sdk.Msg, id uint64, submitTime, depositEndTime time. Messages: msgs, Status: StatusDepositPeriod, FinalTallyResult: EmptyTallyResult(), - TotalDeposit: make([]*sdk.Coin, 0), + TotalDeposit: sdk.NewCoins(), SubmitTime: &submitTime, DepositEndTime: &depositEndTime, } diff --git a/x/gov/types/tx.pb.go b/x/gov/types/tx.pb.go index 5c520165c837..c6062c7c8267 100644 --- a/x/gov/types/tx.pb.go +++ b/x/gov/types/tx.pb.go @@ -9,6 +9,7 @@ import ( _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" types1 "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" @@ -33,9 +34,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary // proposal Content. type MsgSubmitProposal struct { - Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` - InitialDeposit []*types1.Coin `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3" json:"initial_deposit,omitempty"` - Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` + Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` + InitialDeposit []types1.Coin `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3" json:"initial_deposit"` + Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` } func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } @@ -78,7 +79,7 @@ func (m *MsgSubmitProposal) GetMessages() []*types.Any { return nil } -func (m *MsgSubmitProposal) GetInitialDeposit() []*types1.Coin { +func (m *MsgSubmitProposal) GetInitialDeposit() []types1.Coin { if m != nil { return m.InitialDeposit } @@ -339,9 +340,9 @@ var xxx_messageInfo_MsgVoteWeightedResponse proto.InternalMessageInfo // MsgDeposit defines a message to submit a deposit to an existing proposal. type MsgDeposit struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` - Amount []*types1.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount,omitempty"` + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` + Amount []types1.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount"` } func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } @@ -391,7 +392,7 @@ func (m *MsgDeposit) GetDepositor() string { return "" } -func (m *MsgDeposit) GetAmount() []*types1.Coin { +func (m *MsgDeposit) GetAmount() []types1.Coin { if m != nil { return m.Amount } @@ -449,43 +450,44 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1beta2/tx.proto", fileDescriptor_4214261f6b3f9ed4) } var fileDescriptor_4214261f6b3f9ed4 = []byte{ - // 565 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0xee, 0x25, 0x25, 0x69, 0x5f, 0x51, 0xaa, 0x9e, 0x22, 0xe1, 0xb8, 0xc8, 0x44, 0x46, 0x54, - 0x91, 0x50, 0xce, 0x24, 0xa0, 0x4e, 0x0c, 0x34, 0x30, 0xc0, 0x10, 0x01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 0x16, 0x94, 0xbc, 0xa1, 0x18, 0x85, - 0x4a, 0x67, 0x58, 0x31, 0x80, 0x9a, 0x68, 0x57, 0x01, 0x5f, 0x38, 0xcb, 0x0c, 0xb7, 0x7f, 0x17, - 0xa0, 0xd8, 0x95, 0x0c, 0x9f, 0x40, 0xe5, 0xd2, 0xe7, 0x71, 0x6f, 0xd9, 0xdf, 0xb2, 0x30, 0x84, - 0x66, 0xf3, 0x5a, 0xb4, 0x7c, 0x56, 0x9f, 0xc3, 0x66, 0x32, 0x86, 0xfb, 0x57, 0xc8, 0xe6, 0xa0, - 0x79, 0x77, 0x05, 0x98, 0x57, 0x7a, 0x0f, 0x37, 0xff, 0x19, 0x94, 0x55, 0xa2, 0x8c, 0x64, 0xde, - 0xbf, 0x06, 0x29, 0x7f, 0xe1, 0x35, 0x94, 0xb3, 0x46, 0x5a, 0x57, 0xe8, 0x34, 0x6e, 0x1e, 0xac, - 0xc6, 0xb3, 0x92, 0x9d, 0xce, 0xf7, 0xa9, 0x85, 0xce, 0xa7, 0x16, 0xfa, 0x35, 0xb5, 0xd0, 0xc7, - 0x99, 0xb5, 0x71, 0x3e, 0xb3, 0x36, 0x7e, 0xce, 0xac, 0x8d, 0x77, 0x0d, 0xc6, 0xd5, 0xe9, 0xc8, - 0x27, 0x7d, 0x31, 0xd4, 0x7b, 0x4d, 0xff, 0x34, 0x65, 0xf0, 0xc1, 0x39, 0x4b, 0xf6, 0xa1, 0x9a, - 0x44, 0x54, 0xfa, 0xa5, 0x64, 0x3b, 0x3d, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x12, 0x5c, - 0x07, 0x7b, 0x05, 0x00, 0x00, + // 585 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x8d, 0x9b, 0x7e, 0xfd, 0xb9, 0xfd, 0x94, 0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0xe0, 0x77, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xe7, 0x3b, 0xf1, 0xb1, 0x9d, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1217,7 +1219,7 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.InitialDeposit = append(m.InitialDeposit, &types1.Coin{}) + m.InitialDeposit = append(m.InitialDeposit, types1.Coin{}) if err := m.InitialDeposit[len(m.InitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1808,7 +1810,7 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, &types1.Coin{}) + m.Amount = append(m.Amount, types1.Coin{}) if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } From 3ba024d05bc61c5fb26e19038a0124089241c05f Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 16 Dec 2021 13:26:50 +0100 Subject: [PATCH 08/12] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d9d54cbfd6e..15e09a5e680e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -190,6 +190,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/upgrade) [\#10189](https://github.com/cosmos/cosmos-sdk/issues/10189) Removed potential sources of non-determinism in upgrades * [\#10393](https://github.com/cosmos/cosmos-sdk/pull/10422) Add `MinCommissionRate` param to `x/staking` module. * [#10725](https://github.com/cosmos/cosmos-sdk/pull/10725) populate `ctx.ConsensusParams` for begin/end blockers. +* [#10763](https://github.com/cosmos/cosmos-sdk/pull/10763) modify the fields in `TallyParams` to use `string` instead of `bytes` ### Deprecated From ad8e6ef861b245b384ad15e2b563bf48ae824471 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 16 Dec 2021 17:58:38 +0100 Subject: [PATCH 09/12] fix test --- x/gov/types/genesis.go | 5 +++++ x/gov/types/msgs_test.go | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/x/gov/types/genesis.go b/x/gov/types/genesis.go index 392fc6b878ea..276a06c442a6 100644 --- a/x/gov/types/genesis.go +++ b/x/gov/types/genesis.go @@ -1,6 +1,7 @@ package types import ( + "errors" "fmt" "github.com/cosmos/cosmos-sdk/codec/types" @@ -36,6 +37,10 @@ func (data GenesisState) Empty() bool { // ValidateGenesis checks if parameters are within valid ranges func ValidateGenesis(data *GenesisState) error { + if data.StartingProposalId == 0 { + return errors.New("Starting proposal id must be greater than 0") + } + if err := validateTallyParams(data.TallyParams); err != nil { return fmt.Errorf("invalid tally params: %w", err) } diff --git a/x/gov/types/msgs_test.go b/x/gov/types/msgs_test.go index 81ea2716f28b..93e1bbf8e373 100644 --- a/x/gov/types/msgs_test.go +++ b/x/gov/types/msgs_test.go @@ -24,10 +24,10 @@ func init() { func TestMsgDepositGetSignBytes(t *testing.T) { addr := sdk.AccAddress("addr1") - msg := NewMsgDeposit(addr, 0, coinsPos) + msg := NewMsgDeposit(addr, 1, coinsPos) res := msg.GetSignBytes() - expected := `{"type":"cosmos-sdk/MsgDeposit","value":{"amount":[{"amount":"1000","denom":"stake"}],"depositor":"cosmos1v9jxgu33kfsgr5","proposal_id":"0"}}` + expected := `{"type":"cosmos-sdk/MsgDeposit","value":{"amount":[{"amount":"1000","denom":"stake"}],"depositor":"cosmos1v9jxgu33kfsgr5","proposal_id":"1"}}` require.Equal(t, expected, string(res)) } From 38c6c52e58bcfbb2c2a0f68d0515c9ead4fb8f14 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 16 Dec 2021 17:59:35 +0100 Subject: [PATCH 10/12] remove empty const --- x/gov/types/proposal.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index 791dfd904d22..b22808f9c5cd 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -10,8 +10,6 @@ import ( sdktx "github.com/cosmos/cosmos-sdk/types/tx" ) -const () - const ( // DefaultStartingProposalID is 1 DefaultStartingProposalID uint64 = 1 From b04b9bdc69b6e93c96cddcbba5ac5937cbd73d16 Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaurym@users.noreply.github.com> Date: Thu, 16 Dec 2021 18:27:53 +0100 Subject: [PATCH 11/12] Update x/gov/types/msgs_test.go --- x/gov/types/msgs_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/gov/types/msgs_test.go b/x/gov/types/msgs_test.go index 93e1bbf8e373..088593bb7e5c 100644 --- a/x/gov/types/msgs_test.go +++ b/x/gov/types/msgs_test.go @@ -27,7 +27,7 @@ func TestMsgDepositGetSignBytes(t *testing.T) { msg := NewMsgDeposit(addr, 1, coinsPos) res := msg.GetSignBytes() - expected := `{"type":"cosmos-sdk/MsgDeposit","value":{"amount":[{"amount":"1000","denom":"stake"}],"depositor":"cosmos1v9jxgu33kfsgr5","proposal_id":"1"}}` + expected := `{"type":"cosmos-sdk/MsgDeposit","value":{"amount":[{"amount":"1000","denom":"stake"}],"depositor":"cosmos1v9jxgu33kfsgr5"}}` require.Equal(t, expected, string(res)) } From 47b177e65ef4b6ce1dd7737645cbe3a345afe685 Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaurym@users.noreply.github.com> Date: Thu, 16 Dec 2021 18:28:00 +0100 Subject: [PATCH 12/12] Update x/gov/types/msgs_test.go --- x/gov/types/msgs_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/gov/types/msgs_test.go b/x/gov/types/msgs_test.go index 088593bb7e5c..616023e1deaa 100644 --- a/x/gov/types/msgs_test.go +++ b/x/gov/types/msgs_test.go @@ -24,7 +24,7 @@ func init() { func TestMsgDepositGetSignBytes(t *testing.T) { addr := sdk.AccAddress("addr1") - msg := NewMsgDeposit(addr, 1, coinsPos) + msg := NewMsgDeposit(addr, 0, coinsPos) res := msg.GetSignBytes() expected := `{"type":"cosmos-sdk/MsgDeposit","value":{"amount":[{"amount":"1000","denom":"stake"}],"depositor":"cosmos1v9jxgu33kfsgr5"}}`