sofi: R5, real evidence acquisition - #940
Merged
Merged
Conversation
Rebuild step R5 (spec §44): `Evidence` is built only from fetched bytes. Core: `sofi::validation::Evidence` derives `Default` only under `cfg(test)` (gate G2) and `Evidence::acquired` is the one production constructor; `EvidenceNeeds::of(preimage)` states what a verifier must fetch and `EvidenceNeeds::policies_of(state)` names the policy objects by address; `sofi::lineage::vault_leaves_at_genesis` states the vault tree at R_0. New tag `DSM/sofi/vault-genesis-object/v1`, the immutable namespace of the genesis preimage (registry 377 -> 378). SDK: `sdk/sofi_evidence.rs` — `LocalLeaves` (the verifier's own leaves, checked against the validated root), `fetch_vault_genesis` (the R1 locator scan with `vault_id()` recomputed), `acquire_evidence` (trader leaves from the local tree, vault leaves from the genesis when the core's pre root is R_0, policy objects Stored at the address the state commits; anything not fetched is absent and Core answers Unavailable); `read_stored_bytes`. The producers take `&Evidence`; `sofi_sdk.rs` no longer validates over a default. Gates: `ci/sofi_no_default_evidence.sh` (G2) in the production safety checks; `vault_genesis_locator` burned off the G1 baseline. Formal, in tandem: `lean4/DSMSofiStorage.lean` §13 — `acquire`, `acquired_bytes_are_stored`, `nothing_is_defaulted`, `silence_acquires_nothing`, `missing_evidence_is_unavailable_never_invalid`, `acquisition_decides_nothing`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
R5 — real evidence acquisition
Rebuild step R5 of the SoFi build order (spec §44):
Evidenceis built only from fetched bytes,Defaultis test-only (gate G2), and every evidence item has its withheld and corrupted controls (gate G3).What is built
Core.
sofi::validation::EvidencederivesDefaultonly undercfg(test);Evidence::acquiredis the one production constructor.EvidenceNeeds::of(preimage)states what a verifier must fetch — every trader key a core touches, and for every vault the core touches its state key and every touched key — andEvidenceNeeds::policies_of(state)names the three policy objects by class and address once the state is in hand.sofi::lineage::vault_leaves_at_genesisstates the vault tree atR_0: exactly its state leaf,Absenteverywhere else. New tagDSM/sofi/vault-genesis-object/v1, the immutable-store namespace of the exact genesis preimage bytes (registry 377 → 378).SDK (
sdk/sofi_evidence.rs, new):LocalLeaves: the verifier's ownR_econleaves, rebuilt and checked against the validated root before they can be evidence (of_validatedfrom the leaf cache;checkedfor a caller holding leaves).fetch_vault_genesis: the genesis preimage undervault_genesis_locator(v)through the R1 index scan, recognized by Core — strict decode,vault_id()recomputed from the bytes and compared to the locator.acquire_evidence: trader leaf pre values from the local tree; vault leaf pre values from the genesis when the core's pre root isR_0; policy objectsStoredon three members at the address the state commits. What is not fetched is absent and Core answersUnavailable. A vault past its genesis stays unfetched until the successor walk (R12).storage_io::read_stored_bytes:Storedby address.draft_trade/draft_route/draft_closetake&Evidence;sofi_sdk.rsno longer validates over a default.Gate G2 script
ci/sofi_no_default_evidence.sh, wired intoci/production_safety_checks.sh:DefaultonEvidencemust be#[cfg_attr(test, derive(Default))], and noEvidence::default()may appear in production code (before the first#[cfg(test)], outsidetests/).G1 baseline:
vault_genesis_locatornow has a production caller; its line is burned down (19 → 18 entries).Formal side, in tandem
lean4/DSMSofiStorage.lean§13 (the R1 module, extended):Evidenceas address → bytes;acquire needs reads= the Stored bytes at every needed address and nothing else;needthree-valued. Theorems:acquired_bytes_are_stored,nothing_is_defaulted,silence_acquires_nothing,missing_evidence_is_unavailable_never_invalid,acquisition_decides_nothing. No new TLA model: the interleaving statement isUnavailableNeverRejectsinDSM_SofiSuccessorCells.tla.Correspondence and controls
acquired_bytes_are_storedacquired_bytes_are_storednothing_is_defaulted,silence_acquires_nothingnothing_is_defaulted; G2 scriptmissing_evidence_is_unavailable_never_invalidmissing_evidence_is_unavailable_never_invalid; SDKa_withheld_policy_object_is_unavailable_never_invalid(×3),a_vault_past_genesis_is_unavailable_until_the_walkwrong_bytes_never_count(R1)bytes_that_do_not_authenticate_to_their_address_are_never_acquiredacquisition_decides_nothingan_authentic_but_wrong_policy_is_acquired_and_refused_by_corekept_verifies,garbage_is_never_kept(R1)a_genesis_of_another_vault_under_the_locator_is_never_keptlocal_leaves_must_recompute_the_validated_root,a_trader_leaf_cannot_be_withheld_from_the_verifiers_own_rootacquired_evidence_validates_a_first_trade_at_vault_genesisMutation controls executed (each restored afterwards):
acquiredefaulting an unread address to bytes →acquired_bytes_are_storedandsilence_acquires_nothingfail to check.acquire_evidencefilling an unfetched vault's leaves withAbsent→nothing_is_defaultedred;EvidencederivingDefaultunconditionally →ci/sofi_no_default_evidence.shred;fetch_vault_genesisrecognizing a genesis without recomputingvault_id()→a_genesis_of_another_vault_under_the_locator_is_never_keptred.Gates
--features testing):sofi::validation sofi::lineage common::domain_tags59/0.--features test-utils):sdk::sofi_evidence sdk::sofi_sdk21/0.DSMSofiStorage.leankernel-checks with-DwarningAsError=true; the new theorems rest onpropext/Quot.soundonly.make lintexit 0;ci/production_safety_checks.shpassed (sofi reachability: 62 pub fn reachable, 18 in the baseline; G2 script green).Spec
§44.2 gains the R5 row.