allow frontfilling finalized CP block from era file (#6164)

Add support for using era file for the initial checkpoint block.
This should also avoid an error when the beacon node is restarted
before the backfill process has made any progress (#6059).
This commit is contained in:
Etan Kissling 2024-04-10 14:11:07 +02:00 committed by GitHub
parent a561024d88
commit 9bffc51cf6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -1282,7 +1282,10 @@ proc init*(T: type ChainDAGRef, cfg: RuntimeConfig, db: BeaconChainDB,
# blocks from genesis to backfill, if possible. # blocks from genesis to backfill, if possible.
for bid in dag.era.getBlockIds( for bid in dag.era.getBlockIds(
historical_roots, historical_summaries, Slot(0), Eth2Digest()): historical_roots, historical_summaries, Slot(0), Eth2Digest()):
if bid.slot >= backfillSlot: # If backfill has not yet started, the backfill slot itself also needs
# to be served from era files. Checkpoint sync starts from state only
if bid.slot > backfillSlot or
(bid.slot == backfillSlot and bid.root != dag.tail.root):
# If we end up in here, we failed the root comparison just below in # If we end up in here, we failed the root comparison just below in
# an earlier iteration # an earlier iteration
fatal "Era summaries don't lead up to backfill, database or era files corrupt?", fatal "Era summaries don't lead up to backfill, database or era files corrupt?",