diff --git a/x/auth/simulation/fake.go b/x/auth/simulation/fake.go index 82f4e607bf..e89e708422 100644 --- a/x/auth/simulation/fake.go +++ b/x/auth/simulation/fake.go @@ -40,6 +40,10 @@ func SimulateDeductFee(m auth.AccountMapper, f auth.FeeCollectionKeeper) simulat panic(err) } m.SetAccount(ctx, stored) + if !coins.IsNotNegative() { + panic("setting negative fees") + } + f.AddCollectedFees(ctx, coins) event(fmt.Sprintf("auth/SimulateDeductFee/true")) diff --git a/x/distribution/types/validator_info.go b/x/distribution/types/validator_info.go index c8a02569cb..ae80d8aa71 100644 --- a/x/distribution/types/validator_info.go +++ b/x/distribution/types/validator_info.go @@ -45,6 +45,9 @@ func (vi ValidatorDistInfo) TakeFeePoolRewards(fp FeePool, height int64, totalBo blocks := height - vi.FeePoolWithdrawalHeight vi.FeePoolWithdrawalHeight = height accum := vdTokens.MulInt(sdk.NewInt(blocks)) + if accum.GT(fp.ValAccum.Accum) { + panic("individual accum should never be greater than the total") + } withdrawalTokens := fp.Pool.MulDec(accum).QuoDec(fp.ValAccum.Accum) remainingTokens := fp.Pool.Minus(withdrawalTokens)