mpt

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: Apache-2.0, Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StoreTypeMPT = types.StoreTypeMPT

	TriesInMemory = 100

	// StoreKey is string representation of the store key for mpt
	StoreKey = "mpt"
)
View Source
const (
	FlagTrieWriteAhead    = "trie.write-ahead"
	FlagTrieDirtyDisabled = "trie.dirty-disabled"
	FlagTrieCacheSize     = "trie.cache-size"
	FlagTrieNodesLimit    = "trie.nodes-limit"
	FlagTrieImgsLimit     = "trie.imgs-limit"
)
View Source
const (
	FlagTrieAccStoreCache = "trie.account-store-cache"
)
View Source
const ProofOpMptAbsence = "mpt:a"
View Source
const ProofOpMptValue = "mpt:v"

Variables

View Source
var (
	TrieWriteAhead          = false
	TrieDirtyDisabled       = false
	TrieCacheSize     uint  = 2048 // MB
	TrieNodesLimit    uint  = 256  // MB
	TrieImgsLimit     uint  = 4    // MB
	TrieCommitGap     int64 = 100
)
View Source
var (
	KeyPrefixAccRootMptHash        = []byte{0x11}
	KeyPrefixAccLatestStoredHeight = []byte{0x12}
	KeyPrefixEvmRootMptHash        = []byte{0x13}
	KeyPrefixEvmLatestStoredHeight = []byte{0x14}

	GAccToPrefetchChannel    = make(chan [][]byte, 2000)
	GAccTryUpdateTrieChannel = make(chan struct{})
	GAccTrieUpdatedChannel   = make(chan struct{})
)
View Source
var (
	NilHash = ethcmn.Hash{}

	// EmptyCodeHash is the known hash of an empty code.
	EmptyCodeHash      = crypto.Keccak256Hash(nil)
	EmptyCodeHashBytes = crypto.Keccak256(nil)

	// EmptyRootHash is the known root hash of an empty trie.
	EmptyRootHash      = ethtypes.EmptyRootHash
	EmptyRootHashBytes = EmptyRootHash.Bytes()
)
View Source
var (
	TrieAccStoreCache uint = 32 // MB
)

Functions

func InstanceOfMptStore

func InstanceOfMptStore() ethstate.Database

Types

type MptStore

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

MptStore Implements types.KVStore and CommitKVStore. Its main purpose is to own the same interface as iavl store in libs/cosmos-sdk/store/iavl/iavl_store.go

func NewMptStore

func NewMptStore(logger tmlog.Logger, id types.CommitID) (*MptStore, error)

func (*MptStore) CacheWrap

func (ms *MptStore) CacheWrap() types.CacheWrap

func (*MptStore) CacheWrapWithTrace

func (ms *MptStore) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.CacheWrap

func (*MptStore) CommitterCommit

func (ms *MptStore) CommitterCommit(delta *iavl.TreeDelta) (types.CommitID, *iavl.TreeDelta)

* implement CommitStore, CommitKVStore

func (*MptStore) CommitterCommitMap

func (ms *MptStore) CommitterCommitMap(deltaMap iavl.TreeDeltaMap) (_ types.CommitID, _ iavl.TreeDeltaMap)

func (*MptStore) CurrentVersion added in v1.6.1

func (ms *MptStore) CurrentVersion() int64

func (*MptStore) Delete

func (ms *MptStore) Delete(key []byte)

func (*MptStore) Get

func (ms *MptStore) Get(key []byte) []byte

func (*MptStore) GetDBReadCount

func (ms *MptStore) GetDBReadCount() int

func (*MptStore) GetDBReadTime

func (ms *MptStore) GetDBReadTime() int

func (*MptStore) GetDBWriteCount

func (ms *MptStore) GetDBWriteCount() int

func (*MptStore) GetFlatKVReadCount

func (ms *MptStore) GetFlatKVReadCount() int

func (*MptStore) GetFlatKVReadTime

func (ms *MptStore) GetFlatKVReadTime() int

func (*MptStore) GetFlatKVWriteCount

func (ms *MptStore) GetFlatKVWriteCount() int

func (*MptStore) GetFlatKVWriteTime

func (ms *MptStore) GetFlatKVWriteTime() int

func (*MptStore) GetImmutable

func (ms *MptStore) GetImmutable(height int64) (*MptStore, error)

func (*MptStore) GetLatestStoredBlockHeight

func (ms *MptStore) GetLatestStoredBlockHeight() uint64

