py-evm icon indicating copy to clipboard operation
py-evm copied to clipboard

EIP170 Contract Size Limit

Open fubuloubu opened this issue 7 years ago • 6 comments

What is wrong?

Double checking this is the intended functionality.

EIP170 states that the contract size limit was changed to 2**14 + 2**13 which is 24,576 bytes. The following line implementations the constant for EIP170, but it is off by one.

https://github.com/ethereum/py-evm/blob/0ff7bc0f820250d7f15e804bc09870776ea34eb5/eth/vm/forks/spurious_dragon/constants.py#L13

How can it be fixed

Validate that the number is correctly applied. If it is, consider making the number match and modifying the condition that tests for it so that it works with the actual number described in EIP170.

fubuloubu avatar Nov 14 '18 02:11 fubuloubu

Validate that the number is correctly applied.

Yup a quick search shows that it is functioning correctly.

https://github.com/ethereum/py-evm/blob/ae1e3e4fc133f36db2238f61dac05a4e4e344319/eth/vm/forks/spurious_dragon/computation.py#L41


consider making the number match and modifying the condition that tests for it

The change seems fine to me, I agree that it's at least a slight improvement.

carver avatar Nov 14 '18 05:11 carver

Might be good for us to write a non-JSON-fixture based test to test for this specific thing. We rely on the JSON-fixture tests for compliance with these things, but it'd be good to have a legible test as well (similar to what @cburgdorf has done for many of our opcodes).

pipermerriam avatar Nov 14 '18 17:11 pipermerriam

Would like to take a stab on this

glaksmono avatar Nov 18 '18 02:11 glaksmono

@glaksmono :+1:

pipermerriam avatar Nov 19 '18 16:11 pipermerriam

@pipermerriam , is the issue solved with the #1799 pull request?

dherykw avatar Aug 02 '19 15:08 dherykw

I dug into this issue. I have some thoughts about this. Please let me know if there are any mistakes.

  • opcodes for deploy contract are the "init code". It copies/stores the contract code in memory and should return the memory address at the end.

  • The condition of this line should be '>' when the EIP170_CODE_SIZE_LIMIT is 24576. https://github.com/ethereum/py-evm/blob/12f3bee964dc07bf3425beb3776639ad06f0648c/eth/vm/forks/spurious_dragon/computation.py#L86

e3243eric avatar Oct 02 '22 20:10 e3243eric