customrawdb

package
v1.16.20 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: GPL-3.0, LGPL-3.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// CodeToFetchPrefix is the prefix for code hashes that need to be fetched.
	// CodeToFetchPrefix + code hash -> empty value tracks the outstanding code hashes we need to fetch.
	CodeToFetchPrefix = []byte("CP")
)

State sync progress keys and prefixes

View Source
var FirewoodScheme = "firewood"

FirewoodScheme is the state scheme for Firewood (currently disabled). To disable Firewood, the scheme value must still be "firewood" so that comparisons like `provided == FirewoodScheme` don't accidentally match when provided is empty string. Firewood is disabled by not requesting it.

Functions

func AddCodeToFetch

func AddCodeToFetch(db ethdb.KeyValueWriter, hash common.Hash)

AddCodeToFetch adds a marker that we need to fetch the code for `hash`.

func ClearAllSyncSegments

func ClearAllSyncSegments(db ethdb.KeyValueStore) error

ClearAllSyncSegments removes all segment markers from db

func ClearAllSyncStorageTries

func ClearAllSyncStorageTries(db ethdb.KeyValueStore) error

ClearAllSyncStorageTries removes all storage tries added for syncing from db

func ClearSyncSegments

func ClearSyncSegments(db ethdb.KeyValueStore, root common.Hash) error

ClearSyncSegments removes segment markers for root from db

func ClearSyncStorageTrie

func ClearSyncStorageTrie(db ethdb.KeyValueStore, root common.Hash) error

ClearSyncStorageTrie removes all storage trie accounts (with the given root) from db. Intended for use when the trie with root has completed syncing.

func DeleteBloombits added in v0.8.6

func DeleteBloombits(db ethdb.Database, start, end uint64)

DeleteBloombits deletes all bloom bits for a given section range.

func DeleteCodeToFetch

func DeleteCodeToFetch(db ethdb.KeyValueWriter, hash common.Hash)

DeleteCodeToFetch removes the marker that the code corresponding to `hash` needs to be fetched.

func DeleteOfflinePruning

func DeleteOfflinePruning(db ethdb.KeyValueStore) error

DeleteOfflinePruning deletes any marker of the last attempt to run offline pruning.

func DeletePopulateMissingTries

func DeletePopulateMissingTries(db ethdb.KeyValueStore) error

DeletePopulateMissingTries deletes any marker of the last attempt to re-populate missing trie nodes.

func DeleteSnapshotBlockHash

func DeleteSnapshotBlockHash(db ethdb.KeyValueWriter)

DeleteSnapshotBlockHash deletes the hash of the block whose state is contained in the persisted snapshot. Since snapshots are not immutable, this method can be used during updates, so a crash or failure will mark the entire snapshot invalid.

func GetLatestSyncPerformed

func GetLatestSyncPerformed(db ethdb.Iteratee) uint64

GetLatestSyncPerformed returns the latest block number state synced performed to.

func HasPruningDisabled

func HasPruningDisabled(db ethdb.KeyValueStore) (bool, error)

HasPruningDisabled returns true if there is a marker present indicating that the node has run with pruning disabled at some point.

func InspectDatabase

func InspectDatabase(db ethdb.Database, keyPrefix, keyStart []byte) error

InspectDatabase traverses the entire database and checks the size of all different categories of data.

func IterateAccountSnapshots

func IterateAccountSnapshots(db ethdb.Iteratee) ethdb.Iterator

IterateAccountSnapshots returns an iterator for walking all of the accounts in the snapshot

func NewCodeToFetchIterator

func NewCodeToFetchIterator(db ethdb.Iteratee) ethdb.Iterator

NewCodeToFetchIterator returns a KeyLength iterator over all code hashes that are pending syncing. It is the caller's responsibility to unpack the key and call Release on the returned iterator.

func NewSyncPerformedIterator

func NewSyncPerformedIterator(db ethdb.Iteratee) ethdb.Iterator

NewSyncPerformedIterator returns an iterator over all block numbers the VM has state synced to.

func NewSyncSegmentsIterator

func NewSyncSegmentsIterator(db ethdb.Iteratee, root common.Hash) ethdb.Iterator

NewSyncSegmentsIterator returns a KeyLength iterator over all trie segments added for root. It is the caller's responsibility to unpack the key and call Release on the returned iterator.

func NewSyncStorageTriesIterator

func NewSyncStorageTriesIterator(db ethdb.Iteratee, seek []byte) ethdb.Iterator

NewSyncStorageTriesIterator returns a KeyLength iterator over all storage tries added for syncing (beginning at seek). It is the caller's responsibility to unpack the key and call Release on the returned iterator.

func ParseStateSchemeExt added in v0.8.4

func ParseStateSchemeExt(provided string, disk ethdb.Database) (string, error)

ParseStateSchemeExt parses the state scheme from the provided string.

func ReadAcceptorTip

func ReadAcceptorTip(db ethdb.KeyValueReader) (common.Hash, error)

ReadAcceptorTip reads the hash of the last accepted block that was fully processed. If there is no value present (the index is being initialized for the first time), then the empty hash is returned.

func ReadBlockGasCost added in v0.8.8

func ReadBlockGasCost(db ethdb.Reader, hash common.Hash, number uint64) *big.Int

ReadBlockGasCost reads the BlockGasCost for a header from its separate key.

func ReadBloomBits added in v0.8.6

func ReadBloomBits(db ethdb.KeyValueReader, bit uint, section uint64, head common.Hash) ([]byte, error)

ReadBloomBits retrieves the bloom bits for a specific section and bit index.

