Skip to content

Conversation

@alarso16
Copy link
Contributor

Why this should be merged

We should only have one Firewood implementation for coreth and subnet-evm, since all behavior is the same between them. This shares with minimal refactoring to ensure that types don't clash.

How this works

A move and import changes

How this was tested

CI

Need to be documented in RELEASES.md?

No

@alarso16 alarso16 linked an issue Dec 15, 2025 that may be closed by this pull request
@alarso16 alarso16 added cleanup Code quality improvement evm Related to EVM functionality coreth Related to the former coreth standalone repository subnet-evm Related to the former subnet-evm standalone repository technical debt labels Dec 15, 2025
Base automatically changed from alarso16/evm-module to master December 15, 2025 20:41
@alarso16 alarso16 force-pushed the alarso16/shared-firewood branch from 6b31642 to 9ab772f Compare December 15, 2025 20:42
@alarso16 alarso16 marked this pull request as ready for review December 15, 2025 20:43
@alarso16 alarso16 requested a review from a team as a code owner December 15, 2025 20:43
Copilot AI review requested due to automatic review settings December 15, 2025 20:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the Firewood implementation to be shared between coreth and subnet-evm, eliminating code duplication. The implementation is moved to graft/evm/firewood as a common package, with both coreth and subnet-evm now importing from this shared location.

Key changes:

  • Moved Firewood implementation from individual projects to a shared package
  • Renamed Database type to TrieDB to avoid naming conflicts
  • Made trie types (accountTrie, storageTrie) unexported and added wrapper functions for state management

Reviewed changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated no comments.

Show a summary per file
File Description
graft/evm/firewood/triedb.go Renamed Database to TrieDB throughout the implementation
graft/evm/firewood/account_trie.go Made AccountTrie unexported as accountTrie with constructor newAccountTrie
graft/evm/firewood/storage_trie.go Made StorageTrie unexported as storageTrie with constructor newStorageTrie
graft/evm/firewood/state.go Added new NewStateWrapper function to create firewood state database wrapper
graft/evm/firewood/hash_test.go Updated test to use shared implementation and removed duplicate test code
graft/evm/go.mod Added necessary dependencies for the shared firewood package
graft/subnet-evm/* Updated imports to reference shared graft/evm/firewood package
graft/coreth/* Updated imports to reference shared graft/evm/firewood package

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

type AccountTrie struct {
fw *Database
type accountTrie struct {
fw *TrieDB

Choose a reason for hiding this comment

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

excuse my ignorance, what motivated this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clarity between state.Database and triedb.DBOverride

Copy link
Member

@JonathanOppenheimer JonathanOppenheimer left a comment

Choose a reason for hiding this comment

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

There are no functional changes in this PR. Files are moved around, and imports adjusted accordingly. Duplicated code is deleted wholesale.

I am in favor of consolidating all the firewood code into a single place, but not sure if others agree.

@StephenButtolph StephenButtolph added this pull request to the merge queue Dec 16, 2025
Merged via the queue into master with commit e2eb3d0 Dec 16, 2025
52 checks passed
@StephenButtolph StephenButtolph deleted the alarso16/shared-firewood branch December 16, 2025 20:01
@github-project-automation github-project-automation bot moved this to Done 🎉 in avalanchego Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code quality improvement coreth Related to the former coreth standalone repository evm Related to EVM functionality subnet-evm Related to the former subnet-evm standalone repository

Projects

Status: Done 🎉

Development

Successfully merging this pull request may close these issues.

Share coreth's triedb/firewood and testing with subnet-evm

5 participants