Documentation
¶
Index ¶
- Constants
- Variables
- func ClearAllSyncSegments(db ethdb.KeyValueStore) error
- func ClearAllSyncStorageTries(db ethdb.KeyValueStore) error
- func ClearSyncSegments(db ethdb.KeyValueStore, root common.Hash) error
- func ClearSyncStorageTrie(db ethdb.KeyValueStore, root common.Hash) error
- func DeleteCodeToFetch(db ethdb.KeyValueWriter, codeHash common.Hash) error
- func DeleteOfflinePruning(db ethdb.KeyValueWriter) error
- func DeletePopulateMissingTries(db ethdb.KeyValueWriter) error
- func DeleteSnapshotBlockHash(db ethdb.KeyValueWriter) error
- func GetLatestSyncPerformed(db ethdb.Iteratee) (uint64, error)
- func HasPruningDisabled(db ethdb.KeyValueReader) (bool, error)
- func NewAccountSnapshotsIterator(db ethdb.Iteratee) ethdb.Iterator
- func NewCodeToFetchIterator(db ethdb.Iteratee) ethdb.Iterator
- func NewSyncSegmentsIterator(db ethdb.Iteratee, root common.Hash) ethdb.Iterator
- func NewSyncStorageTriesIterator(db ethdb.Iteratee, seek []byte) ethdb.Iterator
- func ParseStateScheme(provided string, db ethdb.Database) (string, error)
- func ParseSyncSegmentKey(keyBytes []byte) (common.Hash, []byte)
- func ParseSyncStorageTrieKey(keyBytes []byte) (common.Hash, common.Hash)
- func ReadAcceptorTip(db ethdb.KeyValueReader) (common.Hash, error)
- func ReadChainConfig[T any](db ethdb.KeyValueReader, hash common.Hash, upgradeConfig *T) (*params.ChainConfig, error)
- func ReadOfflinePruning(db ethdb.KeyValueReader) (time.Time, error)
- func ReadPopulateMissingTries(db ethdb.KeyValueReader) (time.Time, error)
- func ReadSnapshotBlockHash(db ethdb.KeyValueReader) (common.Hash, error)
- func ReadSyncRoot(db ethdb.KeyValueReader) (common.Hash, error)
- func WriteAcceptorTip(db ethdb.KeyValueWriter, hash common.Hash) error
- func WriteChainConfig[T any](db ethdb.KeyValueWriter, hash common.Hash, config *params.ChainConfig, ...) error
- func WriteCodeToFetch(db ethdb.KeyValueWriter, codeHash common.Hash) error
- func WriteOfflinePruning(db ethdb.KeyValueWriter, ts time.Time) error
- func WritePopulateMissingTries(db ethdb.KeyValueWriter, ts time.Time) error
- func WritePruningDisabled(db ethdb.KeyValueWriter) error
- func WriteSnapshotBlockHash(db ethdb.KeyValueWriter, blockHash common.Hash) error
- func WriteSyncPerformed(db ethdb.KeyValueWriter, blockNumber uint64) error
- func WriteSyncRoot(db ethdb.KeyValueWriter, root common.Hash) error
- func WriteSyncSegment(db ethdb.KeyValueWriter, root common.Hash, start common.Hash) error
- func WriteSyncStorageTrie(db ethdb.KeyValueWriter, root common.Hash, account common.Hash) error
Constants ¶
const FirewoodScheme = "firewood"
FirewoodScheme is the scheme for the Firewood storage scheme.
Variables ¶
var ( // CodeToFetchPrefix + code hash -> empty value tracks the outstanding code hashes we need to fetch. CodeToFetchPrefix = []byte("CP") )
Functions ¶
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 DeleteCodeToFetch ¶
func DeleteCodeToFetch(db ethdb.KeyValueWriter, codeHash common.Hash) error
DeleteCodeToFetch removes the marker that the code corresponding to `hash` needs to be fetched.
func DeleteOfflinePruning ¶
func DeleteOfflinePruning(db ethdb.KeyValueWriter) error
DeleteOfflinePruning deletes any marker of the last attempt to run offline pruning.
func DeletePopulateMissingTries ¶
func DeletePopulateMissingTries(db ethdb.KeyValueWriter) error
DeletePopulateMissingTries deletes any marker of the last attempt to re-populate missing trie nodes.
func DeleteSnapshotBlockHash ¶
func DeleteSnapshotBlockHash(db ethdb.KeyValueWriter) error
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 ¶
GetLatestSyncPerformed returns the latest block number state synced performed to.
func HasPruningDisabled ¶
func HasPruningDisabled(db ethdb.KeyValueReader) (bool, error)
HasPruningDisabled returns true if there is a marker present indicating that the node has run with pruning disabled at some point.
func NewAccountSnapshotsIterator ¶
NewAccountSnapshotsIterator returns an iterator for walking all of the accounts in the snapshot
func NewCodeToFetchIterator ¶
NewCodeToFetchIterator returns a KeyLength iterator over all code hashes that are pending syncing. It is the caller's responsibility to parse the key and call Release on the returned iterator.
func NewSyncSegmentsIterator ¶
NewSyncSegmentsIterator returns a KeyLength iterator over all trie segments added for root. It is the caller's responsibility to parse the key and call Release on the returned iterator.
func NewSyncStorageTriesIterator ¶
NewSyncStorageTriesIterator returns a KeyLength iterator over all storage tries added for syncing (beginning at seek). It is the caller's responsibility to parse the key and call Release on the returned iterator.
func ParseStateScheme ¶
ParseStateScheme parses the state scheme from the provided string.
func ParseSyncSegmentKey ¶
ParseSyncSegmentKey returns the root and start position for a trie segment key returned from NewSyncSegmentsIterator.
func ParseSyncStorageTrieKey ¶
ParseSyncStorageTrieKey returns the root and account for a storage trie key returned from NewSyncStorageTriesIterator. It assumes the key has the `syncStorageTriesPrefix` followed by a 32-byte root and 32-byte account hash, and panics if the key is shorter than len(syncStorageTriesPrefix)+2*common.HashLength.
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 ReadChainConfig ¶
func ReadChainConfig[T any](db ethdb.KeyValueReader, hash common.Hash, upgradeConfig *T) (*params.ChainConfig, error)
ReadChainConfig retrieves the consensus settings based on the given genesis hash. The provided `upgradeConfig` (any JSON-unmarshalable type) will be populated if present on disk.
func ReadOfflinePruning ¶
func ReadOfflinePruning(db ethdb.KeyValueReader) (time.Time, error)
ReadOfflinePruning reads the most recent timestamp of an attempt to run offline pruning if present.
func ReadPopulateMissingTries ¶
func ReadPopulateMissingTries(db ethdb.KeyValueReader) (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, error)
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 WriteAcceptorTip ¶
func WriteAcceptorTip(db ethdb.KeyValueWriter, hash common.Hash) error
WriteAcceptorTip writes `hash` as the last accepted block that has been fully processed.
func WriteChainConfig ¶
func WriteChainConfig[T any](db ethdb.KeyValueWriter, hash common.Hash, config *params.ChainConfig, upgradeConfig T) error
WriteChainConfig writes the chain config settings to the database. The provided `upgradeConfig` (any JSON-marshalable type) will be stored alongside the chain config.
func WriteCodeToFetch ¶
func WriteCodeToFetch(db ethdb.KeyValueWriter, codeHash common.Hash) error
WriteCodeToFetch adds a marker that we need to fetch the code for `hash`.
func WriteOfflinePruning ¶
func WriteOfflinePruning(db ethdb.KeyValueWriter, ts time.Time) 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.KeyValueWriter, ts time.Time) error
WritePopulateMissingTries writes a marker for the current attempt to populate missing tries.
func WritePruningDisabled ¶
func WritePruningDisabled(db ethdb.KeyValueWriter) 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) error
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 ¶
WriteSyncSegment adds a trie segment for root at the given start position.
func WriteSyncStorageTrie ¶
WriteSyncStorageTrie adds a storage trie for account (with the given root) to be synced.
Types ¶
This section is empty.