Skip to main content

Module optimize_attest

Module optimize_attest 

Source
Expand description

optimize_attestation side-table — persists the user’s per-disposal contemporaneous-ID attestations (a projection input, not ledger state). The attested_set accessor feeds the compliance_overlay as its attested: &BTreeSet<EventId> argument; get returns the stored attestation text so the overlay can enforce attested-binds-the-exact-selection (R2-I1: a later divergent pick is NOT covered). Modeled on tax_profile.rs discipline (idempotent DDL, defensive guard on every accessor, BTreeSet for NFR4 determinism).

Functions§

all
Return all stored attestations as a BTreeMap<EventId, (String, String)>, where each value is (attestation, attested_at), keyed by the disposal EventId (NFR4-stable deterministic order). CREATE-IF-NOT-EXISTS guard first. Mirrors tax_profile::all discipline.
attested_set
Return all attested disposal EventIds as a sorted BTreeSet (NFR4-stable). Feeds the compliance_overlay as its attested input. Robust to older vaults.
clear
Delete the optimize_attestation row for disposal (idempotent — no-op if absent). Called by reconcile void when the voided decision is a LotSelection, so that revocation is COMPLETE: the decision void and the row clear are co-persisted in the same session.save().
get
Return the stored attestation text for disposal, or None if none has been recorded. Robust to older vaults (defensive init_table guard).
init_table
Create the optimize_attestation side-table if it does not exist (idempotent). Called by Session::from_fresh_vault; also called at the top of every accessor as a defensive ensure-table-then-read guard (robust to older vaults).
set
Record a narrow attestation for disposal (upsert — replaces any prior value). attestation is a caller-supplied opaque string (e.g. JSON-encoded LotSelection) that binds the exact lot picks the user attested; attested_at is an ISO-8601 date string.