core/state: fixup trie prefetcher test for new prefect func signature

This commit is contained in:
lightclient 2024-10-19 11:17:28 -06:00
parent 754cb33b11
commit de1422b2eb
No known key found for this signature in database
GPG key ID: 75C916AFEE20183E

View file

@ -53,12 +53,12 @@ func TestUseAfterTerminate(t *testing.T) {
prefetcher := newTriePrefetcher(db.db, db.originalRoot, "", true) prefetcher := newTriePrefetcher(db.db, db.originalRoot, "", true)
skey := common.HexToHash("aaa") skey := common.HexToHash("aaa")
if err := prefetcher.prefetch(common.Hash{}, db.originalRoot, common.Address{}, [][]byte{skey.Bytes()}, false); err != nil { if err := prefetcher.prefetch(common.Hash{}, db.originalRoot, common.Address{}, nil, []common.Hash{skey}, false); err != nil {
t.Errorf("Prefetch failed before terminate: %v", err) t.Errorf("Prefetch failed before terminate: %v", err)
} }
prefetcher.terminate(false) prefetcher.terminate(false)
if err := prefetcher.prefetch(common.Hash{}, db.originalRoot, common.Address{}, [][]byte{skey.Bytes()}, false); err == nil { if err := prefetcher.prefetch(common.Hash{}, db.originalRoot, common.Address{}, nil, []common.Hash{skey}, false); err == nil {
t.Errorf("Prefetch succeeded after terminate: %v", err) t.Errorf("Prefetch succeeded after terminate: %v", err)
} }
if tr := prefetcher.trie(common.Hash{}, db.originalRoot); tr == nil { if tr := prefetcher.trie(common.Hash{}, db.originalRoot); tr == nil {
@ -90,14 +90,10 @@ func TestVerklePrefetcher(t *testing.T) {
fetcher := newTriePrefetcher(sdb, root, "", false) fetcher := newTriePrefetcher(sdb, root, "", false)
// Read account // Read account
fetcher.prefetch(common.Hash{}, root, common.Address{}, [][]byte{ fetcher.prefetch(common.Hash{}, root, common.Address{}, []common.Address{addr}, nil, false)
addr.Bytes(),
}, false)
// Read storage slot // Read storage slot
fetcher.prefetch(crypto.Keccak256Hash(addr.Bytes()), sRoot, addr, [][]byte{ fetcher.prefetch(crypto.Keccak256Hash(addr.Bytes()), sRoot, addr, nil, []common.Hash{skey}, false)
skey.Bytes(),
}, false)
fetcher.terminate(false) fetcher.terminate(false)
accountTrie := fetcher.trie(common.Hash{}, root) accountTrie := fetcher.trie(common.Hash{}, root)