Contract Limits
MegaETH contract size limits — 512 KB max bytecode, 536 KB max initcode, inherited from MiniRex.
Last updated
MegaETH contract size limits — 512 KB max bytecode, 536 KB max initcode, inherited from MiniRex.
This page specifies MegaETH's limits on deployed contract bytecode size and initcode size. It defines the contract-size limits inherited from MiniRex.
Contract size and initcode size directly affect execution cost, state footprint, and validation overhead. MegaETH raises these limits to accommodate larger deployments, but the protocol must still define explicit maximum values so all nodes reject oversized contracts consistently.
A node MUST enforce the following limits:
Maximum deployed contract size
MAX_CONTRACT_SIZE
Maximum initcode size
MAX_INITCODE_SIZE
If deployed runtime bytecode exceeds MAX_CONTRACT_SIZE, the node MUST reject the deployment. If initcode exceeds MAX_INITCODE_SIZE, the node MUST reject the creation transaction or creation opcode execution.
The initcode limit is defined as:
MAX_INITCODE_SIZE = MAX_CONTRACT_SIZE + ADDITIONAL_INITCODE_SIZE
When a CREATE2 opcode is executed with an init-code length of zero, a node MUST short-circuit after validating the salt operand: it MUST use the keccak-256 hash of the empty byte string as the resulting init-code hash, and MUST NOT perform any offset conversion, memory expansion, or hashing of memory. Because the init-code length is zero, the init-code offset operand MUST be ignored entirely, even when it is a very large value. This ensures that a zero-length CREATE2 charges no memory-expansion gas (and no associated compute gas) for the unused offset operand and never halts with a spurious out-of-gas error caused by an out-of-range offset whose length is zero.
MAX_CONTRACT_SIZE
524,288 bytes
Maximum size of deployed contract bytecode
ADDITIONAL_INITCODE_SIZE
24,576 bytes
Additional bytes allowed above the contract-size limit for initcode
MAX_INITCODE_SIZE
548,864 bytes
Maximum initcode size
Why raise the contract limits? MegaETH allows substantially larger contracts than standard Ethereum. The enlarged limits support deployment patterns that would otherwise exceed Ethereum's contract-size constraints.
This page has no security considerations.
Last updated