Skip to content

Commit

Permalink
Self review
Browse files Browse the repository at this point in the history
  • Loading branch information
Olshansk committed Jun 3, 2024
1 parent c96cb4a commit 47b74de
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 169 deletions.
91 changes: 0 additions & 91 deletions docs/audit.md

This file was deleted.

2 changes: 0 additions & 2 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@ The [SMT extension node](./smt.md#extension-nodes) is very similar to that of
Ethereum's [Modified Merkle Patricia Trie](https://ethereum.org/developers/docs/data-structures-and-encoding/patricia-merkle-trie).

A quick primer on it can be found in this [5P;1R post](https://olshansky.substack.com/p/5p1r-ethereums-modified-merkle-patricia).

WIP
4 changes: 2 additions & 2 deletions docs/smt.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ Extension nodes represent a singly linked chain of inner nodes, with a single
child. In other words, they are an optimization to avoid having a long chain of
inner nodes where each inner node only has one child.

In other words, they are used to
represent a common path in the trie and as such contain the path and bounds of the path they represent. The `digest` of an extension
In other words, they are used to represent a common path in the trie and as such
contain the path and bounds of the path they represent. The `digest` of an extension
node is the hash of its path bounds, the path itself and the child nodes digest
concatenated.

Expand Down
67 changes: 0 additions & 67 deletions e2e_review.md

This file was deleted.

4 changes: 2 additions & 2 deletions hasher.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"hash"
)

// TODO_IN_THIS_PR: Improve how the `hasher` file is consolidated (or not)
// with `node_encoders.go` since the two are very similar.
// TODO_IMPROVE:: Improve how the `hasher` file is consolidated with
// `node_encoders.go` since the two are very similar.

// Ensure the hasher interfaces are satisfied
var (
Expand Down
2 changes: 1 addition & 1 deletion options.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func WithValueHasher(vh ValueHasher) TrieSpecOption {
// used instead of a key during proof verification. Otherwise, this will lead
// double hashing and product an incorrect leaf digest, thereby invalidating
// the proof.
// TODO_IN_THIS_PR: Need to understand this part more.
// TODO_TECHDEBT: Document better when/why this is needed.
func NoHasherSpec(hasher hash.Hash, sumTrie bool) *TrieSpec {
spec := newTrieSpec(hasher, sumTrie)

Expand Down
4 changes: 2 additions & 2 deletions smst.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func NewSparseMerkleSumTrie(
}

// Initialize a non-sum SMT and modify it to have a nil value hasher
// TODO_IN_THIS_PR: Understand the purpose of the nilValueHasher and why
// we're not applying it to the smst but we need it for the smt.
// TODO_UPNEXT(@Olshansk): Understand the purpose of the nilValueHasher and
// why we're not applying it to the smst but we need it for the smt.
smt := &SMT{
TrieSpec: trieSpec,
nodes: nodes,
Expand Down
2 changes: 1 addition & 1 deletion trie_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (spec *TrieSpec) hashSumSerialization(data []byte) []byte {

// depth returns the maximum depth of the trie.
// Since this tree is a binary tree, the depth is the number of bits in the path
// TODO_IN_THIS_PR: Try to understand why we're not taking the log of the output
// TODO_UPNEXT(@Olshansk):: Try to understand why we're not taking the log of the output
func (spec *TrieSpec) depth() int {
return spec.ph.PathSize() * 8 // path size is in bytes so multiply by 8 to get num bits
}
Expand Down
2 changes: 1 addition & 1 deletion types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package smt

// TODO_DISCUSS_IN_THIS_PR_IMPROVEMENTS:
// TODO_DISCUSS_IN_THE_FUTURE:
// 1. Should we rename all instances of digest to hash?
// 2. Should we introduce a shared interface between SparseMerkleTrie and SparseMerkleSumTrie?
// 3. Should we rename Commit to FlushToDisk?
Expand Down

0 comments on commit 47b74de

Please sign in to comment.