interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / spec / searchtrace / G3_SEALED_HOLDOUT_COMMITMENT_V1.md

168 lines · 7566 bytes Raw Blame History Rendered
1# G3 Sealed-Holdout Commitment Format V1
2
3Status: format only. No training, no real held-out data. Implementation:
4`src/searchtrace/st_holdout.{h,c}`; tests: `tests/searchtrace/test_st_holdout.c`.
5
6## Purpose
7
8A held-out task set is committed to publicly before any learner runs. The
9task-set bytes and a secret 32-byte salt stay sealed. A later reveal proves
10the revealed set is byte-for-byte the committed one. The salt prevents
11brute-force confirmation of guessed task sets from the public record.
12
13## Inputs
14
15- `taskset`: opaque bytes (canonical task-set file). Only rule applied:
16 `task_count` = number of lines (LF-separated; final line may lack LF) whose
17 first five bytes are `task ` (ASCII, lowercase, one space). A task set with
18 zero such lines is refused.
19- `salt`: exactly 32 bytes, generated from a CSPRNG, kept sealed until reveal.
20- `holdout_id`: label matching `[A-Za-z0-9._-]{1,64}`.
21
22## Commitment
23
24 commitment = SHA-256( "omega.g3.holdout.commit.v1" 0x00
25 || salt[32]
26 || u64be(taskset_len)
27 || u32be(task_count)
28 || taskset )
29
30 salt_digest = SHA-256( "omega.g3.holdout.salt.v1" 0x00 || salt[32] )
31
32Choices: domain strings are NUL-terminated so no prefix ambiguity; length and
33count are fixed-width big-endian so the preimage is unambiguous; the salt
34digest is domain-separated from the commitment so it cannot be confused with
35it. Publishing `salt_digest` lets the reveal check the salt first and give a
36specific refusal; it leaks nothing useful because the salt is 256 random bits.
37
38## Record (canonical ASCII, LF only, fixed order, no trailing spaces)
39
40 OMEGA-G3-HOLDOUT-COMMIT v1
41 domain omega.g3.holdout.commit.v1
42 holdout_id <label>
43 task_count <decimal, 1..4294967295, no leading zero>
44 taskset_len <decimal, u64, no leading zero>
45 salt_digest <64 lowercase hex>
46 commitment <64 lowercase hex>
47 end <64 lowercase hex>
48
49`end` = SHA-256 of every record byte before the `end ` line (including the
50LF of the `commitment` line). The record ends with exactly one LF after the
51end hex; nothing follows. The file is content-addressed:
52`g3-commit-<sha256 of the whole record, lowercase hex>.txt`.
53
54## Parser refusals (`st_holdout_parse`)
55
56Wrong magic or version; wrong domain; missing, extra or reordered field; hex
57not 64 chars, non-hex char, uppercase hex; bad label; zero tasks; decimal with
58leading zero, non-digit or out of range; `taskset_len < 5 * task_count`
59(each counted line holds at least `task `); truncated record (no end line, or
60line without LF); end digest mismatch; trailing bytes after the end line; any
61CR byte; any NUL byte; record longer than 1024 bytes.
62
63## Reveal (`st_holdout_reveal`)
64
65Checks in order, refusing on the first failure: salt digest, task-set
66length, task count, commitment. Digest comparisons are constant-time.
67
68## Reveal receipt (`st_holdout_reveal_receipt`)
69
70 OMEGA-G3-HOLDOUT-REVEAL v1
71 domain omega.g3.holdout.commit.v1
72 holdout_id <label>
73 commitment <hex>
74 record_digest <hex: sha256 of the commitment record file>
75 task_count <n>
76 taskset_len <n>
77 repo_commit <40 lowercase hex>
78 verdict PASS
79 end <sha256 of the preceding receipt bytes>
80
81Only PASS receipts exist; a failed reveal emits no receipt (the CLI prints the
82refusal reason and exits 2). The function does not re-verify: callers must
83get 0 from `st_holdout_reveal` first (the CLI does). A repo commit that is not
84exactly 40 lowercase hex is refused. File name:
85`g3-reveal-<sha256 of the whole receipt>.txt`.
86
87## CLI (`st_holdout_cli`, argv[0] = subcommand)
88
89- `commit <holdout_id> <taskset_file> <salt_file> <out_dir>`: salt file must be
90 exactly 32 bytes; writes `<out_dir>/g3-commit-<digest>.txt`, prints the path.
91 Same bytes already present: OK (idempotent). Different bytes: refused.
92- `reveal <record_file> <taskset_file> <salt_file> <out_dir>`: needs
93 `OMEGA_REPO_COMMIT` (40 lowercase hex); verifies, writes the receipt, prints
94 the path.
95- `verify <record_file>`: parse only.
96
97Exit codes: 0 ok, 2 refusal (including I/O failure), 1 usage. Files are
98written to a temp name, fsynced, then hard-linked into place (never
99overwritten).
100
101## Known-answer vector
102
103salt = bytes 0x00..0x1f, taskset = `task alpha\ntask beta\n` (21 bytes, 2
104tasks), holdout_id = `g3-kat-1`. Computed independently with `printf` +
105`sha256sum`:
106
107- salt_digest `731be661741f6bbf7b8ed2dc8150a6a35238d7b133817bdf1347415bff4ec4a4`
108- commitment `7008574e68b49d88b0debe5101eec7823a0f11a99833cb5e6aedc9262822b20d`
109- end `f241a91082e4ee19e4612c4fb7a3c6108182449c515bee35be6797bd8ef387ee`
110- record digest `20ba763127e9ffd0b563365d1db13f7d3b813f39c9d3b215c1447a48e9f39a28`
111
112## Owner signature (detached, optional; lane 12)
113
114The commitment record above is unchanged byte for byte (the known-answer
115vector still holds). An owner signature is a separate file next to it.
116
117 signed message = "omega.g3.holdout.sig.v1" 0x00 || <whole commitment record>
118
119Pure Ed25519 (RFC 8032 section 5.1, no prehash, no context), from the in-house
120code vendored in `src/searchtrace/sig/` (copied unchanged from aienos
121`native/sig` at 913b962; see `PROVENANCE.txt`; omega does not read the aienos
122tree at build time). Verification refuses non-canonical and small-order keys
123and signatures (aienos native/sig policy).
124
125Signature record (canonical ASCII, LF only, fixed order, at most 1024 bytes):
126
127 OMEGA-G3-HOLDOUT-SIG v1
128 domain omega.g3.holdout.sig.v1
129 holdout_id <label, equal to the record's>
130 record_digest <64 lowercase hex: sha256 of the whole commitment record>
131 key_id <64 lowercase hex: sha256 of the 32-byte public key>
132 signature <128 lowercase hex>
133 end <64 lowercase hex: sha256 of every byte before "end ">
134
135File name: `g3-sig-<record_digest>.txt`, same folder as `g3-commit-<record_digest>.txt`.
136
137Strict verification (`st_holdout_verify_signed`, CLI `verify --strict`) checks
138in order and refuses on the first failure: commitment record parses (as
139above); signature present (else `EUNSIGNED`, -12); signature record canonical
140(`EFORMAT`) with matching end digest (`EDIGEST`); it names this record's
141holdout_id and record digest (`EBIND`, -13); its key_id is the given public
142key's (`EKEY`, -14); the Ed25519 signature verifies (`ESIG`, -15).
143`verify <record>` without `--strict` is unchanged (parse only, signature not
144required).
145
146CLI:
147
148- `sign <record_file> <secret_key_file> <out_dir>`: the key file must not be
149 readable by group or others; it holds the 32-byte Ed25519 seed as 32 raw
150 bytes, 64 hex digits, or Ed25519 PKCS#8 DER (as `openssl pkey -outform DER`
151 writes it). The tool never creates keys. Writes
152 `<out_dir>/g3-sig-<record_digest>.txt` (same bytes present: OK; different
153 bytes: refused).
154- `verify --strict <public_key_file> <record_file> [<sig_file>]`: public key
155 as 32 raw bytes, 64 hex digits or Ed25519 SPKI DER. Without `<sig_file>`,
156 reads `g3-sig-<record_digest>.txt` from the record's folder; missing means
157 unsigned and is refused (exit 2).
158
159Tests use only TEST keys (fixed labelled seeds, and random keys made and
160deleted by `tests/searchtrace/test_st_holdout_sig_cli.sh`; when openssl is
161installed it also checks the signatures independently). The real signature is
162made only in the offline owner key ceremony.
163
164## Out of scope
165
166Salt generation, sealed storage of the task set and salt, signing the record
167with the real owner key (the signature format and tool exist, see above),
168publishing it to a timestamped location, and any real held-out data.