Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: implement feedback of automerged prs #16308

Merged
merged 2 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/cosmos/group/v1/events.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions x/gov/keeper/proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ func (suite *KeeperTestSuite) TestActivateVotingPeriod() {
suite.Require().True(proposal.VotingStartTime.Equal(suite.ctx.BlockHeader().Time))

has, err := suite.govKeeper.ActiveProposalsQueue.Has(suite.ctx, collections.Join(*proposal.VotingEndTime, proposal.Id))
require.NoError(suite.T(), err)
require.True(suite.T(), has)
require.NoError(suite.T(), suite.govKeeper.DeleteProposal(suite.ctx, proposal.Id))
suite.Require().NoError(err)
suite.Require().True(has)
suite.Require().NoError(suite.govKeeper.DeleteProposal(suite.ctx, proposal.Id))
}
}

Expand All @@ -111,22 +111,22 @@ func (suite *KeeperTestSuite) TestDeleteProposalInVotingPeriod() {
suite.Require().NoError(err)
suite.Require().Nil(proposal.VotingStartTime)

require.NoError(suite.T(), suite.govKeeper.ActivateVotingPeriod(suite.ctx, proposal))
suite.Require().NoError(suite.govKeeper.ActivateVotingPeriod(suite.ctx, proposal))

proposal, err = suite.govKeeper.Proposals.Get(suite.ctx, proposal.Id)
suite.Require().Nil(err)
suite.Require().True(proposal.VotingStartTime.Equal(suite.ctx.BlockHeader().Time))

has, err := suite.govKeeper.ActiveProposalsQueue.Has(suite.ctx, collections.Join(*proposal.VotingEndTime, proposal.Id))
require.NoError(suite.T(), err)
require.True(suite.T(), has)
suite.Require().NoError(err)
suite.Require().True(has)

// add vote
voteOptions := []*v1.WeightedVoteOption{{Option: v1.OptionYes, Weight: "1.0"}}
err = suite.govKeeper.AddVote(suite.ctx, proposal.Id, suite.addrs[0], voteOptions, "")
suite.Require().NoError(err)

require.NoError(suite.T(), suite.govKeeper.DeleteProposal(suite.ctx, proposal.Id))
suite.Require().NoError(suite.govKeeper.DeleteProposal(suite.ctx, proposal.Id))

// add vote but proposal is deleted along with its VotingPeriodProposalKey
err = suite.govKeeper.AddVote(suite.ctx, proposal.Id, suite.addrs[0], voteOptions, "")
Expand Down
4 changes: 2 additions & 2 deletions x/group/events.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions x/group/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
)

var EventTallyResult = "cosmos.group.v1.EventProposalPruned"
var EventProposalPruned = "cosmos.group.v1.EventProposalPruned"

func (s *TestSuite) TestCreateGroupWithLotsOfMembers() {
for i := 50; i < 70; i++ {
Expand Down Expand Up @@ -1834,7 +1834,7 @@ func (s *TestSuite) TestSubmitProposal() {
toBalances := s.bankKeeper.GetAllBalances(sdkCtx, addr2)
s.Require().Contains(toBalances, sdk.NewInt64Coin("test", 100))
events := sdkCtx.EventManager().ABCIEvents()
s.Require().True(eventTypeFound(events, EventTallyResult))
s.Require().True(eventTypeFound(events, EventProposalPruned))
},
},
"with try exec, not enough yes votes for proposal to pass": {
Expand Down Expand Up @@ -1983,7 +1983,7 @@ func (s *TestSuite) TestWithdrawProposal() {
s.Require().NoError(s.groupKeeper.TallyProposalsAtVPEnd(ctxVPE))
events := ctxVPE.EventManager().ABCIEvents()

s.Require().True(eventTypeFound(events, EventTallyResult))
s.Require().True(eventTypeFound(events, EventProposalPruned))
},
},
}
Expand Down Expand Up @@ -2549,7 +2549,7 @@ func (s *TestSuite) TestExecProposal() {
expToBalances: sdk.NewInt64Coin("test", 100),
postRun: func(sdkCtx sdk.Context) {
events := sdkCtx.EventManager().ABCIEvents()
s.Require().True(eventTypeFound(events, EventTallyResult))
s.Require().True(eventTypeFound(events, EventProposalPruned))
},
},
"proposal with multiple messages executed when accepted": {
Expand All @@ -2567,7 +2567,7 @@ func (s *TestSuite) TestExecProposal() {
expToBalances: sdk.NewInt64Coin("test", 200),
postRun: func(sdkCtx sdk.Context) {
events := sdkCtx.EventManager().ABCIEvents()
s.Require().True(eventTypeFound(events, EventTallyResult))
s.Require().True(eventTypeFound(events, EventProposalPruned))
},
},
"proposal not executed when rejected": {
Expand All @@ -2580,7 +2580,7 @@ func (s *TestSuite) TestExecProposal() {
expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN,
postRun: func(sdkCtx sdk.Context) {
events := sdkCtx.EventManager().ABCIEvents()
s.Require().False(eventTypeFound(events, EventTallyResult))
s.Require().False(eventTypeFound(events, EventProposalPruned))
},
},
"open proposal must not fail": {
Expand All @@ -2591,7 +2591,7 @@ func (s *TestSuite) TestExecProposal() {
expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN,
postRun: func(sdkCtx sdk.Context) {
events := sdkCtx.EventManager().ABCIEvents()
s.Require().False(eventTypeFound(events, EventTallyResult))
s.Require().False(eventTypeFound(events, EventProposalPruned))
},
},
"invalid proposal id": {
Expand Down Expand Up @@ -2649,7 +2649,7 @@ func (s *TestSuite) TestExecProposal() {
expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_SUCCESS,
postRun: func(sdkCtx sdk.Context) {
events := sdkCtx.EventManager().ABCIEvents()
s.Require().True(eventTypeFound(events, EventTallyResult))
s.Require().True(eventTypeFound(events, EventProposalPruned))
},
},
"prevent double execution when successful": {
Expand Down Expand Up @@ -2939,7 +2939,7 @@ func (s *TestSuite) TestExecPrunedProposalsAndVotes() {
s.Require().NoError(err)
s.Require().Empty(res.GetVotes())
events := sdkCtx.EventManager().ABCIEvents()
s.Require().True(eventTypeFound(events, EventTallyResult))
s.Require().True(eventTypeFound(events, EventProposalPruned))

} else {
// Check that proposal and votes exists
Expand Down