receipt-ledger: bill what the work spends — bytes out, a package's work per run and its storage by byte-time, every hop's energy, the output its hop delivered #556
Loading…
Reference in a new issue
No description provided.
Delete branch "wai/ledger-physics"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The receipt ledger bills what the work spends. Each item is a rule of the extension with its reason in the text, held by corpus vectors, the Rust reference and
receipt_ledger_verify.py.A job's output is the object its hop delivered (receipt-ledger §5.1). Where a job's route record states what its served attempt delivered (route-record version 2,
outputs, by content hash), each output receipt a job source gives must be of one of those objects, once, or the source is refusedoutput_not_delivered. A line bills a job's subpixels from its output receipts, so a receipt of an object the hop did not deliver billed subpixels nobody delivered for that job, and one given twice billed them twice. Holds under tariff versions 3 and 4; under version 4 a route record of version 1, which states no outputs, holds its outputs to none.Routing figures are never charges (§5.1). A route record's
cost,energy,expected_cost,expected_ttfb_msand its price book'spriceandfailuresorder the survivors; no line reads them, and a job line bills its billed attempt at the tariff's price. Two controls: a failed hop counted as a job, and a job line at the router's list price.Jobs routed under the route record's version 2 in the ledger corpus. An encode, a failover whose failed hop was metered, a decode, a hop past the deadline, three hops that failed, and a failover whose failed hop's figure states no class, routed by the route corpus's router under its version-2 price book;
routes/vectors.jsonis unchanged.A room's bytes out (live-metering §4.1, §4.4, §4.6; receipt-ledger §4.7). A room-session receipt of version 2 states
bytes_out, the bytes its hops sent the session's sessions from their ledgers, prices them per 10^9 bytes in its tariff and counts them in each grant's consumption entry and funds. Delivery costs scale with bytes carried, not only time. A hop link's bytes, in no ledger, are carriage between relays and not counted. Tariff version 4 bills them on a room linebytes_out; a receipt that states a tariff states all fourteen prices.A package's work, per run (§4.7). Packaging is deterministic, so a package made again gives the same receipt from a run that did the work again; every earlier version billed a package once per receipt and refused it. In version 4 a package has a job's shape: the run that made it, a routed job of
package.buildwhose output is the package, is billed once per run, per job and per work unit (the receipt'swork_units, the work its figure is expressed against); the package receipt is the product each run cites; a replayed run is refused. The run's energy is its hop's.A package's storage by byte-time (§4.7). Version 4 prices storage per 10^9 byte-days. A package the previous invoice lists is held through the invoice's whole period and billed ⌊Σ stored_bytes × (end − start) / 1 day⌋; the invoice that first lists it bills no storage, since no record shows when in that period it was written. The period is read from the chain's own invoices.
Every hop's energy (§6.6). Version 4 states the energy of every attempt of a job; the hops not billed (failed, or served past the deadline) in a scope of their own,
unbilled_hops, never summed with the billed hops'. The customer is still not billed for them.Versions: a tariff and invoice of version 4, and a room-session receipt of version 2, because an older reader would misread them. Tariffs of versions 1 to 3 and receipts of version 1 read, verify and bill exactly as before, and their vectors are byte for byte; the one control that named an unknown version now names version 5.
The ledger service (
wai/wai-ledger) reads a source by its tariff's version and, under version 4, bills a held package's storage each period and a package made again by a new run.🤖 Generated with Claude Code