-
-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backfill sync from an anchor checkpoint state (#3384)
* Rebased mpetrunic's PR #2637 with fixes on current master * fixing the remove peer error * refactoring to solve sync stuck issues on not anchored kind of errors * read from db, validate wsCheckpoint * backfill sequences in db to skip redoing previous backfill work * syncrange improvs * feedback cleanup, modular refac of sync function and metrics update * cleanup * Graphana Dashboard * renaming sequences to ranges * rebase cleanup * shortneing comment * using initialize from's return as the anchorState * Fix metrics * Add Aborted enum value in lodestar_backfill_sync_status * Only use JSDoc comment notation for JSDocs * Simplify nullish values to be only null * WIP * refactoring the backfill sync, with parent-child linkage verfication of last previous unverified finalized or wscheckpoint block * cleanup and simplification of checkpoint/prev finalized checks * initializing backfillwritten to avoid previous overwriting with a ahead value * prev finalized or wscheckpoint lookup fix * missing initializtion * better assignment of prev fin or ws checkpoint * don't verify sig on genesis block * making the extractPreviousFinOrWsCheckpoint lighter * simplfication of extractPreviousFinOrWsCheckpoint * improving messaging * metric for prev fin or ws block slot validation * dashboard entry for prev fin or ws checkpoint slot for validation * dashed line for prev fin or ws slot for better clairty * comments cleanup and always backfill Co-authored-by: dapplion <35266934+dapplion@users.noreply.github.com>
- Loading branch information
Showing
32 changed files
with
2,571 additions
and
19 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {IChainForkConfig} from "@chainsafe/lodestar-config"; | ||
import {Slot, ssz} from "@chainsafe/lodestar-types"; | ||
import {IDatabaseController, Bucket, IDbMetrics, Repository} from "@chainsafe/lodestar-db"; | ||
import {bytesToInt} from "@chainsafe/lodestar-utils"; | ||
|
||
/** | ||
* Slot to slot ranges that ensure that block range is fully backfilled | ||
* | ||
* If node starts backfilling at slots 1000, and backfills to 800, there will be an entry | ||
* 1000 -> 800 | ||
* | ||
* When the node is backfilling if it starts at 1200 and backfills to 1000, it will find this sequence and, | ||
* jump directly to 800 and delete the key 1000. | ||
*/ | ||
export class BackfilledRanges extends Repository<Slot, Slot> { | ||
constructor(config: IChainForkConfig, db: IDatabaseController<Uint8Array, Uint8Array>, metrics?: IDbMetrics) { | ||
super(config, db, Bucket.backfilled_ranges, ssz.Slot, metrics); | ||
} | ||
|
||
decodeKey(data: Buffer): number { | ||
return bytesToInt((super.decodeKey(data) as unknown) as Uint8Array, "be"); | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
getId(value: Slot): number { | ||
throw new Error("Cannot get the db key from slot"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.