Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Fix TestOutOfGasWhenDeployContract error check
Browse files Browse the repository at this point in the history
  • Loading branch information
loredanacirstea committed Mar 4, 2022
1 parent 9633e1a commit 892fc66
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions x/evm/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,16 +470,9 @@ func (suite *EvmTestSuite) TestOutOfGasWhenDeployContract() {
tx := types.NewTx(suite.chainID, 1, nil, big.NewInt(0), gasLimit, gasPrice, nil, nil, bytecode, nil)
suite.SignTx(tx)

defer func() {
if r := recover(); r != nil {
// TODO: snapshotting logic
} else {
suite.Require().Fail("panic did not happen")
}
}()
_, err := suite.handler(suite.ctx, tx)

suite.handler(suite.ctx, tx)
suite.Require().Fail("panic did not happen")
suite.Require().Equal("failed to apply transaction: failed to apply ethereum core message: apply message: intrinsic gas too low", err.Error(), "correct error")
}

func (suite *EvmTestSuite) TestErrorWhenDeployContract() {
Expand Down
2 changes: 1 addition & 1 deletion x/evm/keeper/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, msg core.Message, trace
}
leftoverGas := msg.Gas() - intrinsicGas

// access list preparaion is moved from ante handler to here, because it's needed when `ApplyMessage` is called
// access list preparation is moved from ante handler to here, because it's needed when `ApplyMessage` is called
// under contexts where ante handlers are not run, for example `eth_call` and `eth_estimateGas`.
if rules := cfg.ChainConfig.Rules(big.NewInt(ctx.BlockHeight()), cfg.ChainConfig.MergeForkBlock != nil); rules.IsBerlin {
stateDB.PrepareAccessList(msg.From(), msg.To(), vm.ActivePrecompiles(rules), msg.AccessList())
Expand Down

0 comments on commit 892fc66

Please sign in to comment.