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
9f0f7ec4
Commit
9f0f7ec4
authored
Jun 09, 2023
by
Hamdi Allam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some better naming
parent
bd3304d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
l1_processor.go
indexer/processor/l1_processor.go
+10
-11
No files found.
indexer/processor/l1_processor.go
View file @
9f0f7ec4
...
@@ -110,8 +110,7 @@ func l1ProcessFn(processLog log.Logger, ethClient node.EthClient, l1Contracts L1
...
@@ -110,8 +110,7 @@ func l1ProcessFn(processLog log.Logger, ethClient node.EthClient, l1Contracts L1
for
i
,
log
:=
range
logs
{
for
i
,
log
:=
range
logs
{
header
,
ok
:=
l1HeaderMap
[
log
.
BlockHash
]
header
,
ok
:=
l1HeaderMap
[
log
.
BlockHash
]
if
!
ok
{
if
!
ok
{
// Log the individual headers in the batch?
processLog
.
Crit
(
"contract event found with associated header not in the batch"
,
"header"
,
log
.
BlockHash
,
"log_index"
,
log
.
Index
)
processLog
.
Crit
(
"contract event found with associated header not in the batch"
,
"header"
,
header
,
"log_index"
,
log
.
Index
)
return
errors
.
New
(
"parsed log with a block hash not in this batch"
)
return
errors
.
New
(
"parsed log with a block hash not in this batch"
)
}
}
...
@@ -132,15 +131,15 @@ func l1ProcessFn(processLog log.Logger, ethClient node.EthClient, l1Contracts L1
...
@@ -132,15 +131,15 @@ func l1ProcessFn(processLog log.Logger, ethClient node.EthClient, l1Contracts L1
// we iterate on the original array to maintain ordering. probably can find a more efficient
// we iterate on the original array to maintain ordering. probably can find a more efficient
// way to iterate over the `l1HeadersOfInterest` map while maintaining ordering
// way to iterate over the `l1HeadersOfInterest` map while maintaining ordering
l1Headers
:=
[]
*
database
.
L1BlockHeader
{}
indexedL1Header
:=
[]
*
database
.
L1BlockHeader
{}
for
_
,
header
:=
range
headers
{
for
_
,
header
:=
range
headers
{
blockHash
:=
header
.
Hash
()
blockHash
:=
header
.
Hash
()
_
,
ok
:=
l1HeadersOfInterest
[
blockHash
]
_
,
hasLogs
:=
l1HeadersOfInterest
[
blockHash
]
if
!
ok
{
if
!
hasLogs
{
continue
continue
}
}
l1Headers
=
append
(
l1Headers
,
&
database
.
L1BlockHeader
{
indexedL1Header
=
append
(
indexedL1Header
,
&
database
.
L1BlockHeader
{
BlockHeader
:
database
.
BlockHeader
{
BlockHeader
:
database
.
BlockHeader
{
Hash
:
blockHash
,
Hash
:
blockHash
,
ParentHash
:
header
.
ParentHash
,
ParentHash
:
header
.
ParentHash
,
...
@@ -152,15 +151,15 @@ func l1ProcessFn(processLog log.Logger, ethClient node.EthClient, l1Contracts L1
...
@@ -152,15 +151,15 @@ func l1ProcessFn(processLog log.Logger, ethClient node.EthClient, l1Contracts L1
/** Update Database **/
/** Update Database **/
num
L1Headers
:=
len
(
l1Headers
)
num
IndexedL1Headers
:=
len
(
indexedL1Header
)
if
numL1Headers
>
0
{
if
num
Indexed
L1Headers
>
0
{
processLog
.
Info
(
"saved l1 blocks of interest within batch"
,
"num"
,
numL1Headers
,
"batchSize"
,
numHeaders
)
processLog
.
Info
(
"saved l1 blocks of interest within batch"
,
"num"
,
num
Indexed
L1Headers
,
"batchSize"
,
numHeaders
)
err
=
db
.
Blocks
.
StoreL1BlockHeaders
(
l1Headers
)
err
=
db
.
Blocks
.
StoreL1BlockHeaders
(
indexedL1Header
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
// Since the headers to index are derived from logs, we know in this branch `numLogs > 0`
// Since the headers to index are derived from
the existence of
logs, we know in this branch `numLogs > 0`
processLog
.
Info
(
"saving contract logs"
,
"size"
,
numLogs
)
processLog
.
Info
(
"saving contract logs"
,
"size"
,
numLogs
)
err
=
db
.
ContractEvents
.
StoreL1ContractEvents
(
l1ContractEvents
)
err
=
db
.
ContractEvents
.
StoreL1ContractEvents
(
l1ContractEvents
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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