Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/authority/delegate-gate.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / authority / delegate-gate.om` 268 lines ยท 4483 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note Attenuation predicate only. A trusted authority must verify the parent and issue the child. 3 note Words 0..7: version,rights,memory,fuel,expiry,remaining-depth,reserved,reserved. 4 note Words 8..23: exact resource scope,authority root,subject,grant identities, four words each. 5 note This profile supports the same resource only. No wildcard, path or network-subnet inference. 6 7 fn capvalid p view ulong 24 to ulong 8 if ne get p 0 1 9 ret 61 10 end 11 if gt get p 5 64 12 ret 62 13 end 14 if or eq get p 4 0 or ne get p 6 0 ne get p 7 0 15 ret 62 16 end 17 for g ulong 4 18 bits = ulong 0 19 for j ulong 4 20 bits = or bits get p add 8 add mul g 4 j 21 end 22 if eq bits 0 23 ret 62 24 end 25 end 26 ret 0 27 end 28 29 fn capeq p view ulong 24 c view ulong 24 off ulong to bool 30 diff = ulong 0 31 for j ulong 4 32 at = add off j 33 diff = or diff xor get p at get c at 34 end 35 ret eq diff 0 36 end 37 38 fn capchild p view ulong 24 c view ulong 24 now ulong to ulong 39 err = capvalid p 40 if ne err 0 41 ret err 42 end 43 err = capvalid c 44 if ne err 0 45 ret err 46 end 47 if ge now get p 4 48 ret 64 49 end 50 if ge now get c 4 51 ret 65 52 end 53 if ne and get c 1 get p 1 get c 1 54 ret 66 55 end 56 if gt get c 2 get p 2 57 ret 67 58 end 59 if gt get c 3 get p 3 60 ret 68 61 end 62 if gt get c 4 get p 4 63 ret 69 64 end 65 if not capeq p c 8 66 ret 70 67 end 68 if not capeq p c 12 69 ret 71 70 end 71 if eq get p 5 0 72 ret 72 73 end 74 if ge get c 5 get p 5 75 ret 73 76 end 77 if capeq p c 16 78 ret 74 79 end 80 if capeq p c 20 81 ret 75 82 end 83 ret 0 84 end 85 note SPDX-License-Identifier: AGPL-3.0-only 86 global checks ulong 1 87 global fails ulong 1 88 global report uchar 64 89 text title "delegate checks=" 90 fn check got ulong want ulong to void 91 put checks 0 add get checks 0 1 92 if ne got want 93 put fails 0 add get fails 0 1 94 end 95 end 96 fn parent p edit ulong 24 to void 97 for i ulong 24 98 put p i 0 99 end 100 put p 0 1 101 put p 1 7 102 put p 2 1024 103 put p 3 200 104 put p 4 100 105 put p 5 4 106 for i ulong 16 107 put p add i 8 add i 100 108 end 109 end 110 fn child c edit ulong 24 to void 111 parent c 112 put c 1 3 113 put c 2 512 114 put c 3 100 115 put c 4 90 116 put c 5 3 117 put c 16 200 118 put c 20 300 119 end 120 fn summary to int 121 for i ulong len title 122 put report i get title i 123 end 124 n = get checks 0 125 at = len title 126 put report at uchar add 48 div n 100 127 put report add at 1 uchar add 48 rem div n 10 10 128 put report add at 2 uchar add 48 rem n 10 129 put report add at 3 32 130 put report add at 4 uchar add 48 div get fails 0 100 131 put report add at 5 uchar add 48 rem div get fails 0 10 10 132 put report add at 6 uchar add 48 rem get fails 0 10 133 put report add at 7 10 134 w = write 1 report 0 add at 8 135 if ne w long add at 8 136 ret 2 137 end 138 if ne get fails 0 0 139 ret 1 140 end 141 ret 0 142 end 143 fn main to int 144 p = new ulong 24 0 145 c = new ulong 24 0 146 parent p 147 child c 148 check capchild p c 50 0 149 put c 1 8 150 check capchild p c 50 66 151 child c 152 put c 2 1025 153 check capchild p c 50 67 154 child c 155 put c 3 201 156 check capchild p c 50 68 157 child c 158 put c 4 101 159 check capchild p c 50 69 160 child c 161 put c 5 4 162 check capchild p c 50 73 163 child c 164 put p 5 0 165 check capchild p c 50 72 166 parent p 167 child c 168 put c 4 50 169 check capchild p c 50 65 170 child c 171 check capchild p c 100 64 172 child c 173 put c 1 0 174 put c 2 0 175 put c 3 0 176 put c 5 0 177 check capchild p c 50 0 178 put p 1 0 179 put p 2 0 180 put p 3 0 181 check capchild p c 50 0 182 put c 1 1 183 check capchild p c 50 66 184 185 for i ulong 8 186 parent p 187 child c 188 put c add i 8 add get c add i 8 1 189 check capchild p c 50 add 70 div i 4 190 end 191 parent p 192 child c 193 for i ulong 4 194 put c add i 16 get p add i 16 195 end 196 check capchild p c 50 74 197 child c 198 for i ulong 4 199 put c add i 20 get p add i 20 200 end 201 check capchild p c 50 75 202 for group ulong 4 203 parent p 204 child c 205 for j ulong 4 206 put p add 8 add mul group 4 j 0 207 end 208 check capchild p c 50 62 209 parent p 210 for j ulong 4 211 put c add 8 add mul group 4 j 0 212 end 213 check capchild p c 50 62 214 end 215 216 parent p 217 child c 218 put p 0 2 219 check capchild p c 50 61 220 parent p 221 put c 0 2 222 check capchild p c 50 61 223 child c 224 put c 1 512 225 check capchild p c 50 66 226 child c 227 put c 6 1 228 check capchild p c 50 62 229 child c 230 put c 7 1 231 check capchild p c 50 62 232 child c 233 put c 5 `18446744073709551615` 234 check capchild p c 50 62 235 child c 236 put p 5 65 237 check capchild p c 50 62 238 parent p 239 child c 240 put p 5 1 241 put c 5 0 242 check capchild p c 50 0 243 put p 2 `18446744073709551615` 244 put c 2 `18446744073709551615` 245 check capchild p c 50 0 246 put p 2 `18446744073709551614` 247 check capchild p c 50 67 248 parent p 249 child c 250 put p 1 `9223372036854775808` 251 put c 1 `9223372036854775808` 252 check capchild p c 50 0 253 put c 1 `9223372036854775809` 254 check capchild p c 50 66 255 256 note Exhaust all subsets of the small rights profile, not only one happy case. 257 for rights ulong 32 258 parent p 259 child c 260 put c 1 rights 261 want = ulong 66 262 if lt rights 8 263 want = 0 264 end 265 check capchild p c 50 want 266 end 267 ret summary 268 end