Skip to content

Commit

Permalink
chore: update documentation with root info
Browse files Browse the repository at this point in the history
  • Loading branch information
h5law committed Jan 9, 2024
1 parent 5709f03 commit ad3911c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/merkle-sum-trie.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
+ [General Trie Structure](#general-trie-structure)
+ [Binary Sum Digests](#binary-sum-digests)
- [Sum](#sum)
- [Roots](#roots)
- [Nil Values](#nil-values)

<!-- tocstop -->
Expand Down Expand Up @@ -248,6 +249,15 @@ graph TB
The `Sum()` function adds functionality to easily retrieve the trie's current
sum as a `uint64`.

## Roots

Roots are `[]byte` types aliases by the `MerkleRoot` type. This type has one
method `Sum(sumTrie bool) uint64`. For the SMST this method is used by its own
`Sum()` method to return the total sum of the trie.

The `MerkleRoot` type being an alias means it can be used in place of the
`[]byte` type. Specifically for proofs.

## Nil Values

A `nil` value and `0` weight is the same as the placeholder value and default
Expand Down
9 changes: 9 additions & 0 deletions docs/smt.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- [Values](#values)
* [Nil values](#nil-values)
- [Hashers & Digests](#hashers--digests)
- [Roots](#roots)
- [Proofs](#proofs)
* [Verification](#verification)
* [Closest Proof](#closest-proof)
Expand Down Expand Up @@ -342,6 +343,14 @@ graph TD
VH --ValueHash-->L
```

## Roots

Roots are `[]byte` types aliases by the `MerkleRoot` type. This type has one
method `Sum(sumTrie bool) uint64`. For the SMT this method **always** returns 0.

The `MerkleRoot` type being an alias means it can be used in place of the
`[]byte` type. Specifically for proofs.

## Proofs

The `SparseMerkleProof` type contains the information required for inclusion
Expand Down

0 comments on commit ad3911c

Please sign in to comment.