mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
trie: do not expect ordering in stacktrie during fuzzing
This commit is contained in:
parent
58f65c60c2
commit
1fd6747a8a
1 changed files with 7 additions and 14 deletions
|
|
@ -37,16 +37,14 @@ func FuzzStackTrie(f *testing.F) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func fuzz(data []byte, debugging bool) {
|
func fuzz(data []byte, debugging bool) {
|
||||||
// This spongeDb is used to check the sequence of disk-db-writes
|
|
||||||
var (
|
var (
|
||||||
input = bytes.NewReader(data)
|
input = bytes.NewReader(data)
|
||||||
spongeA = &spongeDb{sponge: crypto.NewKeccakState()}
|
dbA = newTestDatabase(rawdb.NewMemoryDatabase(), rawdb.HashScheme)
|
||||||
dbA = newTestDatabase(rawdb.NewDatabase(spongeA), rawdb.HashScheme)
|
trieA = NewEmpty(dbA)
|
||||||
trieA = NewEmpty(dbA)
|
memDB = rawdb.NewMemoryDatabase()
|
||||||
spongeB = &spongeDb{sponge: crypto.NewKeccakState()}
|
dbB = newTestDatabase(memDB, rawdb.HashScheme)
|
||||||
dbB = newTestDatabase(rawdb.NewDatabase(spongeB), rawdb.HashScheme)
|
trieB = NewStackTrie(func(path []byte, hash common.Hash, blob []byte) {
|
||||||
trieB = NewStackTrie(func(path []byte, hash common.Hash, blob []byte) {
|
rawdb.WriteTrieNode(memDB, common.Hash{}, path, hash, blob, dbB.Scheme())
|
||||||
rawdb.WriteTrieNode(spongeB, common.Hash{}, path, hash, blob, dbB.Scheme())
|
|
||||||
})
|
})
|
||||||
vals []*kv
|
vals []*kv
|
||||||
maxElements = 10000
|
maxElements = 10000
|
||||||
|
|
@ -99,11 +97,6 @@ func fuzz(data []byte, debugging bool) {
|
||||||
if rootA != rootB {
|
if rootA != rootB {
|
||||||
panic(fmt.Sprintf("roots differ: (trie) %x != %x (stacktrie)", rootA, rootB))
|
panic(fmt.Sprintf("roots differ: (trie) %x != %x (stacktrie)", rootA, rootB))
|
||||||
}
|
}
|
||||||
sumA := spongeA.sponge.Sum(nil)
|
|
||||||
sumB := spongeB.sponge.Sum(nil)
|
|
||||||
if !bytes.Equal(sumA, sumB) {
|
|
||||||
panic(fmt.Sprintf("sequence differ: (trie) %x != %x (stacktrie)", sumA, sumB))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure all the nodes are persisted correctly
|
// Ensure all the nodes are persisted correctly
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue