cannot check whether the max code size has been exceeded

This commit is contained in:
zhongxianfeng 2018-08-04 16:20:40 +08:00
parent 45bd4fedde
commit 3cd95a4d84
2 changed files with 3 additions and 3 deletions

View file

@ -358,7 +358,7 @@ func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.I
ret, err = run(evm, contract, nil)
// check whether the max code size has been exceeded
maxCodeSizeExceeded := evm.ChainConfig().IsEIP158(evm.BlockNumber) && len(ret) > params.MaxCodeSize
maxCodeSizeExceeded := evm.ChainConfig().IsEIP158(evm.BlockNumber) && ret > params.MaxCodeSize
// if the contract creation ran successfully and no errors were returned
// calculate the gas required to store the code. If the code could not
// be stored due to not enough gas set an error and let it be handled

View file

@ -103,7 +103,7 @@ func (in *Interpreter) enforceRestrictions(op OpCode, operation operation, stack
// It's important to note that any errors returned by the interpreter should be
// considered a revert-and-consume-all-gas operation except for
// errExecutionReverted which means revert-and-keep-gas-left.
func (in *Interpreter) Run(contract *Contract, input []byte) (ret []byte, err error) {
func (in *Interpreter) Run(contract *Contract, input []byte) (ret uint64, err error) {
// Increment the call depth which is restricted to 1024
in.evm.depth++
defer func() { in.evm.depth-- }()
@ -222,5 +222,5 @@ func (in *Interpreter) Run(contract *Contract, input []byte) (ret []byte, err er
pc++
}
}
return nil, nil
return pc, nil
}