Documentation
¶
Index ¶
- Variables
- func DecodeTriesRoots(val []byte) (felt.Felt, felt.Felt, error)
- func EncodeNode(n Node) []byte
- func NewNodeFlag() nodeFlag
- type BinaryNode
- type DeletedNode
- type EdgeNode
- func (n *EdgeNode) Cache() (*HashNode, bool)
- func (n *EdgeNode) CommonPath(key *trieutils.Path) trieutils.Path
- func (n *EdgeNode) Copy() *EdgeNode
- func (n *EdgeNode) Hash(hf crypto.HashFn) felt.Felt
- func (n *EdgeNode) PathMatches(key *trieutils.Path) bool
- func (n *EdgeNode) String() string
- func (n *EdgeNode) Write(buf *bytes.Buffer) error
- type HashNode
- type LeafNode
- type MergeNodeSet
- type Node
- type NodeSet
- type NonLeafNode
- type TrieNode
- type ValueNode
Constants ¶
This section is empty.
Variables ¶
View Source
var NilValueNode = (*ValueNode)(&felt.Felt{})
Used when collapsing internal trie nodes for hashing, since unset children need to be hashed correctly
Functions ¶
func DecodeTriesRoots ¶ added in v0.14.7
Types ¶
type BinaryNode ¶
type BinaryNode struct {
Children [2]Node // 0 = left, 1 = right
Flags nodeFlag
}
Represents a binary branch node in the trie with two children
func (*BinaryNode) Cache ¶
func (n *BinaryNode) Cache() (*HashNode, bool)
func (*BinaryNode) Copy ¶
func (n *BinaryNode) Copy() *BinaryNode
func (*BinaryNode) Left ¶
func (n *BinaryNode) Left() Node
func (*BinaryNode) Right ¶
func (n *BinaryNode) Right() Node
func (*BinaryNode) String ¶
func (n *BinaryNode) String() string
type DeletedNode ¶
type DeletedNode struct {
// contains filtered or unexported fields
}
func NewDeleted ¶
func NewDeleted(isLeaf bool) *DeletedNode
func (*DeletedNode) Blob ¶
func (r *DeletedNode) Blob() []byte
func (*DeletedNode) Hash ¶
func (r *DeletedNode) Hash() felt.Felt
func (*DeletedNode) IsLeaf ¶
func (r *DeletedNode) IsLeaf() bool
type EdgeNode ¶
type EdgeNode struct {
Child Node // The child node at the end of the path
Path *trieutils.Path // The compressed path segment
Flags nodeFlag
}
Represents a path-compressed node that stores a path segment and a single child node
func (*EdgeNode) CommonPath ¶
Returns the common bits between the current node and the given key, starting from the most significant bit
type MergeNodeSet ¶
type MergeNodeSet struct {
OwnerSet *NodeSet // the node set of contract or class nodes
ChildSets map[felt.Felt]*NodeSet // each node set is indexed by the owner
}
func NewMergeNodeSet ¶
func NewMergeNodeSet(nodes *NodeSet) *MergeNodeSet
func (*MergeNodeSet) Merge ¶
func (m *MergeNodeSet) Merge(other *NodeSet) error
type Node ¶
type NodeSet ¶
type NodeSet struct {
Owner felt.Felt // The owner (i.e. contract address)
Nodes map[trieutils.Path]TrieNode
// contains filtered or unexported fields
}
Contains a set of nodes, which are indexed by their path in the trie. It is not thread safe.
func NewNodeSet ¶
func (*NodeSet) ForEach ¶
Iterates over the nodes in a sorted order and calls the callback for each node.
type NonLeafNode ¶
type NonLeafNode struct {
// contains filtered or unexported fields
}
Represents a raw non-leaf trie node, which contains the encoded blob and the hash of the node.
func NewNonLeaf ¶
func NewNonLeaf(hash felt.Felt, blob []byte) *NonLeafNode
func (*NonLeafNode) Blob ¶
func (r *NonLeafNode) Blob() []byte
func (*NonLeafNode) Hash ¶
func (r *NonLeafNode) Hash() felt.Felt
func (*NonLeafNode) IsLeaf ¶
func (r *NonLeafNode) IsLeaf() bool
Click to show internal directories.
Click to hide internal directories.