Skip to content

Commit

Permalink
Revert "fix: check if proposal has passed voting end time before mark…
Browse files Browse the repository at this point in the history
…ing it as invalid (forbole#499)"

This reverts commit 65d7e76.
  • Loading branch information
ankurdotb committed Nov 24, 2022
1 parent a2c755a commit 4d24dc2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
3 changes: 1 addition & 2 deletions cmd/parse/gov/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/hex"
"fmt"
"strconv"
"time"

modulestypes "github.com/forbole/bdjuno/v3/modules/types"
"github.com/rs/zerolog/log"
Expand Down Expand Up @@ -79,7 +78,7 @@ func proposalCmd(parseConfig *parsecmdtypes.Config) *cobra.Command {
return fmt.Errorf("error while getting chain latest block height: %s", err)
}

err = govModule.UpdateProposal(height, time.Now(), proposalID)
err = govModule.UpdateProposal(height, proposalID)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion modules/gov/handle_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (m *Module) updateProposals(height int64, blockTime time.Time, blockVals *t
}

for _, id := range ids {
err = m.UpdateProposal(height, blockTime, id)
err = m.UpdateProposal(height, id)
if err != nil {
return fmt.Errorf("error while updating proposal: %s", err)
}
Expand Down
8 changes: 2 additions & 6 deletions modules/gov/utils_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package gov
import (
"fmt"
"strings"
"time"

minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
proposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
Expand All @@ -21,14 +20,11 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
)

func (m *Module) UpdateProposal(height int64, blockTime time.Time, id uint64) error {
func (m *Module) UpdateProposal(height int64, id uint64) error {
// Get the proposal
proposal, err := m.source.Proposal(height, id)
if err != nil {
// Check if proposal has reached the voting end time
passedVotingPeriod := blockTime.After(proposal.VotingEndTime)

if strings.Contains(err.Error(), codes.NotFound.String()) && passedVotingPeriod {
if strings.Contains(err.Error(), codes.NotFound.String()) {
// Handle case when a proposal is deleted from the chain (did not pass deposit period)
return m.updateDeletedProposalStatus(id)
}
Expand Down

0 comments on commit 4d24dc2

Please sign in to comment.