Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion draft-davidben-tls-merkle-tree-certs.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ Given an ordered list of `n` inputs, `D_n = {d[0], d[1], ..., d[n-1]}`, {{Sectio
A *subtree* of this Merkle Tree is defined by two integers, `start` and `end`, such that:

* `0 <= start < end <= n`
* If `k` is the largest power of 2 that is greater than or equal to `end - start`, `start` must be a multiple of `k`
* If `k` is the largest power of 2 that is less than or equal to `end - start`, `start` must be a multiple of `k`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I think greater is correct, unless I'm confused? [2, 5) is not a valid subtree because it makes this tree:

  /\
 /\ |
2 3 4

But then [0, 5) looks like this, which doesn't contain that tree:

     /\
    /  \
   /\   |
  /  \  |
 /\  /\ |
0 1 2 3 4

So if the subtree has size 3, we need start to be 4-aligned, not just 2-aligned.

But in that case "largest power of 2" should be "smallest power of 2".

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, you're right--thanks for the catch and the counterexample! I agree the correct version is "If k is the smallest power of 2 that is greater than or equal to end - start, start must be a multiple of k", since for any size subtree we want the start index to be aligned with the next-greatest power of two.

I got confused since RFC9162 and the subtree consistency proof section say "let k be the largest power of two smaller than n", but we're dealing with a different k here--that k is for a split index, but the k here is a restriction on the subtree start index. Maybe we pick a new letter like s for "start"?


Note that, if `start` is zero, the second condition is always true.

Expand Down