Skip to content

Commit 88fbee0

Browse files
authored
Fix merkle comment typo (#1393)
<!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will post its summary as a comment. --> ### Correct MerkleTree doc comment in `pkg/merkle/tree.go` to state root at index 0 and note nil empty nodes and leaves Updates the `MerkleTree` struct documentation to reflect 0-indexed root and clarifies that empty nodes and leaves are `nil` and not hashed in [tree.go](https://github.com/xmtp/xmtpd/pull/1393/files#diff-4a0ec8af27f891e4481136ec6a06b2eea6423d8992b8ea8c5c14d841b05b4d9a). #### 📍Where to Start Start with the `MerkleTree` struct doc comment in [tree.go](https://github.com/xmtp/xmtpd/pull/1393/files#diff-4a0ec8af27f891e4481136ec6a06b2eea6423d8992b8ea8c5c14d841b05b4d9a). ---- <!-- Macroscope's review summary starts here --> <a href="https://app.macroscope.com">Macroscope</a> summarized 2a966ac. <!-- Macroscope's review summary ends here --> <!-- macroscope-ui-refresh --> <!-- Macroscope's pull request summary ends here -->
1 parent 5bc20e5 commit 88fbee0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/merkle/tree.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ type Leaf []byte
1313

1414
// MerkleTree is a binary Merkle tree.
1515
//
16-
// tree has the collection of nodes, where:
17-
// - The tree is 1-indexed, so root is at index 1.
18-
// - The internal nodes are at index 1 to N-1.
19-
// - The leaves are at index N to 2N-1.
16+
// The tree is built as a balanced tree, where:
17+
// The root is at index 0, internal nodes are at index 1 to N-1, and the leaves are at index N to 2N-1.
18+
// Empty nodes and leaves are nil and not hashed, to save space.
19+
2020
type MerkleTree struct {
2121
tree []Node
2222
leaves []Leaf

0 commit comments

Comments
 (0)