diff --git a/crates/aienos-kernel/src/continuity.rs b/crates/aienos-kernel/src/continuity.rs index 16c6371..fef7118 100644 --- a/crates/aienos-kernel/src/continuity.rs +++ b/crates/aienos-kernel/src/continuity.rs @@ -466,7 +466,7 @@ impl AgentState { Some(p) => { let parent = self.branch(&p).ok_or(bad("parent branch is absent"))?; // Scan capped at MAX_BRANCHES, as in the C codec - // (continuity_codec.c:463-475): `forks` is input-controlled, + // (cc_state_validate in continuity_codec.c): `forks` is input-controlled, // so an uncapped scan lets a hostile table spin for up to // 2^64 hashes. A table that passes the fork-sum check below // has every forks <= 255, so the cap changes no outcome for @@ -485,7 +485,7 @@ impl AgentState { // overflow checks on, so a plain `.sum()` would wrap and accept e.g. // {root forks = 2^64-1, child forks = 2}. An overflowing sum can never // equal `children` (<= 255), so it is refused with the same class and - // text as the C codec (native/kernel/svc/continuity_codec.c:482-491). + // text as the C codec (cc_state_validate in native/kernel/svc/continuity_codec.c). let forks = self .branches .iter() @@ -886,3 +886,8 @@ pub fn resume(store: &mut Store) -> Result<(Continuity, bool) #[cfg(test)] #[path = "continuity_tests.rs"] mod tests; + +/// D-1/D-2 golden-vector emitter for the C codec (test-only). +#[cfg(test)] +#[path = "continuity_vectors.rs"] +mod continuity_vectors; diff --git a/crates/aienos-kernel/src/continuity_tests.rs b/crates/aienos-kernel/src/continuity_tests.rs index a479975..8a11a10 100644 --- a/crates/aienos-kernel/src/continuity_tests.rs +++ b/crates/aienos-kernel/src/continuity_tests.rs @@ -356,7 +356,7 @@ fn wrapping_fork_sum_is_refused_like_the_c_codec() { // {root forks = 2^64-1, child index 0 forks = 2}: the u64 sum wraps to 1, // which equals the one child. With a plain `.sum()` a --release build // (overflow checks off) accepts this table; the C codec refuses it - // (continuity_codec.c:482-491). The oracle must refuse as well. + // (cc_state_validate, native/kernel/svc/continuity_codec.c). The oracle must refuse as well. let mut state = AgentState::genesis(AGENT, 1); let root = root_branch_id(&AGENT); let child = state.fork(&root).unwrap(); @@ -420,8 +420,8 @@ fn branch_table_at_the_maximum_legal_fork_sum_is_accepted() { fn huge_fork_count_with_underivable_child_is_refused_without_spinning() { // Root forks = 2^64-1 and a child whose id is no derived index: an // uncapped `0..forks` scan would run ~2^64 hashes. Capped at MAX_BRANCHES - // like C (continuity_codec.c:468), it is refused after <= 256 hashes with - // C's class and text (continuity_codec.c:474-479). + // like C (cc_state_validate), it is refused after <= 256 hashes with + // C's class and text (cc_state_validate). let root = root_branch_id(&AGENT); let rogue = [0x77u8; 32]; assert!((0..MAX_BRANCHES as u64).all(|i| child_branch_id(&root, i) != rogue)); diff --git a/crates/aienos-kernel/src/continuity_vectors.rs b/crates/aienos-kernel/src/continuity_vectors.rs new file mode 100644 index 0000000..87c89ff --- /dev/null +++ b/crates/aienos-kernel/src/continuity_vectors.rs @@ -0,0 +1,335 @@ +//! D-1 / D-2 golden vectors for the C continuity codec (contract +//! native/kernel/CONTINUITY_RECOVERY_CONTRACT.md 6.3, aienos#222, cut 2). +//! +//! TEST-ONLY emitter: nothing here is compiled outside `cfg(test)` and it +//! changes no kernel behaviour. It writes two plain-text fixtures under +//! `native/kernel/tests/fixtures/`: +//! +//! * `continuity_vectors.txt`: canonical bytes and logical ObjectIds (D-1). +//! * `continuity_verdicts.txt`: for every vector, the Rust decode verdict of +//! the untouched bytes and of every single-bit flip (D-2). +//! +//! The C host test (`native/kernel/tests/test_continuity_codec.c`) reads both +//! files and must reproduce every byte, every ObjectId and every verdict. +//! +//! Regenerate (the only command): +//! AIENOS_CONTINUITY_VECTORS_REGEN=1 cargo test -p aienos-kernel --lib continuity_vectors +//! Without the variable the test fails if a committed fixture differs from +//! freshly emitted bytes, so the fixtures cannot drift from the oracle. + +use super::*; +use crate::recovery::OperatorAuth; +use crate::recovery_core::{Action, SlotView, SystemRecord}; +use crate::store::engine::{MountState, PeerCondition}; +use alloc::format; +use alloc::string::String; + +const AGENT: [u8; 32] = [0x11; 32]; +const UUID: [u8; 16] = [0x5a; 16]; +/// The same TEST operator key recovery_core_tests.rs uses (OPERATOR). +const TEST_KEY: [u8; 32] = [0x0f; 32]; + +/// Every decode refusal text continuity.rs can return, as (code, class, why). +/// A reason missing from this table makes the emitter panic, so a new Rust +/// reason can never be silently dropped from the D-2 comparison. +const REASONS: &[(char, &str, &str)] = &[ + ('a', "Corrupt", "bad magic"), + ('b', "Corrupt", "unsupported continuity format version"), + ('c', "Corrupt", "nonzero header reserved"), + ('d', "Corrupt", "body length mismatch"), + ('e', "Corrupt", "truncated object"), + ('f', "Corrupt", "nonzero reserved"), + ('g', "Corrupt", "trailing bytes"), + ('h', "Corrupt", "unknown provisioning source"), + ('i', "Corrupt", "zero agent id"), + ('j', "Corrupt", "root branch does not derive from agent"), + ('k', "Corrupt", "too many cortex WAL segments"), + ('l', "Corrupt", "manifest sequence/previous mismatch"), + ('m', "Corrupt", "branch count out of range"), + ('n', "Corrupt", "branches not strictly sorted"), + ('o', "Corrupt", "unexpected root branch"), + ('p', "Corrupt", "parent branch is absent"), + ('q', "Corrupt", "branch lineage is inconsistent"), + ('r', "Corrupt", "fork indexes are not contiguous"), + ('s', "Corrupt", "WAL segment record count"), + ('t', "Corrupt", "unknown epistemic status"), + ('u', "Corrupt", "statement length"), +]; + +fn hex(b: &[u8]) -> String { + let mut s = String::with_capacity(b.len() * 2); + for x in b { + s.push_str(&format!("{x:02x}")); + } + s +} + +fn verdict(kind: u16, bytes: &[u8]) -> char { + let r = match kind { + KIND_AGENT_ROOT => AgentRoot::decode(bytes).map(|_| ()), + KIND_MANIFEST => Manifest::decode(bytes).map(|_| ()), + KIND_AGENT_STATE => AgentState::decode(bytes).map(|_| ()), + KIND_CORTEX_WAL => WalSegment::decode(bytes).map(|_| ()), + _ => panic!("unknown kind"), + }; + match r { + Ok(()) => '.', + Err(ContinuityError::Corrupt(w)) => { + REASONS + .iter() + .find(|(_, c, t)| *c == "Corrupt" && *t == w) + .unwrap_or_else(|| panic!("reason not in REASONS: {w}")) + .0 + } + Err(ContinuityError::Limit(w)) => { + REASONS + .iter() + .find(|(_, c, t)| *c == "Limit" && *t == w) + .unwrap_or_else(|| panic!("reason not in REASONS: {w}")) + .0 + } + Err(e) => panic!("decode returned a non-codec error: {e:?}"), + } +} + +fn root(source: ProvisionSource) -> Vec { + AgentRoot { + agent_id: AGENT, + store_uuid: UUID, + root_branch: root_branch_id(&AGENT), + provisioned_generation: 0x0102030405060708, + source, + } + .encode() +} + +fn manifest(n_wal: usize, sequence: u64) -> Vec { + Manifest { + root: ObjectId([0xa1; 32]), + previous: (sequence > 1).then_some(ObjectId([0xd4; 32])), + sequence, + incarnation: 1, + agent_state: Some(ObjectId([0xb2; 32])), + cortex_wal: (0..n_wal).map(|i| ObjectId([i as u8 + 1; 32])).collect(), + } + .encode() + .unwrap() +} + +fn wal(status: Epistemic, len: usize) -> Vec { + WalSegment { + sequence: 3, + records: alloc::vec![CortexRecord { + status, + evidence_hash: [0x40 + status as u8; 32], + statement: (0..len).map(|i| b'A' + (i % 26) as u8).collect(), + }], + } + .encode() + .unwrap() +} + +fn vectors() -> Vec<(String, u16, Vec)> { + let mut v: Vec<(String, u16, Vec)> = Vec::new(); + v.push(( + "root_operator".into(), + KIND_AGENT_ROOT, + root(ProvisionSource::Operator), + )); + v.push(( + "root_qualification".into(), + KIND_AGENT_ROOT, + root(ProvisionSource::Qualification), + )); + for n in [0usize, 1, 64] { + v.push((format!("manifest_wal{n}"), KIND_MANIFEST, manifest(n, 1))); + } + v.push(( + "manifest_seq2_previous".into(), + KIND_MANIFEST, + manifest(1, 2), + )); + + let mut s = AgentState::genesis(AGENT, 1); + v.push(( + "state_genesis".into(), + KIND_AGENT_STATE, + s.encode().unwrap(), + )); + let rb = root_branch_id(&AGENT); + let c0 = s.fork(&rb).unwrap(); + v.push(( + "state_fork_depth1".into(), + KIND_AGENT_STATE, + s.encode().unwrap(), + )); + // The d1 bytes patched into a hostile table: root claims 2^64-1 forks and + // the child 2, so a wrapping sum equals the child count (1). Both + // implementations must refuse (Rust #232; contract 1.5, section 9). + let mut hostile = s.encode().unwrap(); + // 64-byte header+fixed, 80 bytes per branch, forks at +72; sorted order. + let (a, b) = if s.branches[0].id == rb { + (0, 1) + } else { + (1, 0) + }; + hostile[64 + 80 * a + 72..64 + 80 * a + 80].copy_from_slice(&u64::MAX.to_le_bytes()); + hostile[64 + 80 * b + 72..64 + 80 * b + 80].copy_from_slice(&2u64.to_le_bytes()); + s.fork(&rb).unwrap(); + s.fork(&c0).unwrap(); + v.push(( + "state_fork_depth2".into(), + KIND_AGENT_STATE, + s.encode().unwrap(), + )); + v.push(("state_forksum_overflow".into(), KIND_AGENT_STATE, hostile)); + + for st in [ + Epistemic::DirectObservation, + Epistemic::VerifiedFact, + Epistemic::Inference, + Epistemic::Hypothesis, + Epistemic::Contradiction, + Epistemic::OperatorDecision, + ] { + for len in [1usize, 1024] { + v.push(( + format!("wal_status{}_len{len}", st as u8), + KIND_CORTEX_WAL, + wal(st, len), + )); + } + } + v +} + +fn system_record() -> SystemRecord { + SystemRecord { + slots: [SlotView::Zero, SlotView::Zero], + state_digest: [0x33; 32], + store_uuid: Some(UUID), + mount: Some((MountState::Valid, PeerCondition::Zero, 7)), + reason: None, + continuity: None, + catalog: None, + } +} + +/// (vectors.txt, verdicts.txt) contents. +fn emit() -> (String, String) { + let mut t = String::new(); + t.push_str("# continuity golden vectors (D-1), emitted by the Rust oracle.\n"); + t.push_str("# DO NOT EDIT. Regenerate with:\n"); + t.push_str("# AIENOS_CONTINUITY_VECTORS_REGEN=1 cargo test -p aienos-kernel --lib continuity_vectors\n"); + t.push_str( + "# bid branch id (root = SHA-256 of agent 0x11 x32)\n", + ); + t.push_str( + "# vec canonical bytes, logical ObjectId (store v1)\n", + ); + t.push_str("# deferred recovery challenge / HMAC response: C does not\n"); + t.push_str("# implement these yet (resolve cut), not checked\n"); + let rb = root_branch_id(&AGENT); + t.push_str(&format!("bid root {}\n", hex(&rb))); + for (name, ix) in [ + ("child_index_0", 0u64), + ("child_index_1", 1), + ("child_index_2p32", 1 << 32), + ("child_index_2p64m1", u64::MAX), + ] { + t.push_str(&format!("bid {name} {}\n", hex(&child_branch_id(&rb, ix)))); + } + let vs = vectors(); + for (name, kind, bytes) in &vs { + let id = ObjectId::calculate(*kind, STORE_OBJECT_VERSION, bytes).unwrap(); + t.push_str(&format!( + "vec {name} {kind} {} {}\n", + hex(&id.0), + hex(bytes) + )); + } + let rec = system_record(); + for (name, a) in [ + ("repair_degraded_peer", Action::RepairDegradedPeer), + ("provision_identity", Action::ProvisionIdentity), + ] { + let ch = rec.challenge(a).unwrap(); + t.push_str(&format!("deferred challenge_{name} {}\n", hex(&ch))); + t.push_str(&format!( + "deferred response_{name} {}\n", + hex(&OperatorAuth::expected_response(&TEST_KEY, &ch)) + )); + } + + let mut d = String::new(); + d.push_str("# continuity decode verdicts (D-2), emitted by the Rust oracle.\n"); + d.push_str("# DO NOT EDIT. Regenerate: see continuity_vectors.txt.\n"); + d.push_str( + "# reason ; '.' = accept. verdict : char 0 is the\n", + ); + d.push_str( + "# untouched vector, char 1+i is the vector with bit (i%8) of byte (i/8) flipped.\n", + ); + for (c, cls, why) in REASONS { + d.push_str(&format!("reason {c} {cls} {why}\n")); + } + for (name, kind, bytes) in &vs { + let mut s = String::new(); + s.push(verdict(*kind, bytes)); + let mut t = bytes.clone(); + for i in 0..bytes.len() * 8 { + t[i / 8] ^= 1 << (i % 8); + s.push(verdict(*kind, &t)); + t[i / 8] ^= 1 << (i % 8); + } + d.push_str(&format!("verdict {name} {s}\n")); + } + (t, d) +} + +fn fixture_dir() -> std::path::PathBuf { + std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../native/kernel/tests/fixtures") +} + +#[test] +fn committed_fixtures_match_the_oracle() { + let (vecs, verds) = emit(); + let dir = fixture_dir(); + let files = [ + ("continuity_vectors.txt", vecs), + ("continuity_verdicts.txt", verds), + ]; + if std::env::var_os("AIENOS_CONTINUITY_VECTORS_REGEN").is_some() { + for (n, c) in &files { + std::fs::write(dir.join(n), c).unwrap(); + } + return; + } + for (n, c) in &files { + let have = std::fs::read_to_string(dir.join(n)).unwrap_or_default(); + assert!( + have == *c, + "{n} differs from freshly emitted bytes; regenerate with \ + AIENOS_CONTINUITY_VECTORS_REGEN=1 cargo test -p aienos-kernel --lib continuity_vectors" + ); + } +} + +#[test] +fn emitted_vectors_are_canonical() { + for (name, kind, bytes) in vectors() { + let v = verdict(kind, &bytes); + if name == "state_forksum_overflow" { + assert_eq!(v, 'r', "{name}: the overflowing fork sum must be refused"); + continue; + } + assert_eq!(v, '.', "{name}: must decode"); + let again = match kind { + KIND_AGENT_ROOT => AgentRoot::decode(&bytes).unwrap().encode(), + KIND_MANIFEST => Manifest::decode(&bytes).unwrap().encode().unwrap(), + KIND_AGENT_STATE => AgentState::decode(&bytes).unwrap().encode().unwrap(), + _ => WalSegment::decode(&bytes).unwrap().encode().unwrap(), + }; + assert_eq!(again, bytes, "{name}: decode then encode must be identical"); + } +} diff --git a/native/kernel/CONTINUITY_RECOVERY_CONTRACT.md b/native/kernel/CONTINUITY_RECOVERY_CONTRACT.md index 2d2b3cc..5182910 100644 --- a/native/kernel/CONTINUITY_RECOVERY_CONTRACT.md +++ b/native/kernel/CONTINUITY_RECOVERY_CONTRACT.md @@ -1,7 +1,10 @@ # C kernel contract: continuity objects and Recovery Core -Status: **SPEC, NOT_RUN.** No C code exists for this contract yet. Every C gate -named here is `NOT_RUN (MISSING_IMPLEMENTATION)` until a forge receipt covers it. +Status: **SPEC, NOT_RUN.** Only the codec has C code (cuts 1-2: `svc/continuity_codec.c`, +the golden vectors and the C/Rust decode agreement run by `make -C native/kernel test` +and `continuity-mutants`: **host PASS**, QEMU n/a, nothing wired into the kernel). +Resolution, Recovery Core and every C gate named here stay `NOT_RUN +(MISSING_IMPLEMENTATION)` until a forge receipt covers them. QEMU qualifies nothing physical; nothing here says anything about Machine 1. Authority: @@ -123,6 +126,13 @@ Each branch (80 bytes, `BRANCH_BYTES`, :340, encode :401-407): 3. Every child: parent present; `id == child_branch_id(parent, i)` for some `i < parent.forks`; `depth == parent.depth + 1` (checked add). 4. Sum of all `forks` equals the number of children ("fork indexes are not contiguous"). + **DECIDED (CODE, Rust #232; C agrees): the sum is checked.** A sum that overflows + u64 is refused with the same class and text, because it can never equal the + child count (<= 255). Without the check a table with root forks = 2^64-1 and + one child with forks = 2 wraps to 1 and is accepted. C: `cc_state_validate` + (`continuity_codec.c`, the `over` flag); vector `state_forksum_overflow`; mutant MC-13. + The child-index scan is also capped at `MAX_BRANCHES` hashes in both (no outcome + changes for a table that passes the sum check). `fork` (:365-390): refuses at 256 branches (Limit), absent parent (Corrupt), depth overflow (Limit), id collision (Corrupt); child index = parent.forks, @@ -385,7 +395,7 @@ main design point of this contract. ### 5.3 Known conflicts between the oracle and the sealed Store -- **K-1 Size.** `SS_MAX_PLAINTEXT` is 16384 bytes per object +- **K-1 Size.** **Cap IMPLEMENTED in the C codec, host PASS (cut 1, kept in cut 2); policy still PROPOSED** (the chunking alternative needs an operator decision). Evidence: `continuity_codec.c` decode cap at `rd_open` (`len > CC_MAX_OBJECT_BYTES`) and encode cap at `enc_begin`; `test_continuity_codec.c` K-1 checks (204 branches = 16384 bytes encodes, 205 is Limit with nothing written; 64 x 1024 WAL is Limit, never truncated; decode of 16385 bytes is Limit; mutant MC-11). Cap 16384 and 204 branches are unchanged by cut 2. `SS_MAX_PLAINTEXT` is 16384 bytes per object (store_sealed.h:46). Rust allows an AgentState up to 20544 bytes (256 branches) and a WAL segment up to 67872 bytes (section 1). PROPOSED: the C port enforces the Rust bounds and an extra byte bound of 16384, returning @@ -521,7 +531,7 @@ crates/aienos-kernel/src/recovery.rs: | 91o | `operator_auth_rejects_legacy_bare_sha256_response` | recovery.rs:299 | | 91p | `operator_auth_rejects_undomained_hmac_and_zero_response` | recovery.rs:311 | -### 6.3 Differential agreement (PROPOSED) +### 6.3 Differential agreement (D-1, D-2 DECIDED and IMPLEMENTED, host PASS; D-3 PROPOSED) ADR 0024 Q2 requires differential agreement, not just parallel tests. @@ -534,8 +544,25 @@ ADR 0024 Q2 requires differential agreement, not just parallel tests. and HMAC responses with the TEST key. Committed as fixture files (no Python, no new dependency) under `native/kernel/tests/fixtures/`. The C host test must reproduce every byte and refuse the same tampered vectors. + **DECIDED and IMPLEMENTED (cut 2, host PASS).** Emitter: `crates/aienos-kernel/src/continuity_vectors.rs` + (test-only, `cfg(test)`; no kernel behaviour change). Fixtures: + `native/kernel/tests/fixtures/continuity_vectors.txt` (22 vectors, 5 branch ids, 4 deferred lines). + Regenerate: `AIENOS_CONTINUITY_VECTORS_REGEN=1 cargo test -p aienos-kernel --lib continuity_vectors`; + without the variable the Rust test fails if a committed fixture differs from freshly emitted bytes. + C: `test_continuity_codec.c` (`test_golden`, `test_tampered`; fixture dir = argv[1] or the Makefile + `CC_FIXTURE_DIR`) reproduces every byte and both ObjectIds (`cc_object_id` and `sv1_object_id`), + decode then encode is the identity, and tampered bytes, ObjectIds and verdicts are refused. + Added vector: `state_forksum_overflow` (hostile fork counts, refused by both). + **DEFERRED to the resolve cut:** the recovery challenges (both actions) and HMAC responses with the TEST key + (0x0f x32) are emitted as `deferred` lines but not checked, because the C codec has no challenge or + HMAC code yet. - **D-2 Decode agreement.** For every single-bit flip of every vector, C and Rust agree on accept / refuse and on the error class. + **DECIDED and IMPLEMENTED (cut 2, host PASS).** `continuity_verdicts.txt` holds the Rust verdict of each + vector and of each of its single-bit flips (class and reason text, one letter per distinct reason); C replays + and compares: 22 vectors, 86598 verdicts, **0 divergences** (C and Rust agree on accept/refuse, class and + reason text for every flip). The emitter panics on a Rust reason missing from its table, so a new reason + cannot be dropped silently. The K-1 cap (C-only Limit) cannot appear in a flip because flips keep the length. - **D-3 Cross-store agreement** is not possible byte-for-byte (sealed vs plaintext Store, section 5). Agreement is on resolved values: agent id, sequence, incarnation, branch table bytes, Cortex records, `memory=` digest. @@ -564,6 +591,10 @@ M4_CONTINUITY: | MC-10 | agent id from a fixed value instead of RNDR | 83b | | MC-11 | WAL segment truncated silently at the size bound (K-1) instead of Limit | C size-bound test (PROPOSED) | | MC-12 | Conflict check skipped (first root used) | 87d | +| MC-13 | fork-count sum unchecked (wraps): `CC_MUTANT_UNCHECKED_FORK_SUM`, IMPLEMENTED, killed | 87i, `state_forksum_overflow` (D-1, D-2) | +| MC-14 | golden mismatch only the vectors see (manifest WAL id 63 replaced by id 0): `CC_MUTANT_MANIFEST_LAST_WAL_ZERO`, IMPLEMENTED, killed | D-1 | +| MC-15 | golden comparison skipped: `CC_MUTANT_SKIP_D1` (the test counts comparisons), IMPLEMENTED, killed | D-1 | +| MC-16 | decode-agreement comparison skipped: `CC_MUTANT_SKIP_D2`, IMPLEMENTED, killed | D-2 | M4_RECOVERY: @@ -617,3 +648,10 @@ gate adds one. | Current manifest = the one no other names as previous (:57-61) | all catalog manifests must form exactly 1..n (continuity.rs:656-678) | port the stricter code rule | | Kinds 19 and 23 listed (:40, :42) | not written or read | out of scope | | Provisioning on a store with zero roots (:50-53) | also refused when orphan continuity objects exist (continuity.rs:642-649) | port the code rule | +| Branch-table validation sums `forks` (not specified in the ADR text; section 1.5 item 4) | Rust #232: the sum is checked, an overflowing sum is refused as Corrupt("fork indexes are not contiguous"); before #232 a release build wrapped and accepted {root forks = 2^64-1, child forks = 2} | DECIDED: C refuses on overflow (`cc_state_validate`), Rust and C agree; vector `state_forksum_overflow`, mutant MC-13 | + +D-2 result (cut 2, host PASS): no C/Rust decode divergence was found over 86598 +verdicts (every single-bit flip of 22 vectors, plus the untouched vectors). +The only known C/Rust difference in the codecs is the C-only K-1 size cap +(section 5.3), which the flips cannot reach because they keep the length, and +the C-only `CC_E_ARG` caller-bug class, which no decoder input reaches. diff --git a/native/kernel/GATES.md b/native/kernel/GATES.md index b5d1527..04bf1f8 100644 --- a/native/kernel/GATES.md +++ b/native/kernel/GATES.md @@ -336,7 +336,7 @@ The default `make full` image must carry no crash hook string (Makefile Contract: `native/kernel/CONTINUITY_RECOVERY_CONTRACT.md` (SPEC, NOT_RUN). One row per Rust check: rows 81-87 are the QEMU PASS lines of `scripts/qemu_continuity_test.sh` (receipt `evidence/continuity_qemu_2026-09-25.md`), rows 87a-87i are the host tests `cargo test -p aienos-kernel --lib continuity` -(`crates/aienos-kernel/src/continuity_tests.rs`). No C continuity code exists, so every row is NOT_RUN. +(`crates/aienos-kernel/src/continuity_tests.rs`). The C continuity codec (`svc/continuity_codec.c`, cuts 1-2) has a host test only, with no kernel wiring and no QEMU run: rows 87h, 87i and the codec rows 87j-87k below say HOST PASS for that host test; no gate row is QEMU PASS and `M4_CONTINUITY` stays NOT_RUN. Every other row is NOT_RUN. | # | Rust check | CK gate | Status | | --- | --- | --- | --- | @@ -363,8 +363,10 @@ QEMU PASS lines of `scripts/qemu_continuity_test.sh` (receipt `evidence/continui | 87e | host `forked_or_gapped_manifest_chains_are_corrupt` (:178) | M4_CONTINUITY (host) | NOT_RUN (MISSING_IMPLEMENTATION) | | 87f | host `degraded_mount_resumes_read_only` (:221) | M4_CONTINUITY (host) | NOT_RUN (MISSING_IMPLEMENTATION) | | 87g | host `a_crash_at_every_write_of_a_commit_leaves_old_or_new_never_a_third_state` (:242) | M4_CONTINUITY (host) | NOT_RUN (MISSING_IMPLEMENTATION) | -| 87h | host `encodings_round_trip_and_reject_tampering` (:286) | M4_CONTINUITY (host) | NOT_RUN (MISSING_IMPLEMENTATION) | -| 87i | host `branch_table_validation_rejects_broken_lineage` (:328) | M4_CONTINUITY (host) | NOT_RUN (MISSING_IMPLEMENTATION) | +| 87h | host `encodings_round_trip_and_reject_tampering` (:286) | M4_CONTINUITY (host) | HOST PASS for the C codec twin (`make -C native/kernel test`, `test_continuity_codec`: round trips, one refusal per rule, every single-bit flip of every golden vector decodes as in Rust, D-2); gate NOT_RUN (no QEMU, no kernel wiring) | +| 87i | host `branch_table_validation_rejects_broken_lineage` (:328) | M4_CONTINUITY (host) | HOST PASS for the C codec twin (`cc_state_validate`, incl. the checked fork-count sum and hostile fork counts); gate NOT_RUN (no QEMU, no kernel wiring) | +| 87j | D-1 golden vectors (contract 6.3): Rust-emitted canonical bytes and ObjectIds for 22 vectors, reproduced by C from `native/kernel/tests/fixtures/continuity_vectors.txt`; tampered bytes, ObjectId and verdicts are refused (`cargo test -p aienos-kernel --lib continuity_vectors` fails on fixture drift) | M4_CONTINUITY (host) | HOST PASS (`make -C native/kernel test`, `continuity-mutants`: golden and skip-D1 mutants killed); challenges and HMAC responses are emitted but DEFERRED to the resolve cut (no C implementation); gate NOT_RUN | +| 87k | D-2 decode agreement (contract 6.3): every single-bit flip of every vector, C and Rust agree on accept/refuse and error class and text (86598 verdicts, 0 divergences) | M4_CONTINUITY (host) | HOST PASS (`make -C native/kernel test`; skip-D2 mutant killed); gate NOT_RUN | ## M4 recovery: scripts/qemu_recovery_test.sh -> CK `M4_RECOVERY` diff --git a/native/kernel/Makefile b/native/kernel/Makefile index 92d2a3a..dae60fd 100644 --- a/native/kernel/Makefile +++ b/native/kernel/Makefile @@ -550,25 +550,33 @@ $(OUT)/host-san/test_artifact: $(KDIR)/tests/test_artifact.c $(ART_HOST_DEPS) $( # CK_HARDWARE_STAGING (svc/continuity_codec.h). CC_HOST_SRCS := $(KDIR)/svc/continuity_codec.c $(NATIVE)/argus/sha256.c $(NATIVE)/store/store_v1.c CC_HOST_INC := -I$(KDIR)/svc -I$(NATIVE)/argus -I$(NATIVE)/store -CC_HOST_DEPS := $(CC_HOST_SRCS) $(KDIR)/svc/continuity_codec.h $(NATIVE)/argus/sha256.h \ +CC_HOST_DEPS := $(wildcard $(KDIR)/tests/fixtures/continuity_*.txt) $(CC_HOST_SRCS) $(KDIR)/svc/continuity_codec.h $(NATIVE)/argus/sha256.h \ $(NATIVE)/store/store_v1.h $(KDIR)/tests/ck_test.h +# Cut 2 adds UNCHECKED_FORK_SUM (wrapping fork-count sum), MANIFEST_LAST_WAL_ZERO +# (only the golden vectors see it), SKIP_D1 and SKIP_D2 (test-side: the golden +# or the decode-agreement comparison is skipped; the test counts its +# comparisons, so skipping one is a FAIL). CC_MUTANTS := CC_MUTANT_SKIP_TAKE_BOUND CC_MUTANT_ACCEPT_RESERVED CC_MUTANT_CHILD_INDEX_LE \ - CC_MUTANT_TRUNCATE_AT_CAP + CC_MUTANT_TRUNCATE_AT_CAP CC_MUTANT_UNCHECKED_FORK_SUM CC_MUTANT_MANIFEST_LAST_WAL_ZERO \ + CC_MUTANT_SKIP_D1 CC_MUTANT_SKIP_D2 +# Rust-emitted fixtures (D-1, D-2) read by the test at run time. +CC_FIXTURES := $(abspath $(KDIR)/tests/fixtures) +CC_FIXTURE_DEF := -DCC_FIXTURE_DIR='"$(CC_FIXTURES)"' $(OUT)/host/test_continuity_codec: $(KDIR)/tests/test_continuity_codec.c $(CC_HOST_DEPS) @mkdir -p $(dir $@) - $(HOSTCC) $(HCFLAGS) $(CC_HOST_INC) -o $@ $< $(CC_HOST_SRCS) + $(HOSTCC) $(HCFLAGS) $(CC_HOST_INC) $(CC_FIXTURE_DEF) -o $@ $< $(CC_HOST_SRCS) $(OUT)/host-san/test_continuity_codec: $(KDIR)/tests/test_continuity_codec.c $(CC_HOST_DEPS) @mkdir -p $(dir $@) - $(HOSTCC) $(HCFLAGS) $(SANFLAGS) $(CC_HOST_INC) -o $@ $< $(CC_HOST_SRCS) + $(HOSTCC) $(HCFLAGS) $(SANFLAGS) $(CC_HOST_INC) $(CC_FIXTURE_DEF) -o $@ $< $(CC_HOST_SRCS) continuity-mutants: $(OUT)/host/test_continuity_codec @mkdir -p $(OUT)/host-mut; fail=0; \ $(OUT)/host/test_continuity_codec > $(OUT)/host-mut/base.log 2>&1 || { echo "unmutated test_continuity_codec fails"; fail=1; }; \ for m in $(CC_MUTANTS); do \ b=$(OUT)/host-mut/test_continuity_codec_$$m; \ - if ! $(HOSTCC) $(HCFLAGS) $(CC_HOST_INC) -D$$m -o $$b $(KDIR)/tests/test_continuity_codec.c $(CC_HOST_SRCS); then \ + if ! $(HOSTCC) $(HCFLAGS) $(CC_HOST_INC) $(CC_FIXTURE_DEF) -D$$m -o $$b $(KDIR)/tests/test_continuity_codec.c $(CC_HOST_SRCS); then \ echo "mutant $$m: does not build (FAIL)"; fail=1; continue; fi; \ if $$b > $$b.log 2>&1; then echo "mutant $$m: SURVIVED (FAIL)"; fail=1; \ elif grep -q "^test_continuity_codec: FAIL" $$b.log; then \ diff --git a/native/kernel/svc/continuity_codec.c b/native/kernel/svc/continuity_codec.c index b779109..6e1077d 100644 --- a/native/kernel/svc/continuity_codec.c +++ b/native/kernel/svc/continuity_codec.c @@ -368,7 +368,11 @@ int cc_manifest_encode(const struct cc_manifest *v, uint8_t *out, size_t cap, si w_u16(&w, (uint16_t)v->n_wal); /* :276 */ w_zeros(&w, 6); /* :277 */ for (uint32_t i = 0; i < v->n_wal; i++) +#ifdef CC_MUTANT_MANIFEST_LAST_WAL_ZERO + w_bytes(&w, v->wal[i == 63 ? 0 : i], 32); /* MUTANT: id 63 replaced by id 0 */ +#else w_bytes(&w, v->wal[i], 32); /* :278-280 */ +#endif *len = w.at; return CC_OK; } @@ -482,10 +486,14 @@ int cc_state_validate(const struct cc_state *s, const char **why) uint64_t forks = 0; int over = 0; for (uint32_t i = 0; i < s->n; i++) { +#ifdef CC_MUTANT_UNCHECKED_FORK_SUM + forks += s->br[i].forks; /* MUTANT: wrapping sum, overflow never refused */ +#else if (s->br[i].forks > UINT64_MAX - forks) over = 1; else forks += s->br[i].forks; +#endif } if (roots != 1 || over || forks != children) return fail(why, CC_E_CORRUPT, "fork indexes are not contiguous"); diff --git a/native/kernel/svc/continuity_codec.h b/native/kernel/svc/continuity_codec.h index 71c2c71..9a1b7d4 100644 --- a/native/kernel/svc/continuity_codec.h +++ b/native/kernel/svc/continuity_codec.h @@ -33,7 +33,8 @@ * part of a hardware staging image. */ #if defined(CK_HARDWARE_STAGING) && \ (defined(CC_MUTANT_SKIP_TAKE_BOUND) || defined(CC_MUTANT_ACCEPT_RESERVED) || \ - defined(CC_MUTANT_CHILD_INDEX_LE) || defined(CC_MUTANT_TRUNCATE_AT_CAP)) + defined(CC_MUTANT_CHILD_INDEX_LE) || defined(CC_MUTANT_TRUNCATE_AT_CAP) || \ + defined(CC_MUTANT_UNCHECKED_FORK_SUM) || defined(CC_MUTANT_MANIFEST_LAST_WAL_ZERO)) #error "continuity codec mutants are TEST-only and refused under CK_HARDWARE_STAGING" #endif diff --git a/native/kernel/tests/fixtures/continuity_vectors.txt b/native/kernel/tests/fixtures/continuity_vectors.txt new file mode 100644 index 0000000..e9ca945 --- /dev/null +++ b/native/kernel/tests/fixtures/continuity_vectors.txt @@ -0,0 +1,38 @@ +# continuity golden vectors (D-1), emitted by the Rust oracle. +# DO NOT EDIT. Regenerate with: +# AIENOS_CONTINUITY_VECTORS_REGEN=1 cargo test -p aienos-kernel --lib continuity_vectors +# bid branch id (root = SHA-256 of agent 0x11 x32) +# vec canonical bytes, logical ObjectId (store v1) +# deferred recovery challenge / HMAC response: C does not +# implement these yet (resolve cut), not checked +bid root 89f5fd9d69301a1ab4cce49d57b3f711fb9c36524807ef53fada8119ac24f803 +bid child_index_0 0be1954eac96e977c2eabee2a079600ad249b7c46b4f07910089098041f55785 +bid child_index_1 909874bd0bd38ea9b278982665b3f33ed29b5c76340719bccf030bc59bebcc55 +bid child_index_2p32 35b2e2d23d315594bfdb01277cdce8ad5aedf79641e11b7a82c9d08a6c5e669a +bid child_index_2p64m1 d9716d516fb3c31b21dc4e9a9e748a928a5a53d60642c0251094e47aeb8d22fd +vec root_operator 16 f1a794dd3c69d80b46d29cfef634c902843ba950e919822bdb2bfd2d9c577f27 4149454e524f4f54000000006000000011111111111111111111111111111111111111111111111111111111111111115a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a89f5fd9d69301a1ab4cce49d57b3f711fb9c36524807ef53fada8119ac24f80308070605040302010100000000000000 +vec root_qualification 16 d231e0aaba16e227a5330c590d60f0367d42930593bca2092df9fe3ae23f6bf7 4149454e524f4f54000000006000000011111111111111111111111111111111111111111111111111111111111111115a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a89f5fd9d69301a1ab4cce49d57b3f711fb9c36524807ef53fada8119ac24f80308070605040302010200000000000000 +vec manifest_wal0 17 d3627029b8d369349d05b81ca72d4ee5abeb5e1c1a0645fa35ab89b4fcfb5f03 4149454e4d414e490000000078000000a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b20000000000000000 +vec manifest_wal1 17 df587d9af771b6fe17a2f1325b1001bc18528644c5f62e1b7364aa270bd48632 4149454e4d414e490000000098000000a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b201000000000000000101010101010101010101010101010101010101010101010101010101010101 +vec manifest_wal64 17 a8804abde22ef7cdabc6bb16d165ec2a8cec9a03e68d017a6c947f76d258270e 4149454e4d414e490000000078080000a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b240000000000000000101010101010101010101010101010101010101010101010101010101010101020202020202020202020202020202020202020202020202020202020202020203030303030303030303030303030303030303030303030303030303030303030404040404040404040404040404040404040404040404040404040404040404050505050505050505050505050505050505050505050505050505050505050506060606060606060606060606060606060606060606060606060606060606060707070707070707070707070707070707070707070707070707070707070707080808080808080808080808080808080808080808080808080808080808080809090909090909090909090909090909090909090909090909090909090909090a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f10101010101010101010101010101010101010101010101010101010101010101111111111111111111111111111111111111111111111111111111111111111121212121212121212121212121212121212121212121212121212121212121213131313131313131313131313131313131313131313131313131313131313131414141414141414141414141414141414141414141414141414141414141414151515151515151515151515151515151515151515151515151515151515151516161616161616161616161616161616161616161616161616161616161616161717171717171717171717171717171717171717171717171717171717171717181818181818181818181818181818181818181818181818181818181818181819191919191919191919191919191919191919191919191919191919191919191a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f20202020202020202020202020202020202020202020202020202020202020202121212121212121212121212121212121212121212121212121212121212121222222222222222222222222222222222222222222222222222222222222222223232323232323232323232323232323232323232323232323232323232323232424242424242424242424242424242424242424242424242424242424242424252525252525252525252525252525252525252525252525252525252525252526262626262626262626262626262626262626262626262626262626262626262727272727272727272727272727272727272727272727272727272727272727282828282828282828282828282828282828282828282828282828282828282829292929292929292929292929292929292929292929292929292929292929292a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f30303030303030303030303030303030303030303030303030303030303030303131313131313131313131313131313131313131313131313131313131313131323232323232323232323232323232323232323232323232323232323232323233333333333333333333333333333333333333333333333333333333333333333434343434343434343434343434343434343434343434343434343434343434353535353535353535353535353535353535353535353535353535353535353536363636363636363636363636363636363636363636363636363636363636363737373737373737373737373737373737373737373737373737373737373737383838383838383838383838383838383838383838383838383838383838383839393939393939393939393939393939393939393939393939393939393939393a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f4040404040404040404040404040404040404040404040404040404040404040 +vec manifest_seq2_previous 17 63432f379d8dc4217e8004eb1bbf66fdd7da90e5eeaff810a13eb094d548926f 4149454e4d414e490000000098000000a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d402000000000000000100000000000000b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b201000000000000000101010101010101010101010101010101010101010101010101010101010101 +vec state_genesis 18 440cc553fd3257166bbda2d1c211b6541c1adf6a7687647a6efc540655370f9a 4149454e4252414e000000008000000011111111111111111111111111111111111111111111111111111111111111110100000000000000010000000000000089f5fd9d69301a1ab4cce49d57b3f711fb9c36524807ef53fada8119ac24f803000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +vec state_fork_depth1 18 561ec891c466d831b187ad19016c2800e56aa9947dfb356792c127e003682b20 4149454e4252414e00000000d00000001111111111111111111111111111111111111111111111111111111111111111010000000000000002000000000000000be1954eac96e977c2eabee2a079600ad249b7c46b4f07910089098041f5578589f5fd9d69301a1ab4cce49d57b3f711fb9c36524807ef53fada8119ac24f8030100000000000000000000000000000089f5fd9d69301a1ab4cce49d57b3f711fb9c36524807ef53fada8119ac24f803000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000 +vec state_fork_depth2 18 eb24198e5e3bfe1b4d4c17e3a528bb5aa832c3c5d79e581cc34189d0eb1fd1fe 4149454e4252414e00000000700100001111111111111111111111111111111111111111111111111111111111111111010000000000000004000000000000000be1954eac96e977c2eabee2a079600ad249b7c46b4f07910089098041f5578589f5fd9d69301a1ab4cce49d57b3f711fb9c36524807ef53fada8119ac24f803010000000000000001000000000000005f58ca2b301323c6306060cd5ca8b915bae8e31338c6bfbc89dc859af600eca40be1954eac96e977c2eabee2a079600ad249b7c46b4f07910089098041f557850200000000000000000000000000000089f5fd9d69301a1ab4cce49d57b3f711fb9c36524807ef53fada8119ac24f803000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000909874bd0bd38ea9b278982665b3f33ed29b5c76340719bccf030bc59bebcc5589f5fd9d69301a1ab4cce49d57b3f711fb9c36524807ef53fada8119ac24f80301000000000000000000000000000000 +vec state_forksum_overflow 18 7f97c707e42c5947e4e278fce9a5e58f665c752a357dfe5f9a9fa04b73106a12 4149454e4252414e00000000d00000001111111111111111111111111111111111111111111111111111111111111111010000000000000002000000000000000be1954eac96e977c2eabee2a079600ad249b7c46b4f07910089098041f5578589f5fd9d69301a1ab4cce49d57b3f711fb9c36524807ef53fada8119ac24f8030100000000000000020000000000000089f5fd9d69301a1ab4cce49d57b3f711fb9c36524807ef53fada8119ac24f80300000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff +vec wal_status1_len1 20 6c0c146b54ecea1db7eaa736ef2088dac42af7cfd3d205e260ecbb5cdd07b903 4149454e4357414c00000000350000000300000000000000010000000000000001000100414141414141414141414141414141414141414141414141414141414141414141 +vec wal_status1_len1024 20 5387ca4bdb37e174d5a9723246fafe56394ebbf33564b8cbb932ec9bbebe6f22 4149454e4357414c0000000034040000030000000000000001000000000000000100000441414141414141414141414141414141414141414141414141414141414141414142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a +vec wal_status2_len1 20 f000a5fb68e1cbca841a69dd075136c1c3001b1faabbd191fb530c893352f7af 4149454e4357414c00000000350000000300000000000000010000000000000002000100424242424242424242424242424242424242424242424242424242424242424241 +vec wal_status2_len1024 20 dc08b80c6305bb8e59c59720c27a4d46dae63ef530b73e71c1246a3d71e57bba 4149454e4357414c0000000034040000030000000000000001000000000000000200000442424242424242424242424242424242424242424242424242424242424242424142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a +vec wal_status3_len1 20 e01db0ba0d823fc0660955c4386a614bb2a8eab95a7fa60ff6410d4ee5f3541b 4149454e4357414c00000000350000000300000000000000010000000000000003000100434343434343434343434343434343434343434343434343434343434343434341 +vec wal_status3_len1024 20 37fefa466fcc1fe46a63c0df3688cb225d4711e17d543905a8f7c13f7d932a97 4149454e4357414c0000000034040000030000000000000001000000000000000300000443434343434343434343434343434343434343434343434343434343434343434142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a +vec wal_status4_len1 20 3096ae715218f5ecc75f6dffb3dc49836b9815362d803c59cd4bfa542ca5d613 4149454e4357414c00000000350000000300000000000000010000000000000004000100444444444444444444444444444444444444444444444444444444444444444441 +vec wal_status4_len1024 20 9cf786f96b582f8fa03cb2fdbfd9d0e38c343c711b99675ff42ca34b714f1ca4 4149454e4357414c0000000034040000030000000000000001000000000000000400000444444444444444444444444444444444444444444444444444444444444444444142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a +vec wal_status5_len1 20 cead0aecc91c2cf921789e18c61444e125b392a831681a3d6c7b0d75f85b6c5e 4149454e4357414c00000000350000000300000000000000010000000000000005000100454545454545454545454545454545454545454545454545454545454545454541 +vec wal_status5_len1024 20 3ae5577e6cbad3b2ef52cc295c389051bd0289d8ad5fde016ebf80a384826724 4149454e4357414c0000000034040000030000000000000001000000000000000500000445454545454545454545454545454545454545454545454545454545454545454142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a +vec wal_status6_len1 20 214192dd7e61dad95dbfbaa3aaae6c4c46c142a86ef747fe3a87f71480b62234 4149454e4357414c00000000350000000300000000000000010000000000000006000100464646464646464646464646464646464646464646464646464646464646464641 +vec wal_status6_len1024 20 e43bdf81589402952019362a8b4aa3bd03c919775cb603a6ecae327d958f060e 4149454e4357414c0000000034040000030000000000000001000000000000000600000446464646464646464646464646464646464646464646464646464646464646464142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a4b4c4d4e4f505152535455565758595a4142434445464748494a +deferred challenge_repair_degraded_peer 7dfd4366095705ca21c81268752c14bf8961d000ed1a276d9dcf0753c0f2f4b5 +deferred response_repair_degraded_peer 522fcaf36c316246a07327f09e7797f1b540d8db414408b0df74fd0690085ea7 +deferred challenge_provision_identity 91fe9cff4a2afe23d343ae77c5530bed2c3115bea3df648562b6c19004b184fc +deferred response_provision_identity 1f75d6204a3c651eb9414012a288e4781e48fc9e28d9459843d934ffcda402ea diff --git a/native/kernel/tests/fixtures/continuity_verdicts.txt b/native/kernel/tests/fixtures/continuity_verdicts.txt new file mode 100644 index 0000000..4d2d911 --- /dev/null +++ b/native/kernel/tests/fixtures/continuity_verdicts.txt @@ -0,0 +1,47 @@ +# continuity decode verdicts (D-2), emitted by the Rust oracle. +# DO NOT EDIT. Regenerate: see continuity_vectors.txt. +# reason ; '.' = accept. verdict : char 0 is the +# untouched vector, char 1+i is the vector with bit (i%8) of byte (i/8) flipped. +reason a Corrupt bad magic +reason b Corrupt unsupported continuity format version +reason c Corrupt nonzero header reserved +reason d Corrupt body length mismatch +reason e Corrupt truncated object +reason f Corrupt nonzero reserved +reason g Corrupt trailing bytes +reason h Corrupt unknown provisioning source +reason i Corrupt zero agent id +reason j Corrupt root branch does not derive from agent +reason k Corrupt too many cortex WAL segments +reason l Corrupt manifest sequence/previous mismatch +reason m Corrupt branch count out of range +reason n Corrupt branches not strictly sorted +reason o Corrupt unexpected root branch +reason p Corrupt parent branch is absent +reason q Corrupt branch lineage is inconsistent +reason r Corrupt fork indexes are not contiguous +reason s Corrupt WAL segment record count +reason t Corrupt unknown epistemic status +reason u Corrupt statement length +verdict root_operator .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccddddddddddddddddddddddddddddddddjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj................................................................................................................................jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj................................................................hhhhhhhhffffffffffffffffffffffffffffffffffffffffffffffffffffffff +verdict root_qualification .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccddddddddddddddddddddddddddddddddjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj................................................................................................................................jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj................................................................hhhhhhhhffffffffffffffffffffffffffffffffffffffffffffffffffffffff +verdict manifest_wal0 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................................................................................................................................................................................................................llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll................................................................................................................................................................................................................................................................................................................................eeeeeeekkkkkkkkkffffffffffffffffffffffffffffffffffffffffffffffff +verdict manifest_wal1 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................................................................................................................................................................................................................llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll................................................................................................................................................................................................................................................................................................................................geeeeekkkkkkkkkkffffffffffffffffffffffffffffffffffffffffffffffff................................................................................................................................................................................................................................................................ +verdict manifest_wal64 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................................................................................................................................................................................................................llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll................................................................................................................................................................................................................................................................................................................................kkkkkkgkkkkkkkkkffffffffffffffffffffffffffffffffffffffffffffffff................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ +verdict manifest_seq2_previous .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................l..............................................................................................................................................................................................................................................................................................................................................................................................geeeeekkkkkkkkkkffffffffffffffffffffffffffffffffffffffffffffffff................................................................................................................................................................................................................................................................ +verdict state_genesis .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccddddddddddddddddddddddddddddddddoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo................................................................meeeeeeemmmmmmmmmmmmmmmmmmmmmmmmffffffffffffffffffffffffffffffffooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppooooooooooooooooooooooooooooooooffffffffffffffffffffffffffffffffrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr +verdict state_fork_depth1 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccddddddddddddddddddddddddddddddddoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo................................................................emeeeeeemmmmmmmmmmmmmmmmmmmmmmmmffffffffffffffffffffffffffffffffqqqqqqqnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqffffffffffffffffffffffffffffffffrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrpppppppnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqffffffffffffffffffffffffffffffffqrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr +verdict state_fork_depth2 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccddddddddddddddddddddddddddddddddoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo................................................................eemeeeeemmmmmmmmmmmmmmmmmmmmmmmmffffffffffffffffffffffffffffffffqqqqqqqnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqffffffffffffffffffffffffffffffffqrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrqqqqqqqnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqffffffffffffffffffffffffffffffffrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrppppnnnnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqffffffffffffffffffffffffffffffffrqrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrqqqqnqqnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqffffffffffffffffffffffffffffffffrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr +verdict state_forksum_overflow raaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccddddddddddddddddddddddddddddddddoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooorrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrremeeeeeemmmmmmmmmmmmmmmmmmmmmmmmffffffffffffffffffffffffffffffffqqqqqqqnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqffffffffffffffffffffffffffffffffrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrpppppppnppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqffffffffffffffffffffffffffffffffrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr +verdict wal_status1_len1 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................seeeeessssssssssssssssssssssssssfffffffffffffffffffffffffffffffft..tttttffffffffueeeeeeeeeuuuuuu........................................................................................................................................................................................................................................................................ +verdict wal_status1_len1024 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................seeeeessssssssssssssssssssssssssfffffffffffffffffffffffffffffffft..tttttffffffffuuuuuuuuuuuuuuuu................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ +verdict wal_status2_len1 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................seeeeessssssssssssssssssssssssssffffffffffffffffffffffffffffffff.t.tttttffffffffueeeeeeeeeuuuuuu........................................................................................................................................................................................................................................................................ +verdict wal_status2_len1024 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................seeeeessssssssssssssssssssssssssffffffffffffffffffffffffffffffff.t.tttttffffffffuuuuuuuuuuuuuuuu................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ +verdict wal_status3_len1 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................seeeeessssssssssssssssssssssssssffffffffffffffffffffffffffffffff..ttttttffffffffueeeeeeeeeuuuuuu........................................................................................................................................................................................................................................................................ +verdict wal_status3_len1024 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................seeeeessssssssssssssssssssssssssffffffffffffffffffffffffffffffff..ttttttffffffffuuuuuuuuuuuuuuuu................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ +verdict wal_status4_len1 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................seeeeessssssssssssssssssssssssssffffffffffffffffffffffffffffffff..ttttttffffffffueeeeeeeeeuuuuuu........................................................................................................................................................................................................................................................................ +verdict wal_status4_len1024 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................seeeeessssssssssssssssssssssssssffffffffffffffffffffffffffffffff..ttttttffffffffuuuuuuuuuuuuuuuu................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ +verdict wal_status5_len1 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................seeeeessssssssssssssssssssssssssffffffffffffffffffffffffffffffff.t.tttttffffffffueeeeeeeeeuuuuuu........................................................................................................................................................................................................................................................................ +verdict wal_status5_len1024 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................seeeeessssssssssssssssssssssssssffffffffffffffffffffffffffffffff.t.tttttffffffffuuuuuuuuuuuuuuuu................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ +verdict wal_status6_len1 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................seeeeessssssssssssssssssssssssssfffffffffffffffffffffffffffffffft..tttttffffffffueeeeeeeeeuuuuuu........................................................................................................................................................................................................................................................................ +verdict wal_status6_len1024 .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddddddddddddddddddd................................................................seeeeessssssssssssssssssssssssssfffffffffffffffffffffffffffffffft..tttttffffffffuuuuuuuuuuuuuuuu................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ diff --git a/native/kernel/tests/test_continuity_codec.c b/native/kernel/tests/test_continuity_codec.c index b907023..923e87b 100644 --- a/native/kernel/tests/test_continuity_codec.c +++ b/native/kernel/tests/test_continuity_codec.c @@ -7,13 +7,15 @@ * encoders, each piece citing the Rust line that emits it. Hash values * (root/child branch ids, logical ObjectIds) were computed outside this * code with coreutils sha256sum over printf-built inputs, not with the C - * code under test. A Rust-generated vector emitter is a later cut (D-1). + * code under test. Cut 2 adds Rust-emitted golden vectors (D-1, section 6). * 2. Round trips (twin of rs tests continuity_tests.rs:286, 87h). * 3. One refusal per rule, with the Rust error class and reason text. * 4. Branch-table lineage (twin of continuity_tests.rs:328, 87i). * 5. K-1 (PROPOSED): 16384-byte cap on encode and decode. * Mutants (make continuity-mutants) must each turn this test FAIL. */ #include +#include +#include #include #include "ck_test.h" #include "continuity_codec.h" @@ -537,7 +539,310 @@ static void test_decode_cap(void) CHECK(cc_wal_decode(buf, CC_MAX_OBJECT_BYTES, &wal2, &why) == CC_E_CORRUPT); } -int main(void) +/* ---- D-1 golden vectors and D-2 decode agreement (cut 2) ---- + * Fixtures are emitted by the Rust oracle (crates/aienos-kernel/src/ + * continuity_vectors.rs) and read here at run time: the directory is argv[1], + * else the CC_FIXTURE_DIR compile-time define (set by the Makefile). + * continuity_vectors.txt bid / vec / deferred lines (D-1) + * continuity_verdicts.txt reason table + one verdict string per vector (D-2) */ +#define V_MAX 64 +#define V_BYTES_MAX 2300 /* largest vector: manifest with 64 WAL ids, 2184 */ +#define R_MAX 32 +static char fbuf_v[1 << 17], fbuf_d[1 << 18]; +static struct vec { + char name[48]; + uint16_t kind; + uint8_t oid[32]; + uint8_t bytes[V_BYTES_MAX]; + size_t n; + const char *verdict; /* into fbuf_d, 8n+1 chars, not NUL terminated */ + size_t verdict_len; +} vecs[V_MAX]; +static int n_vecs, n_deferred, n_bids; +static struct { char c; char cls[8]; char why[64]; } reasons[R_MAX]; +static int n_reasons; +/* Comparison counters: the gate asserts the work was actually done, so a + * skipped comparison is a FAIL, not a silent pass (mutants SKIP_D1/SKIP_D2). */ +static unsigned long d1_compared, d2_compared, d2_expected; +static int quiet; /* silence expected divergences in the tamper test */ + +static int read_file(const char *dir, const char *name, char *dst, size_t cap) +{ + char path[512]; + if (snprintf(path, sizeof path, "%s/%s", dir, name) >= (int)sizeof path) + return 0; + FILE *f = fopen(path, "rb"); + if (!f) { + printf(" cannot open %s\n", path); + return 0; + } + size_t n = fread(dst, 1, cap - 1, f); + int big = fgetc(f) != EOF; + fclose(f); + dst[n] = 0; + return n > 0 && !big; +} +/* Strict hex: exactly 2*n lowercase digits, then end of token. */ +static int hex_n(const char *s, size_t n, uint8_t *o) +{ + for (size_t i = 0; i < 2 * n; i++) + if (!((s[i] >= '0' && s[i] <= '9') || (s[i] >= 'a' && s[i] <= 'f'))) + return 0; + for (size_t i = 0; i < n; i++) + o[i] = (uint8_t)(hexv(s[2 * i]) << 4 | hexv(s[2 * i + 1])); + return 1; +} +/* Next line of a NUL-terminated buffer: returns its start, NUL-terminates it, + * advances *p. NULL at end. */ +static char *next_line(char **p) +{ + char *s = *p, *e; + if (!*s) + return 0; + for (e = s; *e && *e != '\n'; e++) + ; + if (*e) + *e++ = 0; + *p = e; + return s; +} +/* Split off the next space-separated token of *l (in place). */ +static char *tok(char **l) +{ + char *s = *l, *e; + if (!s || !*s) + return 0; + for (e = s; *e && *e != ' '; e++) + ; + if (*e) + *e++ = 0; + *l = e; + return s; +} + +static int load_fixtures(const char *dir) +{ + char *p, *l; + if (!read_file(dir, "continuity_vectors.txt", fbuf_v, sizeof fbuf_v) || + !read_file(dir, "continuity_verdicts.txt", fbuf_d, sizeof fbuf_d)) + return 0; + for (p = fbuf_v; (l = next_line(&p));) { + char *kw = tok(&l), *name = tok(&l); + if (!kw || kw[0] == '#') + continue; + if (!name) + return 0; + if (!strcmp(kw, "bid")) { + n_bids++; + } else if (!strcmp(kw, "deferred")) { + n_deferred++; + } else if (!strcmp(kw, "vec")) { + char *kind = tok(&l), *oid = tok(&l), *bytes = l; + if (!kind || !oid || !bytes || n_vecs >= V_MAX || strlen(name) >= sizeof vecs[0].name) + return 0; + struct vec *v = &vecs[n_vecs++]; + strcpy(v->name, name); + v->kind = (uint16_t)strtoul(kind, 0, 10); + size_t hl = strlen(bytes); + if (!hex_n(oid, 32, v->oid) || hl % 2 || hl / 2 > V_BYTES_MAX || strlen(oid) != 64) + return 0; + v->n = hl / 2; + if (!hex_n(bytes, v->n, v->bytes)) + return 0; + } else { + return 0; + } + } + for (p = fbuf_d; (l = next_line(&p));) { + char *kw = tok(&l), *name = tok(&l); + if (!kw || kw[0] == '#') + continue; + if (!name) + return 0; + if (!strcmp(kw, "reason")) { + char *cls = tok(&l); + if (!cls || n_reasons >= R_MAX || strlen(name) != 1 || strlen(cls) >= 8 || strlen(l) >= 64) + return 0; + reasons[n_reasons].c = name[0]; + strcpy(reasons[n_reasons].cls, cls); + strcpy(reasons[n_reasons].why, l); + n_reasons++; + } else if (!strcmp(kw, "verdict")) { + int found = 0; + for (int i = 0; i < n_vecs; i++) + if (!strcmp(vecs[i].name, name) && !vecs[i].verdict) { + vecs[i].verdict = l; + vecs[i].verdict_len = strlen(l); + found = 1; + } + if (!found) + return 0; + } else { + return 0; + } + } + return 1; +} + +/* C verdict of one byte string, in the fixture alphabet: '.' accept, else the + * reason code whose (class, why) the C decoder returned; '?' if C returned a + * class or text the Rust oracle never does (itself a divergence). */ +static char c_verdict(uint16_t kind, const uint8_t *b, size_t n) +{ + struct cc_root r; + int e; + memmove(buf, b, n); + why = 0; + switch (kind) { + case CC_KIND_AGENT_ROOT: e = cc_root_decode(buf, n, &r, &why); break; + case CC_KIND_MANIFEST: e = cc_manifest_decode(buf, n, &man2, &why); break; + case CC_KIND_AGENT_STATE: e = cc_state_decode(buf, n, &st2, &why); break; + case CC_KIND_CORTEX_WAL: e = cc_wal_decode(buf, n, &wal2, &why); break; + default: return '?'; + } + if (e == CC_OK) + return '.'; + const char *cls = e == CC_E_CORRUPT ? "Corrupt" : e == CC_E_LIMIT ? "Limit" : 0; + for (int i = 0; cls && why && i < n_reasons; i++) + if (!strcmp(reasons[i].cls, cls) && !strcmp(reasons[i].why, why)) + return reasons[i].c; + return '?'; +} + +/* D-1: ObjectId (two independent C implementations) and, when the vector is + * accepted, decode then encode reproduces the bytes exactly. */ +static int d1_ok(uint16_t kind, const uint8_t *b, size_t n, const uint8_t oid[32], int accepted) +{ + uint8_t a[32], c[32], re[V_BYTES_MAX + 64]; + size_t rn = 0; + int ok = 1; +#ifndef CC_MUTANT_SKIP_D1 + d1_compared++; + ok = cc_object_id(kind, b, n, a) == CC_OK && sv1_object_id(kind, 1, b, n, c) == 0 && + !memcmp(a, oid, 32) && !memcmp(c, oid, 32); + if (accepted) { + struct cc_root r; + memmove(buf, b, n); + why = 0; + int e = CC_E_ARG; + switch (kind) { + case CC_KIND_AGENT_ROOT: + e = cc_root_decode(buf, n, &r, &why) || cc_root_encode(&r, re, sizeof re, &rn, &why); + break; + case CC_KIND_MANIFEST: + e = cc_manifest_decode(buf, n, &man2, &why) || cc_manifest_encode(&man2, re, sizeof re, &rn, &why); + break; + case CC_KIND_AGENT_STATE: + e = cc_state_decode(buf, n, &st2, &why) || cc_state_encode(&st2, re, sizeof re, &rn, &why); + break; + case CC_KIND_CORTEX_WAL: + e = cc_wal_decode(buf, n, &wal2, &why) || cc_wal_encode(&wal2, re, sizeof re, &rn, &why); + break; + } + ok = ok && e == CC_OK && rn == n && !memcmp(re, b, n); + } +#else + (void)kind; (void)b; (void)n; (void)oid; (void)accepted; (void)a; (void)c; (void)re; (void)rn; +#endif + return ok; +} + +/* D-2: verdict of the untouched vector and of every single-bit flip must equal + * the Rust verdict string. Returns the number of disagreements; prints the + * first few. */ +static unsigned long d2_mismatches(const char *name, uint16_t kind, const uint8_t *b, size_t n, + const char *verdict, size_t vlen) +{ + uint8_t t[V_BYTES_MAX]; + unsigned long bad = 0; + if (vlen != 8 * n + 1) + return 1; + memcpy(t, b, n); +#ifndef CC_MUTANT_SKIP_D2 + if (c_verdict(kind, t, n) != verdict[0]) + bad++; + d2_compared++; + for (size_t i = 0; i < n * 8; i++) { + t[i / 8] ^= (uint8_t)(1u << (i % 8)); + char cv = c_verdict(kind, t, n); + t[i / 8] ^= (uint8_t)(1u << (i % 8)); + d2_compared++; + if (cv != verdict[i + 1]) { + if (bad++ < 3 && !quiet) + printf(" D-2 divergence %s bit %zu: C '%c' Rust '%c'\n", name, i, cv, verdict[i + 1]); + } + } +#else + (void)name; (void)kind; (void)verdict; +#endif + return bad; +} + +static void test_golden(void) +{ + CHECK(n_vecs == 22 && n_bids == 5 && n_deferred == 4 && n_reasons == 21); + /* Branch ids named in the fixture equal the C derivation (D-1). */ + { + uint8_t rb[32], e[32]; + cc_root_branch_id(AGENT, rb); + CHECK(hex_n(RB_HEX, 32, e) && !memcmp(rb, e, 32)); + } + for (int i = 0; i < n_vecs; i++) { + struct vec *v = &vecs[i]; + int expect_ok = strcmp(v->name, "state_forksum_overflow") != 0; + CHECK(v->verdict != 0); + if (!v->verdict) + continue; + d2_expected += 8 * v->n + 1; + /* the Rust verdict of the untouched vector: accept, except the hostile one */ + CHECK((v->verdict[0] == '.') == expect_ok); + int ok = d1_ok(v->kind, v->bytes, v->n, v->oid, v->verdict[0] == '.'); + if (!ok) + printf(" D-1 mismatch: %s\n", v->name); + CHECK(ok); + unsigned long bad = d2_mismatches(v->name, v->kind, v->bytes, v->n, v->verdict, v->verdict_len); + if (bad) + printf(" D-2: %s: %lu disagreements with Rust\n", v->name, bad); + CHECK(bad == 0); + } + /* The work was done: every vector, every bit (not skipped, not truncated). */ + CHECK(d1_compared == (unsigned long)n_vecs); + CHECK(d2_compared == d2_expected && d2_expected > 80000); + printf(" golden: %d vectors, %lu D-2 verdicts compared (C vs Rust)\n", n_vecs, d2_compared); +} + +/* The comparisons refuse tampered vectors: a flipped byte, a flipped ObjectId + * bit and an altered verdict character are each detected. */ +static void test_tampered(void) +{ + struct vec *v = &vecs[0]; /* root_operator, accepted */ + uint8_t t[V_BYTES_MAX], o[32]; + char vs[1024]; + quiet = 1; + CHECK(v->verdict && d1_ok(v->kind, v->bytes, v->n, v->oid, 1)); + memcpy(t, v->bytes, v->n); + t[100] ^= 0x01; /* inside the provisioned generation: still decodes, bytes differ */ + CHECK(!d1_ok(v->kind, t, v->n, v->oid, 1)); + memcpy(o, v->oid, 32); + o[31] ^= 0x80; + CHECK(!d1_ok(v->kind, v->bytes, v->n, o, 1)); + CHECK(v->verdict_len < sizeof vs); + memcpy(vs, v->verdict, v->verdict_len); + CHECK(d2_mismatches(v->name, v->kind, v->bytes, v->n, vs, v->verdict_len) == 0); + vs[0] = 'a'; /* untouched vector claimed refused */ + CHECK(d2_mismatches(v->name, v->kind, v->bytes, v->n, vs, v->verdict_len) == 1); + memcpy(vs, v->verdict, v->verdict_len); + vs[1 + 8 * 20] = vs[1 + 8 * 20] == 'f' ? 'a' : 'f'; /* a flip verdict altered */ + CHECK(d2_mismatches(v->name, v->kind, v->bytes, v->n, vs, v->verdict_len) == 1); + /* wrong length of verdict string is itself a disagreement */ + CHECK(d2_mismatches(v->name, v->kind, v->bytes, v->n, vs, v->verdict_len - 1) == 1); + /* a bit-flipped vector decodes to the verdict Rust gives for that flip */ + memcpy(t, v->bytes, v->n); + t[0] ^= 0x01; /* magic */ + CHECK(c_verdict(v->kind, t, v->n) == 'a'); +} + +int main(int argc, char **argv) { memset(AGENT, 0x11, 32); test_branch_ids(); @@ -546,5 +851,16 @@ int main(void) test_state(); test_wal(); test_decode_cap(); +#ifdef CC_FIXTURE_DIR + const char *dir = argc > 1 ? argv[1] : CC_FIXTURE_DIR; +#else + const char *dir = argc > 1 ? argv[1] : 0; +#endif + int loaded = dir && load_fixtures(dir); + CHECK(loaded); + if (loaded) { + test_golden(); + test_tampered(); + } return ck_t_verdict("test_continuity_codec"); }