Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocols/snap/sync_test: each peer have a different account trie #628

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading