This repository was archived by the owner on Nov 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 160
feat: Enable Firewood in the EVM #959
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ceyonur
reviewed
May 29, 2025
3bb26dc to
bc96ee6
Compare
alarso16
commented
Jul 1, 2025
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file was adapted from Firewood's fuzz testing for the ethhasher. This could contain additional databases (e.g. PathDB) if necessary.
Contributor
Author
aiden94a
added a commit
to aiden94a/firewood
that referenced
this pull request
Sep 23, 2025
This PR renames the FFI package to match the directory. Ref ava-labs/coreth#959 (comment)
night-hacker630n5
added a commit
to night-hacker630n5/firewood
that referenced
this pull request
Sep 29, 2025
This PR renames the FFI package to match the directory. Ref ava-labs/coreth#959 (comment)
infinity-smithpl
added a commit
to infinity-smithpl/firewood
that referenced
this pull request
Oct 24, 2025
This PR renames the FFI package to match the directory. Ref ava-labs/coreth#959 (comment)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
database upgrade
Requires database upgrade
Do not merge
enhancement
New feature or request
go
Pull requests that update go code
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why this should be merged
This is the first step to enable Firewood on the C-Chain. This provides all the necessary EVM constructions to function during consensus.
To review, I recommend you start with:
triedbusingcore/state/database.gofirewood.go,proposal.goandrevision.gofiles, as well as the tests.Next steps for integration
How this works
This interfaces with the Go FFI for Firewood and hooks into
triedbto enable normal operations of the EVM. The operation is very similar to that of HashDB, with a few differences:Trieimplementation (seecore/state/database.goin coreth+libevm) since the geth implementation requires tracking intermediate nodes (which is unnecessary with firewood).Trie, a wrapper is used to intercept requests for the trie in the state database. It simply checks whether we're using Firewood currently tocore/state/database_test.go, which compares the hash output to HashDB.avalanchego/chainDataas well)ethdb. This is required to be able to transfer the string fromvm.gotoblockchain.go. This could also be loaded from the chain context, but this is much clearer.ethdbis used is to track genesis. Since HashDB stores this state permanently, it can simply check whether the root is available. Firewood will clean this from disk after X revisions, so we track the genesis root inethdb, so we can easily check later if using the correct genesis root.To run a node, you need a custom config:
You also need to run
go get github.com/ava-labs/coreth@<most-recent-hash> && go mod tidyto prep avalanchego to build. However, if performance is a concern, you should build Firewood locally. The Firewood team is finishing up some more performance improvements before pushing another version.Heres what still needs done/is a little funky and should be especially reviewed:
ethdbso it can be accessed without any additional config changes. This is not my favorite solution, but it's good enough to work for now. This could similarly be retrieved from the chain context, but this would be extremely difficult for tests.GetModifiedAccountsByNumberGetModifiedAccountsByHashStorageRangeAteth_getProofHow this was tested
Borrowed a simple fuzzing test for Trie usage from Firewood to ensure hash-compatibility and integrated Firewood into all tests outside of APIs. Additionally, currently bootstrapping on mainnet and Fuji (executed 14 million and 8 million blocks, respectively)
Need to be documented?
Yes, but this should wait until it's ready to be used in production.
Need to update RELEASES.md?
No.