extensions/revenue-share.md: the share contract (WRC1) an operator and every owner it names sign, mapping a channel's assets to splits of integer millionths with a rule for breaks between programmes; the program-as-run's JSON carriage, writing out the wai.video.channel receipt's signed bytes unchanged; impressions from the receipt ledger's verified invoices, placed by their instants and attributed to the programme on air; the statement (WRS1) of one party and one period, divided by the largest-remainder rule and citing its records. wai-rs: the revenue_share module (feature revenue_share), ChannelReceipt's JSON carriage, the corpus generator and tests/revenue_share.rs with the worked example. live-conformance/share/: the corpus, from fixed seeds and the ledger corpus's sources. Co-Authored-By: Claude Opus 5.5 <[email protected]>
72 lines
4.9 KiB
Markdown
72 lines
4.9 KiB
Markdown
# live-conformance/share — the revenue share
|
|
|
|
The corpus of [`extensions/revenue-share.md`](../../extensions/revenue-share.md) §12, in one
|
|
file, `vectors.json`:
|
|
|
|
- `sources`: the ledger sources the invoices bill, by name, each a source document of
|
|
receipt-ledger §5.1;
|
|
- `ledgers`: ledger documents (receipt-ledger §7.1), by name, each a `tariff`, an `invoice`, the
|
|
`previous` invoice or `null`, and the names of its `sources` in order;
|
|
- `runs`: the channel's program-as-run windows, by name, each in its carriage (§4.1);
|
|
- `contracts`: share contracts, by name, each hexadecimal;
|
|
- `vectors`: verification documents (§8.1), each the name of its `contract`, the names of the other
|
|
`contracts`, its `statement` (hexadecimal), the names of its `runs` (or `null`) and of its
|
|
`ledgers`, with the `outcome` §8.3 gives it;
|
|
- `keys`: the operator's, the two owners', the channel signer's, the two buyers' and a stranger's
|
|
public keys.
|
|
|
|
**Share equivalence.** For each vector, a conforming verifier given its parts, resolved by name,
|
|
reaches the outcome the vector states:
|
|
|
|
- `refuse`: the `reason` and where, `at`: `[]` for the document, `["contract"]`,
|
|
`["contract", "operator"]` or `["contract", "owner", i]`, `["contracts", k]` and the same places
|
|
after it, `["statement"]`, `["run", k]`, `["ledger", k]` or `["ledger", k, …]` followed by the
|
|
place the receipt ledger gives (receipt-ledger §7.2), and `["ledger", k, "source", j]` for an
|
|
impression of a ledger document's source;
|
|
- `accept`: the statement's digest, the contract's, the `party` and its `role`, the `currency`,
|
|
`start` and `end`, the `invoices` and `runs`, each `impression` of the contract's carriers (its
|
|
ledger document, source, records, class, price, instant `at`, run, entry, asset and split), each
|
|
line (its split, class, impressions, revenue, `ppm`, amount, the records it `cites`, each
|
|
`[kind, identity]`, and the `division`: every party of its split with its `ppm` and `part`), and
|
|
the `total`.
|
|
|
|
The channel, `fast-7`, airs two windows: the 16th's first five minutes (owner A's `a/ep-101`, an ad
|
|
slot, owner B's `b/doc-7`) and the 25th's noon half hour (owner A's `a/ep-102`, an ad slot, owner
|
|
B's `b/doc-8`). Its contract maps each owner's programmes to a split of its own (a third to A and
|
|
two thirds to the operator; three fifths to B and two fifths to the operator) and names a between
|
|
split of halves to the two owners, in which the operator holds no share. The accepted vectors:
|
|
|
|
- `owner_a_october`, `owner_b_october`, `operator_october`: October under the rule preceding, over
|
|
two invoices of one chain. On the 16th, a break under a policy that does not require claims falls
|
|
inside A's programme (three billable impressions) and a break under one that does falls inside
|
|
B's (four presented); on the 25th, two stitched records' ads fall inside A's programme and the ad
|
|
slot after it, a form-1 stream's ad inside B's, and three presentations of DASH events state no
|
|
time and go to the between split. The three statements' parts of each split sum to its revenue;
|
|
the between split's odd revenue gives its leftover millionth to the owner it lists first;
|
|
- `owner_b_following`, `owner_a_between`: the same month under the rules following and between;
|
|
- `owner_a_nothing_billed`: a statement of a period with no invoice, with no line.
|
|
|
|
Every other vector is refused, a control of one defect: each reason of §11, each code it reuses,
|
|
and a ledger document the receipt ledger refuses, at its place.
|
|
|
|
**Provenance.** Generated here: `wai_revenue_share_vectors gen` writes `vectors.json` from fixed
|
|
seeds (the operator, the owners, the channel signer, the buyers) and from sources taken unchanged
|
|
from the ledger corpus [`ledger/`](../ledger/) (`ads_live_break`, `ads_presented`, `stitched_hls`,
|
|
`stitched_form1`, `stitched_squeezeback`, and the vector `streams_stitched_by_others`, a ledger
|
|
document of another seller), whose tariffs give the ad deciders and stitchers its own tariffs
|
|
bill. When the ledger corpus is regenerated, so is this one. Nothing here was fetched from outside
|
|
the repository.
|
|
|
|
Regenerate and check:
|
|
|
|
cd wai/wai-rs
|
|
cargo run -q --no-default-features --features revenue_share --bin wai_revenue_share_vectors -- gen ../live-conformance/share
|
|
cargo run -q --no-default-features --features revenue_share --bin wai_revenue_share_vectors -- verify ../live-conformance/share
|
|
cargo test -q --no-default-features --features revenue_share --test revenue_share
|
|
python3 -I ../live-conformance/revenue_share_verify.py ../live-conformance/share
|
|
|
|
The second implementation, `revenue_share_verify.py`, shares no code with `wai-rs`. It verifies
|
|
each ledger document with the ledger corpus's own second implementation, reads every contract,
|
|
run, marker and statement itself, recomputes every attribution, line, division and citation,
|
|
requires every mutated copy of the corpus to fail, and requires the corpus to catch it with each of
|
|
its own checks dropped.
|