From bd03c13b5307684784eb1a4004c799e266b26c76 Mon Sep 17 00:00:00 2001 From: Kevin Yang <5478483+k-yang@users.noreply.github.com> Date: Sat, 4 Jan 2025 08:43:38 -0500 Subject: [PATCH] test: fix tests --- app/ante/fixed_gas_test.go | 2 +- x/evm/keeper/bank_extension.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/ante/fixed_gas_test.go b/app/ante/fixed_gas_test.go index 4e45f6b6b..64f4c6e8c 100644 --- a/app/ante/fixed_gas_test.go +++ b/app/ante/fixed_gas_test.go @@ -197,7 +197,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() { Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 200)), }, }, - expectedGas: 38175, + expectedGas: 67193, expectedErr: nil, }, } diff --git a/x/evm/keeper/bank_extension.go b/x/evm/keeper/bank_extension.go index c2b6850f9..43257eabe 100644 --- a/x/evm/keeper/bank_extension.go +++ b/x/evm/keeper/bank_extension.go @@ -108,8 +108,9 @@ func (bk NibiruBankKeeper) ForceGasInvariant( // Note that because the ctx gas meter uses private variables to track gas, // we have to branch off with a new gas meter instance to avoid mutating the // "true" gas meter (called GasMeterBefore here). - ctx = ctx. - WithGasMeter(sdk.NewGasMeter(gasMeterBefore.GasRemaining())) + // We use an infinite gas meter because we consume gas in the deferred function + // and gasMeterBefore will panic if we consume too much gas. + ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) err := BaseOp(ctx) baseOpGasConsumed = ctx.GasMeter().GasConsumed()