Repository navigation
sofi: R11, the exercise - #948
Merged
Merged
Conversation
The value written to every successor key of a route: `SofiExercise` (class 0x005E; 0x005D went to the native-reserve credit source in R4), carrying the signed envelopes of F and P, P(E), every G_j and every closure object, bounded by a member's cell cap. Core `sofi::exercise`: the parts rebuild and bind to one another (`recognize_exercise`); an object naming K^(a) of v at R_n is an exercise whose F names (v, a) and whose P names (v, R_n), anything else at the key being nothing (`exercise_names_key`, P1); the ladder's SuccessorResolution from the cell (`attempt_resolution`). SDK `sofi_exercise`: `build_exercise` over the evidence conformance was decided on, `write_exercise` to every leg's cell leader-first under the vault's storage seed, `read_attempt_cell`. The signed two-leg route rig moves into the shared fixtures. Lean `namesKey`/`occupant` with two theorems (mutation 8 executed); the TLA exercise faults re-executed. G1: `successor_attempt_key` burned; `next_attempt`/`next_generation` retagged.
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.
R11 — the exercise
Rebuild step R11 of the SoFi build order (spec §44): the exercise object (Section 17.5), written to every successor key of a route; nothing but an exercise naming the key counts; discharges P1 (OnlyExercisesCount).
What is built
Core.
SOFI_EXERCISE = 0x005E. The spec said0x005D; R4 had already allocated0x005Dto the native-reserve credit source (class_discriminants_do_not_collidepins it), so the exercise takes the next free discriminant and the spec now says so.SofiExercise(wire/objects.rs): the signed envelope ofF, the signed envelope ofP,P(E), everyG_jin leg order, every closure object in reference order; a strict codec bounded per part and as a whole byMAX_EXERCISE_BYTES, a member's cell value cap.sofi/exercise.rs:recognize_exercise— the parts rebuild and are bound to one another (FisP's byPrecommitId;P(E)recomputes theEPcommits; the witnesses areP's own, one per leg, and together exactly the setFcommits; one closure object per reference);exercise_names_key— the recognized view atK^(a)ofvatR_n: an exercise whoseFnames(v, a)in its attempts and whosePnames(v, R_n)in its legs, anything else at the key being nothing;attempt_resolution—SuccessorResolution(K)as the ladder reads it: theEof the exercise that won,FinalorLeaderHeld, elseUnresolved, and no key is ever dead.SDK,
sdk/sofi_exercise.rs.build_exerciseover the evidence conformance was decided on (the witnesses derived fromPand the shadowsP(E)commits; a closure object the evidence does not hold is an error, because the exercise carries the closure);write_exercise— every leg'sK^(a_j)ofv_jatR_j, the leader ofstorage_seed(v_j, R_j)first and every other member after, underTAG_DSM_SOFI_SUCC_CELL_V2;read_attempt_cell— raw reads, the leader from the vault's seed over the committed set, the recognized view, then the ladder'sCellResolutionwith the exercise. Any party may write (P2); the member decides nothing.The R9 test rig (a signed two-leg route with real setups) moves into
sofi_test_fixturesasSignedRoute/signed_route, shared by the R9, R10 and R11 tests.Gate G1.
successor_attempt_keyis burned.next_attemptandnext_generationwere tagged R11 but R11 takes the attempts fromF; they are retagged R12 (the walk advances the counter) and R13 (the resolved vault state's successor generation).Formal side, in tandem
DSM_SofiSuccessorCells.tla:ExerciseNamesItsKey,RecognizedAttemptNamesItsKey,UnrecognizedBytesNeverOccupywith the_ExerciseCountsAnywhere*and_RecognizeAnyBytes*faults — pre-existing since step 3. Re-executed:_ExerciseCountsAnywhere→Error: Invariant ExerciseNamesItsKey is violated(423,664 states generated);_ExerciseCountsAnywhereRecognized→Error: Invariant RecognizedAttemptNamesItsKey is violated.DSMSofiSuccessorCells.lean, THE EXERCISE (new):namesKey,occupant,an_exercise_counts_at_one_key_per_vault(an exercise whose legs each name one vault once counts at one key per vault),only_an_exercise_naming_the_key_counts(whatever junk precedes it — unrecognized bytes, exercises naming other keys — the first exercise naming the key is the occupant). Mutation 8 (namesKeyignoring the attempt) executed:an_exercise_counts_at_one_key_per_vaultis rejected by the kernel (module exit 1); restored.Correspondence and controls
an_exercise_counts_at_one_key_per_vault; TLAExerciseNamesItsKey,RecognizedAttemptNamesItsKeyan_exercise_names_exactly_the_keys_its_fulfillment_and_precommit_name; SDKan_exercise_cannot_count_at_another_keyonly_an_exercise_naming_the_key_counts; TLAUnrecognizedBytesNeverOccupyonly_an_exercise_naming_the_key_counts; Corea_successor_key_resolves_to_the_e_of_the_exercise_that_names_it_or_stays_openan_exercise_whose_parts_are_not_one_operations_is_nothing,an_exercise_round_trips_and_rebuilds_into_bound_objectsFinalRequiresLeader(cells)an_exercise_is_written_to_every_successor_key_at_its_leaderMutation controls executed, each restored afterwards:
only_an_exercise_naming_the_key_countsred (a foreign exercise first at the leader wins the cell and masks the route's own).an_exercise_is_written_to_every_successor_key_at_its_leaderred.an_exercise_names_exactly_the_keys_its_fulfillment_and_precommit_namered.F→an_exercise_whose_parts_are_not_one_operations_is_nothingred, on the wrong-shadow witness case.SOFI_EXERCISEaliased to0x005D→class_discriminants_do_not_collidered:class 0x005d allocated twice: CREDIT_SOURCE_NATIVE_RESERVE_RELEASE and SOFI_EXERCISE. The registry uniqueness invariant is executed, not assumed.namesKeyignoring the attempt →an_exercise_counts_at_one_key_per_vaultrejected (module exit 1)._ExerciseCountsAnywhere→ExerciseNamesItsKeyviolated;_ExerciseCountsAnywhereRecognized→RecognizedAttemptNamesItsKeyviolated.Control-mapping findings on the way: M1 was first run against
an_exercise_cannot_count_at_another_keyand stayed green — Core'sattempt_resolutionre-appliesexercise_names_keyto the winning bytes, so a permissive SDK recognizer cannot make a wrong key resolve; what it CAN do is let a foreign exercise win the cell and mask the route's own, which isonly_an_exercise_naming_the_key_counts. M4 first stayed green because the test lacked the one case the set check is load-bearing for: a witness bound to the right leg,PandEbut claiming another shadow — the per-leg binding does not see the shadow, only the ids do; that case is now in the test.Gates
sofi::exercise4/0 (sofi::registration2/0 unchanged),tests/sofi_v8_independent17/0. SDK (release,--features test-utils):sdk::sofi_exercise3/0,sdk::sofi_register9/0,sdk::sofi_publish6/0.DSMSofiSuccessorCells.leankernel-checks with-DwarningAsError=true; the two new theorems print their axioms. TLC as above.ci/sofi_reachability.py): 82 pub fn reachable, 11 in the baseline;ci/storage_is_dumb.shOK.make lintexit 0 (aftercargo fmt);ci/production_safety_checks.shpassed.Spec
§17.5 carries the class correction and the R11 code block; §44's R11 row says
0x005E; §44.2 gains the R11 row.