Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
likhita-809 committed Mar 29, 2024
1 parent ddad9ff commit d38635b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions x/mint/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (k Keeper) BeginBlocker(ctx context.Context, ic types.InflationCalculationF
}

// recalculate inflation rate
totalSupply := k.bankKeeper.GetSupply(ctx, params.MintDenom).Amount // fetch total supply from the bank module
totalStakingSupply, err := k.StakingTokenSupply(ctx)
if err != nil {
return err
}
Expand All @@ -39,7 +39,7 @@ func (k Keeper) BeginBlocker(ctx context.Context, ic types.InflationCalculationF

// update minter's inflation and annual provisions
minter.Inflation = ic(ctx, minter, params, bondedRatio)
minter.AnnualProvisions = minter.NextAnnualProvisions(params, totalSupply)
minter.AnnualProvisions = minter.NextAnnualProvisions(params, totalStakingSupply)
if err = k.Minter.Set(ctx, minter); err != nil {
return err
}
Expand All @@ -49,6 +49,8 @@ func (k Keeper) BeginBlocker(ctx context.Context, ic types.InflationCalculationF
mintedCoins := sdk.NewCoins(mintedCoin)

maxSupply := params.MaxSupply
totalSupply := k.bankKeeper.GetSupply(ctx, params.MintDenom).Amount // fetch total supply from the bank module

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call

// if maxSupply is not infinite, check against max_supply parameter
if !maxSupply.IsZero() {
if totalSupply.Add(mintedCoins.AmountOf(params.MintDenom)).GT(maxSupply) {

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

path flow from Begin/EndBlock to a panic call

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

path flow from Begin/EndBlock to a panic call
Expand Down

0 comments on commit d38635b

Please sign in to comment.