snapshot + db backend modifications for use by coreth & subnet-evm #69
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
How this works
This pull request makes changes to the
core/state
andtriedb
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
:snapshotTree
interface to abstract the snapshot handling inStateDB
(core/state/statedb.go
).StateDB
struct to use the newsnapshotTree
interface (core/state/statedb.go
).New
function to handlesnapshotTree
and ensure proper handling ofnil
pointers (core/state/statedb.go
). <-- not sure if there is a better way to handle thisChanges to
triedb
:Config
struct intriedb/database.go
to use interfaces forHashDB
andPathDB
(triedb/database.go
). -- Trying to keep changes minimal esp. to tests.Backend
,HashBackend
, andPathBackend
to define methods for different state schemes (triedb/database/database.go
).NewDatabase
function to use the newBackend
interfaces and handlenil
configurations (triedb/database.go
).triedb/database.go
to use the newBackend
interfaces (triedb/database.go
) [1] [2] [3] [4] [5] [6] [7] [8] [9].New
methods toConfig
structs intriedb/hashdb/database.go
andtriedb/pathdb/database.go
to instantiateHashBackend
andPathBackend
respectively (triedb/hashdb/database.go
) [1] (triedb/pathdb/database.go
) [2].How this was tested
CI