Skip to content

sptos-proof

Proof engine with 3-tier routing for the SPTOS Cognition Kernel

Overview

sptos-proof implements the proof engine from ADR-087. Every state mutation in SPTOS requires a cryptographic proof. The engine routes proof requests through three tiers based on operation type: Reflex (sub-100ns for vector updates), Standard (sub-100us with Merkle witnesses), and Deep (sub-10ms with full coherence verification).

Key Features

  • 3-tier proof routing — Automatic tier selection based on mutation type and routing context
  • Time-bounded validity — Proofs expire after a configurable window (default 100ms)
  • Single-use nonces — Each nonce can only be consumed once, preventing replay attacks
  • Merkle witnesses — Standard-tier proofs include Merkle tree path witnesses
  • Proof cache — Up to 64 entries with configurable TTL for Reflex-tier fast paths
  • spt-verified interop — Optional bridge to formal verification attestations

Dependencies

Key internal dependencies:

  • sptos-types — Proof types (ProofToken, ProofTier, ProofAttestation)
  • sptos-cap — Capability checking for PROVE rights enforcement

Usage

rust
use sptos_proof::{ProofEngine, ProofEngineConfig, ProofVerifier};
use sptos_types::ProofTier;

let mut engine = ProofEngine::new(ProofEngineConfig::default());
let token = engine.generate_reflex_proof(&hash, timestamp).unwrap();

let mut verifier = ProofVerifier::new();
verifier.verify(&token, &hash, timestamp).unwrap();

API Reference

Core Types

TypeDescription
ProofEngineCentral engine for generating proofs at all tiers
ProofEngineConfigEngine configuration (validity window, cache size)
ProofVerifierVerifies proof tokens against mutation hashes
ProofCacheFixed-size LRU cache for Reflex-tier proof entries
TierRouterRoutes proof requests to the appropriate tier
MerkleWitnessMerkle tree path witness for Standard-tier proofs
AttestationBuilderConstructs attestation records for the witness log
ProofErrorError type for proof operations

Released under the MIT License.