diff --git a/CHANGELOG.md b/CHANGELOG.md index 85b10d3c9..f92f5b9cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,6 +88,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes * [\#10648](https://github.com/cosmos/cosmos-sdk/pull/10648) Upgrade IAVL to 0.17.3 to solve race condition bug in IAVL. +* [\#10897](https://github.com/cosmos/cosmos-sdk/pull/10897) Fix: set a non-zero value on gas overflow. ## [v0.44.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.4) - 2021-11-25 diff --git a/store/types/gas.go b/store/types/gas.go index bf44e717d..fe72cc520 100644 --- a/store/types/gas.go +++ b/store/types/gas.go @@ -89,9 +89,9 @@ func addUint64Overflow(a, b uint64) (uint64, bool) { func (g *basicGasMeter) ConsumeGas(amount Gas, descriptor string) { var overflow bool - // TODO: Should we set the consumed field after overflow checking? g.consumed, overflow = addUint64Overflow(g.consumed, amount) if overflow { + g.consumed = math.MaxUint64 panic(ErrorGasOverflow{descriptor}) } diff --git a/x/auth/ante/fee.go b/x/auth/ante/fee.go index b1d1d72a7..19e8258cf 100644 --- a/x/auth/ante/fee.go +++ b/x/auth/ante/fee.go @@ -79,7 +79,7 @@ func (dfd DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo } if addr := dfd.ak.GetModuleAddress(types.FeeCollectorName); addr == nil { - panic(fmt.Sprintf("%s module account has not been set", types.FeeCollectorName)) + return ctx, fmt.Errorf("Fee collector module account (%s) has not been set", types.FeeCollectorName) } fee := feeTx.GetFee()