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 / core / sovereign-core / om / qwen-native / flash / attest.om

161 lines · 2709 bytes Raw Blame History
1note Build-time seeded Omega attestor for Flash-Next (131 shards). Emits host bindings only after hashing each opened file and comparing stats on the same descriptor.
2note Usage: attest MODEL_DIR [START COUNT]. Without START COUNT, emits the full install.om for shards 0..131.
3global qa_path uchar 4300
4global qa_root uchar 4096
5global qa_input uchar 65536
6global qa_stat uchar 128
7global qa_before ulong 7
8global qa_info ulong 1
9text qa_declare "global qdiskpin ulong 917"
10text qa_f38 "fn qdisk38 to void"
11text qa_end "end"
12text qa_put "put qdiskpin "
13text qa_layer "/model-00"
14text qa_suffix "-of-00131.safetensors"
15fn qa_print s view uchar * to void
16for i ulong len s
17tkpc ulong get s i
18end
19end
20fn qa_num arg ulong to ulong
21b = new uchar 32 0
22n = argread arg b 0 31
23if le n 0
24exit 2
25end
26v = ulong 0
27for i ulong ulong n
28c = ulong get b i
29if or lt c 48 gt c 57
30exit 2
31end
32v = add mul v 10 sub c 48
33end
34ret v
35end
36fn qa_word off ulong to ulong
37v = ulong 0
38for i ulong 8
39v = or v shl ulong get qa_stat add i off mul i 8
40end
41ret v
42end
43fn qa_value j ulong to ulong
44if eq j 0
45ret qa_word 0
46end
47if eq j 1
48ret qa_word 8
49end
50if eq j 2
51ret qa_word 48
52end
53ret qa_word add 88 mul sub j 3 8
54end
55fn qa_cat p ulong s view uchar * to ulong
56for i ulong len s
57put qa_path add p i get s i
58end
59ret add p len s
60end
61fn qa_name j ulong to ulong
62n = get qa_info 0
63for i ulong n
64put qa_path i get qa_root i
65end
66p = qa_cat n qa_layer
67f = add j 1
68put qa_path p uchar add 48 div f 100
69put qa_path add p 1 uchar add 48 rem div f 10 10
70put qa_path add p 2 uchar add 48 rem f 10
71ret qa_cat add p 3 qa_suffix
72end
73fn qa_hash fd int to void
74hreset
75while true bound 1048577
76r = read fd qa_input 0 len qa_input
77if lt r 0
78exit 3
79end
80if eq r 0
81break
82end
83for i ulong ulong r
84if not hpush get qa_input i
85exit 3
86end
87end
88end
89if not hfinal
90exit 3
91end
92end
93fn qa_shard j ulong to void
94n = qa_name j
95fd = fopen qa_path 0 n 557056 0
96if lt fd 0
97exit 2
98end
99if ne fstat int fd qa_stat 0 128 0
100exit 3
101end
102for i ulong 7
103put qa_before i qa_value i
104end
105qa_hash int fd
106for c ulong 64
107if ne get hd c qa_expected j c
108exit 4
109end
110end
111if ne fstat int fd qa_stat 0 128 0
112exit 3
113end
114for i ulong 7
115if ne get qa_before i qa_value i
116exit 5
117end
118qa_print qa_put
119tcpu add mul j 7 i
120tkpc 32
121tcpu get qa_before i
122tkpc 10
123end
124r = fclose int fd
125if ne r 0
126exit 3
127end
128end
129fn main to int
130if and ne argcnt 2 ne argcnt 4
131ret 2
132end
133n = argread 1 qa_root 0 4095
134if le n 0
135ret 2
136end
137put qa_info 0 ulong n
138if eq argcnt 2
139qa_print qa_declare
140tkpc 10
141qa_print qa_f38
142tkpc 10
143for j ulong 131
144qa_shard j
145end
146qa_print qa_end
147tkpc 10
148tkpfl
149ret 0
150end
151start = qa_num 2
152count = qa_num 3
153if or gt start 131 gt count sub 131 start
154ret 2
155end
156for k ulong count
157qa_shard add start k
158end
159tkpfl
160ret 0
161end