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

refactor: move ef tests to own testing crate #2847

Merged
merged 5 commits into from
May 26, 2023
Merged

refactor: move ef tests to own testing crate #2847

merged 5 commits into from
May 26, 2023

Conversation

onbjerg
Copy link
Member

@onbjerg onbjerg commented May 25, 2023

Motivation

I wanted to move the EF tests out of the main CLI since it does not make sense that it is user facing, support additional EF tests down the line, and create a new crate namespace specifically for more complex tests

Solution

I moved it to its own crate with abstractions based off of Lighthouse's testing crate. The main idea here is that there are different types of tests in https://github.com/ethereum/tests and we are currently only running a subset. Some of them might be of interest later on, e.g. the trie test, RLP tests and so on

The tests are feature gated to ensure no one accidentally runs them without the required files. The tests can be run with make ef-tests or manually by cloning the tests repo into testing/ef-tests/ethereum-tests and running cargo test -p ef-tests --features ef-tests

The reason for the testing subdirectory is to logically group other larger integration tests later on and possibly build common testing components in there for reuse (e.g. testnets)

I also cleaned up the test runner that was moved over from the CLI a bit so it is easier to reason about

Follow ups

Here are some possible follow ups (I will create issues for each if this is merged):

  • Add the ValidBlocks and InvalidBlocks suites. Currently we don't run these, presumably because they are formatted a bit different, but it might be worth runing them regardless. A new Suite type can be implemented for this if needed
  • Add the TransitionTests suite for testing fork transitions (we can't do this rn either)
  • Calculate the state root when there is no post state for the test cases, currently we don't do this, I am not sure why.

@onbjerg onbjerg added C-debt Refactor of code section that is hard to understand or maintain C-test A change that impacts how or what we test A-cli Related to the reth CLI labels May 25, 2023
@onbjerg onbjerg requested a review from gakonst as a code owner May 25, 2023 21:47
@codecov-commenter
Copy link

codecov-commenter commented May 25, 2023

Codecov Report

Merging #2847 (b5f4189) into main (d6ccab1) will decrease coverage by 0.01%.
The diff coverage is 23.56%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main    #2847      +/-   ##
==========================================
- Coverage   71.44%   71.44%   -0.01%     
==========================================
  Files         506      510       +4     
  Lines       66256    66213      -43     
==========================================
- Hits        47339    47304      -35     
+ Misses      18917    18909       -8     
Flag Coverage Δ
integration-tests 17.49% <22.89%> (+0.10%) ⬆️
unit-tests 66.29% <0.67%> (-0.12%) ⬇️

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

Impacted Files Coverage Δ
bin/reth/src/cli.rs 20.98% <ø> (+0.25%) ⬆️
bin/reth/src/lib.rs 100.00% <ø> (ø)
testing/ef-tests/src/assert.rs 0.00% <0.00%> (ø)
testing/ef-tests/src/models.rs 28.81% <1.31%> (ø)
testing/ef-tests/src/cases/blockchain_test.rs 4.76% <4.76%> (ø)
testing/ef-tests/src/case.rs 42.85% <42.85%> (ø)
testing/ef-tests/src/result.rs 68.62% <68.62%> (ø)
testing/ef-tests/src/suite.rs 92.30% <92.30%> (ø)
testing/ef-tests/src/lib.rs 100.00% <100.00%> (ø)

... and 11 files with indirect coverage changes

Copy link
Member

@gakonst gakonst left a comment

Choose a reason for hiding this comment

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

Love it

Comment on lines +119 to +122
Some(RootOrState::Root(root)) => {
// TODO: We should really check the state root here...
println!("Post-state root: #{root:?}")
}
Copy link
Member

Choose a reason for hiding this comment

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

@rkrasiuk :D let's add a state root check?

@gakonst
Copy link
Member

gakonst commented May 26, 2023

Really great cleanup 💯

@gakonst gakonst added this pull request to the merge queue May 26, 2023
Merged via the queue into main with commit cb829be May 26, 2023
@gakonst gakonst deleted the onbjerg/ef-tests branch May 26, 2023 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Related to the reth CLI C-debt Refactor of code section that is hard to understand or maintain C-test A change that impacts how or what we test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants