ethereum / evmone

Fast Ethereum Virtual Machine implementation
Apache License 2.0
864 stars 286 forks source link

Add heuristic to skip jumpdest analysis #990

Open chfast opened 2 months ago

chfast commented 2 months ago

We can guess that the jumpdest analysis is not needed by inspecting the first opcode. This heuristic has some false negatives but is very cheap and covers EOF. The proof it is correct is done at compile-time.

Bigger idea behind this is to only use the heuristic not to waste time on jumpdest analysis and delay EOF header parsing until execution. This makes the code analysis EVM revision agnostic. Maybe someone can push this idea further.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.30%. Comparing base (080a341) to head (aee1c86). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #990 +/- ## ======================================= Coverage 94.29% 94.30% ======================================= Files 144 144 Lines 16155 16159 +4 ======================================= + Hits 15234 15238 +4 Misses 921 921 ``` | [Flag](https://app.codecov.io/gh/ethereum/evmone/pull/990/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | Coverage Δ | | |---|---|---| | [eof_execution_spec_tests](https://app.codecov.io/gh/ethereum/evmone/pull/990/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | `16.72% <100.00%> (+0.02%)` | :arrow_up: | | [ethereum_tests](https://app.codecov.io/gh/ethereum/evmone/pull/990/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | `26.63% <100.00%> (+0.01%)` | :arrow_up: | | [ethereum_tests_silkpre](https://app.codecov.io/gh/ethereum/evmone/pull/990/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | `18.69% <100.00%> (+0.01%)` | :arrow_up: | | [execution_spec_tests](https://app.codecov.io/gh/ethereum/evmone/pull/990/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | `17.78% <100.00%> (+0.02%)` | :arrow_up: | | [unittests](https://app.codecov.io/gh/ethereum/evmone/pull/990/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | `89.74% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files with missing lines](https://app.codecov.io/gh/ethereum/evmone/pull/990?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | Coverage Δ | | |---|---|---| | [lib/evmone/baseline\_analysis.cpp](https://app.codecov.io/gh/ethereum/evmone/pull/990?src=pr&el=tree&filepath=lib%2Fevmone%2Fbaseline_analysis.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum#diff-bGliL2V2bW9uZS9iYXNlbGluZV9hbmFseXNpcy5jcHA=) | `100.00% <100.00%> (ø)` | | | [lib/evmone/baseline\_instruction\_table.cpp](https://app.codecov.io/gh/ethereum/evmone/pull/990?src=pr&el=tree&filepath=lib%2Fevmone%2Fbaseline_instruction_table.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum#diff-bGliL2V2bW9uZS9iYXNlbGluZV9pbnN0cnVjdGlvbl90YWJsZS5jcHA=) | `100.00% <100.00%> (ø)` | | | [test/unittests/instructions\_test.cpp](https://app.codecov.io/gh/ethereum/evmone/pull/990?src=pr&el=tree&filepath=test%2Funittests%2Finstructions_test.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum#diff-dGVzdC91bml0dGVzdHMvaW5zdHJ1Y3Rpb25zX3Rlc3QuY3Bw) | `88.88% <ø> (ø)` | |