6.3 KiB
ChronoSeal v0.6.0 — Synthetic Gene Mutation System
Overview & Motivation
ChronoSeal v0.6.0 introduces a synthetic mutation chain model to strengthen attestation liveness and anti-replay guarantees while preserving privacy-first behavior. The core model combines:
- a primary byte-oriented gene buffer (
Vec<u8>), and - a bounded secondary environment map (
Vec<(u16 symbol, u32 quantity)>).
Each heartbeat now carries deterministic mutation progression evidence (mutation_step, gene_commitment) that is validated server-side against the exact server-issued mutation order. This design increases attacker workload by coupling cryptographic chain continuity with stateful deterministic mutation parity.
Architectural Goals
- Keep runtime behavior deterministic across server and WASM execution.
- Preserve ephemerality and low operational complexity.
- Minimize additional latency on the heartbeat path.
- Improve protocol resistance against replay and mutation tampering.
- Maintain a maintainable codebase with explicit invariants and focused modules.
Design Decisions
-
Shared mutation engine
Mutation opcode semantics live inshared/src/vm_extensions.rsto guarantee server/client parity from one implementation. -
Deterministic gene commitment
A domain-separated BLAKE3 commitment (chronoseal/gene/v1) binds both gene bytes and sorted environment records. -
Bounded mutation complexity
Mutation program length is capped (MAX_MUTATION_PROGRAM_BYTES) and environment cardinality is capped (MAX_ENV_RECORDS). -
Strict validation on ingest
Environment payloads are validated for sortedness, uniqueness, non-zero quantity, and length constraints. -
Protocol-level mutation handshake
InitResponseandHeartbeatpayloads now include mutation step/order and commitment fields. -
DB backend control via
db_type
Server CLI/config now supports:sqlite-in-memory(default)sqlite-in-disk(active; usesdb_path)valkey(active compatibility mode; currently falls back to in-memory)
Implementation Plan
- Add gene model + deterministic commitment in
shared/gene.rs. - Implement v0.6.0 mutation opcode set in shared VM extensions.
- Persist mutation state per session (
gene,environment,pending_mutation,pending_mutation_step). - Extend protocol schema for mutation fields in init/heartbeat exchange.
- Validate mutation step + commitment parity before accepting heartbeat updates.
- Add WASM preview/commit mutation lifecycle mirroring server behavior.
- Add
db_typeCLI/config flow and runtime backend initialization strategy. - Add migration-safe schema extension (column existence checks + index creation).
Testing Strategy (detailed section)
ChronoSeal v0.6.0 test coverage is organized across unit, integration, and randomized/fuzz-style validation.
-
Unit, integration, and property tests
- Unit tests for gene invariants and encoding/decoding.
- Unit tests for every mutation opcode with stack-effect assertions.
- Integration tests for full session lifecycle and heartbeat acceptance/rejection paths.
- Table-driven randomized tests and fuzz-style random bytecode tests to validate deterministic failure/success symmetry.
-
Server-client parity testing
- Shared opcode engine parity tests across seeded mutation sequences.
- Multi-step mutation chain test (
test_mutation_chain) asserting identical server/client final state. - 10+ heartbeat deterministic simulation tests in session integration suite.
-
Evasion / attack simulation testing
- Replay attack simulation.
- Mutation step mismatch rejection.
- Mutation commitment tampering rejection.
- Malformed server mutation payload rejection.
- Stack underflow / unknown opcode / truncated program rejection.
-
Performance regression testing
- Bounded execution checks through capped program size and bounded record counts.
- Timing smoke regression test for mutation execution loops.
- End-to-end heartbeat test coverage to detect behavior regressions on hot paths.
Security Analysis
-
Replay resistance
Heartbeats are now tied to both chain hash and mutation step progression. -
Mutation tampering resistance
Server recomputes candidate gene state from authoritative pending mutation program and rejects commitment mismatch. -
Protocol ambiguity reduction
Canonical signing payload includes mutation fields, reducing exploitable unsigned state. -
Input hardening
Program size limits, stack underflow checks, and strict environment decoding reduce parser abuse and malformed payload amplification. -
Deterministic failure semantics
Invalid mutation instructions fail predictably and symmetrically across server and WASM paths.
Performance Considerations
- Mutation instructions are lightweight and mostly O(1); only
INSERT/DELETEare O(n) but bounded by max gene size. - Environment operations use sorted-vector binary search with tight upper bound (
MAX_ENV_RECORDS). - Commitment hashing is linear in gene size and record count, both bounded.
- Shared engine avoids duplicate logic and divergence-induced debugging overhead.
Migration & Backward Compatibility
- Schema migration is additive; new columns are created when missing.
- Existing deployments without mutation fields require updated client+server pair for heartbeat compatibility.
db_typedefaults to in-memory to preserve ephemeral behavior.sqlite-in-diskis now directly usable viadb_path.valkeycurrently runs in compatibility mode (in-memory fallback) to avoid startup failure while preserving CLI contract.
Risks & Mitigations
-
Risk: State divergence between server and client
Mitigation: shared opcode engine + deterministic seeded parity tests + multi-heartbeat integration tests. -
Risk: Mutation opcode abuse via malformed programs
Mitigation: strict parsing, length caps, explicit underflow/unknown-opcode errors. -
Risk: Performance regressions
Mitigation: bounded structures, smoke timing tests, and focused hot-path validation. -
Risk: Backend confusion during
db_typerollout
Mitigation: explicit CLI command (chronoseal db-type), config output visibility, and clear runtime compatibility behavior.