func ReadChainConfig

func ReadChainConfig(db ethdb.KeyValueReader, hash common.Hash) *params.ChainConfig

ReadChainConfig retrieves the consensus settings based on the given genesis hash.

func ReadHeader added in v0.8.8

func ReadHeader(db ethdb.Reader, hash common.Hash, number uint64) *types.Header

ReadHeader reads a header from the database and restores its HeaderExtra.

func ReadOfflinePruning

func ReadOfflinePruning(db ethdb.KeyValueStore) (time.Time, error)

ReadOfflinePruning reads the most recent timestamp of an attempt to run offline pruning if present.

func ReadPopulateMissingTries

func ReadPopulateMissingTries(db ethdb.KeyValueStore) (time.Time, error)

ReadPopulateMissingTries reads the most recent timestamp of an attempt to re-populate missing trie nodes.

func ReadSnapshotBlockHash

func ReadSnapshotBlockHash(db ethdb.KeyValueReader) common.Hash

ReadSnapshotBlockHash retrieves the hash of the block whose state is contained in the persisted snapshot.

func ReadSyncRoot

func ReadSyncRoot(db ethdb.KeyValueReader) (common.Hash, error)

ReadSyncRoot reads the root corresponding to the main trie of an in-progress sync and returns common.Hash{} if no in-progress sync was found.

func RestoreHeaderExtra added in v0.8.8

func RestoreHeaderExtra(db ethdb.Reader, header *types.Header, hash common.Hash, number uint64)

RestoreHeaderExtra reads the BlockGasCost from its separate key and stores it in the header's in-memory HeaderExtra.

func UnpackSyncPerformedKey

func UnpackSyncPerformedKey(key []byte) uint64

UnpackSyncPerformedKey returns the block number from keys the iterator returned from NewSyncPerformedIterator.

func UnpackSyncSegmentKey

func UnpackSyncSegmentKey(keyBytes []byte) (common.Hash, []byte)

UnpackSyncSegmentKey returns the root and start position for a trie segment key returned from NewSyncSegmentsIterator.

func UnpackSyncStorageTrieKey

func UnpackSyncStorageTrieKey(keyBytes []byte) (common.Hash, common.Hash)

UnpackSyncStorageTrieKey returns the root and account for a storage trie key returned from NewSyncStorageTriesIterator.

func WriteAcceptorTip

func WriteAcceptorTip(db ethdb.KeyValueWriter, hash common.Hash) error

WriteAcceptorTip writes `hash` as the last accepted block that has been fully processed.

func WriteBlock added in v0.8.8

func WriteBlock(db ethdb.KeyValueWriter, block *types.Block)

WriteBlock writes a block with its HeaderExtra (BlockGasCost) to the database. This is a replacement for rawdb.WriteBlock that preserves custom header fields.

func WriteBlockGasCost added in v0.8.8

func WriteBlockGasCost(db ethdb.KeyValueWriter, hash common.Hash, number uint64, cost *big.Int)

WriteBlockGasCost writes the BlockGasCost for a header to a separate key.

func WriteBloomBits added in v0.8.6

func WriteBloomBits(db ethdb.KeyValueWriter, bit uint, section uint64, head common.Hash, bits []byte) error

WriteBloomBits stores the bloom bits for a specific section and bit index.

func WriteChainConfig

func WriteChainConfig(db ethdb.KeyValueWriter, hash common.Hash, config *params.ChainConfig)

WriteChainConfig writes the chain config settings to the database.

func WriteHeader added in v0.8.8

func WriteHeader(db ethdb.KeyValueWriter, header *types.Header)

WriteHeader writes a header with its HeaderExtra (BlockGasCost) to the database. This uses rawdb.WriteHeader for the header itself and stores BlockGasCost separately.

func WriteOfflinePruning

func WriteOfflinePruning(db ethdb.KeyValueStore) error

WriteOfflinePruning writes a time marker of the last attempt to run offline pruning. The marker is written when offline pruning completes and is deleted when the node is started successfully with offline pruning disabled. This ensures users must disable offline pruning and start their node successfully between runs of offline pruning.

func WritePopulateMissingTries

func WritePopulateMissingTries(db ethdb.KeyValueStore) error

WritePopulateMissingTries writes a marker for the current attempt to populate missing tries.

func WritePruningDisabled

func WritePruningDisabled(db ethdb.KeyValueStore) error

WritePruningDisabled writes a marker to track whether the node has ever run with pruning disabled.

func WriteSnapshotBlockHash

func WriteSnapshotBlockHash(db ethdb.KeyValueWriter, blockHash common.Hash)

WriteSnapshotBlockHash stores the root of the block whose state is contained in the persisted snapshot.

func WriteSyncPerformed

func WriteSyncPerformed(db ethdb.KeyValueWriter, blockNumber uint64) error

WriteSyncPerformed logs an entry in `db` indicating the VM state synced to `blockNumber`.

func WriteSyncRoot

func WriteSyncRoot(db ethdb.KeyValueWriter, root common.Hash) error

WriteSyncRoot writes root as the root of the main trie of the in-progress sync.

func WriteSyncSegment

func WriteSyncSegment(db ethdb.KeyValueWriter, root common.Hash, start common.Hash) error

WriteSyncSegment adds a trie segment for root at the given start position.

func WriteSyncStorageTrie

func WriteSyncStorageTrie(db ethdb.KeyValueWriter, root common.Hash, account common.Hash) error

WriteSyncStorageTrie adds a storage trie for account (with the given root) to be synced.

Types

This section is empty.

Jump to

Keyboard shortcuts

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