From ba949b0b317cf06c0fad9e2109bb8bf6f00e811d Mon Sep 17 00:00:00 2001 From: Dmitrii Vasilev Date: Sun, 18 Oct 2026 09:28:07 +0700 Subject: [PATCH] spec(port): share the duplicated CR-CHAT helpers blessed by #10098 (Closes #10159) Move the eight copied helper groups into two shared modules and `use` them from every copy site: - trios-chat/common/helpers.t27: ids16_equal, ids32_equal, zero_id16, bytes_equal, all_zero_bytes, approx_sqrt - trios/common/newton_sqrt.t27: newton_sqrt (was sched_sqrt, ternary_sqrt_newton, sqrt_newton32) 29 CR-CHAT specs resealed. Ledger: eight lines dropped. The four record-bound groups (id_seen_before, obs_seen_before, dest_count, member_contains) stay: they read fields of ring-local structs or differ in integer width, and t27 has no generics to share them. Co-Authored-By: Claude Sonnet 5.5 --- ...-CHAT-03::src::confirmation_tag_chain.json | 21 +- ...ngs::CR-CHAT-03::src::external_commit.json | 21 +- ...src::external_proposal_origin_unbound.json | 21 +- ...T-03::src::external_psk_id_provenance.json | 21 +- ...:group_context_hash_consistency_guard.json | 21 +- ...::src::leaf_node_key_uniqueness_guard.json | 21 +- ...::src::leaf_node_signature_validation.json | 21 +- ...-CHAT-03::src::membership_tag_binding.json | 21 +- ...c::parent_hash_chain_validation_guard.json | 21 +- ...::rings::CR-CHAT-03::src::pcs_healing.json | 21 +- ...-CHAT-03::src::proposal_ref_collision.json | 21 +- ...::ratchet_tree_update_integrity_guard.json | 21 +- ...plication_message_generation_skip_dos.json | 21 +- ...:src::mls_plaintext_framing_integrity.json | 21 +- ...c::padding_block_size_alignment_guard.json | 21 +- ...padding_byte_pattern_uniformity_guard.json | 21 +- ...adding_class_transition_entropy_guard.json | 21 +- ...c::padding_fill_byte_randomness_guard.json | 21 +- ...ey_derivation_domain_separation_guard.json | 21 +- ...07::src::blind_signature_sender_token.json | 21 +- ...affic_burst_interval_regularity_guard.json | 21 +- ..._destination_rotation_frequency_guard.json | 21 +- ..._traffic_destination_uniformity_guard.json | 21 +- ...c_inter_arrival_autocorrelation_guard.json | 21 +- ...r_destination_timing_uniformity_guard.json | 21 +- ...:cover_traffic_replay_detection_guard.json | 21 +- ...cover_traffic_size_distribution_guard.json | 21 +- ...raffic_timing_jitter_uniformity_guard.json | 21 +- ..._traffic_volume_ratio_stability_guard.json | 21 +- specs/port/trios/common/newton_sqrt.t27 | 29 +++ .../crates/trios-chat/common/helpers.t27 | 180 ++++++++++++++++++ .../CR-CHAT-03/src/confirmation_tag_chain.t27 | 28 +-- .../rings/CR-CHAT-03/src/external_commit.t27 | 19 +- .../src/external_proposal_origin_unbound.t27 | 27 +-- .../src/external_psk_id_provenance.t27 | 13 +- .../group_context_hash_consistency_guard.t27 | 19 +- .../src/leaf_node_key_uniqueness_guard.t27 | 21 +- .../src/leaf_node_signature_validation.t27 | 16 +- .../CR-CHAT-03/src/membership_tag_binding.t27 | 16 +- .../parent_hash_chain_validation_guard.t27 | 21 +- .../rings/CR-CHAT-03/src/pcs_healing.t27 | 37 ++-- .../CR-CHAT-03/src/proposal_ref_collision.t27 | 27 +-- .../ratchet_tree_update_integrity_guard.t27 | 19 +- ...pplication_message_generation_skip_dos.t27 | 20 +- .../src/mls_plaintext_framing_integrity.t27 | 18 +- .../padding_block_size_alignment_guard.t27 | 21 +- .../padding_byte_pattern_uniformity_guard.t27 | 18 +- ...padding_class_transition_entropy_guard.t27 | 34 +--- .../padding_fill_byte_randomness_guard.t27 | 34 +--- ...key_derivation_domain_separation_guard.t27 | 33 ++-- .../src/blind_signature_sender_token.t27 | 20 +- ...raffic_burst_interval_regularity_guard.t27 | 55 +----- ...c_destination_rotation_frequency_guard.t27 | 55 ++---- ...r_traffic_destination_uniformity_guard.t27 | 38 +--- ...ic_inter_arrival_autocorrelation_guard.t27 | 35 +--- ...er_destination_timing_uniformity_guard.t27 | 36 +--- .../cover_traffic_replay_detection_guard.t27 | 18 +- .../cover_traffic_size_distribution_guard.t27 | 35 +--- ...traffic_timing_jitter_uniformity_guard.t27 | 38 +--- ...r_traffic_volume_ratio_stability_guard.t27 | 53 +----- .../crates/trios-phi-schedule/src/lib.t27 | 21 +- .../trios/crates/trios-ternary/src/lib.t27 | 24 +-- .../crates/trios-trinity-init/src/lib.t27 | 20 +- tools/duplicate_bodies_baseline.txt | 10 +- 64 files changed, 787 insertions(+), 930 deletions(-) create mode 100644 specs/port/trios/common/newton_sqrt.t27 create mode 100644 specs/port/trios/crates/trios-chat/common/helpers.t27 diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::confirmation_tag_chain.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::confirmation_tag_chain.json index e1ce703f18..4566652590 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::confirmation_tag_chain.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::confirmation_tag_chain.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:45ed5ea5d208cfdccde50e2fe7419d72214d1df919bd129f5e6eadf7a84d9d31", - "gen_hash_rust": "sha256:b0eae364571774fc8b95709ef1790267a69f63cc541a63800ceae8d734ff9f05", - "gen_hash_verilog": "sha256:8001536ad7d28de39107f4a9762d25aad185d455d58792e3671857858de2f658", - "gen_hash_zig": "sha256:fb893415dbbee066e1cd116eec7efa078fb08e1928edff06f78a81f1fd0f65db", + "gen_hash_c": "sha256:7c63cc2f7cb03d6b588e3b67d9ad73d402b97f100034976c3d6bb0d40bd11d2b", + "gen_hash_rust": "sha256:18991b8cec45601bf5ab1f6faf9131b883d8b7fa0962f5bef3e49fa2d84a5c44", + "gen_hash_verilog": "sha256:5b59ca6b2006a0ecaab8cf615ad6d4f32655d5c7865ed8ef4d68a969b7e55038", + "gen_hash_zig": "sha256:ad22283b3b1bdf1dbe4034f27effd3dcaacef148c022e043b7f21ea63ca0e5f9", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-03::src::confirmation_tag_chain", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T09:38:48Z", + "sealed_at": "2026-10-18T02:23:42Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:3500728eb7a78aff3650eeae8fac59b92efa60e3029d7534150c0c888ebbf373", + "spec_hash": "sha256:29aaa7e481bb6a4fcc2f7e4597bb5d0a1286e8960d75d58ebd6fd605ee7acfdc", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/confirmation_tag_chain.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_commit.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_commit.json index 15c6d1c874..57e1cddb99 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_commit.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_commit.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:4e1947b27678d50bc018bdee7803e4cf17f599196cc936d55d23e0218f96b0c7", - "gen_hash_rust": "sha256:e0ba8b7e0a6c86c9db17db693961dd37b32fa60ab86f0ced043fad187dfb76bd", - "gen_hash_verilog": "sha256:d1423aca38c9e0d92cc0199b356d50c37cae08b81a749b2fdafc02502becf66a", - "gen_hash_zig": "sha256:fe66fa15ee3e5cd9a2446cbf81d2ced17b5e9417056ed674653a1b72adbb161a", + "gen_hash_c": "sha256:f74d1fa8be9265892d706b389349fbab325a5b0c465e6b1686a9a181abc96079", + "gen_hash_rust": "sha256:80d7514d3ad8723b6a0c7806a2bff0abba214375e9ffdcccdbeed0745373a31d", + "gen_hash_verilog": "sha256:bbd1890d0488ea0374240fb113d58c2af6fb7480a4bab04a59410aad8c9aee09", + "gen_hash_zig": "sha256:9e5fee76e8a193fcb471c198214025b712070d4545e1197ca8dd984168ae116f", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_commit", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T09:49:06Z", + "sealed_at": "2026-10-18T02:23:45Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:cb44d7762433ae82e6ccbd14aa32828fdd214e8012f4a9916102d393d2013f3f", + "spec_hash": "sha256:ca5f158ed9b569945bd1a0e51e65ee9ce5effc698172a46f15da77352da9fd33", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_commit.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_proposal_origin_unbound.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_proposal_origin_unbound.json index 5f6bcd4fd4..613a662e88 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_proposal_origin_unbound.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_proposal_origin_unbound.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:b7f025aea6bd72686d6ea52022773d5a7593380ded57883b696639d59492b292", - "gen_hash_rust": "sha256:c3797d2bc276e1927a8f45207958ce617103ca1d05c571be7c80339738c8d22a", - "gen_hash_verilog": "sha256:47c7b10322831eb4c8349b32ec7ad628108d1dfe7cf67f25754075577e87e5b9", - "gen_hash_zig": "sha256:36d8ecebe00b1c027c5869523db7a2835cd884bdd482dee80ccb864f23e7281a", + "gen_hash_c": "sha256:7168dd3b50a9a027b03b2ddb1fb569efa2f2573bbe9b0d8c868c187ecd87b317", + "gen_hash_rust": "sha256:505878806231caa7c518408d516e3f31ed6ab76e5bdae6b12bcb8c1d41f80a24", + "gen_hash_verilog": "sha256:dcc1d0c09d428bb72dd6aea662c101ebb83c47697a2e67f5183945a0060af468", + "gen_hash_zig": "sha256:e4e14099a58198a050a7d37bb3b23eb597c55aba01cd06c8d7b5e0002534c418", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_proposal_origin_unbound", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T10:19:43Z", + "sealed_at": "2026-10-18T02:23:45Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:54c131bf8995213b1ee19069ebdd9b6148d0315612c2d4e85f585bf4779734ba", + "spec_hash": "sha256:143d5753e3bd0fdbc05b0568403409b5862806b7c2f6eaeef5ecb9a5a53648e4", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_proposal_origin_unbound.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_psk_id_provenance.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_psk_id_provenance.json index ed1254fa06..eb01974520 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_psk_id_provenance.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_psk_id_provenance.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:cd4df0f77d9024757fbdf0a4dbeef7ad3c283fb9e4158e700ab990f2631f2377", - "gen_hash_rust": "sha256:7964fafce227de1d308f7cd2c7ea17f6aed767ef19f3d341555223e749644cc4", - "gen_hash_verilog": "sha256:51d3d046d2ea11c5d1600586bf2b45201d1cf39c8671354e2c48a1aece7a5a90", - "gen_hash_zig": "sha256:66b0442742caaba8ae2f6ee1f1acbb8a80ce56d91fc9fc02a9742672baebf207", + "gen_hash_c": "sha256:fefa6c7608e6ba45515c74400b654291943c47bddd7dcf7461c2964c32fba560", + "gen_hash_rust": "sha256:846211918c5e88ee1d896c48234a8ab4a6e6c49446fad411ffec3cc14a7b106b", + "gen_hash_verilog": "sha256:66cbe02804164522600967c6bf784036ea1f1a7c4831623d1928998616a4323d", + "gen_hash_zig": "sha256:0ae090509cf1cbc460dcff179affe357393207e34ba89dff6eb1e991861ed374", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_psk_id_provenance", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T10:33:24Z", + "sealed_at": "2026-10-18T02:23:46Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:c9d79dbc7d5c84df41ea0a89c6ba93db30d41335ec67eb040fb3b8b5f2e648b4", + "spec_hash": "sha256:d97ffcdde04e056763774186e105ee3b1b4894eaf51259c37f839ffd3f621f6a", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_psk_id_provenance.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::group_context_hash_consistency_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::group_context_hash_consistency_guard.json index 923abf166b..be8c653e27 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::group_context_hash_consistency_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::group_context_hash_consistency_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:efed7615593e866a8d58a128e572b3484522b6a7de92596728cb43efc0462d65", - "gen_hash_rust": "sha256:a62bfdeef672f25f4f4432e781b46bde25dd23673d2781b2b98218a4914b0c53", - "gen_hash_verilog": "sha256:730a9d14a9d7088b27580665a770ba4433823e566bd7a3d60ceb7e13781249e1", - "gen_hash_zig": "sha256:5c90f47fc6d263a9d267ac8b10e213f61ffde01b224dc7af74da6f1da8c58999", + "gen_hash_c": "sha256:706b6856d49af13c5c3350801c68d3c69fbf01f25d65f83ee21bf467966dd66a", + "gen_hash_rust": "sha256:5fae5f53a714c068ae6c5091a8202234c7d48378a930424a37cb4bd029e3ea91", + "gen_hash_verilog": "sha256:d31c6226f2b077f9483358e2ec5acd52bc93b55b33b0cb448f4ff1181bd32b3b", + "gen_hash_zig": "sha256:3ba19c3ace081f23d4a2d8f4949a894740bbae9cea565229134b5b77dec3550a", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-03::src::group_context_hash_consistency_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T10:47:07Z", + "sealed_at": "2026-10-18T02:23:46Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:be54536b98db2ef67f507be3588caca6cc9c37dabeedb37662602617daf0c5cc", + "spec_hash": "sha256:32bc86d3c171108f493fe2d05ce281ab7f456f3d7dd85c06fbd05463d7f1eef1", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/group_context_hash_consistency_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::leaf_node_key_uniqueness_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::leaf_node_key_uniqueness_guard.json index 91fdfa36d8..86b235a6cb 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::leaf_node_key_uniqueness_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::leaf_node_key_uniqueness_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:9133587ac781c84ef51147bca45f1f7da8de008ee3509f7262c1d58ce453d1a6", - "gen_hash_rust": "sha256:87c65ad07b66ca689e864f60cad024c79de4f7a708eb33b4fa99e889cd2c0c80", - "gen_hash_verilog": "sha256:7b5fee24d2895919df88c0d5a2d5c40f11f5ca7d60bf3812735e793f10a746c8", - "gen_hash_zig": "sha256:20510b8cb1b4d7fafe96af28f4be24513dcbe9d8777b625f6f547e106f8ec416", + "gen_hash_c": "sha256:f19ab088e995faa341d0ebab2a59f05350ac80bfbd9f40849973dfab62237f1c", + "gen_hash_rust": "sha256:a0ecc3f1ce031514d7680c0586793f0f3172a8847436d03b3354c33a36ad03fb", + "gen_hash_verilog": "sha256:3336f8b948acf3f9c8193fbef4ca62f9e9538d974a70bceb34731a107989e284", + "gen_hash_zig": "sha256:bec0217716bf89c08029bae32345234e559b2c4391c8f0cb84a1ce74ed447773", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-03::src::leaf_node_key_uniqueness_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T11:41:22Z", + "sealed_at": "2026-10-18T02:23:47Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:6a28ea5e3568ea6d8e9700025e0bf65b8ccf8bfe94b4c265e4e5233d314a17e5", + "spec_hash": "sha256:57b7f70240e418fbf6e5c77507773e615c12d0b3dc6bebfc001d1c2d961cce2d", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/leaf_node_key_uniqueness_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::leaf_node_signature_validation.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::leaf_node_signature_validation.json index dfbedcc24b..195c2c007a 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::leaf_node_signature_validation.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::leaf_node_signature_validation.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:0cc3928c06760886edbbda3a78ec869b69e364a048627d4750c0a0c12dbd2dce", - "gen_hash_rust": "sha256:e88ea574d11fee0ef65725f00ff685da9e6be029ca8219cf5a7d6c8cb19a022e", - "gen_hash_verilog": "sha256:1b0a7c14d1dfa128a74f41a2aa8d8f3dfa40233fb248db19a484e3bb49a4bc2b", - "gen_hash_zig": "sha256:e17306d442060550d304eb759a33e9137e64a09b66e680572cea66093172454b", + "gen_hash_c": "sha256:ff9e3c3446bf4b325ff171b6dff9e90fac8865ce7b3691c3faf21b24b7c75064", + "gen_hash_rust": "sha256:c1e197bb59027296e58d0b51d1f23a30ce6a3d7612e989c79d20a1a61df72f78", + "gen_hash_verilog": "sha256:b1ec645c6a9fe88f39c021a08997d0a822e5c1498429be3056fbc135f555ef85", + "gen_hash_zig": "sha256:f2df232b4a1b70ccf3546e3ae4e8658fa61c5897d1f132250f02c14fe74966fd", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-03::src::leaf_node_signature_validation", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T12:06:45Z", + "sealed_at": "2026-10-18T02:23:47Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:4c7741d2c382d487c4f0089d079011fffd9ce579e8a6b17a9eceec564249f362", + "spec_hash": "sha256:c4bb649e098e43a22313c20ea921f3ac3ab208354f139fc5eb7b90780b8f2277", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/leaf_node_signature_validation.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::membership_tag_binding.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::membership_tag_binding.json index c9753183ce..f63ec00516 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::membership_tag_binding.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::membership_tag_binding.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:efb3deed528f34e6be5f5b91ccf5668c304d4afd80e2d80216d48bdaed17ea24", - "gen_hash_rust": "sha256:6c8d186621cecacec2411af6dc56c002c60dffb0089f9d609d3e9cf5fc08c30e", - "gen_hash_verilog": "sha256:06ecfacbfb2377b4b0cab5aab904b2f257b3cd22965ec84554411376580cb165", - "gen_hash_zig": "sha256:4df060822508b531d7c5c05e231c7b2b0bf6ba1003049509f103df26ffc5eb29", + "gen_hash_c": "sha256:20bdb580781353a81514000f298ba8ac07a98c207c0df25b205dbb62e5f52ea0", + "gen_hash_rust": "sha256:35949904d7d6b1d82b3853228d8d494834e40fe9c22578266f7ccced3d632a4e", + "gen_hash_verilog": "sha256:81c7c3f69b6db201f9d2cb714001a67805ef5f7c160ae1800bc0f01a5ffe0be1", + "gen_hash_zig": "sha256:fbd1331f847991ba8b6f1f514589355bf5059425dbb54af43cfc32ba5ff8f1d4", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-03::src::membership_tag_binding", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T12:20:54Z", + "sealed_at": "2026-10-18T02:23:48Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:ae32962bf3ed58323c5612c0d360eef872602df4928d83febff2af758cc9f201", + "spec_hash": "sha256:44f458acc2d62ad54c73af5c7842ce7d3a3bf0648a235a355a856c67d438778b", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/membership_tag_binding.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::parent_hash_chain_validation_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::parent_hash_chain_validation_guard.json index a7476a9674..7c1b69b191 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::parent_hash_chain_validation_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::parent_hash_chain_validation_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:dde9d2514fc71bec5df22246282ce5d07ecd828732b16a0c5f4db15af89e1da0", - "gen_hash_rust": "sha256:c08fd91eff4ce661bc887553995104336e66806e1cdc83e5732db1988de55600", - "gen_hash_verilog": "sha256:8a226349c2b36cff02cc34fbf02459e5c7fe8d6e53bdcfc8a4cf02082614d46b", - "gen_hash_zig": "sha256:da88405c3d0e50c31d980fa89427b225653b245a9a74f3d9321bf5117bc8f994", + "gen_hash_c": "sha256:5c469f8ba4d431c0490437a771a7575affcf2069d58667c567cb6f013dbeea12", + "gen_hash_rust": "sha256:d3a491115db7d9e6f2e05f34416e8c99e88b8e025e7889950307253454eb340b", + "gen_hash_verilog": "sha256:8e7985136f3921757c814aa3d81101f003855f69ad159ea8221298cde0a17659", + "gen_hash_zig": "sha256:a8bf5e4a83e54c036d82850e172c857d87b1765da6240ff648be411eb39c3900", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-03::src::parent_hash_chain_validation_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T12:35:05Z", + "sealed_at": "2026-10-18T02:23:48Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:18f9049f5ba9868d24f10cf3cdbbe5bc5164b0591409a8be3a34977b8679e1b6", + "spec_hash": "sha256:ec370fdc1136ea6e35f47b1464bb0b71149e5b69bfe315b92509a99910f4b86e", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/parent_hash_chain_validation_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::pcs_healing.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::pcs_healing.json index d3f100e74e..199acac6fa 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::pcs_healing.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::pcs_healing.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:cb668e90d82b3bc3e4f1b199282a9539f6c5c1ca2f6829da0cefa62f36f28773", - "gen_hash_rust": "sha256:a71df65a0787888fe0528d4569cdbc937fb9930fb6d422a39863daec51e040e4", - "gen_hash_verilog": "sha256:9b97e775e669161293ab1c2212257d7ef2da3d5a6159a896f2d00d78e9826e99", - "gen_hash_zig": "sha256:d277429deba8662a7ff9aaff0f060fb80d80987557bab98262a6575d43bbcbbe", + "gen_hash_c": "sha256:7be4b95f14979058539957c6241a2531bb8ef00c9a2fa3599c0d6fc2934fbd3b", + "gen_hash_rust": "sha256:ba574040eb3a54556d6ff05880938e8dce687581ca37fa439c348918a00a56d0", + "gen_hash_verilog": "sha256:8945a24196674a406add4d85a4f958363aa5c4489cfda68c46828048e982c368", + "gen_hash_zig": "sha256:ef63be7581cbf9063d45f3524aa2f0fd3f07b1b082b17a57eb32e01fd71bc725", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-03::src::pcs_healing", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T12:51:14Z", + "sealed_at": "2026-10-18T02:23:48Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:c7db8949387cb4eaeab2ad8e2e9c88bbbb6ab31425ef39caef9fef033489b949", + "spec_hash": "sha256:b1464f5940edcee1749bc6b98731a8685c7c16e6b00af907b8504851b1ffd623", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/pcs_healing.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::proposal_ref_collision.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::proposal_ref_collision.json index 448ad41d8c..9d88993637 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::proposal_ref_collision.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::proposal_ref_collision.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:54feacd858e263edebeea6f7f8beea61c0cd9ff9d0e0fcc77d01b965fa943575", - "gen_hash_rust": "sha256:0f2ee3df5f9342464baf2509af9a29df6f9ee0e9f9db07e7ffd7b09982b7bbc7", - "gen_hash_verilog": "sha256:5cd3f8abe43fd3537acaa6203f346a372a6cf86927fd1e9b6ccfa28a185f683e", - "gen_hash_zig": "sha256:942540da1dd44d1fa520b36d74334e4f778ef84b4d4c539193637b5bd2ca741f", + "gen_hash_c": "sha256:74fa4a07def5b5f3100507c5fb38c0d003065b46d8f6348f12905bb4f28d3ea6", + "gen_hash_rust": "sha256:f42a1ace51947ae4206162cc15741c90a225db6721a765985cea62bec7bf4307", + "gen_hash_verilog": "sha256:4394334073cdf3674a83160674ef131216b6b2d1928a875deefdab92b3cfa689", + "gen_hash_zig": "sha256:3c67dd5ee260090cbe6af2d976b53eb77827794d73d109942dbb4cff10bf2976", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-03::src::proposal_ref_collision", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T13:09:56Z", + "sealed_at": "2026-10-18T02:23:49Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:debcfe4ca0708407dbccce53bfb61d7f245aa9f0c463ecb13c986be6fe9b00da", + "spec_hash": "sha256:cacf30052e435979175c0c2fd4199756d1a0c2e740f7218c52d205f526e41d40", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/proposal_ref_collision.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::ratchet_tree_update_integrity_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::ratchet_tree_update_integrity_guard.json index 027177ba4d..7311b41a54 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::ratchet_tree_update_integrity_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-03::src::ratchet_tree_update_integrity_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:000e5eab294c0c753504f25195acc809377d7f7a8e95a2b27cf4980a00db9311", - "gen_hash_rust": "sha256:b3e126bc2a02b0b09abd2ce4b395f3ef014003e70c92e85fab3b97f4a90659e7", - "gen_hash_verilog": "sha256:468becd2cbd4b9d753dd1788c6e233704d0c828736ebad0483ff715e996f967b", - "gen_hash_zig": "sha256:f02dfea66b3e4c7e419cf89902d92d00bb0115b6c77dd54ae65b1fa3ae4fa529", + "gen_hash_c": "sha256:759217c419dfae723f6bf1a9c1e3fc0140915f10807978812437e072e24f8827", + "gen_hash_rust": "sha256:5ca8d7b0f6a87e5d7db1616b2d349e733b60a7d6a69e4b3ead9bddc13b758070", + "gen_hash_verilog": "sha256:f17f89274efe8c3427c1b18a602c58e802f401a6997068f5c5d9b8971562a717", + "gen_hash_zig": "sha256:2dd221e2d7abfc972595a25953cf59337961eae7ee59ac7c3bbb49eb23302889", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-03::src::ratchet_tree_update_integrity_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T14:00:53Z", + "sealed_at": "2026-10-18T02:23:49Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:768e5ce725e6b6c2a407b5cd0c9628774cb202409c001b2ebcc4ffd8dadaa67d", + "spec_hash": "sha256:986a8134dbe7a9a9d285f92b0a7a85a31e5a468205aadbd025174c4e71f3da8c", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/ratchet_tree_update_integrity_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::application_message_generation_skip_dos.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::application_message_generation_skip_dos.json index 47d3ed6b5d..c70df94e08 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::application_message_generation_skip_dos.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::application_message_generation_skip_dos.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:a5685b2503fa6471b679a8a6612050aa1f2b2bf8156d2ec44213ea85d613ef99", - "gen_hash_rust": "sha256:abd1593938d72bbfc9d572f8adfd08bdd090e21a3d3f7385ec3d6d2acdb8cf31", - "gen_hash_verilog": "sha256:a969cc380ea1f50c30ed1a35e36c60e75d11b127c90ea9bc8087fa247e7e5685", - "gen_hash_zig": "sha256:d811fdb0334f599db5adfe3fb5ac646f01c39e487a2d71c97f7d24acd6b4f248", + "gen_hash_c": "sha256:97f5301af04489f37bf804a019b96df223ff82c396e42af27f3e3fb042f43987", + "gen_hash_rust": "sha256:68f101fa0bbd6a114a5c486903e9b064bb53e04b73c4cb7b658574975217f510", + "gen_hash_verilog": "sha256:6223cd3d4a30ad561b39b9899016367a46741e51f78f75166be4cfc137be91cc", + "gen_hash_zig": "sha256:c6d1a829957f473dd282b410c99094929ae8bee6c2745578f762651528e4f439", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-04::src::application_message_generation_skip_dos", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-15T21:25:10Z", + "sealed_at": "2026-10-18T02:23:50Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:c6c5d8d439602f073ae1fa1100496f631ab6107fe6a6dd9a4af2ba4d1c95d282", + "spec_hash": "sha256:29b2b15c41461ffb7a8d15fac3dc637147437535c5f95489a4fd7ce16b247cd2", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/application_message_generation_skip_dos.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::mls_plaintext_framing_integrity.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::mls_plaintext_framing_integrity.json index 5a8dab9596..c44a28c057 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::mls_plaintext_framing_integrity.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::mls_plaintext_framing_integrity.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:c080424bf1fbe0ac5418c9930c572b0b55034dbf1c57b2273df79ddddeceb253", - "gen_hash_rust": "sha256:5f7b5364e1aa28aedddfd4081d26d35f1217d4070d7cf9dd7661a3441b112372", - "gen_hash_verilog": "sha256:0cc55c28aef48e4b96270b4784acbad3ef4ed5bf407413d1a179cbe42a1269e2", - "gen_hash_zig": "sha256:96c3e5f3f2418b74fc7c64240fc3bd205fba264a9062e6d0e56e7e4f01030da9", + "gen_hash_c": "sha256:0502800dc087920d82f1d08ef7f38cb0fbf06b1f4a41bb6b0fc080e6cdcd0eff", + "gen_hash_rust": "sha256:c8c4856f4034418a750250f3b9baa4e84248706e2ff1c9c8225a0c03ab540b64", + "gen_hash_verilog": "sha256:1be60c71d2ce3b4298878c1b231d2d7ee5fd65a4e7d1fa6f16ad93053e66ca9a", + "gen_hash_zig": "sha256:77b2efce7fcde4e4568c0e6929fc1a622aefa63bd36856649a35a4ec9dab2d16", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-04::src::mls_plaintext_framing_integrity", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-15T21:39:27Z", + "sealed_at": "2026-10-18T02:23:50Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:c91b6a2b91c96f7461cddc76fbeccfa82c577dccc384030a4de4e4b6b002c655", + "spec_hash": "sha256:af59149d916326534d8f610a29842d56beee017d3785b0382e516bd99994a138", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/mls_plaintext_framing_integrity.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_block_size_alignment_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_block_size_alignment_guard.json index 012b6d114b..447847d595 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_block_size_alignment_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_block_size_alignment_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:0ba5db0caf62e64a0e96c3c553865992dc347897496c5d539488b56e50a62996", - "gen_hash_rust": "sha256:47e043b8226212e96995cbdd61bf157b4d97c92c53c97cf163f53dd192a4f3f1", - "gen_hash_verilog": "sha256:d11b198705aad1728117878c333d245c3a559abd313da24e77714d2badb4900b", - "gen_hash_zig": "sha256:a6af105a8c96a7238e6e6e3c66504c815efb211ad7e7365e6e30702884240428", + "gen_hash_c": "sha256:35a39a3bcb1c4115bc02e49b26c407fcbe2522d4864916713f6927b8ba97491e", + "gen_hash_rust": "sha256:6bb3068559e897a250ddd25c0d90996561bede0c8f099807ade3a60e371d00bb", + "gen_hash_verilog": "sha256:a8741572486ad48a7ed7c90e8173fb389e325d05ae66cd0dad4dab5559162912", + "gen_hash_zig": "sha256:e3147102d07127b13cf6c70466a3db88bf8b2cfae537b4baa8fc5a1c66cb39bb", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_block_size_alignment_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-15T14:20:22Z", + "sealed_at": "2026-10-18T02:23:51Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:de4641f8b9caf3bc6a3ae32992bf1f371f401fe3dfa08b63a5d3fe730c6b8758", + "spec_hash": "sha256:d5c2c659564292d5e0bb9b5054cdaa9142d24d51b35bd8a29440677351c9e730", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_block_size_alignment_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_byte_pattern_uniformity_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_byte_pattern_uniformity_guard.json index 536bfed80d..ea90e16da8 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_byte_pattern_uniformity_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_byte_pattern_uniformity_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:9f31c02e3f46be27a1aeb2e9422cdb89d0466823fb9a3f51cecd6e3f0a7da384", - "gen_hash_rust": "sha256:7d2fce07619d94c72ddc56e8ff31af2f2d419f1c2c0a14540106888a4bb800eb", - "gen_hash_verilog": "sha256:8a8369f37e335c2f6f16c93935cef66086c16285e3ae09af4b310262d5172db9", - "gen_hash_zig": "sha256:fc0a9d59496964d6cba26d7c9f3832d650e20d0c5ca97bc2b4c106b76725820b", + "gen_hash_c": "sha256:477acb2c489a99d6abadd2b4931c08e09f7ffe765169f7c6fb763f3a949d35a1", + "gen_hash_rust": "sha256:fc5682dcfdc871a5eb34111ee2e71b085e03c444b637fa67731afdf771f0ffc5", + "gen_hash_verilog": "sha256:743d5acbd5a518e72a6287b3ef06d75c3a94f53b922550f7783cbfd77907af7e", + "gen_hash_zig": "sha256:fb889f8d9842edfaa6356f6f7766e7df71d809b2f185ba936f328ac78c26c109", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_byte_pattern_uniformity_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-15T22:11:13Z", + "sealed_at": "2026-10-18T02:23:51Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:eed60968caae6d977223fa6a3b10aabc940c68ef24870ab9d396f0c7f12f6751", + "spec_hash": "sha256:9a7e1f7569387848ce30d33e0ddd30e618cfd3ed4b1ac6e8626e4d54cd2501f2", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_byte_pattern_uniformity_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_class_transition_entropy_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_class_transition_entropy_guard.json index c5d6ab1c8e..2adc7966c3 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_class_transition_entropy_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_class_transition_entropy_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+0d4fe82f2", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:9342eaf9d311966f3e53be984be6bc4fd479464878553190fd8b307e1ae085d4", - "gen_hash_rust": "sha256:1c694f42e218fb7231deda2683b62a5b28d06e2fa315fdfc1e561f01d561cef3", - "gen_hash_verilog": "sha256:fdc91c1e9397b44e0e5ff11b84c14674730157e48323e58a532f2237b1ce4e4b", - "gen_hash_zig": "sha256:5708b64336fafd4828ced91eb5054ed857508c4f3a9d5993afc3730dfa4bbf29", + "gen_hash_c": "sha256:b2ccc65d29b7ef740b13137b3125b38b5831b9dc900ddc945ddb168410600fb7", + "gen_hash_rust": "sha256:1c3f0dcb448bf5bfb2b67ce4aaf78a36da35499dd1cf0856c59a7cbccac5261f", + "gen_hash_verilog": "sha256:87a87837d3db44635d0d8f2fbf6f615e89ed2c5e8fadfeb334edd6c006c9f815", + "gen_hash_zig": "sha256:748989c3cb085681f639402c30e5b284472b7bcd3953c398d2f0a0c3d0a4c520", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_class_transition_entropy_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T19:30:05Z", + "sealed_at": "2026-10-18T02:23:52Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:6fc73b689e96fadddfe54d70eb16d9d2bacc5b0e5555f3582f7f7e7cad3ff603", + "spec_hash": "sha256:ddc19461715cf02cd87441dc27b4d7e12f975b1e88f8d2c5a6753e506895a9e5", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_class_transition_entropy_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_fill_byte_randomness_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_fill_byte_randomness_guard.json index 0eeacef67b..492e30845b 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_fill_byte_randomness_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_fill_byte_randomness_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:7ad0f74a273f4beb04112cc728b553e5b82423fbd6e617c259b807af02756415", - "gen_hash_rust": "sha256:c594bc45527c5549b4d56474e3ee0c846c725a5f9571823eca4a8b8f95e32c18", - "gen_hash_verilog": "sha256:e1d183d1359a2e1c806d050b0c965d4852b4f94e4e59cb7f326b127622f10d3f", - "gen_hash_zig": "sha256:f1c79e1966acfe753351587f496e4a4a2b3c570a272d5afb22871699ae30b8d4", + "gen_hash_c": "sha256:258749e63b9becfd6fef610ece22ee6e1d1741b0fecd1439d76a076c684295fd", + "gen_hash_rust": "sha256:b1f0eee02c719c494706f30f193039dff0df8cb7d7044436c968b348af491722", + "gen_hash_verilog": "sha256:0b09a9ee4608257dca6dc704b6d3fe0efe8a9e44168b171db2be1a57ece5506a", + "gen_hash_zig": "sha256:e93b4f7fea326dc734f11d941e3b4f8d8828c333c2118ef7d34c2ee3938eef62", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_fill_byte_randomness_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-16T05:05:13Z", + "sealed_at": "2026-10-18T02:23:52Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:bbbff617693c02530c4fcd50a1a939ae0c9a665af969a25a553582222b872184", + "spec_hash": "sha256:34eae9ea5c7d8a4b0d1c5955bf1074cc5ffcb8509c54800f6577a6f829c94ec5", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_fill_byte_randomness_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_key_derivation_domain_separation_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_key_derivation_domain_separation_guard.json index 8c87b000a0..4943829cb7 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_key_derivation_domain_separation_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_key_derivation_domain_separation_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:6f48b2278d98b8a22be8ee83c7ae89486ba3b5d6d1853de9a310655b89317606", - "gen_hash_rust": "sha256:7db3f7bfd2ecd91d30dedba3fabef3c22f939c720a4633528b0b033643f4ba2d", - "gen_hash_verilog": "sha256:f8c099d5444b552fb187d179a11d6cbb7e5efeba957d1ad79e406aa9a0db879e", - "gen_hash_zig": "sha256:e57f860ed8e1da4be537a16b7ccfe670803a32042e88ddd97a3d32684e4e9990", + "gen_hash_c": "sha256:9de5a0f11ff3b5513167c9a5aba218585b8f2df08691afaa929e4691457e64a4", + "gen_hash_rust": "sha256:cde717e45abd39418b6162eab2c45193f7873e9942c1a6ce18206044426f4f05", + "gen_hash_verilog": "sha256:df0ce10ae6f7f2c2477ecfa77ceac2bf06ef4d3cdb96d8ee3a244266513f91bd", + "gen_hash_zig": "sha256:f121e07abc7d9cabe81765d4427d29b83c26d71241a4cfb09c460772f24f079c", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_key_derivation_domain_separation_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-16T06:43:32Z", + "sealed_at": "2026-10-18T02:23:53Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:c1af265d441dac1b7549091ab28c10711e28d1bfc7819864a9ce7342f0c942cb", + "spec_hash": "sha256:fcf497681bad27509ae5578a84d06b481b83c919c2f9620511286359b325b0bb", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_key_derivation_domain_separation_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::blind_signature_sender_token.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::blind_signature_sender_token.json index 2962b8b422..9f0adddc5c 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::blind_signature_sender_token.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::blind_signature_sender_token.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:a9aef81477820e14fdac862dfa733659de68c2d9cca62dc95f8ac7d06ec53b0d", - "gen_hash_rust": "sha256:f31f8c4f0f2b920cfac0b82e6ad2744d22cc670d10bc06e29240425b7c40b0b5", - "gen_hash_verilog": "sha256:73f400185a5f70715ea07b9bc187c279c04e516b20d1f9c4d2f9ffadd03ae192", - "gen_hash_zig": "sha256:a017e8ada8416477d18109471ae8dafa28bafd844b97421536218638642dbf7a", + "gen_hash_c": "sha256:01e0d046e11c0b086a6cfe3c723b7e4df2dc0bf16bf1ce6c7a40b6936546e0fc", + "gen_hash_rust": "sha256:c96a9082a7fda4e1f18efab8bd016ad8c46cc37c0ed5c28551a9b4ef7bcc965e", + "gen_hash_verilog": "sha256:cbd4c725da089cb063f90985bcba113395ca4773a9e76e8785b152b007ea1f89", + "gen_hash_zig": "sha256:703e108d28f0265be093eb1d54acef04f73b189e92cd67c715b520ab694a1245", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-07::src::blind_signature_sender_token", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T00:46:13Z", + "sealed_at": "2026-10-18T02:23:53Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:a7adb82e6c4d5fb9a080d6d63961e3e1121abc5ba693016bc38c4bd82fe643ca", + "spec_hash": "sha256:c0e451c5a662c5f9348b6e0c826623b4cf49d6ac62e753591b4c56adb39104db", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/blind_signature_sender_token.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_burst_interval_regularity_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_burst_interval_regularity_guard.json index 07f1f239b2..6b59ace1a6 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_burst_interval_regularity_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_burst_interval_regularity_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:de45a5d32eeb94d35a95bfd9595efee6a071085b785564ad0dc393a58be0691e", - "gen_hash_rust": "sha256:c15b7859455f1d15d3ba4c07ff35da868c715a5049fd59bc52f65dcc222576e9", - "gen_hash_verilog": "sha256:4144b7eb2ebe33790c9b345b1b8780f54fce90fc84084a44b7a8fe458c49f3c8", - "gen_hash_zig": "sha256:97b5084294b9e68054b16a133e2201be1eca43aa44c5dec3f53956fc6c3b79f1", + "gen_hash_c": "sha256:565b38da2a90b94dd396230b7cbeca6aca391498bde74d76d18cdeddfe93a847", + "gen_hash_rust": "sha256:36d6d743a803ff8757fc54462d27daa15af688dd9e009a9aeb46a448412e1b01", + "gen_hash_verilog": "sha256:a5c5c88360f9831ba963aa92ce8c086f9eb03f7cf18a5dbddaedbc4b064dec1c", + "gen_hash_zig": "sha256:4d8f12d6fcdaea657affea0a7128f70444600f4011fe50416543fb1bf9320a11", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_burst_interval_regularity_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T00:57:48Z", + "sealed_at": "2026-10-18T02:23:54Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:550f34dd189403d4b5d5b564fff8e84b6eb68edc0d2cb0cb55c3f3ecb7763f4f", + "spec_hash": "sha256:61a0ed4a400d10af8d6a2207d3214c696de72c2409a27399fb246abf469e7d84", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_burst_interval_regularity_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_destination_rotation_frequency_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_destination_rotation_frequency_guard.json index d8a29a90a4..2070707eb0 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_destination_rotation_frequency_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_destination_rotation_frequency_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:8968300f4934c3639cf7acdfbaa8ea8a3b96e69fbe21870bc6d7c454d207ea5a", - "gen_hash_rust": "sha256:50ec2e467956994ce91b28d38c59a9cb359d949dbc6deafab6f7cf3dec249b2f", - "gen_hash_verilog": "sha256:8975217582a9499535b4f8215a4c613572eed81cb7339b0a8801761df9860ae5", - "gen_hash_zig": "sha256:389e7227b5fb6ef13686603ce7f846f9e41f22d64d40041f5f8d0e551492fd86", + "gen_hash_c": "sha256:81958810c0f4cf1e418588cbbe47b8c12916086fbedc2c4ad079e3c660db7d10", + "gen_hash_rust": "sha256:f45491bb02ad9137d56136ef989a8fff13cf62b40e69494f7ac4cdaf25385188", + "gen_hash_verilog": "sha256:12d8c90f434b317d769fc598b7d79733cbcca40712ef446996664a473f1a6361", + "gen_hash_zig": "sha256:b5069b351a1f1440d17185078548036659d2cfff8d4e282754c942bc271a2293", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_destination_rotation_frequency_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T01:09:53Z", + "sealed_at": "2026-10-18T02:23:54Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:21ff8f4c0ae76af5cd71a4026a2d027c9fe7050bd7a2d5941cf5a9626b2d55f6", + "spec_hash": "sha256:7c0a4e82d6a593f50117ca232598c67d0f8125e14a7ea0cc75ae543caa23d195", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_destination_rotation_frequency_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_destination_uniformity_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_destination_uniformity_guard.json index 908994f555..eba5ce1116 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_destination_uniformity_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_destination_uniformity_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:1f7bffb35648431231aae2d96b6ac1e348a55714f8079248bc886efcf9a08275", - "gen_hash_rust": "sha256:e83dc9d658e9753d2c7d8873560c3e1de77e06fc88bfc2243e2a825b9ff1ea13", - "gen_hash_verilog": "sha256:169295456bd6c38684cba557592597b010e762066e5ae42435126f3abdb3bfbc", - "gen_hash_zig": "sha256:fd1367e34c00b2911439a98335e0452369e82d20821057bea479f54a2e5ff834", + "gen_hash_c": "sha256:83e6e4ad42b8144c97852d073a531adf2ef3a84aa06466429990f4bf81ef3c20", + "gen_hash_rust": "sha256:24dfbfbbd17d012b2a102e89ac2e2f05fd0c3d53a93126c47446342f458c77ea", + "gen_hash_verilog": "sha256:2cd0f7e49b8e8bfb923184ce2eb608592eaee234c8da024b83eceea0dbb96d68", + "gen_hash_zig": "sha256:4f31ea183ac2ecdb2fe3b8e9c28884d2a40f0aaa7cabe4e31c85b611014ffaff", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_destination_uniformity_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T01:19:29Z", + "sealed_at": "2026-10-18T02:23:55Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:4b7d464889ef59404f68ed4defbba8915daeec1675ace88f2c5f71ca45f63225", + "spec_hash": "sha256:efd0bb8ae75d23db4b168c49650216dcfb3bedd6160169fcc34e33fe1e092fc6", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_destination_uniformity_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_inter_arrival_autocorrelation_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_inter_arrival_autocorrelation_guard.json index d7cfbfbfcd..ae059260f1 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_inter_arrival_autocorrelation_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_inter_arrival_autocorrelation_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:b1e73e25f6638898369350b5568de8bf84b2033bff2bfbd1377c1256ad652f71", - "gen_hash_rust": "sha256:09a813bb220e1711e92983320c70435015fff41a3cb063fe3b3e62fc79ef4c7f", - "gen_hash_verilog": "sha256:9b4aee21e02c2ac9da4e0e735b6d61e8ead71fed45466f5f9da4844d127419e1", - "gen_hash_zig": "sha256:5b80350895db8b3fa3859b18b13e1f9285bea03e266c0e2c9ab8d28dc052fc5a", + "gen_hash_c": "sha256:cfeee0fa2f377e48bea7ae9a02fa5d0eac6f6874d7e0bd2316d9d65774a19e6a", + "gen_hash_rust": "sha256:acec15181cb99debd5f47a6f1975700a749a461df28410abbe74e2ea4840c871", + "gen_hash_verilog": "sha256:d54a85bd7ce72053355b3708a98862e54c5f9696d0b825c5b7f879ef231a5bea", + "gen_hash_zig": "sha256:d56f4df09ed9866ce275a6ea30bc99b96d19ac87e805b97e5ca574cb5bd3a6f5", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_inter_arrival_autocorrelation_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T02:09:51Z", + "sealed_at": "2026-10-18T02:23:55Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:9b7c21863ff9fbdfd9e26e0618fd59d98eb6fb34ad4cca733775507ab45099b2", + "spec_hash": "sha256:2742a57299e77f276df116d33f332cde62b31619fa1077912eff0c97a5d28230", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_inter_arrival_autocorrelation_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_inter_destination_timing_uniformity_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_inter_destination_timing_uniformity_guard.json index 7b08e55e23..c2a52a5c34 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_inter_destination_timing_uniformity_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_inter_destination_timing_uniformity_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:0eec1e257d888eef73927b6503d39427a78ffdbd585318071bd2f126172cdbf1", - "gen_hash_rust": "sha256:76f0d003cc805c1b99c01647ab8223a09beb63903feb5f89cb8e9ce4b127b2ea", - "gen_hash_verilog": "sha256:e09bc271a83807fa341daa647f66b027e2c91c14459fb16b0508e5b8af768ba8", - "gen_hash_zig": "sha256:916b23b4b1993584eae7b8b514a23489b8865f9ba1dfa615a8879ae0bc24c26d", + "gen_hash_c": "sha256:040f7483bc97a41291632884647e83e197dac71b3b89c67ebba751edc13a0637", + "gen_hash_rust": "sha256:4dd1df250b41040b617a2c5f118880ce59e59464cded99ed24abc0849584a3a2", + "gen_hash_verilog": "sha256:2c89cad8d78911772acebb17ece21249d391a86f2ad8ec439445a1457b4a6564", + "gen_hash_zig": "sha256:66661a1f2e68dd9ecc757bd3bde0a85ccdf093a9df879368e87caa1a51f0c8fe", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_inter_destination_timing_uniformity_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T02:24:35Z", + "sealed_at": "2026-10-18T02:23:56Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:4654562b8a4f0386b2ebda235419cc277aa6fd1d3eaea35da065f1f640f5f594", + "spec_hash": "sha256:61e33fc91770dc4000b849e6aedaab1f151875f9aecc2db63cc252daef9ae9b1", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_inter_destination_timing_uniformity_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_replay_detection_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_replay_detection_guard.json index c30c2bb8f1..c7e8baf6b9 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_replay_detection_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_replay_detection_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:5d163c948bcbd1bf56d800662594f481fcfb25c3b88fab43b58b185a21ae5f67", - "gen_hash_rust": "sha256:0431e36cfd9545d88a4cae54f41ec5781b314195ab9a3e5f4bddd7c16c09452d", - "gen_hash_verilog": "sha256:7d21d6225202df08c904c41746d605beade8fab25cbc04687146efcb3b12a28e", - "gen_hash_zig": "sha256:5e22547ca28a10b4eb0b16eb09385d6db7b59bf2cbf107384192a8ae6b47f67f", + "gen_hash_c": "sha256:635af50d8887d518970fa303cd4075293c1675d99a6361ce52fc34f73ef78e17", + "gen_hash_rust": "sha256:2f7ceaad57c4eca94da3b43f23d1c0b6e4484d2262e8c6d527a58b844c8ed2fd", + "gen_hash_verilog": "sha256:f2aac149e3805c2b3fa8c32355f32bb3d58ad3f4ec9d1ce3b0221bad884dae86", + "gen_hash_zig": "sha256:60af6d598e4e092c93067b9a679c56be94663a0ed798300bfd893ba704bb6489", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_replay_detection_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T03:02:40Z", + "sealed_at": "2026-10-18T02:23:56Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:5f8bdbea4ad59f4e450b604c20ee40c98ad8bc78b1c192f33ff01acce365f695", + "spec_hash": "sha256:671ce72b5aa416b2965c242174301962fac7c621f8fd7bf4d511068f76df9853", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_replay_detection_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_size_distribution_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_size_distribution_guard.json index d19f64a0eb..9ac123735e 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_size_distribution_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_size_distribution_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:3630892ea69d320e1b18f05bb1798e9857d0a5dd8977f7f684370bbd833c724a", - "gen_hash_rust": "sha256:da435018c639de934a252b0d97eb020b02aa54b8f9b5831fa64311174f628835", - "gen_hash_verilog": "sha256:0f729f9d8fa4cb9e19f16c7351d14301d3214d2c11f2fd54fbc0dea49679d216", - "gen_hash_zig": "sha256:f70a7db9be5ed52c6ffac7cc7ae43062af354141591f803e7ef7e7547272754d", + "gen_hash_c": "sha256:414224f3ac80df115431f310587582c485da7c39f10a880be4c0b78ad32272ca", + "gen_hash_rust": "sha256:731676e3ce716a42594dae94413eac72da937144ce607c36bb02b17a19478741", + "gen_hash_verilog": "sha256:569193d98da93983c93f7fb47007f00651b3ec4ed896fda5a59b285cb6edb4e7", + "gen_hash_zig": "sha256:3dbd7c938c6c34b3e4ded11b19c049ec3b8123d9ddeab986feb96436a6a26b29", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_size_distribution_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T03:13:13Z", + "sealed_at": "2026-10-18T02:23:57Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:dde672975ec6250715705fcd3f2cff9e8c6b3e77c476715b94d39d5b07df6bc0", + "spec_hash": "sha256:0dc53790f16f8d08454bf38985c45f0cc3da7b31312d6bb3eb4b53302e8ab89d", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_size_distribution_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_timing_jitter_uniformity_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_timing_jitter_uniformity_guard.json index 283b8a8acd..fafa7aca07 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_timing_jitter_uniformity_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_timing_jitter_uniformity_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:e372c7279326aa573be3ee4863abfee0950611cbedbbc103af5d972051f4ef94", - "gen_hash_rust": "sha256:06a784c6fd4686c456aaadf696614f76ab9b8c4843626bf492b4b4b9380c9732", - "gen_hash_verilog": "sha256:cc5ced2f81f117c680d559f9e4c3d1cb028997b09b826ef992b2d79f7e26a85c", - "gen_hash_zig": "sha256:3c1d82ab2c8294a8a412cad81c80f81228a77c02af543495e89ee0d5f61c2eb2", + "gen_hash_c": "sha256:1aed513cb0b9b5b9414f80a0301d8a5e451e77766a1e127ccedbe7323a66b8d5", + "gen_hash_rust": "sha256:c004fc122f5e772c006e2bad7706cc82eef7a6f0b6eb97dd62a2e44d4d01628f", + "gen_hash_verilog": "sha256:0af71ff399320b93690aed998b25e1af593a40bf0f6db187b5639d03163c4122", + "gen_hash_zig": "sha256:cae301f6c3b40d12420d1c8a390bbf853fe80ed996bb84f6f6021a73edfadafc", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_timing_jitter_uniformity_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T03:46:05Z", + "sealed_at": "2026-10-18T02:23:57Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:3dfcdf7604f81b088d9c82cd41d91b347a03dd1eedc3ec565a468e58f34eb89b", + "spec_hash": "sha256:e825cdb1cc7155513eb08694816db768439d407bec317db6c0da1a8394a90cb2", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_timing_jitter_uniformity_guard.t27", "tests": { "failed": 0, diff --git a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_volume_ratio_stability_guard.json b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_volume_ratio_stability_guard.json index 558fe54005..9c0fc92387 100644 --- a/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_volume_ratio_stability_guard.json +++ b/.trinity/seals/src_port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_volume_ratio_stability_guard.json @@ -1,17 +1,22 @@ { - "built_by": "t27c-bootstrap@0.5.2+01d0a635f", - "closure": [], + "built_by": "t27c-bootstrap@0.5.2+18c98cc77", + "closure": [ + { + "spec": "specs/port/trios/crates/trios-chat/common/helpers.t27", + "spec_hash": "sha256:3e6999616f3579026144a6b55f0297ee4479d3bba187973a2ba5f3ccb726a248" + } + ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:8f8fa7c00077e9e0f77a8299bf19eac15ced5df646560603c51332100ff6fa48", - "gen_hash_rust": "sha256:cc1a5ca1d8de476eb6e97de5830e6834a339c47de39f5086324c4923c19040bb", - "gen_hash_verilog": "sha256:08df8d5647b7e8517f5ada3d9527c8ffbfe1172a1921a9e98b1bc631e6164790", - "gen_hash_zig": "sha256:8a5fbc958364cde1fb27fa665c6a57241f62554860cc10beb2eb678eeec6bbaf", + "gen_hash_c": "sha256:06b79841a7e070b3c9242f84d5c94e4f2751b96cb463c0ed1c4eae6cf7829639", + "gen_hash_rust": "sha256:5e202f19f0d56f1843d45dbda693275a0e3c9822158d5b7a27e7b50f5f0c9594", + "gen_hash_verilog": "sha256:d8c2217a4aa27c1a39c6aa3ac3ce04e0387c170fa027362c32074ce8eb779dad", + "gen_hash_zig": "sha256:87c76a37ff906c27f6102e29b8d616b810701e2e0ee80fabeebd13e5dbc8af39", "module": "port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_volume_ratio_stability_guard", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-17T03:54:59Z", + "sealed_at": "2026-10-18T02:23:58Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:35ca557ed29b872b49c453b1031d9bf54af34505fc65671b3fd7c43239663f22", + "spec_hash": "sha256:0f7cf65d799d713cd91a406fada41e89ad9a8be0fc2c87c67162e8a2608b6116", "spec_path": "specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_volume_ratio_stability_guard.t27", "tests": { "failed": 0, diff --git a/specs/port/trios/common/newton_sqrt.t27 b/specs/port/trios/common/newton_sqrt.t27 new file mode 100644 index 0000000000..f453cc0971 --- /dev/null +++ b/specs/port/trios/common/newton_sqrt.t27 @@ -0,0 +1,29 @@ +module port::trios::common::newton_sqrt; + +// SPDX-License-Identifier: Apache-2.0 +// The f32 Newton square root the trios-phi-schedule, trios-ternary and trios-trinity-init ports share. +// +// Each of the three crates opens with the same primitive under its own name (sched_sqrt, +// ternary_sqrt_newton, sqrt_newton32): x <- (x + v / x) / 2, forty rounds, quadratic convergence far +// beyond the f32 tolerance the callers test against. The duplicate-bodies gate listed them as one +// group; the ports now `use` this module and keep only the helpers built on the root. + +/// Newton's iteration for the square root of v: forty rounds of x <- (x + v / x) / 2, seeded at v. +pub fn newton_sqrt(v: f32) -> f32 { + var s: f32 = v; + var i: usize = 0; + while (i < 40) { + s = (s + v / s) / 2.0; + i += 1; + } + return s; +} + +test newton_sqrt_answers { + const r4 = newton_sqrt(4.0); + assert(r4 > 1.9999 && r4 < 2.0001); + const r2 = newton_sqrt(2.0); + assert(r2 > 1.4141 && r2 < 1.4143); + const r9 = newton_sqrt(9.0); + assert(r9 > 2.9999 && r9 < 3.0001); +} diff --git a/specs/port/trios/crates/trios-chat/common/helpers.t27 b/specs/port/trios/crates/trios-chat/common/helpers.t27 new file mode 100644 index 0000000000..7a98c46f94 --- /dev/null +++ b/specs/port/trios/crates/trios-chat/common/helpers.t27 @@ -0,0 +1,180 @@ +module port::trios::crates::trios-chat::common::helpers; + +// SPDX-License-Identifier: Apache-2.0 +// The small byte helpers the CR-CHAT-03, CR-CHAT-04 and CR-CHAT-07 ring ports share, written once. +// +// Each ring file is a port of one Rust guard, and each guard carried its own copy of the same few +// helpers under a local name (hashes_equal, dests_equal, obs_ids_equal, is_zero_id, ...). Landing the +// 66 port PRs in one merge (gHashTag/t27#10098) put twelve duplicate-body groups into +// tools/duplicate_bodies_baseline.txt. The ring files now `use` this module and keep only what is +// theirs: their verdict types, their rules and their tests. +// +// Three families live here: +// - equality over a fixed-size id: ids16_equal ([16]u8) and ids32_equal ([32]u8). t27 has no +// whole-array equality, so each is a loop over the bytes. +// - the all-zero probe: zero_id16 for a fixed id, all_zero_bytes for a slice, and bytes_equal for +// two slices of any length (the length check comes first). +// - the integer square root approx_sqrt: a bisection over the whole answer range of a u64 (the +// largest root is 4294967295, and thirty-three halvings settle it exactly). +// +// The record-bound scans (id_seen_before, obs_seen_before, dest_count, member_contains) stay in their +// ring files: each reads a field of a record type that ring declares, and t27 has no way to write +// one scan over several record types yet. + +/// Whole-id equality over a sixteen-byte id. +pub fn ids16_equal(a: [16]u8, b: [16]u8) -> bool { + for i in 0..16 { + if (a[i] != b[i]) { + return false; + } + } + return true; +} + +/// Whole-id equality over a thirty-two-byte id, hash or key. +pub fn ids32_equal(a: [32]u8, b: [32]u8) -> bool { + for i in 0..32 { + if (a[i] != b[i]) { + return false; + } + } + return true; +} + +/// Whether a sixteen-byte id is all zero - the original's compare against [0u8; 16]. +pub fn zero_id16(id: [16]u8) -> bool { + for i in 0..16 { + if (id[i] != 0) { + return false; + } + } + return true; +} + +/// Vec equality: the same length and the same bytes. +pub fn bytes_equal(a: []const u8, b: []const u8) -> bool { + if (a.len != b.len) { + return false; + } + for i in 0..a.len { + if (a[i] != b[i]) { + return false; + } + } + return true; +} + +/// Whether every byte is zero - the original's all-zero seed probe. An empty slice is all zero. +pub fn all_zero_bytes(bytes: []const u8) -> bool { + for i in 0..bytes.len { + if (bytes[i] != 0) { + return false; + } + } + return true; +} + +/// The integer square root of a u64 - the original's Newton iteration, answered by a bisection over +/// the whole answer range. The largest root of any u64 is 4294967295, and thirty-three halvings +/// settle the search exactly. +pub fn approx_sqrt(v: u64) -> u64 { + var lo: u64 = 0; + var hi: u64 = 4294967295; + var mid: u64 = 0; + for _ in 0..33 { + if (lo <= hi) { + mid = (lo + hi) / 2; + if (mid * mid <= v) { + lo = mid + 1; + } else { + hi = mid - 1; + } + } + } + return hi; +} + +test ids16_equal_answers { + var a: [16]u8; + var b: [16]u8; + for i in 0..16 { + a[i] = 7; + b[i] = 7; + } + assert(ids16_equal(a, b)); + b[15] = 8; + assert(!ids16_equal(a, b)); + b[15] = 7; + b[0] = 0; + assert(!ids16_equal(a, b)); +} + +test ids32_equal_answers { + var a: [32]u8; + var b: [32]u8; + for i in 0..32 { + a[i] = 9; + b[i] = 9; + } + assert(ids32_equal(a, b)); + b[31] = 10; + assert(!ids32_equal(a, b)); + b[31] = 9; + b[0] = 0; + assert(!ids32_equal(a, b)); +} + +test zero_id16_answers { + var id: [16]u8; + for i in 0..16 { + id[i] = 0; + } + assert(zero_id16(id)); + id[15] = 1; + assert(!zero_id16(id)); + id[15] = 0; + id[0] = 1; + assert(!zero_id16(id)); +} + +test bytes_equal_answers { + var a: [4]u8; + var b: [4]u8; + var c: [3]u8; + for i in 0..4 { + a[i] = 5; + b[i] = 5; + } + for i in 0..3 { + c[i] = 5; + } + assert(bytes_equal(&a, &b)); + assert(!bytes_equal(&a, &c)); + b[3] = 6; + assert(!bytes_equal(&a, &b)); + const e1: [0]u8 = [0]u8{}; + const e2: [0]u8 = [0]u8{}; + assert(bytes_equal(&e1, &e2)); +} + +test all_zero_bytes_answers { + var z: [5]u8; + for i in 0..5 { + z[i] = 0; + } + assert(all_zero_bytes(&z)); + z[4] = 1; + assert(!all_zero_bytes(&z)); + const empty: [0]u8 = [0]u8{}; + assert(all_zero_bytes(&empty)); +} + +test approx_sqrt_answers { + assert(approx_sqrt(0) == 0); + assert(approx_sqrt(1) == 1); + assert(approx_sqrt(15) == 3); + assert(approx_sqrt(16) == 4); + assert(approx_sqrt(17) == 4); + assert(approx_sqrt(1000000) == 1000); + assert(approx_sqrt(18446744073709551615) == 4294967295); +} diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/confirmation_tag_chain.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/confirmation_tag_chain.t27 index 8e89fca3c1..fc31959d94 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/confirmation_tag_chain.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/confirmation_tag_chain.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-03::src::confirmation_tag_chain; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-03/src/confirmation_tag_chain.rs // (CR-CHAT-03 - MLS confirmation_tag chain validation, Wave-28 // Lane A, L-CHAT-3-confupd, RFC 9420 8.1/11). @@ -66,32 +68,6 @@ pub struct CtcVerdict { code: CtcCode, } -// Content equality over two byte slices - the original's -// Vec equality on the group identifiers and the transcript -// hashes. -pub fn bytes_equal(a: []const u8, b: []const u8) -> bool { - if (a.len != b.len) { - return false; - } - for i in 0..a.len { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - -// Whether every byte is zero - the original's all-zero seed -// probe. -pub fn all_zero_bytes(bytes: []const u8) -> bool { - for i in 0..bytes.len { - if (bytes[i] != 0) { - return false; - } - } - return true; -} - // Whether this (group, epoch, tag) triple was already // accepted - the original's BTreeSet contains over the // ledger, answered by a scan over the canonical link diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_commit.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_commit.t27 index 7625745f9c..63d8ed496a 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_commit.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_commit.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_commit; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-03/src/external_commit.rs // (CR-CHAT-03 - MLS external-commit forgery guard, Wave-14 // Lane B, L-CHAT-3-extern, RFC 9420 12.2). @@ -78,17 +80,6 @@ pub struct ExtVerdict { ops_len: usize, } -// Whole-form equality over the thirty-two-byte group -// identifiers - the original's GroupId equality. -pub fn group_ids_equal(a: [32]u8, b: [32]u8) -> bool { - for i in 0..32 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // Whether the leaf slice holds this index - the original's // occupied.contains probe. pub fn leaf_occupied(occupied: []const u32, leaf: u32) -> bool { @@ -106,7 +97,7 @@ pub fn leaf_occupied(occupied: []const u32, leaf: u32) -> bool { // epoch, the free leaf, the self sender, the single // self-Add, the non-empty signature. pub fn check_external_commit(group_id: [32]u8, claimed_epoch: u64, joining_leaf: u32, sender: u32, ops: []const OpRec, signature: []const u8, local_group_id: [32]u8, local_epoch: u64, occupied: []const u32) -> ExtVerdict { - if (!group_ids_equal(group_id, local_group_id)) { + if (!ids32_equal(group_id, local_group_id)) { return ExtVerdict { code: ExtCode.GroupIdMismatch, claimed: 0, actual: 0, leaf: 0, sender: 0, joining: 0, ops: [8]OpRec{OpRec { kind: OpKind.Update, leaf: 0, }, OpRec { kind: OpKind.Update, leaf: 0, }, OpRec { kind: OpKind.Update, leaf: 0, }, OpRec { kind: OpKind.Update, leaf: 0, }, OpRec { kind: OpKind.Update, leaf: 0, }, OpRec { kind: OpKind.Update, leaf: 0, }, OpRec { kind: OpKind.Update, leaf: 0, }, OpRec { kind: OpKind.Update, leaf: 0, },} ops_len: 0, }; } if (claimed_epoch != local_epoch) { @@ -247,8 +238,8 @@ test ext_06_groupid_and_signature_guards { // The helpers have direct tests (coverage: Untested 0). test group_ids_equal_answers { - assert(group_ids_equal(GOOD_GID, GOOD_GID)); - assert(!group_ids_equal(GOOD_GID, OTHER_GID)); + assert(ids32_equal(GOOD_GID, GOOD_GID)); + assert(!ids32_equal(GOOD_GID, OTHER_GID)); } test leaf_occupied_answers { diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_proposal_origin_unbound.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_proposal_origin_unbound.t27 index 457bf0030c..e098b2f7db 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_proposal_origin_unbound.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_proposal_origin_unbound.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_proposal_origin_unbound; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-03/src/external_proposal_origin_unbound.rs // (CR-CHAT-03 - External proposal origin unbound, Wave-33, // L-CHAT-3-epou, R-CHAT-11, RFC 9420 12.1.8.2/6.2). @@ -164,31 +166,6 @@ pub fn proposal_used(used: []const UsedProposal, origin: OriginRec, proposal_id: return false; } -// Content equality over two byte slices - the original's -// Vec equality on the group identifiers. -pub fn bytes_equal(a: []const u8, b: []const u8) -> bool { - if (a.len != b.len) { - return false; - } - for i in 0..a.len { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - -// Whether every byte is zero - the original's all-zero -// signature sentinel probe. -pub fn all_zero_bytes(bytes: []const u8) -> bool { - for i in 0..bytes.len { - if (bytes[i] != 0) { - return false; - } - } - return true; -} - // [VERIFIED] Validate an external proposal's origin // binding. Returns Ok only when every rule holds, checked // in the original's fixed order: the canonical signature diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_psk_id_provenance.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_psk_id_provenance.t27 index c7092c338f..14a3b5cc3b 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_psk_id_provenance.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/external_psk_id_provenance.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-03::src::external_psk_id_provenance; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-03/src/external_psk_id_provenance.rs // (CR-CHAT-03 - External PSK identifier provenance defense, // Wave-31 Lane B, L-CHAT-3-pskprov, RFC 9420 5.3.2/5.3.3). @@ -120,17 +122,6 @@ pub fn consumed_contains(consumed: []const ConsumedPair, psk_id: []const u8, psk return false; } -// Whether every byte is zero - the original's degenerate -// sampler sentinel probe. -pub fn all_zero_bytes(bytes: []const u8) -> bool { - for i in 0..bytes.len { - if (bytes[i] != 0) { - return false; - } - } - return true; -} - // [VERIFIED] Validate one external PreSharedKeyID proposal // against the receiver view. Returns Ok only when every // rule holds, checked in the original's fixed order: the diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/group_context_hash_consistency_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/group_context_hash_consistency_guard.t27 index e7f2eac156..2ca42c60fd 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/group_context_hash_consistency_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/group_context_hash_consistency_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-03::src::group_context_hash_consistency_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-03/src/group_context_hash_consistency_guard.rs // (CR-CHAT-03 - Group context hash consistency guard, Wave-59 // Lane B, R-CHAT-4). @@ -87,17 +89,6 @@ pub fn is_zero_hash(hash: [32]u8) -> bool { return true; } -// Whole-form equality over two context hashes - the -// original's array equality against the reference. -pub fn hashes32_equal(a: [32]u8, b: [32]u8) -> bool { - for i in 0..32 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // [VERIFIED] Validate that all members report the same // group context. Returns Ok only when every rule holds, // checked in the original's order: the member floor, then @@ -120,7 +111,7 @@ pub fn validate_group_context_consistency(reports: []const MemberContext) -> Gch return GchcVerdict { code: GchcCode.DuplicateMember, }; } if (has_ref) { - if (!hashes32_equal(reports[i].context_hash, ref_hash)) { + if (!ids32_equal(reports[i].context_hash, ref_hash)) { return GchcVerdict { code: GchcCode.HashMismatch, }; } } else { @@ -263,8 +254,8 @@ test is_zero_hash_answers { } test hashes32_equal_answers { - assert(hashes32_equal(HASH_A, HASH_A)); - assert(!hashes32_equal(HASH_A, HASH_B)); + assert(ids32_equal(HASH_A, HASH_A)); + assert(!ids32_equal(HASH_A, HASH_B)); } // Rule order is the original's: the member floor before any diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/leaf_node_key_uniqueness_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/leaf_node_key_uniqueness_guard.t27 index 50126c42cf..b8afb0725e 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/leaf_node_key_uniqueness_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/leaf_node_key_uniqueness_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-03::src::leaf_node_key_uniqueness_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-03/src/leaf_node_key_uniqueness_guard.rs // (CR-CHAT-03 - Leaf node key uniqueness guard, Wave-87 // Lane B, R-CHAT-3). @@ -72,17 +74,6 @@ pub struct LnkuVerdict { index: usize, } -// Whole-form equality over two public keys - the -// original's array equality behind its set probes. -pub fn keys32_equal(a: [32]u8, b: [32]u8) -> bool { - for i in 0..32 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // Whether the key is the all-zero form - the original's // sentinel probe. pub fn is_zero_key(key: [32]u8) -> bool { @@ -112,7 +103,7 @@ pub fn index_seen_before(leaves: []const LeafNode, upto: usize, index: usize) -> // the duplicate probe). pub fn first_pos_with_key(leaves: []const LeafNode, upto: usize, key: [32]u8) -> usize { for j in 0..upto { - if (keys32_equal(leaves[j].public_key, key)) { + if (ids32_equal(leaves[j].public_key, key)) { return j; } } @@ -140,7 +131,7 @@ pub fn validate_leaf_key_uniqueness(leaves: []const LeafNode) -> LnkuVerdict { } var key_repeated: bool = false; for j in 0..i { - if (keys32_equal(leaves[j].public_key, leaves[i].public_key)) { + if (ids32_equal(leaves[j].public_key, leaves[i].public_key)) { key_repeated = true; } } @@ -298,8 +289,8 @@ test lnku_10_unique_keys_accepted { // The helpers have direct tests (coverage: Untested 0). test keys32_equal_answers { - assert(keys32_equal(KEY_AA, KEY_AA)); - assert(!keys32_equal(KEY_AA, KEY_BB)); + assert(ids32_equal(KEY_AA, KEY_AA)); + assert(!ids32_equal(KEY_AA, KEY_BB)); } test is_zero_key_answers { diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/leaf_node_signature_validation.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/leaf_node_signature_validation.t27 index bdba6c2ba0..07f5a5f5f7 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/leaf_node_signature_validation.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/leaf_node_signature_validation.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-03::src::leaf_node_signature_validation; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-03/src/leaf_node_signature_validation.rs // (CR-CHAT-03 - MLS LeafNode signature validation, Wave-29 // Lane A, L-CHAT-3-leafsig, RFC 9420 7.1/7.3/7.6). @@ -76,20 +78,6 @@ pub struct LnsVerdict { code: LnsCode, } -// Content equality over two byte slices - the original's -// Vec equality on the group identifiers. -pub fn bytes_equal(a: []const u8, b: []const u8) -> bool { - if (a.len != b.len) { - return false; - } - for i in 0..a.len { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // Whether some set bit of the packet's capabilities sits // outside the assigned mask - the original's bitwise probe // (bits & !mask), re-based over the power table. diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/membership_tag_binding.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/membership_tag_binding.t27 index aebc1aaf68..0b0784718d 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/membership_tag_binding.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/membership_tag_binding.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-03::src::membership_tag_binding; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-03/src/membership_tag_binding.rs // (CR-CHAT-03 - Membership tag binding verification, Wave-40 // Lane B, RFC 9420 8.2). @@ -63,20 +65,6 @@ pub struct MtagVerdict { code: MtagCode, } -// Content equality over two byte slices - the original's -// Vec equality on the group identifiers. -pub fn bytes_equal(a: []const u8, b: []const u8) -> bool { - if (a.len != b.len) { - return false; - } - for i in 0..a.len { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // Whether the leaf index sits in the removed set - the // original's BTreeSet contains, answered by a scan. pub fn leaf_removed(removed: []const usize, leaf: usize) -> bool { diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/parent_hash_chain_validation_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/parent_hash_chain_validation_guard.t27 index 4a16bd5f93..b0eedbc786 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/parent_hash_chain_validation_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/parent_hash_chain_validation_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-03::src::parent_hash_chain_validation_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-03/src/parent_hash_chain_validation_guard.rs // (CR-CHAT-03 - Parent hash chain validation guard, Wave-67 // Lane A, R-CHAT-2). @@ -67,17 +69,6 @@ pub struct PhcvVerdict { pos: usize, } -// Whole-form equality over two canonical hashes - the -// original's Vec equality on the parent link. -pub fn hashes_equal(a: [32]u8, b: [32]u8) -> bool { - for i in 0..32 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // [VERIFIED] Validate that a parent-hash chain from leaf // to root is continuous. Returns Ok only when every rule // holds, checked in the original's fixed order: the depth @@ -110,7 +101,7 @@ pub fn validate_parent_hash_chain(nodes: []const HashNode) -> PhcvVerdict { if (nodes[i].parent_len != PHCV_HASH_LEN) { return PhcvVerdict { code: PhcvCode.HashLengthWrong, pos: 0, }; } - if (!hashes_equal(nodes[i].parent_hash, nodes[i + 1].hash)) { + if (!ids32_equal(nodes[i].parent_hash, nodes[i + 1].hash)) { return PhcvVerdict { code: PhcvCode.ParentHashMismatch, pos: i, }; } } @@ -275,9 +266,9 @@ test phcv_10_max_depth_accepted { // The helper has a direct test (coverage: Untested 0). test hashes_equal_answers { - assert(hashes_equal(H01, H01)); - assert(!hashes_equal(H01, H02)); - assert(!hashes_equal(HFF, HAA)); + assert(ids32_equal(H01, H01)); + assert(!ids32_equal(H01, H02)); + assert(!ids32_equal(HFF, HAA)); } // Rule order is the original's fixed ladder: the depth diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/pcs_healing.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/pcs_healing.t27 index 892823f7c6..69e23ce9f0 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/pcs_healing.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/pcs_healing.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-03::src::pcs_healing; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-03/src/pcs_healing.rs // (CR-CHAT-03 - Group PCS healing, Wave-17, L-CHAT-3-pcs, // R-CHAT-11). @@ -85,17 +87,6 @@ pub struct PcsHealVerdict { new_secrets_len: usize, } -// Whole-form equality over two path-secret hashes - the -// original's array equality. -pub fn hashes32_equal(a: [32]u8, b: [32]u8) -> bool { - for i in 0..32 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // The position of the leaf's stored secret, or the length // when absent - the original's BTreeMap get. pub fn find_secret(secrets: []const SecretEntry, secrets_len: usize, leaf: usize) -> usize { @@ -121,7 +112,7 @@ pub fn process_heal(state_group_id: [32]u8, state_epoch: u64, secrets: []const S for i in 0..secrets_len { next_secrets[i] = secrets[i]; } - if (!hashes32_equal(state_group_id, commit_group_id)) { + if (!ids32_equal(state_group_id, commit_group_id)) { return PcsHealVerdict { code: PcsCode.WrongGroup, new_epoch: state_epoch, new_secrets: next_secrets, new_secrets_len: secrets_len, }; } if (from_epoch != state_epoch) { @@ -145,10 +136,10 @@ pub fn process_heal(state_group_id: [32]u8, state_epoch: u64, secrets: []const S if (pos == secrets_len) { return PcsHealVerdict { code: PcsCode.NonMemberTarget, new_epoch: state_epoch, new_secrets: next_secrets, new_secrets_len: secrets_len, }; } - if (!hashes32_equal(secrets[pos].hash, heals[i].from_hash)) { + if (!ids32_equal(secrets[pos].hash, heals[i].from_hash)) { return PcsHealVerdict { code: PcsCode.FromHashMismatch, new_epoch: state_epoch, new_secrets: next_secrets, new_secrets_len: secrets_len, }; } - if (hashes32_equal(heals[i].from_hash, heals[i].to_hash)) { + if (ids32_equal(heals[i].from_hash, heals[i].to_hash)) { return PcsHealVerdict { code: PcsCode.NoOpHeal, new_epoch: state_epoch, new_secrets: next_secrets, new_secrets_len: secrets_len, }; } } @@ -190,7 +181,7 @@ test pcs_01_well_formed_heal_accepted { assert(v.code == PcsCode.Ok); assert(v.new_epoch == 1); assert(v.new_secrets_len == 1); - assert(hashes32_equal(v.new_secrets[0].hash, HAA)); + assert(ids32_equal(v.new_secrets[0].hash, HAA)); } // **PCS-02** - the epoch mismatch rejected: five of a @@ -199,7 +190,7 @@ test pcs_02_epoch_mismatch_rejected { const v = process_heal(GID03, 0, &FOUNDER_SECRETS, 1, GID03, 5, 0, &CANON_HEALS); assert(v.code == PcsCode.EpochMismatch); assert(v.new_epoch == 0); - assert(hashes32_equal(v.new_secrets[0].hash, H10)); + assert(ids32_equal(v.new_secrets[0].hash, H10)); } // **PCS-03** - the captured pre-heal commit replayed after @@ -213,7 +204,7 @@ test pcs_03_pre_heal_replay_rejected_after_heal { assert(first.new_epoch == 1); const replay = process_heal(GID03, first.new_epoch, &first.new_secrets, first.new_secrets_len, GID03, 0, 0, &CANON_HEALS); assert(replay.code == PcsCode.EpochMismatch); - assert(hashes32_equal(replay.new_secrets[0].hash, HAA)); + assert(ids32_equal(replay.new_secrets[0].hash, HAA)); } // **PCS-04** - the atomic batch heal: one commit healing @@ -232,8 +223,8 @@ test pcs_04_atomic_batch_heal { assert(v.code == PcsCode.Ok); assert(v.new_epoch == 1); assert(v.new_secrets_len == 2); - assert(hashes32_equal(v.new_secrets[0].hash, HAA)); - assert(hashes32_equal(v.new_secrets[1].hash, HBB)); + assert(ids32_equal(v.new_secrets[0].hash, HAA)); + assert(ids32_equal(v.new_secrets[1].hash, HBB)); } // **PCS-05** - the no-op heal rejected: the to-hash equal @@ -258,7 +249,7 @@ test pcs_06_concurrent_heals_only_first_applies { assert(first.code == PcsCode.Ok); const second = process_heal(GID03, first.new_epoch, &first.new_secrets, first.new_secrets_len, GID03, 0, 0, &attacker_heals); assert(second.code == PcsCode.EpochMismatch); - assert(hashes32_equal(second.new_secrets[0].hash, HAA)); + assert(ids32_equal(second.new_secrets[0].hash, HAA)); assert(second.new_epoch == 1); } @@ -277,9 +268,9 @@ test green_g_pcs_summary { // The helpers have direct tests (coverage: Untested 0). test hashes32_equal_answers { - assert(hashes32_equal(H10, H10)); - assert(!hashes32_equal(H10, HAA)); - assert(!hashes32_equal(GID03, ZERO_HASH)); + assert(ids32_equal(H10, H10)); + assert(!ids32_equal(H10, HAA)); + assert(!ids32_equal(GID03, ZERO_HASH)); } test find_secret_answers { diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/proposal_ref_collision.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/proposal_ref_collision.t27 index 1fd86545a1..632132b918 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/proposal_ref_collision.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/proposal_ref_collision.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-03::src::proposal_ref_collision; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-03/src/proposal_ref_collision.rs // (CR-CHAT-03 - ProposalRef collision / replay / provenance, // Wave-32, L-CHAT-3-pref, R-CHAT-11, RFC 9420 12.1.1). @@ -74,20 +76,6 @@ pub struct PrefVerdict { code: PrefCode, } -// Content equality over two byte slices - the original's -// Vec equality on the group identifiers. -pub fn bytes_equal(a: []const u8, b: []const u8) -> bool { - if (a.len != b.len) { - return false; - } - for i in 0..a.len { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // Whether the store knows this identifier - the original's // Vec contains, answered by a scan. pub fn known_id_present(known: []const KnownId, proposal_id: []const u8) -> bool { @@ -135,17 +123,6 @@ pub fn ref_pair_used(used: []const UsedRef, proposal_id: []const u8, proposal_re return false; } -// Whether every byte is zero - the original's degenerate -// HMAC sentinel probe. -pub fn all_zero_bytes(bytes: []const u8) -> bool { - for i in 0..bytes.len { - if (bytes[i] != 0) { - return false; - } - } - return true; -} - // [VERIFIED] Validate a ProposalRef against the receiver // view. Returns Ok only when every rule holds, checked in // the original's fixed order: the canonical length, the diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/ratchet_tree_update_integrity_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/ratchet_tree_update_integrity_guard.t27 index 9dc54d59f5..a59d6a7cf1 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/ratchet_tree_update_integrity_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-03/src/ratchet_tree_update_integrity_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-03::src::ratchet_tree_update_integrity_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-03/src/ratchet_tree_update_integrity_guard.rs // (CR-CHAT-03 - Ratchet tree update integrity guard, Wave-84 // Lane A, R-CHAT-3). @@ -71,17 +73,6 @@ pub struct RtuiVerdict { got: u64, } -// Whole-form equality over two thirty-two-byte hashes - the -// original's array equality on the parent binding. -pub fn hashes32_equal(a: [32]u8, b: [32]u8) -> bool { - for i in 0..32 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // Whether the leaf slice holds this signer - the original's // member-set contains, answered by a scan. pub fn member_contains(members: []const u64, leaf: u64) -> bool { @@ -121,7 +112,7 @@ pub fn validate_tree_updates(updates: []const TreeUpdate, current_epoch: u64, me if (node_seen_before(updates, i, updates[i].node_index)) { return RtuiVerdict { code: RtuiCode.DuplicateNode, idx: updates[i].node_index, expected: 0, got: 0, }; } - if (!hashes32_equal(updates[i].parent_hash, updates[i].computed_hash)) { + if (!ids32_equal(updates[i].parent_hash, updates[i].computed_hash)) { return RtuiVerdict { code: RtuiCode.HashMismatch, idx: updates[i].node_index, expected: 0, got: 0, }; } if (updates[i].epoch != current_epoch) { @@ -263,8 +254,8 @@ test rtui_10_max_batch_accepted { // The helpers have direct tests (coverage: Untested 0). test hashes32_equal_answers { const u: TreeUpdate = make_update(1, 5, 0); - assert(hashes32_equal(u.parent_hash, u.computed_hash)); - assert(!hashes32_equal(u.parent_hash, HASH_FF)); + assert(ids32_equal(u.parent_hash, u.computed_hash)); + assert(!ids32_equal(u.parent_hash, HASH_FF)); } test member_contains_answers { diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/application_message_generation_skip_dos.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/application_message_generation_skip_dos.t27 index 2b7ea52a8f..93eef41a72 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/application_message_generation_skip_dos.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/application_message_generation_skip_dos.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-04::src::application_message_generation_skip_dos; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-04/src/application_message_generation_skip_dos.rs // (CR-CHAT-04 - Application-message generation skip-window DoS defence, // Wave-36 Lane L-CHAT-4-amgsd, requirement R-CHAT-4, RFC 9420 sections @@ -84,23 +86,13 @@ pub struct AppMessageSkipVerdict { code: AppMessageSkipCode, } -// Whole-id equality over the fixed-size ids. -pub fn ids_equal(a: [16]u8, b: [16]u8) -> bool { - for i in 0..16 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // Membership of a sender in the fixed-size known-sender table. The // original asks known_senders.contains(&sender); there is no Vec here, // so the scan covers exactly the slots the caller filled. The sentinel // row holds id 255 in every byte, which no fixture id equals. pub fn sender_known(id: [16]u8, known: [2]SenderId) -> bool { for i in 0..2 { - if (ids_equal(id, known[i].id)) { + if (ids16_equal(id, known[i].id)) { return true; } } @@ -111,7 +103,7 @@ pub fn sender_known(id: [16]u8, known: [2]SenderId) -> bool { // no row for the pair - the original's unwrap_or(0). pub fn last_seen_for(id: [16]u8, epoch: u64, table: [2]GenRow) -> u64 { for i in 0..2 { - if (ids_equal(id, table[i].sender)) { + if (ids16_equal(id, table[i].sender)) { if (table[i].epoch == epoch) { return table[i].last; } @@ -280,8 +272,8 @@ test amgsd_10_canonical_packet_accepted { // The three helpers have direct tests (coverage: Untested 0). test ids_equal_answers { - assert(ids_equal(SENDER_A, SENDER_A)); - assert(!ids_equal(SENDER_A, SENDER_B)); + assert(ids16_equal(SENDER_A, SENDER_A)); + assert(!ids16_equal(SENDER_A, SENDER_B)); } test sender_known_answers { diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/mls_plaintext_framing_integrity.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/mls_plaintext_framing_integrity.t27 index 4919e883e2..921a0f0edd 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/mls_plaintext_framing_integrity.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/mls_plaintext_framing_integrity.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-04::src::mls_plaintext_framing_integrity; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-04/src/mls_plaintext_framing_integrity.rs // (CR-CHAT-04 - MLS plaintext authenticated-data tampering guard, // Wave-39 Lane B, RFC 9420 section 6). @@ -99,16 +101,6 @@ pub fn content_type_known(b: u8) -> bool { return false; } -// Whole-id equality over the fixed-size group ids. -pub fn ids_equal(a: [32]u8, b: [32]u8) -> bool { - for i in 0..32 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // [VERIFIED] Validate an MLS message frame against the original's nine // rules. Returns Ok only when every rule holds, checked in the // original's fixed order: wire version, non-empty group id, non-zero @@ -139,7 +131,7 @@ pub fn validate_mls_frame(frame: MlsFrame, view: MlsGroupView) -> MlsFramingVerd return MlsFramingVerdict { code: MlsFramingCode.TruncatedCiphertext, }; } } - if (!ids_equal(frame.group_id, view.group_id)) { + if (!ids32_equal(frame.group_id, view.group_id)) { return MlsFramingVerdict { code: MlsFramingCode.GroupIdMismatch, }; } if (frame.epoch != view.epoch) { @@ -276,8 +268,8 @@ test content_type_known_answers { } test ids_equal_answers { - assert(ids_equal(MLF_GOOD_ID, MLF_GOOD_ID)); - assert(!ids_equal(MLF_GOOD_ID, MLF_OTHER_ID)); + assert(ids32_equal(MLF_GOOD_ID, MLF_GOOD_ID)); + assert(!ids32_equal(MLF_GOOD_ID, MLF_OTHER_ID)); } // Rule order is the original's: wire version before group id emptiness, diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_block_size_alignment_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_block_size_alignment_guard.t27 index 7f9111b902..a06b471210 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_block_size_alignment_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_block_size_alignment_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_block_size_alignment_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-04/src/padding_block_size_alignment_guard.rs // (CR-CHAT-04 - Padding block size alignment guard, Wave-135 Lane B, // requirement R-CHAT-9). @@ -55,17 +57,6 @@ pub struct BlockAlignmentVerdict { bound: usize, } -// The original compares the id against [0u8; PBSA_BLOCK_ID_LEN]; there is no -// whole-array equality here, so the decision is a loop over the 16 bytes. -pub fn is_zero_id(id: [16]u8) -> bool { - for i in 0..16 { - if (id[i] != 0) { - return false; - } - } - return true; -} - // The original's power-of-two test, verbatim: n > 0 and the low bit mask // clears everything but the sign bit. pub fn is_power_of_two(n: usize) -> bool { @@ -84,7 +75,7 @@ pub fn validate_padding_block_alignment(blocks: []const PaddingBlockRecord) -> B var ref_size: usize = 0; for i in 0..blocks.len { const b = blocks[i]; - if (is_zero_id(b.block_id)) { + if (zero_id16(b.block_id)) { return BlockAlignmentVerdict { code: BlockAlignmentCode.ZeroBlockId, idx: i, got: 0, bound: 0, }; } if (b.block_size < PBSA_MIN_BLOCK) { @@ -208,9 +199,9 @@ test pbsa_10_max_block_accepted { // The two helpers have direct tests (coverage: Untested 0). test is_zero_id_answers { - assert(is_zero_id([16]u8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,})); - assert(!is_zero_id([16]u8{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,})); - assert(!is_zero_id([16]u8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,})); + assert(zero_id16([16]u8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,})); + assert(!zero_id16([16]u8{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,})); + assert(!zero_id16([16]u8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,})); } test is_power_of_two_answers { diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_byte_pattern_uniformity_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_byte_pattern_uniformity_guard.t27 index 49bd02f94d..c8ad13ede1 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_byte_pattern_uniformity_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_byte_pattern_uniformity_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_byte_pattern_uniformity_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-04/src/padding_byte_pattern_uniformity_guard.rs // (CR-CHAT-04 - Padding byte pattern uniformity guard, Wave-139 Lane A, // requirement R-CHAT-4). @@ -68,22 +70,12 @@ pub struct PatternUniformityVerdict { bound_f: f64, } -// Whole-id equality over the fixed-size block ids. -pub fn ids_equal(a: [16]u8, b: [16]u8) -> bool { - for i in 0..16 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // Whether the block at index i shares its id with an earlier block - the // original's BTreeSet insert probe, answered by a scan of the visited // blocks. pub fn id_seen_before(blocks: []const PaddingPatternRecord, i: usize) -> bool { for j in 0..i { - if (ids_equal(blocks[j].block_id, blocks[i].block_id)) { + if (ids16_equal(blocks[j].block_id, blocks[i].block_id)) { return true; } } @@ -243,8 +235,8 @@ test pbpu_10_many_uniform_accepted { // The two helpers have direct tests (coverage: Untested 0). test ids_equal_answers { - assert(ids_equal(PBPU_ID1, PBPU_ID1)); - assert(!ids_equal(PBPU_ID1, PBPU_ID2)); + assert(ids16_equal(PBPU_ID1, PBPU_ID1)); + assert(!ids16_equal(PBPU_ID1, PBPU_ID2)); } test id_seen_before_answers { diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_class_transition_entropy_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_class_transition_entropy_guard.t27 index 311427defe..ed0ab3b95e 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_class_transition_entropy_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_class_transition_entropy_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_class_transition_entropy_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-04/src/padding_class_transition_entropy_guard.rs // (CR-CHAT-04 - Padding class transition entropy guard, Wave-154 Lane B, // requirement R-CHAT-9). @@ -63,31 +65,11 @@ pub struct TransitionEntropyVerdict { bound: usize, } -// Whole-id equality over the fixed-size observation ids. -pub fn ids_equal(a: [16]u8, b: [16]u8) -> bool { - for i in 0..16 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - -// The all-zero observation id - the original's [0u8; 16] probe. -pub fn is_zero_id(id: [16]u8) -> bool { - for i in 0..16 { - if (id[i] != 0) { - return false; - } - } - return true; -} - // Whether the observation at index i shares its id with an earlier one - // the original's BTreeSet insert probe, answered by a scan. pub fn id_seen_before(obs: []const EntropyTransitionObservation, i: usize) -> bool { for j in 0..i { - if (ids_equal(obs[j].obs_id, obs[i].obs_id)) { + if (ids16_equal(obs[j].obs_id, obs[i].obs_id)) { return true; } } @@ -130,7 +112,7 @@ pub fn validate_transition_entropy(obs: []const EntropyTransitionObservation) -> return TransitionEntropyVerdict { code: TransitionEntropyCode.TooFew, idx: 0, got: obs.len, bound: PCTE_MIN_OBS, }; } for i in 0..obs.len { - if (is_zero_id(obs[i].obs_id)) { + if (zero_id16(obs[i].obs_id)) { return TransitionEntropyVerdict { code: TransitionEntropyCode.ZeroId, idx: i, got: 0, bound: 0, }; } if (id_seen_before(obs, i)) { @@ -333,13 +315,13 @@ test pcte_10_many_diverse_accepted { // The five helpers have direct tests (coverage: Untested 0). test ids_equal_answers { - assert(ids_equal(PCTE_ID_1, PCTE_ID_1)); - assert(!ids_equal(PCTE_ID_1, PCTE_ID_2)); + assert(ids16_equal(PCTE_ID_1, PCTE_ID_1)); + assert(!ids16_equal(PCTE_ID_1, PCTE_ID_2)); } test is_zero_id_answers { - assert(is_zero_id(ZERO_ID)); - assert(!is_zero_id(PCTE_ID_1)); + assert(zero_id16(ZERO_ID)); + assert(!zero_id16(PCTE_ID_1)); } test id_seen_before_answers { diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_fill_byte_randomness_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_fill_byte_randomness_guard.t27 index 318ff3076d..0474b23049 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_fill_byte_randomness_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_fill_byte_randomness_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_fill_byte_randomness_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-04/src/padding_fill_byte_randomness_guard.rs // (CR-CHAT-04 - Padding fill byte randomness guard, Wave-147 Lane A, // requirement R-CHAT-4). @@ -67,31 +69,11 @@ pub struct FillRandomnessVerdict { bound_f: f64, } -// Whole-id equality over the fixed-size block ids. -pub fn ids_equal(a: [16]u8, b: [16]u8) -> bool { - for i in 0..16 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - -// The all-zero block id - the original's [0u8; 16] probe. -pub fn is_zero_id(id: [16]u8) -> bool { - for i in 0..16 { - if (id[i] != 0) { - return false; - } - } - return true; -} - // Whether the block at index i shares its id with an earlier one - the // original's BTreeSet insert probe, answered by a scan. pub fn id_seen_before(blocks: []const FillRandomnessRecord, i: usize) -> bool { for j in 0..i { - if (ids_equal(blocks[j].block_id, blocks[i].block_id)) { + if (ids16_equal(blocks[j].block_id, blocks[i].block_id)) { return true; } } @@ -107,7 +89,7 @@ pub fn validate_fill_randomness(blocks: []const FillRandomnessRecord) -> FillRan return FillRandomnessVerdict { code: FillRandomnessCode.TooMany, idx: 0, got_u: blocks.len, got_f: 0.0, bound_u: PFBR_MAX_BLOCKS, bound_f: 0.0, }; } for i in 0..blocks.len { - if (is_zero_id(blocks[i].block_id)) { + if (zero_id16(blocks[i].block_id)) { return FillRandomnessVerdict { code: FillRandomnessCode.ZeroBlockId, idx: i, got_u: 0, got_f: 0.0, bound_u: 0, bound_f: 0.0, }; } if (id_seen_before(blocks, i)) { @@ -257,13 +239,13 @@ test pfbr_10_many_hq_accepted { // The three helpers have direct tests (coverage: Untested 0). test ids_equal_answers { - assert(ids_equal(PFBR_ID_1, PFBR_ID_1)); - assert(!ids_equal(PFBR_ID_1, PFBR_ID_2)); + assert(ids16_equal(PFBR_ID_1, PFBR_ID_1)); + assert(!ids16_equal(PFBR_ID_1, PFBR_ID_2)); } test is_zero_id_answers { - assert(is_zero_id(ZERO_ID)); - assert(!is_zero_id(PFBR_ID_1)); + assert(zero_id16(ZERO_ID)); + assert(!zero_id16(PFBR_ID_1)); } test id_seen_before_answers { diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_key_derivation_domain_separation_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_key_derivation_domain_separation_guard.t27 index 1e65717806..e5174bb63a 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_key_derivation_domain_separation_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-04/src/padding_key_derivation_domain_separation_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-04::src::padding_key_derivation_domain_separation_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-04/src/padding_key_derivation_domain_separation_guard.rs // (CR-CHAT-04 - Padding key derivation domain separation guard, Wave-113 // Lane B, requirement R-CHAT-4). @@ -81,17 +83,6 @@ pub struct DomainSepVerdict { label: [16]u8, } -// Whole-form equality over the fixed sixteen bytes - labels and -// contexts share it. -pub fn bytes_equal(a: [16]u8, b: [16]u8) -> bool { - for i in 0..16 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // The all-zero form - the original's String::is_empty probe on the // one end and its [0u8; 16] comparison on the other. pub fn bytes_zero(b: [16]u8) -> bool { @@ -106,16 +97,16 @@ pub fn bytes_zero(b: [16]u8) -> bool { // Whether the label is one of the four approved domain labels - the // original's approved-set membership probe, answered by a scan. pub fn label_approved(label: [16]u8) -> bool { - if (bytes_equal(label, PKDS_LABEL_1)) { + if (ids16_equal(label, PKDS_LABEL_1)) { return true; } - if (bytes_equal(label, PKDS_LABEL_2)) { + if (ids16_equal(label, PKDS_LABEL_2)) { return true; } - if (bytes_equal(label, PKDS_LABEL_3)) { + if (ids16_equal(label, PKDS_LABEL_3)) { return true; } - if (bytes_equal(label, PKDS_LABEL_4)) { + if (ids16_equal(label, PKDS_LABEL_4)) { return true; } return false; @@ -126,8 +117,8 @@ pub fn label_approved(label: [16]u8) -> bool { // label was seen before, so this scan is the whole duplicate rule. pub fn pair_seen_before(records: []const DerivationRecord, i: usize) -> bool { for j in 0..i { - if (bytes_equal(records[j].label, records[i].label)) { - if (bytes_equal(records[j].context, records[i].context)) { + if (ids16_equal(records[j].label, records[i].label)) { + if (ids16_equal(records[j].context, records[i].context)) { return true; } } @@ -197,7 +188,7 @@ test pkds_02_unapproved_rejected { const v = validate_domain_separation(&records); assert(v.code == DomainSepCode.UnapprovedLabel); assert(v.idx == 0); - assert(bytes_equal(v.label, PKDS_UNKNOWN_LABEL)); + assert(ids16_equal(v.label, PKDS_UNKNOWN_LABEL)); assert(v.label[0] == 117); } @@ -296,9 +287,9 @@ test pkds_10_all_labels_accepted { // The four helpers have direct tests (coverage: Untested 0). test bytes_equal_answers { - assert(bytes_equal(CTX_01, CTX_01)); - assert(!bytes_equal(CTX_01, CTX_02)); - assert(bytes_equal(PKDS_LABEL_2, PKDS_LABEL_2)); + assert(ids16_equal(CTX_01, CTX_01)); + assert(!ids16_equal(CTX_01, CTX_02)); + assert(ids16_equal(PKDS_LABEL_2, PKDS_LABEL_2)); } test bytes_zero_answers { diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/blind_signature_sender_token.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/blind_signature_sender_token.t27 index 154feb7ed8..e262850cf1 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/blind_signature_sender_token.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/blind_signature_sender_token.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-07::src::blind_signature_sender_token; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-07/src/blind_signature_sender_token.rs // (CR-CHAT-07 - Blind-signature sender token, Wave-34 Lane A, // L-CHAT-7-bsst, R-CHAT-10; NDSS 2021 "Improving Signal's Sealed @@ -98,16 +100,6 @@ pub fn issuer_ids_equal(a: [21]u8, b: [21]u8) -> bool { return true; } -// Whole-form equality over the fixed thirty-two nonce bytes. -pub fn nonces_equal(a: [32]u8, b: [32]u8) -> bool { - for i in 0..32 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // The all-zero nonce - the sentinel a correct unblinding never // produces. pub fn nonce_zero(n: [32]u8) -> bool { @@ -164,7 +156,7 @@ pub fn validate_blind_signature_sender_token( return BlindTokenVerdict { code: BlindTokenCode.ExpiredIssuerEpoch, }; } for i in 0..spent.len { - if (nonces_equal(spent[i].nonce, token.token_nonce)) { + if (ids32_equal(spent[i].nonce, token.token_nonce)) { return BlindTokenVerdict { code: BlindTokenCode.TokenNonceReuse, }; } } @@ -174,7 +166,7 @@ pub fn validate_blind_signature_sender_token( var sig_ok: bool = false; for i in 0..valid_sigs.len { if (issuer_ids_equal(valid_sigs[i].issuer_id, token.issuer_pubkey_id)) { - if (nonces_equal(valid_sigs[i].nonce, token.token_nonce)) { + if (ids32_equal(valid_sigs[i].nonce, token.token_nonce)) { if (signatures_equal(valid_sigs[i].signature, token.signature)) { sig_ok = true; } @@ -318,8 +310,8 @@ test bsst_10_canonical_token_accepted { test bsst_helpers_answer { assert(issuer_ids_equal(ISSUER_ID_A, ISSUER_ID_A)); assert(!issuer_ids_equal(ISSUER_ID_A, PHANTOM_ID)); - assert(nonces_equal(NONCE_A, NONCE_A)); - assert(!nonces_equal(NONCE_A, ZERO_NONCE)); + assert(ids32_equal(NONCE_A, NONCE_A)); + assert(!ids32_equal(NONCE_A, ZERO_NONCE)); assert(nonce_zero(ZERO_NONCE)); assert(!nonce_zero(NONCE_A)); assert(signatures_equal(SIG_A, SIG_A)); diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_burst_interval_regularity_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_burst_interval_regularity_guard.t27 index da4837aeb8..ca2a58659f 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_burst_interval_regularity_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_burst_interval_regularity_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_burst_interval_regularity_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_burst_interval_regularity_guard.rs // (CR-CHAT-07 - Cover traffic burst interval regularity guard, // Wave-152 Lane B, R-CHAT-10). @@ -70,58 +72,17 @@ pub struct BurstRegularityVerdict { bound64: u64, } -// Whole-form equality over the fixed sixteen burst-id bytes. -pub fn burst_ids_equal(a: [16]u8, b: [16]u8) -> bool { - for i in 0..16 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - -// The all-zero burst id - the original's [0u8; 16] probe. -pub fn burst_id_zero(id: [16]u8) -> bool { - for i in 0..16 { - if (id[i] != 0) { - return false; - } - } - return true; -} - // Whether burst i repeats an earlier id - the original's // BTreeSet insert probe, answered by a scan. pub fn burst_seen_before(bursts: []const BurstObservation, i: usize) -> bool { for j in 0..i { - if (burst_ids_equal(bursts[j].burst_id, bursts[i].burst_id)) { + if (ids16_equal(bursts[j].burst_id, bursts[i].burst_id)) { return true; } } return false; } -// The integer square root of a u64 - the original's approx_sqrt -// Newton iteration, answered by a bisection over the whole answer -// range. The largest root of any u64 is 4294967295, and -// thirty-three halvings settle the search exactly. -pub fn approx_sqrt(n: u64) -> u64 { - var lo: u64 = 0; - var hi: u64 = 4294967295; - var mid: u64 = 0; - for _ in 0..33 { - if (lo <= hi) { - mid = (lo + hi) / 2; - if (mid * mid <= n) { - lo = mid + 1; - } else { - hi = mid - 1; - } - } - } - return hi; -} - // [VERIFIED] Validate cover traffic burst interval regularity. // Returns Ok only when every rule holds, checked in the // original's order: the batch ceiling, the burst floor, then per @@ -137,7 +98,7 @@ pub fn validate_burst_regularity(bursts: []const BurstObservation) -> BurstRegul const n: u64 = @as(u64, bursts.len); var sum: u64 = 0; for i in 0..bursts.len { - if (burst_id_zero(bursts[i].burst_id)) { + if (zero_id16(bursts[i].burst_id)) { return BurstRegularityVerdict { code: BurstRegularityCode.ZeroId, idx: i, got: 0, bound: 0, got64: 0, bound64: 0, }; } if (burst_seen_before(bursts, i)) { @@ -354,10 +315,10 @@ test ctbi_10_many_irregular_accepted { // The four helpers have direct tests (coverage: Untested 0). test ctbi_helpers_answer { - assert(burst_ids_equal(BID_01, BID_01)); - assert(!burst_ids_equal(BID_01, BID_02)); - assert(burst_id_zero(ZERO_BID)); - assert(!burst_id_zero(BID_01)); + assert(ids16_equal(BID_01, BID_01)); + assert(!ids16_equal(BID_01, BID_02)); + assert(zero_id16(ZERO_BID)); + assert(!zero_id16(BID_01)); const three: [3]BurstObservation = [3]BurstObservation{ BurstObservation { burst_id: BID_01, interval_us: 1000, }, BurstObservation { burst_id: BID_02, interval_us: 1000, }, diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_destination_rotation_frequency_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_destination_rotation_frequency_guard.t27 index 564d846929..892741b690 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_destination_rotation_frequency_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_destination_rotation_frequency_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_destination_rotation_frequency_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_destination_rotation_frequency_guard.rs // (CR-CHAT-07 - Cover traffic destination rotation frequency // guard, Wave-133 Lane A, R-CHAT-10). @@ -79,42 +81,11 @@ pub struct DestRotationVerdict { current_ts: u64, } -// Whole-form equality over the fixed thirty-two emission-id -// bytes. -pub fn emission_ids_equal(a: [32]u8, b: [32]u8) -> bool { - for i in 0..32 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - -// Whole-form equality over the fixed sixteen destination bytes. -pub fn dests_equal(a: [16]u8, b: [16]u8) -> bool { - for i in 0..16 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - -// The all-zero destination - the original's [0u8; 16] probe. -pub fn dest_zero(d: [16]u8) -> bool { - for i in 0..16 { - if (d[i] != 0) { - return false; - } - } - return true; -} - // Whether emission i repeats an earlier emission id - the // original's BTreeSet insert probe, answered by a scan. pub fn emission_seen_before(emissions: []const DestEmission, i: usize) -> bool { for j in 0..i { - if (emission_ids_equal(emissions[j].emission_id, emissions[i].emission_id)) { + if (ids32_equal(emissions[j].emission_id, emissions[i].emission_id)) { return true; } } @@ -126,7 +97,7 @@ pub fn emission_seen_before(emissions: []const DestEmission, i: usize) -> bool { pub fn dest_count(emissions: []const DestEmission, d: [16]u8) -> usize { var count: usize = 0; for i in 0..emissions.len { - if (dests_equal(emissions[i].dest, d)) { + if (ids16_equal(emissions[i].dest, d)) { count = count + 1; } } @@ -141,7 +112,7 @@ pub fn distinct_dests(emissions: []const DestEmission) -> usize { for i in 0..emissions.len { var seen_before: bool = false; for j in 0..i { - if (dests_equal(emissions[j].dest, emissions[i].dest)) { + if (ids16_equal(emissions[j].dest, emissions[i].dest)) { seen_before = true; } } @@ -164,7 +135,7 @@ pub fn validate_dest_rotation(emissions: []const DestEmission) -> DestRotationVe } var prev_ts: u64 = 0; for i in 0..emissions.len { - if (dest_zero(emissions[i].dest)) { + if (zero_id16(emissions[i].dest)) { return DestRotationVerdict { code: DestRotationCode.ZeroDest, idx: i, got: 0, bound: 0, got64: 0, prev: ZERO_DEST, current: ZERO_DEST, prev_ts: 0, current_ts: 0, }; } if (emission_seen_before(emissions, i)) { @@ -239,7 +210,7 @@ test cdrf_01_too_many_per_dest_rejected { assert(v.code == DestRotationCode.TooManyPerDest); assert(v.got == 11); assert(v.bound == 10); - assert(dests_equal(v.current, DEST_1)); + assert(ids16_equal(v.current, DEST_1)); } // **CDRF-02** - the zero destination rejected. @@ -376,12 +347,12 @@ test cdrf_10_many_rotating_accepted { // The five helpers have direct tests (coverage: Untested 0). test cdrf_helpers_answer { - assert(emission_ids_equal(EID_01, EID_01)); - assert(!emission_ids_equal(EID_01, EID_02)); - assert(dests_equal(DEST_1, DEST_1)); - assert(!dests_equal(DEST_1, DEST_2)); - assert(dest_zero(ZERO_DEST)); - assert(!dest_zero(DEST_1)); + assert(ids32_equal(EID_01, EID_01)); + assert(!ids32_equal(EID_01, EID_02)); + assert(ids16_equal(DEST_1, DEST_1)); + assert(!ids16_equal(DEST_1, DEST_2)); + assert(zero_id16(ZERO_DEST)); + assert(!zero_id16(DEST_1)); const three: [3]DestEmission = [3]DestEmission{ DestEmission { emission_id: EID_01, dest: DEST_1, timestamp_ms: 1, }, DestEmission { emission_id: EID_02, dest: DEST_2, timestamp_ms: 2, }, diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_destination_uniformity_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_destination_uniformity_guard.t27 index 6f4145be25..b133e087b4 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_destination_uniformity_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_destination_uniformity_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_destination_uniformity_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_destination_uniformity_guard.rs // (CR-CHAT-07 - Cover traffic destination uniformity guard, // Wave-110 Lane A, R-CHAT-10). @@ -94,31 +96,11 @@ pub struct DestUniformityVerdict { bound: usize, } -// Whole-form equality over the fixed sixteen destination bytes. -pub fn dests_equal(a: [16]u8, b: [16]u8) -> bool { - for i in 0..16 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - -// The all-zero destination - the original's [0u8; 16] probe. -pub fn dest_zero(d: [16]u8) -> bool { - for i in 0..16 { - if (d[i] != 0) { - return false; - } - } - return true; -} - // The declared-set position of a destination, or the sentinel // four for a destination no rule accepted. pub fn dest_position(declared: []const DeclaredDest, d: [16]u8) -> usize { for i in 0..declared.len { - if (dests_equal(declared[i].dest, d)) { + if (ids16_equal(declared[i].dest, d)) { return i; } } @@ -129,7 +111,7 @@ pub fn dest_position(declared: []const DeclaredDest, d: [16]u8) -> usize { // original's BTreeSet membership probe, answered by a scan. pub fn dest_declared(declared: []const DeclaredDest, d: [16]u8) -> bool { for i in 0..declared.len { - if (dests_equal(declared[i].dest, d)) { + if (ids16_equal(declared[i].dest, d)) { return true; } } @@ -141,7 +123,7 @@ pub fn dest_declared(declared: []const DeclaredDest, d: [16]u8) -> bool { pub fn dest_count(emissions: []const DestCoverEmission, d: [16]u8) -> usize { var count: usize = 0; for i in 0..emissions.len { - if (dests_equal(emissions[i].dest, d)) { + if (ids16_equal(emissions[i].dest, d)) { count = count + 1; } } @@ -165,7 +147,7 @@ pub fn validate_dest_uniformity( return DestUniformityVerdict { code: DestUniformityCode.TooFew, idx: 0, got: emissions.len, bound: CDUG_MIN_EMISSIONS, }; } for i in 0..emissions.len { - if (dest_zero(emissions[i].dest)) { + if (zero_id16(emissions[i].dest)) { return DestUniformityVerdict { code: DestUniformityCode.ZeroDest, idx: i, got: 0, bound: 0, }; } if (!dest_declared(declared_dests, emissions[i].dest)) { @@ -442,10 +424,10 @@ test cdug_10_uniform_accepted { // The five helpers have direct tests (coverage: Untested 0). test cdug_helpers_answer { - assert(dests_equal(DEST_1, DEST_1)); - assert(!dests_equal(DEST_1, DEST_2)); - assert(dest_zero(ZERO_DEST16)); - assert(!dest_zero(DEST_1)); + assert(ids16_equal(DEST_1, DEST_1)); + assert(!ids16_equal(DEST_1, DEST_2)); + assert(zero_id16(ZERO_DEST16)); + assert(!zero_id16(DEST_1)); assert(dest_position(&DECLARED_4, DEST_1) == 0); assert(dest_position(&DECLARED_4, DEST_4) == 3); assert(dest_position(&DECLARED_4, DEST_99) == 4); diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_inter_arrival_autocorrelation_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_inter_arrival_autocorrelation_guard.t27 index a43c0985cc..e8b247ebfb 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_inter_arrival_autocorrelation_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_inter_arrival_autocorrelation_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_inter_arrival_autocorrelation_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_inter_arrival_autocorrelation_guard.rs // (CR-CHAT-07 - Cover traffic inter-arrival autocorrelation // guard, Wave-144 Lane B, R-CHAT-10). @@ -81,32 +83,11 @@ pub struct AutocorrelationVerdict { bound_s: i64, } -// Whole-form equality over the fixed sixteen observation-id -// bytes. -pub fn obs_ids_equal(a: [16]u8, b: [16]u8) -> bool { - for i in 0..16 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - -// The all-zero observation id - the original's [0u8; 16] probe. -pub fn obs_id_zero(id: [16]u8) -> bool { - for i in 0..16 { - if (id[i] != 0) { - return false; - } - } - return true; -} - // Whether observation i repeats an earlier id - the original's // BTreeSet insert probe, answered by a scan. pub fn obs_seen_before(observations: []const IntervalObservation, i: usize) -> bool { for j in 0..i { - if (obs_ids_equal(observations[j].obs_id, observations[i].obs_id)) { + if (ids16_equal(observations[j].obs_id, observations[i].obs_id)) { return true; } } @@ -153,7 +134,7 @@ pub fn validate_inter_arrival_autocorr(observations: []const IntervalObservation return AutocorrelationVerdict { code: AutocorrelationCode.TooFew, idx: 0, got: observations.len, bound: CTIA_MIN_INTERVALS, got_s: 0, bound_s: 0, }; } for i in 0..observations.len { - if (obs_id_zero(observations[i].obs_id)) { + if (zero_id16(observations[i].obs_id)) { return AutocorrelationVerdict { code: AutocorrelationCode.ZeroId, idx: i, got: 0, bound: 0, got_s: 0, bound_s: 0, }; } if (obs_seen_before(observations, i)) { @@ -343,10 +324,10 @@ test ctia_10_many_alternating_accepted { // The four helpers have direct tests (coverage: Untested 0). test ctia_helpers_answer { - assert(obs_ids_equal(OID_01, OID_01)); - assert(!obs_ids_equal(OID_01, OID_02)); - assert(obs_id_zero(ZERO_OID16)); - assert(!obs_id_zero(OID_01)); + assert(ids16_equal(OID_01, OID_01)); + assert(!ids16_equal(OID_01, OID_02)); + assert(zero_id16(ZERO_OID16)); + assert(!zero_id16(OID_01)); const three: [3]IntervalObservation = [3]IntervalObservation{ IntervalObservation { obs_id: OID_01, interval_us: 500, }, IntervalObservation { obs_id: OID_02, interval_us: 500, }, diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_inter_destination_timing_uniformity_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_inter_destination_timing_uniformity_guard.t27 index 7823915ebe..d15f3139d7 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_inter_destination_timing_uniformity_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_inter_destination_timing_uniformity_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_inter_destination_timing_uniformity_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_inter_destination_timing_uniformity_guard.rs // (CR-CHAT-07 - Cover traffic inter-destination timing // uniformity guard, Wave-118 Lane B, R-CHAT-10). @@ -84,26 +86,6 @@ pub struct DestTimingVerdict { bound_f: f64, } -// Whole-form equality over the fixed sixteen destination bytes. -pub fn dests_equal(a: [16]u8, b: [16]u8) -> bool { - for i in 0..16 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - -// The all-zero destination - the original's [0u8; 16] probe. -pub fn dest_zero(d: [16]u8) -> bool { - for i in 0..16 { - if (d[i] != 0) { - return false; - } - } - return true; -} - // Whether a is byte-lexicographically before b: the first // differing byte decides. pub fn dest_byte_less(a: [16]u8, b: [16]u8) -> bool { @@ -123,7 +105,7 @@ pub fn dest_byte_less(a: [16]u8, b: [16]u8) -> bool { // distribution lane. pub fn dest_seen_before(emissions: []const DestTimingEmission, i: usize) -> bool { for j in 0..i { - if (dests_equal(emissions[j].dest, emissions[i].dest)) { + if (ids16_equal(emissions[j].dest, emissions[i].dest)) { return true; } } @@ -146,7 +128,7 @@ pub fn distinct_dests(emissions: []const DestTimingEmission) -> usize { pub fn dest_count(emissions: []const DestTimingEmission, d: [16]u8) -> usize { var count: usize = 0; for i in 0..emissions.len { - if (dests_equal(emissions[i].dest, d)) { + if (ids16_equal(emissions[i].dest, d)) { count = count + 1; } } @@ -170,7 +152,7 @@ pub fn validate_dest_timing( } var prev_ts: u64 = 0; for i in 0..emissions.len { - if (dest_zero(emissions[i].dest)) { + if (zero_id16(emissions[i].dest)) { return DestTimingVerdict { code: DestTimingCode.ZeroDest, idx: i, got: 0, bound: 0, prev: 0, current: 0, got_f: 0.0, bound_f: 0.0, }; } if (emissions[i].timestamp_ms == 0) { @@ -360,10 +342,10 @@ test cidt_10_many_uniform_accepted { // The six helpers have direct tests (coverage: Untested 0). test cidt_helpers_answer { - assert(dests_equal(DEST_1, DEST_1)); - assert(!dests_equal(DEST_1, DEST_2)); - assert(dest_zero(ZERO_DEST16)); - assert(!dest_zero(DEST_1)); + assert(ids16_equal(DEST_1, DEST_1)); + assert(!ids16_equal(DEST_1, DEST_2)); + assert(zero_id16(ZERO_DEST16)); + assert(!zero_id16(DEST_1)); assert(dest_byte_less(DEST_1, DEST_2)); assert(!dest_byte_less(DEST_2, DEST_1)); assert(!dest_byte_less(DEST_1, DEST_1)); diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_replay_detection_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_replay_detection_guard.t27 index f2e64b4d31..f7b10495ba 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_replay_detection_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_replay_detection_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_replay_detection_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_replay_detection_guard.rs // (CR-CHAT-07 - Cover traffic replay detection guard, Wave-113 // Lane A, R-CHAT-10). @@ -63,16 +65,6 @@ pub struct CoverReplayVerdict { current: u64, } -// Whole-form equality over the fixed thirty-two hash bytes. -pub fn hashes_equal(a: [32]u8, b: [32]u8) -> bool { - for i in 0..32 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // The all-zero hash - the original's [0u8; 32] probe. pub fn hash_zero(h: [32]u8) -> bool { for i in 0..32 { @@ -87,7 +79,7 @@ pub fn hash_zero(h: [32]u8) -> bool { // BTreeSet insert probe, answered by a scan. pub fn hash_seen_before(windows: []const CoverWindow, i: usize) -> bool { for j in 0..i { - if (hashes_equal(windows[j].pattern_hash, windows[i].pattern_hash)) { + if (ids32_equal(windows[j].pattern_hash, windows[i].pattern_hash)) { return true; } } @@ -256,8 +248,8 @@ test ctrd_10_boundary_accepted { // The three helpers have direct tests (coverage: Untested 0). test ctrd_helpers_answer { - assert(hashes_equal(HASH_01, HASH_01)); - assert(!hashes_equal(HASH_01, HASH_02)); + assert(ids32_equal(HASH_01, HASH_01)); + assert(!ids32_equal(HASH_01, HASH_02)); assert(hash_zero(ZERO_HASH32)); assert(!hash_zero(HASH_01)); const three: [3]CoverWindow = [3]CoverWindow{ diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_size_distribution_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_size_distribution_guard.t27 index 253da83199..878e3b9812 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_size_distribution_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_size_distribution_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_size_distribution_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_size_distribution_guard.rs // (CR-CHAT-07 - Cover traffic size distribution guard, Wave-155 // Lane B, R-CHAT-10). @@ -75,32 +77,11 @@ pub struct SizeDistVerdict { bound64: u64, } -// Whole-form equality over the fixed sixteen observation-id -// bytes. -pub fn obs_ids_equal(a: [16]u8, b: [16]u8) -> bool { - for i in 0..16 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - -// The all-zero observation id - the original's [0u8; 16] probe. -pub fn obs_id_zero(id: [16]u8) -> bool { - for i in 0..16 { - if (id[i] != 0) { - return false; - } - } - return true; -} - // Whether observation i repeats an earlier id - the original's // BTreeSet insert probe, answered by a scan. pub fn obs_seen_before(obs: []const SizeObservation, i: usize) -> bool { for j in 0..i { - if (obs_ids_equal(obs[j].obs_id, obs[i].obs_id)) { + if (ids16_equal(obs[j].obs_id, obs[i].obs_id)) { return true; } } @@ -211,7 +192,7 @@ pub fn validate_size_distribution(obs: []const SizeObservation) -> SizeDistVerdi var real_count: usize = 0; var cover_count: usize = 0; for i in 0..obs.len { - if (obs_id_zero(obs[i].obs_id)) { + if (zero_id16(obs[i].obs_id)) { return SizeDistVerdict { code: SizeDistCode.ZeroId, idx: i, got: 0, bound: 0, got64: 0, bound64: 0, }; } if (obs_seen_before(obs, i)) { @@ -413,10 +394,10 @@ test ctsd_10_many_matched_accepted { // The four helpers have direct tests (coverage: Untested 0). test ctsd_helpers_answer { - assert(obs_ids_equal(OID_01, OID_01)); - assert(!obs_ids_equal(OID_01, OID_21)); - assert(obs_id_zero(ZERO_OID16)); - assert(!obs_id_zero(OID_01)); + assert(ids16_equal(OID_01, OID_01)); + assert(!ids16_equal(OID_01, OID_21)); + assert(zero_id16(ZERO_OID16)); + assert(!zero_id16(OID_01)); const pair: [2]SizeObservation = [2]SizeObservation{ SizeObservation { obs_id: OID_01, size: 256, is_real: true, }, SizeObservation { obs_id: OID_01, size: 512, is_real: false, }, diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_timing_jitter_uniformity_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_timing_jitter_uniformity_guard.t27 index 98d0e90919..911ba16ffc 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_timing_jitter_uniformity_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_timing_jitter_uniformity_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_timing_jitter_uniformity_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_timing_jitter_uniformity_guard.rs // (CR-CHAT-07 - Cover traffic timing jitter uniformity guard, // Wave-137 Lane A, R-CHAT-10). @@ -83,47 +85,17 @@ pub struct JitterUniformityVerdict { bound64: u64, } -// Whole-form equality over the fixed sixteen observation-id -// bytes. -pub fn obs_ids_equal(a: [16]u8, b: [16]u8) -> bool { - for i in 0..16 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - // Whether observation i repeats an earlier id - the original's // BTreeSet insert probe, answered by a scan. pub fn obs_seen_before(observations: []const JitterObservation, i: usize) -> bool { for j in 0..i { - if (obs_ids_equal(observations[j].obs_id, observations[i].obs_id)) { + if (ids16_equal(observations[j].obs_id, observations[i].obs_id)) { return true; } } return false; } -// The integer square root of a u64 - the original's isqrt, -// answered by a bisection over the whole answer range. -pub fn approx_sqrt(v: u64) -> u64 { - var lo: u64 = 0; - var hi: u64 = 4294967295; - var mid: u64 = 0; - for _ in 0..33 { - if (lo <= hi) { - mid = (lo + hi) / 2; - if (mid * mid <= v) { - lo = mid + 1; - } else { - hi = mid - 1; - } - } - } - return hi; -} - // [VERIFIED] Validate cover traffic timing jitter uniformity. // Returns Ok only when every rule holds, checked in the // original's order: the batch ceiling, the empty batch @@ -367,8 +339,8 @@ test ctju_10_uniform_high_accepted { // The three helpers have direct tests (coverage: Untested 0). test ctju_helpers_answer { - assert(obs_ids_equal(OID_01, OID_01)); - assert(!obs_ids_equal(OID_01, OID_02)); + assert(ids16_equal(OID_01, OID_01)); + assert(!ids16_equal(OID_01, OID_02)); const three: [3]JitterObservation = [3]JitterObservation{ JitterObservation { obs_id: OID_01, interval_us: 500, }, JitterObservation { obs_id: OID_02, interval_us: 500, }, diff --git a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_volume_ratio_stability_guard.t27 b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_volume_ratio_stability_guard.t27 index 31be8c7a75..a71870a892 100644 --- a/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_volume_ratio_stability_guard.t27 +++ b/specs/port/trios/crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_volume_ratio_stability_guard.t27 @@ -1,5 +1,7 @@ module port::trios::crates::trios-chat::rings::CR-CHAT-07::src::cover_traffic_volume_ratio_stability_guard; +use port::trios::crates::trios-chat::common::helpers; + // Port of gHashTag/trios crates/trios-chat/rings/CR-CHAT-07/src/cover_traffic_volume_ratio_stability_guard.rs // (CR-CHAT-07 - Cover traffic volume ratio stability guard, // Wave-149 Lane A, R-CHAT-10). @@ -81,56 +83,17 @@ pub struct RatioStabilityVerdict { bound64: u64, } -// Whole-form equality over the fixed sixteen window-id bytes. -pub fn window_ids_equal(a: [16]u8, b: [16]u8) -> bool { - for i in 0..16 { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - -// The all-zero window id - the original's [0u8; 16] probe. -pub fn window_id_zero(id: [16]u8) -> bool { - for i in 0..16 { - if (id[i] != 0) { - return false; - } - } - return true; -} - // Whether observation i repeats an earlier id - the original's // BTreeSet insert probe, answered by a scan. pub fn window_seen_before(observations: []const RatioObservation, i: usize) -> bool { for j in 0..i { - if (window_ids_equal(observations[j].window_id, observations[i].window_id)) { + if (ids16_equal(observations[j].window_id, observations[i].window_id)) { return true; } } return false; } -// The integer square root of a u64 - the original's isqrt, -// answered by a bisection over the whole answer range. -pub fn approx_sqrt(v: u64) -> u64 { - var lo: u64 = 0; - var hi: u64 = 4294967295; - var mid: u64 = 0; - for _ in 0..33 { - if (lo <= hi) { - mid = (lo + hi) / 2; - if (mid * mid <= v) { - lo = mid + 1; - } else { - hi = mid - 1; - } - } - } - return hi; -} - // [VERIFIED] Validate cover traffic volume ratio stability. // Returns Ok only when every rule holds, checked in the // original's order: the batch ceiling, the empty batch @@ -148,7 +111,7 @@ pub fn validate_ratio_stability(observations: []const RatioObservation) -> Ratio return RatioStabilityVerdict { code: RatioStabilityCode.TooFew, idx: 0, got: observations.len, bound: CTVS_MIN_OBS, got64: 0, bound64: 0, }; } for i in 0..observations.len { - if (window_id_zero(observations[i].window_id)) { + if (zero_id16(observations[i].window_id)) { return RatioStabilityVerdict { code: RatioStabilityCode.ZeroId, idx: i, got: 0, bound: 0, got64: 0, bound64: 0, }; } if (window_seen_before(observations, i)) { @@ -351,10 +314,10 @@ test ctvs_10_many_stable_accepted { // The four helpers have direct tests (coverage: Untested 0). test ctvs_helpers_answer { - assert(window_ids_equal(WID_01, WID_01)); - assert(!window_ids_equal(WID_01, WID_02)); - assert(window_id_zero(ZERO_WID16)); - assert(!window_id_zero(WID_01)); + assert(ids16_equal(WID_01, WID_01)); + assert(!ids16_equal(WID_01, WID_02)); + assert(zero_id16(ZERO_WID16)); + assert(!zero_id16(WID_01)); const three: [3]RatioObservation = [3]RatioObservation{ RatioObservation { window_id: WID_01, ratio_x1000: 800, }, RatioObservation { window_id: WID_02, ratio_x1000: 800, }, diff --git a/specs/port/trios/crates/trios-phi-schedule/src/lib.t27 b/specs/port/trios/crates/trios-phi-schedule/src/lib.t27 index 57d333058c..39354cf9c8 100644 --- a/specs/port/trios/crates/trios-phi-schedule/src/lib.t27 +++ b/specs/port/trios/crates/trios-phi-schedule/src/lib.t27 @@ -26,20 +26,11 @@ module port::trios_phi_schedule_lib; -// Newton square root — the port's root primitive. -pub fn sched_sqrt(v: f32) -> f32 { - var s: f32 = v; - var i: usize = 0; - while (i < 40) { - s = (s + v / s) / 2.0; - i += 1; - } - return s; -} +use port::trios::common::newton_sqrt; // φ = (1 + sqrt(5)) / 2 — the golden ratio from gf_constants(). pub fn phi_value() -> f32 { - return (1.0 + sched_sqrt(5.0)) / 2.0; + return (1.0 + newton_sqrt(5.0)) / 2.0; } // φ^(-e) for e >= 0: the integer part by repeated multiplication by @@ -54,7 +45,7 @@ pub fn phi_pow_neg(e: f32) -> f32 { result = result * inv; i += 1; } - var root: f32 = sched_sqrt(inv); + var root: f32 = newton_sqrt(inv); var bit: f32 = 0.5; var remaining: f32 = frac; var j: usize = 0; @@ -63,7 +54,7 @@ pub fn phi_pow_neg(e: f32) -> f32 { result = result * root; remaining = remaining - bit; } - root = sched_sqrt(root); + root = newton_sqrt(root); bit = bit / 2.0; j += 1; } @@ -198,10 +189,10 @@ pub fn alpha_phi_role() -> str { // --------------------------------------------------------------------------- test sqrt_ladder_direct { - const r2 = sched_sqrt(2.0); + const r2 = newton_sqrt(2.0); assert(r2 > 1.41421); assert(r2 < 1.41422); - const r5 = sched_sqrt(5.0); + const r5 = newton_sqrt(5.0); assert(r5 > 2.23606); assert(r5 < 2.23607); } diff --git a/specs/port/trios/crates/trios-ternary/src/lib.t27 b/specs/port/trios/crates/trios-ternary/src/lib.t27 index 3cc4ee5679..470b660ec6 100644 --- a/specs/port/trios/crates/trios-ternary/src/lib.t27 +++ b/specs/port/trios/crates/trios-ternary/src/lib.t27 @@ -24,6 +24,8 @@ module port::trios_ternary_lib; +use port::trios::common::newton_sqrt; + // --------------------------------------------------------------------------- // Original lines 27-62: the Ternary value {-1, 0, +1} and its // conversions. The thresholding decision: strictly above 0.5 → +1, @@ -44,25 +46,11 @@ pub fn Ternary_to_f32(value: i32) -> f32 { return value as f32; } -// Original line 59: log2(3), computed without the log2 builtin - -// Newton square roots build the 2^(1/2^k) ladder, the binary -// expansion of the fraction assembles 2^y for any y in [0, 1), and a -// bisection on 2^x = 3 over [1, 2] converges far past the test window. -pub fn ternary_sqrt_newton(v: f32) -> f32 { - var s: f32 = v; - var i: usize = 0; - while (i < 40) { - s = (s + v / s) / 2.0; - i += 1; - } - return s; -} - // 2^y for y in [0, 1): each set binary bit k contributes the k-th // square root of 2 (bit 1 -> sqrt(2), bit 2 -> sqrt(sqrt(2)), ...). pub fn ternary_pow2_frac(y: f32) -> f32 { var result: f32 = 1.0; - var root: f32 = ternary_sqrt_newton(2.0); + var root: f32 = newton_sqrt(2.0); var bit: f32 = 0.5; var remaining: f32 = y; var i: usize = 0; @@ -71,7 +59,7 @@ pub fn ternary_pow2_frac(y: f32) -> f32 { result = result * root; remaining = remaining - bit; } - root = ternary_sqrt_newton(root); + root = newton_sqrt(root); bit = bit / 2.0; i += 1; } @@ -171,10 +159,10 @@ pub fn ffn_ternary_size_bytes(num_params: usize) -> usize { // --------------------------------------------------------------------------- test sqrt_ladder_converges { - const r2 = ternary_sqrt_newton(2.0); + const r2 = newton_sqrt(2.0); assert(r2 > 1.41421); assert(r2 < 1.41422); - const r4 = ternary_sqrt_newton(r2); + const r4 = newton_sqrt(r2); assert(r4 > 1.18920); assert(r4 < 1.18921); assert(pow2_unit(1.0) == 2.0); diff --git a/specs/port/trios/crates/trios-trinity-init/src/lib.t27 b/specs/port/trios/crates/trios-trinity-init/src/lib.t27 index 687f39c383..69585981e1 100644 --- a/specs/port/trios/crates/trios-trinity-init/src/lib.t27 +++ b/specs/port/trios/crates/trios-trinity-init/src/lib.t27 @@ -22,17 +22,7 @@ module port::trios_trinity_init; -// Newton's iteration for the square root: x <- (x + v/x) / 2, forty -// rounds — quadratic convergence, far beyond the f32 tolerance below. -pub fn sqrt_newton32(v: f32) -> f32 { - var s: f32 = v; - var i: usize = 0; - while (i < 40) { - s = (s + v / s) / 2.0; - i += 1; - } - return s; -} +use port::trios::common::newton_sqrt; // Original line 53: `let size = shape.iter().product::();` — the // element count is the product of the dimensions. @@ -65,9 +55,9 @@ pub fn trinity_init(shape: []const usize) -> TrinityInitPlan { if (size == 0) { return TrinityInitPlan { element_count: 0, bound: 0.0 }; } - const sqrt_3: f32 = sqrt_newton32(3.0); + const sqrt_3: f32 = newton_sqrt(3.0); const n_f: f32 = size as f32; - const sqrt_n: f32 = sqrt_newton32(n_f); + const sqrt_n: f32 = newton_sqrt(n_f); return TrinityInitPlan { element_count: size, bound: sqrt_3 / sqrt_n }; } @@ -90,10 +80,10 @@ pub fn sample_within_bound(x: f32, bound: f32) -> bool { // --------------------------------------------------------------------------- test newton_roots_converge { - const r3 = sqrt_newton32(3.0); + const r3 = newton_sqrt(3.0); assert(r3 > 1.7320); assert(r3 < 1.7321); - const r12 = sqrt_newton32(12.0); + const r12 = newton_sqrt(12.0); assert(r12 > 3.4641); assert(r12 < 3.4642); } diff --git a/tools/duplicate_bodies_baseline.txt b/tools/duplicate_bodies_baseline.txt index db3eaca20e..ca89afb5bc 100644 --- a/tools/duplicate_bodies_baseline.txt +++ b/tools/duplicate_bodies_baseline.txt @@ -7,19 +7,15 @@ sadd 31 build_tree 28,2 magmul 22,2 smul 20,2 -burst_ids_equal 13 tmul 13 -emission_ids_equal 10 relu 10 dot27 8,5 -burst_id_zero 7 contrib 7 activate 6 clamp 6 clear 6,2 quantize 6,5 relu_prime 6 -bytes_equal 5 count 5 exp_approx 5 floor 5,4 @@ -29,7 +25,6 @@ pack3 5 pow 5,2 scale_q 5 tp 5 -all_zero_bytes 4 fromRaw 4 gft_add 4 gft_mul 4 @@ -47,7 +42,6 @@ cos 3 crc_byte 3 crc_step 3 dest_count 3 -dest_zero 3 fill 3 floor_log2 3,2 gadd 3 @@ -62,7 +56,6 @@ pack2 3 pow2_frac 3 publish_result_to_string 3 same 3,2,2 -sched_sqrt 3 source_upload_file 3 starts_with_at 3 strings_equal 3 @@ -77,7 +70,6 @@ LinkSection_data 2 LinkSection_text 2 adaptive_temperature_by_sacred_score 2 add 2 -approx_sqrt 2 asr9 2 assert_pass 2 axi4_full_master 2 @@ -112,7 +104,7 @@ hard_sigmoid 2 has_at 2 has_star_inner 2 hw_place_before 2 -id_seen_before 2 +id_seen_before 2,2 is_counter_power_of_two 2 is_name_byte 2 kill 2