Skip to content

proof: verify↔Merkle modes 2+3 (inclusion-proof verification + live Hash bridge)#54

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/dazzling-noether-hkgAV
Jun 18, 2026
Merged

proof: verify↔Merkle modes 2+3 (inclusion-proof verification + live Hash bridge)#54
hyperpolymath merged 1 commit into
mainfrom
claude/dazzling-noether-hkgAV

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Verify↔Merkle wiring — modes 2 & 3 (completes all three)

Rounds out the verify↔Merkle wiring you asked for ("all three, generic→granular"). Mode 1 (root-equivalence: rootFaithful / rootVerifySound) landed on main via #53; this adds the remaining two. Verified with idris2 0.8.0, --build (--total): 26/26 modules, axiom-free.

Mode 3 (granular) — inclusion-proof verification

inclusionVerifySound — for an in-range leaf, the inclusion proof from generateProof reconstructs the tree's true root, so a verifier checking (leaf, proof) against the root accepts exactly the genuine data at that position. This is merkleCorrect (Stage 1.1) read as a per-leaf verification guarantee. The propositional reconstruct = root is the wall-free core; the residual root == root Bool step in the verifyProof API is the documented primitive-Bits8 boundary.

Mode 2 (live bridge) — A2ML Hash ↔ Merkle HashBytes

hashToBytes — decodes an A2ML hex Hash to 32 raw Merkle bytes (via the proven Stage 2.3 codec). Snapshot-root verification composes it with rootVerifySound: convert the leaves and FSSnapshot.rootHash, build the tree, compare roots, and binding gives "same root ⇒ same blocks." Partial (Nothing on malformed hex); its correctness is the hex boundary (2.3-bounded), so it's surfaced as an explicit decode, not asserted.

The three modes, together (Ochrance.Filesystem.VerifyMerkle)

Mode Symbol Backed by
generic — root equivalence rootFaithful / rootVerifySound merkleBindingTree (1.4)
granular — inclusion proof inclusionVerifySound merkleCorrect (1.1)
live bridge — snapshot root hashToBytes (+ rootVerifySound) hex codec (2.3)

Still open (documented, architectural)

Fully replacing the live Hash-based verifyRefsHelper with a tree build needs hashToBytes' correctness (2.3, bounded by unpack/pack + Bits8) and a power-of-two leaf layout — a verify-path change, not a proof.

Verification note

The repo's Idris2 CI is a static scan, not a full type-check — verified with a real bootstrapped compiler before pushing.

🤖 Generated with Claude Code


Generated by Claude Code

… proof + live Hash bridge)

Rounds out the verify↔Merkle wiring to all three modes (generic→granular):
- inclusionVerifySound — inclusion-proof verification soundness: a generated
  (leaf, proof) reconstructs the tree's true root (merkleCorrect, Stage 1.1, read as
  a per-leaf verification guarantee). The propositional reconstruct = root is the
  wall-free core; the residual root == root Bool step is the documented Bits8 wall.
- hashToBytes — the live bridge decoding an A2ML Hash (hex string) to 32 Merkle
  HashBytes (via the proven Stage 2.3 hex codec); snapshot-root verification composes
  it with rootVerifySound. Conversion correctness is the hex boundary (2.3-bounded),
  surfaced as an explicit partial decode, not asserted.

(Mode 1, rootFaithful/rootVerifySound, landed in the previous commit / PR #53.)

Verified: idris2 0.8.0, --build (--total), 26/26 modules, axiom-free.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011z2t8zAxfcCNLJzU7YdpBQ
@hyperpolymath
hyperpolymath marked this pull request as ready for review June 18, 2026 07:06
@hyperpolymath
hyperpolymath merged commit ce195a5 into main Jun 18, 2026
19 checks passed
@hyperpolymath
hyperpolymath deleted the claude/dazzling-noether-hkgAV branch June 18, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants