Documentation
¶
Index ¶
- func CopyStorageSnapshot(db ethdb.Iteratee, account common.Hash, batch ethdb.Batch, batchSize int, ...) error
- func FillAccounts(t *testing.T, trieDB *trie.Database, root common.Hash, numAccounts int, ...) (common.Hash, map[*keystore.Key]*types.StateAccount)
- func FillAccountsWithOverlappingStorage(t *testing.T, trieDB *trie.Database, root common.Hash, numAccounts int, ...) (common.Hash, map[*keystore.Key]*types.StateAccount)
- func NewEVMStateSyncer(config *EVMStateSyncerConfig) (*stateSyncer, error)
- func RestoreMainTrieProgressFromSnapshot(db ethdb.Iteratee, tr *TrieProgress) error
- func RestoreStorageTrieProgressFromSnapshot(db ethdb.Iteratee, tr *TrieProgress, account common.Hash) error
- func WriteAccountSnapshot(db ethdb.KeyValueWriter, accHash common.Hash, acc types.StateAccount)
- func WriteAccountStorageSnapshotFromTrie(batch ethdb.Batch, batchSize int, accountHash common.Hash, ...) error
- type EVMStateSyncerConfig
- type StateSyncProgress
- type StorageTrieProgress
- type TrieProgress
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyStorageSnapshot ¶
func CopyStorageSnapshot(db ethdb.Iteratee, account common.Hash, batch ethdb.Batch, batchSize int, dstAccounts []common.Hash) error
CopyStorageSnapshot iterates [db] to find all storage snapshot entries for [account] and copies them to the storage snapshot of each account in [dstAccounts] Note: assumes that the storage snapshot for [account] is already complete.
func FillAccounts ¶
func FillAccounts( t *testing.T, trieDB *trie.Database, root common.Hash, numAccounts int, onAccount func(*testing.T, int, types.StateAccount) types.StateAccount, ) (common.Hash, map[*keystore.Key]*types.StateAccount)
FillAccounts adds [numAccounts] randomly generated accounts to the secure trie at [root] and commits it to [trieDB]. [onAccount] is called if non-nil (so the caller can modify the account before it is stored in the secure trie). returns the new trie root and a map of funded keys to StateAccount structs.
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)
func RestoreMainTrieProgressFromSnapshot ¶
func RestoreMainTrieProgressFromSnapshot(db ethdb.Iteratee, tr *TrieProgress) error
RestoreMainTrieProgressFromSnapshot iterates the account snapshots from [db] and adds full RLP representations as leafs to the stack trie in [tr]. Also sets [tr.startsFrom] to the key that syncing can begin from.
func RestoreStorageTrieProgressFromSnapshot ¶
func RestoreStorageTrieProgressFromSnapshot(db ethdb.Iteratee, tr *TrieProgress, account common.Hash) error
RestoreStorageTrieProgressFromSnapshot iterates the account storage snapshots for [account] from [db] and adds key/value pairs as leafs to the stack trie in [tr]. Also sets [tr.startsFrom] to the key that syncing can begin from.
func WriteAccountSnapshot ¶
func WriteAccountSnapshot(db ethdb.KeyValueWriter, accHash common.Hash, acc types.StateAccount)
WriteAccountSnapshot stores the account represented by [acc] to the snapshot at [accHash], using SlimAccountRLP format (omitting empty code/storage).
func WriteAccountStorageSnapshotFromTrie ¶
func WriteAccountStorageSnapshotFromTrie(batch ethdb.Batch, batchSize int, accountHash common.Hash, storageTrie *trie.Trie) error
WriteAccountStorageSnapshotFromTrie iterates the trie at [storageTrie] and copies all entries to the storage snapshot for [accountHash].
Types ¶
type EVMStateSyncerConfig ¶
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 TrieProgress ¶
type TrieProgress struct {
// contains filtered or unexported fields
}
func NewTrieProgress ¶
func NewTrieProgress(db ethdb.Batcher, batchSize int, eta *syncETA) *TrieProgress