seed_history_cohort

Function seed_history_cohort 

Source
pub fn seed_history_cohort(
    db: &Db,
    schema: &RpcStoreSchema,
    history_watermark: Watermark,
    chain_id: ChainId,
    objects: Option<&dyn ObjectStore>,
) -> Result<()>
Expand description

Seed the framework state for the embedded fullnode’s HISTORY_COHORT after restore_indexes has bulk-loaded the LIVE_COHORT.

The live cohort resumes from the restore target T (written by the restore driver’s finalize step). The history cohort is not restored; instead each of its pipelines is seeded to history_watermark — the lowest available checkpoint L in the perpetual store — so tip indexing backfills (L, T] from the perpetual store and then follows live. For each history pipeline this writes:

  • __watermark = history_watermark — the framework resumes at history_watermark.checkpoint_hi_inclusive + 1.
  • __chain_id = chain_id — pins the chain, matching what the restore driver wrote for the live cohort.

When objects is supplied, also seeds the current epoch’s epochs row from its on-chain SuiSystemState — a partial start record without start_checkpoint (see seed_current_epoch_start) — so get_epoch / get_committee and Move type-layout resolution work immediately after restore rather than only once the backfill reaches the epoch’s boundary. objects is read through the ObjectStore trait, so the embedded caller passes the validator’s perpetual store directly (this crate stays free of any sui-core dependency).

Stamps the singleton pruning_watermark at the lowest available checkpoint L — the first checkpoint the backfill will index, history_watermark.checkpoint_hi_inclusive + 1 — with tx_seq_lo = history_watermark.tx_hi (the first tx_seq that checkpoint contributes). This records that nothing below L is available and sets the bitmap compaction filter’s floor. The backfill only ever writes tx_seq at or above the floor, so the filter drops nothing it produces. (The upper bound of history availability while a backfill is in progress is a separate concern, handled elsewhere.)

Idempotent: re-running overwrites the same rows. Does not touch the live cohort or the deactivated (perpetual-store-served) CFs.