seed_current_epoch_start

Function seed_current_epoch_start 

Source
pub fn seed_current_epoch_start(
    schema: &RpcStoreSchema,
    objects: &dyn ObjectStore,
    start_checkpoint: Option<u64>,
    batch: &mut Batch,
) -> Result<u64>
Expand description

Stage a start record for the epoch reflected by the on-chain SuiSystemState in objects, keyed by that epoch.

The epochs pipeline derives a start record only from an end-of-epoch checkpoint’s epoch_info, which a restore-then-tip flow never processes (tip indexing resumes at anchor + 1), so a freshly restored database has no start record for the epoch it landed in. This reconstructs that record straight from the restored object set: protocol version, reference gas price, and epoch-start timestamp come from the SuiSystemState, the BCS of which is stored so get_committee and Move type-layout resolution work too.

start_checkpoint is supplied by the caller and may be None. The formal-snapshot restore lands at an epoch boundary, so it passes Some(anchor + 1). The embedded-fullnode restore lands at a mid-epoch tip, so the epoch’s first checkpoint is unknown and it passes None; the upward backfill fills start_checkpoint in later if that boundary falls within the available range.

Stages a merge into batch; the caller commits. Returns the epoch that was seeded.