Hierarchical Differential State Storage & Regeneration #7629
Replies: 2 comments 1 reply
-
Looks great!!! I do have some questions surrounding the In addition to the analytical solution I think we should also do some empirical differential testing to understand this from a practical perspective. Like there may be some unforeseen system-level implications to the reconstruction that are not captured by the equation. |
Beta Was this translation helpful? Give feedback.
-
@nazarhussain In your slot 700 example, why isn't slot 640 in layer 1 used in the reconstruction? Isn't it be 512->640->672->696? Also to clarify, the diffs we are storing in each differential layer is the diff between slot i, and the closest slot to i in the layer one level below right? So in your example, the object layer 3 stores at 696 is the diff between state 696 and state 672 in layer 2. The object layer 2 stores at 672 is the diff between state 672 and state 640 in layer 1. Is this correct? I also want to know if this hdiff proposal will store unfinalized states as well? My impression is that unfinalized state enquiry are served by state cache. Only finalized states are stores in hdiff storage And how does #7005 play a role here if at all? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Motivation
A hierarchical differential approach—where we store full snapshots only at certain intervals and keep diffs at more frequent intervals—can drastically reduce storage requirements while still enabling historical reconstruction.
Proposed Solution
This solution introduces a multi-layered approach to storing and retrieving historical data in Lodestar. By combining large snapshot intervals at the lowest layer with a series of more frequent differential layers above them, clients can reassemble states on-demand without storing every historical snapshot. This balance of full backups and incremental diffs helps keep storage requirements in check while enabling relatively quick recovery of past states or blocks.
Following are the key factors to remember in this solution.
Snapshot Layer
Differential Layers
Shortest Path Reconstruction
N
, the system locates the “nearest” stored diff or snapshot by scanning from the top layer down.N
has a directly stored diff in the highest-frequency layer, the system applies that diff to the next-lower layer’s state, and so on, until eventually reaching a snapshot.N
, the final few blocks are replayed to get the exact state at slotN
.Block Archiving & Retrieval
Example Layer Configuration
512
epochs (lowest layer).128
epochs.32
epochs.8
epochs.Thus, the path from slot
700
to the nearest snapshot might look like (696 <- 672 <- 512). Once we have state at696
we can then replay the block for slot700
to get that state.Following configuration is just for example, in actual implementation we can choose different values based on observation in the real nodes.
Mathematical Estimation of Layer Frequencies
We can use the cost equation (as shown in the references) to balance:
By adjusting:
F
(frequency of snapshots),D_i
(frequency of each differential layer),n
(number of differential layers),We can find a compromise between minimal storage and fast restoration time.
We can capture the whole process into a single value Cost to compare across different input values. Following equation can be used to calculate the Cost involved.
Conclusion
This hierarchical diff-based storage strategy ensures that Lodestar can handle on-demand regeneration of historical data without ballooning disk usage. It strikes a balance between:
By defining a set of layer frequencies (e.g.,
[8, 32, 128, 512]
by default) and systematically storing diffs at each layer, Lodestar can:Once in place, operators can run nodes with partial historical data yet still reconstruct needed states on demand—enabling more lightweight operation than a traditional “archive” node and improving the overall user experience of Lodestar.
Beta Was this translation helpful? Give feedback.
All reactions