code wiki / (root) / nx_journal_log_test.nx

nx_journal_log_test.nx

buildroot/runtime/nx_journal_log_test.nx

7876 B195 linesdepth 7pulls 7 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_journal_log_test.nx -- smoke for nx_journal_log ST-3 MVP. Exercises: 1. Allocation + canary + initial state 2. Append + read roundtrip on 3 distinct payloads 3. Count increments correctly 4. read returns correct schema_id per entry 5. read with oversized buffer; read out-of-range seq_no -> -1 6. Empty log -> verify_chain returns -1 (trivially intact); latest_hash returns NX_JOURNAL_NOT_FOUND 7. Filled log -> verify_chain returns -1 (chain intact) 8. latest_hash deterministic across two journals with same payload sequence (cross-journal hash determinism) 9. TAMPER detection: stomp entry K's blob_w0 directly -> verify_chain returns K+1 (next entry's prev_hash no longer matches the recomputed hash of the tampered entry) 10. Canary tamper on log struct -> all ops refuse 11. Bad-input gates (null log / null payload / negative len / out-of-range seq_no)

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_blob_store.nx nx_journal_log.nx nx_journal_log_test.nx

imports: nx_syscalls.nxnx_blob_store.nxnx_journal_log.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_blob_store_new sys_mmap nx_journal_log_new sys_mmap ↻ nx_journal_log_is_valid nx_journal_log_count nx_journal_log_is_valid ↻ nx_journal_log_verify_chai nx_journal_log_is_valid ↻ sys_mmap ↻ _journal_entry_hash sys_mmap ↻ _journal_canonicalize _journal_store_i64_le sha256_digest sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sha256_update sha256_compress_ni_blocks blk_set_byte sha256_compress sha256_compress_ni blk_word sha256_final blk_set_byte ↻ sha256_compress ↻ _journal_load_i64_le sys_mmap ↻ nx_journal_log_latest_hash nx_journal_log_is_valid ↻ _journal_entry_hash ↻ _fill_pattern nx_journal_log_append nx_journal_log_is_valid ↻ nx_blob_hash_new sys_mmap ↻ nx_blob_store_put

structs

none

consts

none

functions

25func _fill_pattern(buf: *u8, len: i64, seed: i64) -> i64
called by 1: main
34func main() -> i64