Skip to content

Align subtrees with updated specs - #18

Open
phbnf wants to merge 6 commits into
mainfrom
newspecs
Open

Align subtrees with updated specs#18
phbnf wants to merge 6 commits into
mainfrom
newspecs

Conversation

@phbnf

@phbnf phbnf commented Jul 22, 2026

Copy link
Copy Markdown
Owner
This commit updates the Merkle tree proof generation, verification, and reference implementations to align with recent specification changes in ietf-plants-wg/merkle-tree-certs:

* **PR #274 (`find_subtrees` for size <= 1 intervals):**
  * Updated `FindSubtrees` in proof.go to return two subtrees (`[start, end)` and `[end, end)`) when `end - start <= 1`, removing the previous special case that returned only one subtree when interval size

was <= 1.

* **PR #275 (0-length / empty subtrees):**
  * **Proof Generation & Validity:** Updated `isSubtreeValid` in proof.go and tree.go to treat `start == end` as a valid 0-length subtree. `SubtreeConsistencyProof` now returns an empty proof slice

([][]byte{}) when start == end.
* Proof Verification: Updated VerifySubtreeConsistency in verify.go to check if start == end upfront, verifying end <= size, len(proof) == 0, and subRoot == hasher.EmptyRoot() without
duplicate subtree validity calls or comparing against parentRoot. Updated RootFromSubtreeConsistencyProof to return hasher.EmptyRoot() when start == end && size == 0.
* Reference Implementation: Clarified preconditions in refSubtreeConsistencyProof in reference_test.go to explicitly handle start == end returning nil (empty proof).
* Tests & Vectors: Updated test loop bounds across proof_test.go, tree_test.go, and vectors_test.go to use inclusive upper limits (range ... + 1) to cover right edges and empty subtrees. Updated
rolling SHA-256 test digests to match PR #275.
* Probe Generator: Added static test vectors for empty subtrees in main.go and updated generated JSON testdata in testdata/subtreeconsistency/.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@phbnf
phbnf force-pushed the newspecs branch 3 times, most recently from e171d7a to 24cadc6 Compare July 22, 2026 17:53
@phbnf
phbnf force-pushed the newspecs branch 2 times, most recently from 895d522 to 3597cbb Compare July 23, 2026 10:56
phbnf added 4 commits July 23, 2026 11:10
Replace the wrapper around invalidConsistencyProof with a dedicated
invalidSubtreeConsistencyProof function in cmd/proofgen/main.go.

TAG=agy
CONV=1f76bf92-7d8b-43a5-942a-a4bd88025626
Update FindSubtrees in proof/proof.go to return two Subtree structs
by value instead of allocating a []Subtree slice.

TAG=agy
CONV=1f76bf92-7d8b-43a5-942a-a4bd88025626
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.

1 participant