EIP-2677: Limit size of initcode

Discussion topic for

This was suggested during the discussion of EIP-2315: EIP-2315 "Simple Subroutines for the EVM" - Analysis

Enforce a maximum size limit ( max_initcode_size ) for initcode . If the size of initcode exceeds max_initcode_size , then contract creation fails with an out of gas error.

Since EIP-170 was implemented, there has been a size limit of 24576 ( 0x6000 ) on contract code. We propose to also limit the size of executable code to 2x the above limit, i.e. 49152 ( 0xc000 ).

This also leads to two nice properties:

  • instruction offset in code fits 16-bit value,
  • code size fits 16-bit value.

Is the rationale that this will reduce the worst-case resource consumption of initcode, enabling a price reduction? Or is it that initcode is priced too low already and this change will bring resource consumption in line with the current price?

Ensuring a limit for init code makes analysis of it easier. While the lack of this limit may not be a problem currently, it makes the introduction of new EVM features harder. A good example is EIP-2315.

hmm, current stack width is 256 bits, but I guess the new return stack will be slimmer, only operating on program counters and not data