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(fw): Add sha256 hash to fixtures #454

Merged
merged 8 commits into from
Mar 1, 2024

Conversation

marioevz
Copy link
Member

@marioevz marioevz commented Feb 23, 2024

🗒️ Description

Adds sha256 hash calculation to all generated fixtures, by simply converting to JSON string, with ordered keys and without _info, then hashing the string.

I benchmarked all algorithms that hashlib provides using this: https://github.com/SharkyRawr/python-hashlib-benchmark
and surprisingly sha256 was among the fastest ones (I thought it would be md5 but it turns out it's not).

It also adds a nice script that prints the hashes in several forms, the hasher entry-point (see more with hasher -h).

🔗 Related Issues

None

✅ 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.

@marioevz marioevz added scope:tests Scope: Changes EL client test cases in `./tests` type:feat type: Feature scope:fw Scope: Framework (evm|tools|forks|pytest) labels Feb 23, 2024
@spencer-tb
Copy link
Collaborator

spencer-tb commented Feb 26, 2024

Really nice! Played around with this today - I plan to rebase the fixture diff PR onto this branch tomorrow and use:

HashableItem.from_folder(folder_path=args.folder_path)

To create the fixture hash tree within #443.

As these are tightly coupled I'll maybe make a PR here, where we have all the "hashing" related logic within the hasher. This would leave the "differ" to solely focus on comparisons.

I added the info hash to some framework tests here: marioevz#16

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! Docs are really nice

@marioevz marioevz merged commit 7b9ccb9 into ethereum:main Mar 1, 2024
5 checks passed
@marioevz marioevz deleted the add-fixtures-hash branch March 1, 2024 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:fw Scope: Framework (evm|tools|forks|pytest) scope:tests Scope: Changes EL client test cases in `./tests` type:feat type: Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants