Writing

Grandine: Syncing from Non-Finalized Checkpoints

Reading time: 6 minutes

Summary

Grandine currently supports checkpoint sync only from finalized checkpoints. During extended periods of non-finality, the latest finalized checkpoint may become significantly older than the current wall-clock head.

This project will explore adding support for syncing from a trusted non-finalized checkpoint closer to the current head.

Because Grandine was designed around finalized checkpoint startup, it is difficult to determine every required architectural change before attempting the implementation. The project will therefore follow an implementation-first approach: begin with the smallest possible change, identify finalized-checkpoint assumptions as they are encountered, and refine the design based on those findings.

A likely requirement is to distinguish between:

  • the trusted checkpoint used locally to start the node and restrict rollback; and
  • the actual finalized and justified checkpoints used by the consensus protocol.

However, the exact representation and architecture will be determined through implementation and review rather than treated as fixed upfront.

The initial technical investigation and possible design directions are documented in the Draft Design Document.

Motivation

Finalized checkpoint sync provides a safe and efficient way to bootstrap a beacon node. However, during extended periods of non-finality, syncing from the latest finalized checkpoint may leave a node far behind the current chain head.

Supporting startup from a trusted checkpoint ahead of finality could improve node recovery and reduce the amount of history that must be processed during prolonged non-finality incidents.

Grandine currently assumes that the startup checkpoint is finalized. This assumption appears across checkpoint loading, fork-choice initialization, storage, P2P status, and sync logic.

The project will investigate which of these assumptions must change to support non-finalized startup safely, while avoiding unnecessary refactors.

Implementation Approach

This project will follow an implementation-first and exploratory approach. Grandine was not originally designed to initialize from a non-finalized checkpoint, so some constraints and edge cases will only become clear while attempting the implementation. The goal is to make the least invasive change that achieves the desired functionality. The work will begin with a small implementation spike focused on:

  • loading a selected non-finalized block and state;
  • passing the checkpoint through the existing startup path;
  • identifying where finalized-checkpoint assumptions prevent initialization or syncing;
  • making only the changes required to unblock the next stage;
  • validating each change with focused tests;
  • and refining the design document based on implementation findings.

The current draft design document should therefore be treated as a record of the initial research and possible design directions, not as a fixed specification.

Implementation changes will be divided into small, reviewable pull requests so the Grandine team can provide feedback as the work develops.

Initial Areas of Investigation

The first implementation attempts will focus on understanding how non-finalized startup affects:

  • remote checkpoint loading;
  • checkpoint block and state validation;
  • fork-choice initialization;
  • finalized and justified checkpoint handling;
  • forward-sync boundaries;
  • P2P status reporting;
  • storage and restart behaviour;
  • and block ancestry validation.

A possible outcome may involve maintaining a local trusted checkpoint separately from the on-chain finalized and justified checkpoints. However, this will be introduced only if the implementation shows that such a distinction is necessary.

Project Scope

In Scope

  • Investigate loading a checkpoint using a configurable state or block identifier.
  • Attempt startup from a trusted non-finalized block and state.
  • Identify finalized-checkpoint assumptions in the existing startup and sync paths.
  • Make the minimum required changes to support non-finalized startup.
  • Preserve existing finalized checkpoint-sync behaviour.
  • Ensure Grandine does not incorrectly report the trusted checkpoint as protocol-finalized.
  • Add focused unit and integration tests as implementation changes are introduced.
  • Document findings, limitations, and design decisions discovered during implementation.
  • Submit changes as small, reviewable pull requests.

Out of Scope

  • Automatic discovery of trusted checkpoint providers.
  • Automatically trusting non-finalized checkpoints.
  • Resolving conflicting checkpoints from multiple providers.
  • Redesigning weak-subjectivity checkpoint distribution.
  • Large architectural refactors that are not required for the initial functionality.
  • Full historical back-sync unless it becomes necessary for the first implementation.
  • Arbitrary checkpoint selection unless supported naturally by the existing architecture.
  • A complete redesign of Grandine’s storage or fork-choice systems.

Deliverables

The expected deliverables are:

  1. An implementation spike demonstrating how far the current startup flow can proceed with a non-finalized checkpoint.
  2. Documentation of the finalized-checkpoint assumptions discovered during implementation.
  3. A minimal implementation supporting startup from a trusted non-finalized checkpoint, where feasible.
  4. Small pull requests covering the necessary checkpoint loading, fork-choice, sync, P2P, or storage changes.
  5. Tests covering the behaviour introduced by each implementation stage.
  6. Documentation explaining how the feature works, its trust assumptions, and its known limitations.
  7. An updated design document reflecting the actual implementation findings.

The exact internal types and abstractions will be determined during implementation and review.

Implementation Milestones

Milestone 1 - Implementation spike

  • Add or reuse a way to select a checkpoint state or block.
  • Load a selected non-finalized checkpoint from a remote beacon node.
  • Validate the downloaded block and state.
  • Attempt to pass the checkpoint through Grandine’s current startup path.
  • Record every point where the current code assumes the checkpoint is finalized.
  • Preserve the existing finalized checkpoint-sync path.

Milestone 2 - Minimal startup support

  • Make the smallest changes required to initialize from the selected checkpoint.
  • Preserve the real finalized and justified checkpoints from the downloaded state where required.
  • Prevent the node from treating the trusted startup checkpoint as protocol-finalized.
  • Add focused tests for checkpoint loading and startup.
  • Submit the first small implementation PRs for review.

Milestone 3 - Sync and protocol behaviour

Based on findings from the first two milestones:

  • update forward-sync boundaries where necessary;
  • audit P2P finalized checkpoint reporting;
  • verify fork-choice and ancestry behaviour;
  • investigate storage and restart requirements;
  • add integration and negative tests;
  • refine the implementation based on Grandine team feedback.

Milestone 4 - Documentation and integration

  • Document the final implementation approach.
  • Describe the trust assumptions and initial limitations.
  • Update the design document based on the implementation.
  • Address review feedback.
  • Prepare the implementation for integration where feasible.

Expected Outcome

The intended outcome is for Grandine to start from a trusted non-finalized checkpoint without incorrectly treating that checkpoint as protocol-finalized. The exact internal architecture will depend on what is discovered during implementation.

At minimum, the project should produce:

  • a clearer understanding of the finalized-checkpoint assumptions in Grandine;
  • an implementation attempt using the least invasive changes possible;
  • tested code for the parts of non-finalized checkpoint startup that can be supported safely;
  • and documentation of any remaining blockers or future work.

Risks and Open Questions

The main risks and open questions include:

  • how deeply finalized-checkpoint assumptions are embedded in Grandine;
  • whether non-finalized startup can be supported without major fork-choice changes;
  • whether the selected checkpoint must be at an epoch boundary;
  • how the trusted checkpoint should be represented internally;
  • whether a separate local irreversible checkpoint is necessary;
  • how checkpoint information should survive a restart;
  • whether historical back-sync can remain unchanged;
  • how sync lower bounds should be selected;
  • and how the CLI should communicate the trust assumptions clearly.

These questions will be answered progressively through implementation and review rather than being fully resolved before coding begins.

The initial research and possible approaches are available in the Open Questions section of the design document.

Development and Review Strategy

The work will be submitted through small pull requests rather than one large implementation. A possible PR sequence is:

  1. checkpoint state or block selection;
  2. remote loading and validation;
  3. minimal startup-path changes;
  4. fork-choice or ancestry fixes discovered during implementation;
  5. sync-boundary updates;
  6. P2P and status corrections;
  7. storage or restart support;
  8. documentation and integration tests.

This sequence is not fixed. It will be adjusted based on implementation findings and feedback from the Grandine team.

Supporting Documents and Resources I used

Originally published on HackMD . Comments and discussion live there.