Skip to content

Commit

Permalink
fix: parse gov genesis with doc.InitialHeight instead of height 1 (f…
Browse files Browse the repository at this point in the history
…orbole#461)

## Description

Closes: #XXXX



jira: https://forbole.atlassian.net/browse/BDU-544

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch
- [ ] provided a link to the relevant issue or specification
- [x] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
  • Loading branch information
huichiaotsou authored and ankurdotb committed Sep 8, 2022
1 parent 09f4f74 commit cc1172e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
- ([\#443](https://github.com/forbole/bdjuno/pull/443)) Remove tombstone status from staking module(already stored in slashing module)
- ([\#455](https://github.com/forbole/bdjuno/pull/455)) Added `unbonding_tokens` and `staked_not_bonded_tokens` values to staking pool table

#### Gov Module
- ([\#461](https://github.com/forbole/bdjuno/pull/461)) Parse `x/gov` genesis with `genesisDoc.InitialHeight` instead of the hard-coded height 1

#### Daily refetch
- ([\#454](https://github.com/forbole/bdjuno/pull/454)) Added `daily refetch` module to refetch missing blocks every day
Expand Down
8 changes: 4 additions & 4 deletions modules/gov/handle_genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (m *Module) HandleGenesis(doc *tmtypes.GenesisDoc, appState map[string]json
}

// Save the proposals
err = m.saveProposals(genState.Proposals)
err = m.saveProposals(genState.Proposals, doc.InitialHeight)
if err != nil {
return fmt.Errorf("error while storing genesis governance proposals: %s", err)
}
Expand All @@ -44,7 +44,7 @@ func (m *Module) HandleGenesis(doc *tmtypes.GenesisDoc, appState map[string]json
}

// saveProposals save proposals from genesis file
func (m *Module) saveProposals(slice govtypes.Proposals) error {
func (m *Module) saveProposals(slice govtypes.Proposals, genHeight int64) error {
proposals := make([]types.Proposal, len(slice))
tallyResults := make([]types.TallyResult, len(slice))
deposits := make([]types.Deposit, len(slice))
Expand All @@ -70,14 +70,14 @@ func (m *Module) saveProposals(slice govtypes.Proposals) error {
proposal.FinalTallyResult.Abstain.String(),
proposal.FinalTallyResult.No.String(),
proposal.FinalTallyResult.NoWithVeto.String(),
1,
genHeight,
)

deposits[index] = types.NewDeposit(
proposal.ProposalId,
"",
proposal.TotalDeposit,
1,
genHeight,
)
}

Expand Down

0 comments on commit cc1172e

Please sign in to comment.