Skip to content

Commit

Permalink
feat: Add metadata field to Vote in x/gov (#11308)
Browse files Browse the repository at this point in the history
## Description

Closes: #11268 

Add metadata to Vote in x/gov using the existing maxMetadataLen constraint.

---

### 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
likhita-809 authored Mar 3, 2022
1 parent 8296ad9 commit 918330b
Show file tree
Hide file tree
Showing 27 changed files with 810 additions and 365 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Features

* [\#11308](https://github.com/cosmos/cosmos-sdk/pull/11308) Added a mandatory metadata field to Vote in x/gov v1beta2.
* [\#10977](https://github.com/cosmos/cosmos-sdk/pull/10977) Now every cosmos message protobuf definition must be extended with a ``cosmos.msg.v1.signer`` option to signal the signer fields in a language agnostic way.
* [\#10710](https://github.com/cosmos/cosmos-sdk/pull/10710) Chain-id shouldn't be required for creating a transaction with both --generate-only and --offline flags.
* [\#10703](https://github.com/cosmos/cosmos-sdk/pull/10703) Create a new grantee account, if the grantee of an authorization does not exist.
Expand Down
217 changes: 146 additions & 71 deletions api/cosmos/gov/v1beta2/gov.pulsar.go

Large diffs are not rendered by default.

294 changes: 221 additions & 73 deletions api/cosmos/gov/v1beta2/tx.pulsar.go

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions proto/cosmos/gov/v1beta2/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ message Vote {
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
reserved 3;
repeated WeightedVoteOption options = 4;

// metadata is any arbitrary metadata to attached to the vote.
string metadata = 5;
}

// DepositParams defines the params for deposits on governance proposals.
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 @@ -68,6 +68,7 @@ message MsgVote {
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
VoteOption option = 3;
string metadata = 4;
}

// MsgVoteResponse defines the Msg/Vote response type.
Expand All @@ -80,6 +81,7 @@ message MsgVoteWeighted {
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated WeightedVoteOption options = 3;
string metadata = 4;
}

// MsgVoteWeightedResponse defines the Msg/VoteWeighted response type.
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 @@ -93,7 +93,7 @@ func (s *MWTestSuite) TestTips() {
ctx, accts := s.setupAcctsForTips(ctx)
tipper, feePayer := accts[0], accts[1]

msg = govtypes.NewMsgVote(tipper.acc.GetAddress(), 1, govtypes.OptionYes)
msg = govtypes.NewMsgVote(tipper.acc.GetAddress(), 1, govtypes.OptionYes, "")

auxSignerData := s.mkTipperAuxSignerData(tipper.priv, msg, tc.tip, signing.SignMode_SIGN_MODE_DIRECT_AUX, tipper.accNum, 0, ctx.ChainID())
feePayerTxBuilder := s.mkFeePayerTxBuilder(s.clientCtx, auxSignerData, feePayer.priv, signing.SignMode_SIGN_MODE_DIRECT, tx.Fee{Amount: tc.fee, GasLimit: tc.gasLimit}, feePayer.accNum, 0, ctx.ChainID())
Expand Down
4 changes: 2 additions & 2 deletions x/gov/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func TestProposalPassedEndblocker(t *testing.T) {
deposits := initialModuleAccCoins.Add(proposal.TotalDeposit...).Add(proposalCoins...)
require.True(t, moduleAccCoins.IsEqual(deposits))

err = app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
err = app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
require.NoError(t, err)

newHeader := ctx.BlockHeader()
Expand Down Expand Up @@ -354,7 +354,7 @@ func TestEndBlockerProposalHandlerFailed(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, res)

err = app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
err = app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
require.NoError(t, err)

newHeader := ctx.BlockHeader()
Expand Down
17 changes: 15 additions & 2 deletions x/gov/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const (
flagVoter = "voter"
flagDepositor = "depositor"
flagStatus = "status"
flagMetadata = "metadata"
// Deprecated: only used for v1beta1 legacy proposals.
FlagProposal = "proposal"
)
Expand Down Expand Up @@ -282,13 +283,19 @@ $ %s tx gov vote 1 yes --from mykey
return err
}

metadata, err := cmd.Flags().GetString(flagMetadata)
if err != nil {
return err
}

// Build vote message and run basic validation
msg := v1beta2.NewMsgVote(from, proposalID, byteVoteOption)
msg := v1beta2.NewMsgVote(from, proposalID, byteVoteOption, metadata)

return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}

cmd.Flags().String(flagMetadata, "", "Specify metadata of the vote")
flags.AddTxFlagsToCmd(cmd)

return cmd
Expand Down Expand Up @@ -331,12 +338,18 @@ $ %s tx gov weighted-vote 1 yes=0.6,no=0.3,abstain=0.05,no_with_veto=0.05 --from
return err
}

metadata, err := cmd.Flags().GetString(flagMetadata)
if err != nil {
return err
}

// Build vote message and run basic validation
msg := v1beta2.NewMsgVoteWeighted(from, proposalID, options)
msg := v1beta2.NewMsgVoteWeighted(from, proposalID, options, metadata)
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}

cmd.Flags().String(flagMetadata, "", "Specify metadata of the weighted vote")
flags.AddTxFlagsToCmd(cmd)

return cmd
Expand Down
27 changes: 27 additions & 0 deletions x/gov/client/testutil/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ func (s *IntegrationTestSuite) TestNewCmdVote() {
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
fmt.Sprintf("--metadata=%s", "AQ=="),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
},
false, 2,
Expand All @@ -895,6 +896,19 @@ func (s *IntegrationTestSuite) TestNewCmdVote() {
},
false, 0,
},
{
"valid vote with metadata",
[]string{
"1",
"yes",
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
fmt.Sprintf("--metadata=%s", "AQ=="),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
},
false, 0,
},
}

for _, tc := range testCases {
Expand Down Expand Up @@ -955,6 +969,19 @@ func (s *IntegrationTestSuite) TestNewCmdWeightedVote() {
},
false, 0,
},
{
"valid vote with metadata",
[]string{
"1",
"yes",
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
fmt.Sprintf("--metadata=%s", "AQ=="),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
},
false, 0,
},
{
"invalid valid split vote string",
[]string{
Expand Down
22 changes: 11 additions & 11 deletions x/gov/client/utils/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ func TestGetPaginatedVotes(t *testing.T) {
acc2 := make(sdk.AccAddress, 20)
acc2[0] = 2
acc1Msgs := []sdk.Msg{
v1beta2.NewMsgVote(acc1, 0, v1beta2.OptionYes),
v1beta2.NewMsgVote(acc1, 0, v1beta2.OptionYes),
v1beta2.NewMsgVote(acc1, 0, v1beta2.OptionYes, ""),
v1beta2.NewMsgVote(acc1, 0, v1beta2.OptionYes, ""),
}
acc2Msgs := []sdk.Msg{
v1beta2.NewMsgVote(acc2, 0, v1beta2.OptionYes),
v1beta2.NewMsgVoteWeighted(acc2, 0, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)),
v1beta2.NewMsgVote(acc2, 0, v1beta2.OptionYes, ""),
v1beta2.NewMsgVoteWeighted(acc2, 0, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""),
}
for _, tc := range []testCase{
{
Expand All @@ -105,8 +105,8 @@ func TestGetPaginatedVotes(t *testing.T) {
acc2Msgs[:1],
},
votes: []v1beta2.Vote{
v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)),
v1beta2.NewVote(0, acc2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))},
v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""),
v1beta2.NewVote(0, acc2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")},
},
{
description: "2MsgPerTx1Chunk",
Expand All @@ -117,8 +117,8 @@ func TestGetPaginatedVotes(t *testing.T) {
acc2Msgs,
},
votes: []v1beta2.Vote{
v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)),
v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)),
v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""),
v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""),
},
},
{
Expand All @@ -130,8 +130,8 @@ func TestGetPaginatedVotes(t *testing.T) {
acc2Msgs,
},
votes: []v1beta2.Vote{
v1beta2.NewVote(0, acc2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)),
v1beta2.NewVote(0, acc2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)),
v1beta2.NewVote(0, acc2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""),
v1beta2.NewVote(0, acc2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""),
},
},
{
Expand All @@ -141,7 +141,7 @@ func TestGetPaginatedVotes(t *testing.T) {
msgs: [][]sdk.Msg{
acc1Msgs[:1],
},
votes: []v1beta2.Vote{v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))},
votes: []v1beta2.Vote{v1beta2.NewVote(0, acc1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")},
},
{
description: "InvalidPage",
Expand Down
20 changes: 10 additions & 10 deletions x/gov/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() {
for i := 0; i < 5; i++ {
govAddress := app.GovKeeper.GetGovernanceAccount(suite.ctx).GetAddress()
testProposal := []sdk.Msg{
v1beta2.NewMsgVote(govAddress, uint64(i), v1beta2.OptionYes),
v1beta2.NewMsgVote(govAddress, uint64(i), v1beta2.OptionYes, ""),
}
proposal, err := app.GovKeeper.SubmitProposal(ctx, testProposal, "")
suite.Require().NotEmpty(proposal)
Expand Down Expand Up @@ -269,7 +269,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() {
func() {
testProposals[1].Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, *testProposals[1])
suite.Require().NoError(app.GovKeeper.AddVote(ctx, testProposals[1].Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain)))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, testProposals[1].Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain), ""))

req = &v1beta2.QueryProposalsRequest{
Voter: addrs[0].String(),
Expand Down Expand Up @@ -384,7 +384,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVote() {
func() {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain)))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain), ""))

