Skip to content

Commit bdee333

Browse files
authored
refactor: move gov types to v1beta2 (#10852)
## Description Closes: #10793 --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
1 parent 344be86 commit bdee333

30 files changed

+329
-322
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
114114
* [\#10692](https://github.com/cosmos/cosmos-sdk/pull/10612) `SignerData` takes 2 new fields, `Address` and `PubKey`, which need to get populated when using SIGN_MODE_DIRECT_AUX.
115115
* [\#10748](https://github.com/cosmos/cosmos-sdk/pull/10748) Move legacy `x/gov` api to `v1beta1` directory.
116116
* [\#10816](https://github.com/cosmos/cosmos-sdk/pull/10816) Reuse blocked addresses from the bank module. No need to pass them to distribution.
117+
* [\#10852](https://github.com/cosmos/cosmos-sdk/pull/10852) Move `x/gov/types` to `x/gov/types/v1beta2`.
117118

118119
### Client Breaking Changes
119120

proto/cosmos/gov/v1beta2/genesis.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package cosmos.gov.v1beta2;
44

55
import "cosmos/gov/v1beta2/gov.proto";
66

7-
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";
7+
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2";
88

99
// GenesisState defines the gov module's genesis state.
1010
message GenesisState {

proto/cosmos/gov/v1beta2/gov.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import "google/protobuf/any.proto";
88
import "google/protobuf/duration.proto";
99
import "cosmos_proto/cosmos.proto";
1010

11-
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";
11+
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2";
1212

1313
// VoteOption enumerates the valid vote options for a given governance proposal.
1414
enum VoteOption {

proto/cosmos/gov/v1beta2/query.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import "google/api/annotations.proto";
66
import "cosmos/gov/v1beta2/gov.proto";
77
import "cosmos_proto/cosmos.proto";
88

9-
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";
9+
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2";
1010

1111
// Query defines the gRPC querier service for gov module
1212
service Query {

proto/cosmos/gov/v1beta2/tx.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import "gogoproto/gogo.proto";
77
import "cosmos_proto/cosmos.proto";
88
import "google/protobuf/any.proto";
99

10-
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";
10+
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2";
1111

1212
// Msg defines the gov Msg service.
1313
service Msg {

x/authz/simulation/genesis.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
1010
"github.com/cosmos/cosmos-sdk/x/authz"
1111
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
12-
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
12+
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2"
1313
)
1414

1515
// genGrant returns a slice of authorization grants.
@@ -31,7 +31,7 @@ func genGrant(r *rand.Rand, accounts []simtypes.Account) []authz.GrantAuthorizat
3131
func generateRandomGrant(r *rand.Rand) *codectypes.Any {
3232
authorizations := make([]*codectypes.Any, 2)
3333
authorizations[0] = newAnyAuthorization(banktypes.NewSendAuthorization(sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(1000)))))
34-
authorizations[1] = newAnyAuthorization(authz.NewGenericAuthorization(sdk.MsgTypeURL(&govtypes.MsgSubmitProposal{})))
34+
authorizations[1] = newAnyAuthorization(authz.NewGenericAuthorization(sdk.MsgTypeURL(&v1beta2.MsgSubmitProposal{})))
3535

3636
return authorizations[r.Intn(len(authorizations))]
3737
}

x/gov/client/testutil/cli_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
"github.com/cosmos/cosmos-sdk/testutil/network"
88
sdk "github.com/cosmos/cosmos-sdk/types"
9-
"github.com/cosmos/cosmos-sdk/x/gov/types"
9+
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2"
1010

1111
"github.com/stretchr/testify/require"
1212
"github.com/stretchr/testify/suite"
@@ -17,9 +17,9 @@ func TestIntegrationTestSuite(t *testing.T) {
1717
cfg.NumValidators = 1
1818
suite.Run(t, NewIntegrationTestSuite(cfg))
1919

20-
dp := types.NewDepositParams(sdk.NewCoins(sdk.NewCoin(cfg.BondDenom, types.DefaultMinDepositTokens)), time.Duration(15)*time.Second)
21-
vp := types.NewVotingParams(time.Duration(5) * time.Second)
22-
genesisState := types.DefaultGenesisState()
20+
dp := v1beta2.NewDepositParams(sdk.NewCoins(sdk.NewCoin(cfg.BondDenom, v1beta2.DefaultMinDepositTokens)), time.Duration(15)*time.Second)
21+
vp := v1beta2.NewVotingParams(time.Duration(5) * time.Second)
22+
genesisState := v1beta2.DefaultGenesisState()
2323
genesisState.DepositParams = &dp
2424
genesisState.VotingParams = &vp
2525
bz, err := cfg.Codec.MarshalJSON(genesisState)

x/gov/keeper/params.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,42 @@ package keeper
22

33
import (
44
sdk "github.com/cosmos/cosmos-sdk/types"
5-
"github.com/cosmos/cosmos-sdk/x/gov/types"
65
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
6+
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2"
77
)
88

99
// GetDepositParams returns the current DepositParams from the global param store
1010
func (keeper Keeper) GetDepositParams(ctx sdk.Context) v1beta1.DepositParams {
1111
var depositParams v1beta1.DepositParams
12-
keeper.paramSpace.Get(ctx, types.ParamStoreKeyDepositParams, &depositParams)
12+
keeper.paramSpace.Get(ctx, v1beta2.ParamStoreKeyDepositParams, &depositParams)
1313
return depositParams
1414
}
1515

1616
// GetVotingParams returns the current VotingParams from the global param store
1717
func (keeper Keeper) GetVotingParams(ctx sdk.Context) v1beta1.VotingParams {
1818
var votingParams v1beta1.VotingParams
19-
keeper.paramSpace.Get(ctx, types.ParamStoreKeyVotingParams, &votingParams)
19+
keeper.paramSpace.Get(ctx, v1beta2.ParamStoreKeyVotingParams, &votingParams)
2020
return votingParams
2121
}
2222

2323
// GetTallyParams returns the current TallyParam from the global param store
2424
func (keeper Keeper) GetTallyParams(ctx sdk.Context) v1beta1.TallyParams {
2525
var tallyParams v1beta1.TallyParams
26-
keeper.paramSpace.Get(ctx, types.ParamStoreKeyTallyParams, &tallyParams)
26+
keeper.paramSpace.Get(ctx, v1beta2.ParamStoreKeyTallyParams, &tallyParams)
2727
return tallyParams
2828
}
2929

3030
// SetDepositParams sets DepositParams to the global param store
3131
func (keeper Keeper) SetDepositParams(ctx sdk.Context, depositParams v1beta1.DepositParams) {
32-
keeper.paramSpace.Set(ctx, types.ParamStoreKeyDepositParams, &depositParams)
32+
keeper.paramSpace.Set(ctx, v1beta2.ParamStoreKeyDepositParams, &depositParams)
3333
}
3434

3535
// SetVotingParams sets VotingParams to the global param store
3636
func (keeper Keeper) SetVotingParams(ctx sdk.Context, votingParams v1beta1.VotingParams) {
37-
keeper.paramSpace.Set(ctx, types.ParamStoreKeyVotingParams, &votingParams)
37+
keeper.paramSpace.Set(ctx, v1beta2.ParamStoreKeyVotingParams, &votingParams)
3838
}
3939

4040
// SetTallyParams sets TallyParams to the global param store
4141
func (keeper Keeper) SetTallyParams(ctx sdk.Context, tallyParams v1beta1.TallyParams) {
42-
keeper.paramSpace.Set(ctx, types.ParamStoreKeyTallyParams, &tallyParams)
42+
keeper.paramSpace.Set(ctx, v1beta2.ParamStoreKeyTallyParams, &tallyParams)
4343
}

x/gov/keeper/querier.go

+17-16
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,35 @@ import (
99
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
1010
"github.com/cosmos/cosmos-sdk/x/gov/types"
1111
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
12+
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2"
1213
)
1314

1415
// NewQuerier creates a new gov Querier instance
1516
func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
1617
return func(ctx sdk.Context, path []string, req abci.RequestQuery) ([]byte, error) {
1718
switch path[0] {
18-
case types.QueryParams:
19+
case v1beta2.QueryParams:
1920
return queryParams(ctx, path[1:], req, keeper, legacyQuerierCdc)
2021

21-
case types.QueryProposals:
22+
case v1beta2.QueryProposals:
2223
return queryProposals(ctx, path[1:], req, keeper, legacyQuerierCdc)
2324

24-
case types.QueryProposal:
25+
case v1beta2.QueryProposal:
2526
return queryProposal(ctx, path[1:], req, keeper, legacyQuerierCdc)
2627

27-
case types.QueryDeposits:
28+
case v1beta2.QueryDeposits:
2829
return queryDeposits(ctx, path[1:], req, keeper, legacyQuerierCdc)
2930

30-
case types.QueryDeposit:
31+
case v1beta2.QueryDeposit:
3132
return queryDeposit(ctx, path[1:], req, keeper, legacyQuerierCdc)
3233

33-
case types.QueryVotes:
34+
case v1beta2.QueryVotes:
3435
return queryVotes(ctx, path[1:], req, keeper, legacyQuerierCdc)
3536

36-
case types.QueryVote:
37+
case v1beta2.QueryVote:
3738
return queryVote(ctx, path[1:], req, keeper, legacyQuerierCdc)
3839

39-
case types.QueryTally:
40+
case v1beta2.QueryTally:
4041
return queryTally(ctx, path[1:], req, keeper, legacyQuerierCdc)
4142

4243
default:
@@ -47,21 +48,21 @@ func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
4748

4849
func queryParams(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) {
4950
switch path[0] {
50-
case types.ParamDeposit:
51+
case v1beta2.ParamDeposit:
5152
bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, keeper.GetDepositParams(ctx))
5253
if err != nil {
5354
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
5455
}
5556
return bz, nil
5657

57-
case types.ParamVoting:
58+
case v1beta2.ParamVoting:
5859
bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, keeper.GetVotingParams(ctx))
5960
if err != nil {
6061
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
6162
}
6263
return bz, nil
6364

64-
case types.ParamTallying:
65+
case v1beta2.ParamTallying:
6566
bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, keeper.GetTallyParams(ctx))
6667
if err != nil {
6768
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
@@ -75,7 +76,7 @@ func queryParams(ctx sdk.Context, path []string, req abci.RequestQuery, keeper K
7576

7677
// nolint: unparam
7778
func queryProposal(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) {
78-
var params types.QueryProposalParams
79+
var params v1beta2.QueryProposalParams
7980
err := legacyQuerierCdc.UnmarshalJSON(req.Data, &params)
8081
if err != nil {
8182
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
@@ -96,7 +97,7 @@ func queryProposal(ctx sdk.Context, path []string, req abci.RequestQuery, keeper
9697

9798
// nolint: unparam
9899
func queryDeposit(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) {
99-
var params types.QueryDepositParams
100+
var params v1beta2.QueryDepositParams
100101
err := legacyQuerierCdc.UnmarshalJSON(req.Data, &params)
101102
if err != nil {
102103
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
@@ -113,7 +114,7 @@ func queryDeposit(ctx sdk.Context, path []string, req abci.RequestQuery, keeper
113114

114115
// nolint: unparam
115116
func queryVote(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) {
116-
var params types.QueryVoteParams
117+
var params v1beta2.QueryVoteParams
117118
err := legacyQuerierCdc.UnmarshalJSON(req.Data, &params)
118119
if err != nil {
119120
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
@@ -130,7 +131,7 @@ func queryVote(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Kee
130131

131132
// nolint: unparam
132133
func queryDeposits(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) {
133-
var params types.QueryProposalParams
134+
var params v1beta2.QueryProposalParams
134135
err := legacyQuerierCdc.UnmarshalJSON(req.Data, &params)
135136
if err != nil {
136137
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
@@ -151,7 +152,7 @@ func queryDeposits(ctx sdk.Context, path []string, req abci.RequestQuery, keeper
151152

152153
// nolint: unparam
153154
func queryTally(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) {
154-
var params types.QueryProposalParams
155+
var params v1beta2.QueryProposalParams
155156
err := legacyQuerierCdc.UnmarshalJSON(req.Data, &params)
156157
if err != nil {
157158
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())

x/gov/keeper/querier_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/cosmos/cosmos-sdk/x/gov/keeper"
1717
"github.com/cosmos/cosmos-sdk/x/gov/types"
1818
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
19+
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2"
1920
)
2021

2122
const custom = "custom"
@@ -202,7 +203,7 @@ func TestQueries(t *testing.T) {
202203

203204
proposal2.TotalDeposit = proposal2.TotalDeposit.Add(deposit4.Amount...)
204205
proposal2.Status = v1beta1.StatusVotingPeriod
205-
proposal2.VotingEndTime = proposal2.VotingEndTime.Add(types.DefaultPeriod)
206+
proposal2.VotingEndTime = proposal2.VotingEndTime.Add(v1beta2.DefaultPeriod)
206207

207208
deposit5 := v1beta1.NewDeposit(proposal3.ProposalId, TestAddrs[1], depositParams.MinDeposit)
208209
depositer5, err := sdk.AccAddressFromBech32(deposit5.Depositor)
@@ -212,7 +213,7 @@ func TestQueries(t *testing.T) {
212213

213214
proposal3.TotalDeposit = proposal3.TotalDeposit.Add(deposit5.Amount...)
214215
proposal3.Status = v1beta1.StatusVotingPeriod
215-
proposal3.VotingEndTime = proposal3.VotingEndTime.Add(types.DefaultPeriod)
216+
proposal3.VotingEndTime = proposal3.VotingEndTime.Add(v1beta2.DefaultPeriod)
216217
// total deposit of TestAddrs[1] on proposal #3 is worth the proposal deposit + individual deposit
217218
deposit5.Amount = deposit5.Amount.Add(deposit3.Amount...)
218219

x/gov/simulation/genesis.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
sdk "github.com/cosmos/cosmos-sdk/types"
1212
"github.com/cosmos/cosmos-sdk/types/module"
1313
"github.com/cosmos/cosmos-sdk/types/simulation"
14-
"github.com/cosmos/cosmos-sdk/x/gov/types"
14+
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2"
1515
)
1616

1717
// Simulation parameter constants
@@ -94,17 +94,17 @@ func RandomizedGenState(simState *module.SimulationState) {
9494
func(r *rand.Rand) { veto = GenTallyParamsVeto(r) },
9595
)
9696

97-
govGenesis := types.NewGenesisState(
97+
govGenesis := v1beta2.NewGenesisState(
9898
startingProposalID,
99-
types.NewDepositParams(minDeposit, depositPeriod),
100-
types.NewVotingParams(votingPeriod),
101-
types.NewTallyParams(quorum, threshold, veto),
99+
v1beta2.NewDepositParams(minDeposit, depositPeriod),
100+
v1beta2.NewVotingParams(votingPeriod),
101+
v1beta2.NewTallyParams(quorum, threshold, veto),
102102
)
103103

104104
bz, err := json.MarshalIndent(&govGenesis, "", " ")
105105
if err != nil {
106106
panic(err)
107107
}
108108
fmt.Printf("Selected randomly generated governance parameters:\n%s\n", bz)
109-
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(govGenesis)
109+
simState.GenState[v1beta2.ModuleName] = simState.Cdc.MustMarshalJSON(govGenesis)
110110
}

x/gov/simulation/genesis_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/cosmos/cosmos-sdk/types/module"
1414
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
1515
"github.com/cosmos/cosmos-sdk/x/gov/simulation"
16-
"github.com/cosmos/cosmos-sdk/x/gov/types"
16+
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta2"
1717
)
1818

1919
// TestRandomizedGenState tests the normal scenario of applying RandomizedGenState.
@@ -37,8 +37,8 @@ func TestRandomizedGenState(t *testing.T) {
3737

3838
simulation.RandomizedGenState(&simState)
3939

40-
var govGenesis types.GenesisState
41-
simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &govGenesis)
40+
var govGenesis v1beta2.GenesisState
41+
simState.Cdc.MustUnmarshalJSON(simState.GenState[v1beta2.ModuleName], &govGenesis)
4242

4343
dec1, _ := sdk.NewDecFromStr("0.361000000000000000")
4444
dec2, _ := sdk.NewDecFromStr("0.512000000000000000")
@@ -51,9 +51,9 @@ func TestRandomizedGenState(t *testing.T) {
5151
require.Equal(t, dec2.String(), govGenesis.TallyParams.Threshold)
5252
require.Equal(t, dec3.String(), govGenesis.TallyParams.VetoThreshold)
5353
require.Equal(t, uint64(0x28), govGenesis.StartingProposalId)
54-
require.Equal(t, []*types.Deposit{}, govGenesis.Deposits)
55-
require.Equal(t, []*types.Vote{}, govGenesis.Votes)
56-
require.Equal(t, []*types.Proposal{}, govGenesis.Proposals)
54+
require.Equal(t, []*v1beta2.Deposit{}, govGenesis.Deposits)
55+
require.Equal(t, []*v1beta2.Vote{}, govGenesis.Votes)
56+
require.Equal(t, []*v1beta2.Proposal{}, govGenesis.Proposals)
5757
}
5858

5959
// TestRandomizedGenState tests abnormal scenarios of applying RandomizedGenState.

x/gov/types/codec.go x/gov/types/v1beta2/codec.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package types
1+
package v1beta2
22

33
import (
44
"github.com/cosmos/cosmos-sdk/codec"

x/gov/types/v1beta2/content.go

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package v1beta2
2+
3+
import sdk "github.com/cosmos/cosmos-sdk/types"
4+
5+
// Copied over from /x/gov/types/keys.go to avoid circular imports
6+
const (
7+
ModuleName = "gov"
8+
9+
RouterKey = ModuleName
10+
)
11+
12+
// Content defines an interface that a proposal must implement. It contains
13+
// information such as the title and description along with the type and routing
14+
// information for the appropriate handler to process the proposal. Content can
15+
// have additional fields, which will handled by a proposal's Handler.
16+
type Content interface {
17+
GetTitle() string
18+
GetDescription() string
19+
ProposalRoute() string
20+
ProposalType() string
21+
ValidateBasic() error
22+
String() string
23+
}
24+
25+
// Handler defines a function that handles a proposal after it has passed the
26+
// governance process.
27+
type Handler func(ctx sdk.Context, content Content) error

x/gov/types/deposit.go x/gov/types/v1beta2/deposit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package types
1+
package v1beta2
22

33
import (
44
"fmt"

x/gov/types/genesis.go x/gov/types/v1beta2/genesis.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package types
1+
package v1beta2
22

33
import (
44
"errors"

0 commit comments

Comments
 (0)