Skip to documentation
Browse documentation Backfill workflow

Workflow / New indexer

Build offline. Prove the backfill. Then join live.

A new protocol decoder, security rule, or derived index should not begin at today's ledger and ignore the history already retained. Stargazer's target workflow replays every new module against the local archive, validates the result in isolation, catches it up to the live watermark, and only then promotes it.

01 / Lifecycle

One path from first fixture to live operation.

  1. 01
    Define Planned

    Version the module, its accepted facts, output schema, and supported code hashes.

  2. 02
    Fixture In progress

    Capture representative real ledgers and exact expected outputs.

  3. 03
    Backfill Planned

    Replay the local archive into isolated staging storage with delivery disabled.

  4. 04
    Validate Planned

    Check continuity, idempotency, parser coverage, errors, and output invariants.

  5. 05
    Catch up Planned

    Process the gap between the archive high-water mark and the current live checkpoint.

  6. 06
    Publish Planned

    Atomically promote the materialization and enable the same version on the live tail.

02 / Module contract

Version behavior, not just code.

Each indexing module should declare enough information to reproduce a finding later:

FieldPurpose
module_idStable identity for a protocol decoder, generic fact extractor, or rule.
module_versionImmutable behavior version attached to every derived row.
schema_versionExpected storage contract and migration boundary.
recognized_wasmExact code hashes a protocol-specific decoder understands.
input_factsNormalized chain facts required before the module can run.
coverageNetwork, ledger range, contracts, and known exclusions for the materialization.

An unknown Wasm hash must continue through generic indexing and create a coverage finding. It must not be decoded silently with the closest known interface.

03 / Fixtures and benchmarks

Start with difficult, real ledgers.

  1. Choose representative history. Include high-transaction ledgers, failed invocations, fee bumps, deep authorization trees, upgrades, and restorations.
  2. Pin the raw evidence. Record ledger hashes, archive paths, transaction hashes, and checksums outside generated databases.
  3. Assert semantic outputs. Test exact wallet-contract links, protocol attribution, executable transitions, and known negative cases.
  4. Measure the cost. Compare ledgers per second, decoded bytes, database growth, write amplification, and peak memory.
  5. Replay twice. The second pass must leave counts and materialized state unchanged.

04 / Isolated backfill

Never mutate the active projection in place.

Active generation Module v1 + live watermark
Staging generation Module v2 + archive replay
Catch-up buffer Archive high-water → live
Atomic promotion v2 becomes active

Staging can be a new database, a versioned table set, or a separate storage generation. The key property is that readers see either the complete old generation or the complete validated new generation—never a partially rebuilt mixture.

05 / Promotion gate

What must pass before live activation.

  • the full target ledger range is contiguous and hash-chain consistent;
  • all fixtures match their exact expected facts and findings;
  • duplicate replay changes no counts, versions, or alert identities;
  • parser errors and unsupported code hashes are counted and reviewable;
  • archive and live source outputs agree over an overlapping sample;
  • the new projection covers the live high-water mark or a documented handoff ledger;
  • read queries and indexes meet their bounded latency and memory budgets;
  • historical delivery remains disabled throughout replay.

06 / Alert semantics

Historical detection is not a new incident.

A backfill may discover an old upgrade, control change, or incident exposure. That finding belongs in the evidence database and can appear in a retrospective report, but it must carry historical provenance and delivery_enabled = false. Only findings produced after the promoted live handoff are eligible for normal notification policy.