tip | title | author | created | status | type | category |
---|---|---|---|---|---|---|
3 |
the model of handling ErrCodeStoreOutOfGas situation |
SHU XUN <[email protected]> |
2019-05-27 |
Draft |
Standards Track |
Core |
This draft TIP describes the model of handling the situation that contract creation code storage out of gas
when an error of ErrCodeStoreOutOfGas was returned by the EVM,We should punish such behavior. revert to the snapshot and consume any gas remaining
In order to achieve the specs, The current processing mode needs to be modified.
- the current processing mode is when EVM return ErrCodeStoreOutOfGas,we just return the error without any special handling, But when ErrCodeStoreOutOfGas is a malicious behavior, the client expends some computing resources on it, and the gas consume too little about the action.
- so in order to avoid this ,when contract creation code storage out of gas, we should revert to the snapshot and consume any gas remaining.
current processing mode:
err != nil && err != ErrCodeStoreOutOfGas{
evm.StateDB.RevertToSnapshot(snapshot)
if err != errExecutionReverted {
contract.UseGas(contract.Gas)
}
}
when err is ErrCodeStoreOutOfGas only return err
modified processing mode:
err != nil && (evm.ChainConfig().IsTIP3(evm.BlockNumber) || err != ErrCodeStoreOutOfGas){
evm.StateDB.RevertToSnapshot(snapshot)
if err != errExecutionReverted {
contract.UseGas(contract.Gas)
}
}