[go: up one dir, main page]

Rollup node: Data loss in GC when reorg happens while GC is running

If we have a chain, where B' is the current head:

--- A --- B
     `--- B' (head)

And we start a GC at this point, B will disappear from the store after the GC has finished because it is not on the main chain.

If now a reorg is triggered by a new block C:

--- A --- B --- C (head)
     `--- B'

B is still available for the main daemon loop because the GC has not finished yet (so it is not added to the "fresh" store).

When the GC finishes, the stale store is overwritten and B disappears, leaving the L2 chain in an incomplete state:

--- A     ? --- C (head)
     `--- B'

Worse, the following run of the GC will remove everything that is not reachable from the head, leaving us with just:

          ? --- C (head)