Repository navigation
Repair trios-chat specs: skipped_message_key_gap_bound_guard and CR-CHAT-LAWS lib (Closes #9550) - #9551
Open
dmitrii-f-t27 wants to merge 1 commit into
Open
Repair trios-chat specs: skipped_message_key_gap_bound_guard and CR-CHAT-LAWS lib (Closes #9550)#9551dmitrii-f-t27 wants to merge 1 commit into
dmitrii-f-t27 wants to merge 1 commit into
Conversation
skipped_message_key_gap_bound_guard: verdict struct instead of payload enum variants and ?Enum (Zig BLOCKED, 12 rustc errors); duplicate check scans earlier inputs instead of a [256]bool indexed by the key index (up to 1,000,000); original order of checks; the IndexBelowMin check the original never makes is gone (variant kept). 17 tests, 34 asserts. CR-CHAT-LAWS lib: the 12 laws as flat bytes, each followed by its zero byte (the original's exact SHA-256 input), plus offsets; SHA-256 stays in the Rust adapter; laws_hash_matches_reference() keeps the decision and no function returns the reference digest. 6 tests, 131 asserts, none vacuous; prefix check includes the law number. Full-path module lines; seals saved with t27c built from this tree (d06eaed); t27b ledger row for the repaired smkg spec. Refs gHashTag#9550
9 tasks
Contributor
Author
|
@gHashTag, please merge this PR (squash) into master;
Dmitrii Fedorov (@dmitrii-f-t27) |
This branch has not been deployed
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.
Closes #9550
Part of the Trinity Secure Chat rewrite (gHashTag/trios
crates/trios-chat, epic gHashTag/trios#1812; stage-6 goal #4548).Repairs two merged trios-chat specs so that they compile in Zig and their
gen-rustoutput compiles under rustc:specs/port/trios/crates/trios-chat/rings/CR-CHAT-02/src/skipped_message_key_gap_bound_guard.t27specs/port/trios/crates/trios-chat/rings/CR-CHAT-LAWS/src/lib.t27What changed
skipped_message_key_gap_bound_guard. A verdict struct (
SkippedGapCode,Okfirst, then the original variants in order, plus the u32 payload) replaces the payload enum variants and the?SkippedGapErrorreturn. Duplicates are found by scanning earlier inputs, which is what the original'sBTreeSetanswers, instead of a[256]boolindexed by the key index (indices go up to 1,000,000). The order of checks is the original's; theIndexBelowMincheck the original never makes is removed (the variant stays for the adapter). Tests: the 10 originals with exact verdicts, plus index 1,000,000, check order and helpers.CR-CHAT-LAWS lib. The 12 laws are flat bytes, each followed by its zero byte:
LAWS_PREIMAGEis exactly the byte string the original feeds to SHA-256;LAWS_OFFSETSgives each law's start. SHA-256 is not computed in .t27; it stays in the Rust adapter withsha2. The spec keeps the decisionlaws_hash_matches_reference(digest); no function returns the reference digest. Every test asserts at runtime; the prefix check includes the law number; a FNV-1a checksum test pins every byte of the table to a value computed from the original Rust strings.Both specs get a full-path module line (the LAWS spec no longer collides with the trios-store
src_libseal), seals saved with t27c built from this tree, and the t27b ledger gets a row for the repaired smkg spec (the LAWS row already says pass).Checks (local, macOS arm64, Zig 0.16.0, rustc 1.94.0, t27c and t27b built from this tree at 394732e)
t27c test-reportt27b test --checkt27c gen-rust+rustc --crate-type libt27c coveraget27c seal --verifySwap readiness (scratch, not part of this PR):
#[test]s, byte-identical, pass 10/10 against the generated Rust behind a 23-line adapter. Mutatinggap > SMKG_MAX_GAPto>=in the generated file failssmkg_09; after restore the file is byte-identical to freshgen-rustoutput and 10/10 pass again. The five new expectations (index 1,000,000;[5, 6, 5]duplicate before order;[5, 3, 5]not increasing;[4, 2000000]too large before gap; 257 indices) were also run against the original Rust and pass there.sha2::Sha256over the generatedLAWS_PREIMAGE; that digest equals d8c962d0cfe111bf72f9d59f2296baf015ff5c9f0390cf807b7cc08c706f3a98 and the generated preimage equals the joined original strings byte for byte.Gates run locally on this tree:
check_seal_coverage.pyOK;check_seal_currency.py0 stale;check_assertionless_spec_tests.pyok;tri types ratchetCLEAN (110/110).tools/dupe_scan.pyreports 12 errors, the same set as on master d06eaed (none names a function of these specs).CI on the head SHA 394732e
Required: validate SUCCESS, check-linked-issue SUCCESS, parse-ratchet SUCCESS, own-language SUCCESS. 28 of 31 checks green (Corpus ratchet, emit-bitexact, coverage and spec-guards included). Three reds; none names these specs, and each matches master d06eaed:
python3 tools/dupe_scan.pyon a clean master d06eaed checkout prints the identical set; the same set is red on #9131cargo build -p tri --all-targetswith rustc 1.99.0: errors in cli/dlc10/src/lib.rs, cli/tri/src/gates.rs and gen/rust/tri/network/payout.rs (this PR touches none of them)A red check with an external cause is still red; these need fixes on master, not here.
Not claimed: no swap into gHashTag/trios happens here; the trios side is a later PR.
Dmitrii Fedorov (@dmitrii-f-t27)