sofi: R6, the producer fails closed - #941
Merged
Merged
Conversation
Rebuild step R6 (spec §44): the producer validates with the evidence it acquired and stops on anything but Valid (rule T5, gate G5). `sdk/sofi_sdk.rs` `draft` builds the preimage, refuses what beta will not execute through `preimage_admissible` (wired; G1 baseline line burned), and runs `validate` over the acquired evidence: Invalid is `BuildError::StaticallyInvalid(reason)`, Unavailable is the new `BuildError::Unavailable(Missing)` — no draft exists, so nothing is published, exercised or advanced. `route_validation` stays on the baseline, retagged R12. `sdk/sofi_test_fixtures.rs` (cfg(test)): whole operations at vault genesis over the fake fleet, shared by the evidence and producer tests; the producer's build tests now run over acquired evidence. Formal, in tandem: `lean4/DSMSofiStorage.lean` §13 — `Verdict.and`, `proceeds`, `unavailable_stops_the_producer`, `missing_evidence_never_hides_a_refusal`, `the_producer_proceeds_only_on_valid`, `invalid_dominates_and_unavailable_never_becomes_invalid`.
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.
R6 — the producer fails closed
Rebuild step R6 of the SoFi build order (spec §44): the producer validates with the evidence it acquired and stops on anything but
Valid(rule T5, gate G5).What is built
The draft (
sdk/sofi_sdk.rs): builds the preimage, refuses what beta will not execute throughpreimage_admissible(now wired; its G1 baseline line is burned), and runsvalidateover the evidence the caller acquired (R5).Okbuilds the draft.InvalidisBuildError::StaticallyInvalid(reason).Unavailableis the newBuildError::Unavailable(Missing): noPrecommitDraftexists, so nothing is published, exercised or advanced, and what is missing is named. The three-valued conjunction keeps missing evidence from hiding a refusal and from passing for one.route_validationstays on the G1 baseline, retagged R12: it is the verdict-only wrapper the resolution ladder consumes; the producer needs the reason, which onlyvalidatecarries.Shared fixtures (
sdk/sofi_test_fixtures.rs,cfg(test)): whole operations built the way a trader builds them, against vaults at their genesis —VaultAtGenesis(state, genesis preimage, the three policies; publishes and indexes them on the fake fleet),RouteFixture::swap(n)andRouteFixture::close()with real trees,Fold(T°, E)for the realize root, andacquire. The evidence tests (R5) and the producer tests now share them, because a producer that fails closed can only be exercised with evidence that was actually fetched.Formal side, in tandem
lean4/DSMSofiStorage.lean§13 (R6):Verdict.and, the three-valued conjunction ofsofi::conformance::Validation::and;proceeds. Theorems:invalid_dominates_and_unavailable_never_becomes_invalid(the Core test's twin),unavailable_stops_the_producer,missing_evidence_never_hides_a_refusal,the_producer_proceeds_only_on_valid. No new TLA model.Correspondence and controls
unavailable_stops_the_producer,the_producer_proceeds_only_on_validunavailable_stops_the_producer_and_nothing_is_produced(G5: each policy withheld, then the genesis)missing_evidence_never_hides_a_refusal,invalid_dominates_and_unavailable_never_becomes_invalidinvalid_dominates_and_unavailable_never_becomes_invalid; SDKmissing_evidence_never_hides_a_refusalan_exercise_is_signed_twice_and_p_travels_with_its_signature,a_two_hop_route_that_chains_builds,a_close_is_the_same_variant_and_only_the_origin_ownerMutation controls executed (each restored afterwards):
Unavailable(the pre-R6 arm) →unavailable_stops_the_producer_and_nothing_is_producedred.Verdict.andreadingUnavailableas its other conjunct →unavailable_stops_the_producerandthe_producer_proceeds_only_on_validfail to check.Gates
--features test-utils):sdk::sofi_evidence sdk::sofi_sdk23/0. Core:sofi::admission sofi::conformance3/0.DSMSofiStorage.leankernel-checks with-DwarningAsError=true.make lintexit 0;ci/production_safety_checks.shpassed (sofi reachability: 63 pub fn reachable, 17 in the baseline; G2 script green).Spec
§44.2 gains the R6 row.