bluealloy / revm

Rust implementation of the Ethereum Virtual Machine.
https://bluealloy.github.io/revm/
MIT License
1.64k stars 551 forks source link

feat(EOF): Bytecode::new_raw supports EOF, new_raw_checked added #1607

Closed rakita closed 3 months ago

rakita commented 3 months ago

Bytecode::new_raw now support EOF bytecode and will panic on invalid EOF code. In most cases, the validity of EOF is not questioned as validity is checked inside EVM.

An alternative safe function new_raw_checked was added that returns EofDecodeError if an invalid EOF bytecode can happen.

Bytecode::new_legacy to force legacy bytecode.

github-actions[bot] commented 3 months ago

Valgrind Results:

==3962== Cachegrind, a cache and branch-prediction profiler
==3962== Copyright (C) 2002-2017, and GNU GPL'd, by Nicholas Nethercote et al.
==3962== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==3962== Command: target/release/snailtracer
==3962== 
--3962-- warning: L3 cache found, using its data for the LL simulation.
Running snailtracer example!
elapsed: 1.857832964s
==3962== 
==3962== I   refs:      427,041,912
==3962== I1  misses:          3,402
==3962== LLi misses:          2,835
==3962== I1  miss rate:        0.00%
==3962== LLi miss rate:        0.00%
==3962== 
==3962== D   refs:      204,077,616  (132,269,149 rd   + 71,808,467 wr)
==3962== D1  misses:        340,092  (    200,092 rd   +    140,000 wr)
==3962== LLd misses:        137,814  (      4,493 rd   +    133,321 wr)
==3962== D1  miss rate:         0.2% (        0.2%     +        0.2%  )
==3962== LLd miss rate:         0.1% (        0.0%     +        0.2%  )
==3962== 
==3962== LL refs:           343,494  (    203,494 rd   +    140,000 wr)
==3962== LL misses:         140,649  (      7,328 rd   +    133,321 wr)
==3962== LL miss rate:          0.0% (        0.0%     +        0.2%  )