Versions in this module Expand all Collapse all v0 v0.0.1 Jun 25, 2024 Changes in this version + var ErrCommitDisabled = errors.New("no database for committing") + func AssertTrieConsistency(t testing.TB, root common.Hash, a, b *Database, ...) + func CorruptTrie(t *testing.T, trieDB *Database, root common.Hash, n int) + func FillAccounts(t *testing.T, trieDB *Database, root common.Hash, numAccounts int, ...) (common.Hash, map[*keystore.Key]*types.StateAccount) + func FillTrie(t *testing.T, numKeys int, keySize int, testTrie *Trie) ([][]byte, [][]byte) + func GenerateTrie(t *testing.T, trieDB *Database, numKeys int, keySize int) (common.Hash, [][]byte, [][]byte) + func VerifyProof(rootHash common.Hash, key []byte, proofDb ethdb.KeyValueReader) (value []byte, err error) + func VerifyRangeProof(rootHash common.Hash, firstKey []byte, lastKey []byte, keys [][]byte, ...) (bool, error) + type Config struct + Cache int + Journal string + Preimages bool + StatsPrefix string + type Database struct + func NewDatabase(diskdb ethdb.Database) *Database + func NewDatabaseWithConfig(diskdb ethdb.Database, config *Config) *Database + func (db *Database) Cap(limit common.StorageSize) error + func (db *Database) Close() error + func (db *Database) Commit(root common.Hash, report bool) error + func (db *Database) Dereference(root common.Hash) error + func (db *Database) Initialized(genesisRoot common.Hash) bool + func (db *Database) Node(hash common.Hash) ([]byte, error) + func (db *Database) Reader(blockRoot common.Hash) Reader + func (db *Database) Reference(root common.Hash, parent common.Hash) error + func (db *Database) SaveCache(dir string) error + func (db *Database) SaveCachePeriodically(dir string, interval time.Duration, stopCh <-chan struct{}) + func (db *Database) Scheme() string + func (db *Database) Size() (common.StorageSize, common.StorageSize) + func (db *Database) Update(root common.Hash, parent common.Hash, nodes *trienode.MergedNodeSet) error + func (db *Database) UpdateAndReferenceRoot(root common.Hash, parent common.Hash, nodes *trienode.MergedNodeSet) error + type ID struct + Owner common.Hash + Root common.Hash + StateRoot common.Hash + func StateTrieID(root common.Hash) *ID + func StorageTrieID(stateRoot common.Hash, owner common.Hash, root common.Hash) *ID + func TrieID(root common.Hash) *ID + type Iterator struct + Err error + Key []byte + Value []byte + func NewIterator(it NodeIterator) *Iterator + func (it *Iterator) Next() bool + func (it *Iterator) Prove() [][]byte + type MissingNodeError struct + NodeHash common.Hash + Owner common.Hash + Path []byte + func (err *MissingNodeError) Error() string + func (err *MissingNodeError) Unwrap() error + type NodeIterator interface + AddResolver func(NodeResolver) + Error func() error + Hash func() common.Hash + Leaf func() bool + LeafBlob func() []byte + LeafKey func() []byte + LeafProof func() [][]byte + Next func(bool) bool + NodeBlob func() []byte + Parent func() common.Hash + Path func() []byte + func NewDifferenceIterator(a, b NodeIterator) (NodeIterator, *int) + func NewUnionIterator(iters []NodeIterator) (NodeIterator, *int) + type NodeReader interface + Reader func(root common.Hash) Reader + type NodeResolver func(owner common.Hash, path []byte, hash common.Hash) []byte + type NodeWriteFunc = func(owner common.Hash, path []byte, hash common.Hash, blob []byte) + type Reader interface + Node func(owner common.Hash, path []byte, hash common.Hash) ([]byte, error) + type SecureTrie = StateTrie + func NewSecure(stateRoot common.Hash, owner common.Hash, root common.Hash, db *Database) (*SecureTrie, error) + type StackTrie struct + func NewFromBinary(data []byte, writeFn NodeWriteFunc) (*StackTrie, error) + func NewStackTrie(writeFn NodeWriteFunc) *StackTrie + func NewStackTrieWithOwner(writeFn NodeWriteFunc, owner common.Hash) *StackTrie + func (st *StackTrie) Commit() (h common.Hash, err error) + func (st *StackTrie) Hash() (h common.Hash) + func (st *StackTrie) MarshalBinary() (data []byte, err error) + func (st *StackTrie) MustUpdate(key, value []byte) + func (st *StackTrie) Reset() + func (st *StackTrie) UnmarshalBinary(data []byte) error + func (st *StackTrie) Update(key, value []byte) error + type StateTrie struct + func NewStateTrie(id *ID, db *Database) (*StateTrie, error) + func (t *StateTrie) Commit(collectLeaf bool) (common.Hash, *trienode.NodeSet) + func (t *StateTrie) Copy() *StateTrie + func (t *StateTrie) DeleteAccount(address common.Address) error + func (t *StateTrie) DeleteStorage(_ common.Address, key []byte) error + func (t *StateTrie) GetAccount(address common.Address) (*types.StateAccount, error) + func (t *StateTrie) GetAccountByHash(addrHash common.Hash) (*types.StateAccount, error) + func (t *StateTrie) GetKey(shaKey []byte) []byte + func (t *StateTrie) GetNode(path []byte) ([]byte, int, error) + func (t *StateTrie) GetStorage(_ common.Address, key []byte) ([]byte, error) + func (t *StateTrie) Hash() common.Hash + func (t *StateTrie) MustDelete(key []byte) + func (t *StateTrie) MustGet(key []byte) []byte + func (t *StateTrie) MustUpdate(key, value []byte) + func (t *StateTrie) NodeIterator(start []byte) NodeIterator + func (t *StateTrie) Prove(key []byte, fromLevel uint, proofDb ethdb.KeyValueWriter) error + func (t *StateTrie) UpdateAccount(address common.Address, acc *types.StateAccount) error + func (t *StateTrie) UpdateStorage(_ common.Address, key, value []byte) error + type Trie struct + func New(id *ID, db NodeReader) (*Trie, error) + func NewEmpty(db *Database) *Trie + func (t *Trie) Commit(collectLeaf bool) (common.Hash, *trienode.NodeSet) + func (t *Trie) Copy() *Trie + func (t *Trie) Delete(key []byte) error + func (t *Trie) Get(key []byte) ([]byte, error) + func (t *Trie) GetNode(path []byte) ([]byte, int, error) + func (t *Trie) Hash() common.Hash + func (t *Trie) MustDelete(key []byte) + func (t *Trie) MustGet(key []byte) []byte + func (t *Trie) MustGetNode(path []byte) ([]byte, int) + func (t *Trie) MustUpdate(key, value []byte) + func (t *Trie) NodeIterator(start []byte) NodeIterator + func (t *Trie) Prove(key []byte, fromLevel uint, proofDb ethdb.KeyValueWriter) error + func (t *Trie) Reset() + func (t *Trie) Update(key, value []byte) error