Skip to content

Commit

Permalink
feat: Add metadata field to proposal (#10989)
Browse files Browse the repository at this point in the history
## Description

Closes: #10490 




---

### 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)
  • Loading branch information
amaury1093 authored Jan 25, 2022
1 parent 1581289 commit 95e65fe
Show file tree
Hide file tree
Showing 27 changed files with 378 additions and 213 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [\#10748](https://github.com/cosmos/cosmos-sdk/pull/10748) Move legacy `x/gov` api to `v1beta1` directory.
* [\#10816](https://github.com/cosmos/cosmos-sdk/pull/10816) Reuse blocked addresses from the bank module. No need to pass them to distribution.
* [\#10852](https://github.com/cosmos/cosmos-sdk/pull/10852) Move `x/gov/types` to `x/gov/types/v1beta2`.
* [\#10868](https://github.com/cosmos/cosmos-sdk/pull/10868) The Gov keeper accepts now a mandatory last argument, the ServiceMsgRouter.
* [\#10868](https://github.com/cosmos/cosmos-sdk/pull/10868), [\#10989](https://github.com/cosmos/cosmos-sdk/pull/10989) The Gov keeper accepts now 2 more mandatory arguments, the ServiceMsgRouter and a maximum proposal metadata length.

### Client Breaking Changes

Expand Down
3 changes: 3 additions & 0 deletions proto/cosmos/gov/v1beta2/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ message Proposal {
repeated cosmos.base.v1beta1.Coin total_deposit = 7 [(gogoproto.nullable) = false];
google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true];
google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true];

// metadata is any arbitrary metadata attached to the proposal.
bytes metadata = 10;
}

// ProposalStatus enumerates the valid statuses of a proposal.
Expand Down
2 changes: 2 additions & 0 deletions proto/cosmos/gov/v1beta2/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ message MsgSubmitProposal {
repeated google.protobuf.Any messages = 1;
repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [(gogoproto.nullable) = false];
string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// metadata is any arbitrary metadata attached to the proposal.
bytes metadata = 4;
}

// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type.
Expand Down
3 changes: 2 additions & 1 deletion simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,10 @@ func NewSimApp(
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper))
govMaxMetadataLen := uint64(10000)
govKeeper := govkeeper.NewKeeper(
appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper,
&stakingKeeper, govRouter, app.msgSvcRouter,
&stakingKeeper, govRouter, app.msgSvcRouter, govMaxMetadataLen,
)

app.GovKeeper = *govKeeper.SetHooks(
Expand Down
2 changes: 1 addition & 1 deletion x/auth/middleware/tips_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (s *MWTestSuite) setupAcctsForTips(ctx sdk.Context) (sdk.Context, []testAcc
s.Require().NoError(err)

// Create dummy proposal for tipper to vote on.
prop, err := govtypes.NewProposal([]sdk.Msg{banktypes.NewMsgSend(accts[0].acc.GetAddress(), accts[0].acc.GetAddress(), initialRegens)}, 1, time.Now(), time.Now().Add(time.Hour))
prop, err := govtypes.NewProposal([]sdk.Msg{banktypes.NewMsgSend(accts[0].acc.GetAddress(), accts[0].acc.GetAddress(), initialRegens)}, 1, nil, time.Now(), time.Now().Add(time.Hour))
s.Require().NoError(err)
s.app.GovKeeper.SetProposal(ctx, prop)
s.app.GovKeeper.ActivateVotingPeriod(ctx, prop)
Expand Down
10 changes: 7 additions & 3 deletions x/gov/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func TestTickExpiredDepositPeriod(t *testing.T) {
[]sdk.Msg{mkTestLegacyContent(t)},
sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)},
addrs[0].String(),
nil,
)
require.NoError(t, err)

Expand Down Expand Up @@ -89,6 +90,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) {
[]sdk.Msg{mkTestLegacyContent(t)},
sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)},
addrs[0].String(),
nil,
)
require.NoError(t, err)

Expand All @@ -112,6 +114,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) {
[]sdk.Msg{mkTestLegacyContent(t)},
sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)},
addrs[0].String(),
nil,
)
require.NoError(t, err)

Expand Down Expand Up @@ -169,6 +172,7 @@ func TestTickPassedDepositPeriod(t *testing.T) {
[]sdk.Msg{mkTestLegacyContent(t)},
sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)},
addrs[0].String(),
nil,
)
require.NoError(t, err)

