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
aa3b147c
Unverified
Commit
aa3b147c
authored
Feb 16, 2024
by
Adrian Sutton
Committed by
GitHub
Feb 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dispute-mon: Disagree with output roots that are not found by the local node (#9553)
parent
81976a4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
validator.go
op-dispute-mon/mon/validator.go
+6
-0
validator_test.go
op-dispute-mon/mon/validator_test.go
+10
-0
No files found.
op-dispute-mon/mon/validator.go
View file @
aa3b147c
...
...
@@ -3,6 +3,7 @@ package mon
import
(
"context"
"fmt"
"strings"
"github.com/ethereum/go-ethereum/common"
...
...
@@ -27,6 +28,11 @@ func newOutputValidator(client OutputRollupClient) *outputValidator {
func
(
o
*
outputValidator
)
CheckRootAgreement
(
ctx
context
.
Context
,
blockNum
uint64
,
rootClaim
common
.
Hash
)
(
bool
,
common
.
Hash
,
error
)
{
output
,
err
:=
o
.
client
.
OutputAtBlock
(
ctx
,
blockNum
)
if
err
!=
nil
{
// string match as the error comes from the remote server so we can't use Errors.Is sadly.
if
strings
.
Contains
(
err
.
Error
(),
"not found"
)
{
// Output root doesn't exist, so we must disagree with it.
return
false
,
common
.
Hash
{},
nil
}
return
false
,
common
.
Hash
{},
fmt
.
Errorf
(
"failed to get output at block: %w"
,
err
)
}
expected
:=
common
.
Hash
(
output
.
OutputRoot
)
...
...
op-dispute-mon/mon/validator_test.go
View file @
aa3b147c
...
...
@@ -41,6 +41,16 @@ func TestDetector_CheckRootAgreement(t *testing.T) {
require
.
Equal
(
t
,
mockRootClaim
,
fetched
)
require
.
True
(
t
,
agree
)
})
t
.
Run
(
"OutputNotFound"
,
func
(
t
*
testing
.
T
)
{
validator
,
rollup
:=
setupOutputValidatorTest
(
t
)
// This crazy error is what we actually get back from the API
rollup
.
err
=
errors
.
New
(
"failed to get L2 block ref with sync status: failed to determine L2BlockRef of height 42984924, could not get payload: not found"
)
agree
,
fetched
,
err
:=
validator
.
CheckRootAgreement
(
context
.
Background
(),
42984924
,
mockRootClaim
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
common
.
Hash
{},
fetched
)
require
.
False
(
t
,
agree
)
})
}
func
setupOutputValidatorTest
(
t
*
testing
.
T
)
(
*
outputValidator
,
*
stubRollupClient
)
{
...
...
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