Skip to content

Subtree consistency proof verification#243

Open
phbnf wants to merge 8 commits into
transparency-dev:mainfrom
phbnf:vercons-easy
Open

Subtree consistency proof verification#243
phbnf wants to merge 8 commits into
transparency-dev:mainfrom
phbnf:vercons-easy

Conversation

@phbnf

@phbnf phbnf commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Towards #225.

This PR introduces VerifySubtreeConsistency. The implementation is a bit different from the current VerifyConsistency implementation, hence the PR length. However I believe that this one is easier to follow, and closer to specs:

  • First we reconstruct the original and the grown subtree roots
  • Then, we treat the rest of the proof as an inclusion proof

This is how I've explained things in the design doc as well.

I've got two other candidate implementations, that are more similar to the current one, but I find them quite hard to follow. The complexity is around figuring out which proof nodes we need to recompute the subtree root hash. For regular consistency proofs, breaking the proof down where the path of |end-1| and |size-1| is enough. It's a bit more complex when it comes to subtrees:

  • This implementation uses a decompSubtreeProof function, but I still find quite it hard to follow.
  • That implementation uses making, which isn't that straight forward at first sight.

I ran a few benchmarks, and did not find any significant performance difference between these implementations.

I've also gone maximalist on comments, and I'm happy to remove some.
I'm sure that either implementation could be improved, but since I'd rather that we agree on a direction first.

@phbnf phbnf requested a review from AlCutter June 24, 2026 06:25
@phbnf phbnf requested a review from a team as a code owner June 24, 2026 06:25
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 55.17241% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.17%. Comparing base (0845efa) to head (69c0e7f).

Files with missing lines Patch % Lines
proof/verify.go 55.17% 25 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #243      +/-   ##
==========================================
- Coverage   49.81%   49.17%   -0.65%     
==========================================
  Files           8        8              
  Lines         807      844      +37     
==========================================
+ Hits          402      415      +13     
- Misses        397      421      +24     
  Partials        8        8              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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