Skip to content

Commit

Permalink
fix: check submit event with voting start period attritube to gov han…
Browse files Browse the repository at this point in the history
…dle block
  • Loading branch information
dadamu committed Mar 21, 2024
1 parent 890cbb1 commit 39e7987
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions modules/gov/handle_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,19 @@ func (m *Module) updateProposalsStatus(height int64, blockTime time.Time, txEven
}
ids = append(ids, endBlockIDs...)

// the proposal changes state from the submit to voting
idsInSubmitTxs, err := findProposalIDsInEvents(txEvents, govtypes.EventTypeSubmitProposal, govtypes.AttributeKeyVotingPeriodStart)
if err != nil {
return err
}
ids = append(ids, idsInSubmitTxs...)

// the proposal changes state from the deposit to voting
txIDs, err := findProposalIDsInEvents(txEvents, govtypes.EventTypeProposalDeposit, govtypes.AttributeKeyVotingPeriodStart)
idsInDepositTxs, err := findProposalIDsInEvents(txEvents, govtypes.EventTypeProposalDeposit, govtypes.AttributeKeyVotingPeriodStart)
if err != nil {
return err
}
ids = append(ids, txIDs...)
ids = append(ids, idsInDepositTxs...)

// update status for proposals IDs stored in ids array
for _, id := range ids {
Expand All @@ -57,7 +64,7 @@ func (m *Module) updateProposalsStatus(height int64, blockTime time.Time, txEven
return fmt.Errorf("error while updating proposal validator statuses snapshots: %s", err)
}

err = m.UpdateProposalStakingPoolSnapshot(height, blockVals, id)
err = m.UpdateProposalStakingPoolSnapshot(height, id)
if err != nil {
return fmt.Errorf("error while updating proposal validator statuses snapshots: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion modules/gov/utils_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (m *Module) UpdateProposalValidatorStatusesSnapshot(height int64, blockVals
return nil
}

func (m *Module) UpdateProposalStakingPoolSnapshot(height int64, blockVals *tmctypes.ResultValidators, id uint64) error {
func (m *Module) UpdateProposalStakingPoolSnapshot(height int64, id uint64) error {
err := m.updateProposalStakingPoolSnapshot(height, id)
if err != nil {
return fmt.Errorf("error while updating proposal staking pool snapshot: %s", err)
Expand Down

0 comments on commit 39e7987

Please sign in to comment.