refactor(db): use hashed state as canonical state representation (#21115)

Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com>
Co-authored-by: joshieDo <93316087+joshieDo@users.noreply.github.com>
This commit is contained in:
Georgios Konstantopoulos
2026-02-12 13:02:02 -05:00
committed by GitHub
parent 7ff78ca082
commit 121160d248
60 changed files with 4341 additions and 484 deletions

View File

@@ -155,7 +155,7 @@ pub struct NodeConfig<ChainSpec> {
/// All `RocksDB` table routing arguments
pub rocksdb: RocksDbArgs,
/// Storage mode configuration (v2 vs v1/legacy)
/// All storage related arguments with --storage prefix
pub storage: StorageArgs,
}
@@ -355,6 +355,12 @@ impl<ChainSpec> NodeConfig<ChainSpec> {
self
}
/// Set the storage args for the node
pub const fn with_storage(mut self, storage: StorageArgs) -> Self {
self.storage = storage;
self
}
/// Returns pruning configuration.
pub fn prune_config(&self) -> Option<PruneConfig>
where
@@ -398,6 +404,13 @@ impl<ChainSpec> NodeConfig<ChainSpec> {
s = s.with_use_hashed_state(self.storage.use_hashed_state);
if s.use_hashed_state {
s = s.with_storage_changesets_in_static_files(true);
}
if s.storage_changesets_in_static_files {
s = s.with_use_hashed_state(true);
}
s
}