Skip to content

Commit

Permalink
protocols/snap/sync_test: each peer have a different account trie (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco4203 authored and huyngopt1994 committed Nov 21, 2024
1 parent fa4a087 commit 8b1fa06
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions eth/protocols/snap/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ func testSyncBloatedProof(t *testing.T, scheme string) {

nodeScheme, sourceAccountTrie, elems := makeAccountTrieNoStorage(scheme, 100)
source := newTestPeer("source", t, term)
source.accountTrie = sourceAccountTrie
source.accountTrie = sourceAccountTrie.Copy()
source.accountValues = elems

source.accountRequestHandler = func(t *testPeer, requestId uint64, root common.Hash, origin common.Hash, limit common.Hash, cap uint64) error {
Expand Down Expand Up @@ -663,7 +663,7 @@ func testSync(t *testing.T, scheme string) {

mkSource := func(name string) *testPeer {
source := newTestPeer(name, t, term)
source.accountTrie = sourceAccountTrie
source.accountTrie = sourceAccountTrie.Copy()
source.accountValues = elems
return source
}
Expand Down Expand Up @@ -696,7 +696,7 @@ func testSyncTinyTriePanic(t *testing.T, scheme string) {

mkSource := func(name string) *testPeer {
source := newTestPeer(name, t, term)
source.accountTrie = sourceAccountTrie
source.accountTrie = sourceAccountTrie.Copy()
source.accountValues = elems
return source
}
Expand Down Expand Up @@ -730,7 +730,7 @@ func testMultiSync(t *testing.T, scheme string) {

mkSource := func(name string) *testPeer {
source := newTestPeer(name, t, term)
source.accountTrie = sourceAccountTrie
source.accountTrie = sourceAccountTrie.Copy()
source.accountValues = elems
return source
}
Expand Down Expand Up @@ -767,7 +767,7 @@ func testSyncWithStorage(t *testing.T, scheme string) {

mkSource := func(name string) *testPeer {
source := newTestPeer(name, t, term)
source.accountTrie = sourceAccountTrie
source.accountTrie = sourceAccountTrie.Copy()
source.accountValues = elems
source.storageTries = storageTries
source.storageValues = storageElems
Expand Down Expand Up @@ -984,7 +984,7 @@ func testSyncBoundaryAccountTrie(t *testing.T, scheme string) {

mkSource := func(name string) *testPeer {
source := newTestPeer(name, t, term)
source.accountTrie = sourceAccountTrie
source.accountTrie = sourceAccountTrie.Copy()
source.accountValues = elems
return source
}
Expand Down Expand Up @@ -1108,7 +1108,7 @@ func testSyncNoStorageAndOneAccountCorruptPeer(t *testing.T, scheme string) {

mkSource := func(name string, accFn accountHandlerFunc) *testPeer {
source := newTestPeer(name, t, term)
source.accountTrie = sourceAccountTrie
source.accountTrie = sourceAccountTrie.Copy()
source.accountValues = elems
source.accountRequestHandler = accFn
return source
Expand Down Expand Up @@ -1151,7 +1151,7 @@ func testSyncNoStorageAndOneCodeCappedPeer(t *testing.T, scheme string) {

mkSource := func(name string, codeFn codeHandlerFunc) *testPeer {
source := newTestPeer(name, t, term)
source.accountTrie = sourceAccountTrie
source.accountTrie = sourceAccountTrie.Copy()
source.accountValues = elems
source.codeRequestHandler = codeFn
return source
Expand Down Expand Up @@ -1204,7 +1204,7 @@ func testSyncBoundaryStorageTrie(t *testing.T, scheme string) {

mkSource := func(name string) *testPeer {
source := newTestPeer(name, t, term)
source.accountTrie = sourceAccountTrie
source.accountTrie = sourceAccountTrie.Copy()
source.accountValues = elems
source.storageTries = storageTries
source.storageValues = storageElems
Expand Down Expand Up @@ -1244,7 +1244,7 @@ func testSyncWithStorageAndOneCappedPeer(t *testing.T, scheme string) {

mkSource := func(name string, slow bool) *testPeer {
source := newTestPeer(name, t, term)
source.accountTrie = sourceAccountTrie
source.accountTrie = sourceAccountTrie.Copy()
source.accountValues = elems
source.storageTries = storageTries
source.storageValues = storageElems
Expand Down Expand Up @@ -1290,7 +1290,7 @@ func testSyncWithStorageAndCorruptPeer(t *testing.T, scheme string) {

mkSource := func(name string, handler storageHandlerFunc) *testPeer {
source := newTestPeer(name, t, term)
source.accountTrie = sourceAccountTrie
source.accountTrie = sourceAccountTrie.Copy()
source.accountValues = elems
source.storageTries = storageTries
source.storageValues = storageElems
Expand Down Expand Up @@ -1332,7 +1332,7 @@ func testSyncWithStorageAndNonProvingPeer(t *testing.T, scheme string) {

mkSource := func(name string, handler storageHandlerFunc) *testPeer {
source := newTestPeer(name, t, term)
source.accountTrie = sourceAccountTrie
source.accountTrie = sourceAccountTrie.Copy()
source.accountValues = elems
source.storageTries = storageTries
source.storageValues = storageElems
Expand Down Expand Up @@ -1377,7 +1377,7 @@ func testSyncWithStorageMisbehavingProve(t *testing.T, scheme string) {

mkSource := func(name string) *testPeer {
source := newTestPeer(name, t, term)
source.accountTrie = sourceAccountTrie
source.accountTrie = sourceAccountTrie.Copy()
source.accountValues = elems
source.storageTries = storageTries
source.storageValues = storageElems
Expand Down Expand Up @@ -1800,7 +1800,7 @@ func testSyncAccountPerformance(t *testing.T, scheme string) {

mkSource := func(name string) *testPeer {
source := newTestPeer(name, t, term)
source.accountTrie = sourceAccountTrie
source.accountTrie = sourceAccountTrie.Copy()
source.accountValues = elems
return source
}
Expand Down

0 comments on commit 8b1fa06

Please sign in to comment.