You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit implements the logic to compute root hashes for hot state. It's an initial version with a number of TODO items, but it's a reasonable start. Most of the logic is gated behind a flag so we are not enabling this in mainnet yet, until we run things in testnet for some time and gain more confidence.
How this roughly works:
- `State::update` computes the changes to hot state. They are saved in `ExecutionOutput`.
- The above changes are passed to `StateSummary::update` and used to compute in-memory `SparseMerkleTree`.
- The resulting Merkle trees are committed to persisted database (`hot_state_merkle_db` introduced in #18385) so the proofs can be used in turn for future `StateSummary::update`.
Copy file name to clipboardExpand all lines: config/src/config/storage_config.rs
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -245,13 +245,17 @@ pub struct HotStateConfig {
245
245
pubmax_items_per_shard:usize,
246
246
/// Whether to delete persisted data on disk on restart. Used during development.
247
247
pubdelete_on_restart:bool,
248
+
/// Whether we compute root hashes for hot state in executor and commit the resulting JMT to
249
+
/// db.
250
+
pubcompute_root_hash:bool,
248
251
}
249
252
250
253
implDefaultforHotStateConfig{
251
254
fndefault() -> Self{
252
255
Self{
253
256
max_items_per_shard:250_000,
254
257
delete_on_restart:true,
258
+
compute_root_hash:true,
255
259
}
256
260
}
257
261
}
@@ -658,6 +662,13 @@ impl ConfigOptimizer for StorageConfig {
658
662
{
659
663
panic!("Storage sharding (AIP-97) is not enabled in node config. Please follow the guide to migration your node, and set storage.rocksdb_configs.enable_storage_sharding to true explicitly in your node config. https://aptoslabs.notion.site/DB-Sharding-Migration-Public-Full-Nodes-1978b846eb7280b29f17ceee7d480730");
660
664
}
665
+
// TODO(HotState): Hot state root hash computation is off by default in Mainnet unless
0 commit comments