From 88e7544a4ee8a661ccbb71f09db61e8542dde2d9 Mon Sep 17 00:00:00 2001 From: Yarom Swisa Date: Wed, 13 Mar 2024 18:22:35 +0200 Subject: [PATCH] fix --- app/app.go | 1 + app/upgrades/empty_upgrades.go | 6 ++++++ x/pairing/keeper/unstaking.go | 3 +++ 3 files changed, 10 insertions(+) diff --git a/app/app.go b/app/app.go index 1c7c51e70f..6048a84032 100644 --- a/app/app.go +++ b/app/app.go @@ -186,6 +186,7 @@ var Upgrades = []upgrades.Upgrade{ upgrades.Upgrade_0_34_0, upgrades.Upgrade_0_35_0, upgrades.Upgrade_1_0_0, + upgrades.Upgrade_1_0_1, } // this line is used by starport scaffolding # stargate/wasm/app/enabledProposals diff --git a/app/upgrades/empty_upgrades.go b/app/upgrades/empty_upgrades.go index 125528b489..a625b72a5d 100644 --- a/app/upgrades/empty_upgrades.go +++ b/app/upgrades/empty_upgrades.go @@ -217,3 +217,9 @@ var Upgrade_1_0_0 = Upgrade{ CreateUpgradeHandler: defaultUpgradeHandler, StoreUpgrades: store.StoreUpgrades{}, } + +var Upgrade_1_0_1 = Upgrade{ + UpgradeName: "v1.0.1", + CreateUpgradeHandler: defaultUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} diff --git a/x/pairing/keeper/unstaking.go b/x/pairing/keeper/unstaking.go index 516a0233e1..a9c0025a16 100644 --- a/x/pairing/keeper/unstaking.go +++ b/x/pairing/keeper/unstaking.go @@ -160,6 +160,9 @@ func (k Keeper) SlashDelegator(ctx sdk.Context, slashingInfo types.DelegatorSlas for _, entry := range unbonding.Entries { totalBalance = totalBalance.Add(entry.Balance) } + if totalBalance.IsZero() { + continue + } slashingFactor := total.ToLegacyDec().QuoInt(totalBalance) slashingFactor = sdk.MinDec(sdk.OneDec(), slashingFactor)