Skip to main content

latest_snapshot

Function latest_snapshot 

Source
pub(crate) fn latest_snapshot(api: &str, auth: AuthOptions<'_>) -> ContentHash
Expand description

The log identity to sign a scope against: (node, head) from /api/view.

Unlike current_binding, a failed read here is fatal. The two are different kinds of read: that one reports on a decision the node will make anyway, while this one is part of what gets signed. Guessing a scope, or quietly signing without one, would produce a signature that is either refused or — worse, on a node that does not require scopes — admissible forever and everywhere. The id of the ref-state attestation this node is currently serving, read from /api/view (D67).

Read rather than accepted as an argument, and fatal on failure, for the same reason as log_scope: this value is what gets signed. A witness that pasted a stale id would be attesting a ref-state that is no longer current, which is the one thing a witness must never do by accident — and the node would refuse it, so the only outcome of allowing it is a confusing error instead of a correct signature.