subcontainer have size limit of 64K implied by the header format
but this doesn't apply to "top-level" containers!
we have EIP-3860 MAX_INITCODE_SIZE of 48K - but not part of EOF validation!
EVM implementations doing validate_eof and handling the containers/headers must make assumptions about the maximum size of the container to expect and handle
is it MAX_INITCODE_SIZE?
is it 64K, same as subcontainer?
is it whatever can be maxed out with sections, i.e. max code sections, then max of max container sections and max data size?
is it some yet other value?
for example, evmone had a subtle bug, where large top-level containers had "overflown" data_section_offset persisted in the header, because offsets were expected to not exceed 64K
Proposal
Introduce a validation rule of max top-level container size of MAX_INITCODE_SIZE 48K (or twice that constant, for practical reasons like solidity testing methods). Whenever either the bytestring being the top-level container or the declared (in the header, as discovered during header parsing) size of the top-level container exceed that, validation fails.
Pushing in form of a PR after discussion during EOF implementers call 49.
To reiterate the reasoning behind:
Synopsis of the problem:
validate_eof
and handling the containers/headers must make assumptions about the maximum size of the container to expect and handleProposal
Introduce a validation rule of max top-level container size of MAX_INITCODE_SIZE 48K (or twice that constant, for practical reasons like solidity testing methods). Whenever either the bytestring being the top-level container or the declared (in the header, as discovered during header parsing) size of the top-level container exceed that, validation fails.