Description
With a restriction that contacts can not start with 0xEF
and with the possibility that in future we will have different ByteCode
for EVM Object Format, it makes sense to introduce support for it into the revm. https://eips.ethereum.org/EIPS/eip-3541
The biggest benefit atm would be introducing ByteCode
type that will contain jumptable and gas blocks and with that we would skip the needed analysis of the contract. This is a fairly big speed-u for some use cases noticed in the foundry as fuzzing tests call a lot of contracts with not much execution and analysis, in that case, is taking a lot of time.
The proposal is to introduce enum ByteCode
that would somehow return: code
, code_size
and jumptable
.
Basically replace this input with ByteCode
:
and propagate change wherever needed.
ByteCode
should set these fields in the contract:
revm/crates/revm/src/interpreter/contract.rs
Lines 11 to 13 in 0852824
and do the same for database struct:
- Return
ByteCode
:revm/crates/revm/src/db/traits.rs
Line 14 in 0852824
- Replace bytes with
BytesCode
:revm/crates/revm/src/models.rs
Line 24 in 0852824
To fully circle the story with EVM Object Format, CREATE and CREATE2 will need to return 0xEF type format in bytes that would get transformed to ByteCode
for evm usage here:
revm/crates/revm/src/evm_impl.rs
Lines 395 to 399 in 0852824
But this is a consensus rule and out of scope for this feat, we should just continue using legacy
ByteCode
here. If needed we could in Inspector create_end
transform that into ByteCode
.