reticiulum-specification/tools
Rob 512ae058e7 Add tools/verify_stamps.py — runtime-lock §5.7
12th verifier in the suite. Locks in the LXMF stamps and tickets
spec (§5.7) by exercising LXMF.LXMStamper directly:

  - Workblock construction: deterministic for a given material;
    confirms exactly 768 KiB at the WORKBLOCK_EXPAND_ROUNDS = 3000
    default (matches spec §5.7.2 documented size).
  - PoW search-and-validate: brute-force search at target_cost = 4
    bits (fast — usually 1-16 iterations). Confirms stamp_valid and
    stamp_value round-trip; tampers a byte and confirms rejection.
  - LXMessage.validate_stamp end-to-end: accepts a valid PoW stamp
    on a synthesized LXMessage; rejects a tampered one.
  - Ticket shortcut: builds stamp = SHA256(ticket || message_id)
    by hand, confirms validate_stamp(target_cost, tickets=[...])
    accepts with the matching ticket and rejects with a wrong one.

target_cost = 4 keeps the test fast; real interop uses 8-16 bits.
The verifier doesn't claim to be a stamp-cost benchmark — that's a
separate use case.

12 of 12 verifiers in tools/ now pass against RNS 1.2.0 / LXMF 0.9.6.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 15:13:59 -04:00
..
README.md Add tools/verify_stamps.py — runtime-lock §5.7 2026-05-03 15:13:59 -04:00
regen_identities.py Verify §2.3, §4.3, §7.1, §7.4 against upstream RNS 1.2.0 / LXMF 0.9.6 2026-05-03 10:14:51 -04:00
verify_announce_app_data.py Verify §2.3, §4.3, §7.1, §7.4 against upstream RNS 1.2.0 / LXMF 0.9.6 2026-05-03 10:14:51 -04:00
verify_announce_roundtrip.py Add three high-value verifiers: token crypto, announce, LXMF opportunistic 2026-05-03 12:41:20 -04:00
verify_destination_hash.py Fix and expand §1.3 — on-disk identity format (real spec bug!) 2026-05-03 11:54:54 -04:00
verify_link_handshake.py Add four more verifiers + receive-propagated flow + frontmatter version 2026-05-03 12:54:34 -04:00
verify_lxmf_opportunistic.py Add three high-value verifiers: token crypto, announce, LXMF opportunistic 2026-05-03 12:41:20 -04:00
verify_msgpack_quirk.py Add four more verifiers + receive-propagated flow + frontmatter version 2026-05-03 12:54:34 -04:00
verify_packet_header.py Verify §2.3, §4.3, §7.1, §7.4 against upstream RNS 1.2.0 / LXMF 0.9.6 2026-05-03 10:14:51 -04:00
verify_path_request.py Verify §2.3, §4.3, §7.1, §7.4 against upstream RNS 1.2.0 / LXMF 0.9.6 2026-05-03 10:14:51 -04:00
verify_proof_packet.py Add four more verifiers + receive-propagated flow + frontmatter version 2026-05-03 12:54:34 -04:00
verify_rnode_split.py Add four more verifiers + receive-propagated flow + frontmatter version 2026-05-03 12:54:34 -04:00
verify_stamps.py Add tools/verify_stamps.py — runtime-lock §5.7 2026-05-03 15:13:59 -04:00
verify_token_crypto.py Add three high-value verifiers: token crypto, announce, LXMF opportunistic 2026-05-03 12:41:20 -04:00

Verifier scripts

Self-contained Python scripts that test claims in ../SPEC.md against the upstream RNS / LXMF Python stack.

Conventions

  • Each script verifies one claim or one related cluster of claims.
  • Exit code 0 on PASS, non-zero on FAIL.
  • Print a one-line PASS/FAIL summary plus a unified diff or hex dump on mismatch.
  • Reference the SPEC.md section the script verifies in a docstring at the top.

Required environment

pip install rns lxmf

The scripts read RNS.__version__ at startup and print it in their output so a future reader can tell which RNS version a verification ran against.

Status

Populated against RNS 1.2.0 / LXMF 0.9.6:

Script Verifies SPEC.md section Status
verify_destination_hash.py §1.1, §1.2, §1.3 — identity composition, dest_hash = SHA256(name_hash || identity_hash)[:16], on-disk private-key round-trip via to_file/from_file
verify_packet_header.py §2.1, §2.2, §2.3 — flag byte layout, HEADER_1/HEADER_2 form, originator HEADER_1→HEADER_2 conversion via upstream Transport.outbound
verify_token_crypto.py §3 — Token encrypt/decrypt, HKDF salt = identity_hash, HMAC-then-AES order, PKCS#7 padding
verify_announce_app_data.py §4.3 — LXMF announce app_data 2-element form, parser tolerance
verify_announce_roundtrip.py §4.1, §4.2, §4.5 — announce body layout, signature, dest_hash recompute, tamper rejection
verify_lxmf_opportunistic.py §5.1, §5.2, §5.5, §5.6 — full identity → encrypt → decrypt → parse round-trip
verify_proof_packet.py §6.5 — implicit (64B) and explicit (96B) proof body forms, validator length-dispatch
verify_link_handshake.py §6.1, §6.2, §6.3, §6.6 — LINKREQUEST/LRPROOF body order, link_id derivation, signalling
verify_path_request.py §1.2 well-known hashes, §7.1 LXMF path-preamble gating
verify_rnode_split.py §8.3 — RNode air-frame split-packet TX/RX state machines
verify_msgpack_quirk.py §9.3 — encoding name as bytes vs str affects upstream parsing
verify_stamps.py §5.7 — workblock determinism, PoW stamp search/validate, ticket shortcut
regen_identities.py regenerates test-vectors/identities.json

See ../agent.md §5 and ../todo.md for the remaining priority order.