Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade v0.45.8 #133

Merged
merged 23 commits into from
Sep 27, 2022
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3fc6728
fix: update x/mint parameter validation (backport #12384) (#12396)
mergify[bot] Jun 30, 2022
f90ddb3
chore: optimize get last completed upgrade (#12268)
robert-zaremba Jul 3, 2022
5712b41
fix: Simulation is not deterministic due to GenTx (backport #12374) (…
adu-web3 Jul 4, 2022
cf6fd4c
fix: use go install instead of go get in makefile (#12435)
julienrbrt Jul 4, 2022
315eaad
chore: fumpt sdk v45 series #12442
faddat Jul 5, 2022
e47a477
feat: Move AppModule.BeginBlock and AppModule.EndBlock to extension i…
mergify[bot] Jul 19, 2022
2144168
feat: add message index event attribute to authz message execution (b…
mergify[bot] Jul 22, 2022
ede5b72
chore(store): upgrade iavl to v0.19.0 (backport #12626) (#12697)
mergify[bot] Jul 23, 2022
3321e79
feat: Add `GetParamSetIfExists` to prevent panic on breaking param ch…
fedekunze Jul 26, 2022
7a92958
feat: Add convenience method for constructing key to access account's…
mergify[bot] Aug 2, 2022
96545d6
chore: bump tm in 0.45.x (#12784)
tac0turtle Aug 4, 2022
9eed4ed
chore: 0.45.7 changelog prep (#12821)
tac0turtle Aug 4, 2022
1af28df
docs(staking): typo in staking/state (backport #12834) (#12836)
mergify[bot] Aug 7, 2022
181c9f4
chore: fee payer event (backport #12850) (#12856)
mergify[bot] Aug 8, 2022
a7a3a02
chore: changelog update (backport #12859) (#12862)
mergify[bot] Aug 8, 2022
ca7cdc5
fix: Use fixed length hex for pointer at FwdCapabilityKey (backport #…
yihuang Aug 9, 2022
9a4d83c
feat: deterministic map iteration (backport #12781) (#12944)
mergify[bot] Aug 18, 2022
d2ba3c4
chore: bump tendermint to `0.34.21` and iavl to `0.19.1` (#12970)
julienrbrt Aug 19, 2022
ea4d9ed
perf: Amortize clearing unsorted cache entries (Juno genesis fix) (ba…
mergify[bot] Aug 19, 2022
3a792c0
fix: proper error when parsing telemetry configuration (backport #129…
mergify[bot] Aug 23, 2022
04ed5bb
ci: fix release notes not populated by goreleaser (#13019)
mergify[bot] Aug 24, 2022
4a98828
fix: missing return statement in BaseApp.Query (backport #13046) (#13…
mergify[bot] Aug 25, 2022
3fc8a80
chore: v0.45.8 release changelog (#13053)
julienrbrt Aug 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: optimize get last completed upgrade (#12268)
* feat: improve GetLastCompletedUpgrade

* rename

* use var block
  • Loading branch information
robert-zaremba authored and MissingNO57 committed Sep 16, 2022
commit f90ddb3e238713e175f5cce4c447ef757bb65350
26 changes: 11 additions & 15 deletions x/upgrade/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,24 +243,20 @@ func (k Keeper) GetLastCompletedUpgrade(ctx sdk.Context) (string, int64) {
iter := sdk.KVStoreReversePrefixIterator(ctx.KVStore(k.storeKey), []byte{types.DoneByte})
defer iter.Close()

var upgrades []upgrade
var (
latest upgrade
found bool
)
for ; iter.Valid(); iter.Next() {
name := parseDoneKey(iter.Key())
value := int64(sdk.BigEndianToUint64(iter.Value()))

upgrades = append(upgrades, upgrade{Name: name, BlockHeight: value})
}

// sort upgrades in descending order by block height
sort.SliceStable(upgrades, func(i, j int) bool {
return upgrades[i].BlockHeight > upgrades[j].BlockHeight
})

if len(upgrades) > 0 {
return upgrades[0].Name, upgrades[0].BlockHeight
upgradeHeight := int64(sdk.BigEndianToUint64(iter.Value()))
if !found || upgradeHeight >= latest.BlockHeight {
found = true
name := parseDoneKey(iter.Key())
latest = upgrade{Name: name, BlockHeight: upgradeHeight}
}
}

return "", 0
return latest.Name, latest.BlockHeight
}

// parseDoneKey - split upgrade name from the done key
Expand Down