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

eof: Detect unused inputs #1122

Closed
wants to merge 1 commit into from
Closed

eof: Detect unused inputs #1122

wants to merge 1 commit into from

Conversation

chfast
Copy link
Member

@chfast chfast commented Feb 4, 2025

Add one more EOF validation rule: all code section inputs must be used. This is validated by tracking if any instruction in the code section reaches the stack bottom (height 0).

Spec issue: ipsilon/eof#176.

Copy link

codecov bot commented Feb 4, 2025

Codecov Report

Attention: Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.

Project coverage is 25.54%. Comparing base (dd38ff4) to head (173dab9).
Report is 27 commits behind head on master.

Files with missing lines Patch % Lines
lib/evmone/eof.cpp 0.00% 7 Missing ⚠️
test/unittests/eof_validation.cpp 0.00% 2 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (dd38ff4) and HEAD (173dab9). Click for more details.

HEAD has 3 uploads less than BASE
Flag BASE (dd38ff4) HEAD (173dab9)
eof_execution_spec_tests 1 0
unittests 1 0
ethereum_tests 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1122       +/-   ##
===========================================
- Coverage   94.29%   25.54%   -68.76%     
===========================================
  Files         159      159               
  Lines       17343    17352        +9     
===========================================
- Hits        16354     4432    -11922     
- Misses        989    12920    +11931     
Flag Coverage Δ
eof_execution_spec_tests ?
ethereum_tests ?
ethereum_tests_silkpre 18.96% <0.00%> (-0.01%) ⬇️
execution_spec_tests 21.79% <0.00%> (-0.02%) ⬇️
unittests ?

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

Files with missing lines Coverage Δ
lib/evmone/eof.hpp 3.33% <ø> (-96.67%) ⬇️
test/unittests/eof_validation_stack_test.cpp 0.00% <ø> (-100.00%) ⬇️
test/unittests/eof_validation.cpp 0.00% <0.00%> (-93.45%) ⬇️
lib/evmone/eof.cpp 0.34% <0.00%> (-85.45%) ⬇️

... and 119 files with indirect coverage changes

@@ -1241,11 +1241,11 @@ TEST_F(eof_validation, jumpf_to_nonreturning)

// Exactly required inputs on stack at JUMPF
add_test_case(eof_bytecode(3 * OP_PUSH0 + jumpf(1), 3).code(OP_STOP, 3, 0x80, 3),
EOFValidationError::success);
EOFValidationError::unused_input);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessarily urgent, but leaving a comment to not miss - we may maybe want to move such unused_input cases to their separate batch of tests, and rewrite these variants to actually have them use the inputs.

Or, maybe actually writing these tests now could be useful to get more insight into what the change entails.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the plan. I only wanted to list all affected tests.

@pdobacz
Copy link
Contributor

pdobacz commented Feb 18, 2025

another observation - did you maybe check if this breaks any RETF tests (i.e. in EEST?). If not, we're missing tests

Ah, I see in the eof issue - EEST tests only broke with JUMPF, so we're missing tests.

@chfast
Copy link
Member Author

chfast commented Feb 18, 2025

another observation - did you maybe check if this breaks any RETF tests (i.e. in EEST?). If not, we're missing tests

Ah, I see in the eof issue - EEST tests only broke with JUMPF, so we're missing tests.

No. It only breaks similar JUMPF tests.

@chfast
Copy link
Member Author

chfast commented Feb 19, 2025

We will not do this.

@chfast chfast closed this Feb 19, 2025
@pdobacz
Copy link
Contributor

pdobacz commented Feb 20, 2025

@chfast did we settle on whether or not we need new RETF EEST tests. IIUC none broke when you implemented this?

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.

2 participants