req = &v1beta2.QueryVoteRequest{
ProposalId: proposal.Id,
Expand Down Expand Up @@ -495,8 +495,8 @@ func (suite *KeeperTestSuite) TestGRPCQueryVotes() {
accAddr2, err2 := sdk.AccAddressFromBech32(votes[1].Voter)
suite.Require().NoError(err1)
suite.Require().NoError(err2)
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr1, votes[0].Options))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr2, votes[1].Options))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr1, votes[0].Options, ""))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr2, votes[1].Options, ""))

req = &v1beta2.QueryVotesRequest{
ProposalId: proposal.Id,
Expand Down Expand Up @@ -596,8 +596,8 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryVotes() {
accAddr2, err2 := sdk.AccAddressFromBech32(votes[1].Voter)
suite.Require().NoError(err1)
suite.Require().NoError(err2)
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain)))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionAbstain), ""))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, accAddr2, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))

req = &v1beta1.QueryVotesRequest{
ProposalId: proposal.Id,
Expand Down Expand Up @@ -1055,9 +1055,9 @@ func (suite *KeeperTestSuite) TestGRPCQueryTally() {
proposal.Status = v1beta2.StatusVotingPeriod
app.GovKeeper.SetProposal(ctx, proposal)

suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes)))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))
suite.Require().NoError(app.GovKeeper.AddVote(ctx, proposal.Id, addrs[2], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), ""))