GetLatestStoredBlockHeight get latest mpt storage height

func (*MptStore) GetMptRootHash

func (ms *MptStore) GetMptRootHash(height uint64) ethcmn.Hash

GetMptRootHash gets root mpt hash from block height

func (*MptStore) GetNodeReadCount

func (ms *MptStore) GetNodeReadCount() int

func (*MptStore) GetStoreType

func (ms *MptStore) GetStoreType() types.StoreType

* implement KVStore

func (*MptStore) Has

func (ms *MptStore) Has(key []byte) bool

func (*MptStore) HasVersion added in v1.5.4

func (ms *MptStore) HasVersion(height int64) bool

func (*MptStore) Iterator

func (ms *MptStore) Iterator(start, end []byte) types.Iterator

func (*MptStore) LastCommitID

func (ms *MptStore) LastCommitID() types.CommitID

func (*MptStore) LastCommitVersion added in v1.6.3

func (ms *MptStore) LastCommitVersion() int64

func (*MptStore) OnStop

func (ms *MptStore) OnStop() error

func (*MptStore) PushData2Database

func (ms *MptStore) PushData2Database(curHeight int64)

PushData2Database writes all associated state in cache to the database

func (*MptStore) Query

func (ms *MptStore) Query(req abci.RequestQuery) (res abci.ResponseQuery)

* implement Queryable

func (*MptStore) ResetCount

func (ms *MptStore) ResetCount()

func (*MptStore) ReverseIterator

func (ms *MptStore) ReverseIterator(start, end []byte) types.Iterator

func (*MptStore) Set

func (ms *MptStore) Set(key, value []byte)

func (*MptStore) SetLatestStoredBlockHeight

func (ms *MptStore) SetLatestStoredBlockHeight(height uint64)

SetLatestStoredBlockHeight sets the latest stored storage height

func (*MptStore) SetMptRootHash

func (ms *MptStore) SetMptRootHash(height uint64, hash ethcmn.Hash)

SetMptRootHash sets the mapping from block height to root mpt hash

func (*MptStore) SetPruning

func (ms *MptStore) SetPruning(options types.PruningOptions)

func (*MptStore) SetUpgradeVersion

func (ms *MptStore) SetUpgradeVersion(i int64)

func (*MptStore) StartPrefetcher

func (ms *MptStore) StartPrefetcher(namespace string)

func (*MptStore) StopPrefetcher

func (ms *MptStore) StopPrefetcher()

StopPrefetcher terminates a running prefetcher and reports any leftover stats from the gathered metrics.

func (*MptStore) StopWithVersion added in v1.6.1

func (ms *MptStore) StopWithVersion(targetVersion int64) error

Stop stops the blockchain service. If any imports are currently in progress it will abort them using the procInterrupt.

type ProofList

type ProofList [][]byte

func (*ProofList) Delete

func (n *ProofList) Delete(key []byte) error

func (*ProofList) Put

func (n *ProofList) Put(key []byte, value []byte) error

type TriePrefetcher

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

TriePrefetcher is an active prefetcher, which receives accounts or storage items and does trie-loading of them. The goal is to get as much useful content into the caches as possible.

Note, the prefetcher's API is not thread safe.

func NewTriePrefetcher

func NewTriePrefetcher(db ethstate.Database, root common.Hash, namespace string) *TriePrefetcher

NewTriePrefetcher

func (*TriePrefetcher) Close

func (p *TriePrefetcher) Close()

Close iterates over all the subfetchers, aborts any that were left spinning and reports the stats to the metrics subsystem.

func (*TriePrefetcher) Copy

func (p *TriePrefetcher) Copy() *TriePrefetcher

copy creates a deep-but-inactive copy of the trie prefetcher. Any trie data already loaded will be copied over, but no goroutines will be started. This is mostly used in the miner which creates a copy of it's actively mutated state to be sealed while it may further mutate the state.

func (*TriePrefetcher) Prefetch

func (p *TriePrefetcher) Prefetch(root common.Hash, keys [][]byte)

prefetch schedules a batch of trie items to prefetch.

func (*TriePrefetcher) Trie

func (p *TriePrefetcher) Trie(root common.Hash) ethstate.Trie

trie returns the trie matching the root hash, or nil if the prefetcher doesn't have it.

func (*TriePrefetcher) Used

func (p *TriePrefetcher) Used(root common.Hash, used [][]byte)

used marks a batch of state items used to allow creating statistics as to how useful or wasteful the prefetcher is.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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