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

snapshot + db backend modifications for use by coreth & subnet-evm #69

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

Conversation

darioush
Copy link
Collaborator

@darioush darioush commented Nov 12, 2024

Why this should be merged

  • subnet-evm / coreth use block hash based snapshots,
  • subnet-evm / coreth use modified hashdb (and later pathdb) backends so we can pass these in

How this works

This pull request makes changes to the core/state and triedb packages to enhance the flexibility of the state management and database handling. The changes involve introducing new interfaces, updating function implementations.

Changes to core/state:

  • Introduced the snapshotTree interface to abstract the snapshot handling in StateDB (core/state/statedb.go).
  • Updated the StateDB struct to use the new snapshotTree interface (core/state/statedb.go).
  • Modified the New function to handle snapshotTree and ensure proper handling of nil pointers (core/state/statedb.go). <-- not sure if there is a better way to handle this

Changes to triedb:

  • Refactored the Config struct in triedb/database.go to use interfaces for HashDB and PathDB (triedb/database.go). -- Trying to keep changes minimal esp. to tests.
  • Introduced new interfaces Backend, HashBackend, and PathBackend to define methods for different state schemes (triedb/database/database.go).
  • Updated the NewDatabase function to use the new Backend interfaces and handle nil configurations (triedb/database.go).
  • Simplified various methods in triedb/database.go to use the new Backend interfaces (triedb/database.go) [1] [2] [3] [4] [5] [6] [7] [8] [9].
  • Added New methods to Config structs in triedb/hashdb/database.go and triedb/pathdb/database.go to instantiate HashBackend and PathBackend respectively (triedb/hashdb/database.go) [1] (triedb/pathdb/database.go) [2].

How this was tested

CI

@darioush darioush changed the title Darioush/state snapshot + db backend modifications for use by coreth & subnet-evm Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants