sofi: R7, FulfillmentConformance as the full predicate of Part IV - #943
Merged
Merged
Conversation
`fulfillment_conformance(F, σ_F, ConformanceEvidence)` evaluates the eight items of §20.2 over what a verifier fetched and folds them in item order: Valid, Invalid with a reason, or Unavailable naming what is missing. A fact about bytes in hand is Invalid; a read that established nothing — a P by another id, a non-verifying copy, a preimage of another E, bytes that do not re-derive ρ or a closure reference, an earlier attempt key that is not Final — is Unavailable, never Invalid. The producer's pre-sign subset (`check_fulfillment_against_precommit`) is built from the same helpers. Lean §10 of DSMSofiAtomicity: `conformance_valid_iff`, `more_evidence_only_refines`, `a_missing_p_waits_and_only_an_unsigned_f_refuses`, `unread_storage_is_unavailable_never_invalid`; mutations 35 and 36 executed. One Core test per item over a signed two-leg rig; five Rust mutation controls executed and restored. G1 baseline: `fulfillment_conformance` added for R9/R12, `setup_ref` burned.
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.
R7 — Core FulfillmentConformance, the full predicate
Rebuild step R7 of the SoFi build order (spec §44):
FulfillmentConformance(F)as Part IV §20.2 states it, three-valued, over what a verifier actually fetched, one named test per item.What is built
The predicate (
dsm/src/sofi/conformance.rs):fulfillment_conformance(F, σ_F, &ConformanceEvidence) -> FulfillmentConformance, which isValid,Invalid(FulfillmentConformanceError)orUnavailable(ConformanceMissing). The eight items are evaluated and folded in item order: the firstInvalidnames the reason, else the firstUnavailablenames what is missing. So a withheld object can never hide a refusal, and nothing missing is ever read as one.Two rules shape every arm. A fact about bytes in hand — an unsigned or non-verifying
F, a key that is not P's, a non-canonical policy set, a hole in the attempts, legs that are not whatP(E)derives, a setup that names another trader or vault or sits at or afterp, a closure reference to a class no rule can address — isInvalid, permanently. A read that established nothing —Pnot fetched or fetched by another id, aPcopy whose envelope does not verify (another envelope may), a preimage that does not recomputeE, bytes atρthat do not re-hash toρ, a closure object that does not re-derive its reference, an earlier attempt key that is notFinal— isUnavailable, neverInvalid. A hostile relayer serving garbage cannot end a lineage with it.P(byPrecommitId, envelope verified withverify_precommit),q = p + 1checked.verify_fulfillmentunderF's own key, then key and algorithm equality withP.P(E)commits (canonical_legs), in P's leg order.a_j > 0,K^(a_j − 1)isFinalon anything — a lost key counts,LeaderHeldwaits, an unread key waits.SetupRegisteredper leg:Storedbytes atρthat decode and re-deriveρ.(G, DevID)and the leg's vault, withsetup.position < p; P's(v, R, ρ)legs equal thoseP(E)derives.recompute_e(P(E)) = P.E; every𝒞_E^prereference verified under its variant's rule (policy_object_addressfor content,claim_reffor a single-root claim, theSofiResolutionClaimfields for a conditional claim,setup_reffor a setup).ConformanceEvidencederivesDefaultonly undercfg(test)(the G2 posture ofEvidence); production builds it only from fetched bytes and resolved cells, keyed byρ, byValidationRefand by(v, a).The producer's half.
check_fulfillment_against_precommitstays as the pre-sign subset (items 1 to 4 beforeFis signed and before anything is stored) and is now built from the same per-item helpers as the predicate, so the two cannot drift;the_producers_pre_sign_check_is_the_structural_half_of_the_predicatepins that.Small wire additions:
SettlementBody::closure(),ValidationRef: Ord(a map key). The validation tests' real-P(E)rig moves intovalidation::fixtures(test-only,pub(crate)) and gainsswap_fixture_with(hops, setup_ref_of, closure), so the conformance tests run over an operation whose legs carry theρof real setup bodies and whose closure names one object of every reference kind.Formal side, in tandem
lean4/DSMSofiAtomicity.lean§10 (new):ConfEvidence(the twin ofConformanceEvidence),known(a fact about bytes) andfetched(a storage read),conformance(the eight items in order underallV; aPby another id is noP). Theorems:conformance_valid_iff— Valid ⇔ the structuralConformingover the exactPandP(E),Fsigned, every storage fact established.more_evidence_only_refines—Extends ev ev' → Refines (conformance ev) (conformance ev'): Invalid is permanent, Valid is never withdrawn, an unmade read is never a refusal.a_missing_p_waits_and_only_an_unsigned_f_refuses,unread_storage_is_unavailable_never_invalid.TLA:
TrueConformanceinDSM_SofiFulfillment.tlanow names its Rust twin; no configuration changes.Correspondence and controls
conformance_valid_iffa_fulfillment_with_everything_in_hand_is_valid,item_1_…toitem_8_…more_evidence_only_refinesinvalid_dominates_unavailable_in_item_order,item_5_…,item_6_…,item_8_…a_missing_p_waits_and_only_an_unsigned_f_refusesitem_1_…,item_2_…unread_storage_is_unavailable_never_invaliditem_5_…,item_6_…,item_8_…Mutation controls executed, each restored afterwards:
LeaderHeldaccepted as a permanent resolution →item_5_an_earlier_attempt_must_have_a_permanent_storage_resolutionred.item_6_setup_registered_holds_for_every_legred (invalid_dominates_unavailable_in_item_orderdoes not reach setups and stayed green; the item test is the control).item_2_f_is_signed_under_the_key_p_committedred.Pread as Invalid →item_1_the_referenced_p_is_available_verifies_and_q_is_its_successorred.item_8_the_preimage_and_closure_are_available_and_verifyred.Pread as Invalid →a_missing_p_waits_and_only_an_unsigned_f_refusesandmore_evidence_only_refinesfail to check.fetched→knownin item 6) →unread_storage_is_unavailable_never_invalidandmore_evidence_only_refinesfail to check.Gates
sofi::conformance12/0,sofi::validation33/0,tests/sofi_v8_independent17/0. SDK (release,--features test-utils):sdk::sofi_sdk13/0.DSMSofiAtomicity.leankernel-checks with-DwarningAsError=true; the four new theorems print their axioms.ci/sofi_reachability.py):fulfillment_conformanceis added to the baseline (R9 wires it into the producer beforeFis written; R12 into the ladder) — the predicate lands ahead of both by the build order, and this is the one line the burn-down file gains;setup_refis burned, reached through it.make lintexit 0 (aftercargo fmt);ci/production_safety_checks.shpassed (sofi reachability: 64 pub fn reachable, 17 in the baseline; G2 script green).Spec
§20.2 and §17.3 point at the predicate; §44.2 gains the R7 row.