diff --git a/x/wasm/internal/keeper/keeper.go b/x/wasm/internal/keeper/keeper.go index dcd9b567068..660e7e6a2b8 100644 --- a/x/wasm/internal/keeper/keeper.go +++ b/x/wasm/internal/keeper/keeper.go @@ -559,7 +559,10 @@ func (k Keeper) dispatchMessages(ctx sdk.Context, contractAddr sdk.AccAddress, m func gasForContract(ctx sdk.Context) uint64 { meter := ctx.GasMeter() - remaining := (meter.Limit() - meter.GasConsumed()) * GasMultiplier + if meter.IsOutOfGas() { + return 0 + } + remaining := (meter.Limit() - meter.GasConsumedToLimit()) * GasMultiplier if remaining > MaxGas { return MaxGas }