Documentation ¶
Overview ¶
Package trie implements a dense Merkle Patricia Trie. See the documentation on Trie for details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type NewTrieFunc ¶ added in v0.2.1
type Storage ¶
type Storage interface { Put(key *bitset.BitSet, value *Node) error Get(key *bitset.BitSet) (*Node, error) Delete(key *bitset.BitSet) error }
Storage is the Persistent storage for the Trie
type TransactionStorage ¶ added in v0.3.0
type TransactionStorage struct {
// contains filtered or unexported fields
}
TransactionStorage is a database transaction on a trie.
func NewTransactionStorage ¶ added in v0.3.0
func NewTransactionStorage(txn db.Transaction, prefix []byte) *TransactionStorage
func (*TransactionStorage) Delete ¶ added in v0.3.0
func (t *TransactionStorage) Delete(key *bitset.BitSet) error
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}
Trie is a dense Merkle Patricia Trie (i.e., all internal nodes have two children).
This implementation allows for a "flat" storage by keying nodes on their path rather than their hash, resulting in O(1) accesses and O(log n) insertions.
The state trie specification describes a sparse Merkle Trie. Note that this dense implementation results in an equivalent commitment.
Terminology:
- path: represents the path as defined in the specification. Together with len, represents a relative path from the current node to the node's nearest non-empty child.
- len: represents the len as defined in the specification. The number of bits to take from the fixed-length path to reach the nearest non-empty child.
- key: represents the storage key for trie [Node]s. It is the full path to the node from the root.
func NewTriePedersen ¶ added in v0.2.1
func NewTriePoseidon ¶ added in v0.2.1
Click to show internal directories.
Click to hide internal directories.