Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
docs

docs
  • Loading branch information
weiihann committed Feb 26, 2025
1 parent dc3f89e commit be972d8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
12 changes: 8 additions & 4 deletions core/trie2/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,21 @@ type Node interface {
}

type (
// Represents a binary branch node in the trie with two children
BinaryNode struct {
Children [2]Node // 0 = left, 1 = right
flags nodeFlag
}
// Represents a path-compressed node that stores a path segment
// and a single child node
EdgeNode struct {
Child Node
Path *Path
Child Node // The child node at the end of the path
Path *Path // The compressed path segment
flags nodeFlag
}
HashNode struct{ felt.Felt }
// Represents a node that only contains a hash reference to another node
HashNode struct{ felt.Felt }
// Represents a leaf node that stores an actual value in the trie
ValueNode struct{ felt.Felt }
)

Expand Down Expand Up @@ -98,7 +103,6 @@ func (n ValueNode) String() string {
return fmt.Sprintf("Value(%s)", n.Felt.String())

Check warning on line 103 in core/trie2/node.go

View check run for this annotation

Codecov / codecov/patch

core/trie2/node.go#L102-L103

Added lines #L102 - L103 were not covered by tests
}

// TODO(weiihann): check if we want to return a pointer or a value
func (n *BinaryNode) copy() *BinaryNode { cpy := *n; return &cpy }
func (n *EdgeNode) copy() *EdgeNode { cpy := *n; return &cpy }

Expand Down
6 changes: 3 additions & 3 deletions db/buckets.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ const (
MempoolTail // key of the tail node
MempoolLength // number of transactions
MempoolNode
ClassTrie // ClassTrie + Node path -> Trie Node
ContractTrieContract // ContractTrieContract + Node path -> Trie Node
ContractTrieStorage // ContractTrieStorage + Contract Address + Node path -> Trie Node
ClassTrie // ClassTrie + nodetype + path + pathlength -> Trie Node
ContractTrieContract // ContractTrieContract + nodetype + path + pathlength -> Trie Node
ContractTrieStorage // ContractTrieStorage + nodetype + path + pathlength -> Trie Node
)

// Key flattens a prefix and series of byte arrays into a single []byte.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/cockroachdb/pebble v1.1.4
github.com/coder/websocket v1.8.12
github.com/consensys/gnark-crypto v0.16.0
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/ethereum/go-ethereum v1.15.0
github.com/fxamacker/cbor/v2 v2.7.0
github.com/go-playground/validator/v10 v10.25.0
Expand Down Expand Up @@ -56,7 +57,6 @@ require (
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
github.com/crate-crypto/go-kzg-4844 v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
Expand Down

0 comments on commit be972d8

Please sign in to comment.