Rollup node: compact snapshots with context reconstruction
What
This MR introduces an option --compact
to the snapshot export
command to produce smaller snapshots for the rollup node.
Fixes #6818 (closed).
Why
The snapshots produced this way are smaller in size (by a factor at least 3) because they contain a single commit for the context corresponding to the first available level. Replaying the history of the context on import also guarantees that the PVM state is correct (if the L2 blocks of the snapshots are also).
How
On import, the context is reconstructed by replaying all L2 blocks since the first available level. This takes longer than importing a snapshot produced without --compact
(a few minutes instead of seconds). The correctness of the imported data is still checked afterwards but this phase is much quicker (a few seconds).
Example on ghostnet etherlink for "full" snapshot
Compact | size | export | import |
---|---|---|---|
No | 1.4 GB | 50s | 20s |
Yes | 416 MB | 39s | 6m53s |
Manually testing the MR
dune exec tezt/tests/main.exe -- -f sc_rollup.ml snapshot compact -i