Skip to content

Commit

Permalink
Merge pull request #1299 from lavanet/CNS-fix-slashing-bug
Browse files Browse the repository at this point in the history
CNS-fix-slashing-bug
  • Loading branch information
Yaroms authored Mar 13, 2024
2 parents 78d82cb + 88e7544 commit c1f9829
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions app/upgrades/empty_upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
}
3 changes: 3 additions & 0 deletions x/pairing/keeper/unstaking.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c1f9829

Please sign in to comment.