Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,19 @@ jobs:
grep -q '^test result: ok. 1 passed; 0 failed; 0 ignored' proof_length.out

# tests/vectors/tracker/rows_of_record.json: the Lean's rows of the word
# handed, under the machine without the recheck
# handed, under the machine without the recheck; the rows of the record
# and the door, of LeafRows and the crate's own, each under its own
# machine; and the latch's rows again through the door where
# stepRecheck_eq_step covers them
- name: The tracker's rows of record
run: |
cargo test --locked --test tracker_rows -- --exact --nocapture \
rows_of_record_handed | tee tracker_rows.out
rows_of_record_handed \
rows_of_record_recheck | tee tracker_rows.out
grep -q '^rows_of_record_handed: 46 rows under step, 0 divergences, 0 not spelled$' tracker_rows.out
grep -q '^test result: ok. 1 passed; 0 failed; 0 ignored' tracker_rows.out
grep -q '^rows_of_record_recheck: 53 rows, 45 under recheck and 8 under step, 0 divergences, 1 not spelled, 0 ahead of the Lean$' tracker_rows.out
grep -q '^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$' tracker_rows.out
grep -q '^test result: ok. 2 passed; 0 failed; 0 ignored' tracker_rows.out

# The wallet, the overlay engine and the app layer host this crate in wasm.
wasm32:
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ Mirrored from bsv-stack-lean's `lean/Tracker.lean` at `a7ef91de` (section "The r
- `tests/compact_golden.rs`: every golden string is byte-identical but `conflicted_by_ids_and_text`'s tail, where the node's verdict now writes its two competitors on the record and the prior word `unknown`; its old ending is quoted in its doc. `version_1_bytes_still_restore` and `version_2_is_version_1_with_four_empty_fields` read that one state's record apart; `handed_refusals` and `tests/compact.rs`'s `version_2_refusals` lose the refusals of a record "held empty in this release"; `an_instance_beside_each_word_of_record` reads the list kept beside `conflicted` only when its prior word is `handed`.
- Tests: `tests/transitions.rs` (the latch over a `conflicted` word under every chain event and a recheck; a competitor's proof for the tracked txid, refused in both modes, the latch's old answer quoted; the record and the prior word; a competitor's length and the tracked transaction's measure kept apart, the K4 scope of the crate's issue 57; the door's rows over one state), `tests/reorg_by_root.rs` (the latch's outputs over a registry with `conflicted` words, unchanged with the flag named off; the selection under the door; one header read per standing competitor with a proof), `tests/compact.rs` (a state with a record round-trips; the record's refusals; the round trip's generator feeds the door), `tests/labels.rs` (`competitor_gone`), a unit test of `leave_word`. `tests/handed_properties.rs`'s `handed_to_only_beside_handed` is tightened to `conflicted` whose prior word is `handed`, both ways.

### Tests: the recheck of `conflicted`'s tests of record (for #47)

Mirrored from bsv-stack-lean's `lean/Tracker.lean` at `a7ef91de` (blob `c2a6045a`): the rows of the namespace `Tracker.HandedRows` from "The competitor's proof goes on the record" to its end and the namespace `Tracker.LeafRows`, and the theorems of the section "The recheck of `conflicted`". The crate is one machine with a mode; its tests run the Lean's rows of both machines, each under its own.

- `tests/vectors/tracker/rows_of_record.json` (sha256 `0e8f13056b9fd5dfd0785f870c0347f1565a918176216f87313c6ec9fec2d3e1`) gains the 47 rows of the record and the door and the 5 of `LeafRows`, one row one `#guard`, its text verbatim, and one row of the crate's own (`self_competitor_refused`, `Tracker.competitor_is_another` at a taken payment); every row names its group and its machine, and each input of a trace the machine the source passes it through (`run P` or `runR`). 99 rows: the 46 of the word under `step`; of the 53, 45 under the door and 8 under the latch. `LeafRows`' competitor named "C" offered X's proof is listed by name as not spelled: the crate names a competitor by its proof's own txid.
- `tests/tracker_rows.rs`, `rows_of_record_recheck` (new): every row of the 53 under its own machine, `0 divergences, 1 not spelled, 0 ahead of the Lean` (no row starts from a state stored before the record existed, so none meets the crate's named join); then the 54 rows of the latch a second time through the door wherever `stepRecheck_eq_step`'s premise holds at every step of the row's traces: 52 replayed, 1 not covered (`returned.5`, the latch's own reorg on `conflictedT`), 0 divergences. The `vectors` job runs it by name beside `rows_of_record_handed` and greps its three lines: 14 named passes.
- `tests/recheck_properties.rs` (new): 23 properties, each named for its Lean theorem (`step_conflicted_latched` to `conflictReask_only` and `conflictReads_le`), and 3 of the crate's own (`a_competitors_length_is_its_own`, the length rule's scope: a competitor's length never moves the tracked transaction's measure, 64 included; `no_run_lists_an_id_whose_only_entry_is_gone`; `conflicted_from_handed_keeps_its_list`). 256 cases each from the fixed ChaCha seed, no failure persistence; every trace runs under both machines, with two competitors whose proofs are built from their bytes, and each premise is met in some case.
- `tests/properties.rs`: `mined_implies_checked_proof`, `stale_iff_header_inactive` and `hint_changes_no_chain_word` run each trace under both machines with two competitors; `same_evidence_same_word` stays over the latch: two hosts agree on the word under the door only where they hold the same record. `tests/compact.rs`: the generator runs each step under either machine with two competitors; `a_conflicted_word_and_its_record_name_the_same_competitors` reads the row's conflict before the step, so a return by that very step is checked (it was not), and fails when the named join is removed. `tests/scenarios.rs`: the three scenarios of record run under both machines and give the same states step by step.
- `tests/compact_golden.rs`: four goldens with a record, each spelled field by field, each competitor's length beside the tracked transaction's own field: `conflicted_with_a_checked_competitor` (prior `announced`), `conflicted_from_handed` (the instance kept, the competitor's 191 beside the tracked transaction's 65), `conflicted_named_by_a_node` (no length, no proof), `returned_with_the_record_marked` (`announced`, `competitor_gone`, the mark); `record_refusals`, #47's refusals as bytes beside them; and `a_record_with_no_prior_word_is_written_by_a_run_and_restores` (a restored version 1 row that a competitor joined: read, not refused).
- Refused, in the compact form: `conflicted` whose prior word is `handed` with no instance (`Malformed("conflicted from handed with no instance")`), whose return would be `handed` with none; no run writes it. The named join and the door's selection keep the ids they hold in a set; behaviour unchanged.

### Hosts: what a host of 0.9.0-beta.11 changes to take the tenth word (for #56)

**A host of 0.9.0-beta.11 changes each exhaustive match on `Word`, and may start feeding three acts.** (1) `Word` has a tenth word, `Word::Handed`, and is still not `#[non_exhaustive]`, on purpose: every exhaustive match on `Word` outside the crate stops compiling (E0004) until it names the word, because each place that names words must decide what `handed` means for it. (2) A host that feeds no `HostAction::HandOver` never sees `Word::Handed`, and every word it sees is the word it saw at 0.9.0-beta.11: no other act, hint or evidence writes it (the Lean's `handedNamed_run` and the arms of `step` in `lean/Tracker.lean` at bsv-stack-lean `08ce467d`). Once a host feeds the act, a rule that reads a word by its text or through a wildcard arm reads `handed` as whatever that arm says, in silence; name each before feeding the act. (3) A re-ask of the new kind `Reask::Reannounce` asks the host to post the bytes again to each instance of `State::handed_to()`; it is never a proof request, so a host that fetches a proof for every due re-ask whatever its kind fetches the wrong thing for it. `Reask::LABELS` gains `"reannounce"` at its end. (4) `State::to_compact` writes version 2 of the compact form. Version 1 bytes a host stored still restore, as the same state with no instance; an older crate refuses version 2 bytes with `CompactError::UnknownVersion(2)` and restores nothing.
Expand Down
Loading
Loading