8000 test(ethhash): Use libevm by alarso16 · Pull Request #900 · ava-labs/firewood · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

test(ethhash): Use libevm #900

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

test(ethhash): Use libevm #900

wants to merge 3 commits into from

Conversation

alarso16
Copy link
Contributor
@alarso16 alarso16 commented May 21, 2025

Instead of importing go-ethereum, libevm has the same functionality, but maintained by us. Upon editing the file, there were additionally lint changes needed, as well as adding account changes to better emulate use cases.

@alarso16 alarso16 requested a review from Copilot May 21, 2025 17:40
Copilot

This comment was marked as resolved.

@alarso16 alarso16 requested a review from Copilot May 21, 2025 18:05
Copilot

This comment was marked as resolved.

@alarso16 alarso16 added testing c-chain go Pull requests that update go code labels May 21, 2025
@alarso16 alarso16 force-pushed the alarso16/libevm-eth-test branch from e05c528 to 5929fc9 Compare May 21, 2025 18:14
@alarso16 alarso16 marked this pull request as ready for review May 21, 2025 18:18
fwKeys = append(fwKeys, accHash[:])
encodedVal, err := rlp.EncodeToBytes(acc)
require.NoError(t, err)
fwVals = append(fwVals, encodedVal)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

How does this NOT change the hash???

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah yes, you found some of the ethhash magic. It doesn't matter what the hash is inside the data for an account. We compute the correct value and use that to hash the trie.

I was mistaken earlier when I stated that we never look at the data. We do some magic RLP encoding stuff to ensure compatibility with the hash at the top level, and we don't care what that hash is inside the data when computing the hash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-chain go Pull requests that update go code testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0