Skip to main content

handle_subtree_slice_challenge

Function handle_subtree_slice_challenge 

Source
pub async fn handle_subtree_slice_challenge(
    challenge: &SubtreeSliceChallenge,
    storage: &LmdbStorage,
    self_peer_id: &PeerId,
    is_bootstrapping: bool,
    commitment_state: Option<&Arc<ResponderCommitmentState>>,
) -> SubtreeSliceResponse
Expand description

Handle a round-2 slice challenge (responder side), ADR-0002 / V2-685.

The auditor has already structurally verified this node’s round-1 subtree proof and now opens up to two 1 KiB blocks (a fresh-random block plus the final block) of a small freshly-random sample of those leaves. For each opening the responder reads the committed chunk and builds a two-chain opening (a Bao verified slice for authenticity against the chunk address, and a nonced block-tree opening for possession against round 1’s nonced_root), returning SubtreeSliceItem::Present. If it committed to the key but can no longer produce the bytes it returns SubtreeSliceItem::Absent, which the auditor counts as a provable failure.

Openings are authorised against the subtree round 1 actually proved, not merely against the pinned commitment. A challenge naming any key outside that subtree is refused whole, before any chunk is read, so the work this round can cost is bounded by the work the caller already paid for in round 1. An honest auditor cannot trip this: it samples only the leaves round 1 returned, and without that leaf’s nonced_root and content_len it has nothing to verify an answer against.