Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/atoma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ jobs:
- name: Build the actual Atoma emitter
working-directory: tools/atoma
run: zig build
- name: Validate compiled models against the original source bytes
- name: Validate the source model and replay the compiled native export
run: bash scripts/atoma-translation-gate.sh
- uses: actions/upload-artifact@v7.0.2
if: always()
Expand All @@ -235,7 +235,7 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 2
steps:
- name: Require existing replay, heap pilots and byte translation validation
- name: Require existing replay, heap pilots and native byte validation
env:
CORE_RESULT: ${{ needs.core_soundness.result }}
HEAP_RESULT: ${{ needs.heap_consumers.result }}
Expand Down
53 changes: 47 additions & 6 deletions docs/decisions/ATOMA-BYTE-TRANSLATION.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,50 @@ no leading zero, and the expression parser bounds grouping and addition
chains. A renamed function and a comment-only edit qualify independently.
The comment edit requires a new receipt because its byte identity changed.

This is translation validation for each checked artifact against the
independent byte semantics. The native witness from the first beta slice
still supplies execution evidence for the pinned Zig compiler and target.
General Zig parsing, compiler and native correspondence, wider types,
imports, memory and effects remain open. Receipts remain `INCOMPLETE`.
The required workflow retains the Proven and UAA source and native campaigns.
== Native byte evidence

The x86-64 native profile reserves `_start` for the observer's Linux entry
point. A source with that export can still be checked by the source-to-model
gate. The native gate refuses it before compiling the observer.

The native gate builds the accepted source snapshot with Zig 0.15.2 for
`x86_64-linux-musl`, using baseline CPU, Debug mode, LLVM and disabled LTO.
The gate checks the translation manifest and the receipt's source and compiled
model identities before building. It finds the unique defined global function
in the ELF object and checks that a separately compiled Zig observer refers
to that symbol as an undefined external. The observer object supplies the Zig
Linux entry point. The gate links the two objects statically without libc and
checks that the executable has no ELF interpreter or shared library
dependencies. The observer calls the export through the C calling convention
and writes exactly one result byte for each input in ascending order from 0
to 255. The observer has no model or
expected values. Coq checks that the ELF symbol matches the name in the admitted
source and that the entire observed vector equals the compiled model's body.
The per-input theorem ties the vector entries to the model's body and
specification and uses the independent source interpretation theorem. The gate
audits the assumptions and runs `coqchk` on the compiled proof closure.
Before proof and during offline replay, a separate decoder restores the byte
list from the generated Coq input and checks it against the raw trace.

The required byte translation job checks `advance_five` and the separately
named `nudge_byte`. It also checks that the correct model rejects a freshly
compiled same-symbol wrong body at input 0 and a changed trace at input 255,
and that a 255-byte trace is refused before proof. Substituting a compiled Coq
model, changing even comment-only source bytes, or replacing the recorded
executable invalidates the corresponding evidence. The required workflow
retains the Proven and UAA source and native campaigns.

On x86-64 Linux with a compatible Coq kernel checker, replay an authenticated
native evidence directory downloaded from its hosted run with
`bash scripts/atoma-native-byte.sh replay PATH_TO_NATIVE_EVIDENCE`. Replay checks
the receipt and relative file digests, regenerates the Coq data input from the
raw trace, checks the compiled proof closure, and runs a copy of the archived
executable with execute permission restored. Its output must match byte for
byte. The receipt binds the build commands, tool digests, objects, executable,
raw trace and proofs. The original hosted receipt and manifest are provenance
inputs and must come from a trusted source before replay executes the binary.

The `INCOMPLETE` receipt covers one artifact and one execution profile. The
observation depends on the Zig toolchain, linker, collector, host and raw-byte
capture. Coq checks the captured data. General compiler and ABI refinement,
other targets and modes, imports, memory, effects and wider types remain open.
19 changes: 19 additions & 0 deletions examples/atoma/source-u8/native-observer.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MPL-2.0
// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
const std = @import("std");

comptime {
_ = std.start;
}

const Export = struct {
extern fn @"ATOMA_EXPORT"(input: u8) callconv(.c) u8;
};

pub fn main() !void {
var trace: [256]u8 = undefined;
for (&trace, 0..) |*result, input| {
result.* = Export.@"ATOMA_EXPORT"(@intCast(input));
}
try std.fs.File.stdout().writeAll(&trace);
}
Loading
Loading