Skip to content

tests: the recheck of conflicted's tests of record, the Lean's rows of both machines (for #47) - #73

Merged
Calgooon merged 12 commits into
betafrom
lane/trk-47-2
Nov 29, 2026
Merged

Calgooon merged 12 commits into
betafrom
lane/trk-47-2

Conversation

@Calgooon

Copy link
Copy Markdown
Contributor

A host of the crate can now run the recheck of conflicted (the door behind Params::recheck_conflicted) knowing that the crate answers the Lean's executable rows of both machines, each under its own: 46 rows of the word under the latch, 45 of the door under the door, 8 under the latch, 0 divergences. The latch's rows are replayed a second time through the door wherever stepRecheck_eq_step says the two machines agree. The door's theorems run as 23 properties named for them, over both machines. The compact form now refuses one shape no run writes: conflicted from handed with no instance.

For #47.

The tests and what they pin

  • The rows (tests/vectors/tracker/rows_of_record.json, sha256 0e8f1305...d3e1; tests/tracker_rows.rs). At bsv-stack-lean a7ef91de, lean/Tracker.lean (blob c2a6045a), grep -c '^#guard' counts 47 rows in HandedRows from "The competitor's proof goes on the record" to its end and 5 in LeafRows. That is 52, matching the plan's 52, and all are transcribed, plus one row of the crate's own (self_competitor_refused). Every row names its group and its machine, and every input of its trace names the machine the source passes it through (run P is step, runR is recheck).

    • rows_of_record_recheck runs the 53 under their own machines. One row is not spelled and is listed by name: leaf.4, a competitor named C offered X's proof (the crate names a competitor by its proof's own txid). 0 ahead of the Lean: every row starts at State.init "T", so none meets the named join. The stack's main on this host is still a7ef91de and has no mirror of it.
    • It then replays the 54 rows of the latch with the flag on, wherever stepRecheck_eq_step's premise holds at every step of the row's traces. 52 are covered and replayed; 1 is not covered (returned.5, the latch's own reorg on conflictedT).
  • The properties (tests/recheck_properties.rs, new): 23 named for the theorems of "The recheck of conflicted", from step_conflicted_latched to conflictReask_only (with conflictReask_bounded) and conflictReads_le. Three are the crate's own:

    • a_competitors_length_is_its_own (K4's scope: a competitor's length never moves the tracked measure, 64 included);
    • no_run_lists_an_id_whose_only_entry_is_gone;
    • conflicted_from_handed_keeps_its_list.

    Each runs 256 cases from the fixed ChaCha seed with no failure persistence. Every trace runs under both machines, the two competitors' proofs are built from their bytes, and each premise is met (checked).

  • The generators: tests/properties.rs runs three of its four properties over both machines with two competitors. same_evidence_same_word stays over the latch, and VERIFICATION says that two hosts agree on the word under the door only where they hold the same record. tests/compact.rs's generator runs each step under either machine.

  • The scenarios: tests/scenarios.rs runs the three scenarios of record under both machines, and the states are the same step by step.

  • The goldens (tests/compact_golden.rs): four with a record, each competitor's length beside the tracked transaction's own field: conflicted_with_a_checked_competitor, conflicted_from_handed (191 on the record, 65 in the last field), conflicted_named_by_a_node, returned_with_the_record_marked. record_refusals pins BREAKING (the compact format): Conflicted keeps the competitor's checked proof and is rechecked on a reorg and an invalidation, as Mined is (ruling 28.3) #47's refusals as bytes. a_record_with_no_prior_word_is_written_by_a_run_and_restores pins that shape as accepted.

  • Issue 57's rows of pull request 72:

    • (2) The decoder refuses conflicted from handed with no instance (src/compact.rs). The record with no prior word is pinned as read. The gone-only id is left to the decoder, and a property says no run writes it.
    • (3) a_conflicted_word_and_its_record_name_the_same_competitors reads the row's conflict before the step. It fails when the named join is removed (below).
    • (4) A set in name_the_unrecorded (src/state.rs) and in the door's selection (src/tracker.rs), with behaviour unchanged.
  • The mutation check: eight faults were planted in the door's arms, one at a time, and reverted. Every one fails some test of this change (the table in docs/VERIFICATION.md):

    • the return's condition;
    • the prior word's reading;
    • the self refusal (caught by competitor_is_another; the row cannot tell it from the length rule's refusal);
    • a verdict-named competitor returning;
    • the record dropped on a hint;
    • the named join removed;
    • the decoder's new refusal removed;
    • a competitor's length read as the tracked measure.
  • The compact form: the record rides version 2, since no published prerelease reads version 2.

The proof

$ cargo fmt --all -- --check
exit 0
$ cargo clippy --locked --all-targets -- -D warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.29s
exit 0
$ cargo test --locked
test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.28s
TOTAL passed 295 failed 0 over 23 test binaries (the base b2a22f7: 262)
$ RUSTDOCFLAGS=-Dwarnings cargo doc --locked --no-deps
   Generated .../doc/bsv_tracker/index.html
exit 0
$ cargo build --locked --target wasm32-unknown-unknown --features wasm
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.06s
exit 0
$ cargo +1.88 check --locked --all-targets
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.22s
exit 0
$ cargo deny --locked check bans licenses sources
bans ok, licenses ok, sources ok
$ cargo test --locked --test tracker_rows -- --exact --nocapture rows_of_record_handed rows_of_record_recheck
rows_of_record_handed: 46 rows under step, 0 divergences, 0 not spelled
rows_of_record_recheck: 53 rows, 45 under recheck and 8 under step, 0 divergences, 1 not spelled, 0 ahead of the Lean
rows_of_record_latch_through_the_door: 52 of 54 rows of the latch covered by stepRecheck_eq_step and replayed under recheck, 1 not covered, 0 divergences, 1 not spelled
test result: ok. 2 passed; 0 failed; 0 ignored
$ git diff --stat origin/beta -- src
 src/compact.rs | 21 ++++++++++++++-------
 src/state.rs   |  4 +++-
 src/tracker.rs |  3 ++-
 3 files changed, 19 insertions(+), 9 deletions(-)
$ git diff --stat origin/beta
 13 files changed, 2637 insertions(+), 376 deletions(-)

The vectors job's tracker step runs both tests by name and greps their three count lines: 14 named passes.

Rows left

  • The row self_competitor_refused cannot tell the self refusal from the length rule's. The file's tracked transaction has no bytes, so its stated proof offered as a competitor's is also refused as Unmeasured, with the same re-ask. The property competitor_is_another pins the error. A tracked name with bytes in the rows file would let the row pin it too.
  • K7's export. The rows file is still the crate's transcription at a7ef91de. When the stack exports the tracker's rows, the file becomes a byte copy pinned by its sha256, and the per-step machine marks move with it.
  • handed_to_only_beside_handed stays over the latch. It already reads prior (lane 3 tightened it). The door's half is conflicted_from_handed_keeps_its_list over both machines. A single property over both machines would replace the two.
  • The current depth of a kept competitor's proof against the tip is not addressed. That is for the keeper to rule (issue 57).

The landing is the captain's.

🤖 Generated with Claude Code

Calgooon and others added 12 commits November 29, 2026 00:02
…ach under its own machine (for #47)

The rows file gains the 47 #guard lines of HandedRows from "The competitor's
proof goes on the record" and the 5 of Tracker.LeafRows at bsv-stack-lean
a7ef91de, with one row of the crate's own (the self refusal). Each row names
its group and its machine, and each input of a trace the machine the source's
run P or runR passes it through. The replay runs every row under its own
machine (45 under the door, 8 under the latch, LeafRows' competitor named C
listed as not spelled), then replays the latch's rows a second time through
the door wherever stepRecheck_eq_step's premise holds at every step: the
keeper's condition for one machine with a mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rom their bytes (for #47)

mined_implies_checked_proof, stale_iff_header_inactive and
hint_changes_no_chain_word run each trace under the latch and under the door,
with two competitors whose proofs are built from their bytes; a hint writes no
record. same_evidence_same_word stays over the latch: theorem (iv) is a
statement of step, and sameViewOtherRecord shows equal views part over the door.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… for its Lean theorem (for #47)

23 properties named for the theorems of the section "The recheck of
conflicted" of lean/Tracker.lean at bsv-stack-lean a7ef91de, and 3 of the
crate's own (a competitor's length is its own; no run lists an id whose only
entry is gone; conflicted from handed keeps its list). 256 cases from the fixed
ChaCha seed, no failure persistence; every trace runs under both machines, two
competitors' proofs built from their bytes, and each premise is met in some case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e (for #47)

No run writes it (the property conflicted_from_handed_keeps_its_list): a
conflict begun from handed keeps the list for its return, and a return from such
bytes would give handed with no instance, which the decoder refuses on its own
bytes. Issue 57's rows of pull request 72, item 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…behaviour unchanged (for #47)

name_the_unrecorded and Tracker::on_chain each scanned a list per item; the
list and the record grow with every verdict a node repeats. Each now keeps the
ids it has in a set; the order written and the ids selected are as before.
Issue 57's rows of pull request 72, item 4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eturn check made live (for #47)

The goldens carry each competitor's length beside the tracked transaction's
own field (191 on the record, 65 or unmeasured in the last field), the named
competitor with none, and the return with the record marked. The refusals are
spelled from the same pieces; a record with no prior word is read, and a run
writes one (a restored version 1 row joined). The generator of tests/compact.rs
runs each step under either machine with two competitors; the property
a_conflicted_word_and_its_record_name_the_same_competitors reads the row's
conflict before the step, so a return by that step is checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ates step by step (for #47)

The latch, the production proofs and the reorg nobody hears meet no conflicted
word, so stepRecheck_eq_step says the door changes none of their states: each
runs under both machines and the trails are compared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…(for #47)

The tracker's rows step runs rows_of_record_recheck beside
rows_of_record_handed and greps its two count lines: 14 named passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The rows of both machines and their replay, the properties beside their
theorems, the goldens and refusals, issue 57's rows of the earlier change, and
the eight planted faults with the tests that caught each. VERIFICATION says
that two hosts agree on the word under the door only where they hold the same
record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clippy -D warnings: a struct literal for the competitor's headers, and the
replay's large state variant boxed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s (for #47)

cargo +1.88 refuses the temporary borrowed in competitor_is_another's assert
(E0716).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Calgooon
Calgooon merged commit 7dea844 into beta Nov 29, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant