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

feat(consume): enable loading of ethereum/tests/BlockchainTests #596

Conversation

danceratopz
Copy link
Member

@danceratopz danceratopz commented Jun 6, 2024

🗒️ Description

Enables loading ethereum/tests/BlockchainTests (except for 5 json files that define invalid fields via "bigint").

  1. Makes post_state an optional field in blockchain fixtures.
  2. Adds a list of fixtures to skip in genindex (the fixtures here all currently use bigint to define invalid fields in json).
  3. Updates hasher to use _info["generatedTestHash"] as a synonym for _info["hash"] (this allows genindex to check whether the index.json is up-to-date for ethereum/tests; otherwise it must be regenerated every time).

This requires: ethereum/tests#1380.

Test loading of fixtures into EEST pydantic models with:

genindex -i ~/path/to/ethereum/tests/BlockchainTests/

Expected output:

Skipping '/home/dtopz/code/github/ethereum/tests/BlockchainTests/GeneralStateTests/stTransactionTest/ValueOverflowParis.json'
Skipping '/home/dtopz/code/github/ethereum/tests/BlockchainTests/InvalidBlocks/bc4895-withdrawals/withdrawalsAmountBounds.json'
Skipping '/home/dtopz/code/github/ethereum/tests/BlockchainTests/InvalidBlocks/bc4895-withdrawals/withdrawalsIndexBounds.json'
Skipping '/home/dtopz/code/github/ethereum/tests/BlockchainTests/InvalidBlocks/bc4895-withdrawals/withdrawalsValidatorIndexBounds.json'
Skipping '/home/dtopz/code/github/ethereum/tests/BlockchainTests/InvalidBlocks/bc4895-withdrawals/withdrawalsAddressBounds.json'
Indexing complete 🦄       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:48

The resulting index.json file contains 22953 tests.

🔗 Related Issues

#572

✅ Checklist

  • All: Set appropriate labels for the changes.
  • All: Considered squashing commits to improve commit history.
  • All: Added an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.
  • Tests: All converted JSON/YML tests from ethereum/tests have been added to converted-ethereum-tests.txt.
  • Tests: Included the type and version of evm t8n tool used to locally execute test cases: e.g., ref with commit hash or geth 1.13.1-stable-3f40e65.
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.

@danceratopz danceratopz added type:feat type: Feature scope:consume Scope: Consume command suite scope:fw Scope: Framework (evm|tools|forks|pytest) labels Jun 6, 2024
Copy link
Collaborator

@spencer-tb spencer-tb left a comment

Choose a reason for hiding this comment

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

LGTM! Amazing that we can run these now :D

@spencer-tb
Copy link
Collaborator

My only confusion surrounding this is why hive/consensus has >100k tests where as we only have ~20k.

Is it 22953 test files maybe? Will have another look

@spencer-tb spencer-tb requested a review from marioevz June 7, 2024 04:56
@danceratopz
Copy link
Member Author

danceratopz commented Jun 7, 2024

My only confusion surrounding this is why hive/consensus has >100k tests where as we only have ~20k.

Is it 22953 test files maybe? Will have another look

Good question! @winsvega moved non-Cancun tests to "legacy tests" in the ethereum/tests branch being used here. We should try loading those tests too.

Copy link
Member

@marioevz marioevz left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@winsvega
Copy link
Collaborator

winsvega commented Jun 8, 2024

My only confusion surrounding this is why hive/consensus has >100k tests where as we only have ~20k.
Is it 22953 test files maybe? Will have another look

Good question! @winsvega moved non-Cancun tests to "legacy tests" in the ethereum/tests branch being used here. We should try loading those tests too.

This is to save time and to be able to edit existing tests without breaking anything.
Passing legacy tests should be enough to be able to sync with cancun mainnet. If not, then the mainnet covers all cases for up to cancun implementation.

The main tests are on >=Cancun to ensure that from current point on there will be no async hardforks. Thats why we focus on those.

@spencer-tb
Copy link
Collaborator

Perfect! Yeah this makes a lot of sense. There is no point in maintaining the older fork versions of the tests in my eyes.

But still a nice to have!

We should try loading those tests too.

Agreed!

Happy for you to merge this :)

danceratopz and others added 3 commits June 11, 2024 15:04
Co-authored-by: spencer <spencer.taylor-brown@ethereum.org>
@danceratopz danceratopz merged commit 2df7dea into ethereum:main Jun 11, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:consume Scope: Consume command suite scope:fw Scope: Framework (evm|tools|forks|pytest) type:feat type: Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants