Skip to content

Commit

Permalink
test: added sad test for precompile local gas
Browse files Browse the repository at this point in the history
  • Loading branch information
onikonychev committed Oct 31, 2024
1 parent 84c63b6 commit 362ed5a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions x/evm/precompile/funtoken_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,21 @@ func (s *FuntokenSuite) TestPrecompileLocalGas() {
big.NewInt(int64(precompile.FunTokenGasLimitBankSend)), // customGas
)
s.Require().NoError(err)

s.deps.ResetGasMeter()

s.T().Log("Sad: callBankSend with local gas - insufficient gas amount")
_, err = deps.EvmKeeper.CallContract(
deps.Ctx,
embeds.SmartContract_TestFunTokenPrecompileLocalGas.ABI,
deps.Sender.EthAddr,
&contractAddr,
true,
precompile.FunTokenGasLimitBankSend, // gasLimit for the entire call
"callBankSendLocalGas",
big.NewInt(1), // erc20 amount
randomAcc.String(), // to
big.NewInt(50_000), // customGas - too small
)
s.Require().ErrorContains(err, "Failed to call bankSend")
}

0 comments on commit 362ed5a

Please sign in to comment.