Documentation
¶
Index ¶
- func AssertDBConsistency(t testing.TB, root common.Hash, clientDB ethdb.Database, ...)
- func AssertTrieConsistency(t testing.TB, root common.Hash, a, b *triedb.Database, ...)
- func CorruptTrie(t *testing.T, diskdb ethdb.Batcher, tr *trie.Trie, n int)
- func FillAccounts(t *testing.T, r *rand.Rand, trieDB *triedb.Database, root common.Hash, ...) (common.Hash, map[*utilstest.Key]*types.StateAccount)
- func FillAccountsWithOverlappingStorage(t *testing.T, r *rand.Rand, trieDB *triedb.Database, root common.Hash, ...) (common.Hash, map[*utilstest.Key]*types.StateAccount)
- func FillAccountsWithStorage(t *testing.T, r *rand.Rand, serverDB ethdb.Database, ...) common.Hash
- func FillTrie(t *testing.T, r *rand.Rand, start, numKeys int, keySize int, ...) (common.Hash, [][]byte, [][]byte)
- func GenerateTrie(t *testing.T, r *rand.Rand, trieDB *triedb.Database, numKeys int, keySize int) (common.Hash, [][]byte, [][]byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertDBConsistency ¶
func AssertDBConsistency(t testing.TB, root common.Hash, clientDB ethdb.Database, serverTrieDB, clientTrieDB *triedb.Database)
AssertDBConsistency checks [serverTrieDB] and [clientTrieDB] have the same EVM state trie at [root], and that [clientTrieDB.DiskDB] has corresponding account & snapshot values. Also verifies any code referenced by the EVM state is present in [clientTrieDB] and the hash is correct.
func AssertTrieConsistency ¶
func AssertTrieConsistency(t testing.TB, root common.Hash, a, b *triedb.Database, onLeaf func(key, val []byte) error)
AssertTrieConsistency ensures given trieDB [a] and [b] both have the same non-empty trie at [root]. (all key/value pairs must be equal)
func CorruptTrie ¶
CorruptTrie deletes every [n]th trie node from the trie given by [tr] from the underlying [db]. Assumes [tr] can be iterated without issue.
func FillAccounts ¶
func FillAccounts( t *testing.T, r *rand.Rand, trieDB *triedb.Database, root common.Hash, numAccounts int, onAccount func(*testing.T, int, types.StateAccount) types.StateAccount, ) (common.Hash, map[*utilstest.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, r *rand.Rand, trieDB *triedb.Database, root common.Hash, numAccounts int, numOverlappingStorageRoots int, ) (common.Hash, map[*utilstest.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 FillAccountsWithStorage ¶
func FillTrie ¶
func FillTrie(t *testing.T, r *rand.Rand, start, numKeys int, keySize int, trieDB *triedb.Database, root common.Hash) (common.Hash, [][]byte, [][]byte)
FillTrie fills a given trie with [numKeys] random keys, each of size [keySize] returns inserted keys and values
func GenerateTrie ¶
func GenerateTrie(t *testing.T, r *rand.Rand, trieDB *triedb.Database, numKeys int, keySize int) (common.Hash, [][]byte, [][]byte)
GenerateTrie creates a trie with [numKeys] random key-value pairs inside of [trieDB]. Returns the root of the generated trie, the slice of keys inserted into the trie in lexicographical order, and the slice of corresponding values.
Types ¶
This section is empty.