Skip to content

Wire dig-mirror-coin's census to a ChainSource — a node can record epoch 1 and nothing after it #400

Description

@MichaelTaylor3d

Parent epic: https://github.com/DIG-Network/dig_ecosystem/issues/3173

Task

Give dig-node a dig_chainsource_interface::ChainSource and wire dig_mirror_coin::census to it, so a
node can record epoch n rather than only the genesis epoch.

Why — this is the gap between "the record store exists" and "a node knows its requirement"

Everything around it shipped today:

shipped what it does
dig-mirror-collateral 0.3.0 the arithmetic — required_per_store, the controller, the protocol versioning
dig-mirror-coin 0.7.0 census — counts collateralised stores, owners and locked totals at the census height
dig-node-control-interface 0.24.0 four control methods, including control.collateral.buffer
dig-node PR #398 (26e640d8) the immutable per-epoch record store, peer-record verification, dig.getCollateralEpoch, retention

But dig-node has no dependency on dig-mirror-coin at allgit grep dig-mirror-coin -- '*/Cargo.toml'
returns nothing on origin/main — and does not implement ChainSource. So:

  • bring_up_collateral_records() records epoch 1 only, which is derivable from nothing.
  • dign collateral requirement answers unknown for the current epoch, correctly and indefinitely.
  • Sampled sync cannot cover for it. verify and adopt are complete and tested against forged
    records, but without a chain source the population is unknown, so adopt returns Advisory every
    time and never adopts. The safety property holds; the capability does not arrive.

The consequence worth stating plainly

The epoch-104 output quoted as this family's evidence — 3.780 DIG per store, from 17 advertisement(s) across 820 collateralised owner(s) — rendered a hand-placed record. The command genuinely works and
the arithmetic is right; the provenance was a fixture. That was corrected on the epic
(https://github.com/DIG-Network/dig_ecosystem/issues/3173#issuecomment-5457908969), and this ticket is
what makes such output real.

What to build

  1. A ChainSource implementation in dig-node, or an adapter over what the node already has. Check
    first whether chia-query already satisfies the trait or nearly does — it is the ecosystem's
    canonical coinset access layer, and re-deriving chain reads beside it would be a rival implementation.
  2. Depend on dig-mirror-coin 0.7.0 and call census at the epoch census height.
  3. Write the resulting record through EpochRecordStore::put, which PR feat(collateral): per-epoch record, gossip serve, sampled sync #398 made immutable
    (PutOutcome::Conflict on any differing record) and which already distinguishes bootstrap /
    censused / adopted_from_peers provenance.

What NOT to do

  • Do not restate any arithmetic. required_per_store is the whole answer; equilibrium × multiplier − handicap omits the floor clamp and is wrong as a formula. Call the function.
  • Do not let a census failure become a figure. A node that cannot census says unknown with a
    reason
    — never zero, never a stale neighbouring epoch. Six instances of "an unknown rendered as a
    reassuring answer"
    were found and fixed in this family this week; the newest surface is the easiest
    place for a seventh.
  • Respect the protocol-version ceiling. PR feat(collateral): per-epoch record, gossip serve, sampled sync #398 landed it at two boundaries; a record this code
    writes must carry the version that computed it.

What this unblocks

  • dign collateral requirement answering for the current epoch on a real node.
  • Sampled sync becoming meaningful — with a known population, adopt can do something other than
    Advisory.
  • The wiring lane's own note from PR feat(collateral): per-epoch record, gossip serve, sampled sync #398: cap the collected set at plan.sample_size at the
    collection site
    , so SampleExceeded stays a backstop rather than the primary bound — otherwise one
    identity answering once can deny adoption to everyone.

Acceptance

On a real node with no seeded file: dign collateral requirement reports the current epoch's
requirement, derived from a census this node performed, with provenance: censused and a real
census_height in the record. A node that cannot reach a chain source says unknown with its reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:businessa person can DO something new, or money moves, or a shipped surface stops lying to themmvpgates the releasable MVP

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions