Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add heuristic to skip jumpdest analysis #990

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

chfast
Copy link
Member

@chfast chfast commented Sep 5, 2024

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.

Add `std::optional<evmc_revision> eof_since` to the `instr::traits`
with the information in which EVM revision an instruction has become
valid in EOF.

Using `std::optional` has some inconvenience:
the `std::nullopt` is less-than any concrete value (think "Frontier-1")
while for undefined instructions we rather want to assign +infinity.
Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #990   +/-   ##
=======================================
  Coverage   94.29%   94.30%           
=======================================
  Files         144      144           
  Lines       16155    16159    +4     
=======================================
+ Hits        15234    15238    +4     
  Misses        921      921           
Flag Coverage Δ
eof_execution_spec_tests 16.72% <100.00%> (+0.02%) ⬆️
ethereum_tests 26.63% <100.00%> (+0.01%) ⬆️
ethereum_tests_silkpre 18.69% <100.00%> (+0.01%) ⬆️
execution_spec_tests 17.78% <100.00%> (+0.02%) ⬆️
unittests 89.74% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
lib/evmone/baseline_analysis.cpp 100.00% <100.00%> (ø)
lib/evmone/baseline_instruction_table.cpp 100.00% <100.00%> (ø)
test/unittests/instructions_test.cpp 88.88% <ø> (ø)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant