Skip to content

Carry the recommended $DIG buffer and the node's funding state — the app cannot derive either #35

Description

@MichaelTaylor3d

Parent epic: https://github.com/DIG-Network/dig_ecosystem/issues/3173
Producer: DIG-Network/dig-node#389
Consumer: DIG-Network/dig-app#306 (PR DIG-Network/dig-app#311)

Task

Declare a control method carrying the recommended $DIG buffer and the node's funding state, so
the figure dig-node#389 computes has somewhere to arrive.

Why — the app cannot derive this, and that is a fact about the contract, not a preference

0.23.0 declares control.collateral.requirement, .margin.get and .margin.set. None carries a
buffer, so dig-node#389's output currently has no transport and dig-app#306 has nothing to render.

The tempting alternative — let dig-app derive the buffer from .requirement plus .margin.get plus
the balance — is not expressible from the published contract. control.collateral.requirement's
own description says it plainly:

stores counts qualifying (owner, store, root) advertisements and owners counts distinct owner
puzzle hashes: neither is a node count.

The buffer is pairs_this_node_serves x required_per_store x (1 + margin) plus transition overlap plus
escalation headroom. The first term is this node's served set, which the census figure is
explicitly not, and the overlap term needs reclaim state that nothing exposes at all. A client that
multiplied the network-wide census count by the requirement would produce a confident, badly wrong
number on a money surface.

Two further reasons the node must own it:

  • dign must answer the same question on a headless host, where no notification will ever fire. A
    derivation living in dig-app cannot serve the CLI.
  • Two derivations of one money figure are rival implementations that will disagree, and the one
    that disagrees on a funding warning is the one a user acts on.

What to serve

At minimum: the recommended buffer in DIG base units, the funding state, and enough of the
working that a client can show why — pairs served by this node, required_per_store, the margin in
force, and the horizon the escalation headroom used.

The horizon must be in the payload, not implied. Escalation is bounded at +12.5% per epoch
(UP_STEP_DENOM = 8) and compounds — x1.12 at one epoch, x1.60 at four, x4.62 at thirteen — so the
buffer is meaningless without the horizon it assumed, and a client that cannot state it is asking the
user to trust a magic number.

The three funding states, and only two of them are notifications

state meaning
short now cannot cover the current epoch; stores are already going uncollateralised
dangerously low covers now, cannot cover the next epoch at the escalation ceiling
below recommended buffer fine for several epochs, no cushion — readout only, never a notification

Carry the distinction in the payload rather than leaving a client to re-derive it from thresholds.
A normal node sits in the third state much of the time, and a recurring ignorable alert is how a user
learns to ignore the two that matter.

Unknown is a first-class answer

Follow control.collateral.requirement's existing rule exactly, in its own words: a node that cannot
determine the figure answers unknown WITH the reason — never a zero, which would read as a free
requirement.
Here a zero would read as no buffer needed, which is the money-lie failure in its
purest form. A node that does not know its store set, its requirement, or its reclaim state says so.

Shape question to settle, not to guess

Extend control.collateral.requirement's result, or add control.collateral.buffer? Extending is
additive and cheaper, but the requirement is a consensus-derived figure while the buffer is
local and margin-dependent — and 0.23.0 deliberately kept the margin out of .requirement on
exactly that grounds ("It NEVER returns the local safety margin, which is not a consensus value").
That reasoning applies to the buffer too, which argues for a separate method. Decide it explicitly and
record the argument.

Release-first ordering

Publish here first, then DIG-Network/dig-node#389 serves it, then
DIG-Network/dig-app#306 consumes it. dig-app PR #311 already ships an honest
unknown state for every unserved verb, so nothing is broken while this is in flight.

Acceptance

The method is declared, documented to the standard of the three collateral methods already in 0.23.0,
published, and a node that cannot determine its state can express that without returning a number.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions