Holdings said who holds what; nothing fetched from them. extensions/peer-delivery.md is the exchange, over records WAI already had: a neighbour's holdings record says where to ask, the publisher's receipts say what the answer must be, and the asker's settlement acknowledgement says what was served. It registers no capability and no record, and is in the delivery profile. Joining is the sink's choice: asking a peer and serving one are each off unless the operator's policy and the viewer's setting both allow it, and the setting is off until the person using the sink turns it on. The exchange is eight frames over a link that keeps message boundaries (a data channel among them) and three HTTP requests for a neighbour reached that way. Peers are not trusted. An asker asks only for an object whose object receipt it holds, never names to a holder an object that holder has not listed, and takes nothing before the bytes verify. A holder that served other bytes is asked nothing more (peer_bytes_refused); a record that listed what its holder then said it lacks is set aside (holdings_overstated); a record that misstates a group's size was already refused whole. The asker signs one acknowledgement a holder a window for exactly what it verified, of class 2 with no grant, and the holder checks it against what it served. That settles what cache-authority §9 left open. §9 of the new text says what a peer learns of a viewer: an address, which of the objects it listed were asked for and when, and a session key where the asker acknowledges; and nothing else. wai-rs: feature peer_delivery (the gate, the frames, the asker, a holder's answer and its check of an acknowledgement), the corpus live-conformance/peer-delivery/ (92 cases) and its second implementation peer_delivery_verify.py, which rebuilds every acknowledgement byte for byte: 92 cases agree, 18 of 18 mutated copies and 22 of 22 weakened verifiers caught. wai-web: the peer bundle (src/peer.rs) and peer/: the client over data channels and fetch, objects kept in the Cache API, and two runs with faults planted on the holders' side. Under node, 33 checks (wai-web-wasm.yml runs it and has the Python verifier recompute the session from its signed acknowledgements). In a browser, 23 checks over seven pages: altered bytes refused and never acknowledged, an overstating record never asked, a peer that lists what it lacks set aside, and pages whose setting is off opening no connection. Co-Authored-By: Claude <[email protected]>
3.3 KiB
live-conformance/peer-delivery — objects from the neighbours that hold them
The corpus of extensions/peer-delivery.md §10, in one
file, vectors.json.
Provenance. Generated here by wai_peer_delivery_vectors gen (wai-rs, feature
peer_delivery), from Ed25519 keys on fixed 32-byte seeds, constant instants, and envelopes
whose payloads are opaque test bytes written by the generator; no media and no input from
outside this repository.
keys names every key by its role, as 64 lowercase hexadecimal digits: the publisher's
(did:web:publisher.example#d1), five holders' (h1 to h5) and the asker's.
world.groupsare two groups: each itslinkhash, its groupreceipt, and itsobjects, each an objectreceiptand theenvelopein hexadecimal. The first has six objects; the second three, its second past onedataframe.frames(§4.2) are each a message'sbytesand itsoutcome:read, with the frame's name and fields; orrefuseand itsreason.transfers(§4.4) are each what wasasked, the asker'smax_object_bytes, theheadand the lengths of thedataframes that follow;outcomeiscompleteor the reason.gates(§3) are each apolicyand asetting;outcomesays whether the sink mayaskand mayserve.sessions(§5, §6.1) are each an asker's session: its testasker_seed, thepolicyandsetting, thegroupsandobjects(by index into the world) whose receipts it holds, what each holder's link answers for an object (links, by holder key and<group>/<index>:servethe object named,bytesgiven, ormisswith its code; a link with no answer failed), androunds, each the records offered before it, its instant, thewantedobjects and itswindow.outcome.roundsgives, for each round, the records' labels, each wanted object'sroute,attemptsand source (from: a holder's key, ororigin), and the acknowledgements signed, each itsupstream,recordanditems;outcome.askscounts the objects each holder was asked for, andoutcome.recordsgives the labels after the last round.answers(§4.3) are each a holder's record, an object and whether it is permitted and holds the bytes;outcomeisserveormiss code=….acks(§6.3) are each a holder (me), the item list of what itservedover a link, and an acknowledgementrecordwith itsitems;outcomeistakenwith what the record states, orrefuseand itsreason.
Everything is synthetic: keys attest nothing, and the publisher's origin is a reserved example domain. Each case states the outcome it was written to have, declared in the generator: a session's attempts, sources and labels are written out by hand there, and its acknowledgements are sealed from the objects the case says each holder served, never copied from the client.
wai_peer_delivery_vectors verify and tests/peer_delivery.rs check that the file regenerates
byte for byte and that wai-rs reaches every stated outcome. ../peer_delivery_verify.py is
the second implementation, written from the extension's text, which rebuilds every
acknowledgement byte for byte, mutates copies of the corpus and drops each of its own checks in
turn and requires each to be caught. The page client's runs over this world are
wai-web/peer/.