fix(dig-node): recompute the merkle root in the shared anchor-admit gate so admitted/pushed capsules are data-complete (#2246 #2240) - #197
Draft
MichaelTaylor3d wants to merge 1 commit into
Conversation
MichaelTaylor3d
force-pushed
the
fix/anchor-admit-merkle-recompute
branch
from
August 7, 2026 15:52
40c2b9c to
7bfb15d
Compare
…t MerkleNodes digests (#2246 #2240) The capsule-admit trust gate (ChainAnchoredModuleVerifier::rejection_reason) recomputed the merkle root from the capsule's own MerkleNodes section and compared it to the committed CurrentRoot. That is hollow: rule 4 already forces CurrentRoot == chain_root, a single untagged leaf's root IS that leaf, and decode_merkle_leaves accepts arbitrary bytes -- so MerkleNodes=[chain_root] with an empty/garbage ChunkPool passed for free, admitting a contentless capsule that was then cached and DHT-announced (phantom-holder / holder-set poisoning). Bind the SERVED content instead: recompute each resource leaf as resource_leaf(concat(ChunkPool ciphertexts)) per KeyTable entry, sort by static_key (the producer's order), fold, and require the root == committed root (== chain_root). Also require the recomputed leaves equal decode_merkle_leaves (MerkleNodes) so served inclusion proofs stay consistent with content. MerkleNodes is no longer trusted for the admit decision. Fail-closed on absent/undecodable KeyTable/ChunkPool or any out-of-range chunk index; an empty store folds to sha256([]). Covers both reshare-admit and cache.pushCapsule land (shared gate; full ChunkPool is materialized before the gate on both paths). No digstore change. 0.100.2->0.100.3. Closes #2246, Closes #2240. Co-Authored-By: Claude <noreply@anthropic.com>
MichaelTaylor3d
force-pushed
the
fix/anchor-admit-merkle-recompute
branch
from
August 7, 2026 16:30
0797b99 to
e8b1ba5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2246, Closes #2240 (super-repo DIG-Network/dig_ecosystem#2246 / #2240 — one deduped family; both are the same
ChainAnchoredModuleVerifiercode path).Problem: the capsule-admit trust gate (
ChainAnchoredModuleVerifier::rejection_reason,module_anchor.rs) today only byte-compares the module's committedCurrentRootsection against the chain-anchored root — it never proves that committed root is the merkle root of the DATA actually present. A header-matching-but-incomplete/tampered.digis therefore admitted → cached → served → DHT-announced, turning an honest node into an authoritative source of corrupt content. Same gate backs both reshare-admit (#2246) andcache.pushCapsuleland (#2240).Fix: add a fail-closed rule to the shared verifier — recompute
MerkleTree::from_leaves(decode_merkle_leaves(MerkleNodes)).root()from the parsedDataViewand reject (NotAnchored) if it ≠ the committedCurrentRoot(orMerkleNodesis absent/undecodable). digstore recompute primitives are already available (no cross-repo cascade).RED-first regression test (small in-memory fixture — committed root == chain root but
MerkleNodesrecompute to a different/absent root → must flip Anchored→NotAnchored) + a push-path twin. §5.1 backwards-compat: verified against golden.digfixtures (the canonical read path already requiresMerkleNodes). Versionfix:patch0.100.1→0.100.2.Draft = loop salvage anchor; implementation in progress.
Generated by Claude Code