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
b42a8e90
Commit
b42a8e90
authored
Jun 23, 2023
by
Kevin Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace event with output for better readability.
parent
d6ffb8c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
helpers.ts
packages/fault-detector/src/helpers.ts
+1
-2
helpers.spec.ts
packages/fault-detector/test/helpers.spec.ts
+5
-5
No files found.
packages/fault-detector/src/helpers.ts
View file @
b42a8e90
...
@@ -48,9 +48,8 @@ export const findFirstUnfinalizedStateBatchIndex = async (
...
@@ -48,9 +48,8 @@ export const findFirstUnfinalizedStateBatchIndex = async (
while
(
lo
!==
hi
)
{
while
(
lo
!==
hi
)
{
const
mid
=
Math
.
floor
((
lo
+
hi
)
/
2
)
const
mid
=
Math
.
floor
((
lo
+
hi
)
/
2
)
const
outputData
=
await
findOutputForIndex
(
oracle
,
mid
,
logger
)
const
outputData
=
await
findOutputForIndex
(
oracle
,
mid
,
logger
)
const
eventTimestamp
=
outputData
.
l1Timestamp
if
(
event
Timestamp
+
fpw
<
latestBlock
.
timestamp
)
{
if
(
outputData
.
l1
Timestamp
+
fpw
<
latestBlock
.
timestamp
)
{
lo
=
mid
+
1
lo
=
mid
+
1
}
else
{
}
else
{
hi
=
mid
hi
=
mid
...
...
packages/fault-detector/test/helpers.spec.ts
View file @
b42a8e90
...
@@ -41,7 +41,7 @@ describe('helpers', () => {
...
@@ -41,7 +41,7 @@ describe('helpers', () => {
})
})
describe
(
'
findOutputForIndex
'
,
()
=>
{
describe
(
'
findOutputForIndex
'
,
()
=>
{
describe
(
'
when the
even
t exists once
'
,
()
=>
{
describe
(
'
when the
outpu
t exists once
'
,
()
=>
{
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
const
latestBlock
=
await
hre
.
ethers
.
provider
.
getBlock
(
'
latest
'
)
const
latestBlock
=
await
hre
.
ethers
.
provider
.
getBlock
(
'
latest
'
)
const
params
=
{
const
params
=
{
...
@@ -60,14 +60,14 @@ describe('helpers', () => {
...
@@ -60,14 +60,14 @@ describe('helpers', () => {
)
)
})
})
it
(
'
should return the
even
t
'
,
async
()
=>
{
it
(
'
should return the
outpu
t
'
,
async
()
=>
{
const
even
t
=
await
findOutputForIndex
(
L2OutputOracle
,
0
)
const
outpu
t
=
await
findOutputForIndex
(
L2OutputOracle
,
0
)
expect
(
even
t
.
l2OutputIndex
).
to
.
equal
(
0
)
expect
(
outpu
t
.
l2OutputIndex
).
to
.
equal
(
0
)
})
})
})
})
describe
(
'
when the
even
t does not exist
'
,
()
=>
{
describe
(
'
when the
outpu
t does not exist
'
,
()
=>
{
it
(
'
should throw an error
'
,
async
()
=>
{
it
(
'
should throw an error
'
,
async
()
=>
{
await
expect
(
await
expect
(
findOutputForIndex
(
L2OutputOracle
,
0
)
findOutputForIndex
(
L2OutputOracle
,
0
)
...
...
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