diff --git a/app/app.go b/app/app.go index e63da5a..6fafe79 100644 --- a/app/app.go +++ b/app/app.go @@ -420,22 +420,24 @@ func New( // register the governance hooks ), ) - // register the proposal types - adminRouter := govv1beta1.NewRouter() - adminRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). + adminRouterLegacy := govv1beta1.NewRouter() + adminRouterLegacy.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(&app.UpgradeKeeper)). AddRoute(ibchost.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) + adminRouter := baseapp.NewMsgServiceRouter() app.AdminmoduleKeeper = *adminmodulemodulekeeper.NewKeeper( appCodec, keys[adminmodulemoduletypes.StoreKey], keys[adminmodulemoduletypes.MemStoreKey], + adminRouterLegacy, adminRouter, // this allows any type of proposal to be submitted to the admin module (everything is whitelisted) // projects will implement their functions to define what is allowed for admins. func(govv1beta1.Content) bool { return true }, + func(msg sdk.Msg) bool { return true }, ) adminModule := adminmodulemodule.NewAppModule(appCodec, app.AdminmoduleKeeper) diff --git a/go.mod b/go.mod index fd8f5a8..4c444c6 100644 --- a/go.mod +++ b/go.mod @@ -20,6 +20,7 @@ require ( require ( cosmossdk.io/core v0.5.1 + cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/tools/rosetta v0.2.1 github.com/cosmos/cosmos-proto v1.0.0-beta.2 github.com/cosmos/gogoproto v1.4.10 @@ -36,7 +37,6 @@ require ( cloud.google.com/go/storage v1.29.0 // indirect cosmossdk.io/api v0.3.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.3 // indirect - cosmossdk.io/errors v1.0.0-beta.7 // indirect cosmossdk.io/log v1.1.0 // indirect cosmossdk.io/math v1.0.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect diff --git a/proto/cosmos/adminmodule/adminmodule/query.proto b/proto/cosmos/adminmodule/adminmodule/query.proto index 6e70543..be2a55a 100644 --- a/proto/cosmos/adminmodule/adminmodule/query.proto +++ b/proto/cosmos/adminmodule/adminmodule/query.proto @@ -3,6 +3,7 @@ package cosmos.adminmodule.adminmodule; import "google/api/annotations.proto"; import "cosmos/gov/v1beta1/gov.proto"; +import "cosmos/gov/v1/gov.proto"; option go_package = "github.com/cosmos/admin-module/x/adminmodule/types"; @@ -19,6 +20,11 @@ service Query { option (google.api.http).get = "/cosmos/adminmodule/adminmodule/archivedproposals"; } + // Queries a list of archived proposals. + rpc ArchivedProposalsLegacy(QueryArchivedProposalsLegacyRequest) returns (QueryArchivedProposalsLegacyResponse) { + option (google.api.http).get = "/cosmos/adminmodule/adminmodule/archivedproposalslegacy"; + } + } message QueryAdminsRequest { @@ -31,6 +37,17 @@ message QueryAdminsResponse { message QueryArchivedProposalsRequest { } +message QueryArchivedProposalsLegacyRequest { +} + +message QueryProposalsResponse { + repeated cosmos.gov.v1.Proposal proposals = 1; +} + message QueryArchivedProposalsResponse { - repeated cosmos.gov.v1beta1.Proposal proposals = 1; + repeated cosmos.gov.v1.Proposal proposals = 1; +} + +message QueryArchivedProposalsLegacyResponse { + repeated cosmos.gov.v1beta1.Proposal proposalsLegacy = 1; } diff --git a/proto/cosmos/adminmodule/adminmodule/tx.proto b/proto/cosmos/adminmodule/adminmodule/tx.proto index f5ead85..a953c41 100644 --- a/proto/cosmos/adminmodule/adminmodule/tx.proto +++ b/proto/cosmos/adminmodule/adminmodule/tx.proto @@ -13,6 +13,7 @@ service Msg { rpc DeleteAdmin(MsgDeleteAdmin) returns (MsgDeleteAdminResponse); rpc AddAdmin(MsgAddAdmin) returns (MsgAddAdminResponse); rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse); + rpc SubmitProposalLegacy(MsgSubmitProposalLegacy) returns (MsgSubmitProposalLegacyResponse); } message MsgDeleteAdmin { @@ -31,6 +32,23 @@ message MsgAddAdmin { message MsgAddAdminResponse { } +// MsgSubmitProposalLegacy defines an sdk.Msg type that supports submitting arbitrary +// proposal Content. +message MsgSubmitProposalLegacy { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; + + google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"]; + string proposer = 2; +} + +// MsgSubmitProposalLegacyResponse defines the Msg/SubmitProposalLegacy response type. +message MsgSubmitProposalLegacyResponse { + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (gogoproto.moretags) = "yaml:\"proposal_id\""]; +} + // MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary // proposal Content. message MsgSubmitProposal { @@ -39,7 +57,8 @@ message MsgSubmitProposal { option (gogoproto.stringer) = false; option (gogoproto.goproto_getters) = false; - google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"]; + // messages are the arbitrary messages to be executed if proposal passes. + repeated google.protobuf.Any messages = 1; string proposer = 2; } diff --git a/x/adminmodule/abci.go b/x/adminmodule/abci.go deleted file mode 100644 index abca4af..0000000 --- a/x/adminmodule/abci.go +++ /dev/null @@ -1,71 +0,0 @@ -package adminmodule - -import ( - "fmt" - "time" - - "github.com/cosmos/admin-module/x/adminmodule/keeper" - "github.com/cosmos/admin-module/x/adminmodule/types" - "github.com/cosmos/cosmos-sdk/telemetry" - sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1beta1types "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) - - logger := keeper.Logger(ctx) - - keeper.IterateActiveProposalsQueue(ctx, func(proposal govv1beta1types.Proposal) bool { - var logMsg, tagValue string - - handler := keeper.Router().GetRoute(proposal.ProposalRoute()) - cacheCtx, writeCache := ctx.CacheContext() - - // The proposal handler may execute state mutating logic depending - // on the proposal content. If the handler fails, no state mutation - // is written and the error message is logged. - err := handler(cacheCtx, proposal.GetContent()) - if err == nil { - logMsg = "passed" - proposal.Status = govv1beta1types.StatusPassed - tagValue = govtypes.AttributeValueProposalPassed - - // The cached context is created with a new EventManager. However, since - // the proposal handler execution was successful, we want to track/keep - // any events emitted, so we re-emit to "merge" the events into the - // original Context's EventManager. - ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events()) - - // write state to the underlying multi-store - writeCache() - } else { - proposal.Status = govv1beta1types.StatusFailed - tagValue = govtypes.AttributeValueProposalFailed - logMsg = fmt.Sprintf("proposal failed on execution: %s", err) - } - - keeper.SetProposal(ctx, proposal) - keeper.RemoveFromActiveProposalQueue(ctx, proposal.ProposalId) - - keeper.AddToArchive(ctx, proposal) - - logger.Info( - "proposal tallied", - "proposal", proposal.ProposalId, - "title", proposal.GetTitle(), - "result", logMsg, - ) - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeAdminProposal, - sdk.NewAttribute(govtypes.AttributeKeyProposalID, fmt.Sprintf("%d", proposal.ProposalId)), - sdk.NewAttribute(govtypes.AttributeKeyProposalResult, tagValue), - ), - ) - return false - }) -} diff --git a/x/adminmodule/client/cli/query.go b/x/adminmodule/client/cli/query.go index fe394e2..f8bf4a2 100644 --- a/x/adminmodule/client/cli/query.go +++ b/x/adminmodule/client/cli/query.go @@ -26,7 +26,7 @@ func GetQueryCmd(queryRoute string) *cobra.Command { // this line is used by starport scaffolding # 1 - cmd.AddCommand(CmdAdmins(), CmdArchivedProposals()) + cmd.AddCommand(CmdAdmins(), CmdArchivedProposals(), CmdArchivedProposalsLegacy()) return cmd } diff --git a/x/adminmodule/client/cli/query_archived_proposals.go b/x/adminmodule/client/cli/query_archived_proposals.go index 657d79d..ba91b51 100644 --- a/x/adminmodule/client/cli/query_archived_proposals.go +++ b/x/adminmodule/client/cli/query_archived_proposals.go @@ -1,9 +1,10 @@ package cli import ( - "github.com/spf13/cobra" "strconv" + "github.com/spf13/cobra" + "github.com/cosmos/admin-module/x/adminmodule/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -40,3 +41,33 @@ func CmdArchivedProposals() *cobra.Command { return cmd } + +func CmdArchivedProposalsLegacy() *cobra.Command { + cmd := &cobra.Command{ + Use: "archivedproposalslegacy", + Short: "Query archived proposals legacy", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryArchivedProposalsLegacyRequest{} + + res, err := queryClient.ArchivedProposalsLegacy(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/adminmodule/client/cli/tx_client_update_proposal.go b/x/adminmodule/client/cli/tx_client_update_proposal.go index 88eddee..6192887 100644 --- a/x/adminmodule/client/cli/tx_client_update_proposal.go +++ b/x/adminmodule/client/cli/tx_client_update_proposal.go @@ -39,7 +39,7 @@ func NewCmdSubmitUpdateClientProposal() *cobra.Command { from := clientCtx.GetFromAddress() - msg, err := types.NewMsgSubmitProposal(content, from) + msg, err := types.NewMsgSubmitProposalLegacy(content, from) if err != nil { return err } diff --git a/x/adminmodule/client/cli/tx_ibc_upgrade_proposal.go b/x/adminmodule/client/cli/tx_ibc_upgrade_proposal.go index d8c1d86..8bad0c4 100644 --- a/x/adminmodule/client/cli/tx_ibc_upgrade_proposal.go +++ b/x/adminmodule/client/cli/tx_ibc_upgrade_proposal.go @@ -79,7 +79,7 @@ func NewCmdSubmitIbcClientUpgradeProposal() *cobra.Command { from := clientCtx.GetFromAddress() - msg, err := types.NewMsgSubmitProposal(content, from) + msg, err := types.NewMsgSubmitProposalLegacy(content, from) if err != nil { return err } diff --git a/x/adminmodule/client/cli/tx_software_upgrade_proposal.go b/x/adminmodule/client/cli/tx_software_upgrade_proposal.go index 823b5e9..f92f8ba 100644 --- a/x/adminmodule/client/cli/tx_software_upgrade_proposal.go +++ b/x/adminmodule/client/cli/tx_software_upgrade_proposal.go @@ -45,7 +45,7 @@ func NewCmdSubmitUpgradeProposal() *cobra.Command { from := clientCtx.GetFromAddress() - msg, err := types.NewMsgSubmitProposal(content, from) + msg, err := types.NewMsgSubmitProposalLegacy(content, from) if err != nil { return err } @@ -93,7 +93,7 @@ func NewCmdSubmitCancelUpgradeProposal() *cobra.Command { content := upgradetypes.NewCancelSoftwareUpgradeProposal(title, description) - msg, err := types.NewMsgSubmitProposal(content, from) + msg, err := types.NewMsgSubmitProposalLegacy(content, from) if err != nil { return err } diff --git a/x/adminmodule/client/cli/tx_submit_param_change_proposal.go b/x/adminmodule/client/cli/tx_submit_param_change_proposal.go index 25027ef..d1a5745 100644 --- a/x/adminmodule/client/cli/tx_submit_param_change_proposal.go +++ b/x/adminmodule/client/cli/tx_submit_param_change_proposal.go @@ -69,7 +69,7 @@ Where proposal.json contains: proposal.Title, proposal.Description, proposal.Changes.ToParamChanges(), ) - msg, err := types.NewMsgSubmitProposal(content, from) + msg, err := types.NewMsgSubmitProposalLegacy(content, from) if err != nil { return err } diff --git a/x/adminmodule/client/cli/tx_submit_proposal.go b/x/adminmodule/client/cli/tx_submit_proposal.go index eec4a9a..53b3cf1 100644 --- a/x/adminmodule/client/cli/tx_submit_proposal.go +++ b/x/adminmodule/client/cli/tx_submit_proposal.go @@ -79,7 +79,7 @@ $ %s tx adminmodule submit-proposal --title="Test Proposal" --description="My aw content, _ := govv1types.ContentFromProposalType(proposal.Title, proposal.Description, proposal.Type) - msg, err := types.NewMsgSubmitProposal(content, clientCtx.GetFromAddress()) + msg, err := types.NewMsgSubmitProposalLegacy(content, clientCtx.GetFromAddress()) if err != nil { return fmt.Errorf("invalid message: %w", err) } diff --git a/x/adminmodule/genesis.go b/x/adminmodule/genesis.go index 8e0b8c8..ee648a4 100644 --- a/x/adminmodule/genesis.go +++ b/x/adminmodule/genesis.go @@ -13,6 +13,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) k.SetAdmin(ctx, admin) } k.SetProposalID(ctx, 1) + k.SetProposalIDLegacy(ctx, 1) } // ExportGenesis returns the capability module's exported genesis. diff --git a/x/adminmodule/keeper/grpc_query_archived_proposals.go b/x/adminmodule/keeper/grpc_query_archived_proposals.go index fbdd33c..ce694dc 100644 --- a/x/adminmodule/keeper/grpc_query_archived_proposals.go +++ b/x/adminmodule/keeper/grpc_query_archived_proposals.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "github.com/cosmos/admin-module/x/adminmodule/types" sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" @@ -17,3 +18,13 @@ func (k Keeper) ArchivedProposals(goCtx context.Context, req *types.QueryArchive Proposals: proposals, }, nil } + +func (k Keeper) ArchivedProposalsLegacy(goCtx context.Context, req *types.QueryArchivedProposalsLegacyRequest) (*types.QueryArchivedProposalsLegacyResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + proposals := k.GetArchivedProposalsLegacy(sdk.UnwrapSDKContext(goCtx)) + return &types.QueryArchivedProposalsLegacyResponse{ + ProposalsLegacy: proposals, + }, nil +} diff --git a/x/adminmodule/keeper/keeper.go b/x/adminmodule/keeper/keeper.go index 5ff161f..f2a9b29 100644 --- a/x/adminmodule/keeper/keeper.go +++ b/x/adminmodule/keeper/keeper.go @@ -4,12 +4,13 @@ import ( "fmt" "github.com/cometbft/cometbft/libs/log" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/admin-module/x/adminmodule/types" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - govv1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + govv1beta1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" // this line is used by starport scaffolding # ibc/keeper/import ) @@ -18,9 +19,10 @@ type ( cdc codec.Codec storeKey storetypes.StoreKey memKey storetypes.StoreKey - rtr govv1types.Router - IsProposalTypeWhitelisted func(govv1types.Content) bool - // this line is used by starport scaffolding # ibc/keeper/attribute + legacyRouter govv1beta1types.Router + msgServiceRouter *baseapp.MsgServiceRouter + isProposalTypeWhitelisted func(govv1beta1types.Content) bool + isMessageWhitelisted func(message sdk.Msg) bool } ) @@ -28,25 +30,48 @@ func NewKeeper( cdc codec.Codec, storeKey, memKey storetypes.StoreKey, - rtr govv1types.Router, - isProposalTypeWhitelisted func(govv1types.Content) bool, - // this line is used by starport scaffolding # ibc/keeper/parameter + legacyRouter govv1beta1types.Router, + msgServiceRouter *baseapp.MsgServiceRouter, + isProposalTypeWhitelisted func(govv1beta1types.Content) bool, + isMessageWhitelisted func(msg sdk.Msg) bool, ) *Keeper { return &Keeper{ cdc: cdc, storeKey: storeKey, memKey: memKey, - rtr: rtr, - IsProposalTypeWhitelisted: isProposalTypeWhitelisted, - // this line is used by starport scaffolding # ibc/keeper/return + legacyRouter: legacyRouter, + msgServiceRouter: msgServiceRouter, + isProposalTypeWhitelisted: isProposalTypeWhitelisted, + isMessageWhitelisted: isMessageWhitelisted, } } +// RouterLegacy returns the adminmodule Keeper's govtypeRouter +func (k Keeper) RouterLegacy() govv1beta1types.Router { + return k.legacyRouter +} + // Router returns the adminmodule Keeper's Router -func (k Keeper) Router() govv1types.Router { - return k.rtr +func (k Keeper) Router() *baseapp.MsgServiceRouter { + return k.msgServiceRouter } +// Logger returns the adminmodule Keeper's Logger func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +// Codec returns the adminmodule Keeper's Codec +func (k Keeper) Codec() codec.Codec { + return k.cdc +} + +// IsProposalTypeWhitelisted returns the adminmodule Keeper's isProposalTypeWhitelisted +func (k Keeper) IsProposalTypeWhitelisted() func(govv1beta1types.Content) bool { + return k.isProposalTypeWhitelisted +} + +// IsMessageWhitelisted returns the adminmodule Keeper's isMessageWhitelisted +func (k Keeper) IsMessageWhitelisted() func(msg sdk.Msg) bool { + return k.isMessageWhitelisted +} diff --git a/x/adminmodule/keeper/msg_server_submit_proposal.go b/x/adminmodule/keeper/msg_server_submit_proposal.go index dcfcd59..284ef90 100644 --- a/x/adminmodule/keeper/msg_server_submit_proposal.go +++ b/x/adminmodule/keeper/msg_server_submit_proposal.go @@ -2,19 +2,21 @@ package keeper import ( "context" - "errors" - "fmt" + "cosmossdk.io/errors" "github.com/cosmos/admin-module/x/adminmodule/types" "github.com/cosmos/cosmos-sdk/store/prefix" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) func (k msgServer) SubmitProposal(goCtx context.Context, msg *types.MsgSubmitProposal) (*types.MsgSubmitProposalResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + authority := authtypes.NewModuleAddress(types.ModuleName) store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.AdminKey)) storeCreator := store.Get([]byte(msg.Proposer)) @@ -22,22 +24,35 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *types.MsgSubmitPro return nil, fmt.Errorf("proposer %s must be admin to submit proposals to admin-module", msg.Proposer) } - content := msg.GetContent() - if !k.Keeper.IsProposalTypeWhitelisted(content) { - return nil, errors.New("proposal content is not whitelisted") + msgs, err := msg.GetMsgs() + if err != nil { + return nil, errors.Wrap(err, "failed to submit proposal") + } + + for _, msg := range msgs { + signers := msg.GetSigners() + if len(signers) != 1 { + return nil, fmt.Errorf("should be only 1 signer in message, received: %s", msg.GetSigners()) + } + if !signers[0].Equals(authority) { + return nil, errors.Wrap(sdkerrors.ErrorInvalidSigner, signers[0].String()) + } + if !k.Keeper.isMessageWhitelisted(msg) { + return nil, fmt.Errorf("sdk.Msg is not whitelisted: %s", msg) + } } - proposal, err := k.Keeper.SubmitProposal(ctx, content) + proposal, err := k.Keeper.SubmitProposal(ctx, msgs) if err != nil { - return nil, err + return nil, errors.Wrap(err, "failed to submit proposal") } defer telemetry.IncrCounter(1, types.ModuleName, "proposal") - submitEvent := sdk.NewEvent(types.EventTypeSubmitAdminProposal, sdk.NewAttribute(govtypes.AttributeKeyProposalType, msg.GetContent().ProposalType())) + submitEvent := sdk.NewEvent(types.EventTypeSubmitAdminProposal, sdk.NewAttribute(govtypes.AttributeKeyProposalType, types.EventTypeSubmitSdkMessage)) ctx.EventManager().EmitEvent(submitEvent) return &types.MsgSubmitProposalResponse{ - ProposalId: proposal.ProposalId, + ProposalId: proposal.Id, }, nil } diff --git a/x/adminmodule/keeper/msg_server_submit_proposal_legacy.go b/x/adminmodule/keeper/msg_server_submit_proposal_legacy.go new file mode 100644 index 0000000..e57cee0 --- /dev/null +++ b/x/adminmodule/keeper/msg_server_submit_proposal_legacy.go @@ -0,0 +1,44 @@ +package keeper + +import ( + "context" + "errors" + + "fmt" + + cosmoserrors "cosmossdk.io/errors" + "github.com/cosmos/admin-module/x/adminmodule/types" + "github.com/cosmos/cosmos-sdk/store/prefix" + "github.com/cosmos/cosmos-sdk/telemetry" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +func (k msgServer) SubmitProposalLegacy(goCtx context.Context, msg *types.MsgSubmitProposalLegacy) (*types.MsgSubmitProposalLegacyResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.AdminKey)) + storeCreator := store.Get([]byte(msg.Proposer)) + if storeCreator == nil { + return nil, fmt.Errorf("proposer %s must be admin to submit proposals to admin-module", msg.Proposer) + } + + content := msg.GetContent() + if !k.Keeper.isProposalTypeWhitelisted(content) { + return nil, errors.New("proposal content is not whitelisted") + } + + proposal, err := k.Keeper.SubmitProposalLegacy(ctx, content) + if err != nil { + return nil, cosmoserrors.Wrap(err, "failed to submit proposal legacy") + } + + defer telemetry.IncrCounter(1, types.ModuleName, "proposal legacy") + + submitEvent := sdk.NewEvent(types.EventTypeSubmitAdminProposal, sdk.NewAttribute(govtypes.AttributeKeyProposalType, msg.GetContent().ProposalType())) + ctx.EventManager().EmitEvent(submitEvent) + + return &types.MsgSubmitProposalLegacyResponse{ + ProposalId: proposal.ProposalId, + }, nil +} diff --git a/x/adminmodule/keeper/proposal.go b/x/adminmodule/keeper/proposal.go index 699901e..6ccb69a 100644 --- a/x/adminmodule/keeper/proposal.go +++ b/x/adminmodule/keeper/proposal.go @@ -4,26 +4,14 @@ import ( "fmt" "github.com/cosmos/admin-module/x/adminmodule/types" - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govv1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) // SubmitProposal create new proposal given a content -func (k Keeper) SubmitProposal(ctx sdk.Context, content govv1types.Content) (govv1types.Proposal, error) { - if !k.rtr.HasRoute(content.ProposalRoute()) { - return govv1types.Proposal{}, sdkerrors.Wrap(govtypes.ErrNoProposalHandlerExists, content.ProposalRoute()) - } - - cacheCtx, _ := ctx.CacheContext() - handler := k.rtr.GetRoute(content.ProposalRoute()) - if err := handler(cacheCtx, content); err != nil { - return govv1types.Proposal{}, sdkerrors.Wrap(govtypes.ErrInvalidProposalContent, err.Error()) - } - +func (k Keeper) SubmitProposal(ctx sdk.Context, msgs []sdk.Msg) (govv1types.Proposal, error) { + var events sdk.Events proposalID, err := k.GetProposalID(ctx) if err != nil { return govv1types.Proposal{}, err @@ -31,15 +19,25 @@ func (k Keeper) SubmitProposal(ctx sdk.Context, content govv1types.Content) (gov headerTime := ctx.BlockHeader().Time - // submitTime and depositEndTime would not be used - proposal, err := govv1types.NewProposal(content, proposalID, headerTime, headerTime) + proposal, err := govv1types.NewProposal(msgs, proposalID, headerTime, headerTime, "", "", "", nil) if err != nil { return govv1types.Proposal{}, err } + for idx, msg := range msgs { + handler := k.Router().Handler(msg) + + var res *sdk.Result + res, err := handler(ctx, msg) + if err != nil { + return proposal, fmt.Errorf("failed to handle %d msg in proposal %d: %w", idx, proposal.Id, err) + } + events = append(events, res.GetEvents()...) + } + proposal.Status = govv1types.StatusPassed k.SetProposal(ctx, proposal) - k.InsertActiveProposalQueue(ctx, proposalID) k.SetProposalID(ctx, proposalID+1) + k.AddToArchive(ctx, proposal) return proposal, nil } @@ -68,7 +66,7 @@ func (k Keeper) SetProposal(ctx sdk.Context, proposal govv1types.Proposal) { bz := k.MustMarshalProposal(proposal) - store.Set(types.ProposalKey(proposal.ProposalId), bz) + store.Set(types.ProposalKey(proposal.Id), bz) } // GetProposal get proposal from store by ProposalID @@ -86,43 +84,6 @@ func (k Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (govv1types.Prop return proposal, true } -// InsertActiveProposalQueue inserts a ProposalID into the active proposal queue -func (k Keeper) InsertActiveProposalQueue(ctx sdk.Context, proposalID uint64) { - store := ctx.KVStore(k.storeKey) - store.Set(types.ActiveProposalQueueKey(proposalID), types.GetProposalIDBytes(proposalID)) -} - -// RemoveFromActiveProposalQueue removes a proposalID from the Active Proposal Queue -func (k Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.ActiveProposalQueueKey(proposalID)) -} - -// IterateActiveProposalsQueue iterates over the proposals in the active proposal queue -// and performs a callback function -func (k Keeper) IterateActiveProposalsQueue(ctx sdk.Context, cb func(proposal govv1types.Proposal) (stop bool)) { - iterator := k.ActiveProposalQueueIterator(ctx) - - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - proposalID := types.GetProposalIDFromBytes(iterator.Value()) - proposal, found := k.GetProposal(ctx, proposalID) - if !found { - panic(fmt.Sprintf("proposal %d does not exist", proposalID)) - } - - if cb(proposal) { - break - } - } -} - -// ActiveProposalQueueIterator returns an sdk.Iterator for all the proposals in the Active Queue -func (k Keeper) ActiveProposalQueueIterator(ctx sdk.Context) sdk.Iterator { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.ActiveProposalQueuePrefix) - return prefixStore.Iterator(nil, nil) -} - func (k Keeper) MarshalProposal(proposal govv1types.Proposal) ([]byte, error) { bz, err := k.cdc.Marshal(&proposal) if err != nil { diff --git a/x/adminmodule/keeper/proposal_archive.go b/x/adminmodule/keeper/proposal_archive.go index 3a786cd..e482f23 100644 --- a/x/adminmodule/keeper/proposal_archive.go +++ b/x/adminmodule/keeper/proposal_archive.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/admin-module/x/adminmodule/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - govv1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + govv1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) func (k Keeper) GetArchivedProposals(ctx sdk.Context) []*govv1types.Proposal { @@ -30,5 +30,5 @@ func (k Keeper) AddToArchive(ctx sdk.Context, proposal govv1types.Proposal) { bz := k.MustMarshalProposal(proposal) - store.Set(types.ProposalKey(proposal.ProposalId), bz) + store.Set(types.ProposalKey(proposal.Id), bz) } diff --git a/x/adminmodule/keeper/proposal_archive_legacy.go b/x/adminmodule/keeper/proposal_archive_legacy.go new file mode 100644 index 0000000..a47c028 --- /dev/null +++ b/x/adminmodule/keeper/proposal_archive_legacy.go @@ -0,0 +1,34 @@ +package keeper + +import ( + "github.com/cosmos/admin-module/x/adminmodule/types" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + govv1beta1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +func (k Keeper) GetArchivedProposalsLegacy(ctx sdk.Context) []*govv1beta1types.Proposal { + proposals := make([]*govv1beta1types.Proposal, 0) + + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.ArchiveLegacyKey)) + + iterator := store.Iterator(nil, nil) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var proposal govv1beta1types.Proposal + + k.MustUnmarshalProposalLegacy(iterator.Value(), &proposal) + proposals = append(proposals, &proposal) + } + + return proposals +} + +func (k Keeper) AddToArchiveLegacy(ctx sdk.Context, proposal govv1beta1types.Proposal) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.ArchiveLegacyKey)) + + bz := k.MustMarshalProposalLegacy(proposal) + + store.Set(types.ProposalLegacyKey(proposal.ProposalId), bz) +} diff --git a/x/adminmodule/keeper/proposal_legacy.go b/x/adminmodule/keeper/proposal_legacy.go new file mode 100644 index 0000000..4544344 --- /dev/null +++ b/x/adminmodule/keeper/proposal_legacy.go @@ -0,0 +1,123 @@ +package keeper + +import ( + "github.com/cosmos/admin-module/x/adminmodule/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1beta1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +// SubmitProposal create new proposal given a content +func (k Keeper) SubmitProposalLegacy(ctx sdk.Context, content govv1beta1types.Content) (govv1beta1types.Proposal, error) { + if !k.legacyRouter.HasRoute(content.ProposalRoute()) { + return govv1beta1types.Proposal{}, sdkerrors.Wrap(govtypes.ErrNoProposalHandlerExists, content.ProposalRoute()) + } + + err := content.ValidateBasic() + if err != nil { + return govv1beta1types.Proposal{}, sdkerrors.Wrap(err, "failed to validate proposal content") + } + + proposalID, err := k.GetProposalIDLegacy(ctx) + if err != nil { + return govv1beta1types.Proposal{}, err + } + + headerTime := ctx.BlockHeader().Time + // submitTime and depositEndTime would not be used + proposal, err := govv1beta1types.NewProposal(content, proposalID, headerTime, headerTime) + if err != nil { + return govv1beta1types.Proposal{}, sdkerrors.Wrap(err, "failed to create proposal struct") + } + + handler := k.RouterLegacy().GetRoute(proposal.ProposalRoute()) + // The proposal handler may execute state mutating logic depending + // on the proposal content. If the handler fails, no state mutation + // is written and the error message is returned. + err = handler(ctx, content) + if err == nil { + proposal.Status = govv1beta1types.StatusPassed + + } else { + return govv1beta1types.Proposal{}, sdkerrors.Wrap(err, "failed to execute proposal proposal struct") + } + k.SetProposalLegacy(ctx, proposal) + k.SetProposalIDLegacy(ctx, proposalID+1) + k.AddToArchiveLegacy(ctx, proposal) + + return proposal, nil +} + +// GetProposalIDLegacy gets the highest proposal ID +func (k Keeper) GetProposalIDLegacy(ctx sdk.Context) (proposalID uint64, err error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ProposalIDKeyLegacy) + if bz == nil { + return 0, sdkerrors.Wrap(types.ErrInvalidGenesis, "initial proposal ID hasn't been set") + } + + proposalID = types.GetProposalIDFromBytes(bz) + return proposalID, nil +} + +// SetProposalIDLegacy sets the new proposal ID to the store +func (k Keeper) SetProposalIDLegacy(ctx sdk.Context, proposalID uint64) { + store := ctx.KVStore(k.storeKey) + store.Set(types.ProposalIDKeyLegacy, types.GetProposalIDBytes(proposalID)) +} + +// SetProposalLegacy set a proposal to store +func (k Keeper) SetProposalLegacy(ctx sdk.Context, proposal govv1beta1types.Proposal) { + store := ctx.KVStore(k.storeKey) + + bz := k.MustMarshalProposalLegacy(proposal) + + store.Set(types.ProposalLegacyKey(proposal.ProposalId), bz) +} + +// GetProposalLegacy get proposal from store by ProposalID +func (k Keeper) GetProposalLegacy(ctx sdk.Context, proposalID uint64) (govv1beta1types.Proposal, bool) { + store := ctx.KVStore(k.storeKey) + + bz := store.Get(types.ProposalLegacyKey(proposalID)) + if bz == nil { + return govv1beta1types.Proposal{}, false + } + + var proposal govv1beta1types.Proposal + k.MustUnmarshalProposalLegacy(bz, &proposal) + + return proposal, true +} + +func (k Keeper) MarshalProposalLegacy(proposal govv1beta1types.Proposal) ([]byte, error) { + bz, err := k.cdc.Marshal(&proposal) + if err != nil { + return nil, err + } + return bz, nil +} + +func (k Keeper) UnmarshalProposalLegacy(bz []byte, proposal *govv1beta1types.Proposal) error { + err := k.cdc.Unmarshal(bz, proposal) + if err != nil { + return err + } + return nil +} + +func (k Keeper) MustMarshalProposalLegacy(proposal govv1beta1types.Proposal) []byte { + bz, err := k.MarshalProposalLegacy(proposal) + if err != nil { + panic(err) + } + return bz +} + +func (k Keeper) MustUnmarshalProposalLegacy(bz []byte, proposal *govv1beta1types.Proposal) { + err := k.UnmarshalProposalLegacy(bz, proposal) + if err != nil { + panic(err) + } +} diff --git a/x/adminmodule/module.go b/x/adminmodule/module.go index 70702fd..1d2d534 100644 --- a/x/adminmodule/module.go +++ b/x/adminmodule/module.go @@ -182,6 +182,5 @@ func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) { // EndBlock executes all ABCI EndBlock logic respective to the capability module. It // returns no validator updates. func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - EndBlocker(ctx, am.keeper) return []abci.ValidatorUpdate{} } diff --git a/x/adminmodule/types/events.go b/x/adminmodule/types/events.go index 9f057d3..9353317 100644 --- a/x/adminmodule/types/events.go +++ b/x/adminmodule/types/events.go @@ -4,4 +4,5 @@ package types const ( EventTypeAdminProposal = "admin_proposal" EventTypeSubmitAdminProposal = "submit_admin_proposal" + EventTypeSubmitSdkMessage = "submit_sdk_message" ) diff --git a/x/adminmodule/types/keys.go b/x/adminmodule/types/keys.go index a4764c3..8d66b43 100644 --- a/x/adminmodule/types/keys.go +++ b/x/adminmodule/types/keys.go @@ -22,13 +22,16 @@ const ( AdminKey = "Admin-" - ArchiveKey = "Archive-" + ArchiveKey = "ArchiveSdk47-" + + ArchiveLegacyKey = "Archive-" ) var ( - ProposalsKeyPrefix = []byte{0x00} - ActiveProposalQueuePrefix = []byte{0x01} - ProposalIDKey = []byte{0x03} + ProposalsKeyLegacyPrefix = []byte{0x00} + ProposalIDKeyLegacy = []byte{0x03} + ProposalsKeyPrefix = []byte{0x04} + ProposalIDKey = []byte{0x06} ) // GetProposalIDBytes returns the byte representation of the proposalID @@ -48,7 +51,7 @@ func ProposalKey(proposalID uint64) []byte { return append(ProposalsKeyPrefix, GetProposalIDBytes(proposalID)...) } -// ActiveProposalQueueKey returns the key for a proposalID in the activeProposalQueue -func ActiveProposalQueueKey(proposalID uint64) []byte { - return append(ActiveProposalQueuePrefix, GetProposalIDBytes(proposalID)...) +// ProposalLegacyKey gets a specific proposal from the store +func ProposalLegacyKey(proposalID uint64) []byte { + return append(ProposalsKeyLegacyPrefix, GetProposalIDBytes(proposalID)...) } diff --git a/x/adminmodule/types/message_submit_proposal.go b/x/adminmodule/types/message_submit_proposal.go index 3021955..b46d8e9 100644 --- a/x/adminmodule/types/message_submit_proposal.go +++ b/x/adminmodule/types/message_submit_proposal.go @@ -1,17 +1,12 @@ package types import ( - "fmt" - - "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" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govtypesv1b1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/gogoproto/proto" + "github.com/cosmos/cosmos-sdk/x/gov/codec" "gopkg.in/yaml.v2" ) @@ -20,37 +15,31 @@ var ( _ cdctypes.UnpackInterfacesMessage = &MsgSubmitProposal{} ) -func NewMsgSubmitProposal(content govtypesv1b1.Content, proposer sdk.AccAddress) (*MsgSubmitProposal, error) { +func NewMsgSubmitProposal(messages []sdk.Msg, proposer sdk.AccAddress) (*MsgSubmitProposal, error) { m := &MsgSubmitProposal{ Proposer: proposer.String(), } - err := m.SetContent(content) + anys, err := sdktx.SetMsgs(messages) if err != nil { return nil, err } + + m.Messages = anys return m, nil } -func (m *MsgSubmitProposal) GetContent() govtypesv1b1.Content { - content, ok := m.Content.GetCachedValue().(govtypesv1b1.Content) - if !ok { - return nil - } - return content +// GetMsgs unpacks m.Messages Any's into sdk.Msg's +func (m *MsgSubmitProposal) GetMsgs() ([]sdk.Msg, error) { + return sdktx.GetMsgs(m.Messages, "sdk.Msg") } -func (m *MsgSubmitProposal) SetContent(content govtypesv1b1.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 +func (m *MsgSubmitProposal) Route() string { + return RouterKey +} + +func (m *MsgSubmitProposal) Type() string { + return "SubmitProposal" } func (m *MsgSubmitProposal) GetSigners() []sdk.AccAddress { @@ -61,8 +50,9 @@ func (m *MsgSubmitProposal) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{proposer} } -func (m *MsgSubmitProposal) GetSignBytes() []byte { - bz := govcodec.ModuleCdc.MustMarshalJSON(m) +// GetSignBytes returns the message bytes to sign over. +func (msg MsgSubmitProposal) GetSignBytes() []byte { + bz := codec.ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } @@ -75,24 +65,14 @@ func (m *MsgSubmitProposal) String() string { // ValidateBasic implements Msg func (m *MsgSubmitProposal) ValidateBasic() error { if m.Proposer == "" { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, m.Proposer) - } - - content := m.GetContent() - if content == nil { - return sdkerrors.Wrap(govtypes.ErrInvalidProposalContent, "missing content") - } - if !govtypesv1b1.IsValidProposalType(content.ProposalType()) { - return sdkerrors.Wrap(govtypes.ErrInvalidProposalType, content.ProposalType()) + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "proposer are empty") } - if err := content.ValidateBasic(); err != nil { - return err + if len(m.Messages) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "messages are empty") } - return nil } func (m MsgSubmitProposal) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error { - var content govtypesv1b1.Content - return unpacker.UnpackAny(m.Content, &content) + return sdktx.UnpackInterfaces(unpacker, m.Messages) } diff --git a/x/adminmodule/types/message_submit_proposal_legacy.go b/x/adminmodule/types/message_submit_proposal_legacy.go new file mode 100644 index 0000000..778c5f9 --- /dev/null +++ b/x/adminmodule/types/message_submit_proposal_legacy.go @@ -0,0 +1,97 @@ +package types + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypesv1b1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/cosmos/gogoproto/proto" + "gopkg.in/yaml.v2" +) + +var ( + _ sdk.Msg = &MsgSubmitProposalLegacy{} + _ cdctypes.UnpackInterfacesMessage = &MsgSubmitProposalLegacy{} +) + +func NewMsgSubmitProposalLegacy(content govtypesv1b1.Content, proposer sdk.AccAddress) (*MsgSubmitProposalLegacy, error) { + m := &MsgSubmitProposalLegacy{ + Proposer: proposer.String(), + } + + err := m.SetContent(content) + if err != nil { + return nil, err + } + return m, nil +} + +func (m *MsgSubmitProposalLegacy) GetContent() govtypesv1b1.Content { + content, ok := m.Content.GetCachedValue().(govtypesv1b1.Content) + if !ok { + return nil + } + return content +} + +func (m *MsgSubmitProposalLegacy) SetContent(content govtypesv1b1.Content) error { + msg, ok := content.(proto.Message) + if !ok { + return fmt.Errorf("failed to cast proposal content of type %T to proto.Message", msg) + } + any, err := types.NewAnyWithValue(msg) + if err != nil { + return err + } + m.Content = any + return nil +} + +func (m *MsgSubmitProposalLegacy) GetSigners() []sdk.AccAddress { + proposer, err := sdk.AccAddressFromBech32(m.Proposer) + if err != nil { + panic(err) + } + return []sdk.AccAddress{proposer} +} + +func (m *MsgSubmitProposalLegacy) GetSignBytes() []byte { + bz := govcodec.ModuleCdc.MustMarshalJSON(m) + return sdk.MustSortJSON(bz) +} + +// String implements the Stringer interface +func (m *MsgSubmitProposalLegacy) String() string { + out, _ := yaml.Marshal(m) + return string(out) +} + +func (m *MsgSubmitProposalLegacy) ValidateBasic() error { + if m.Proposer == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "missinng proposer") + } + + content := m.GetContent() + if content == nil { + return sdkerrors.Wrap(govtypes.ErrInvalidProposalContent, "missing content") + } + if !govtypesv1b1.IsValidProposalType(content.ProposalType()) { + return sdkerrors.Wrap(govtypes.ErrInvalidProposalType, content.ProposalType()) + } + if err := content.ValidateBasic(); err != nil { + return err + } + + return nil +} + +func (m MsgSubmitProposalLegacy) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error { + var content govtypesv1b1.Content + return unpacker.UnpackAny(m.Content, &content) +} diff --git a/x/adminmodule/types/query.pb.go b/x/adminmodule/types/query.pb.go index 523bd16..d73386e 100644 --- a/x/adminmodule/types/query.pb.go +++ b/x/adminmodule/types/query.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" v1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -145,15 +146,95 @@ func (m *QueryArchivedProposalsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryArchivedProposalsRequest proto.InternalMessageInfo +type QueryArchivedProposalsLegacyRequest struct { +} + +func (m *QueryArchivedProposalsLegacyRequest) Reset() { *m = QueryArchivedProposalsLegacyRequest{} } +func (m *QueryArchivedProposalsLegacyRequest) String() string { return proto.CompactTextString(m) } +func (*QueryArchivedProposalsLegacyRequest) ProtoMessage() {} +func (*QueryArchivedProposalsLegacyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2e7b4eebb507dc96, []int{3} +} +func (m *QueryArchivedProposalsLegacyRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryArchivedProposalsLegacyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryArchivedProposalsLegacyRequest.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 *QueryArchivedProposalsLegacyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryArchivedProposalsLegacyRequest.Merge(m, src) +} +func (m *QueryArchivedProposalsLegacyRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryArchivedProposalsLegacyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryArchivedProposalsLegacyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryArchivedProposalsLegacyRequest proto.InternalMessageInfo + +type QueryProposalsResponse struct { + Proposals []*v1.Proposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals,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_2e7b4eebb507dc96, []int{4} +} +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() []*v1.Proposal { + if m != nil { + return m.Proposals + } + return nil +} + type QueryArchivedProposalsResponse struct { - Proposals []*v1beta1.Proposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals,omitempty"` + Proposals []*v1.Proposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals,omitempty"` } func (m *QueryArchivedProposalsResponse) Reset() { *m = QueryArchivedProposalsResponse{} } func (m *QueryArchivedProposalsResponse) String() string { return proto.CompactTextString(m) } func (*QueryArchivedProposalsResponse) ProtoMessage() {} func (*QueryArchivedProposalsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_2e7b4eebb507dc96, []int{3} + return fileDescriptor_2e7b4eebb507dc96, []int{5} } func (m *QueryArchivedProposalsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -182,18 +263,65 @@ func (m *QueryArchivedProposalsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryArchivedProposalsResponse proto.InternalMessageInfo -func (m *QueryArchivedProposalsResponse) GetProposals() []*v1beta1.Proposal { +func (m *QueryArchivedProposalsResponse) GetProposals() []*v1.Proposal { if m != nil { return m.Proposals } return nil } +type QueryArchivedProposalsLegacyResponse struct { + ProposalsLegacy []*v1beta1.Proposal `protobuf:"bytes,1,rep,name=proposalsLegacy,proto3" json:"proposalsLegacy,omitempty"` +} + +func (m *QueryArchivedProposalsLegacyResponse) Reset() { *m = QueryArchivedProposalsLegacyResponse{} } +func (m *QueryArchivedProposalsLegacyResponse) String() string { return proto.CompactTextString(m) } +func (*QueryArchivedProposalsLegacyResponse) ProtoMessage() {} +func (*QueryArchivedProposalsLegacyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2e7b4eebb507dc96, []int{6} +} +func (m *QueryArchivedProposalsLegacyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryArchivedProposalsLegacyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryArchivedProposalsLegacyResponse.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 *QueryArchivedProposalsLegacyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryArchivedProposalsLegacyResponse.Merge(m, src) +} +func (m *QueryArchivedProposalsLegacyResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryArchivedProposalsLegacyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryArchivedProposalsLegacyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryArchivedProposalsLegacyResponse proto.InternalMessageInfo + +func (m *QueryArchivedProposalsLegacyResponse) GetProposalsLegacy() []*v1beta1.Proposal { + if m != nil { + return m.ProposalsLegacy + } + return nil +} + func init() { proto.RegisterType((*QueryAdminsRequest)(nil), "cosmos.adminmodule.adminmodule.QueryAdminsRequest") proto.RegisterType((*QueryAdminsResponse)(nil), "cosmos.adminmodule.adminmodule.QueryAdminsResponse") proto.RegisterType((*QueryArchivedProposalsRequest)(nil), "cosmos.adminmodule.adminmodule.QueryArchivedProposalsRequest") + proto.RegisterType((*QueryArchivedProposalsLegacyRequest)(nil), "cosmos.adminmodule.adminmodule.QueryArchivedProposalsLegacyRequest") + proto.RegisterType((*QueryProposalsResponse)(nil), "cosmos.adminmodule.adminmodule.QueryProposalsResponse") proto.RegisterType((*QueryArchivedProposalsResponse)(nil), "cosmos.adminmodule.adminmodule.QueryArchivedProposalsResponse") + proto.RegisterType((*QueryArchivedProposalsLegacyResponse)(nil), "cosmos.adminmodule.adminmodule.QueryArchivedProposalsLegacyResponse") } func init() { @@ -201,29 +329,35 @@ func init() { } var fileDescriptor_2e7b4eebb507dc96 = []byte{ - // 350 bytes of a gzipped FileDescriptorProto + // 439 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4a, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x4f, 0x4c, 0xc9, 0xcd, 0xcc, 0xcb, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x45, 0x61, 0x17, 0x96, 0xa6, 0x16, 0x55, 0xea, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xc9, 0x41, 0xd4, 0xea, 0x21, 0xc9, 0x23, 0xb3, 0xa5, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x41, 0xfa, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xba, 0xa5, 0x64, 0xa0, 0x36, - 0xa5, 0xe7, 0x97, 0xe9, 0x97, 0x19, 0x26, 0xa5, 0x96, 0x24, 0x1a, 0x82, 0xd8, 0x10, 0x59, 0x25, - 0x11, 0x2e, 0xa1, 0x40, 0x90, 0x55, 0x8e, 0x20, 0xf3, 0x8a, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, - 0x4b, 0x94, 0x74, 0xb9, 0x84, 0x51, 0x44, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x85, 0xc4, 0xb8, - 0xd8, 0xc0, 0xf6, 0x16, 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x06, 0x41, 0x79, 0x4a, 0xf2, 0x5c, - 0xb2, 0x10, 0xe5, 0x45, 0xc9, 0x19, 0x99, 0x65, 0xa9, 0x29, 0x01, 0x45, 0xf9, 0x05, 0xf9, 0xc5, - 0x89, 0x39, 0x70, 0xf3, 0x62, 0xb8, 0xe4, 0x70, 0x29, 0x80, 0x1a, 0x6d, 0xc5, 0xc5, 0x59, 0x00, - 0x13, 0x04, 0x9b, 0xce, 0x6d, 0x24, 0xa3, 0x07, 0xf5, 0x37, 0xc8, 0xb5, 0x50, 0x97, 0xeb, 0xc1, - 0x74, 0x06, 0x21, 0x94, 0x1b, 0xfd, 0x66, 0xe2, 0x62, 0x05, 0x1b, 0x2f, 0xb4, 0x90, 0x91, 0x8b, - 0x0d, 0xe2, 0x66, 0x21, 0x23, 0x3d, 0xfc, 0xa1, 0xa6, 0x87, 0xe9, 0x6d, 0x29, 0x63, 0x92, 0xf4, - 0x40, 0x5c, 0xae, 0xa4, 0xd7, 0x74, 0xf9, 0xc9, 0x64, 0x26, 0x0d, 0x21, 0x35, 0x7d, 0x02, 0x51, - 0x0a, 0x09, 0x2c, 0xa1, 0xb3, 0x8c, 0x5c, 0x82, 0x18, 0xe1, 0x20, 0x64, 0x4b, 0x9c, 0xd5, 0x38, - 0x02, 0x58, 0xca, 0x8e, 0x5c, 0xed, 0x50, 0x4f, 0x58, 0x82, 0x3d, 0x61, 0x2c, 0x64, 0x48, 0xd0, - 0x13, 0x50, 0x23, 0xe0, 0xa1, 0xef, 0xe4, 0x73, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, - 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, - 0x0c, 0x51, 0x46, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0x28, 0xc6, 0xea, - 0x42, 0xcd, 0xaa, 0x40, 0x31, 0xb9, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x9c, 0x2c, 0x8d, - 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x35, 0x4d, 0x4a, 0xe9, 0x20, 0x03, 0x00, 0x00, + 0xa5, 0xe7, 0x97, 0xe9, 0x97, 0x19, 0x26, 0xa5, 0x96, 0x24, 0x1a, 0x82, 0xd8, 0x50, 0x59, 0x71, + 0x14, 0x59, 0x84, 0x84, 0x92, 0x08, 0x97, 0x50, 0x20, 0xc8, 0x0d, 0x8e, 0x20, 0x8b, 0x8a, 0x83, + 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x94, 0x74, 0xb9, 0x84, 0x51, 0x44, 0x8b, 0x0b, 0xf2, 0xf3, + 0x8a, 0x53, 0x85, 0xc4, 0xb8, 0xd8, 0xc0, 0x0e, 0x2a, 0x96, 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x0c, + 0x82, 0xf2, 0x94, 0xe4, 0xb9, 0x64, 0x21, 0xca, 0x8b, 0x92, 0x33, 0x32, 0xcb, 0x52, 0x53, 0x02, + 0x8a, 0xf2, 0x0b, 0xf2, 0x8b, 0x13, 0x73, 0xe0, 0xe6, 0xa9, 0x72, 0x29, 0x63, 0x57, 0xe0, 0x93, + 0x9a, 0x9e, 0x98, 0x5c, 0x09, 0x53, 0xe6, 0xcf, 0x25, 0x06, 0x56, 0x86, 0xa4, 0x1f, 0x6a, 0xb3, + 0x29, 0x17, 0x67, 0x01, 0x4c, 0x10, 0x6c, 0x39, 0xb7, 0x91, 0xb8, 0x1e, 0x34, 0xbc, 0x40, 0x9e, + 0x29, 0x33, 0xd4, 0x83, 0x69, 0x0a, 0x42, 0xa8, 0x54, 0x0a, 0xe7, 0x92, 0xc3, 0xe5, 0x30, 0xca, + 0x0c, 0xce, 0xe3, 0x52, 0xc1, 0xef, 0x21, 0xa8, 0xf1, 0x6e, 0x5c, 0xfc, 0x05, 0xa8, 0x52, 0x50, + 0x4b, 0x64, 0x50, 0x2d, 0x01, 0xc7, 0x17, 0xc2, 0x26, 0x74, 0x4d, 0x46, 0x8f, 0x59, 0xb8, 0x58, + 0xc1, 0x16, 0x0a, 0x2d, 0x64, 0xe4, 0x62, 0x83, 0x44, 0x8b, 0x90, 0x91, 0x1e, 0xfe, 0x14, 0xa3, + 0x87, 0x19, 0xb3, 0x52, 0xc6, 0x24, 0xe9, 0x81, 0xf8, 0x42, 0x49, 0xaf, 0xe9, 0xf2, 0x93, 0xc9, + 0x4c, 0x1a, 0x42, 0x6a, 0xfa, 0x04, 0x92, 0x33, 0x24, 0x3d, 0x08, 0x9d, 0x65, 0xe4, 0x12, 0xc4, + 0x08, 0x19, 0x21, 0x5b, 0xe2, 0xac, 0xc6, 0x91, 0x86, 0xa4, 0xec, 0xc8, 0xd5, 0x0e, 0xf5, 0x84, + 0x25, 0xd8, 0x13, 0xc6, 0x42, 0x86, 0x04, 0x3d, 0x01, 0x35, 0x02, 0x1e, 0x07, 0x42, 0x4f, 0x19, + 0xb9, 0xc4, 0x71, 0xc4, 0xb4, 0x90, 0x33, 0x79, 0xce, 0x42, 0x49, 0xf8, 0x52, 0x2e, 0x94, 0x19, + 0x02, 0xf5, 0xa1, 0x3d, 0xd8, 0x87, 0x96, 0x42, 0xe6, 0x24, 0xfb, 0x30, 0x07, 0x6c, 0x90, 0x93, + 0xcf, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, + 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x19, 0xa5, 0x67, 0x96, 0x64, + 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xa2, 0x18, 0xae, 0x0b, 0x35, 0xb1, 0x02, 0xc5, 0xfc, 0x92, + 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0x09, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xa6, + 0xaa, 0x8a, 0x92, 0x04, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -242,6 +376,8 @@ type QueryClient interface { Admins(ctx context.Context, in *QueryAdminsRequest, opts ...grpc.CallOption) (*QueryAdminsResponse, error) // Queries a list of archived proposals. ArchivedProposals(ctx context.Context, in *QueryArchivedProposalsRequest, opts ...grpc.CallOption) (*QueryArchivedProposalsResponse, error) + // Queries a list of archived proposals. + ArchivedProposalsLegacy(ctx context.Context, in *QueryArchivedProposalsLegacyRequest, opts ...grpc.CallOption) (*QueryArchivedProposalsLegacyResponse, error) } type queryClient struct { @@ -270,12 +406,23 @@ func (c *queryClient) ArchivedProposals(ctx context.Context, in *QueryArchivedPr return out, nil } +func (c *queryClient) ArchivedProposalsLegacy(ctx context.Context, in *QueryArchivedProposalsLegacyRequest, opts ...grpc.CallOption) (*QueryArchivedProposalsLegacyResponse, error) { + out := new(QueryArchivedProposalsLegacyResponse) + err := c.cc.Invoke(ctx, "/cosmos.adminmodule.adminmodule.Query/ArchivedProposalsLegacy", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Queries a list of admins items. Admins(context.Context, *QueryAdminsRequest) (*QueryAdminsResponse, error) // Queries a list of archived proposals. ArchivedProposals(context.Context, *QueryArchivedProposalsRequest) (*QueryArchivedProposalsResponse, error) + // Queries a list of archived proposals. + ArchivedProposalsLegacy(context.Context, *QueryArchivedProposalsLegacyRequest) (*QueryArchivedProposalsLegacyResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -288,6 +435,9 @@ func (*UnimplementedQueryServer) Admins(ctx context.Context, req *QueryAdminsReq func (*UnimplementedQueryServer) ArchivedProposals(ctx context.Context, req *QueryArchivedProposalsRequest) (*QueryArchivedProposalsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ArchivedProposals not implemented") } +func (*UnimplementedQueryServer) ArchivedProposalsLegacy(ctx context.Context, req *QueryArchivedProposalsLegacyRequest) (*QueryArchivedProposalsLegacyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ArchivedProposalsLegacy not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -329,6 +479,24 @@ func _Query_ArchivedProposals_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Query_ArchivedProposalsLegacy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryArchivedProposalsLegacyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ArchivedProposalsLegacy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.adminmodule.adminmodule.Query/ArchivedProposalsLegacy", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ArchivedProposalsLegacy(ctx, req.(*QueryArchivedProposalsLegacyRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.adminmodule.adminmodule.Query", HandlerType: (*QueryServer)(nil), @@ -341,6 +509,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "ArchivedProposals", Handler: _Query_ArchivedProposals_Handler, }, + { + MethodName: "ArchivedProposalsLegacy", + Handler: _Query_ArchivedProposalsLegacy_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/adminmodule/adminmodule/query.proto", @@ -424,6 +596,66 @@ func (m *QueryArchivedProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *QueryArchivedProposalsLegacyRequest) 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 *QueryArchivedProposalsLegacyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryArchivedProposalsLegacyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 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 *QueryArchivedProposalsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -461,6 +693,43 @@ func (m *QueryArchivedProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *QueryArchivedProposalsLegacyResponse) 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 *QueryArchivedProposalsLegacyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryArchivedProposalsLegacyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ProposalsLegacy) > 0 { + for iNdEx := len(m.ProposalsLegacy) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ProposalsLegacy[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 encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -505,6 +774,30 @@ func (m *QueryArchivedProposalsRequest) Size() (n int) { return n } +func (m *QueryArchivedProposalsLegacyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = 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)) + } + } + return n +} + func (m *QueryArchivedProposalsResponse) Size() (n int) { if m == nil { return 0 @@ -520,6 +813,21 @@ func (m *QueryArchivedProposalsResponse) Size() (n int) { return n } +func (m *QueryArchivedProposalsLegacyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ProposalsLegacy) > 0 { + for _, e := range m.ProposalsLegacy { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -708,6 +1016,140 @@ func (m *QueryArchivedProposalsRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryArchivedProposalsLegacyRequest) 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: QueryArchivedProposalsLegacyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryArchivedProposalsLegacyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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, &v1.Proposal{}) + if err := m.Proposals[len(m.Proposals)-1].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 *QueryArchivedProposalsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -766,7 +1208,7 @@ func (m *QueryArchivedProposalsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Proposals = append(m.Proposals, &v1beta1.Proposal{}) + m.Proposals = append(m.Proposals, &v1.Proposal{}) if err := m.Proposals[len(m.Proposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -792,6 +1234,90 @@ func (m *QueryArchivedProposalsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryArchivedProposalsLegacyResponse) 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: QueryArchivedProposalsLegacyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryArchivedProposalsLegacyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalsLegacy", 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.ProposalsLegacy = append(m.ProposalsLegacy, &v1beta1.Proposal{}) + if err := m.ProposalsLegacy[len(m.ProposalsLegacy)-1].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 diff --git a/x/adminmodule/types/query.pb.gw.go b/x/adminmodule/types/query.pb.gw.go index f9dc8cc..0a47931 100644 --- a/x/adminmodule/types/query.pb.gw.go +++ b/x/adminmodule/types/query.pb.gw.go @@ -69,6 +69,24 @@ func local_request_Query_ArchivedProposals_0(ctx context.Context, marshaler runt } +func request_Query_ArchivedProposalsLegacy_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryArchivedProposalsLegacyRequest + var metadata runtime.ServerMetadata + + msg, err := client.ArchivedProposalsLegacy(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ArchivedProposalsLegacy_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryArchivedProposalsLegacyRequest + var metadata runtime.ServerMetadata + + msg, err := server.ArchivedProposalsLegacy(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. @@ -121,6 +139,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_ArchivedProposalsLegacy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ArchivedProposalsLegacy_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ArchivedProposalsLegacy_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -202,6 +243,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_ArchivedProposalsLegacy_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_ArchivedProposalsLegacy_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_ArchivedProposalsLegacy_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -209,10 +270,14 @@ var ( pattern_Query_Admins_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1, 2, 2}, []string{"cosmos", "adminmodule", "admins"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ArchivedProposals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1, 2, 2}, []string{"cosmos", "adminmodule", "archivedproposals"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_ArchivedProposalsLegacy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1, 2, 2}, []string{"cosmos", "adminmodule", "archivedproposalslegacy"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Admins_0 = runtime.ForwardResponseMessage forward_Query_ArchivedProposals_0 = runtime.ForwardResponseMessage + + forward_Query_ArchivedProposalsLegacy_0 = runtime.ForwardResponseMessage ) diff --git a/x/adminmodule/types/tx.pb.go b/x/adminmodule/types/tx.pb.go index 9ba0802..db0abc7 100644 --- a/x/adminmodule/types/tx.pb.go +++ b/x/adminmodule/types/tx.pb.go @@ -206,17 +206,102 @@ func (m *MsgAddAdminResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAddAdminResponse proto.InternalMessageInfo -// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary +// MsgSubmitProposalLegacy defines an sdk.Msg type that supports submitting arbitrary // proposal Content. -type MsgSubmitProposal struct { +type MsgSubmitProposalLegacy struct { Content *types.Any `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` Proposer string `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty"` } +func (m *MsgSubmitProposalLegacy) Reset() { *m = MsgSubmitProposalLegacy{} } +func (*MsgSubmitProposalLegacy) ProtoMessage() {} +func (*MsgSubmitProposalLegacy) Descriptor() ([]byte, []int) { + return fileDescriptor_55c2d463b72a29fc, []int{4} +} +func (m *MsgSubmitProposalLegacy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitProposalLegacy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitProposalLegacy.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 *MsgSubmitProposalLegacy) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitProposalLegacy.Merge(m, src) +} +func (m *MsgSubmitProposalLegacy) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitProposalLegacy) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitProposalLegacy.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitProposalLegacy proto.InternalMessageInfo + +// MsgSubmitProposalLegacyResponse defines the Msg/SubmitProposalLegacy response type. +type MsgSubmitProposalLegacyResponse struct { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id" yaml:"proposal_id"` +} + +func (m *MsgSubmitProposalLegacyResponse) Reset() { *m = MsgSubmitProposalLegacyResponse{} } +func (m *MsgSubmitProposalLegacyResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitProposalLegacyResponse) ProtoMessage() {} +func (*MsgSubmitProposalLegacyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_55c2d463b72a29fc, []int{5} +} +func (m *MsgSubmitProposalLegacyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitProposalLegacyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitProposalLegacyResponse.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 *MsgSubmitProposalLegacyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitProposalLegacyResponse.Merge(m, src) +} +func (m *MsgSubmitProposalLegacyResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitProposalLegacyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitProposalLegacyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitProposalLegacyResponse proto.InternalMessageInfo + +func (m *MsgSubmitProposalLegacyResponse) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary +// proposal Content. +type MsgSubmitProposal struct { + // messages are the arbitrary messages to be executed if proposal passes. + Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` + Proposer string `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty"` +} + func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } func (*MsgSubmitProposal) ProtoMessage() {} func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_55c2d463b72a29fc, []int{4} + return fileDescriptor_55c2d463b72a29fc, []int{6} } func (m *MsgSubmitProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -254,7 +339,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_55c2d463b72a29fc, []int{5} + return fileDescriptor_55c2d463b72a29fc, []int{7} } func (m *MsgSubmitProposalResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -295,6 +380,8 @@ func init() { proto.RegisterType((*MsgDeleteAdminResponse)(nil), "cosmos.adminmodule.adminmodule.MsgDeleteAdminResponse") proto.RegisterType((*MsgAddAdmin)(nil), "cosmos.adminmodule.adminmodule.MsgAddAdmin") proto.RegisterType((*MsgAddAdminResponse)(nil), "cosmos.adminmodule.adminmodule.MsgAddAdminResponse") + proto.RegisterType((*MsgSubmitProposalLegacy)(nil), "cosmos.adminmodule.adminmodule.MsgSubmitProposalLegacy") + proto.RegisterType((*MsgSubmitProposalLegacyResponse)(nil), "cosmos.adminmodule.adminmodule.MsgSubmitProposalLegacyResponse") proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos.adminmodule.adminmodule.MsgSubmitProposal") proto.RegisterType((*MsgSubmitProposalResponse)(nil), "cosmos.adminmodule.adminmodule.MsgSubmitProposalResponse") } @@ -304,36 +391,39 @@ func init() { } var fileDescriptor_55c2d463b72a29fc = []byte{ - // 449 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4f, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x4c, 0xc9, 0xcd, 0xcc, 0xcb, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x45, 0x61, - 0x97, 0x54, 0xe8, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xc9, 0x41, 0x14, 0xea, 0x21, 0x49, 0x22, - 0xb3, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x4a, 0xf5, 0x41, 0x2c, 0x88, 0x2e, 0x29, 0xc9, - 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, 0x54, 0x7d, 0x30, 0x2f, 0xa9, 0x34, 0x4d, 0x3f, 0x31, 0xaf, 0x12, - 0x26, 0x05, 0x31, 0x30, 0x1e, 0xa2, 0x07, 0x6a, 0x3a, 0x98, 0xa3, 0xe4, 0xc0, 0xc5, 0xe7, 0x5b, - 0x9c, 0xee, 0x92, 0x9a, 0x93, 0x5a, 0x92, 0xea, 0x08, 0xb2, 0x43, 0x48, 0x82, 0x8b, 0x3d, 0xb9, - 0x28, 0x35, 0xb1, 0x24, 0xbf, 0x48, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, 0xc6, 0x15, 0x12, - 0xe1, 0x62, 0x05, 0x3b, 0x43, 0x82, 0x09, 0x2c, 0x0e, 0xe1, 0x28, 0x49, 0x70, 0x89, 0xa1, 0x9a, - 0x10, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0xaa, 0x64, 0xcb, 0xc5, 0xed, 0x5b, 0x9c, 0xee, - 0x98, 0x92, 0x42, 0x9e, 0xc1, 0xa2, 0x5c, 0xc2, 0x48, 0xda, 0xe1, 0xa6, 0xd6, 0x71, 0x09, 0xfa, - 0x16, 0xa7, 0x07, 0x97, 0x26, 0xe5, 0x66, 0x96, 0x04, 0x14, 0xe5, 0x17, 0xe4, 0x17, 0x27, 0xe6, - 0x08, 0x59, 0x73, 0xb1, 0x27, 0xe7, 0xe7, 0x95, 0xa4, 0xe6, 0x95, 0x80, 0xcd, 0xe6, 0x36, 0x12, - 0xd1, 0x83, 0x04, 0x87, 0x1e, 0x2c, 0x38, 0xf4, 0x1c, 0xf3, 0x2a, 0x9d, 0xb8, 0x4f, 0x6d, 0xd1, - 0x65, 0x77, 0x86, 0x28, 0x0c, 0x82, 0xe9, 0x10, 0x92, 0xe2, 0xe2, 0x28, 0x00, 0x1b, 0x94, 0x5a, - 0x04, 0x75, 0x01, 0x9c, 0x6f, 0x25, 0xd0, 0xb1, 0x40, 0x9e, 0x61, 0xc6, 0x02, 0x79, 0x86, 0x17, - 0x0b, 0xe4, 0x19, 0x1a, 0xee, 0x28, 0x30, 0x28, 0x25, 0x73, 0x49, 0x62, 0xd8, 0x0f, 0x73, 0x9c, - 0x90, 0x1b, 0x17, 0x77, 0x01, 0x54, 0x2c, 0x3e, 0x33, 0x05, 0xec, 0x16, 0x16, 0x27, 0xd5, 0x57, - 0xf7, 0xe4, 0x91, 0x85, 0x3f, 0xdd, 0x93, 0x17, 0xaa, 0x4c, 0xcc, 0xcd, 0xb1, 0x52, 0x42, 0x12, - 0x54, 0x0a, 0xe2, 0x82, 0xf1, 0x3c, 0x53, 0x8c, 0x5e, 0x31, 0x71, 0x31, 0xfb, 0x16, 0xa7, 0x0b, - 0x95, 0x72, 0x71, 0x23, 0xc7, 0x8d, 0x9e, 0x1e, 0xfe, 0xa4, 0xa1, 0x87, 0x1a, 0x13, 0x52, 0x66, - 0xa4, 0xa9, 0x87, 0x7b, 0x23, 0x87, 0x8b, 0x03, 0x1e, 0x6d, 0xda, 0x44, 0x98, 0x01, 0x53, 0x2c, - 0x65, 0x4c, 0x82, 0x62, 0xb8, 0x6d, 0x75, 0x5c, 0x7c, 0x68, 0xd1, 0x69, 0x48, 0x84, 0x31, 0xa8, - 0x5a, 0xa4, 0x2c, 0x49, 0xd6, 0x02, 0xb3, 0xdf, 0xc9, 0xe7, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, - 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, - 0x8f, 0xe5, 0x18, 0xa2, 0x8c, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, - 0x91, 0x73, 0xaf, 0x2e, 0x34, 0xcb, 0x56, 0xa0, 0x66, 0xe0, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, - 0x70, 0x8a, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x48, 0x78, 0xc1, 0x42, 0xef, 0x03, 0x00, - 0x00, + // 508 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x3f, 0x8b, 0xd4, 0x40, + 0x14, 0x4f, 0x5c, 0x75, 0xd7, 0x17, 0x38, 0x74, 0x5c, 0x35, 0x97, 0x22, 0x59, 0x02, 0xa2, 0x20, + 0x37, 0xd1, 0x3d, 0x50, 0x3c, 0x11, 0xdd, 0x55, 0x04, 0xe1, 0x16, 0x24, 0x76, 0x36, 0x47, 0x36, + 0x19, 0xc7, 0x40, 0x92, 0x09, 0x99, 0x04, 0x2e, 0x8d, 0x58, 0x58, 0x58, 0x5e, 0x69, 0xb9, 0x1f, + 0xc2, 0x0f, 0x21, 0x56, 0x57, 0x5a, 0xc8, 0x21, 0xbb, 0x8d, 0x58, 0xda, 0x0b, 0x72, 0x93, 0x4d, + 0x48, 0x3c, 0x4f, 0x2e, 0xcb, 0x75, 0xf3, 0x66, 0x7e, 0xff, 0x5e, 0xf2, 0x66, 0xe0, 0x86, 0xcb, + 0x78, 0xc8, 0xb8, 0xe5, 0x78, 0xa1, 0x1f, 0x85, 0xcc, 0xcb, 0x02, 0xd2, 0x58, 0xa7, 0xbb, 0x38, + 0x4e, 0x58, 0xca, 0x90, 0x5e, 0x00, 0x71, 0xed, 0xb0, 0xbe, 0xd6, 0xfa, 0x94, 0x51, 0x26, 0xa0, + 0xd6, 0xe1, 0xaa, 0x60, 0x69, 0xeb, 0x94, 0x31, 0x1a, 0x10, 0x4b, 0x54, 0xd3, 0xec, 0xb5, 0xe5, + 0x44, 0x79, 0x79, 0x54, 0x08, 0xee, 0x14, 0x9c, 0xa5, 0xba, 0x28, 0xcc, 0xc7, 0xb0, 0x36, 0xe1, + 0xf4, 0x29, 0x09, 0x48, 0x4a, 0x46, 0x87, 0x1e, 0x48, 0x85, 0xae, 0x9b, 0x10, 0x27, 0x65, 0x89, + 0x2a, 0x0f, 0xe4, 0x9b, 0x17, 0xec, 0xb2, 0x44, 0x7d, 0x38, 0x27, 0x62, 0xa8, 0x67, 0xc4, 0x7e, + 0x51, 0x98, 0x2a, 0x5c, 0x6d, 0x2a, 0xd8, 0x84, 0xc7, 0x2c, 0xe2, 0xc4, 0x7c, 0x08, 0xca, 0x84, + 0xd3, 0x91, 0xe7, 0xad, 0x26, 0x7c, 0x05, 0x2e, 0xd7, 0xe8, 0x95, 0xea, 0x7b, 0x19, 0xae, 0x4d, + 0x38, 0x7d, 0x99, 0x4d, 0x43, 0x3f, 0x7d, 0x91, 0xb0, 0x98, 0x71, 0x27, 0xd8, 0x26, 0xd4, 0x71, + 0x73, 0xf4, 0x00, 0xba, 0x2e, 0x8b, 0x52, 0x12, 0xa5, 0xc2, 0x42, 0x19, 0xf6, 0x71, 0xf1, 0x55, + 0x70, 0xf9, 0x55, 0xf0, 0x28, 0xca, 0xc7, 0xca, 0x97, 0x4f, 0x1b, 0xdd, 0x27, 0x05, 0xd0, 0x2e, + 0x19, 0x48, 0x83, 0x5e, 0x2c, 0xe4, 0x48, 0xb2, 0x0c, 0x52, 0xd5, 0x5b, 0x17, 0x3f, 0xcc, 0x0c, + 0xe9, 0xe3, 0xcc, 0x90, 0x7e, 0xcc, 0x0c, 0xe9, 0xdd, 0xb7, 0x81, 0x64, 0xfa, 0x60, 0x1c, 0x93, + 0xa2, 0x4c, 0x8a, 0x9e, 0x81, 0x12, 0x2f, 0x4f, 0x76, 0x7c, 0x4f, 0x24, 0x3a, 0x3b, 0xbe, 0xfe, + 0xf3, 0xc0, 0xa8, 0x6f, 0xff, 0x3a, 0x30, 0x50, 0xee, 0x84, 0xc1, 0x96, 0x59, 0xdb, 0x34, 0x6d, + 0x28, 0xab, 0xe7, 0x9e, 0xc9, 0xe1, 0xd2, 0x11, 0x2b, 0x74, 0x1b, 0x7a, 0x21, 0xe1, 0xdc, 0xa1, + 0x84, 0xab, 0xf2, 0xa0, 0x73, 0x5c, 0xaf, 0x76, 0x85, 0x6a, 0xd9, 0x9f, 0x0b, 0xeb, 0x47, 0x4c, + 0x4f, 0xbb, 0xb3, 0xe1, 0xef, 0x0e, 0x74, 0x26, 0x9c, 0xa2, 0x0c, 0x94, 0xfa, 0x08, 0x62, 0xfc, + 0xff, 0x1b, 0x80, 0x9b, 0x03, 0xa7, 0xdd, 0x6d, 0x87, 0xaf, 0xda, 0x08, 0xa0, 0x57, 0x4d, 0xe7, + 0xad, 0x13, 0x68, 0x94, 0x60, 0x6d, 0xb3, 0x05, 0xb8, 0x72, 0x7b, 0x0b, 0x6b, 0x7f, 0xfd, 0xc3, + 0x3b, 0x27, 0x90, 0x69, 0x52, 0xb4, 0xfb, 0xad, 0x29, 0x95, 0xff, 0x9e, 0x0c, 0xfd, 0x7f, 0xde, + 0x9a, 0x7b, 0xad, 0x35, 0x0b, 0xa2, 0xf6, 0x68, 0x45, 0x62, 0x19, 0x69, 0xbc, 0xfd, 0x79, 0xae, + 0xcb, 0xfb, 0x73, 0x5d, 0xfe, 0x3e, 0xd7, 0xe5, 0xbd, 0x85, 0x2e, 0xed, 0x2f, 0x74, 0xe9, 0xeb, + 0x42, 0x97, 0x5e, 0x0d, 0xa9, 0x9f, 0xbe, 0xc9, 0xa6, 0xd8, 0x65, 0xa1, 0x55, 0x7f, 0x37, 0x37, + 0x96, 0x8f, 0xe5, 0x6e, 0xf3, 0xe9, 0xcc, 0x63, 0xc2, 0xa7, 0xe7, 0xc5, 0xe0, 0x6f, 0xfe, 0x09, + 0x00, 0x00, 0xff, 0xff, 0x5e, 0x3a, 0x9b, 0x8c, 0x69, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -351,6 +441,7 @@ type MsgClient interface { DeleteAdmin(ctx context.Context, in *MsgDeleteAdmin, opts ...grpc.CallOption) (*MsgDeleteAdminResponse, error) AddAdmin(ctx context.Context, in *MsgAddAdmin, opts ...grpc.CallOption) (*MsgAddAdminResponse, error) SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) + SubmitProposalLegacy(ctx context.Context, in *MsgSubmitProposalLegacy, opts ...grpc.CallOption) (*MsgSubmitProposalLegacyResponse, error) } type msgClient struct { @@ -388,11 +479,21 @@ func (c *msgClient) SubmitProposal(ctx context.Context, in *MsgSubmitProposal, o return out, nil } +func (c *msgClient) SubmitProposalLegacy(ctx context.Context, in *MsgSubmitProposalLegacy, opts ...grpc.CallOption) (*MsgSubmitProposalLegacyResponse, error) { + out := new(MsgSubmitProposalLegacyResponse) + err := c.cc.Invoke(ctx, "/cosmos.adminmodule.adminmodule.Msg/SubmitProposalLegacy", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { DeleteAdmin(context.Context, *MsgDeleteAdmin) (*MsgDeleteAdminResponse, error) AddAdmin(context.Context, *MsgAddAdmin) (*MsgAddAdminResponse, error) SubmitProposal(context.Context, *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) + SubmitProposalLegacy(context.Context, *MsgSubmitProposalLegacy) (*MsgSubmitProposalLegacyResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -408,6 +509,9 @@ func (*UnimplementedMsgServer) AddAdmin(ctx context.Context, req *MsgAddAdmin) ( func (*UnimplementedMsgServer) SubmitProposal(ctx context.Context, req *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SubmitProposal not implemented") } +func (*UnimplementedMsgServer) SubmitProposalLegacy(ctx context.Context, req *MsgSubmitProposalLegacy) (*MsgSubmitProposalLegacyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitProposalLegacy not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -467,6 +571,24 @@ func _Msg_SubmitProposal_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Msg_SubmitProposalLegacy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitProposalLegacy) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitProposalLegacy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.adminmodule.adminmodule.Msg/SubmitProposalLegacy", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitProposalLegacy(ctx, req.(*MsgSubmitProposalLegacy)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.adminmodule.adminmodule.Msg", HandlerType: (*MsgServer)(nil), @@ -483,6 +605,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SubmitProposal", Handler: _Msg_SubmitProposal_Handler, }, + { + MethodName: "SubmitProposalLegacy", + Handler: _Msg_SubmitProposalLegacy_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/adminmodule/adminmodule/tx.proto", @@ -608,7 +734,7 @@ func (m *MsgAddAdminResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgSubmitProposal) Marshal() (dAtA []byte, err error) { +func (m *MsgSubmitProposalLegacy) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -618,12 +744,12 @@ func (m *MsgSubmitProposal) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSubmitProposalLegacy) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgSubmitProposalLegacy) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -650,6 +776,78 @@ func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgSubmitProposalLegacyResponse) 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 *MsgSubmitProposalLegacyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitProposalLegacyResponse) 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 *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] = 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) @@ -741,7 +939,7 @@ func (m *MsgAddAdminResponse) Size() (n int) { return n } -func (m *MsgSubmitProposal) Size() (n int) { +func (m *MsgSubmitProposalLegacy) Size() (n int) { if m == nil { return 0 } @@ -758,6 +956,37 @@ func (m *MsgSubmitProposal) Size() (n int) { return n } +func (m *MsgSubmitProposalLegacyResponse) 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 *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)) + } + } + 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 @@ -1104,7 +1333,7 @@ func (m *MsgAddAdminResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { +func (m *MsgSubmitProposalLegacy) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1127,10 +1356,10 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSubmitProposal: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSubmitProposalLegacy: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposal: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSubmitProposalLegacy: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1222,6 +1451,191 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgSubmitProposalLegacyResponse) 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: MsgSubmitProposalLegacyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitProposalLegacyResponse: 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 *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 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