Expand Down Expand Up @@ -221,7 +225,7 @@ func TestTickPassedVotingPeriod(t *testing.T) {
activeQueue.Close()

proposalCoins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, app.StakingKeeper.TokensFromConsensusPower(ctx, 5))}
newProposalMsg, err := v1beta2.NewMsgSubmitProposal([]sdk.Msg{mkTestLegacyContent(t)}, proposalCoins, addrs[0].String())
newProposalMsg, err := v1beta2.NewMsgSubmitProposal([]sdk.Msg{mkTestLegacyContent(t)}, proposalCoins, addrs[0].String(), nil)
require.NoError(t, err)

wrapCtx := sdk.WrapSDKContext(ctx)
Expand Down Expand Up @@ -289,7 +293,7 @@ func TestProposalPassedEndblocker(t *testing.T) {
require.NotNil(t, macc)
initialModuleAccCoins := app.BankKeeper.GetAllBalances(ctx, macc.GetAddress())

proposal, err := app.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)})
proposal, err := app.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, nil)
require.NoError(t, err)

proposalCoins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, app.StakingKeeper.TokensFromConsensusPower(ctx, 10))}
Expand Down Expand Up @@ -339,7 +343,7 @@ func TestEndBlockerProposalHandlerFailed(t *testing.T) {
// Create a proposal where the handler will pass for the test proposal
// because the value of contextKeyBadProposal is true.
ctx = ctx.WithValue(contextKeyBadProposal, true)
proposal, err := app.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)})
proposal, err := app.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, nil)
require.NoError(t, err)

proposalCoins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, app.StakingKeeper.TokensFromConsensusPower(ctx, 10)))
Expand Down
16 changes: 8 additions & 8 deletions x/gov/client/utils/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func QueryDepositsByTxQuery(clientCtx client.Context, params v1beta2.QueryPropos
clientCtx, defaultPage,
// Query legacy Msgs event action
[]string{
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta2.TypeMsgDeposit),
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgDeposit),
fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalDeposit, types.AttributeKeyProposalID, params.ProposalID),
},
// Query proto Msgs event action v1beta1
Expand Down Expand Up @@ -119,7 +119,7 @@ func QueryVotesByTxQuery(clientCtx client.Context, params v1beta2.QueryProposalV
clientCtx, nextTxPage,
// Query legacy Vote Msgs
[]string{
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta2.TypeMsgVote),
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgVote),
fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalVote, types.AttributeKeyProposalID, params.ProposalID),
},
// Query Vote proto Msgs v1beta1
Expand All @@ -134,7 +134,7 @@ func QueryVotesByTxQuery(clientCtx client.Context, params v1beta2.QueryProposalV
},
// Query legacy VoteWeighted Msgs
[]string{
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta2.TypeMsgVoteWeighted),
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgVoteWeighted),
fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalVote, types.AttributeKeyProposalID, params.ProposalID),
},
// Query VoteWeighted proto Msgs v1beta1
Expand Down Expand Up @@ -210,7 +210,7 @@ func QueryVoteByTxQuery(clientCtx client.Context, params v1beta2.QueryVoteParams
clientCtx, defaultPage,
// Query legacy Vote Msgs
[]string{
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta2.TypeMsgVote),
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgVote),
fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalVote, types.AttributeKeyProposalID, params.ProposalID),
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeySender, params.Voter),
},
Expand All @@ -228,7 +228,7 @@ func QueryVoteByTxQuery(clientCtx client.Context, params v1beta2.QueryVoteParams
},
// Query legacy VoteWeighted Msgs
[]string{
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta2.TypeMsgVoteWeighted),
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgVoteWeighted),
fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalVote, types.AttributeKeyProposalID, params.ProposalID),
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeySender, params.Voter.String()),
},
Expand Down Expand Up @@ -318,7 +318,7 @@ func QueryDepositByTxQuery(clientCtx client.Context, params v1beta2.QueryDeposit
clientCtx, defaultPage,
// Query legacy Msgs event action
[]string{
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta2.TypeMsgDeposit),
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgDeposit),
fmt.Sprintf("%s.%s='%d'", types.EventTypeProposalDeposit, types.AttributeKeyProposalID, params.ProposalID),
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeySender, params.Depositor.String()),
},
Expand Down Expand Up @@ -385,7 +385,7 @@ func QueryProposerByTxQuery(clientCtx client.Context, proposalID uint64) (Propos
defaultPage,
// Query legacy Msgs event action
[]string{
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta2.TypeMsgSubmitProposal),
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgSubmitProposal),
fmt.Sprintf("%s.%s='%d'", types.EventTypeSubmitProposal, types.AttributeKeyProposalID, proposalID),
},
// Query proto Msgs event action v1beta1
Expand Down Expand Up @@ -463,7 +463,7 @@ func queryInitialDepositByTxQuery(clientCtx client.Context, proposalID uint64) (
clientCtx, defaultPage,
// Query legacy Msgs event action
[]string{
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta2.TypeMsgSubmitProposal),
fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, v1beta1.TypeMsgSubmitProposal),
fmt.Sprintf("%s.%s='%d'", types.EventTypeSubmitProposal, types.AttributeKeyProposalID, proposalID),
},
// Query proto Msgs event action v1beta1
Expand Down
4 changes: 2 additions & 2 deletions x/gov/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ func TestImportExportQueues(t *testing.T) {

ctx = app.BaseApp.NewContext(false, tmproto.Header{})
// Create two proposals, put the second into the voting period
proposal1, err := app.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)})
proposal1, err := app.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, nil)
require.NoError(t, err)
proposalID1 := proposal1.ProposalId

