aien-protocols-mv
Canonical specifications, wire protocols, and schemas for the AIEN sovereign ecosystem
Brought by drakestapleton
GitHub aien-dev/aien-protocols-mv#10 (code only)
Apply it
git checkout -b patch-deef765a6da00ad0 b50c00d737fa5c57ea7280e2aa4b0354ff166cf5 curl -fsSL https://interplane.io/drakestapleton/aien-protocols-mv/patches/deef765a6da00ad0.patch | git am
Provenance
github-import 1
aien-dev/aien-protocols-mv
10
985484968a1a36185659dd222d6fe5290cb6b939
{"kind":"github-import","owner":"aien-dev","repo":"aien-protocols-mv","number":10,"url":"https://github.com/aien-dev/aien-protocols-mv/pull/10","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:42Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/.crumb b/.crumb new file mode 100644 index 0000000..cf3f45e --- /dev/null +++ b/.crumb @@ -0,0 +1,42 @@ +{ + "schema_version": "1.0.0", + "name": "aien-protocols", + "layer": "root", + "purpose": "Repository root aien-protocols. Purpose not yet described by a human.", + "below": [ + { + "name": "crates", + "role": "" + }, + { + "name": "specs", + "role": "" + } + ], + "extensions": { + "seed": { + "purpose_auto": "Repository root aien-protocols. Purpose not yet described by a human.", + "files": [ + "ANTI_ENCLOSURE.md", + "CHANGELOG.md", + "CONSUMERS.md", + "Cargo.lock", + "Cargo.toml", + "GOVERNANCE.md", + "LICENSE-CODE", + "LICENSE-SPEC", + "NOTICES.md", + "README.md", + "SCOPE.md", + "TRADEMARKS.md", + "VERSIONING.md" + ], + "git": { + "remote": "git@github.com:aien-dev/aien-protocols.git", + "branch": "hardening/LB-trn1-transcript", + "head": "1c70ac4" + } + }, + "owner_lane": "" + } +} diff --git a/.gitignore b/.gitignore index 3a29bfb..c7e87b2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.swp *~ .DS_Store +.crumb.local diff --git a/crates/.crumb b/crates/.crumb new file mode 100644 index 0000000..18f21ab --- /dev/null +++ b/crates/.crumb @@ -0,0 +1,55 @@ +{ + "schema_version": "1.0.0", + "name": "crates", + "layer": "crates", + "purpose": "Directory crates. Purpose not yet described by a human.", + "above": { + "name": "aien-protocols", + "path": ".." + }, + "below": [ + { + "name": "aien-action-protocol", + "role": "" + }, + { + "name": "aien-agent-state-abi", + "role": "" + }, + { + "name": "aien-evaluation-protocol", + "role": "" + }, + { + "name": "aien-event-protocol", + "role": "" + }, + { + "name": "aien-inference-client", + "role": "" + }, + { + "name": "aien-inference-protocol", + "role": "" + }, + { + "name": "aien-probe", + "role": "" + }, + { + "name": "aien-protocol-types", + "role": "" + }, + { + "name": "aien-provenance", + "role": "" + } + ], + "extensions": { + "seed": { + "purpose_auto": "Directory crates. Purpose not yet described by a human.", + "files": [] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-action-protocol/.crumb b/crates/aien-action-protocol/.crumb new file mode 100644 index 0000000..5ee15ef --- /dev/null +++ b/crates/aien-action-protocol/.crumb @@ -0,0 +1,25 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-action-protocol", + "layer": "crates/aien-action-protocol", + "purpose": "Directory crates/aien-action-protocol. Purpose not yet described by a human.", + "above": { + "name": "crates", + "path": ".." + }, + "below": [ + { + "name": "src", + "role": "" + } + ], + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-action-protocol. Purpose not yet described by a human.", + "files": [ + "Cargo.toml" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-action-protocol/src/.crumb b/crates/aien-action-protocol/src/.crumb new file mode 100644 index 0000000..8c96882 --- /dev/null +++ b/crates/aien-action-protocol/src/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-action-protocol/src", + "layer": "crates/aien-action-protocol/src", + "purpose": "Directory crates/aien-action-protocol/src. Purpose not yet described by a human.", + "above": { + "name": "crates/aien-action-protocol", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-action-protocol/src. Purpose not yet described by a human.", + "files": [ + "lib.rs" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-agent-state-abi/.crumb b/crates/aien-agent-state-abi/.crumb new file mode 100644 index 0000000..9df7c3c --- /dev/null +++ b/crates/aien-agent-state-abi/.crumb @@ -0,0 +1,29 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-agent-state-abi", + "layer": "crates/aien-agent-state-abi", + "purpose": "Directory crates/aien-agent-state-abi. Purpose not yet described by a human.", + "above": { + "name": "crates", + "path": ".." + }, + "below": [ + { + "name": "src", + "role": "" + }, + { + "name": "tests", + "role": "" + } + ], + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-agent-state-abi. Purpose not yet described by a human.", + "files": [ + "Cargo.toml" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-agent-state-abi/src/.crumb b/crates/aien-agent-state-abi/src/.crumb new file mode 100644 index 0000000..9d87a2f --- /dev/null +++ b/crates/aien-agent-state-abi/src/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-agent-state-abi/src", + "layer": "crates/aien-agent-state-abi/src", + "purpose": "Directory crates/aien-agent-state-abi/src. Purpose not yet described by a human.", + "above": { + "name": "crates/aien-agent-state-abi", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-agent-state-abi/src. Purpose not yet described by a human.", + "files": [ + "lib.rs" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-agent-state-abi/tests/.crumb b/crates/aien-agent-state-abi/tests/.crumb new file mode 100644 index 0000000..b66fef2 --- /dev/null +++ b/crates/aien-agent-state-abi/tests/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-agent-state-abi/tests", + "layer": "crates/aien-agent-state-abi/tests", + "purpose": "Directory crates/aien-agent-state-abi/tests. Purpose not yet described by a human.", + "above": { + "name": "crates/aien-agent-state-abi", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-agent-state-abi/tests. Purpose not yet described by a human.", + "files": [ + "integration_tests.rs" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-evaluation-protocol/.crumb b/crates/aien-evaluation-protocol/.crumb new file mode 100644 index 0000000..4abb46f --- /dev/null +++ b/crates/aien-evaluation-protocol/.crumb @@ -0,0 +1,29 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-evaluation-protocol", + "layer": "crates/aien-evaluation-protocol", + "purpose": "Directory crates/aien-evaluation-protocol. Purpose not yet described by a human.", + "above": { + "name": "crates", + "path": ".." + }, + "below": [ + { + "name": "src", + "role": "" + }, + { + "name": "tests", + "role": "" + } + ], + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-evaluation-protocol. Purpose not yet described by a human.", + "files": [ + "Cargo.toml" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-evaluation-protocol/src/.crumb b/crates/aien-evaluation-protocol/src/.crumb new file mode 100644 index 0000000..2928c23 --- /dev/null +++ b/crates/aien-evaluation-protocol/src/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-evaluation-protocol/src", + "layer": "crates/aien-evaluation-protocol/src", + "purpose": "Directory crates/aien-evaluation-protocol/src. Purpose not yet described by a human.", + "above": { + "name": "crates/aien-evaluation-protocol", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-evaluation-protocol/src. Purpose not yet described by a human.", + "files": [ + "lib.rs" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-evaluation-protocol/tests/.crumb b/crates/aien-evaluation-protocol/tests/.crumb new file mode 100644 index 0000000..60cd78e --- /dev/null +++ b/crates/aien-evaluation-protocol/tests/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-evaluation-protocol/tests", + "layer": "crates/aien-evaluation-protocol/tests", + "purpose": "Directory crates/aien-evaluation-protocol/tests. Purpose not yet described by a human.", + "above": { + "name": "crates/aien-evaluation-protocol", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-evaluation-protocol/tests. Purpose not yet described by a human.", + "files": [ + "evaluator_protocol_tests.rs" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-event-protocol/.crumb b/crates/aien-event-protocol/.crumb new file mode 100644 index 0000000..59ce6ec --- /dev/null +++ b/crates/aien-event-protocol/.crumb @@ -0,0 +1,25 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-event-protocol", + "layer": "crates/aien-event-protocol", + "purpose": "Directory crates/aien-event-protocol. Purpose not yet described by a human.", + "above": { + "name": "crates", + "path": ".." + }, + "below": [ + { + "name": "src", + "role": "" + } + ], + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-event-protocol. Purpose not yet described by a human.", + "files": [ + "Cargo.toml" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-event-protocol/src/.crumb b/crates/aien-event-protocol/src/.crumb new file mode 100644 index 0000000..8ca3259 --- /dev/null +++ b/crates/aien-event-protocol/src/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-event-protocol/src", + "layer": "crates/aien-event-protocol/src", + "purpose": "Directory crates/aien-event-protocol/src. Purpose not yet described by a human.", + "above": { + "name": "crates/aien-event-protocol", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-event-protocol/src. Purpose not yet described by a human.", + "files": [ + "lib.rs" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-inference-client/.crumb b/crates/aien-inference-client/.crumb new file mode 100644 index 0000000..2aa9575 --- /dev/null +++ b/crates/aien-inference-client/.crumb @@ -0,0 +1,29 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-inference-client", + "layer": "crates/aien-inference-client", + "purpose": "Directory crates/aien-inference-client. Purpose not yet described by a human.", + "above": { + "name": "crates", + "path": ".." + }, + "below": [ + { + "name": "src", + "role": "" + }, + { + "name": "tests", + "role": "" + } + ], + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-inference-client. Purpose not yet described by a human.", + "files": [ + "Cargo.toml" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-inference-client/src/.crumb b/crates/aien-inference-client/src/.crumb new file mode 100644 index 0000000..a1e39c6 --- /dev/null +++ b/crates/aien-inference-client/src/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-inference-client/src", + "layer": "crates/aien-inference-client/src", + "purpose": "Directory crates/aien-inference-client/src. Purpose not yet described by a human.", + "above": { + "name": "crates/aien-inference-client", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-inference-client/src. Purpose not yet described by a human.", + "files": [ + "lib.rs" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-inference-client/tests/.crumb b/crates/aien-inference-client/tests/.crumb new file mode 100644 index 0000000..b026003 --- /dev/null +++ b/crates/aien-inference-client/tests/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-inference-client/tests", + "layer": "crates/aien-inference-client/tests", + "purpose": "Directory crates/aien-inference-client/tests. Purpose not yet described by a human.", + "above": { + "name": "crates/aien-inference-client", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-inference-client/tests. Purpose not yet described by a human.", + "files": [ + "http_client_tests.rs" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-inference-protocol/.crumb b/crates/aien-inference-protocol/.crumb new file mode 100644 index 0000000..a2917e2 --- /dev/null +++ b/crates/aien-inference-protocol/.crumb @@ -0,0 +1,25 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-inference-protocol", + "layer": "crates/aien-inference-protocol", + "purpose": "Directory crates/aien-inference-protocol. Purpose not yet described by a human.", + "above": { + "name": "crates", + "path": ".." + }, + "below": [ + { + "name": "src", + "role": "" + } + ], + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-inference-protocol. Purpose not yet described by a human.", + "files": [ + "Cargo.toml" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-inference-protocol/src/.crumb b/crates/aien-inference-protocol/src/.crumb new file mode 100644 index 0000000..e1682be --- /dev/null +++ b/crates/aien-inference-protocol/src/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-inference-protocol/src", + "layer": "crates/aien-inference-protocol/src", + "purpose": "Directory crates/aien-inference-protocol/src. Purpose not yet described by a human.", + "above": { + "name": "crates/aien-inference-protocol", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-inference-protocol/src. Purpose not yet described by a human.", + "files": [ + "lib.rs" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-probe/.crumb b/crates/aien-probe/.crumb new file mode 100644 index 0000000..51f5da1 --- /dev/null +++ b/crates/aien-probe/.crumb @@ -0,0 +1,30 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-probe", + "layer": "crates/aien-probe", + "purpose": "Directory crates/aien-probe. Purpose not yet described by a human.", + "above": { + "name": "crates", + "path": ".." + }, + "below": [ + { + "name": "src", + "role": "" + }, + { + "name": "tests", + "role": "" + } + ], + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-probe. Purpose not yet described by a human.", + "files": [ + "Cargo.toml", + "README.md" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-probe/src/.crumb b/crates/aien-probe/src/.crumb new file mode 100644 index 0000000..c3ae23a --- /dev/null +++ b/crates/aien-probe/src/.crumb @@ -0,0 +1,22 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-probe/src", + "layer": "crates/aien-probe/src", + "purpose": "Directory crates/aien-probe/src. Purpose not yet described by a human.", + "above": { + "name": "crates/aien-probe", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-probe/src. Purpose not yet described by a human.", + "files": [ + "backend.rs", + "evaluator.rs", + "lib.rs", + "math.rs" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-probe/tests/.crumb b/crates/aien-probe/tests/.crumb new file mode 100644 index 0000000..a0a25dc --- /dev/null +++ b/crates/aien-probe/tests/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-probe/tests", + "layer": "crates/aien-probe/tests", + "purpose": "Directory crates/aien-probe/tests. Purpose not yet described by a human.", + "above": { + "name": "crates/aien-probe", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-probe/tests. Purpose not yet described by a human.", + "files": [ + "probe_engine_tests.rs" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-protocol-types/.crumb b/crates/aien-protocol-types/.crumb new file mode 100644 index 0000000..437e203 --- /dev/null +++ b/crates/aien-protocol-types/.crumb @@ -0,0 +1,25 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-protocol-types", + "layer": "crates/aien-protocol-types", + "purpose": "Directory crates/aien-protocol-types. Purpose not yet described by a human.", + "above": { + "name": "crates", + "path": ".." + }, + "below": [ + { + "name": "src", + "role": "" + } + ], + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-protocol-types. Purpose not yet described by a human.", + "files": [ + "Cargo.toml" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-protocol-types/src/.crumb b/crates/aien-protocol-types/src/.crumb new file mode 100644 index 0000000..395b0d7 --- /dev/null +++ b/crates/aien-protocol-types/src/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-protocol-types/src", + "layer": "crates/aien-protocol-types/src", + "purpose": "Directory crates/aien-protocol-types/src. Purpose not yet described by a human.", + "above": { + "name": "crates/aien-protocol-types", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-protocol-types/src. Purpose not yet described by a human.", + "files": [ + "lib.rs" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-provenance/.crumb b/crates/aien-provenance/.crumb new file mode 100644 index 0000000..b5cdd5c --- /dev/null +++ b/crates/aien-provenance/.crumb @@ -0,0 +1,25 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-provenance", + "layer": "crates/aien-provenance", + "purpose": "Directory crates/aien-provenance. Purpose not yet described by a human.", + "above": { + "name": "crates", + "path": ".." + }, + "below": [ + { + "name": "src", + "role": "" + } + ], + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-provenance. Purpose not yet described by a human.", + "files": [ + "Cargo.toml" + ] + }, + "owner_lane": "" + } +} diff --git a/crates/aien-provenance/src/.crumb b/crates/aien-provenance/src/.crumb new file mode 100644 index 0000000..102d3c2 --- /dev/null +++ b/crates/aien-provenance/src/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "crates/aien-provenance/src", + "layer": "crates/aien-provenance/src", + "purpose": "Directory crates/aien-provenance/src. Purpose not yet described by a human.", + "above": { + "name": "crates/aien-provenance", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory crates/aien-provenance/src. Purpose not yet described by a human.", + "files": [ + "lib.rs" + ] + }, + "owner_lane": "" + } +} diff --git a/specs/.crumb b/specs/.crumb new file mode 100644 index 0000000..c0d3af2 --- /dev/null +++ b/specs/.crumb @@ -0,0 +1,39 @@ +{ + "schema_version": "1.0.0", + "name": "specs", + "layer": "specs", + "purpose": "Directory specs. Purpose not yet described by a human.", + "above": { + "name": "aien-protocols", + "path": ".." + }, + "below": [ + { + "name": "agent-state", + "role": "" + }, + { + "name": "crumb-visible", + "role": "" + }, + { + "name": "evaluation", + "role": "" + }, + { + "name": "execution-transcript", + "role": "" + }, + { + "name": "inference", + "role": "" + } + ], + "extensions": { + "seed": { + "purpose_auto": "Directory specs. Purpose not yet described by a human.", + "files": [] + }, + "owner_lane": "" + } +} diff --git a/specs/agent-state/.crumb b/specs/agent-state/.crumb new file mode 100644 index 0000000..77f38ba --- /dev/null +++ b/specs/agent-state/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "specs/agent-state", + "layer": "specs/agent-state", + "purpose": "Directory specs/agent-state. Purpose not yet described by a human.", + "above": { + "name": "specs", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory specs/agent-state. Purpose not yet described by a human.", + "files": [ + "SPEC.md" + ] + }, + "owner_lane": "" + } +} diff --git a/specs/crumb-visible/.crumb b/specs/crumb-visible/.crumb new file mode 100644 index 0000000..26d4d27 --- /dev/null +++ b/specs/crumb-visible/.crumb @@ -0,0 +1,29 @@ +{ + "schema_version": "1.0.0", + "name": "specs/crumb-visible", + "layer": "specs/crumb-visible", + "purpose": "Directory specs/crumb-visible. Purpose not yet described by a human.", + "above": { + "name": "specs", + "path": ".." + }, + "below": [ + { + "name": "tools", + "role": "" + }, + { + "name": "vectors", + "role": "" + } + ], + "extensions": { + "seed": { + "purpose_auto": "Directory specs/crumb-visible. Purpose not yet described by a human.", + "files": [ + "CRUMB_READER_CONTRACT.md" + ] + }, + "owner_lane": "" + } +} diff --git a/specs/crumb-visible/tools/.crumb b/specs/crumb-visible/tools/.crumb new file mode 100644 index 0000000..7142fd4 --- /dev/null +++ b/specs/crumb-visible/tools/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "specs/crumb-visible/tools", + "layer": "specs/crumb-visible/tools", + "purpose": "Directory specs/crumb-visible/tools. Purpose not yet described by a human.", + "above": { + "name": "specs/crumb-visible", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory specs/crumb-visible/tools. Purpose not yet described by a human.", + "files": [ + "make-vectors.sh" + ] + }, + "owner_lane": "" + } +} diff --git a/specs/crumb-visible/vectors/.crumb b/specs/crumb-visible/vectors/.crumb new file mode 100644 index 0000000..f78dd66 --- /dev/null +++ b/specs/crumb-visible/vectors/.crumb @@ -0,0 +1,68 @@ +{ + "schema_version": "1.0.0", + "name": "specs/crumb-visible/vectors", + "layer": "specs/crumb-visible/vectors", + "purpose": "Directory specs/crumb-visible/vectors. Purpose not yet described by a human.", + "above": { + "name": "specs/crumb-visible", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory specs/crumb-visible/vectors. Purpose not yet described by a human.", + "files": [ + "expected.txt", + "p001.crb", + "p002.crb", + "p003.crb", + "p004.crb", + "p005.crb", + "r001.crb", + "r002.crb", + "r003.crb", + "r004.crb", + "r005.crb", + "r006.crb", + "r007.crb", + "r008.crb", + "r009.crb", + "r010.crb", + "r011.crb", + "r012.crb", + "r013.crb", + "r014.crb", + "r015.crb", + "r016.crb", + "r017.crb", + "r018.crb", + "r019.crb", + "r020.crb", + "r021.crb", + "r022.crb", + "r023.crb", + "r024.crb", + "r025.crb", + "r026.crb", + "r027.crb", + "r028.crb", + "r029.crb", + "r030.crb", + "r031.crb", + "r032.crb", + "r033.crb", + "r034.crb", + "r035.crb", + "r036.crb", + "r037.crb", + "r038.crb", + "r039.crb", + "r040.crb", + "r041.crb", + "r042.crb", + "r043.crb", + "r044.crb" + ] + }, + "owner_lane": "" + } +} diff --git a/specs/evaluation/.crumb b/specs/evaluation/.crumb new file mode 100644 index 0000000..330deae --- /dev/null +++ b/specs/evaluation/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "specs/evaluation", + "layer": "specs/evaluation", + "purpose": "Directory specs/evaluation. Purpose not yet described by a human.", + "above": { + "name": "specs", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory specs/evaluation. Purpose not yet described by a human.", + "files": [ + "SPEC.md" + ] + }, + "owner_lane": "" + } +} diff --git a/specs/execution-transcript/.crumb b/specs/execution-transcript/.crumb new file mode 100644 index 0000000..8ad89b8 --- /dev/null +++ b/specs/execution-transcript/.crumb @@ -0,0 +1,29 @@ +{ + "schema_version": "1.0.0", + "name": "specs/execution-transcript", + "layer": "specs/execution-transcript", + "purpose": "Directory specs/execution-transcript. Purpose not yet described by a human.", + "above": { + "name": "specs", + "path": ".." + }, + "below": [ + { + "name": "tools", + "role": "" + }, + { + "name": "vectors", + "role": "" + } + ], + "extensions": { + "seed": { + "purpose_auto": "Directory specs/execution-transcript. Purpose not yet described by a human.", + "files": [ + "TRN1_TRANSCRIPT_SPEC.md" + ] + }, + "owner_lane": "" + } +} diff --git a/specs/execution-transcript/TRN1_TRANSCRIPT_SPEC.md b/specs/execution-transcript/TRN1_TRANSCRIPT_SPEC.md new file mode 100644 index 0000000..ee92bfa --- /dev/null +++ b/specs/execution-transcript/TRN1_TRANSCRIPT_SPEC.md @@ -0,0 +1,348 @@ +# Execution Transcript: TRN1 + +**Status**: Draft v0 (hardening lane LB, 2026-10-01). Not yet produced by any runtime. +**Contract version**: 0.1.0 (major zero: may change by minor bump, see VERSIONING.md) +**Wire schema version**: 1 (the `schema` field below) +**License**: Community Specification License 1.0 +**Reference verifier**: [`tools/trn1_verify.c`](tools/trn1_verify.c), C99, self-contained (own SHA-256, libc only) +**Planned implementations**: omega `tools/replay` (C verifier and replayer, lane LD); sovereign-core `crates/aien-replay` (Rust reader, lane LE) +**Conformance corpus**: [`vectors/`](vectors/) with [`vectors/expected.txt`](vectors/expected.txt) and [`vectors/compare.txt`](vectors/compare.txt) + +## 1. Purpose + +A run of an AIEN system makes choices that are not fixed by its inputs: which +reaction the scheduler wakes next, which branch id it hands out, which random +seed it draws, what an outside source sent, which capability generation was +current. A TRN1 transcript writes those choices down, in order, so that: + +1. a **verifier** can tell, from the bytes alone, whether a transcript is + complete and undamaged (nothing dropped, reordered, flipped or cut off); +2. a **replayer** can run the same program again, feed it the recorded + choices, write a second transcript, and **compare** the two record by + record, reporting `MATCH through N` or the first divergence. + +The transcript is the byte format and the outcomes, never a language type. +No C struct, Rust enum or serialization crosses it. + +What is deliberately **not** in the compared part of a transcript: wall-clock +times, worker or core placement, and anything else that may differ between +two correct runs of the same history. Those may be kept as *annotations* +(section 4.3), which are integrity-protected but never compared. + +## 2. Verifier and comparison interface + +A verifier is a pure function of one read-only byte buffer. It returns +exactly one of: + +- **accept**, with the record count, the run id and the final chain digest + (section 7), or +- **refuse**, with one refusal code (section 6) and the 1-based position of + the record where the first failing check fired (0 = the file header). + +A comparison takes two buffers, *expected* (the recorded run) and *actual* +(the replay), verifies both, and returns one line (section 8). + +Neither performs I/O beyond reading its input, reads clocks, or uses +randomness that can change the outcome. + +## 3. File header (48 bytes) + +All integers are unsigned little-endian unless marked signed (two's +complement). Offsets are from the start of the buffer. + +| Offset | Size | Field | Valid values | +|---|---|---|---| +| 0 | 4 | magic | ASCII `TRN1` (`54 52 4E 31`) | +| 4 | 2 | schema | `1` | +| 6 | 2 | flags | `0` (no flags defined) | +| 8 | 32 | run_id | opaque; the root causal id of this run (plan item P5). Any value. | +| 40 | 2 | producer | subsystem id (section 5.2) of the writer; not 0 | +| 42 | 6 | reserved | all zero | + +The **header digest** is SHA-256 over these 48 bytes. It is the `prev` value +of record 1. + +## 4. Records + +### 4.1 Record layout + +After the header come one or more records, back to back. The last record is +always `END` (type `0xFFFF`), and nothing follows it. + +| Offset | Size | Field | Rule | +|---|---|---|---| +| 0 | 2 | type | a known record type (section 5.1) | +| 2 | 2 | subsystem | a known subsystem id (section 5.2); 0 on `END` and only on `END` | +| 4 | 4 | ident_len | identity length, at most 65536, exact per type | +| 8 | 4 | annot_len | annotation length, at most 65536; 0 on `END` | +| 12 | 4 | reserved | zero | +| 16 | 8 | seq | position of this record, 1-based, dense: record k has seq k | +| 24 | 32 | prev | record digest of record k-1, or the header digest for k = 1 | +| 56 | ident_len | identity | type-specific, compared on replay (section 5.1) | +| 56 + ident_len | annot_len | annotation | opaque, chained, never compared | + +### 4.2 Two digests per record + +- **Record digest** = SHA-256 over the whole record, bytes 0 through the end + of the annotation. It goes into the next record's `prev`, so the records + form a hash chain anchored on the header. The record digest of `END` is the + **final digest** of the transcript; publishing it (for example in a + receipt) pins the whole file. +- **Compared digest** = SHA-256 over + `"AIEN_TRN1_CMP"` (13 ASCII bytes) `|| type (2) || subsystem (2) || seq (8) || ident_len (4) || identity`, + all integers little-endian. Comparison (section 8) uses only this. It leaves + out `prev`, the annotation and the header, so two runs of the same history + with different run ids, timings or worker placement compare equal. + +### 4.3 Identity versus annotation + +Everything that a correct replay must reproduce goes in the identity. +Everything that may legitimately differ between two correct runs goes in the +annotation. Writers must not put a wall-clock value in an identity unless the +program's behaviour depended on it, and then it is a `CLOCK_READ` record. + +## 5. Registries + +### 5.1 Record types + +`ident` lengths are exact unless stated. "digest" fields are 32 bytes. +Fields named `reserved` must be zero (NONCANONICAL otherwise). + +| Type | Name | ident_len | Identity fields in order | +|---|---|---|---| +| 1 | SCHED_DECISION | 32 | decision u64 (logical step), chosen u64 (task or reaction id), wake_cause u64, coalesced u64 | +| 2 | BRANCH_CREATE | 24 | branch u64 (logical id), parent u64 (0 = root), generation u64 | +| 3 | BRANCH_DESTROY | 24 | branch u64, generation u64, reason i32, reserved u32 | +| 4 | RNG_SEED | 40 | stream u64, seed[32] | +| 5 | RNG_DRAW | 24 | stream u64, index u64, value u64 | +| 6 | ARTIFACT_DIGEST | 48 | kind u32, reserved u32, artifact u64, digest | +| 7 | CAP_TRANSITION | 32 | cap_id u32, op u8 (1 MINT, 2 ATTENUATE, 3 TRANSFER, 4 REVOKE, 5 RECLAIM, 6 EPOCH; else SHAPE), reserved[3], generation_before u64, generation_after u64, principal u32, issuer u32 | +| 8 | CORTEX_READ | 56 | object u32, object_generation u32, version u64, mask u64, value digest | +| 9 | EFFECT_INTENT | 56 | effect u64, effect_class u32, cap_id u32, cap_generation u64, request digest | +| 10 | EFFECT_COMMIT | 48 | effect u64, outcome i32, reserved u32, result digest | +| 11 | EXTERNAL_INPUT | 48 to 4144 | source u32, reserved u32, input_seq u64, content digest, content (0 to 4096 bytes). When content is present its SHA-256 must equal the digest (DIGEST otherwise); when absent the content is stored elsewhere and only the digest is pinned. | +| 12 | CLOCK_READ | 16 | clock u32, reserved u32, value u64. Only for reads the program's behaviour depended on. | +| 13 | CRASH_BOUNDARY | 48 | epoch u64, last_durable_seq u64 (must be below this record's seq, SHAPE otherwise), recovered state digest | +| 14 | CHECKPOINT | 40 | scope u32, reserved u32, subsystem state digest | +| 15 | RX_CRUMB | 32 + n | crumb digest, then the canonical crumb bytes (section 5.3) | +| 16 | ARGUS_EVENT | 200 | event[128], chained u8 (0 or 1, SHAPE otherwise), reserved[7], chain_before digest, chain_after digest (section 5.4) | +| 0xFFFF | END | 16 | record_count u64 (must equal this record's seq, GAP otherwise), reserved u64 | + +### 5.2 Subsystems + +| Id | Name | Id | Name | +|---|---|---|---| +| 0 | transcript (END only) | 6 | aienos-store | +| 1 | omega-world | 7 | sovcore-runtime | +| 2 | omega-cortex | 8 | sovcore-scheduler | +| 3 | omega-jspace | 9 | sovcore-kv | +| 4 | aienos-kernel | 10 | external | +| 5 | aienos-argus | | | + +The name column is the text printed in a DIVERGENCE line. + +### 5.3 RX_CRUMB: carrying an Omega RxCrumb without loss + +Source of truth: omega `src/runtime/rx_world.h` (`RxCrumb`) and +`src/runtime/rx_world.c` (`crumb_hash`), checked at omega main `9ca297c`. +Omega computes a crumb's digest as SHA-256 over the ASCII tag +`AIEN_RX_CAUSAL_V1` (17 bytes) followed by these little-endian fields; the +**canonical crumb bytes** in a TRN1 record are exactly those fields, without +the tag: + +| Field | Size | +|---|---| +| id | u64 | +| kind | u32 (`RxCrumbKind`; not range-checked here, so new kinds pass) | +| reaction | u32 (`UINT32_MAX` for external or create) | +| faculty | u32 | +| wake_cause | u64 | +| coalesced_wakes | u64 | +| n_inputs, then n_inputs times (obj id u32, obj generation u32, version u64, mask u64) | u32 + 24 each, n_inputs at most 8 | +| n_caps, then n_caps times (cap_id u32, generation u64, issuer u32) | u32 + 16 each, at most 8 | +| n_outputs, then n_outputs times (obj id u32, obj generation u32, version u64, mask u64) | u32 + 24 each, at most 8 | +| reason | i32 | +| n_parents, then n_parents times (parent u64, then the parent's 32-byte digest **only if 1 <= parent < id**) | u32 + 8 or 40 each, at most 65 | + +The bytes must parse to exactly their length (SHAPE otherwise), and the +first 32 bytes of the identity must equal +SHA-256(`AIEN_RX_CAUSAL_V1` || canonical bytes) (DIGEST otherwise). Limits 8, +8, 8 and 65 are omega's `RX_MAX_DEPS`, `RX_MAX_CAPS`, `RX_MAX_WRITES` and +`RX_MAX_PARENTS` (= 8 * 8 + 1). + +The fields omega keeps but does not hash (`worker`, `t_start_ns`, `t_end_ns`, +`episode`) are not identity. A writer that wants them kept puts them in the +annotation as `worker u32, t_start_ns u64, t_end_ns u64, episode u64` +(28 bytes); the corpus does this. With that annotation every `RxCrumb` field +is carried, and the omega digest is carried and rechecked unchanged: the +conversion is lossless and needs no omega code. Omega's rule "a parent +digest is hashed only when the parent precedes the child" is reproduced by +the `1 <= parent < id` rule above (vector `p002` exercises parents 0 and +parents at or above the crumb id). + +### 5.4 ARGUS_EVENT: carrying the AIENOS ARGUS chain without loss + +Source of truth: aienos `native/argus/argus_abi.h` and `argus_event.c` +(`encode_raw`, `argus_chain_extend`), and `argus_core.c` (chain starts from +32 zero bytes; malformed events are recorded but not chained), checked at +aienos main `33927b1`. + +- `event` is the 128-byte ARGUS wire encoding exactly as `argus_event_encode` + writes it (ABI version 1). TRN1 does not validate ARGUS semantics; that is + the ARGUS decoder's job. +- `chained = 1`: `chain_after` must equal SHA-256(`chain_before` || `event`), + which is what `argus_chain_extend` computes. `chained = 0`: `chain_after` + must equal `chain_before`. +- Continuity: inside one transcript, each ARGUS_EVENT's `chain_before` must + equal the previous ARGUS_EVENT's `chain_after`. The first ARGUS_EVENT may + start from any value (all zeros for a stream that starts at boot), so a + transcript can begin in the middle of a run. Failures are DIGEST. + +The ARGUS `tick` field is the authority's logical clock, not a wall clock, +and stays in the identity. + +## 6. Refusal codes + +Zero means accept. A refusal is a negative integer from this table, and only +from this table. + +| Code | Name | Meaning | +|---|---|---| +| -1 | MAGIC | first four bytes are not `TRN1` | +| -2 | VERSION | schema is not 1 (unknown version, older or newer) | +| -3 | LENGTH | buffer ends inside the header or a record; a length above its limit; bytes after END | +| -4 | NONCANONICAL | a flag or reserved field is not zero | +| -5 | UNKNOWN | unknown record type, unknown subsystem, or producer 0 or unknown | +| -6 | SHAPE | identity length wrong for its type; a field outside its valid set; END subsystem or annotation rule broken; malformed crumb bytes | +| -7 | GAP | a record's seq is not its position (omission, reorder, duplicate) or END's record_count differs from its seq | +| -8 | CHAIN | a record's prev is not the digest of what precedes it (bit flip, splice) | +| -9 | DIGEST | an embedded digest does not match: crumb digest, external input content, ARGUS chain link or continuity | +| -10 | TRUNCATED | the buffer ends cleanly after a record that is not END | + +## 7. Check order (determines the code) + +A verifier refuses with the code of the **first** failing check, in this +order. "event" is the position k of the record being checked (0 = header). + +Header: + +1. Fewer than 4 bytes: LENGTH. Magic not `TRN1`: MAGIC. +2. Fewer than 6 bytes: LENGTH. schema not 1: VERSION. +3. Fewer than 48 bytes: LENGTH. flags not 0: NONCANONICAL. +4. producer 0 or unknown: UNKNOWN. +5. reserved not zero: NONCANONICAL. + +Then for record k = 1, 2, ...: + +1. Buffer ends exactly here: TRUNCATED. Fewer than 56 bytes left, or k above 4096: LENGTH. +2. type unknown: UNKNOWN. subsystem unknown: UNKNOWN. +3. reserved not zero: NONCANONICAL. +4. ident_len or annot_len above 65536: LENGTH. +5. seq not k: GAP. +6. prev not the previous digest: CHAIN. +7. identity plus annotation not fully present: LENGTH. +8. Shape, in this order: ident_len rule for the type; END-and-only-END has + subsystem 0; CAP_TRANSITION op; CRASH_BOUNDARY last_durable_seq < k; + RX_CRUMB canonical bytes; ARGUS_EVENT chained flag; END annot_len 0. + Any failure: SHAPE. +9. Reserved fields inside the identity: NONCANONICAL. +10. Embedded digests: RX_CRUMB digest, EXTERNAL_INPUT content, ARGUS + continuity then ARGUS link. Any failure: DIGEST. +11. If END: record_count not k: GAP. Bytes remain after END: LENGTH with + event k + 1. Otherwise accept. + +The 4096-record cap is a limit of this v0 reference verifier and corpus, not +a property of the format; a later contract version may lift it. + +## 8. Outcome lines and comparison + +Every outcome is one canonical text line, which is also the corpus manifest +format. + +Verify: + +```text +ok records=N run=<run_id, 64 hex> final=<final digest, 64 hex> +refuse CODE event=K +``` + +Compare (expected first, actual second): both are verified first. If one is +refused the line is `refuse expected CODE event=K` or +`refuse actual CODE event=K` (expected checked first). Otherwise the +compared digests (section 4.2) are compared position by position from 1: + +```text +MATCH through N +DIVERGENCE event=K expected=<compared digest, 64 hex> actual=<compared digest, 64 hex> subsystem=<name> +``` + +`subsystem` names the expected record's subsystem (section 5.2). Because +every transcript ends with END, whose identity holds the record count, two +transcripts of different length always diverge at or before the shorter +one's END; `MATCH through N` therefore means both have exactly N records with +equal identities. + +What a chain does and does not prove: the chain catches accidental damage +and naive tampering in one file. A writer that drops a record and then +renumbers and rechains produces a transcript that verifies (corpus `f001`). +That is caught only by comparison with a replay, or by checking the final +digest against an independently stored copy. Consumers must not treat +"verifies" as "is the history that happened". + +## 9. Conformance corpus + +`vectors/expected.txt` lists every transcript as `<file> <verify line>`; +`vectors/compare.txt` lists pairs as `<expected> <actual> <compare line>`. +Lines starting with `#` are comments. Plain text, so C, shell, Rust and +Omega harnesses can read them without a JSON parser. + +| Group | Files | What it shows | +|---|---|---| +| Golden | `g001` .. `g005` | g001 an Omega World run (two real RxCrumbs, effect intent and commit); g002 an ARGUS stream (two chained events, one unchained); g003 every other record type, including a crash boundary; g004 END only; g005 a replay of g001 with a different run id, workers and timings, which MATCHes g001 | +| Edge positives | `p001`, `p002` | 4096-byte external input with a large annotation; a crumb at omega's 8/8/8 limits with digest-less parents | +| Forged replays | `f001` .. `f006` | valid chains with a different history: omission, reorder, changed seed, changed capability generation inside a crumb, extra record, early stop. Each verifies alone and DIVERGEs from g001 at the named record | +| Byte damage | `m001` .. `m018` | g001 damaged after writing: omission, reorder, bit flips (identity, annotation, prev, seq, run id, magic, crumb bytes, END), truncation (header, mid record, inside END, at a record boundary), empty file, trailing byte, duplicate | +| Built refusals | `m020` .. `m065` | rechained so only the named check can fire: unknown versions (2 and 0), flags, producer, reserved fields, unknown type and subsystem, check order cases, oversize identity, every SHAPE rule, every DIGEST rule including an omitted ARGUS event the writer rechained | + +Regenerate with `tools/make-corpus.sh vectors`. The generator is shell plus +coreutils (`sha256sum`, `od`, `sed`) and builds every byte from the tables +above; it never calls the verifier. `tools/check-corpus.sh` regenerates the +corpus into a temporary directory and requires it byte-identical to +`vectors/`, then builds the reference verifier (warnings as errors, and an +ASan/UBSan build when available) and checks every line. +`tools/mutate-verifier.sh` builds one verifier per check with that check +disabled and requires the corpus to catch each one (no survivors). + +A conforming harness prints one summary line: + +```text +TRN1_CONFORMANCE impl=<c|rust|osc|...> pass=N fail=0 +``` + +## 10. Versioning + +- Wire schema 1 is the only accepted schema. A verifier refuses every other + schema value with VERSION; it never reinterprets an older or newer file. +- While the contract is 0.Y.Z, a new record type, subsystem or field is a + minor version with new vectors; existing vectors keep their outcomes or the + change is recorded as breaking in CHANGELOG.md. +- Adding vectors the reference already decides is a patch version. + Changing a refusal code or the check order is a breaking change. +- No feature negotiation: one schema, checked exactly. A writer that needs a + record this spec lacks proposes it here first; it does not invent a type + number. + +## 11. Limits of v0 (stated, not hidden) + +- No runtime writes TRN1 yet. RX_CRUMB and ARGUS_EVENT layouts were checked + against the live omega and aienos sources named above, and a host-only + scratch check fed the corpus bytes to those sources' hash functions + (recorded in the lane LB report, not part of CI). +- Batch composition, KV page ownership and sampler state for an inference + runtime have no record type yet; they wait for an inference runtime that + exists (sovereign-core is scaffolding, omega has none). +- Cross-record checks beyond ARGUS continuity are left to replayers: a + crumb's parent digest is not checked against an earlier RX_CRUMB record in + the same file, and effect commits are not matched to intents. +- No signature over the final digest. Anchoring the final digest in a signed + receipt belongs to the receipt format, not to TRN1. diff --git a/specs/execution-transcript/tools/.crumb b/specs/execution-transcript/tools/.crumb new file mode 100644 index 0000000..f5d739a --- /dev/null +++ b/specs/execution-transcript/tools/.crumb @@ -0,0 +1,22 @@ +{ + "schema_version": "1.0.0", + "name": "specs/execution-transcript/tools", + "layer": "specs/execution-transcript/tools", + "purpose": "Directory specs/execution-transcript/tools. Purpose not yet described by a human.", + "above": { + "name": "specs/execution-transcript", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory specs/execution-transcript/tools. Purpose not yet described by a human.", + "files": [ + "check-corpus.sh", + "make-corpus.sh", + "mutate-verifier.sh", + "trn1_verify.c" + ] + }, + "owner_lane": "" + } +} diff --git a/specs/execution-transcript/tools/check-corpus.sh b/specs/execution-transcript/tools/check-corpus.sh new file mode 100755 index 0000000..0997e39 --- /dev/null +++ b/specs/execution-transcript/tools/check-corpus.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# check-corpus.sh: build the C reference verifier and check the TRN1 corpus. +# +# Usage: check-corpus.sh [CC] (default CC: cc) +# +# 1. Regenerates the corpus into a temporary directory with make-corpus.sh +# and requires it to be byte-identical to vectors/, .gitattributes included +# (a stale or hand-edited corpus fails here). +# 2. Builds trn1_verify.c with warnings as errors, plus an ASan/UBSan build +# when the compiler supports it. +# 3. Runs every expected.txt and compare.txt line; prints +# TRN1_CONFORMANCE impl=c pass=N fail=M and exits non-zero on any miss. +# Host-only check: no hardware, no QEMU. Shell and C only. +set -eu +export LC_ALL=C +here=$(cd "$(dirname "$0")" && pwd) +vec="$here/../vectors" +CC=${1:-cc} +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT + +bash "$here/make-corpus.sh" "$tmp/regen" >/dev/null +# The comparison is the whole directory, byte for byte, including +# vectors/.gitattributes (make-corpus.sh emits it). Before trusting it, prove +# it catches drift on a copy of the regenerated corpus (counterexamples): +# a) one bit flipped in one vector must differ; +# b) a vector missing must differ; +# c) the line-ending pin (.gitattributes) removed must differ. +first=$(ls "$tmp/regen"/*.trn | head -n 1) +test -s "$first" || { echo "TRN1_CORPUS_SELFTEST: no non-empty vector to alter" >&2; exit 2; } +for cx in flip drop attr; do + rm -rf "$tmp/cx" && cp -r "$tmp/regen" "$tmp/cx" + f="$tmp/cx/$(basename "$first")" + case $cx in + flip) b=$(od -An -N1 -tu1 "$f" | tr -d ' ') + printf "\\$(printf '%03o' $((b ^ 1)))" | dd of="$f" bs=1 seek=0 count=1 conv=notrunc 2>/dev/null ;; + drop) rm -f "$f" ;; + attr) rm -f "$tmp/cx/.gitattributes" ;; + esac + if diff -r "$tmp/cx" "$tmp/regen" >/dev/null; then + echo "TRN1_CORPUS_SELFTEST: counterexample '$cx' not detected" >&2 + exit 2 + fi +done +echo "TRN1_CORPUS_SELFTEST counterexamples=3 detected=3" +if ! diff -r "$vec" "$tmp/regen" >/dev/null; then + echo "TRN1_CORPUS_STALE: vectors/ differs from make-corpus.sh output" >&2 + diff -rq "$vec" "$tmp/regen" >&2 || true + exit 1 +fi +echo "TRN1_CORPUS_REGEN identical" + +"$CC" -std=c99 -O2 -Wall -Wextra -Werror -o "$tmp/trn1_verify" "$here/trn1_verify.c" +"$tmp/trn1_verify" --corpus "$vec" + +if "$CC" -std=c99 -O1 -g -fsanitize=address,undefined -fno-sanitize-recover=all \ + -o "$tmp/trn1_verify_san" "$here/trn1_verify.c" 2>/dev/null; then + "$tmp/trn1_verify_san" --corpus "$vec" | sed 's/^TRN1_CONFORMANCE impl=c/TRN1_CONFORMANCE impl=c-asan-ubsan/' + test "${PIPESTATUS[0]}" -eq 0 +else + echo "TRN1_SANITIZER NOT_RUN (compiler lacks -fsanitize=address,undefined)" +fi diff --git a/specs/execution-transcript/tools/make-corpus.sh b/specs/execution-transcript/tools/make-corpus.sh new file mode 100755 index 0000000..a64f616 --- /dev/null +++ b/specs/execution-transcript/tools/make-corpus.sh @@ -0,0 +1,414 @@ +#!/bin/bash +# make-corpus.sh: regenerate the TRN1 (execution transcript, wire schema 1) +# shared conformance corpus. Language-neutral spec: ../TRN1_TRANSCRIPT_SPEC.md. +# +# Usage: make-corpus.sh OUT_DIR (normally specs/execution-transcript/vectors) +# +# Every vector is built byte by byte here from the spec tables, with digests +# from coreutils sha256sum. Nothing is produced by the C reference verifier, +# so the corpus and the verifier are two independent readings of the spec; +# tools/check-corpus.sh makes them agree. +# +# Groups (all listed in OUT_DIR/expected.txt, pairs in OUT_DIR/compare.txt): +# gNNN.trn golden transcripts (accepted) +# pNNN.trn edge positives (accepted) +# fNNN.trn forged replays: valid chain, different history (accepted alone, +# DIVERGENCE when compared with their golden) +# mNNN.trn mutated transcripts (refused with a named code and event) +# Shell only: no Python, no tools beyond coreutils. +set -eu +export LC_ALL=C +OUT=${1:?OUT_DIR} +mkdir -p "$OUT" +rm -f "$OUT"/*.trn "$OUT"/expected.txt "$OUT"/compare.txt "$OUT"/.gitattributes +# Vectors are exact bytes (digests cover every byte), so git must never apply +# line-ending or text conversion to them. This file is part of the corpus and +# is checked by check-corpus.sh like any vector. +printf '*.trn binary\n' >"$OUT/.gitattributes" + +# ---- hex helpers (all integers little-endian) --------------------------- +# le BYTES VALUE: VALUE as BYTES little-endian bytes, in hex +le() { + local n=$1 v=$2 h out="" i + if [ "$n" -lt 8 ]; then v=$((v & ((1 << (8 * n)) - 1))); fi + h=$(printf "%0$((2 * n))x" "$v") + for ((i = 2 * n - 2; i >= 0; i -= 2)); do out+=${h:i:2}; done + printf '%s' "$out" +} +h8() { le 1 "$1"; } +h16() { le 2 "$1"; } +h32() { le 4 "$1"; } +h64() { le 8 "$1"; } +zeros() { local i out=""; for ((i = 0; i < $1; i++)); do out+=00; done; printf '%s' "$out"; } +# txt STRING: the bytes of STRING in hex +txt() { printf '%s' "$1" | od -An -v -tx1 | tr -d ' \n'; } +# bin HEX: write raw bytes +bin() { local e; e=$(printf '%s' "$1" | sed 's/../\\x&/g'); printf '%b' "$e"; } +# sha HEX: SHA-256 of the bytes, in hex +sha() { bin "$1" | sha256sum | cut -c1-64; } +# dig STRING: a fixed 32-byte digest used as test data +dig() { printf '%s' "$1" | sha256sum | cut -c1-64; } +# flip HEX BYTE_OFFSET: HEX with the low bit of that byte inverted +flip() { + local h=$1 o=$(($2 * 2)) b + b=$(printf '%02x' $((0x${h:o:2} ^ 1))) + printf '%s' "${h:0:o}$b${h:o+2}" +} + +# ---- transcript builder --------------------------------------------------- +# A transcript is built in the shell variables T (hex so far), PREV (digest of +# the last record or header), SEQ, and OFF[i]/LEN[i] (byte offset and length +# of record i, 1-based), so byte-level mutants can find records. +SUB_TRANSCRIPT=0 SUB_WORLD=1 SUB_CORTEX=2 SUB_JSPACE=3 SUB_KERNEL=4 SUB_ARGUS=5 +SUB_RUNTIME=7 SUB_SCHED=8 SUB_KV=9 SUB_EXTERNAL=10 +# start PRODUCER RUN_ID_HEX [SCHEMA] [FLAGS] [RESERVED_HEX] +start() { + T="TRN1" + T=$(txt TRN1)$(h16 "${3:-1}")$(h16 "${4:-0}")$2$(h16 "$1")${5:-$(zeros 6)} + PREV=$(sha "$T") + SEQ=0 + OFF=() LEN=() +} +# rec TYPE SUB IDENT_HEX ANNOT_HEX [SEQ] [PREV] [RESERVED] [IDENT_LEN] +rec() { + local s=${5:-$((SEQ + 1))} p=${6:-$PREV} il=${8:-$((${#3} / 2))} r + r=$(h16 "$1")$(h16 "$2")$(h32 "$il")$(h32 $((${#4} / 2)))$(h32 "${7:-0}")$(h64 "$s")$p$3$4 + SEQ=$((SEQ + 1)) + OFF[SEQ]=$((${#T} / 2)) + LEN[SEQ]=$((${#r} / 2)) + T+=$r + PREV=$(sha "$r") +} +end() { rec 65535 $SUB_TRANSCRIPT "$(h64 $((SEQ + 1)))$(zeros 8)" "${1:-}"; } +save() { bin "$T" >"$OUT/$1"; } + +# ---- record identity builders (spec section 5) ------------------------------ +sched() { printf '%s' "$(h64 "$1")$(h64 "$2")$(h64 "$3")$(h64 "$4")"; } +branch_create() { printf '%s' "$(h64 "$1")$(h64 "$2")$(h64 "$3")"; } +branch_destroy() { printf '%s' "$(h64 "$1")$(h64 "$2")$(h32 "$3")$(zeros 4)"; } +rng_seed() { printf '%s' "$(h64 "$1")$2"; } +rng_draw() { printf '%s' "$(h64 "$1")$(h64 "$2")$(h64 "$3")"; } +artifact() { printf '%s' "$(h32 "$1")$(zeros 4)$(h64 "$2")$3"; } +# cap_transition CAP OP GEN_BEFORE GEN_AFTER PRINCIPAL ISSUER [RESERVED3_HEX] +cap_transition() { printf '%s' "$(h32 "$1")$(h8 "$2")${7:-000000}$(h64 "$3")$(h64 "$4")$(h32 "$5")$(h32 "$6")"; } +cortex_read() { printf '%s' "$(h32 "$1")$(h32 "$2")$(h64 "$3")$(h64 "$4")$5"; } +effect_intent() { printf '%s' "$(h64 "$1")$(h32 "$2")$(h32 "$3")$(h64 "$4")$5"; } +effect_commit() { printf '%s' "$(h64 "$1")$(h32 "$2")$(zeros 4)$3"; } +# external_input SOURCE INPUT_SEQ CONTENT_HEX [DIGEST_HEX] +external_input() { printf '%s' "$(h32 "$1")$(zeros 4)$(h64 "$2")${4:-$(sha "$3")}$3"; } +clock_read() { printf '%s' "$(h32 "$1")$(zeros 4)$(h64 "$2")"; } +crash_boundary() { printf '%s' "$(h64 "$1")$(h64 "$2")$3"; } +checkpoint() { printf '%s' "$(h32 "$1")$(zeros 4)$2"; } +# Omega RxCrumb canonical bytes (rx_world.c crumb_hash, after the tag): +# crumb_canon ID KIND REACTION FACULTY WAKE COALESCED INPUTS_HEX CAPS_HEX OUTPUTS_HEX REASON PARENTS_HEX +# where INPUTS_HEX etc. already start with their u32 count. +crumb_canon() { printf '%s' "$(h64 "$1")$(h32 "$2")$(h32 "$3")$(h32 "$4")$(h64 "$5")$(h64 "$6")$7$8$9$(h32 "${10}")${11}"; } +objv() { printf '%s' "$(h32 "$1")$(h32 "$2")$(h64 "$3")$(h64 "$4")"; } # obj id, obj gen, version, mask +capv() { printf '%s' "$(h32 "$1")$(h64 "$2")$(h32 "$3")"; } # cap id, 64-bit generation, issuer +crumb_digest() { sha "$(txt AIEN_RX_CAUSAL_V1)$1"; } +# rx_crumb CANON [DIGEST]: RX_CRUMB identity = digest || canonical bytes +rx_crumb() { printf '%s' "${2:-$(crumb_digest "$1")}$1"; } +crumb_annot() { printf '%s' "$(h32 "$1")$(h64 "$2")$(h64 "$3")$(h64 "$4")"; } # worker, t_start, t_end, episode +# ARGUS: 128-byte ArgusEvent wire bytes (aienos native/argus/argus_event.c encode_raw) +# argus_ev SEQUENCE KIND CLASS OUTCOME PRINCIPAL CAP_ID CAP_GEN +argus_ev() { + printf '%s' "$(h8 1)$(h8 "$3")$(h16 "$2")$(h8 0)$(h8 "$4")$(h16 0)$(h64 "$1")$(h64 "$1")$(h32 "$5")$(h32 0)$(h32 "$6")$(h32 0)$(h64 "$7")$(h64 1)$(h64 0)$(dig "machine A1")$(dig "evidence $1")" +} +# argus_rec EVENT_HEX CHAINED BEFORE_HEX [AFTER_HEX] [RESERVED7_HEX] +argus_rec() { + local after=${4:-} + if [ -z "$after" ]; then + if [ "$2" != 0 ]; then after=$(sha "$3$1"); else after=$3; fi + fi + printf '%s' "$1$(h8 "$2")${5:-$(zeros 7)}$3$after" +} +ARGUS_AFTER="" +sched_annot() { printf '%s' "$(h32 "$1")$(h64 "$2")"; } # worker, wall time (not compared) + +# ---- manifests ------------------------------------------------------------ +{ + echo "# TRN1 shared conformance corpus. Spec: TRN1_TRANSCRIPT_SPEC.md (contract 0.1.0, wire schema 1)." + echo "# Line: <file> ok records=N run=<64 hex> final=<64 hex>" + echo "# or: <file> refuse <code> event=<record position, 0 = file header>" + echo "# codes: -1 MAGIC -2 VERSION -3 LENGTH -4 NONCANONICAL -5 UNKNOWN -6 SHAPE" + echo "# -7 GAP -8 CHAIN -9 DIGEST -10 TRUNCATED" + echo "# Generated by tools/make-corpus.sh; do not edit by hand." +} >"$OUT/expected.txt" +{ + echo "# TRN1 replay comparison pairs. Spec section 8." + echo "# Line: <expected file> <actual file> MATCH through N" + echo "# or: <expected file> <actual file> DIVERGENCE event=N expected=<64 hex> actual=<64 hex> subsystem=<name>" + echo "# or: <expected file> <actual file> refuse expected|actual <code> event=N" + echo "# Generated by tools/make-corpus.sh; do not edit by hand." +} >"$OUT/compare.txt" +ok() { echo "$1 ok records=$2 run=$3 final=$PREV" >>"$OUT/expected.txt"; } +refuse() { echo "$1 refuse $2 event=$3" >>"$OUT/expected.txt"; } +pair() { echo "$1 $2 $3" >>"$OUT/compare.txt"; } +# Compared digest of record I of the transcript in T (spec section 8). +cmpd() { + local i=$1 o=$((OFF[$1] * 2)) il + il=$((0x$(printf '%s' "${T:o+14:2}${T:o+12:2}${T:o+10:2}${T:o+8:2}"))) + sha "$(txt AIEN_TRN1_CMP)${T:o:8}${T:o+32:16}${T:o+8:8}${T:o+112:il*2}" +} +# cut FILE_HEX START_BYTE COUNT: bytes [START, START+COUNT) +cut_hex() { printf '%s' "${1:$(($2 * 2)):$(($3 * 2))}"; } + +# =========================================================================== +# g001: Omega World run (producer omega-world). Every record kind a World +# writes today, including two real RxCrumbs (create, then commit with parent). +# =========================================================================== +RUN1=$(dig "run g001") +C1=$(crumb_canon 1 1 4294967295 0 0 0 "$(h32 0)" "$(h32 0)" "$(h32 1)$(objv 5 1 3 255)" 0 "$(h32 0)") +C1D=$(crumb_digest "$C1") +C2=$(crumb_canon 2 3 3 1 1 0 "$(h32 1)$(objv 5 1 3 255)" "$(h32 1)$(capv 4 9 1)" "$(h32 1)$(objv 6 1 1 1)" 0 "$(h32 1)$(h64 1)$C1D") +g001() { # g001 [worker-time skew for replay annotations] [run id] + local w=${1:-0} + start $SUB_WORLD "${2:-$RUN1}" + rec 4 $SUB_WORLD "$(rng_seed 1 "$(dig "seed g001")")" "" + rec 2 $SUB_JSPACE "$(branch_create 7 0 1)" "" + rec 1 $SUB_WORLD "$(sched 1 3 0 0)" "$(sched_annot $((2 + w)) $((1000 + w * 77)))" + rec 8 $SUB_CORTEX "$(cortex_read 5 1 3 255 "$(dig "cortex obj5 v3")")" "" + rec 15 $SUB_WORLD "$(rx_crumb "$C1")" "$(crumb_annot $((1 + w)) $((2000 + w)) $((2100 + w)) 1)" + rec 15 $SUB_WORLD "$(rx_crumb "$C2")" "$(crumb_annot $((2 + w)) $((2200 + w)) $((2900 + w)) 1)" + rec 7 $SUB_KERNEL "$(cap_transition 4 2 9 10 3 1)" "" + rec 9 $SUB_WORLD "$(effect_intent 1 2 4 10 "$(dig "effect 1 request")")" "" + rec 10 $SUB_WORLD "$(effect_commit 1 0 "$(dig "effect 1 result")")" "" + rec 14 $SUB_WORLD "$(checkpoint 1 "$(dig "world state after g001")")" "" +} +g001; end; save g001.trn; ok g001.trn 11 "$RUN1" +G1=$T +G1CMP=(); for i in $(seq 1 11); do G1CMP[i]=$(cmpd "$i"); done + +# g005: replay of g001 on another schedule. Different run id, workers and +# wall times (annotations); same identities. Verifies alone and MATCHes g001. +RUN5=$(dig "run g005 replay of g001") +g001 3 "$RUN5"; end; save g005.trn; ok g005.trn 11 "$RUN5" +pair g001.trn g005.trn "MATCH through 11" +pair g001.trn g001.trn "MATCH through 11" + +# =========================================================================== +# g002: AIENOS ARGUS stream (producer aienos-argus). Two chained events, one +# malformed event recorded but not chained (argus_core step 0), a revoke. +# =========================================================================== +RUN2=$(dig "run g002") +E1=$(argus_ev 1 10 2 1 3 4 9) +E2=$(argus_ev 2 11 2 1 3 4 10) +E3=$(argus_ev 3 12 2 9 3 4 10) +Z32=$(zeros 32) +A1=$(sha "$Z32$E1"); A2=$(sha "$A1$E2") +start $SUB_ARGUS "$RUN2" +rec 16 $SUB_ARGUS "$(argus_rec "$E1" 1 "$Z32")" "" +rec 16 $SUB_ARGUS "$(argus_rec "$E2" 1 "$A1")" "" +rec 16 $SUB_ARGUS "$(argus_rec "$E3" 0 "$A2")" "" +rec 7 $SUB_KERNEL "$(cap_transition 4 4 10 11 3 1)" "" +rec 14 $SUB_ARGUS "$(checkpoint 2 "$A2")" "" +end; save g002.trn; ok g002.trn 6 "$RUN2" +G2=$T +pair g002.trn g002.trn "MATCH through 6" + +# =========================================================================== +# g003: the remaining record types (producer sovcore-runtime), including a +# recovered crash boundary and external input with and without content. +# =========================================================================== +RUN3=$(dig "run g003") +IN1=$(txt "hello transcript") +g003() { + start $SUB_RUNTIME "$RUN3" + rec 11 $SUB_EXTERNAL "$(external_input 1 1 "$IN1")" "" + rec 11 $SUB_EXTERNAL "$(external_input 1 2 "" "$(dig "input 2 stored elsewhere")")" "" + rec 12 $SUB_RUNTIME "$(clock_read 1 42)" "" + rec 5 $SUB_RUNTIME "$(rng_draw 1 0 12345)" "" + rec 6 $SUB_RUNTIME "$(artifact 1 9 "$(dig "artifact 9")")" "" + rec 2 $SUB_KV "$(branch_create 2 1 1)" "" + rec 3 $SUB_KV "$(branch_destroy 2 1 -1)" "" + rec 13 $SUB_RUNTIME "$(crash_boundary 2 7 "$(dig "recovered state epoch 2")")" "" + rec 1 $SUB_SCHED "$(sched 1 1 0 0)" "$(sched_annot 0 5)" + rec 14 $SUB_KV "$(checkpoint 3 "$(dig "kv pages after g003")")" "" +} +g003; end; save g003.trn; ok g003.trn 11 "$RUN3" +G3=$T + +# g004: the smallest transcript, END only. +RUN4=$(dig "run g004") +start $SUB_KERNEL "$RUN4"; end; save g004.trn; ok g004.trn 1 "$RUN4" + +# =========================================================================== +# Edge positives. +# =========================================================================== +# p001: largest external input content (4096 bytes) and a large annotation. +BIG=$(for i in $(seq 1 256); do printf '%s' "000102030405060708090a0b0c0d0e0f"; done) +start $SUB_RUNTIME "$(dig "run p001")" +rec 11 $SUB_EXTERNAL "$(external_input 2 1 "$BIG")" "$BIG$BIG" +end; save p001.trn; ok p001.trn 2 "$(dig "run p001")" +# p002: crumb at Omega's limits: 8 inputs, 8 caps, 8 outputs, and parents that +# carry no digest (p = 0 and p >= id), as crumb_hash writes them. +INS=$(h32 8); CAPS=$(h32 8); OUTS=$(h32 8) +for i in 1 2 3 4 5 6 7 8; do INS+=$(objv "$i" 1 "$i" 255); CAPS+=$(capv "$i" $((1 << 40)) 0); OUTS+=$(objv $((i + 8)) 2 1 1); done +CP=$(crumb_canon 5 3 2 1 4 2 "$INS" "$CAPS" "$OUTS" -3 "$(h32 4)$(h64 0)$(h64 4)$C1D$(h64 5)$(h64 9)") +start $SUB_WORLD "$(dig "run p002")" +rec 15 $SUB_WORLD "$(rx_crumb "$CP")" "$(crumb_annot 0 0 0 0)" +end; save p002.trn; ok p002.trn 2 "$(dig "run p002")" + +# =========================================================================== +# Forged replays: each has a valid chain (accepted alone) but a different +# history than g001. Only comparison against the expected run finds them. +# =========================================================================== +div() { # div FILE EVENT SUBSYSTEM: record the DIVERGENCE pair against g001 + pair g001.trn "$1" "DIVERGENCE event=$2 expected=${G1CMP[$2]} actual=$(cmpd "$2") subsystem=$3" +} +# f001 omission: record 3 (scheduler decision) dropped, renumbered, rechained. +start $SUB_WORLD "$RUN1" +rec 4 $SUB_WORLD "$(rng_seed 1 "$(dig "seed g001")")" "" +rec 2 $SUB_JSPACE "$(branch_create 7 0 1)" "" +rec 8 $SUB_CORTEX "$(cortex_read 5 1 3 255 "$(dig "cortex obj5 v3")")" "" +rec 15 $SUB_WORLD "$(rx_crumb "$C1")" "$(crumb_annot 1 2000 2100 1)" +rec 15 $SUB_WORLD "$(rx_crumb "$C2")" "$(crumb_annot 2 2200 2900 1)" +rec 7 $SUB_KERNEL "$(cap_transition 4 2 9 10 3 1)" "" +rec 9 $SUB_WORLD "$(effect_intent 1 2 4 10 "$(dig "effect 1 request")")" "" +rec 10 $SUB_WORLD "$(effect_commit 1 0 "$(dig "effect 1 result")")" "" +rec 14 $SUB_WORLD "$(checkpoint 1 "$(dig "world state after g001")")" "" +end; save f001.trn; ok f001.trn 10 "$RUN1"; div f001.trn 3 omega-world +# f002 reorder: records 3 and 4 swapped, rechained. +start $SUB_WORLD "$RUN1" +rec 4 $SUB_WORLD "$(rng_seed 1 "$(dig "seed g001")")" "" +rec 2 $SUB_JSPACE "$(branch_create 7 0 1)" "" +rec 8 $SUB_CORTEX "$(cortex_read 5 1 3 255 "$(dig "cortex obj5 v3")")" "" +rec 1 $SUB_WORLD "$(sched 1 3 0 0)" "$(sched_annot 2 1000)" +rec 15 $SUB_WORLD "$(rx_crumb "$C1")" "$(crumb_annot 1 2000 2100 1)" +rec 15 $SUB_WORLD "$(rx_crumb "$C2")" "$(crumb_annot 2 2200 2900 1)" +rec 7 $SUB_KERNEL "$(cap_transition 4 2 9 10 3 1)" "" +rec 9 $SUB_WORLD "$(effect_intent 1 2 4 10 "$(dig "effect 1 request")")" "" +rec 10 $SUB_WORLD "$(effect_commit 1 0 "$(dig "effect 1 result")")" "" +rec 14 $SUB_WORLD "$(checkpoint 1 "$(dig "world state after g001")")" "" +end; save f002.trn; ok f002.trn 11 "$RUN1"; div f002.trn 3 omega-world +# f003: different RNG seed (first record). +start $SUB_WORLD "$RUN1" +rec 4 $SUB_WORLD "$(rng_seed 1 "$(dig "seed g001 other")")" "" +end; save f003.trn; ok f003.trn 2 "$RUN1"; div f003.trn 1 omega-world +# f004: crumb 2 used capability generation 8 instead of 9 (digest recomputed). +C2X=$(crumb_canon 2 3 3 1 1 0 "$(h32 1)$(objv 5 1 3 255)" "$(h32 1)$(capv 4 8 1)" "$(h32 1)$(objv 6 1 1 1)" 0 "$(h32 1)$(h64 1)$C1D") +start $SUB_WORLD "$RUN1" +rec 4 $SUB_WORLD "$(rng_seed 1 "$(dig "seed g001")")" "" +rec 2 $SUB_JSPACE "$(branch_create 7 0 1)" "" +rec 1 $SUB_WORLD "$(sched 1 3 0 0)" "$(sched_annot 2 1000)" +rec 8 $SUB_CORTEX "$(cortex_read 5 1 3 255 "$(dig "cortex obj5 v3")")" "" +rec 15 $SUB_WORLD "$(rx_crumb "$C1")" "$(crumb_annot 1 2000 2100 1)" +rec 15 $SUB_WORLD "$(rx_crumb "$C2X")" "$(crumb_annot 2 2200 2900 1)" +end; save f004.trn; ok f004.trn 7 "$RUN1"; div f004.trn 6 omega-world +# f005: one extra clock read before END. +g001; rec 12 $SUB_WORLD "$(clock_read 1 99)" ""; end; save f005.trn; ok f005.trn 12 "$RUN1"; div f005.trn 11 transcript +# f006: run stopped early (END after record 5). +start $SUB_WORLD "$RUN1" +rec 4 $SUB_WORLD "$(rng_seed 1 "$(dig "seed g001")")" "" +rec 2 $SUB_JSPACE "$(branch_create 7 0 1)" "" +rec 1 $SUB_WORLD "$(sched 1 3 0 0)" "$(sched_annot 2 1000)" +rec 8 $SUB_CORTEX "$(cortex_read 5 1 3 255 "$(dig "cortex obj5 v3")")" "" +rec 15 $SUB_WORLD "$(rx_crumb "$C1")" "$(crumb_annot 1 2000 2100 1)" +end; save f006.trn; ok f006.trn 6 "$RUN1"; div f006.trn 6 omega-world + +# =========================================================================== +# Byte-level mutants of g001 (damage after writing: nothing rechained). +# =========================================================================== +g001 >/dev/null; end # refresh OFF/LEN for g001 +mb() { bin "$1" >"$OUT/$2"; } +R() { printf '%s' "${OFF[$1]}"; } +# m001 omission: record 3 removed. +mb "${G1:0:$(($(R 3) * 2))}${G1:$(($(R 4) * 2))}" m001.trn; refuse m001.trn -7 3 +# m002 reorder: records 3 and 4 swapped. +mb "${G1:0:$(($(R 3) * 2))}$(cut_hex "$G1" "$(R 4)" "${LEN[4]}")$(cut_hex "$G1" "$(R 3)" "${LEN[3]}")${G1:$(($(R 5) * 2))}" m002.trn; refuse m002.trn -7 3 +# m003 bit flip in record 4 identity (cortex read digest): next record's prev breaks. +mb "$(flip "$G1" $(($(R 4) + 56 + 30)))" m003.trn; refuse m003.trn -8 5 +# m004 bit flip in record 3 annotation (worker id): annotations are chained too. +mb "$(flip "$G1" $(($(R 3) + 56 + 32)))" m004.trn; refuse m004.trn -8 4 +# m005 bit flip in record 2 prev field. +mb "$(flip "$G1" $(($(R 2) + 24 + 5)))" m005.trn; refuse m005.trn -8 2 +# m006 bit flip in record 6 seq. +mb "$(flip "$G1" $(($(R 6) + 16)))" m006.trn; refuse m006.trn -7 6 +# m007 bit flip in header run id. +mb "$(flip "$G1" 9)" m007.trn; refuse m007.trn -8 1 +# m008 bit flip in magic. +mb "$(flip "$G1" 0)" m008.trn; refuse m008.trn -1 0 +# m009 truncation inside record 5. +mb "${G1:0:$((($(R 5) + 70) * 2))}" m009.trn; refuse m009.trn -3 5 +# m010 truncation at a record boundary: END lost. +mb "${G1:0:$(($(R 11) * 2))}" m010.trn; refuse m010.trn -10 11 +# m011 truncation inside the file header. +mb "${G1:0:40}" m011.trn; refuse m011.trn -3 0 +# m012 empty file. +: >"$OUT/m012.trn"; refuse m012.trn -3 0 +# m013 truncation inside END. +mb "${G1:0:$((${#G1} - 6))}" m013.trn; refuse m013.trn -3 11 +# m014 trailing byte after END. +mb "${G1}00" m014.trn; refuse m014.trn -3 12 +# m015 duplicate: record 3 written twice. +mb "${G1:0:$(($(R 4) * 2))}$(cut_hex "$G1" "$(R 3)" "${LEN[3]}")${G1:$(($(R 4) * 2))}" m015.trn; refuse m015.trn -7 4 +# m016 bit flip inside crumb 1 canonical bytes (record 5): its own crumb digest no longer matches. +mb "$(flip "$G1" $(($(R 5) + 56 + 32 + 12)))" m016.trn; refuse m016.trn -9 5 +# m017 bit flip in END prev. +mb "$(flip "$G1" $(($(R 11) + 24)))" m017.trn; refuse m017.trn -8 11 +# m018 bit flip in END record count. +mb "$(flip "$G1" $(($(R 11) + 56)))" m018.trn; refuse m018.trn -7 11 + +# =========================================================================== +# Built mutants: rechained, so only the named check can catch them. +# =========================================================================== +H() { start "${1:-$SUB_WORLD}" "$(dig "run $2")" "${3:-1}" "${4:-0}" "${5:-}"; } +# Header checks. +H $SUB_WORLD m020 2; end; save m020.trn; refuse m020.trn -2 0 # unknown future schema +H $SUB_WORLD m021 0; end; save m021.trn; refuse m021.trn -2 0 # schema 0 +H $SUB_WORLD m022 1 1; end; save m022.trn; refuse m022.trn -4 0 # header flags set +H 0 m023; end; save m023.trn; refuse m023.trn -5 0 # producer 0 +H 11 m024; end; save m024.trn; refuse m024.trn -5 0 # producer unknown +H $SUB_WORLD m025 1 0 "000000000100"; end; save m025.trn; refuse m025.trn -4 0 # header reserved +# Record header checks. +H $SUB_WORLD m030; rec 17 $SUB_WORLD "$(clock_read 1 1)" ""; end; save m030.trn; refuse m030.trn -5 1 # unknown type +H $SUB_WORLD m031; rec 12 11 "$(clock_read 1 1)" ""; end; save m031.trn; refuse m031.trn -5 1 # unknown subsystem +H $SUB_WORLD m032; rec 12 $SUB_WORLD "$(clock_read 1 1)" "" "" "" 1; end; save m032.trn; refuse m032.trn -4 1 # record reserved +H $SUB_WORLD m033; rec 12 $SUB_WORLD "$(clock_read 1 1)" "" 2; end; save m033.trn; refuse m033.trn -7 1 # seq skips (omission at start) +H $SUB_WORLD m034; rec 12 $SUB_WORLD "$(clock_read 1 1)" "" "" "$(dig other)"; end; save m034.trn; refuse m034.trn -8 1 # wrong prev +# Check order: unknown type wins over a bad seq. +H $SUB_WORLD m035; rec 17 $SUB_WORLD "$(clock_read 1 1)" "" 9; end; save m035.trn; refuse m035.trn -5 1 +# Check order: a bad seq wins over a bad prev. +H $SUB_WORLD m036; rec 12 $SUB_WORLD "$(clock_read 1 1)" "" 9 "$(dig other)"; end; save m036.trn; refuse m036.trn -7 1 +# Identity longer than the limit, fully present: LENGTH, not SHAPE. +HUGE=$(head -c 65537 /dev/zero | od -An -v -tx1 | tr -d ' \n') +H $SUB_WORLD m037; rec 1 $SUB_WORLD "$HUGE" ""; end; save m037.trn; refuse m037.trn -3 1 +# Shape checks. +H $SUB_WORLD m040; rec 1 $SUB_WORLD "$(sched 1 3 0 0 | cut -c1-62)" ""; end; save m040.trn; refuse m040.trn -6 1 # SCHED 31 bytes +H $SUB_WORLD m041; rec 65535 $SUB_WORLD "$(h64 1)$(zeros 8)" ""; save m041.trn; refuse m041.trn -6 1 # END not subsystem 0 +H $SUB_WORLD m042; rec 12 $SUB_TRANSCRIPT "$(clock_read 1 1)" ""; end; save m042.trn; refuse m042.trn -6 1 # subsystem 0 off END +H $SUB_WORLD m043; rec 7 $SUB_KERNEL "$(cap_transition 4 7 9 10 3 1)" ""; end; save m043.trn; refuse m043.trn -6 1 # cap op 7 +H $SUB_WORLD m044; rec 13 $SUB_RUNTIME "$(crash_boundary 2 1 "$(dig x)")" ""; end; save m044.trn; refuse m044.trn -6 1 # last durable >= own seq +H $SUB_WORLD m045; rec 11 $SUB_EXTERNAL "$(external_input 1 1 "$BIG"00)" ""; end; save m045.trn; refuse m045.trn -6 1 # content 4097 +H $SUB_WORLD m046; rec 15 $SUB_WORLD "$(dig short | cut -c1-40)" ""; end; save m046.trn; refuse m046.trn -6 1 # crumb identity < 32 bytes +CB9=$(crumb_canon 3 3 1 1 0 0 "$(h32 9)$(for i in 1 2 3 4 5 6 7 8 9; do objv "$i" 1 1 1; done)" "$(h32 0)" "$(h32 0)" 0 "$(h32 0)") +H $SUB_WORLD m047; rec 15 $SUB_WORLD "$(rx_crumb "$CB9")" ""; end; save m047.trn; refuse m047.trn -6 1 # 9 inputs (digest valid) +CBP=$(crumb_canon 3 3 1 1 0 0 "$(h32 0)" "$(h32 0)" "$(h32 0)" 0 "$(h32 1)$(h64 1)") +H $SUB_WORLD m048; rec 15 $SUB_WORLD "$(rx_crumb "$CBP")" ""; end; save m048.trn; refuse m048.trn -6 1 # parent 1 < id 3 without its digest +H $SUB_ARGUS m049; rec 16 $SUB_ARGUS "$(argus_rec "$E1" 2 "$Z32" "$(sha "$Z32$E1")")" ""; end; save m049.trn; refuse m049.trn -6 1 # chained flag 2 +H $SUB_WORLD m050; end "00"; save m050.trn; refuse m050.trn -6 1 # END with annotation +# Reserved fields inside identities. +H $SUB_WORLD m055; rec 7 $SUB_KERNEL "$(cap_transition 4 2 9 10 3 1 000100)" ""; end; save m055.trn; refuse m055.trn -4 1 +H $SUB_WORLD m056; rec 65535 $SUB_TRANSCRIPT "$(h64 1)$(h64 1)" ""; save m056.trn; refuse m056.trn -4 1 +H $SUB_ARGUS m057; rec 16 $SUB_ARGUS "$(argus_rec "$E1" 1 "$Z32" "" 00000000000001)" ""; end; save m057.trn; refuse m057.trn -4 1 +# END count. +H $SUB_WORLD m058; rec 12 $SUB_WORLD "$(clock_read 1 1)" ""; rec 65535 $SUB_TRANSCRIPT "$(h64 5)$(zeros 8)" ""; save m058.trn; refuse m058.trn -7 2 +# Embedded digests. +CBAD=$(crumb_canon 1 1 4294967295 0 0 0 "$(h32 0)" "$(h32 0)" "$(h32 1)$(objv 5 1 3 254)" 0 "$(h32 0)") +H $SUB_WORLD m060; rec 15 $SUB_WORLD "$(rx_crumb "$CBAD" "$C1D")" ""; end; save m060.trn; refuse m060.trn -9 1 # crumb digest stale +H $SUB_WORLD m061; rec 11 $SUB_EXTERNAL "$(external_input 1 1 "$(txt "hello transcripT")" "$(sha "$IN1")")" ""; end; save m061.trn; refuse m061.trn -9 1 # input content altered +H $SUB_ARGUS m062; rec 16 $SUB_ARGUS "$(argus_rec "$E1" 1 "$Z32" "$(dig wrong)")" ""; end; save m062.trn; refuse m062.trn -9 1 # chain_after wrong +H $SUB_ARGUS m063; rec 16 $SUB_ARGUS "$(argus_rec "$E1" 1 "$Z32")" ""; rec 16 $SUB_ARGUS "$(argus_rec "$E2" 1 "$Z32")" ""; end; save m063.trn; refuse m063.trn -9 2 # ARGUS event dropped between records 1 and 2 +H $SUB_ARGUS m064; rec 16 $SUB_ARGUS "$(argus_rec "$E3" 0 "$Z32" "$A1")" ""; end; save m064.trn; refuse m064.trn -9 1 # unchained event moved the chain +# ARGUS stream with an event omitted, then rechained by the writer: the ARGUS +# continuity check still catches it (g002 without record 2). +start $SUB_ARGUS "$RUN2" +rec 16 $SUB_ARGUS "$(argus_rec "$E1" 1 "$Z32")" "" +rec 16 $SUB_ARGUS "$(argus_rec "$E3" 0 "$A2")" "" +end; save m065.trn; refuse m065.trn -9 2 + +# Compare against refused files. +pair g001.trn m001.trn "refuse actual -7 event=3" +pair m008.trn g001.trn "refuse expected -1 event=0" + +echo "corpus written to $OUT: $(ls "$OUT"/*.trn | wc -l) transcripts" diff --git a/specs/execution-transcript/tools/mutate-verifier.sh b/specs/execution-transcript/tools/mutate-verifier.sh new file mode 100755 index 0000000..e9ca64a --- /dev/null +++ b/specs/execution-transcript/tools/mutate-verifier.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# mutate-verifier.sh: show that every check in trn1_verify.c is exercised by +# the corpus. Builds one verifier per check with that check disabled +# (-DTRN1_MUTANT=K) and requires the corpus to report at least one miss. +# A mutant the corpus does not notice is a SURVIVOR and fails this script. +# +# Usage: mutate-verifier.sh [CC] +set -eu +export LC_ALL=C +here=$(cd "$(dirname "$0")" && pwd) +vec="$here/../vectors" +CC=${1:-cc} +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT +names=$(sed -n '/CHK_MAGIC = 1/,/CHK_LAST/p' "$here/trn1_verify.c" | tr -d ' \n' | sed 's/CHK_MAGIC=1/CHK_MAGIC/; s/,CHK_LAST.*//' | tr ',' ' ') +test -n "$names" || { echo "cannot read the check list" >&2; exit 2; } +k=0 killed=0 survived=0 +for name in $names; do + k=$((k + 1)) + "$CC" -std=c99 -O1 -w -DTRN1_MUTANT=$k -o "$tmp/m$k" "$here/trn1_verify.c" + if "$tmp/m$k" --corpus "$vec" >"$tmp/out$k" 2>&1; then + echo "SURVIVOR $k $name" + survived=$((survived + 1)) + else + echo "killed $k $name: $(grep -c '^MISMATCH' "$tmp/out$k") corpus line(s) differ" + killed=$((killed + 1)) + fi +done +echo "TRN1_VERIFIER_MUTANTS total=$k killed=$killed survived=$survived" +test "$survived" -eq 0 && test "$k" -gt 0 diff --git a/specs/execution-transcript/tools/trn1_verify.c b/specs/execution-transcript/tools/trn1_verify.c new file mode 100644 index 0000000..ad5d4ee --- /dev/null +++ b/specs/execution-transcript/tools/trn1_verify.c @@ -0,0 +1,459 @@ +/* trn1_verify.c: reference verifier for the TRN1 execution transcript, + * wire schema 1, contract 0.1.0. Spec: ../TRN1_TRANSCRIPT_SPEC.md. + * + * Self-contained C99: its own SHA-256 (FIPS 180-4), libc only, no imports + * from any implementation repository. It exists to prove the corpus, not to + * be linked into a runtime. + * + * Usage: + * trn1_verify FILE print one verdict line (spec section 7) + * trn1_verify --compare EXP ACT print one compare line (spec section 8) + * trn1_verify --corpus DIR check DIR/expected.txt and DIR/compare.txt, + * print TRN1_CONFORMANCE impl=c pass=N fail=M + * + * Exit status: 0 on accept / MATCH / all corpus lines agree, 1 otherwise, + * 2 on usage or I/O error. + * + * Mutation hooks: building with -DTRN1_MUTANT=K disables check K (the + * numbers are the CHK_* values below). tools/mutate-verifier.sh builds every + * mutant and requires the corpus to fail each one, which shows every check + * is exercised by at least one vector. + */ +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifndef TRN1_MUTANT +#define TRN1_MUTANT 0 +#endif +#define CHECK(k) (TRN1_MUTANT != (k)) + +enum { + CHK_MAGIC = 1, CHK_VERSION, CHK_HDR_FLAGS, CHK_PRODUCER, CHK_HDR_RESERVED, + CHK_TYPE, CHK_SUBSYS, CHK_REC_RESERVED, CHK_LIMIT, CHK_SEQ, CHK_PREV, + CHK_IDENT_LEN, CHK_END_SUBSYS, CHK_BODY_RESERVED, CHK_CAP_OP, + CHK_CRASH_SEQ, CHK_CRUMB_SHAPE, CHK_CRUMB_DIGEST, CHK_ARGUS_FLAG, + CHK_ARGUS_LINK, CHK_ARGUS_CONT, CHK_INPUT_DIGEST, CHK_END_ANNOT, + CHK_END_COUNT, CHK_TRAILING, CHK_TRUNCATED, CHK_LAST +}; + +/* ---- refusal codes (spec section 6) ------------------------------------ */ +enum { + R_OK = 0, R_MAGIC = -1, R_VERSION = -2, R_LENGTH = -3, R_NONCANONICAL = -4, + R_UNKNOWN = -5, R_SHAPE = -6, R_GAP = -7, R_CHAIN = -8, R_DIGEST = -9, + R_TRUNCATED = -10 +}; + +/* ---- SHA-256 ------------------------------------------------------------ */ +typedef struct { uint32_t h[8]; uint64_t n; uint8_t b[64]; uint32_t used; } sha256; + +static const uint32_t K256[64] = { + 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5, + 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174, + 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da, + 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967, + 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85, + 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070, + 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3, + 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2 +}; +#define ROR(x, r) (((x) >> (r)) | ((x) << (32 - (r)))) + +static void sha_block(sha256 *s, const uint8_t *p) { + uint32_t w[64], a, b, c, d, e, f, g, h; + for (int i = 0; i < 16; i++) + w[i] = (uint32_t)p[4*i] << 24 | (uint32_t)p[4*i+1] << 16 | (uint32_t)p[4*i+2] << 8 | p[4*i+3]; + for (int i = 16; i < 64; i++) { + uint32_t s0 = ROR(w[i-15], 7) ^ ROR(w[i-15], 18) ^ (w[i-15] >> 3); + uint32_t s1 = ROR(w[i-2], 17) ^ ROR(w[i-2], 19) ^ (w[i-2] >> 10); + w[i] = w[i-16] + s0 + w[i-7] + s1; + } + a = s->h[0]; b = s->h[1]; c = s->h[2]; d = s->h[3]; + e = s->h[4]; f = s->h[5]; g = s->h[6]; h = s->h[7]; + for (int i = 0; i < 64; i++) { + uint32_t t1 = h + (ROR(e, 6) ^ ROR(e, 11) ^ ROR(e, 25)) + ((e & f) ^ (~e & g)) + K256[i] + w[i]; + uint32_t t2 = (ROR(a, 2) ^ ROR(a, 13) ^ ROR(a, 22)) + ((a & b) ^ (a & c) ^ (b & c)); + h = g; g = f; f = e; e = d + t1; d = c; c = b; b = a; a = t1 + t2; + } + s->h[0] += a; s->h[1] += b; s->h[2] += c; s->h[3] += d; + s->h[4] += e; s->h[5] += f; s->h[6] += g; s->h[7] += h; +} +static void sha_init(sha256 *s) { + static const uint32_t iv[8] = { 0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a, + 0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19 }; + memcpy(s->h, iv, sizeof iv); s->n = 0; s->used = 0; +} +static void sha_update(sha256 *s, const void *data, size_t len) { + const uint8_t *p = data; + s->n += len; + while (len) { + uint32_t k = 64 - s->used; + if (k > len) k = (uint32_t)len; + memcpy(s->b + s->used, p, k); + s->used += k; p += k; len -= k; + if (s->used == 64) { sha_block(s, s->b); s->used = 0; } + } +} +static void sha_final(sha256 *s, uint8_t out[32]) { + uint64_t bits = s->n * 8; + uint8_t pad = 0x80, z = 0, l[8]; + sha_update(s, &pad, 1); + while (s->used != 56) sha_update(s, &z, 1); + for (int i = 0; i < 8; i++) l[i] = (uint8_t)(bits >> (56 - 8 * i)); + sha_update(s, l, 8); + for (int i = 0; i < 8; i++) { + out[4*i] = (uint8_t)(s->h[i] >> 24); out[4*i+1] = (uint8_t)(s->h[i] >> 16); + out[4*i+2] = (uint8_t)(s->h[i] >> 8); out[4*i+3] = (uint8_t)s->h[i]; + } +} +static void sha2(const void *a, size_t na, const void *b, size_t nb, uint8_t out[32]) { + sha256 s; sha_init(&s); sha_update(&s, a, na); if (nb) sha_update(&s, b, nb); sha_final(&s, out); +} + +/* ---- little-endian readers ---------------------------------------------- */ +static uint16_t g16(const uint8_t *p) { return (uint16_t)(p[0] | p[1] << 8); } +static uint32_t g32(const uint8_t *p) { return (uint32_t)p[0] | (uint32_t)p[1] << 8 | (uint32_t)p[2] << 16 | (uint32_t)p[3] << 24; } +static uint64_t g64(const uint8_t *p) { return (uint64_t)g32(p) | (uint64_t)g32(p + 4) << 32; } +static int all_zero(const uint8_t *p, size_t n) { while (n--) if (*p++) return 0; return 1; } + +/* ---- registries (spec sections 4 and 5) --------------------------------- */ +#define HDR_SIZE 48u +#define REC_HDR_SIZE 56u +#define MAX_IDENT 65536u +#define MAX_ANNOT 65536u +#define MAX_CONTENT 4096u +#define T_END 0xFFFFu + +static const char *subsys_name(uint16_t s) { + static const char *n[] = { "transcript", "omega-world", "omega-cortex", "omega-jspace", + "aienos-kernel", "aienos-argus", "aienos-store", "sovcore-runtime", + "sovcore-scheduler", "sovcore-kv", "external" }; + return s < sizeof n / sizeof n[0] ? n[s] : NULL; +} + +/* Fixed identity length per record type; -1 = variable (rule in code), 0 = unknown type. */ +static long ident_rule(uint16_t t) { + switch (t) { + case 1: return 32; /* SCHED_DECISION */ + case 2: return 24; /* BRANCH_CREATE */ + case 3: return 24; /* BRANCH_DESTROY */ + case 4: return 40; /* RNG_SEED */ + case 5: return 24; /* RNG_DRAW */ + case 6: return 48; /* ARTIFACT_DIGEST */ + case 7: return 32; /* CAP_TRANSITION */ + case 8: return 56; /* CORTEX_READ */ + case 9: return 56; /* EFFECT_INTENT */ + case 10: return 48; /* EFFECT_COMMIT */ + case 11: return -1; /* EXTERNAL_INPUT: 48 + content (0..4096) */ + case 12: return 16; /* CLOCK_READ */ + case 13: return 48; /* CRASH_BOUNDARY */ + case 14: return 40; /* CHECKPOINT */ + case 15: return -1; /* RX_CRUMB: 32 + canonical crumb bytes */ + case 16: return 200; /* ARGUS_EVENT */ + case T_END: return 16; + default: return 0; + } +} + +/* RX_CRUMB canonical bytes: the exact preimage omega hashes after the + * "AIEN_RX_CAUSAL_V1" tag (omega src/runtime/rx_world.c crumb_hash). + * Returns 1 if the bytes parse exactly, 0 otherwise. */ +static int crumb_shape(const uint8_t *c, size_t n) { + size_t o = 0; + uint64_t id; + uint32_t k; +#define NEED(x) do { if (n - o < (size_t)(x)) return 0; } while (0) + NEED(8 + 4 + 4 + 4 + 8 + 8); id = g64(c); o += 36; + NEED(4); k = g32(c + o); o += 4; if (k > 8) return 0; NEED((size_t)k * 24); o += (size_t)k * 24; + NEED(4); k = g32(c + o); o += 4; if (k > 8) return 0; NEED((size_t)k * 16); o += (size_t)k * 16; + NEED(4); k = g32(c + o); o += 4; if (k > 8) return 0; NEED((size_t)k * 24); o += (size_t)k * 24; + NEED(4); o += 4; /* reason */ + NEED(4); k = g32(c + o); o += 4; if (k > 65) return 0; + for (uint32_t i = 0; i < k; i++) { + uint64_t p; + NEED(8); p = g64(c + o); o += 8; + if (p >= 1 && p < id) { NEED(32); o += 32; } + } +#undef NEED + return o == n; +} + +/* ---- transcript walk ---------------------------------------------------- */ +#define MAX_RECS 4096u +typedef struct { + int code; /* R_* */ + uint64_t event; /* failing record position, 0 = header */ + uint64_t records; /* on accept: record count including END */ + uint8_t run_id[32]; + uint8_t final_digest[32]; + uint8_t (*cmp)[32]; /* compared digest per record (index 0 = record 1) */ + uint16_t *subsys; +} Verdict; + +static int refuse(Verdict *v, int code, uint64_t ev) { v->code = code; v->event = ev; return code; } + +static int verify(const uint8_t *b, size_t n, Verdict *v) { + size_t o = 0; + uint8_t prev[32], argus_after[32]; + int have_argus = 0; + uint64_t seq = 0; + + memset(v, 0, sizeof *v); + v->cmp = calloc(MAX_RECS, 32); + v->subsys = calloc(MAX_RECS, sizeof *v->subsys); + if (!v->cmp || !v->subsys) { fprintf(stderr, "out of memory\n"); exit(2); } + + /* Header, check order 1..5. */ + if (n < 4) return refuse(v, R_LENGTH, 0); + if (CHECK(CHK_MAGIC) && memcmp(b, "TRN1", 4) != 0) return refuse(v, R_MAGIC, 0); + if (n < 6) return refuse(v, R_LENGTH, 0); + if (CHECK(CHK_VERSION) && g16(b + 4) != 1) return refuse(v, R_VERSION, 0); + if (n < HDR_SIZE) return refuse(v, R_LENGTH, 0); + if (CHECK(CHK_HDR_FLAGS) && g16(b + 6) != 0) return refuse(v, R_NONCANONICAL, 0); + if (CHECK(CHK_PRODUCER) && (g16(b + 40) == 0 || !subsys_name(g16(b + 40)))) return refuse(v, R_UNKNOWN, 0); + if (CHECK(CHK_HDR_RESERVED) && !all_zero(b + 42, 6)) return refuse(v, R_NONCANONICAL, 0); + memcpy(v->run_id, b + 8, 32); + sha2(b, HDR_SIZE, NULL, 0, prev); + o = HDR_SIZE; + + for (;;) { + const uint8_t *r, *id; + uint16_t type, sub; + uint32_t ilen, alen; + long rule; + uint64_t pos = seq + 1; + + /* 1. record header present */ + if (o == n) return refuse(v, CHECK(CHK_TRUNCATED) ? R_TRUNCATED : R_OK, pos); + if (n - o < REC_HDR_SIZE) return refuse(v, R_LENGTH, pos); + if (pos > MAX_RECS) return refuse(v, R_LENGTH, pos); + r = b + o; + type = g16(r); sub = g16(r + 2); ilen = g32(r + 4); alen = g32(r + 8); + /* 2. known type and subsystem */ + rule = ident_rule(type); + if (CHECK(CHK_TYPE) && rule == 0) return refuse(v, R_UNKNOWN, pos); + if (CHECK(CHK_SUBSYS) && !subsys_name(sub)) return refuse(v, R_UNKNOWN, pos); + /* 3. reserved */ + if (CHECK(CHK_REC_RESERVED) && g32(r + 12) != 0) return refuse(v, R_NONCANONICAL, pos); + /* 4. length limits */ + if (CHECK(CHK_LIMIT) && (ilen > MAX_IDENT || alen > MAX_ANNOT)) return refuse(v, R_LENGTH, pos); + /* 5. sequence */ + if (CHECK(CHK_SEQ) && g64(r + 16) != pos) return refuse(v, R_GAP, pos); + /* 6. chain */ + if (CHECK(CHK_PREV) && memcmp(r + 24, prev, 32) != 0) return refuse(v, R_CHAIN, pos); + /* 7. body present */ + if ((uint64_t)(n - o - REC_HDR_SIZE) < (uint64_t)ilen + alen) return refuse(v, R_LENGTH, pos); + id = r + REC_HDR_SIZE; + + /* 8. shape, then reserved fields, then embedded digests */ + if (CHECK(CHK_IDENT_LEN)) { + if (rule > 0 && ilen != (uint32_t)rule) return refuse(v, R_SHAPE, pos); + if (type == 11 && (ilen < 48 || ilen > 48 + MAX_CONTENT)) return refuse(v, R_SHAPE, pos); + if (type == 15 && ilen < 32) return refuse(v, R_SHAPE, pos); + } + if (CHECK(CHK_END_SUBSYS) && ((type == T_END) != (sub == 0))) return refuse(v, R_SHAPE, pos); + if (CHECK(CHK_CAP_OP) && type == 7 && (id[4] < 1 || id[4] > 6)) return refuse(v, R_SHAPE, pos); + if (CHECK(CHK_CRASH_SEQ) && type == 13 && g64(id + 8) >= pos) return refuse(v, R_SHAPE, pos); + if (CHECK(CHK_CRUMB_SHAPE) && type == 15 && ilen >= 32 && !crumb_shape(id + 32, ilen - 32)) return refuse(v, R_SHAPE, pos); + if (CHECK(CHK_ARGUS_FLAG) && type == 16 && id[128] > 1) return refuse(v, R_SHAPE, pos); + if (CHECK(CHK_END_ANNOT) && type == T_END && alen != 0) return refuse(v, R_SHAPE, pos); + if (CHECK(CHK_BODY_RESERVED)) { + int bad = 0; + switch (type) { + case 3: bad = g32(id + 20) != 0; break; + case 6: bad = g32(id + 4) != 0; break; + case 7: bad = !all_zero(id + 5, 3); break; + case 10: bad = g32(id + 12) != 0; break; + case 11: bad = g32(id + 4) != 0; break; + case 12: bad = g32(id + 4) != 0; break; + case 14: bad = g32(id + 4) != 0; break; + case 16: bad = !all_zero(id + 129, 7); break; + case T_END: bad = g64(id + 8) != 0; break; + } + if (bad) return refuse(v, R_NONCANONICAL, pos); + } + if (type == 15 && ilen >= 32) { + uint8_t d[32]; + sha2("AIEN_RX_CAUSAL_V1", 17, id + 32, ilen - 32, d); + if (CHECK(CHK_CRUMB_DIGEST) && memcmp(d, id, 32) != 0) return refuse(v, R_DIGEST, pos); + } + if (type == 11 && ilen > 48) { + uint8_t d[32]; + sha2(id + 48, ilen - 48, NULL, 0, d); + if (CHECK(CHK_INPUT_DIGEST) && memcmp(d, id + 16, 32) != 0) return refuse(v, R_DIGEST, pos); + } + if (type == 16) { + const uint8_t *before = id + 136, *after = id + 168; + if (CHECK(CHK_ARGUS_CONT) && have_argus && memcmp(before, argus_after, 32) != 0) + return refuse(v, R_DIGEST, pos); + if (CHECK(CHK_ARGUS_LINK)) { + uint8_t d[32]; + if (id[128]) sha2(before, 32, id, 128, d); else memcpy(d, before, 32); + if (memcmp(d, after, 32) != 0) return refuse(v, R_DIGEST, pos); + } + memcpy(argus_after, after, 32); + have_argus = 1; + } + + /* record digest (chain) and compared digest (replay) */ + sha2(r, REC_HDR_SIZE + (size_t)ilen + alen, NULL, 0, prev); + { + uint8_t h[16]; + sha256 s; + memcpy(h, r, 4); /* type, subsystem */ + memcpy(h + 4, r + 16, 8); /* seq */ + memcpy(h + 12, r + 4, 4); /* ident_len */ + sha_init(&s); + sha_update(&s, "AIEN_TRN1_CMP", 13); + sha_update(&s, h, 16); + sha_update(&s, id, ilen); + sha_final(&s, v->cmp[seq]); + v->subsys[seq] = sub; + } + o += REC_HDR_SIZE + (size_t)ilen + alen; + seq = pos; + + if (type == T_END) { + if (CHECK(CHK_END_COUNT) && g64(id) != pos) return refuse(v, R_GAP, pos); + if (CHECK(CHK_TRAILING) && o != n) return refuse(v, R_LENGTH, pos + 1); + v->records = pos; + memcpy(v->final_digest, prev, 32); + return R_OK; + } + } +} + +/* ---- output -------------------------------------------------------------- */ +static void hex(char *out, const uint8_t *d) { + for (int i = 0; i < 32; i++) sprintf(out + 2 * i, "%02x", d[i]); +} + +static void verdict_line(const Verdict *v, char *buf, size_t cap) { + if (v->code == R_OK) { + char rh[65], fh[65]; + hex(rh, v->run_id); hex(fh, v->final_digest); + snprintf(buf, cap, "ok records=%llu run=%s final=%s", (unsigned long long)v->records, rh, fh); + } else { + snprintf(buf, cap, "refuse %d event=%llu", v->code, (unsigned long long)v->event); + } +} + +static int compare_line(const Verdict *e, const Verdict *a, char *buf, size_t cap) { + if (e->code) { snprintf(buf, cap, "refuse expected %d event=%llu", e->code, (unsigned long long)e->event); return 1; } + if (a->code) { snprintf(buf, cap, "refuse actual %d event=%llu", a->code, (unsigned long long)a->event); return 1; } + uint64_t m = e->records < a->records ? e->records : a->records; + for (uint64_t i = 0; i < m; i++) { + if (memcmp(e->cmp[i], a->cmp[i], 32) != 0) { + char eh[65], ah[65]; + hex(eh, e->cmp[i]); hex(ah, a->cmp[i]); + snprintf(buf, cap, "DIVERGENCE event=%llu expected=%s actual=%s subsystem=%s", + (unsigned long long)(i + 1), eh, ah, subsys_name(e->subsys[i])); + return 1; + } + } + /* Both end in END at the same position with equal compared digests, so the + * counts are equal here (END's identity carries the count). */ + snprintf(buf, cap, "MATCH through %llu", (unsigned long long)m); + return 0; +} + +static uint8_t *slurp(const char *path, size_t *n) { + FILE *f = fopen(path, "rb"); + uint8_t *p = NULL; + size_t cap = 0, len = 0, k; + if (!f) return NULL; + do { + if (len == cap) { + uint8_t *q = realloc(p, cap = cap ? cap * 2 : 4096); + if (!q) { free(p); fclose(f); return NULL; } + p = q; + } + k = fread(p + len, 1, cap - len, f); + len += k; + } while (k); + fclose(f); + *n = len; + return p ? p : calloc(1, 1); +} + +static int load(const char *path, Verdict *v) { + size_t n; + uint8_t *b = slurp(path, &n); + if (!b) { fprintf(stderr, "cannot read %s\n", path); exit(2); } + verify(b, n, v); + free(b); + return v->code; +} +static void drop(Verdict *v) { free(v->cmp); free(v->subsys); } + +static void rstrip(char *s) { size_t n = strlen(s); while (n && (s[n-1] == '\n' || s[n-1] == '\r')) s[--n] = 0; } + +static int corpus(const char *dir) { + char path[4096], line[8192], got[512]; + unsigned pass = 0, fail = 0; + FILE *f; + + snprintf(path, sizeof path, "%s/expected.txt", dir); + if (!(f = fopen(path, "r"))) { fprintf(stderr, "cannot read %s\n", path); return 2; } + while (fgets(line, sizeof line, f)) { + char *sp; + Verdict v; + rstrip(line); + if (!line[0] || line[0] == '#') continue; + if (!(sp = strchr(line, ' '))) { fprintf(stderr, "bad line: %s\n", line); fail++; continue; } + *sp = 0; + snprintf(path, sizeof path, "%s/%s", dir, line); + load(path, &v); + verdict_line(&v, got, sizeof got); + drop(&v); + if (strcmp(got, sp + 1) == 0) pass++; + else { fail++; printf("MISMATCH %s\n expected: %s\n got: %s\n", line, sp + 1, got); } + } + fclose(f); + + snprintf(path, sizeof path, "%s/compare.txt", dir); + if (!(f = fopen(path, "r"))) { fprintf(stderr, "cannot read %s\n", path); return 2; } + while (fgets(line, sizeof line, f)) { + char *s1, *s2, p2[4096]; + Verdict e, a; + rstrip(line); + if (!line[0] || line[0] == '#') continue; + if (!(s1 = strchr(line, ' ')) || !(s2 = strchr(s1 + 1, ' '))) { fprintf(stderr, "bad line: %s\n", line); fail++; continue; } + *s1 = 0; *s2 = 0; + snprintf(path, sizeof path, "%s/%s", dir, line); + snprintf(p2, sizeof p2, "%s/%s", dir, s1 + 1); + load(path, &e); load(p2, &a); + compare_line(&e, &a, got, sizeof got); + drop(&e); drop(&a); + if (strcmp(got, s2 + 1) == 0) pass++; + else { fail++; printf("MISMATCH %s %s\n expected: %s\n got: %s\n", line, s1 + 1, s2 + 1, got); } + } + fclose(f); + printf("TRN1_CONFORMANCE impl=c pass=%u fail=%u\n", pass, fail); + return fail || !pass ? 1 : 0; +} + +int main(int argc, char **argv) { + char out[512]; + if (argc == 2 && argv[1][0] != '-') { + Verdict v; + int rc = load(argv[1], &v); + verdict_line(&v, out, sizeof out); + puts(out); + drop(&v); + return rc ? 1 : 0; + } + if (argc == 4 && strcmp(argv[1], "--compare") == 0) { + Verdict e, a; + int rc; + load(argv[2], &e); load(argv[3], &a); + rc = compare_line(&e, &a, out, sizeof out); + puts(out); + drop(&e); drop(&a); + return rc; + } + if (argc == 3 && strcmp(argv[1], "--corpus") == 0) return corpus(argv[2]); + fprintf(stderr, "usage: trn1_verify FILE | --compare EXP ACT | --corpus DIR\n"); + return 2; +} diff --git a/specs/execution-transcript/vectors/.gitattributes b/specs/execution-transcript/vectors/.gitattributes new file mode 100644 index 0000000..22eb2cb --- /dev/null +++ b/specs/execution-transcript/vectors/.gitattributes @@ -0,0 +1 @@ +*.trn binary diff --git a/specs/execution-transcript/vectors/compare.txt b/specs/execution-transcript/vectors/compare.txt new file mode 100644 index 0000000..84e7c1f --- /dev/null +++ b/specs/execution-transcript/vectors/compare.txt @@ -0,0 +1,16 @@ +# TRN1 replay comparison pairs. Spec section 8. +# Line: <expected file> <actual file> MATCH through N +# or: <expected file> <actual file> DIVERGENCE event=N expected=<64 hex> actual=<64 hex> subsystem=<name> +# or: <expected file> <actual file> refuse expected|actual <code> event=N +# Generated by tools/make-corpus.sh; do not edit by hand. +g001.trn g005.trn MATCH through 11 +g001.trn g001.trn MATCH through 11 +g002.trn g002.trn MATCH through 6 +g001.trn f001.trn DIVERGENCE event=3 expected=d8b161d5d091c356fea1e485e1b7f871a0635a6a4cd41112872f04835379cbc2 actual=24b56d5388431e2f5d5607fa8e9217274ac9b3c1f39f7f9765059650cd1f8570 subsystem=omega-world +g001.trn f002.trn DIVERGENCE event=3 expected=d8b161d5d091c356fea1e485e1b7f871a0635a6a4cd41112872f04835379cbc2 actual=24b56d5388431e2f5d5607fa8e9217274ac9b3c1f39f7f9765059650cd1f8570 subsystem=omega-world +g001.trn f003.trn DIVERGENCE event=1 expected=5ae4d27d41ef6e1e372363e1a05693426a6ab439c07371f9d566d930a59c60fe actual=91b829fdb1bc0ffd019b310110053fe9a1d930079216130ca1213114ccad6379 subsystem=omega-world +g001.trn f004.trn DIVERGENCE event=6 expected=a731fd198172bb345490827dfe2d3c4f5db41ec179c633d1e10a8d4b12564125 actual=a3fdfe68305051f8f35d1d1525f045195c6c37c7ccdbabc1867e2e1c4abede18 subsystem=omega-world +g001.trn f005.trn DIVERGENCE event=11 expected=527723c59673130672775773c5c0915ca83f0fdb7b217421990b84deafbc9e3a actual=6e4432578f1a8507f8ab918a2a95df704f1b7ca76fbe5f2d565d9fe7ed63c0c7 subsystem=transcript +g001.trn f006.trn DIVERGENCE event=6 expected=a731fd198172bb345490827dfe2d3c4f5db41ec179c633d1e10a8d4b12564125 actual=b6877b58278d02422bdac96fd2e85eca59d1975635f97c2f2d6f5e2b079cd112 subsystem=omega-world +g001.trn m001.trn refuse actual -7 event=3 +m008.trn g001.trn refuse expected -1 event=0 diff --git a/specs/execution-transcript/vectors/expected.txt b/specs/execution-transcript/vectors/expected.txt new file mode 100644 index 0000000..ca9c84c --- /dev/null +++ b/specs/execution-transcript/vectors/expected.txt @@ -0,0 +1,72 @@ +# TRN1 shared conformance corpus. Spec: TRN1_TRANSCRIPT_SPEC.md (contract 0.1.0, wire schema 1). +# Line: <file> ok records=N run=<64 hex> final=<64 hex> +# or: <file> refuse <code> event=<record position, 0 = file header> +# codes: -1 MAGIC -2 VERSION -3 LENGTH -4 NONCANONICAL -5 UNKNOWN -6 SHAPE +# -7 GAP -8 CHAIN -9 DIGEST -10 TRUNCATED +# Generated by tools/make-corpus.sh; do not edit by hand. +g001.trn ok records=11 run=6c2bc4d0bb8d7451ab2759374381a399a454a13302362dc00fb692398752be31 final=31b369e23358b131e85f6edb79ab013728430a84b66ecb8afa92fd4c31fe010c +g005.trn ok records=11 run=dc704406afc636c2ee75e7406d409fd4f2ad64a965205b1cdc9e851b66d0f135 final=9d249efbb38aee4d9b025f03d523d92bfec1797aa299c1824a406d02822ded54 +g002.trn ok records=6 run=d38578cdea20f67d42b7c1ca28a00195f1b6e4a9dbb5caa2d7af8d74e026fb0d final=9b546eb958ac20e51208a60da0c5790ef2d5ddf410d67f68cdcbda1e004b7a3f +g003.trn ok records=11 run=d209508d37a39d1c7ae75374101e5045d69bdae83525932a46e923cfe9634598 final=12b2160de0ba690a8452f4e8a15a72d3638f2a388e38a767f657a5797e2b6e49 +g004.trn ok records=1 run=93ad24a9adbb64bb96e8a110eda9935610425a246e60570cfcc671941005312c final=273dfe04aa8fe27b0d3c0869b6ea5a80a7ee542ebc8a70a67ecf494f0c588507 +p001.trn ok records=2 run=9cdc3d6282cb871e7f031da77355fa448e1522a1d027c9561c58f00eec5b503d final=d9934456b574a77c82e20481766bd61c29695cc86c63dd3b67df218d32aeee3a +p002.trn ok records=2 run=fb77217b150ec6735c40efcc17e94695f44dc9643c64abfeb0a6f3943b5a13ec final=1de98598788de01549bc96cde609c8b2d85dd117b395227247db880ef61a5fee +f001.trn ok records=10 run=6c2bc4d0bb8d7451ab2759374381a399a454a13302362dc00fb692398752be31 final=a10c390960b9facdc2a273a1440857a25ecd44dc0f783db2cb22718e6eab5da8 +f002.trn ok records=11 run=6c2bc4d0bb8d7451ab2759374381a399a454a13302362dc00fb692398752be31 final=baad4e0df1a65044360e191e8e798d25fc14342a8e225112e862fee99eaf4ca5 +f003.trn ok records=2 run=6c2bc4d0bb8d7451ab2759374381a399a454a13302362dc00fb692398752be31 final=407613162d38ab0842e7a0df37e7a39dbd3319926012299023eb31f5d33c1401 +f004.trn ok records=7 run=6c2bc4d0bb8d7451ab2759374381a399a454a13302362dc00fb692398752be31 final=0146edf498dcd308ae9ab4f6df739f10f2baa4be32da879a9763fab267ba6086 +f005.trn ok records=12 run=6c2bc4d0bb8d7451ab2759374381a399a454a13302362dc00fb692398752be31 final=e9960f89292f0af3027780bcb7d92d2451653f519ee9f506b172cc5845273e86 +f006.trn ok records=6 run=6c2bc4d0bb8d7451ab2759374381a399a454a13302362dc00fb692398752be31 final=b00e73f0e1c0cc7f7438cc6eba267a89584cab674dd5ebc8bd6e373975f6c600 +m001.trn refuse -7 event=3 +m002.trn refuse -7 event=3 +m003.trn refuse -8 event=5 +m004.trn refuse -8 event=4 +m005.trn refuse -8 event=2 +m006.trn refuse -7 event=6 +m007.trn refuse -8 event=1 +m008.trn refuse -1 event=0 +m009.trn refuse -3 event=5 +m010.trn refuse -10 event=11 +m011.trn refuse -3 event=0 +m012.trn refuse -3 event=0 +m013.trn refuse -3 event=11 +m014.trn refuse -3 event=12 +m015.trn refuse -7 event=4 +m016.trn refuse -9 event=5 +m017.trn refuse -8 event=11 +m018.trn refuse -7 event=11 +m020.trn refuse -2 event=0 +m021.trn refuse -2 event=0 +m022.trn refuse -4 event=0 +m023.trn refuse -5 event=0 +m024.trn refuse -5 event=0 +m025.trn refuse -4 event=0 +m030.trn refuse -5 event=1 +m031.trn refuse -5 event=1 +m032.trn refuse -4 event=1 +m033.trn refuse -7 event=1 +m034.trn refuse -8 event=1 +m035.trn refuse -5 event=1 +m036.trn refuse -7 event=1 +m037.trn refuse -3 event=1 +m040.trn refuse -6 event=1 +m041.trn refuse -6 event=1 +m042.trn refuse -6 event=1 +m043.trn refuse -6 event=1 +m044.trn refuse -6 event=1 +m045.trn refuse -6 event=1 +m046.trn refuse -6 event=1 +m047.trn refuse -6 event=1 +m048.trn refuse -6 event=1 +m049.trn refuse -6 event=1 +m050.trn refuse -6 event=1 +m055.trn refuse -4 event=1 +m056.trn refuse -4 event=1 +m057.trn refuse -4 event=1 +m058.trn refuse -7 event=2 +m060.trn refuse -9 event=1 +m061.trn refuse -9 event=1 +m062.trn refuse -9 event=1 +m063.trn refuse -9 event=2 +m064.trn refuse -9 event=1 +m065.trn refuse -9 event=2 diff --git a/specs/execution-transcript/vectors/f001.trn b/specs/execution-transcript/vectors/f001.trn new file mode 100644 index 0000000..b324e17 Binary files /dev/null and b/specs/execution-transcript/vectors/f001.trn differ diff --git a/specs/execution-transcript/vectors/f002.trn b/specs/execution-transcript/vectors/f002.trn new file mode 100644 index 0000000..7dbb2ea Binary files /dev/null and b/specs/execution-transcript/vectors/f002.trn differ diff --git a/specs/execution-transcript/vectors/f003.trn b/specs/execution-transcript/vectors/f003.trn new file mode 100644 index 0000000..321adea Binary files /dev/null and b/specs/execution-transcript/vectors/f003.trn differ diff --git a/specs/execution-transcript/vectors/f004.trn b/specs/execution-transcript/vectors/f004.trn new file mode 100644 index 0000000..bc88369 Binary files /dev/null and b/specs/execution-transcript/vectors/f004.trn differ diff --git a/specs/execution-transcript/vectors/f005.trn b/specs/execution-transcript/vectors/f005.trn new file mode 100644 index 0000000..adec2a3 Binary files /dev/null and b/specs/execution-transcript/vectors/f005.trn differ diff --git a/specs/execution-transcript/vectors/f006.trn b/specs/execution-transcript/vectors/f006.trn new file mode 100644 index 0000000..199c87b Binary files /dev/null and b/specs/execution-transcript/vectors/f006.trn differ diff --git a/specs/execution-transcript/vectors/g001.trn b/specs/execution-transcript/vectors/g001.trn new file mode 100644 index 0000000..4f3bfed Binary files /dev/null and b/specs/execution-transcript/vectors/g001.trn differ diff --git a/specs/execution-transcript/vectors/g002.trn b/specs/execution-transcript/vectors/g002.trn new file mode 100644 index 0000000..63d0cb5 Binary files /dev/null and b/specs/execution-transcript/vectors/g002.trn differ diff --git a/specs/execution-transcript/vectors/g003.trn b/specs/execution-transcript/vectors/g003.trn new file mode 100644 index 0000000..5836103 Binary files /dev/null and b/specs/execution-transcript/vectors/g003.trn differ diff --git a/specs/execution-transcript/vectors/g004.trn b/specs/execution-transcript/vectors/g004.trn new file mode 100644 index 0000000..1e64b6f Binary files /dev/null and b/specs/execution-transcript/vectors/g004.trn differ diff --git a/specs/execution-transcript/vectors/g005.trn b/specs/execution-transcript/vectors/g005.trn new file mode 100644 index 0000000..d702fce Binary files /dev/null and b/specs/execution-transcript/vectors/g005.trn differ diff --git a/specs/execution-transcript/vectors/m001.trn b/specs/execution-transcript/vectors/m001.trn new file mode 100644 index 0000000..684b9c8 Binary files /dev/null and b/specs/execution-transcript/vectors/m001.trn differ diff --git a/specs/execution-transcript/vectors/m002.trn b/specs/execution-transcript/vectors/m002.trn new file mode 100644 index 0000000..104a7c1 Binary files /dev/null and b/specs/execution-transcript/vectors/m002.trn differ diff --git a/specs/execution-transcript/vectors/m003.trn b/specs/execution-transcript/vectors/m003.trn new file mode 100644 index 0000000..20b3c33 Binary files /dev/null and b/specs/execution-transcript/vectors/m003.trn differ diff --git a/specs/execution-transcript/vectors/m004.trn b/specs/execution-transcript/vectors/m004.trn new file mode 100644 index 0000000..ecf59d3 Binary files /dev/null and b/specs/execution-transcript/vectors/m004.trn differ diff --git a/specs/execution-transcript/vectors/m005.trn b/specs/execution-transcript/vectors/m005.trn new file mode 100644 index 0000000..c19f89d Binary files /dev/null and b/specs/execution-transcript/vectors/m005.trn differ diff --git a/specs/execution-transcript/vectors/m006.trn b/specs/execution-transcript/vectors/m006.trn new file mode 100644 index 0000000..a66212b Binary files /dev/null and b/specs/execution-transcript/vectors/m006.trn differ diff --git a/specs/execution-transcript/vectors/m007.trn b/specs/execution-transcript/vectors/m007.trn new file mode 100644 index 0000000..b254c17 Binary files /dev/null and b/specs/execution-transcript/vectors/m007.trn differ diff --git a/specs/execution-transcript/vectors/m008.trn b/specs/execution-transcript/vectors/m008.trn new file mode 100644 index 0000000..50dceba Binary files /dev/null and b/specs/execution-transcript/vectors/m008.trn differ diff --git a/specs/execution-transcript/vectors/m009.trn b/specs/execution-transcript/vectors/m009.trn new file mode 100644 index 0000000..80a4172 Binary files /dev/null and b/specs/execution-transcript/vectors/m009.trn differ diff --git a/specs/execution-transcript/vectors/m010.trn b/specs/execution-transcript/vectors/m010.trn new file mode 100644 index 0000000..6ed483e Binary files /dev/null and b/specs/execution-transcript/vectors/m010.trn differ diff --git a/specs/execution-transcript/vectors/m011.trn b/specs/execution-transcript/vectors/m011.trn new file mode 100644 index 0000000..59eaa75 Binary files /dev/null and b/specs/execution-transcript/vectors/m011.trn differ diff --git a/specs/execution-transcript/vectors/m012.trn b/specs/execution-transcript/vectors/m012.trn new file mode 100644 index 0000000..e69de29 diff --git a/specs/execution-transcript/vectors/m013.trn b/specs/execution-transcript/vectors/m013.trn new file mode 100644 index 0000000..48951f1 Binary files /dev/null and b/specs/execution-transcript/vectors/m013.trn differ diff --git a/specs/execution-transcript/vectors/m014.trn b/specs/execution-transcript/vectors/m014.trn new file mode 100644 index 0000000..2c7d00d Binary files /dev/null and b/specs/execution-transcript/vectors/m014.trn differ diff --git a/specs/execution-transcript/vectors/m015.trn b/specs/execution-transcript/vectors/m015.trn new file mode 100644 index 0000000..35bfdcd Binary files /dev/null and b/specs/execution-transcript/vectors/m015.trn differ diff --git a/specs/execution-transcript/vectors/m016.trn b/specs/execution-transcript/vectors/m016.trn new file mode 100644 index 0000000..27dae74 Binary files /dev/null and b/specs/execution-transcript/vectors/m016.trn differ diff --git a/specs/execution-transcript/vectors/m017.trn b/specs/execution-transcript/vectors/m017.trn new file mode 100644 index 0000000..cd53880 Binary files /dev/null and b/specs/execution-transcript/vectors/m017.trn differ diff --git a/specs/execution-transcript/vectors/m018.trn b/specs/execution-transcript/vectors/m018.trn new file mode 100644 index 0000000..cf30f34 Binary files /dev/null and b/specs/execution-transcript/vectors/m018.trn differ diff --git a/specs/execution-transcript/vectors/m020.trn b/specs/execution-transcript/vectors/m020.trn new file mode 100644 index 0000000..cf7648c Binary files /dev/null and b/specs/execution-transcript/vectors/m020.trn differ diff --git a/specs/execution-transcript/vectors/m021.trn b/specs/execution-transcript/vectors/m021.trn new file mode 100644 index 0000000..50295e5 Binary files /dev/null and b/specs/execution-transcript/vectors/m021.trn differ diff --git a/specs/execution-transcript/vectors/m022.trn b/specs/execution-transcript/vectors/m022.trn new file mode 100644 index 0000000..47daf0c Binary files /dev/null and b/specs/execution-transcript/vectors/m022.trn differ diff --git a/specs/execution-transcript/vectors/m023.trn b/specs/execution-transcript/vectors/m023.trn new file mode 100644 index 0000000..e4ff222 Binary files /dev/null and b/specs/execution-transcript/vectors/m023.trn differ diff --git a/specs/execution-transcript/vectors/m024.trn b/specs/execution-transcript/vectors/m024.trn new file mode 100644 index 0000000..e12da7f Binary files /dev/null and b/specs/execution-transcript/vectors/m024.trn differ diff --git a/specs/execution-transcript/vectors/m025.trn b/specs/execution-transcript/vectors/m025.trn new file mode 100644 index 0000000..1db78f8 Binary files /dev/null and b/specs/execution-transcript/vectors/m025.trn differ diff --git a/specs/execution-transcript/vectors/m030.trn b/specs/execution-transcript/vectors/m030.trn new file mode 100644 index 0000000..25021cd Binary files /dev/null and b/specs/execution-transcript/vectors/m030.trn differ diff --git a/specs/execution-transcript/vectors/m031.trn b/specs/execution-transcript/vectors/m031.trn new file mode 100644 index 0000000..8f7a247 Binary files /dev/null and b/specs/execution-transcript/vectors/m031.trn differ diff --git a/specs/execution-transcript/vectors/m032.trn b/specs/execution-transcript/vectors/m032.trn new file mode 100644 index 0000000..2ceffcb Binary files /dev/null and b/specs/execution-transcript/vectors/m032.trn differ diff --git a/specs/execution-transcript/vectors/m033.trn b/specs/execution-transcript/vectors/m033.trn new file mode 100644 index 0000000..c5b8447 Binary files /dev/null and b/specs/execution-transcript/vectors/m033.trn differ diff --git a/specs/execution-transcript/vectors/m034.trn b/specs/execution-transcript/vectors/m034.trn new file mode 100644 index 0000000..2b7f9dc Binary files /dev/null and b/specs/execution-transcript/vectors/m034.trn differ diff --git a/specs/execution-transcript/vectors/m035.trn b/specs/execution-transcript/vectors/m035.trn new file mode 100644 index 0000000..3b805da Binary files /dev/null and b/specs/execution-transcript/vectors/m035.trn differ diff --git a/specs/execution-transcript/vectors/m036.trn b/specs/execution-transcript/vectors/m036.trn new file mode 100644 index 0000000..44f6d41 Binary files /dev/null and b/specs/execution-transcript/vectors/m036.trn differ diff --git a/specs/execution-transcript/vectors/m037.trn b/specs/execution-transcript/vectors/m037.trn new file mode 100644 index 0000000..bdc418d Binary files /dev/null and b/specs/execution-transcript/vectors/m037.trn differ diff --git a/specs/execution-transcript/vectors/m040.trn b/specs/execution-transcript/vectors/m040.trn new file mode 100644 index 0000000..2bb3a94 Binary files /dev/null and b/specs/execution-transcript/vectors/m040.trn differ diff --git a/specs/execution-transcript/vectors/m041.trn b/specs/execution-transcript/vectors/m041.trn new file mode 100644 index 0000000..b5cb291 Binary files /dev/null and b/specs/execution-transcript/vectors/m041.trn differ diff --git a/specs/execution-transcript/vectors/m042.trn b/specs/execution-transcript/vectors/m042.trn new file mode 100644 index 0000000..9d49aea Binary files /dev/null and b/specs/execution-transcript/vectors/m042.trn differ diff --git a/specs/execution-transcript/vectors/m043.trn b/specs/execution-transcript/vectors/m043.trn new file mode 100644 index 0000000..9e797be Binary files /dev/null and b/specs/execution-transcript/vectors/m043.trn differ diff --git a/specs/execution-transcript/vectors/m044.trn b/specs/execution-transcript/vectors/m044.trn new file mode 100644 index 0000000..f09077e Binary files /dev/null and b/specs/execution-transcript/vectors/m044.trn differ diff --git a/specs/execution-transcript/vectors/m045.trn b/specs/execution-transcript/vectors/m045.trn new file mode 100644 index 0000000..710cc02 Binary files /dev/null and b/specs/execution-transcript/vectors/m045.trn differ diff --git a/specs/execution-transcript/vectors/m046.trn b/specs/execution-transcript/vectors/m046.trn new file mode 100644 index 0000000..a4592ee Binary files /dev/null and b/specs/execution-transcript/vectors/m046.trn differ diff --git a/specs/execution-transcript/vectors/m047.trn b/specs/execution-transcript/vectors/m047.trn new file mode 100644 index 0000000..cb3fb66 Binary files /dev/null and b/specs/execution-transcript/vectors/m047.trn differ diff --git a/specs/execution-transcript/vectors/m048.trn b/specs/execution-transcript/vectors/m048.trn new file mode 100644 index 0000000..1fe5167 Binary files /dev/null and b/specs/execution-transcript/vectors/m048.trn differ diff --git a/specs/execution-transcript/vectors/m049.trn b/specs/execution-transcript/vectors/m049.trn new file mode 100644 index 0000000..1799139 Binary files /dev/null and b/specs/execution-transcript/vectors/m049.trn differ diff --git a/specs/execution-transcript/vectors/m050.trn b/specs/execution-transcript/vectors/m050.trn new file mode 100644 index 0000000..dbbd556 Binary files /dev/null and b/specs/execution-transcript/vectors/m050.trn differ diff --git a/specs/execution-transcript/vectors/m055.trn b/specs/execution-transcript/vectors/m055.trn new file mode 100644 index 0000000..8a3c336 Binary files /dev/null and b/specs/execution-transcript/vectors/m055.trn differ diff --git a/specs/execution-transcript/vectors/m056.trn b/specs/execution-transcript/vectors/m056.trn new file mode 100644 index 0000000..5276407 Binary files /dev/null and b/specs/execution-transcript/vectors/m056.trn differ diff --git a/specs/execution-transcript/vectors/m057.trn b/specs/execution-transcript/vectors/m057.trn new file mode 100644 index 0000000..eecfd6a Binary files /dev/null and b/specs/execution-transcript/vectors/m057.trn differ diff --git a/specs/execution-transcript/vectors/m058.trn b/specs/execution-transcript/vectors/m058.trn new file mode 100644 index 0000000..cbf743c Binary files /dev/null and b/specs/execution-transcript/vectors/m058.trn differ diff --git a/specs/execution-transcript/vectors/m060.trn b/specs/execution-transcript/vectors/m060.trn new file mode 100644 index 0000000..dfb8686 Binary files /dev/null and b/specs/execution-transcript/vectors/m060.trn differ diff --git a/specs/execution-transcript/vectors/m061.trn b/specs/execution-transcript/vectors/m061.trn new file mode 100644 index 0000000..b23ef13 Binary files /dev/null and b/specs/execution-transcript/vectors/m061.trn differ diff --git a/specs/execution-transcript/vectors/m062.trn b/specs/execution-transcript/vectors/m062.trn new file mode 100644 index 0000000..b7038fc Binary files /dev/null and b/specs/execution-transcript/vectors/m062.trn differ diff --git a/specs/execution-transcript/vectors/m063.trn b/specs/execution-transcript/vectors/m063.trn new file mode 100644 index 0000000..0c13927 Binary files /dev/null and b/specs/execution-transcript/vectors/m063.trn differ diff --git a/specs/execution-transcript/vectors/m064.trn b/specs/execution-transcript/vectors/m064.trn new file mode 100644 index 0000000..0f49bc0 Binary files /dev/null and b/specs/execution-transcript/vectors/m064.trn differ diff --git a/specs/execution-transcript/vectors/m065.trn b/specs/execution-transcript/vectors/m065.trn new file mode 100644 index 0000000..3619ca3 Binary files /dev/null and b/specs/execution-transcript/vectors/m065.trn differ diff --git a/specs/execution-transcript/vectors/p001.trn b/specs/execution-transcript/vectors/p001.trn new file mode 100644 index 0000000..f6f6191 Binary files /dev/null and b/specs/execution-transcript/vectors/p001.trn differ diff --git a/specs/execution-transcript/vectors/p002.trn b/specs/execution-transcript/vectors/p002.trn new file mode 100644 index 0000000..2704b63 Binary files /dev/null and b/specs/execution-transcript/vectors/p002.trn differ diff --git a/specs/inference/.crumb b/specs/inference/.crumb new file mode 100644 index 0000000..19c21f0 --- /dev/null +++ b/specs/inference/.crumb @@ -0,0 +1,19 @@ +{ + "schema_version": "1.0.0", + "name": "specs/inference", + "layer": "specs/inference", + "purpose": "Directory specs/inference. Purpose not yet described by a human.", + "above": { + "name": "specs", + "path": ".." + }, + "extensions": { + "seed": { + "purpose_auto": "Directory specs/inference. Purpose not yet described by a human.", + "files": [ + "SPEC.md" + ] + }, + "owner_lane": "" + } +}