Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
df4b2f3a
Unverified
Commit
df4b2f3a
authored
Jan 16, 2025
by
Matthew Slipper
Committed by
GitHub
Jan 16, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-e2e: Add timeouts to multi-peer sync test (#13801)
parent
7b862463
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
25 deletions
+37
-25
sync_test.go
op-node/p2p/sync_test.go
+37
-25
No files found.
op-node/p2p/sync_test.go
View file @
df4b2f3a
...
@@ -236,7 +236,7 @@ func TestMultiPeerSync(t *testing.T) {
...
@@ -236,7 +236,7 @@ func TestMultiPeerSync(t *testing.T) {
hostA
,
hostB
,
hostC
:=
hosts
[
0
],
hosts
[
1
],
hosts
[
2
]
hostA
,
hostB
,
hostC
:=
hosts
[
0
],
hosts
[
1
],
hosts
[
2
]
require
.
Equal
(
t
,
hostA
.
Network
()
.
Connectedness
(
hostB
.
ID
()),
network
.
Connected
)
require
.
Equal
(
t
,
hostA
.
Network
()
.
Connectedness
(
hostB
.
ID
()),
network
.
Connected
)
ctx
,
cancel
:=
context
.
With
Cancel
(
context
.
Background
()
)
ctx
,
cancel
:=
context
.
With
Timeout
(
context
.
Background
(),
5
*
time
.
Minute
)
defer
cancel
()
defer
cancel
()
clA
,
recvA
:=
setupPeer
(
ctx
,
hostA
)
clA
,
recvA
:=
setupPeer
(
ctx
,
hostA
)
...
@@ -264,11 +264,15 @@ func TestMultiPeerSync(t *testing.T) {
...
@@ -264,11 +264,15 @@ func TestMultiPeerSync(t *testing.T) {
// With such large range to request we are going to hit the rate-limits of B and C,
// With such large range to request we are going to hit the rate-limits of B and C,
// but that means we'll balance the work between the peers.
// but that means we'll balance the work between the peers.
for
i
:=
uint64
(
89
);
i
>
10
;
i
--
{
// wait for all payloads
for
i
:=
uint64
(
89
);
i
>
10
;
i
--
{
// wait for all payloads
e
:=
<-
recvA
select
{
p
:=
e
.
ExecutionPayload
case
e
:=
<-
recvA
:
exp
,
ok
:=
payloads
.
getPayload
(
uint64
(
p
.
BlockNumber
))
p
:=
e
.
ExecutionPayload
require
.
True
(
t
,
ok
,
"expecting known payload"
)
exp
,
ok
:=
payloads
.
getPayload
(
uint64
(
p
.
BlockNumber
))
require
.
Equal
(
t
,
exp
.
ExecutionPayload
.
BlockHash
,
p
.
BlockHash
,
"expecting the correct payload"
)
require
.
True
(
t
,
ok
,
"expecting known payload"
)
require
.
Equal
(
t
,
exp
.
ExecutionPayload
.
BlockHash
,
p
.
BlockHash
,
"expecting the correct payload"
)
case
<-
ctx
.
Done
()
:
t
.
Fatal
(
"timed out waiting for payload"
)
}
}
}
// now see if B can sync a range, and fill the gap with a re-request
// now see if B can sync a range, and fill the gap with a re-request
...
@@ -280,15 +284,19 @@ func TestMultiPeerSync(t *testing.T) {
...
@@ -280,15 +284,19 @@ func TestMultiPeerSync(t *testing.T) {
require
.
True
(
t
,
clB
.
activeRangeRequests
.
get
(
rangeReqId
),
"expecting range request to be active"
)
require
.
True
(
t
,
clB
.
activeRangeRequests
.
get
(
rangeReqId
),
"expecting range request to be active"
)
for
i
:=
uint64
(
29
);
i
>
25
;
i
--
{
for
i
:=
uint64
(
29
);
i
>
25
;
i
--
{
p
:=
<-
recvB
select
{
exp
,
ok
:=
payloads
.
getPayload
(
uint64
(
p
.
ExecutionPayload
.
BlockNumber
))
case
p
:=
<-
recvB
:
require
.
True
(
t
,
ok
,
"expecting known payload"
)
exp
,
ok
:=
payloads
.
getPayload
(
uint64
(
p
.
ExecutionPayload
.
BlockNumber
))
require
.
Equal
(
t
,
exp
.
ExecutionPayload
.
BlockHash
,
p
.
ExecutionPayload
.
BlockHash
,
"expecting the correct payload"
)
require
.
True
(
t
,
ok
,
"expecting known payload"
)
require
.
Equal
(
t
,
exp
.
ExecutionPayload
.
BlockHash
,
p
.
ExecutionPayload
.
BlockHash
,
"expecting the correct payload"
)
case
<-
ctx
.
Done
()
:
t
.
Fatal
(
"timed out waiting for payload"
)
}
}
}
// Wait for the request for block 25 to be made
// Wait for the request for block 25 to be made
c
tx
,
cancelFunc
:=
context
.
WithTimeout
(
context
.
Background
()
,
30
*
time
.
Second
)
c
hildCtx
,
cancelChild
:=
context
.
WithTimeout
(
ctx
,
30
*
time
.
Second
)
defer
cancel
Func
()
defer
cancel
Child
()
requestMade
:=
false
requestMade
:=
false
for
requestMade
!=
true
{
for
requestMade
!=
true
{
select
{
select
{
...
@@ -296,7 +304,7 @@ func TestMultiPeerSync(t *testing.T) {
...
@@ -296,7 +304,7 @@ func TestMultiPeerSync(t *testing.T) {
if
blockNum
==
25
{
if
blockNum
==
25
{
requestMade
=
true
requestMade
=
true
}
}
case
<-
ctx
.
Done
()
:
case
<-
c
hildC
tx
.
Done
()
:
t
.
Fatal
(
"Did not request block 25 in a reasonable time"
)
t
.
Fatal
(
"Did not request block 25 in a reasonable time"
)
}
}
}
}
...
@@ -310,10 +318,10 @@ func TestMultiPeerSync(t *testing.T) {
...
@@ -310,10 +318,10 @@ func TestMultiPeerSync(t *testing.T) {
// But the re-request checks the status in the main loop, and it may thus look like it's still in-flight,
// But the re-request checks the status in the main loop, and it may thus look like it's still in-flight,
// and thus not run the new request.
// and thus not run the new request.
// Wait till the failed request is recognized as marked as done, so the re-request actually runs.
// Wait till the failed request is recognized as marked as done, so the re-request actually runs.
c
tx
,
cancelFunc
=
context
.
WithTimeout
(
context
.
Background
()
,
30
*
time
.
Second
)
c
hildCtx
,
cancelChild
=
context
.
WithTimeout
(
ctx
,
30
*
time
.
Second
)
defer
cancel
Func
()
defer
cancel
Child
()
for
{
for
{
isInFlight
,
err
:=
clB
.
isInFlight
(
ctx
,
25
)
isInFlight
,
err
:=
clB
.
isInFlight
(
c
hildC
tx
,
25
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
time
.
Sleep
(
time
.
Second
)
time
.
Sleep
(
time
.
Second
)
if
!
isInFlight
{
if
!
isInFlight
{
...
@@ -328,15 +336,19 @@ func TestMultiPeerSync(t *testing.T) {
...
@@ -328,15 +336,19 @@ func TestMultiPeerSync(t *testing.T) {
_
,
err
=
clB
.
RequestL2Range
(
ctx
,
payloads
.
getBlockRef
(
20
),
payloads
.
getBlockRef
(
26
))
_
,
err
=
clB
.
RequestL2Range
(
ctx
,
payloads
.
getBlockRef
(
20
),
payloads
.
getBlockRef
(
26
))
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
for
i
:=
uint64
(
25
);
i
>
20
;
i
--
{
for
i
:=
uint64
(
25
);
i
>
20
;
i
--
{
p
:=
<-
recvB
select
{
exp
,
ok
:=
payloads
.
getPayload
(
uint64
(
p
.
ExecutionPayload
.
BlockNumber
))
case
p
:=
<-
recvB
:
require
.
True
(
t
,
ok
,
"expecting known payload"
)
exp
,
ok
:=
payloads
.
getPayload
(
uint64
(
p
.
ExecutionPayload
.
BlockNumber
))
require
.
Equal
(
t
,
exp
.
ExecutionPayload
.
BlockHash
,
p
.
ExecutionPayload
.
BlockHash
,
"expecting the correct payload"
)
require
.
True
(
t
,
ok
,
"expecting known payload"
)
require
.
Equal
(
t
,
exp
.
ParentBeaconBlockRoot
,
p
.
ParentBeaconBlockRoot
)
require
.
Equal
(
t
,
exp
.
ExecutionPayload
.
BlockHash
,
p
.
ExecutionPayload
.
BlockHash
,
"expecting the correct payload"
)
if
cfg
.
IsEcotone
(
uint64
(
p
.
ExecutionPayload
.
Timestamp
))
{
require
.
Equal
(
t
,
exp
.
ParentBeaconBlockRoot
,
p
.
ParentBeaconBlockRoot
)
require
.
NotNil
(
t
,
p
.
ParentBeaconBlockRoot
)
if
cfg
.
IsEcotone
(
uint64
(
p
.
ExecutionPayload
.
Timestamp
))
{
}
else
{
require
.
NotNil
(
t
,
p
.
ParentBeaconBlockRoot
)
require
.
Nil
(
t
,
p
.
ParentBeaconBlockRoot
)
}
else
{
require
.
Nil
(
t
,
p
.
ParentBeaconBlockRoot
)
}
case
<-
ctx
.
Done
()
:
t
.
Fatal
(
"timed out waiting for payload"
)
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment