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
67a0414d
Unverified
Commit
67a0414d
authored
Feb 18, 2022
by
Matthew Slipper
Committed by
GitHub
Feb 18, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2218 from ethereum-optimism/fix/handle-null-response
fix: handle null response in `eth_getBlockRange`
parents
59732e5f
e9602d86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
9 deletions
+37
-9
tasty-seahorses-tie.md
.changeset/tasty-seahorses-tie.md
+5
-0
service.ts
...data-transport-layer/src/services/l2-ingestion/service.ts
+32
-9
No files found.
.changeset/tasty-seahorses-tie.md
0 → 100644
View file @
67a0414d
---
'
@eth-optimism/data-transport-layer'
:
patch
---
Handle null response for
`eth_getBlockRange`
query
packages/data-transport-layer/src/services/l2-ingestion/service.ts
View file @
67a0414d
...
@@ -219,15 +219,38 @@ export class L2IngestionService extends BaseService<L2IngestionServiceOptions> {
...
@@ -219,15 +219,38 @@ export class L2IngestionService extends BaseService<L2IngestionServiceOptions> {
id
:
'
1
'
,
id
:
'
1
'
,
}
}
const
resp
=
await
axios
.
post
(
// Retry the `eth_getBlockRange` query in case the endBlockNumber
this
.
state
.
l2RpcProvider
.
connection
.
url
,
// is greater than the tip and `null` is returned. This gives time
req
,
// for the sync to catch up
{
responseType
:
'
stream
'
}
let
result
=
null
)
let
retry
=
0
const
respJson
=
await
bfj
.
parse
(
resp
.
data
,
{
while
(
result
===
null
)
{
yieldRate
:
4096
,
// this yields abit more often than the default of 16384
if
(
retry
===
6
)
{
})
throw
new
Error
(
blocks
=
respJson
.
result
`unable to fetch block range [
${
startBlockNumber
}
,
${
endBlockNumber
}
)`
)
}
const
resp
=
await
axios
.
post
(
this
.
state
.
l2RpcProvider
.
connection
.
url
,
req
,
{
responseType
:
'
stream
'
}
)
const
respJson
=
await
bfj
.
parse
(
resp
.
data
,
{
yieldRate
:
4096
,
// this yields abit more often than the default of 16384
})
result
=
respJson
.
result
if
(
result
===
null
)
{
retry
++
this
.
logger
.
info
(
`request for block range [
${
startBlockNumber
}
,
${
endBlockNumber
}
) returned null, retry
${
retry
}
`
)
await
sleep
(
1000
*
retry
)
}
}
blocks
=
result
}
}
for
(
const
block
of
blocks
)
{
for
(
const
block
of
blocks
)
{
...
...
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