proposal2, err := app.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)})
proposal2, err := app.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, nil)
require.NoError(t, err)
proposalID2 := proposal2.ProposalId

Expand Down
4 changes: 2 additions & 2 deletions x/gov/keeper/deposit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestDeposits(t *testing.T) {
TestAddrs := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(10000000))

tp := TestProposal
proposal, err := app.GovKeeper.SubmitProposal(ctx, tp)
proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, nil)
require.NoError(t, err)
proposalID := proposal.ProposalId

Expand Down Expand Up @@ -101,7 +101,7 @@ func TestDeposits(t *testing.T) {
require.Equal(t, addr1Initial, app.BankKeeper.GetAllBalances(ctx, TestAddrs[1]))

// Test delete and burn deposits
proposal, err = app.GovKeeper.SubmitProposal(ctx, tp)
proposal, err = app.GovKeeper.SubmitProposal(ctx, tp, nil)
require.NoError(t, err)
proposalID = proposal.ProposalId
_, err = app.GovKeeper.AddDeposit(ctx, proposalID, TestAddrs[0], fourStake)
Expand Down
14 changes: 7 additions & 7 deletions x/gov/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposal() {
testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal")
msgContent, err := v1beta2.NewLegacyContent(testProposal, govAcct.String())
suite.Require().NoError(err)
submittedProposal, err := app.GovKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent})
submittedProposal, err := app.GovKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, nil)
suite.Require().NoError(err)
suite.Require().NotEmpty(submittedProposal)

