statesync

package
v0.8.13-rc.4 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: GPL-3.0, LGPL-3.0 Imports: 29 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultMaxOutstandingCodeHashes = 5000
	DefaultNumCodeFetchingWorkers   = 5
)

Variables

This section is empty.

Functions

func FillAccountsWithOverlappingStorage

func FillAccountsWithOverlappingStorage(
	t *testing.T, trieDB *trie.Database, root common.Hash, numAccounts int, numOverlappingStorageRoots int,
) (common.Hash, map[*keystore.Key]*types.StateAccount)

FillAccountsWithOverlappingStorage adds [numAccounts] randomly generated accounts to the secure trie at [root] and commits it to [trieDB]. For each 3 accounts created: - One does not have a storage trie, - One has a storage trie shared with other accounts (total number of shared storage tries [numOverlappingStorageRoots]), - One has a uniquely generated storage trie, returns the new trie root and a map of funded keys to StateAccount structs.

func NewEVMStateSyncer

func NewEVMStateSyncer(config *EVMStateSyncerConfig) (*stateSyncer, error)

Types

type CodeSyncerConfig added in v0.8.13

type CodeSyncerConfig struct {
	// Maximum number of outstanding code hashes in the queue before the code syncer should block.
	MaxOutstandingCodeHashes int
	// Number of worker threads to fetch code from the network
	NumCodeFetchingWorkers int

	// Client for fetching code from the network
	Client statesyncclient.Client

	// Database for the code syncer to use.
	DB ethdb.Database
}

CodeSyncerConfig defines the configuration of the code syncer

type EVMStateSyncerConfig

type EVMStateSyncerConfig struct {
	Root                     common.Hash
	Client                   syncclient.Client
	DB                       ethdb.Database
	BatchSize                int
	MaxOutstandingCodeHashes int // Maximum number of code hashes in the code syncer queue
	NumCodeFetchingWorkers   int // Number of code syncing threads
}

type StateSyncProgress

type StateSyncProgress struct {
	MainTrie     *TrieProgress
	MainTrieDone bool
	Root         common.Hash
	StorageTries map[common.Hash]*StorageTrieProgress
}

StateSyncProgress tracks the progress of syncing the main trie and the sub-tasks for syncing storage tries.

type StorageTrieProgress

type StorageTrieProgress struct {
	*TrieProgress
	Account            common.Hash
	AdditionalAccounts []common.Hash
	Skipped            bool
}

type SyncETA added in v0.8.12

type SyncETA interface {
	// NotifyProgress is called when leafs are received to estimate progress and
	// updates the overall ETA if needed, logging a message if it has been more
	// than [updateInterval] since the last update.
	NotifyProgress(root common.Hash, startTime time.Time, startKey []byte, key []byte)

	// RemoveSyncedTrie is called when a trie is done syncing, so it will no longer
	// be considered for calculating the ETA.
	RemoveSyncedTrie(root common.Hash, skipped bool)
}

func NewSyncEta added in v0.8.12

func NewSyncEta(mainTrieRoot common.Hash) SyncETA

type TrieProgress

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

func NewTrieProgress

func NewTrieProgress(db ethdb.Batcher, batchSize int, eta SyncETA) *TrieProgress

Jump to

Keyboard shortcuts

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