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
omega-mv / src / omega_vcstore_priv.h
| 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef OMEGA_VCSTORE_PRIV_H |
| 18 | #define OMEGA_VCSTORE_PRIV_H |
| 19 | |
| 20 | /* PRIVATE to the Verified Crumb Store and its one admission door (VC1 stage 6, ADR 0029 |
| 21 | * Decisions 5, 7 and 8). |
| 22 | * |
| 23 | * The two raw insert functions are not in omega_vcstore.h on purpose. A record may enter a store |
| 24 | * only through omega_resolve_admit (receipt checked) or omega_resolve_admit_genesis (member of |
| 25 | * VC-GENESIS-1 only), both in omega_resolve.c. The only files that may include this header are |
| 26 | * src/omega_vcstore.c (defines them) |
| 27 | * src/omega_resolve.c (the admission door) |
| 28 | * and test code under tests/. tests/test_omega_resolve.c scans src/ and tools/ and fails if any |
| 29 | * other file includes this header or calls either function. |
| 30 | * |
| 31 | * The raw functions themselves enforce what the store can see: format, immutability, |
| 32 | * dependencies present, and (BOOTSTRAP only) membership of the semantic id in VC-GENESIS-1. They |
| 33 | * do NOT check receipts: that is the admission door's job. */ |
| 34 | |
| 35 | #include "omega_vcstore.h" |
| 36 | |
| 37 | /* Insert a Verified Crumb (admission kind VERIFIED). claimed_vc_id is required (NULL is |
| 38 | * MALFORMED, never "skip the check"). The store is unchanged on every refusal. Refusals: |
| 39 | * - NULL argument, zero length: VCSTORE_MALFORMED |
| 40 | * - any SPEC 3.6 format refusal (includes MISSING_RECEIPT for a zero receipt_id and |
| 41 | * DEPENDENCY_CYCLE for a self dependency) |
| 42 | * - SHA-256(bytes) != claimed_vc_id: VCSTORE_ID_MISMATCH |
| 43 | * - semantic_id already present with different bytes or another admission kind: |
| 44 | * VCSTORE_IMMUTABLE_CONFLICT (identical bytes and kind: success, no change) |
| 45 | * - a dependency semantic_id not in the store, or whose contract_id differs from the entry's |
| 46 | * required_contract: UNVERIFIED_DEPENDENCY |
| 47 | * - out of memory: VCSTORE_NOMEM |
| 48 | * There is no capacity limit: the store grows. */ |
| 49 | int omega_vcstore_insert(OmegaVcStore *s, const uint8_t *canonical, size_t len, |
| 50 | const uint8_t claimed_vc_id[32]); |
| 51 | |
| 52 | /* Genesis loading only. Same refusals, plus GENESIS_NOT_LISTED when the record's semantic id is |
| 53 | * not a member of VC-GENESIS-1 (src/omega_genesis.h). Admission kind BOOTSTRAP. For a bootstrap |
| 54 | * record the receipt_id field carries the hash of the audit record. */ |
| 55 | int omega_vcstore_insert_bootstrap(OmegaVcStore *s, const uint8_t *canonical, size_t len, |
| 56 | const uint8_t claimed_vc_id[32]); |
| 57 | |
| 58 | #endif /* OMEGA_VCSTORE_PRIV_H */ |