Expand Down Expand Up @@ -116,7 +116,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() {
testProposal := []sdk.Msg{
v1beta2.NewMsgVote(govAddress, uint64(i), v1beta2.OptionYes),
}
proposal, err := app.GovKeeper.SubmitProposal(ctx, testProposal)
proposal, err := app.GovKeeper.SubmitProposal(ctx, testProposal, nil)
suite.Require().NotEmpty(proposal)
suite.Require().NoError(err)
testProposals = append(testProposals, &proposal)
Expand Down Expand Up @@ -291,7 +291,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVote() {
"no votes present",
func() {
var err error
proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal)
proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal, nil)
suite.Require().NoError(err)

req = &v1beta2.QueryVoteRequest{
Expand Down Expand Up @@ -396,7 +396,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVotes() {
"create a proposal and get votes",
func() {
var err error
proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal)
proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal, nil)
suite.Require().NoError(err)

req = &v1beta2.QueryVotesRequest{
Expand Down Expand Up @@ -588,7 +588,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposit() {
"no deposits proposal",
func() {
var err error
proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal)
proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal, nil)
suite.Require().NoError(err)
suite.Require().NotNil(proposal)

Expand Down Expand Up @@ -677,7 +677,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposits() {
"create a proposal and get deposits",
func() {
var err error
proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal)
proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal, nil)
suite.Require().NoError(err)

req = &v1beta2.QueryDepositsRequest{
Expand Down Expand Up @@ -769,7 +769,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryTally() {
"create a proposal and get tally",
func() {
var err error
proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal)
proposal, err = app.GovKeeper.SubmitProposal(ctx, TestProposal, nil)
suite.Require().NoError(err)
suite.Require().NotNil(proposal)

Expand Down
4 changes: 2 additions & 2 deletions x/gov/keeper/hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestHooks(t *testing.T) {
require.False(t, govHooksReceiver.AfterProposalVotingPeriodEndedValid)

tp := TestProposal
_, err := app.GovKeeper.SubmitProposal(ctx, tp)
_, err := app.GovKeeper.SubmitProposal(ctx, tp, nil)
require.NoError(t, err)
require.True(t, govHooksReceiver.AfterProposalSubmissionValid)

Expand All @@ -75,7 +75,7 @@ func TestHooks(t *testing.T) {

require.True(t, govHooksReceiver.AfterProposalFailedMinDepositValid)

p2, err := app.GovKeeper.SubmitProposal(ctx, tp)
p2, err := app.GovKeeper.SubmitProposal(ctx, tp, nil)
require.NoError(t, err)

activated, err := app.GovKeeper.AddDeposit(ctx, p2.ProposalId, addrs[0], minDeposit)
Expand Down
21 changes: 13 additions & 8 deletions x/gov/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ type Keeper struct {

// Msg server router
router *middleware.MsgServiceRouter

// maxMetadataLen defines the maximum proposal metadata length.
maxMetadataLen uint64
}

// NewKeeper returns a governance keeper. It handles:
Expand All @@ -54,6 +57,7 @@ func NewKeeper(
cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace types.ParamSubspace,
authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, sk types.StakingKeeper,
legacyRouter v1beta1.Router, router *middleware.MsgServiceRouter,
maxMetadataLen uint64,
) Keeper {

// ensure governance module account is set
Expand All @@ -67,14 +71,15 @@ func NewKeeper(
legacyRouter.Seal()

return Keeper{
storeKey: key,
paramSpace: paramSpace,
authKeeper: authKeeper,
bankKeeper: bankKeeper,
sk: sk,
cdc: cdc,
legacyRouter: legacyRouter,
router: router,
storeKey: key,
paramSpace: paramSpace,
authKeeper: authKeeper,
bankKeeper: bankKeeper,
sk: sk,
cdc: cdc,
legacyRouter: legacyRouter,
router: router,
maxMetadataLen: maxMetadataLen,
}
}

Expand Down
14 changes: 7 additions & 7 deletions x/gov/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ func TestIncrementProposalNumber(t *testing.T) {
ctx := app.BaseApp.NewContext(false, tmproto.Header{})

tp := TestProposal
_, err := app.GovKeeper.SubmitProposal(ctx, tp)
_, err := app.GovKeeper.SubmitProposal(ctx, tp, nil)
require.NoError(t, err)
_, err = app.GovKeeper.SubmitProposal(ctx, tp)
_, err = app.GovKeeper.SubmitProposal(ctx, tp, nil)
require.NoError(t, err)
_, err = app.GovKeeper.SubmitProposal(ctx, tp)
_, err = app.GovKeeper.SubmitProposal(ctx, tp, nil)
require.NoError(t, err)
_, err = app.GovKeeper.SubmitProposal(ctx, tp)
_, err = app.GovKeeper.SubmitProposal(ctx, tp, nil)
require.NoError(t, err)
_, err = app.GovKeeper.SubmitProposal(ctx, tp)
_, err = app.GovKeeper.SubmitProposal(ctx, tp, nil)
require.NoError(t, err)
proposal6, err := app.GovKeeper.SubmitProposal(ctx, tp)
proposal6, err := app.GovKeeper.SubmitProposal(ctx, tp, nil)
require.NoError(t, err)

require.Equal(t, uint64(6), proposal6.ProposalId)
Expand All @@ -73,7 +73,7 @@ func TestProposalQueues(t *testing.T) {

// create test proposals
tp := TestProposal
proposal, err := app.GovKeeper.SubmitProposal(ctx, tp)
proposal, err := app.GovKeeper.SubmitProposal(ctx, tp, nil)
require.NoError(t, err)

inactiveIterator := app.GovKeeper.InactiveProposalQueueIterator(ctx, *proposal.DepositEndTime)
Expand Down
3 changes: 2 additions & 1 deletion x/gov/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1beta2.MsgSubmitP
return nil, err
}

proposal, err := k.Keeper.SubmitProposal(ctx, proposalMsgs)
proposal, err := k.Keeper.SubmitProposal(ctx, proposalMsgs, msg.Metadata)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -230,6 +230,7 @@ func (k legacyMsgServer) SubmitProposal(goCtx context.Context, msg *v1beta1.MsgS
[]sdk.Msg{contentMsg},
msg.InitialDeposit,
msg.Proposer,
nil,
)
if err != nil {
return nil, err
Expand Down
Loading

0 comments on commit 95e65fe

Please sign in to comment.