diff --git a/x/coredaos/keeper/msg_server.go b/x/coredaos/keeper/msg_server.go index 1ae01216..ea7e1d8e 100644 --- a/x/coredaos/keeper/msg_server.go +++ b/x/coredaos/keeper/msg_server.go @@ -379,9 +379,12 @@ func (ms MsgServer) VetoProposal(goCtx context.Context, msg *types.MsgVetoPropos } proposal.Status = govtypesv1.StatusVetoed - // Since the proposal is veoted, we set the final tally result to an empty tally. + // Since the proposal is veoted, we set the final tally result to an empty tally + // and the voting period ends immediately emptyTally := govtypesv1.EmptyTallyResult() proposal.FinalTallyResult = &emptyTally + blockTime := ctx.BlockTime() + proposal.VotingEndTime = &blockTime ms.k.govKeeper.SetProposal(ctx, proposal) ms.k.govKeeper.DeleteVotes(ctx, proposal.Id) diff --git a/x/coredaos/keeper/msg_server_test.go b/x/coredaos/keeper/msg_server_test.go index 1411026a..d305a68e 100644 --- a/x/coredaos/keeper/msg_server_test.go +++ b/x/coredaos/keeper/msg_server_test.go @@ -686,7 +686,7 @@ func TestMsgServerVetoProposal(t *testing.T) { Id: 1, Status: govtypesv1.StatusVetoed, FinalTallyResult: &emptyTally, - VotingEndTime: &votingEndTime, + VotingEndTime: &votingEndTime, // will be overwritten in the test } depositPeriodProposal := govtypesv1.Proposal{ Title: "Test Proposal", @@ -751,6 +751,11 @@ func TestMsgServerVetoProposal(t *testing.T) { ProposalId: 1, }, setupMocks: func(ctx sdk.Context, m *testutil.Mocks) { + // ensure proposalWithVeto has the correct VotingEndTime set + // can only do it here because ctx is needed + votingEndTime := ctx.BlockTime() + proposalWithVeto.VotingEndTime = &votingEndTime + call1 := m.GovKeeper.EXPECT().GetProposal(ctx, uint64(1)).Return(votingPeriodProposal, true) m.GovKeeper.EXPECT().RefundAndDeleteDeposits(ctx, uint64(1)).After(call1) m.GovKeeper.EXPECT().SetProposal(ctx, proposalWithVeto).After(call1) @@ -769,6 +774,11 @@ func TestMsgServerVetoProposal(t *testing.T) { BurnDeposit: true, }, setupMocks: func(ctx sdk.Context, m *testutil.Mocks) { + // ensure proposalWithVeto has the correct VotingEndTime set + // can only do it here because ctx is needed + votingEndTime := ctx.BlockTime() + proposalWithVeto.VotingEndTime = &votingEndTime + call1 := m.GovKeeper.EXPECT().GetProposal(ctx, uint64(1)).Return(votingPeriodProposal, true) m.GovKeeper.EXPECT().DeleteAndBurnDeposits(ctx, uint64(1)).MaxTimes(1) m.GovKeeper.EXPECT().SetProposal(ctx, proposalWithVeto).After(call1)