mpt

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2024 License: MIT, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadTrie

func ReadTrie(root common.Hash, getPreimage func(key common.Hash) []byte) []hexutil.Bytes

ReadTrie takes a Merkle Patricia Trie (MPT) root of a "DerivableList", and a pre-image oracle getter, and traverses the implied MPT to collect all raw leaf nodes in order, which are then returned.

func WriteTrie

func WriteTrie(values []hexutil.Bytes) (common.Hash, []hexutil.Bytes)

WriteTrie takes a list of values, and merkleizes them as a "DerivableList": a Merkle Patricia Trie (MPT) with values keyed by their RLP encoded index. This merkleization matches that of transactions, receipts, and withdrawals lists in the block header (at least up to the Shanghai L1 update). This then returns the MPT root and a list of pre-images of the trie. Note: empty values are illegal, and there may be less pre-images returned than values, if any values are less than 32 bytes and fit into branch-node slots that way.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB implements the ethdb.Database to back the StateDB of Geth.

func (*DB) Ancient

func (p *DB) Ancient(kind string, number uint64) ([]byte, error)

func (*DB) AncientDatadir

func (p *DB) AncientDatadir() (string, error)

func (*DB) AncientRange

func (p *DB) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error)

func (*DB) AncientSize

func (p *DB) AncientSize(kind string) (uint64, error)

func (*DB) Ancients

func (p *DB) Ancients() (uint64, error)

func (DB) Close

func (p DB) Close() error

func (DB) Compact

func (p DB) Compact(start []byte, limit []byte) error

func (DB) Delete

func (p DB) Delete(key []byte) error

func (*DB) Get

func (p *DB) Get(key []byte) ([]byte, error)

func (*DB) Has

func (p *DB) Has(key []byte) (bool, error)

func (*DB) HasAncient

func (p *DB) HasAncient(kind string, number uint64) (bool, error)

func (*DB) MigrateTable

func (p *DB) MigrateTable(s string, f func([]byte) ([]byte, error)) error

func (*DB) ModifyAncients

func (p *DB) ModifyAncients(f func(ethdb.AncientWriteOp) error) (int64, error)

func (DB) NewBatch

func (p DB) NewBatch() ethdb.Batch

func (DB) NewBatchWithSize

func (p DB) NewBatchWithSize(size int) ethdb.Batch

func (DB) NewIterator

func (p DB) NewIterator(prefix []byte, start []byte) ethdb.Iterator

func (DB) NewSnapshot

func (p DB) NewSnapshot() (ethdb.Snapshot, error)

func (*DB) Put

func (p *DB) Put(key []byte, value []byte) error

func (*DB) ReadAncients

func (p *DB) ReadAncients(fn func(ethdb.AncientReaderOp) error) (err error)

func (DB) Stat

func (p DB) Stat(property string) (string, error)

func (*DB) Sync

func (p *DB) Sync() error

func (*DB) Tail

func (p *DB) Tail() (uint64, error)

func (*DB) TruncateHead

func (p *DB) TruncateHead(n uint64) (uint64, error)

func (*DB) TruncateTail

func (p *DB) TruncateTail(n uint64) (uint64, error)

type Hooks

type Hooks struct {
	Get    func(key []byte) []byte
	Put    func(key []byte, value []byte)
	Delete func(key []byte)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL