acuarica / evm

A Symbolic Ethereum Virtual Machine (EVM) bytecode interpreter, parser and decompiler, along with several other utils for programmatically extracting information from EVM bytecode.
https://acuarica.github.io/evm/
MIT License
46 stars 5 forks source link

Support contract code size limit #58

Closed acuarica closed 5 months ago

acuarica commented 6 months ago

Hard fork Spurious Dragon sets the contract size limit to 24,576 bytes defined by EIP-170.[1]

Implement the validation of the contract code size when decoding and decompiling EVM bytecode. The size limit mentioned above should be configurable, such that bytecode operating on non-Ethereum EVM-based blockchains can customize this limit.

This validation should be included at least when reading a bytecode buffer and when reading the bytecode buffer using the CODECOPY instruction.


[1] https://eips.ethereum.org/EIPS/eip-170

acuarica commented 5 months ago

This issue was originally created to validate the Number conversion at [1]. However, this might not be needed given that if the conversion fails the next bytecode[destpc] will also fail.

Closing this.


[1] https://github.com/acuarica/evm/blob/ce49d7b5445c8ccdf26986cb92aa03c60acd1b70/src/step.ts#L460C14-L460C14