### `wai.delivery.ledger`: invoice lines recomputed from signed records

- **The extension** ([receipt-ledger](extensions/receipt-ledger.md)): a tariff, `WLT1`, that a
  seller and a buyer both sign, pricing in one currency every unit WAI's records state: a room
  session's units (live-metering §4.4), acknowledged bytes by object class (settlement §3.3), a
  package's packages, entries and stored bytes (packaging §9), and ad impressions, presented under
  the players' claims or billable on beacons, or presented in a stream another party stitched
  (stitched-presentation §7.4); and naming the rooms, delivering parties, packagers, and ad
  deciders and stitchers it bills, the stitchers being a stitched verification's signers. §3 is the note on one tariff across rooms, packages and HTTP delivery:
  a room receipt or a statement that states a tariff states this one (`tariff_conflict`), every
  amount rounds down once per line, and no unit is converted into another or priced from joules.
- **The invoice**, `WLI1`: every record it was computed from; one line per source and unit, each
  citing its records by a citation digest; the joules per scope (room hops, delivery hops,
  packaging, ad decisions) and per class, with the largest declared uncertainty, never summed
  across either; chained per tariff so that no record is billed twice (`record_rebilled`). A
  verifier verifies each source by its own extension and recomputes every figure, refusing with
  fifteen reasons of its own (§10). Two reports are stated with an accepted invoice: the ad
  decisions against the presentation claims, with the reason each billed impression did not count,
  and for a stitched stream stitched-presentation §7.5's own statement, unchanged;
  and delivery by party under the one tariff, with free and declared bytes and the overlaps, bytes
  one receiver acknowledged from two parties in windows that overlap.
- **The reference**: `wai-rs`'s `receipt_ledger` module (feature `receipt_ledger`); the corpus
  `live-conformance/ledger/`, its sources taken from the metering, settlement, ads and presentation
  corpora and the packs of pack-conformance, with two delivering parties' statements written for
  it; `live-conformance/receipt_ledger_verify.py`, the second implementation, which verifies each
  source with that corpus's own second implementation and checks a single verification document
  with `--document`.
- **The service**, `wai/wai-ledger`: tariffs, sources and invoices kept in a directory it owns,
  each file written whole and the state recovered and verified again on start; every invoice
  served with its verification document. Its tests issue the corpus's invoices byte for byte and
  recover the chain after a restart; `smoke.sh` checks it over HTTP; CI in
  `.github/workflows/wai-ledger.yml`.

