Skip to main content

CommitmentSource

Trait CommitmentSource 

Source
pub trait CommitmentSource: Send + Sync {
    // Required methods
    fn current_binding_for_quote(&self) -> Option<QuoteBinding>;
    fn current_binding_snapshot(&self) -> Option<QuoteBinding>;
    fn commitment_blob_for_pin(&self, pin: [u8; 32]) -> Option<Vec<u8>>;
}
Expand description

Source of the live storage commitment a quote prices against (ADR-0004).

Implemented by the responder-side commitment state. Decouples QuoteGenerator from replication internals: the generator only needs the current commitment’s (key_count, pin) and the guarantee that asking for it refreshes its answerability (“quoting is advertising”). Returns None when there is no live current commitment (never rotated, or retired), in which case the node quotes the baseline with no pin.

Required Methods§

Source

fn current_binding_for_quote(&self) -> Option<QuoteBinding>

Snapshot the current commitment’s binding AND refresh its answerability, atomically. None if there is no live current commitment.

Source

fn current_binding_snapshot(&self) -> Option<QuoteBinding>

Non-mutating snapshot of the current commitment’s binding: the same value Self::current_binding_for_quote prices from, WITHOUT refreshing answerability. For read-only consumers — the payment verifier’s price-floor policy reads the local commitment price here — that must not extend retention: “quoting is advertising” applies to issued quotes only, not to a verifier consulting its own price.

Source

fn commitment_blob_for_pin(&self, pin: [u8; 32]) -> Option<Vec<u8>>

ADR-0004: the serialized signed commitment for pin, if it is still retained, so the quote response can ship it as a sidecar (“the commitment arrived with the quote”). Returns the same canonical bytes a peer would receive via GetCommitmentByPin, so the client’s pin match is identical across both resolution paths. None if the pin is no longer retained (in which case the response carries no commitment and the client falls back to gossip/fetch). Kept separate from Self::current_binding_for_quote so the ~5 KB blob is only materialised when a response is being built, never on the Copy pricing path.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl CommitmentSource for ResponderCommitmentState

ADR-0004: the responder commitment state is the quote generator’s commitment source. current_binding_for_quote snapshots the live current commitment’s (key_count, pin) and refreshes its answerability in one atomic step (via ResponderCommitmentState::current_for_quote), so a quote that prices against the current commitment keeps it answerable for its TTL.