From 3cd95a4d84d0ce1df7c42ceb777ac7e730e2a077 Mon Sep 17 00:00:00 2001 From: zhongxianfeng Date: Sat, 4 Aug 2018 16:20:40 +0800 Subject: [PATCH] cannot check whether the max code size has been exceeded --- core/vm/evm.go | 2 +- core/vm/interpreter.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/vm/evm.go b/core/vm/evm.go index 96676c314a..6f3bf5e97a 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -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 diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 7090e0261f..0e837c2a16 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -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 }