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
64bc4d78
Unverified
Commit
64bc4d78
authored
Aug 08, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-e2e: Pass network config when starting challenger
parent
cbd17dcb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
6 deletions
+23
-6
executor.go
op-challenger/fault/cannon/executor.go
+4
-4
cannon_helper.go
op-e2e/e2eutils/disputegame/cannon_helper.go
+18
-1
faultproof_test.go
op-e2e/faultproof_test.go
+1
-1
No files found.
op-challenger/fault/cannon/executor.go
View file @
64bc4d78
...
...
@@ -17,7 +17,7 @@ import (
const
(
snapsDir
=
"snapshots"
preimagesDir
=
"
snapshot
s"
preimagesDir
=
"
preimage
s"
)
var
snapshotNameRegexp
=
regexp
.
MustCompile
(
`^[0-9]+\.json$`
)
...
...
@@ -138,17 +138,17 @@ func findStartingSnapshot(logger log.Logger, snapDir string, absolutePreState st
bestSnap
:=
uint64
(
0
)
for
_
,
entry
:=
range
entries
{
if
entry
.
IsDir
()
{
logger
.
Warn
(
"Unexpected directory in snapshots dir
: %v/%v"
,
snapDir
,
entry
.
Name
())
logger
.
Warn
(
"Unexpected directory in snapshots dir
"
,
"parent"
,
snapDir
,
"child"
,
entry
.
Name
())
continue
}
name
:=
entry
.
Name
()
if
!
snapshotNameRegexp
.
MatchString
(
name
)
{
logger
.
Warn
(
"Unexpected file in snapshots dir
: %v/%v"
,
snapDir
,
entry
.
Name
())
logger
.
Warn
(
"Unexpected file in snapshots dir
"
,
"parent"
,
snapDir
,
"child"
,
entry
.
Name
())
continue
}
index
,
err
:=
strconv
.
ParseUint
(
name
[
0
:
len
(
name
)
-
len
(
".json"
)],
10
,
64
)
if
err
!=
nil
{
logger
.
Error
(
"Unable to parse trace index of snapshot file
: %v/%v"
,
snapDir
,
entry
.
Name
())
logger
.
Error
(
"Unable to parse trace index of snapshot file
"
,
"parent"
,
snapDir
,
"child"
,
entry
.
Name
())
continue
}
if
index
>
bestSnap
&&
index
<
traceIndex
{
...
...
op-e2e/e2eutils/disputegame/cannon_helper.go
View file @
64bc4d78
...
...
@@ -2,16 +2,21 @@ package disputegame
import
(
"context"
"encoding/json"
"os"
"path/filepath"
"github.com/ethereum-optimism/optimism/op-challenger/config"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/challenger"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/core"
)
type
CannonGameHelper
struct
{
FaultGameHelper
}
func
(
g
*
CannonGameHelper
)
StartChallenger
(
ctx
context
.
Context
,
l1Endpoint
string
,
l2Endpoint
string
,
name
string
,
options
...
challenger
.
Option
)
*
challenger
.
Helper
{
func
(
g
*
CannonGameHelper
)
StartChallenger
(
ctx
context
.
Context
,
rollupCfg
*
rollup
.
Config
,
l2Genesis
*
core
.
Genesis
,
l1Endpoint
string
,
l2Endpoint
string
,
name
string
,
options
...
challenger
.
Option
)
*
challenger
.
Helper
{
opts
:=
[]
challenger
.
Option
{
func
(
c
*
config
.
Config
)
{
c
.
GameAddress
=
g
.
addr
...
...
@@ -24,6 +29,18 @@ func (g *CannonGameHelper) StartChallenger(ctx context.Context, l1Endpoint strin
c
.
CannonServer
=
"../op-program/bin/op-program"
c
.
CannonAbsolutePreState
=
"../op-program/bin/prestate.json"
c
.
CannonSnapshotFreq
=
config
.
DefaultCannonSnapshotFreq
genesisBytes
,
err
:=
json
.
Marshal
(
l2Genesis
)
g
.
require
.
NoError
(
err
,
"marshall l2 genesis config"
)
genesisFile
:=
filepath
.
Join
(
c
.
CannonDatadir
,
"l2-genesis.json"
)
g
.
require
.
NoError
(
os
.
WriteFile
(
genesisFile
,
genesisBytes
,
0644
))
c
.
CannonL2GenesisPath
=
genesisFile
rollupBytes
,
err
:=
json
.
Marshal
(
rollupCfg
)
g
.
require
.
NoError
(
err
,
"marshall rollup config"
)
rollupFile
:=
filepath
.
Join
(
c
.
CannonDatadir
,
"rollup.json"
)
g
.
require
.
NoError
(
os
.
WriteFile
(
rollupFile
,
rollupBytes
,
0644
))
c
.
CannonRollupConfigPath
=
rollupFile
},
}
opts
=
append
(
opts
,
options
...
)
...
...
op-e2e/faultproof_test.go
View file @
64bc4d78
...
...
@@ -156,7 +156,7 @@ func TestCannonDisputeGame(t *testing.T) {
game
:=
disputeGameFactory
.
StartCannonGame
(
ctx
,
common
.
Hash
{
0xaa
})
require
.
NotNil
(
t
,
game
)
game
.
StartChallenger
(
ctx
,
sys
.
NodeEndpoint
(
"l1"
),
sys
.
NodeEndpoint
(
"sequencer"
),
"Challenger"
,
func
(
c
*
config
.
Config
)
{
game
.
StartChallenger
(
ctx
,
sys
.
RollupConfig
,
sys
.
L2GenesisCfg
,
sys
.
NodeEndpoint
(
"l1"
),
sys
.
NodeEndpoint
(
"sequencer"
),
"Challenger"
,
func
(
c
*
config
.
Config
)
{
c
.
AgreeWithProposedOutput
=
true
// Agree with the proposed output, so disagree with the root claim
c
.
TxMgrConfig
.
PrivateKey
=
e2eutils
.
EncodePrivKeyToString
(
sys
.
cfg
.
Secrets
.
Alice
)
})
...
...
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