Skip to content

Commit

Permalink
reformat sdk upstream validation (#269)
Browse files Browse the repository at this point in the history
Co-authored-by: hard-nett <[email protected]>
  • Loading branch information
angelorc and hard-nett authored Feb 13, 2025
1 parent f18e2ae commit 68fe10d
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions app/upgrades/v021/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,26 @@ func CreateV021UpgradeHandler(mm *module.Manager, configurator module.Configurat
}

/* ensure no delegations exist without starting info*/
allDels, err := k.StakingKeeper.GetAllDelegations(sdkCtx)
allVals, err := k.StakingKeeper.GetAllValidators(sdkCtx)
if err != nil {
panic(err)
}
for _, del := range allDels {
for _, val := range allVals {
/* ensure all rewards are patched */
val, err := k.StakingKeeper.Validator(sdkCtx, sdk.ValAddress(del.GetValidatorAddr()))
dels, err := k.StakingKeeper.GetValidatorDelegations(sdkCtx, sdk.ValAddress(val.OperatorAddress))
if err != nil {
panic(err)
}
endingPeriod, err := k.DistrKeeper.IncrementValidatorPeriod(sdkCtx, val)
if err != nil {
panic(err)
}
/* will error if still broken */
_, err = k.DistrKeeper.CalculateDelegationRewards(sdkCtx, val, del, endingPeriod)
if err != nil {
panic(err)
for _, del := range dels {
endingPeriod, err := k.DistrKeeper.IncrementValidatorPeriod(sdkCtx, val)
if err != nil {
panic(err)
}
/* will error if still broken */
_, err = k.DistrKeeper.CalculateDelegationRewards(sdkCtx, val, del, endingPeriod)
if err != nil {
panic(err)
}
}
}

Expand Down

0 comments on commit 68fe10d

Please sign in to comment.