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
9c366e67
Commit
9c366e67
authored
May 17, 2023
by
Hamdi Allam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nits
parent
7fe5de7c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
helpers.ts
packages/fault-detector/src/helpers.ts
+1
-1
service.ts
packages/fault-detector/src/service.ts
+12
-11
No files found.
packages/fault-detector/src/helpers.ts
View file @
9c366e67
...
@@ -148,7 +148,7 @@ export const findEventForStateBatch = async <TSubmissionEventArgs>(
...
@@ -148,7 +148,7 @@ export const findEventForStateBatch = async <TSubmissionEventArgs>(
}
}
// Update the event cache if we don't have the event.
// Update the event cache if we don't have the event.
logger
?.
info
(
'
event not cached f
rom
index. warming cache...
'
,
{
index
})
logger
?.
info
(
'
event not cached f
or
index. warming cache...
'
,
{
index
})
await
updateOracleCache
(
oracle
,
logger
)
await
updateOracleCache
(
oracle
,
logger
)
// Event better be in cache now!
// Event better be in cache now!
...
...
packages/fault-detector/src/service.ts
View file @
9c366e67
...
@@ -219,6 +219,8 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
...
@@ -219,6 +219,8 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
// We use this a lot, a bit cleaner to pull out to the top level of the state object.
// We use this a lot, a bit cleaner to pull out to the top level of the state object.
this
.
state
.
fpw
=
await
this
.
state
.
messenger
.
getChallengePeriodSeconds
()
this
.
state
.
fpw
=
await
this
.
state
.
messenger
.
getChallengePeriodSeconds
()
this
.
logger
.
info
(
`fault proof window is
${
this
.
state
.
fpw
}
seconds`
)
if
(
this
.
options
.
bedrock
)
{
if
(
this
.
options
.
bedrock
)
{
const
oo
=
this
.
state
.
messenger
.
contracts
.
l1
.
L2OutputOracle
const
oo
=
this
.
state
.
messenger
.
contracts
.
l1
.
L2OutputOracle
this
.
state
.
oo
=
{
this
.
state
.
oo
=
{
...
@@ -255,10 +257,8 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
...
@@ -255,10 +257,8 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
// but it happens often on testnets because the FPW is very short.
// but it happens often on testnets because the FPW is very short.
if
(
firstUnfinalized
===
undefined
)
{
if
(
firstUnfinalized
===
undefined
)
{
this
.
logger
.
info
(
'
no unfinalized batches found. skipping all batches.
'
)
this
.
logger
.
info
(
'
no unfinalized batches found. skipping all batches.
'
)
// `getTotalElements - 1` is the last batch. So the current count of batches
// represents the next expected batch to be published
const
totalBatches
=
await
this
.
state
.
oo
.
getTotalElements
()
const
totalBatches
=
await
this
.
state
.
oo
.
getTotalElements
()
this
.
state
.
currentBatchIndex
=
totalBatches
.
toNumber
()
this
.
state
.
currentBatchIndex
=
totalBatches
.
toNumber
()
-
1
}
else
{
}
else
{
this
.
state
.
currentBatchIndex
=
firstUnfinalized
this
.
state
.
currentBatchIndex
=
firstUnfinalized
}
}
...
@@ -266,8 +266,8 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
...
@@ -266,8 +266,8 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
this
.
state
.
currentBatchIndex
=
this
.
options
.
startBatchIndex
this
.
state
.
currentBatchIndex
=
this
.
options
.
startBatchIndex
}
}
this
.
logger
.
info
(
'
starting
height
'
,
{
this
.
logger
.
info
(
'
starting
batch
'
,
{
startB
atchIndex
:
this
.
state
.
currentBatchIndex
,
b
atchIndex
:
this
.
state
.
currentBatchIndex
,
})
})
// Set the initial metrics.
// Set the initial metrics.
...
@@ -287,7 +287,8 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
...
@@ -287,7 +287,8 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
let
latestBatchIndex
:
number
let
latestBatchIndex
:
number
try
{
try
{
latestBatchIndex
=
(
await
this
.
state
.
oo
.
getTotalElements
()).
toNumber
()
-
1
const
totalBatches
=
await
this
.
state
.
oo
.
getTotalElements
()
latestBatchIndex
=
totalBatches
.
toNumber
()
-
1
}
catch
(
err
)
{
}
catch
(
err
)
{
this
.
logger
.
error
(
'
failed to query total # of batches
'
,
{
this
.
logger
.
error
(
'
failed to query total # of batches
'
,
{
error
:
err
,
error
:
err
,
...
@@ -303,7 +304,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
...
@@ -303,7 +304,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
}
}
if
(
this
.
state
.
currentBatchIndex
>
latestBatchIndex
)
{
if
(
this
.
state
.
currentBatchIndex
>
latestBatchIndex
)
{
this
.
logger
.
info
(
'
batch index is ahead of
L1
. waiting...
'
,
{
this
.
logger
.
info
(
'
batch index is ahead of
the oracle
. waiting...
'
,
{
batchIndex
:
this
.
state
.
currentBatchIndex
,
batchIndex
:
this
.
state
.
currentBatchIndex
,
latestBatchIndex
,
latestBatchIndex
,
})
})
...
@@ -314,7 +315,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
...
@@ -314,7 +315,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
this
.
metrics
.
highestBatchIndex
.
set
({
type
:
'
known
'
},
latestBatchIndex
)
this
.
metrics
.
highestBatchIndex
.
set
({
type
:
'
known
'
},
latestBatchIndex
)
this
.
logger
.
info
(
'
checking batch
'
,
{
this
.
logger
.
info
(
'
checking batch
'
,
{
batchIndex
:
this
.
state
.
currentBatchIndex
,
batchIndex
:
this
.
state
.
currentBatchIndex
,
latest
Index
:
latest
BatchIndex
,
latestBatchIndex
,
})
})
let
event
:
PartialEvent
let
event
:
PartialEvent
...
@@ -325,7 +326,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
...
@@ -325,7 +326,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
this
.
logger
this
.
logger
)
)
}
catch
(
err
)
{
}
catch
(
err
)
{
this
.
logger
.
error
(
'
failed to fetch event associated
the
batch
'
,
{
this
.
logger
.
error
(
'
failed to fetch event associated
with
batch
'
,
{
error
:
err
,
error
:
err
,
node
:
'
l1
'
,
node
:
'
l1
'
,
section
:
'
findEventForStateBatch
'
,
section
:
'
findEventForStateBatch
'
,
...
@@ -448,7 +449,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
...
@@ -448,7 +449,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
event
.
transactionHash
event
.
transactionHash
)
)
}
catch
(
err
)
{
}
catch
(
err
)
{
this
.
logger
.
error
(
'
failed to
require
acquire batch transaction
'
,
{
this
.
logger
.
error
(
'
failed to acquire batch transaction
'
,
{
error
:
err
,
error
:
err
,
node
:
'
l1
'
,
node
:
'
l1
'
,
section
:
'
getTransaction
'
,
section
:
'
getTransaction
'
,
...
@@ -474,7 +475,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
...
@@ -474,7 +475,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
this
.
logger
.
info
(
'
L2 node is behind. waiting for sync...
'
,
{
this
.
logger
.
info
(
'
L2 node is behind. waiting for sync...
'
,
{
batchBlockStart
:
batchStart
,
batchBlockStart
:
batchStart
,
batchBlockEnd
:
batchEnd
,
batchBlockEnd
:
batchEnd
,
l2Block
:
latestBlock
,
l2Block
Height
:
latestBlock
,
})
})
return
return
}
}
...
...
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