Expand description
Event-fed on-chain pool view for the serve path (ADR 003 §Sizing).
The cdn/client/v1 serve handler holds no RPC client, but two of its gates
need a pool-level chain quantity per request:
- Floor-
Msolvency — the pool’s remaining balance (getPool.deposit − getPool.totalRedeemed) minus the refundable floorMmust still cover the credit window, or the node refusesUnfundedbefore signingok: true. - ADR 011 funder gate — the pool owner (
getPool.owner) is the funding address the origin-blacklist gate evaluates, at open time and mid-stream.
Both quantities are fully determined by the PaymentPool event log, so the
serve path reads them from an in-memory projection the settlement watcher folds
from that log (crate::payment_settlement) — the common case costs no
getPool eth_call. The two reads split by whether the caller can block:
- Admission (
PoolView::status) MAY block. The production wrapper (crate::payment_settlement::ResolvingPoolView) reads the projection first and, on a miss (a pool opened before the watcher’s cold-start head), does ONEgetPoolto confirm the pool exists and is solvent BEFORE a serve is admitted. An absent, closed, or errored pool yieldsNoneand the admit gate refuses — it does not fail open. - Mid-stream (
PoolView::cached_status) MUST NOT block: it reads the projection only. An admitted stream’s pool was seeded at admission and a projection entry persists until the pool is forgotten (aPoolReclaimedremoves it), so aNonehere is not expected for a live stream; if it does occur it fails open, since the on-chainredeemis the backstop and a chain read at a voucher boundary would stall delivery.
The bare PoolProjection is the projection itself: its status returns
None for a pool it has not folded and never touches the network. Tests wire
it (or a fake) directly; production wraps it in the getPool-on-miss view.
Structs§
- Pool
Projection - An event-fed
PoolView: the serve gates read{owner, remaining}from an in-memory projection the settlement watcher folds from thePaymentPoolevent log, so no serve request costs agetPooleth_call. - Pool
Status - The per-pool chain quantities the serve gates read.
Enums§
- Lifecycle
- A pool’s on-chain lifecycle, folded from the
PaymentPoolevent log.Openpools accept top-ups and redemptions; aClosingpool accepts redemptions only untildeadline(the on-chain dispute deadline), after whichredeemManyrevertsPoolClosed. A pool never returns toOpenonceClosing, and aClosingpool cannot be topped up, so itsremainingonly falls.
Constants§
- POOL_
RECHECK_ INTERVAL - Wall-clock cadence for the serve loops’ mid-stream pool-solvency re-check (ADR 003 §Pool solvency policy).
Traits§
- Pool
View - A per-request source of
PoolStatus. Trait so the handler holds it behind anArc<dyn PoolView>and tests pass a fake (orNone) without a chain.