Files
scriptc/tests/library-mode/int-trap/lib.ts
Chris Tate a2c68beadb The ask-4 conformance corpus end to end, with the sidecar attestation and inbound-trap fixtures
- tests/harness/library-int.test.ts: all 16 reference-corpus cases as library fixtures on both emissions — send/sendU64 are profile-mapped exports with i64/u64 params, PROVE cases pin every crossed value against the Node oracle (the test process runs the same case source), the counter loop crosses 0..9 in order, REFUSE cases name obligation, slot path, and evidence
- int-returns fixture: i64/u64 returns cross as real int64_t/uint64_t (9007199254740991, -0 as 0, -7 % 3 as -1, ToUint32 max on a u64 slot)
- int-trap fixture: inbound integers past 2^53-1 deliver the structured SC4012 host-contract trap with profile teaching/remediation; in-range extremes convert exactly
- Sidecar slots: integer_slots attestation in declaration order, declared slots spelled i64 (V10 bijection validated), unproven writes refused by slot path (Msg.count, helpers.clampIdx.return), unresolvable and non-number declarations refused SC4009, teachings ride SC4022 as attributed notes
- Layer-1 differential: no Layer-1 representation exists (trivially unobservable); pinned consequence — f64-declared vs i64-declared builds cross byte-identical values
- Integer-declared helpers join libRoots so their attestation covers a compiled body, never a dead-stripped vacuity
2026-07-24 11:39:43 -05:00

20 lines
620 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* Ask 4's inbound declared-integer edge: `take`'s parameter is
* profile-declared i64 (takeU's u64), so the generated wrapper
* range-checks every HOST call — a value past ±(2^53 − 1) cannot ride
* f64 exactly, and silent rounding is a coercion the author never wrote,
* so the wrapper delivers the SC4012 host-contract trap instead.
* In-range values convert exactly. */
let seen: number[] = [];
export function take(x: number): void {
seen.push(x);
}
export function takeU(x: number): void {
seen.push(x);
}
export function last(): number {
return seen.length === 0 ? -1 : seen[seen.length - 1];
}