wai: media jobs in the receipt ledger, and the int_motion receipts written down (stacked on #542) #544
Loading…
Reference in a new issue
No description provided.
Delete branch "wai/routed-jobs-ledger"
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?
Open WAI records for routed media jobs, second half: media jobs billed by the receipt ledger, the receipts of
wai.video.int_motionwritten down, and the encode receipt.Stacked on #542: this branch holds #542's commits, and both now include main through
2666f8468(#541, #545). Merge #542 (headbc500a9eb) first; this PR's own commits are the rest.What is in it
The receipt ledger prices media jobs (extensions/receipt-ledger.md)
Tariff and invoice version 2.
WLT1andWLI1with version byte 2. A version-2 tariff carries job prices (§4.5): a capability, a unit, a divisor and a price. The unit isjobs, orsubpixels, which is thework_pixel_opsof the job's output receipt. Version 1 reads, verifies and bills as before.Job source (§5.1). A route record's verification document (
wai.route.record, #542), with its hops' OER/2 receipts and keys, plusoutputs:wai.video.int_motiondecode receipts, each with its codestream. It is verified as route-record §7 (receipts checked). Each output is read by integer-payloads §15.2 and re-derived from its codestream, or refusedoutput_invalid.Billed hop, serving capability, figure (§5.1). The billed hop is the attempt the record bills; the serving capability is its candidate's. The figure is that hop's OER/2 figure: the unmetered marker, or microjoules (exact, a half to the even one) beside its
energy.class. A figure with no class is refusedjob_figure_invalid.New kinds.
int_motiondecode receipt), 16 (a route record). These were 10 to 12, which collided with main's kinds: 10 and 11 are revenue-share §7.4's, 12 and 13 opportunity-report §7.3's.jobs: the serving hops' figures by class, the unmetered counted apart.One registry of record kinds (§5.2).
private_kind, in either version (such an invoice wasinvoice_invalidbefore). A version-2 invoice lists kinds 1 to 9 and 14 to 16, never another text's.Double-billing rules. One hop and one output belong to one job (
record_duplicate). Two records of one router for one job arerecord_overlap.Nothing for unbilled jobs. A failed hop, a hop past the declared deadline, and a job no hop served bill nothing.
Corpus (
live-conformance/ledger/). It readslive-conformance/routes/. It adds one accepted month of jobs beside a package:int_motionjob billed per job and per subpixel;It also adds 15 controls: job prices out of order, a router in a v1 scope, a job source under v1, a v1 invoice under a v2 tariff, a record refused by its own extension, an output not re-derived, a figure with no class, a router outside the scope, outside the period, a job given twice, routed twice, an output claimed by two jobs, a job line overstated, a jobs row altered. Three more cover the kinds: a private kind in a version-2 invoice and in a version-1 invoice (
private_kind), and another text's kind in an invoice (invoice_invalid). The existinginvoice_versioncontrol now uses version 3, since version 2 is defined; every other existing vector keeps its outcome.Second implementation.
receipt_ledger_verify.pyverifies each job withroute_record_verify.pyand each output with the newlive-conformance/_int_motion_receipt.py, written from integer-payloads §15.The
int_motionreceipts (extensions/integer-payloads.md §15)wai.video.int_motion/encode-receipt). It states the source frames' hashes and their commitment, the parameters (block,search,mv_precision,q), the SSE the payload decodes with against the source, the work, and the encode's energy and class (a new profile: neverHwShunt).VideoEncodeReceiptseals it over the reference encoder's payload, re-derives it from the payload and the source, and reads and writes its JSON.Small
oer::micro_joules: an OER/2 figure as whole microjoules, exactly.Tariffliteral; it now statesversion: 1and no job prices, and its bytes and corpus are unchanged.Design decisions (and why)
wai breakingreports no wire break). A job price is only billable under a tariff the buyer signed at version 2.billedattempt, not the hop receipt alone. The route record already holds the deadline and the failure rules, so the ledger needs no deadline field of its own on the hop receipt.int_motiondecode receipts in this revision. They are what a customer can re-derive from the codestream. Package jobs stay package sources, billed by §4.1's package prices. The encode receipt is defined and tested but not yet a ledger record kind.Checks
cargo test --locked --no-default-features --features receipt_ledger --lib receipt_ledger::wai_receipt_ledger_vectors gen;cargo test --features receipt_ledger --test receipt_ledgerpython3 -I live-conformance/receipt_ledger_verify.py live-conformance/ledgerprivate-kindamong them)cryptography)--test opportunity_report,--lib opportunity_report::;opportunity_report_verify.py--test revenue_share(release);revenue_share_verify.pycd wai/wai-ledger && cargo test --locked--test route_record;wai_route_record_vectors verify;route_record_verify.py--features oer --lib oer::(incl.micro_joules);wai_oer_vectors verify--features video_receipt --test video_receiptcargo test --no-run --features "$WAI_FEATURES" --libplus every one of the job's test targets--all-targets --features receipt_ledger,revenue_shareandvideo_receiptwai breaking --against 2666f8468Reason::PrivateKindand the corpus control acknowledged in the CHANGELOG)wfsteps.pyon the mergeFalsifications (committed first, each restored)
wai_receipt_ledger_vectors verify, each exit ≠ 0):job-figure,outputandjob-duplicateare among the 22 checks each caught when dropped. Two job mutations (an output dropped, the jobs' coverage stated whole) are among the copies that must fail.resignnow seals each control over its defect, and each mutant fails the test.Not in this PR
wai:video-encode-receipt-idin energy-measurement §6.1, so that energy claims can name encode receipts.jwp-receipts§2.4.5'senergyclaim held to a minor-1 receipt's class.For the lead / owner
receipt_ledgernow depends onroute_recordandvideo_receipt(it builds theint_motiondecoder).receipt_ledger_verify.pynow needscryptographythrough the OER/2 reference verifier, as the CI job already installs.🤖 Generated with Claude Code
920a037c6a' into wai/routed-jobs-ledger