Skip to content

Commit e7408b5

Browse files
holimankaralabe
authored andcommitted
core/vm: Make MaxCodesize non-retroactive (#15072)
* core/vm: Make max_codesize only applicable post Spurious Dragon/158/155/161/170 * tests: Remove expected failure
1 parent 1901521 commit e7408b5

2 files changed

Lines changed: 1 addition & 3 deletions

File tree

‎core/vm/evm.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.I
336336

337337
ret, err = run(evm, snapshot, contract, nil)
338338
// check whether the max code size has been exceeded
339-
maxCodeSizeExceeded := len(ret) > params.MaxCodeSize
339+
maxCodeSizeExceeded := evm.ChainConfig().IsEIP158(evm.BlockNumber) && len(ret) > params.MaxCodeSize
340340
// if the contract creation ran successfully and no errors were returned
341341
// calculate the gas required to store the code. If the code could not
342342
// be stored due to not enough gas set an error and let it be handled

‎tests/state_test.go‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ func TestState(t *testing.T) {
3535
st.skipLoad(`^stTransactionTest/OverflowGasRequire\.json`) // gasLimit > 256 bits
3636
st.skipLoad(`^stTransactionTest/zeroSigTransa[^/]*\.json`) // EIP-86 is not supported yet
3737
// Expected failures:
38-
st.fails(`^stCodeSizeLimit/codesizeOOGInvalidSize\.json/(Frontier|Homestead|EIP150)`,
39-
"code size limit implementation is not conditional on fork")
4038
st.fails(`^stRevertTest/RevertPrecompiledTouch\.json/EIP158`, "bug in test")
4139
st.fails(`^stRevertTest/RevertPrefoundEmptyOOG\.json/EIP158`, "bug in test")
4240
st.fails(`^stRevertTest/RevertPrecompiledTouch\.json/Byzantium`, "bug in test")

0 commit comments

Comments
 (0)