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 / forge_realization.c
| 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 | #include "forge_realization.h" |
| 18 | #include "forge_realize.h" |
| 19 | #include <string.h> |
| 20 | |
| 21 | int omega_realization_request_init(OmegaRealizationRequest *req, |
| 22 | const uint8_t *program_digest, |
| 23 | uint32_t opcode_count, |
| 24 | const uint8_t *ir_payload, |
| 25 | size_t ir_size, |
| 26 | const ForgeMachineDescriptor *desc) { |
| 27 | if (!req || !program_digest || !desc) return -1; |
| 28 | memset(req, 0, sizeof(*req)); |
| 29 | memcpy(req->program_digest, program_digest, 32); |
| 30 | req->opcode_count = opcode_count; |
| 31 | req->ir_payload = ir_payload; |
| 32 | req->ir_size = ir_size; |
| 33 | req->machine_desc = *desc; |
| 34 | |
| 35 | return forge_descriptor_compute_digest(desc, req->descriptor_digest); |
| 36 | } |
| 37 | |
| 38 | int omega_forge_realize(const OmegaRealizationRequest *req, ForgeRealizationResult *out_res) { |
| 39 | if (!req || !out_res) return -1; |
| 40 | |
| 41 | ForgeRealizationRequest f_req; |
| 42 | memset(&f_req, 0, sizeof(f_req)); |
| 43 | memcpy(f_req.program_digest, req->program_digest, 32); |
| 44 | f_req.opcode_count = req->opcode_count; |
| 45 | f_req.ir_payload = req->ir_payload; |
| 46 | f_req.ir_size = req->ir_size; |
| 47 | f_req.target_machine = req->machine_desc; |
| 48 | memcpy(f_req.target_descriptor_digest, req->descriptor_digest, 32); |
| 49 | |
| 50 | return forge_realize(&f_req, out_res); |
| 51 | } |
| 52 | |
| 53 | int omega_forge_submit(Nvrm *rm, |
| 54 | const ForgeVerifiedRealization *verified_real, |
| 55 | const ForgeMachineDescriptor *live_desc, |
| 56 | ForgeExecutionEvidence *out_evidence) { |
| 57 | return forge_submit_realization(rm, verified_real, live_desc, out_evidence); |
| 58 | } |