req = &v1beta2.QueryTallyResultRequest{ProposalId: proposal.Id}

Expand Down
2 changes: 1 addition & 1 deletion x/gov/keeper/hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestHooks(t *testing.T) {
require.NoError(t, err)
require.True(t, govHooksReceiver.AfterProposalDepositValid)

err = app.GovKeeper.AddVote(ctx, p2.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
err = app.GovKeeper.AddVote(ctx, p2.Id, addrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
require.NoError(t, err)
require.True(t, govHooksReceiver.AfterProposalVoteValid)

Expand Down
9 changes: 9 additions & 0 deletions x/gov/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,12 @@ func (keeper Keeper) InactiveProposalQueueIterator(ctx sdk.Context, endTime time
store := ctx.KVStore(keeper.storeKey)
return store.Iterator(types.InactiveProposalQueuePrefix, sdk.PrefixEndBytes(types.InactiveProposalByTimeKey(endTime)))
}

// assertMetadataLength returns an error if given metadata length
// is greater than a pre-defined maxMetadataLen.
func (k Keeper) assertMetadataLength(metadata string) error {
if metadata != "" && uint64(len(metadata)) > k.config.MaxMetadataLen {
return types.ErrMetadataTooLong.Wrapf("got metadata with length %d", len(metadata))
}
return nil
}
4 changes: 2 additions & 2 deletions x/gov/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (k msgServer) Vote(goCtx context.Context, msg *v1beta2.MsgVote) (*v1beta2.M
if accErr != nil {
return nil, accErr
}
err := k.Keeper.AddVote(ctx, msg.ProposalId, accAddr, v1beta2.NewNonSplitVoteOption(msg.Option))
err := k.Keeper.AddVote(ctx, msg.ProposalId, accAddr, v1beta2.NewNonSplitVoteOption(msg.Option), msg.Metadata)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -144,7 +144,7 @@ func (k msgServer) VoteWeighted(goCtx context.Context, msg *v1beta2.MsgVoteWeigh
if accErr != nil {
return nil, accErr
}
err := k.Keeper.AddVote(ctx, msg.ProposalId, accAddr, msg.Options)
err := k.Keeper.AddVote(ctx, msg.ProposalId, accAddr, msg.Options, msg.Metadata)
if err != nil {
return nil, err
}
Expand Down
5 changes: 3 additions & 2 deletions x/gov/keeper/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import (

// SubmitProposal create new proposal given an array of messages
func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadata string) (v1beta2.Proposal, error) {
if metadata != "" && uint64(len(metadata)) > keeper.config.MaxMetadataLen {
return v1beta2.Proposal{}, types.ErrMetadataTooLong.Wrapf("got metadata with length %d", len(metadata))
err := keeper.assertMetadataLength(metadata)
if err != nil {
return v1beta2.Proposal{}, err
}

// Will hold a comma-separated string of all Msg type URLs.
Expand Down
2 changes: 1 addition & 1 deletion x/gov/keeper/proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (suite *KeeperTestSuite) TestGetProposalsFiltered() {

if i%2 == 0 {
d := v1beta2.NewDeposit(proposalID, addr1, nil)
v := v1beta2.NewVote(proposalID, addr1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
v := v1beta2.NewVote(proposalID, addr1, v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
suite.app.GovKeeper.SetDeposit(suite.ctx, d)
suite.app.GovKeeper.SetVote(suite.ctx, v)
}
Expand Down
6 changes: 3 additions & 3 deletions x/gov/keeper/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,13 @@ func TestQueries(t *testing.T) {
checkEqualProposal(t, proposal3, *proposals[1])

// Addrs[0] votes on proposals #2 & #3
vote1 := v1beta2.NewVote(proposal2.Id, TestAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
vote2 := v1beta2.NewVote(proposal3.Id, TestAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
vote1 := v1beta2.NewVote(proposal2.Id, TestAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
vote2 := v1beta2.NewVote(proposal3.Id, TestAddrs[0], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
app.GovKeeper.SetVote(ctx, vote1)
app.GovKeeper.SetVote(ctx, vote2)

// Addrs[1] votes on proposal #3
vote3 := v1beta2.NewVote(proposal3.Id, TestAddrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes))
vote3 := v1beta2.NewVote(proposal3.Id, TestAddrs[1], v1beta2.NewNonSplitVoteOption(v1beta2.OptionYes), "")
app.GovKeeper.SetVote(ctx, vote3)

// Test query voted by TestAddrs[0]
Expand Down
Loading

0 comments on commit 918330b

Please sign in to comment.