Skip to content

Commit

Permalink
chore: implement feedback of automerged prs (#16308)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt authored May 26, 2023
1 parent f851e18 commit 3608dab
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
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

0 comments on commit 3608dab

Please sign in to comment.