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

ethhash WIP #807

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft

ethhash WIP #807

wants to merge 18 commits into from

Conversation

rkuris
Copy link
Collaborator

@rkuris rkuris commented Feb 26, 2025

hashednode should really be split into two files so that we aren't doing so many #[cfg(...)] checks inline, but this is a good starting point for adding some tests.

rkuris and others added 16 commits February 26, 2025 13:59
hashednode should really be split into two files so that we aren't doing
so many #[cfg(...)] checks inline, but this is a good starting point for
adding some tests.
Create a hashers module so that we can split out the code needed by
merkledb from the new ethhash option.
Don't recreate the iterator each time, instead consume it using a for
loop.
Added new HashType type alias to decide which compatibilty we need

Tests pass, needs cleanup. Lots of print lines to remove. Doesn't compile without ethhash.

Co-authored-by: Darioush Jalali <darioush@users.noreply.github.com>
The problem here is still some grey areas around when TrieHash is really
required and when HashType is supposed to be used. Added some clippy
allows for useless_conversions which the compiler should optimize away
anyway to work around this, but a better approach might be to use
another method on TrieHash to create a HashType from it rather than just
calling into which can give the clippy warning.
 - Removed some stray comments, added some, and fixed a few others
 - Allowed for compiling successfully regardless of feature flags
 - Left in some trace! calls but gated them with a new logger method
   to check if the log message for trace would be generated to
   prevent calling hex::encode on debug strings (perf)
 - Implemented serde serializer on ethhash for debugging
We now have this transformation down to the two cases we care about and
compute everything in one fell swoop, with no mutable variables. See the
inline comments for exactly how this works.
@rkuris rkuris self-assigned this Mar 6, 2025
@rkuris rkuris added the c-chain label Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants