forked from cerc-io/laconicd-deprecated
Fix EVM out of gas handling (#133)
This commit is contained in:
parent
69e0873dd9
commit
c130105b86
@ -74,7 +74,9 @@ func handleETHTxMsg(ctx sdk.Context, keeper Keeper, msg types.EthereumTxMsg) sdk
|
||||
keeper.txCount.increment()
|
||||
|
||||
bloom, res := st.TransitionCSDB(ctx)
|
||||
keeper.bloom.Or(keeper.bloom, bloom)
|
||||
if res.IsOK() {
|
||||
keeper.bloom.Or(keeper.bloom, bloom)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ func (st StateTransition) TransitionCSDB(ctx sdk.Context) (*big.Int, sdk.Result)
|
||||
return nil, res
|
||||
}
|
||||
|
||||
cost, err := core.IntrinsicGas(st.Payload, st.Recipient == nil, true)
|
||||
cost, err := core.IntrinsicGas(st.Payload, contractCreation, true)
|
||||
if err != nil {
|
||||
return nil, sdk.ErrOutOfGas("invalid intrinsic gas for transaction").Result()
|
||||
}
|
||||
@ -105,7 +105,12 @@ func (st StateTransition) TransitionCSDB(ctx sdk.Context) (*big.Int, sdk.Result)
|
||||
// handle errors
|
||||
if vmerr != nil {
|
||||
res := emint.ErrVMExecution(vmerr.Error()).Result()
|
||||
if vmerr == vm.ErrOutOfGas || vmerr == vm.ErrCodeStoreOutOfGas {
|
||||
res = sdk.ErrOutOfGas("EVM execution went out of gas").Result()
|
||||
}
|
||||
res.Data = returnData
|
||||
// Consume gas before returning
|
||||
ctx.GasMeter().ConsumeGas(gasLimit-leftOverGas, "EVM execution consumption")
|
||||
return nil, res
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user