specs/trust_manager.t27 declares 17 test blocks with 23 assertions. Four of those assertions cannot pass against gen/rust/trust_manager.rs, and could not have passed at any point since they were written. They are behaviour defects in the spec, not codegen defects.
They were invisible until now for the usual reason: the module was one of the nine functions deleted by the parser-drop repaired in 9bcbd80, and gen/rust/ is excluded from compilation in src/lib.rs, so nothing ever executed them.
Reproduced against the artifact before changing anything - actual values in brackets.
1. create_trust_relationship_basic - field width vs witness [232]. create_trust_relationship masks verified & 0xFF. The test builds it with verified=1000 and asserts get_trust_verified(rel) == 1000, but 1000 & 0xFF = 232. Either the witness fits in 8 bits, or verified is widened - which changes the packing layout of every other field and the u32 return type.
2. find_most_trusted_middle [3] and should_route_via_node_true [false] - lane width mismatch. create_trust_score returns a 32-bit word with the score at bits 16..23. create_trust_array packs eight slots at shifts 56, 48, 40, 32, 24, 16, 8, 0 - 8-bit lanes - so (create_trust_score(1,60,6,4) as u64) << 56 is 0x0400000000000000: only the low byte survives, and the score byte is shifted out before any OR happens. get_trust_score then extracts with & 0xFFFFFFFF from lanes eight bits wide, so slots overlap.
Consequently get_trust_score(array, i) never recovers a usable score. find_most_trusted returns 3 where the test expects 1, and should_route_via_node(arr, 0, 70) returns false where the test expects true.
Note that should_route_via_node_false is currently a false pass - it reads garbage from an overlapping slot that happens to fall under 90.
Either the array holds 8-bit score values (create_trust_array takes score bytes, get_trust_score masks & 0xFF), or it holds fewer, wider slots. Whichever is chosen moves MAX_NODES, the shifts and the extraction masks together.
3. update_trust_score_increases - arithmetic expectation [57]. The test starts from create_trust_score(5, 50, 5, 5), calls update_trust_score(current, 3, 1) and asserts the result is >= 60. The actual value is 57: new_positive=8, new_negative=6, calculate_trust_score(8, 6) = 800/14 = 57. Either the threshold is wrong or calculate_trust_score's rounding is.
Constraint for whoever picks this up
gen/ is generated and this repository's own law forbids editing it. Edit specs/trust_manager.t27 only, then regenerate.
t27c's parser silently discards statements it cannot parse (Err(_) => recover_to_stmt_boundary) and exits 0 with empty stderr - see gHashTag/t27#2508. After any spec edit, verify the counts rather than assuming: the spec must declare and the artifact must emit the same number of functions (21 and 21), rustc --crate-type lib --edition 2021 on the artifact must exit 0, and because a function count cannot catch a statement dropped inside a test block, the AST node counts must be checked too (FnDecl / TestBlock / assert StmtExpr = 21 / 17 / 23). An unbalanced brace in particular is not reported - it deletes every function declared after it.
phi^2 + phi^-2 = 3
specs/trust_manager.t27declares 17testblocks with 23 assertions. Four of those assertions cannot pass againstgen/rust/trust_manager.rs, and could not have passed at any point since they were written. They are behaviour defects in the spec, not codegen defects.They were invisible until now for the usual reason: the module was one of the nine functions deleted by the parser-drop repaired in 9bcbd80, and
gen/rust/is excluded from compilation insrc/lib.rs, so nothing ever executed them.Reproduced against the artifact before changing anything - actual values in brackets.
1.
create_trust_relationship_basic- field width vs witness [232].create_trust_relationshipmasksverified & 0xFF. The test builds it withverified=1000and assertsget_trust_verified(rel) == 1000, but1000 & 0xFF = 232. Either the witness fits in 8 bits, orverifiedis widened - which changes the packing layout of every other field and theu32return type.2.
find_most_trusted_middle[3] andshould_route_via_node_true[false] - lane width mismatch.create_trust_scorereturns a 32-bit word with the score at bits 16..23.create_trust_arraypacks eight slots at shifts 56, 48, 40, 32, 24, 16, 8, 0 - 8-bit lanes - so(create_trust_score(1,60,6,4) as u64) << 56is0x0400000000000000: only the low byte survives, and the score byte is shifted out before any OR happens.get_trust_scorethen extracts with& 0xFFFFFFFFfrom lanes eight bits wide, so slots overlap.Consequently
get_trust_score(array, i)never recovers a usable score.find_most_trustedreturns 3 where the test expects 1, andshould_route_via_node(arr, 0, 70)returns false where the test expects true.Note that
should_route_via_node_falseis currently a false pass - it reads garbage from an overlapping slot that happens to fall under 90.Either the array holds 8-bit score values (
create_trust_arraytakes score bytes,get_trust_scoremasks& 0xFF), or it holds fewer, wider slots. Whichever is chosen movesMAX_NODES, the shifts and the extraction masks together.3.
update_trust_score_increases- arithmetic expectation [57]. The test starts fromcreate_trust_score(5, 50, 5, 5), callsupdate_trust_score(current, 3, 1)and asserts the result is>= 60. The actual value is 57:new_positive=8,new_negative=6,calculate_trust_score(8, 6) = 800/14 = 57. Either the threshold is wrong orcalculate_trust_score's rounding is.Constraint for whoever picks this up
gen/is generated and this repository's own law forbids editing it. Editspecs/trust_manager.t27only, then regenerate.t27c's parser silently discards statements it cannot parse (
Err(_) => recover_to_stmt_boundary) and exits 0 with empty stderr - see gHashTag/t27#2508. After any spec edit, verify the counts rather than assuming: the spec must declare and the artifact must emit the same number of functions (21 and 21),rustc --crate-type lib --edition 2021on the artifact must exit 0, and because a function count cannot catch a statement dropped inside atestblock, the AST node counts must be checked too (FnDecl/TestBlock/ assertStmtExpr= 21 / 17 / 23). An unbalanced brace in particular is not reported - it deletes every function declared after it.phi^2 + phi^-2 = 3