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
c13a4f88
Unverified
Commit
c13a4f88
authored
Aug 21, 2023
by
mergify[bot]
Committed by
GitHub
Aug 21, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into aj/capture-return-data
parents
feea33df
d2b14ac9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
18 deletions
+33
-18
executor.go
op-challenger/fault/cannon/executor.go
+1
-3
executor_test.go
op-challenger/fault/cannon/executor_test.go
+11
-9
provider.go
op-challenger/fault/cannon/provider.go
+4
-3
provider_test.go
op-challenger/fault/cannon/provider_test.go
+16
-1
helper.go
op-e2e/e2eutils/disputegame/helper.go
+1
-1
faultproof_test.go
op-e2e/faultproof_test.go
+0
-1
No files found.
op-challenger/fault/cannon/executor.go
View file @
c13a4f88
...
...
@@ -39,7 +39,6 @@ type Executor struct {
rollupConfig
string
l2Genesis
string
absolutePreState
string
dataDir
string
snapshotFreq
uint
selectSnapshot
snapshotSelect
cmdExecutor
cmdExecutor
...
...
@@ -57,7 +56,6 @@ func NewExecutor(logger log.Logger, cfg *config.Config, inputs LocalGameInputs)
rollupConfig
:
cfg
.
CannonRollupConfigPath
,
l2Genesis
:
cfg
.
CannonL2GenesisPath
,
absolutePreState
:
cfg
.
CannonAbsolutePreState
,
dataDir
:
cfg
.
CannonDatadir
,
snapshotFreq
:
cfg
.
CannonSnapshotFreq
,
selectSnapshot
:
findStartingSnapshot
,
cmdExecutor
:
runCmd
,
...
...
@@ -71,7 +69,7 @@ func (e *Executor) GenerateProof(ctx context.Context, dir string, i uint64) erro
return
fmt
.
Errorf
(
"find starting snapshot: %w"
,
err
)
}
proofDir
:=
filepath
.
Join
(
dir
,
proofsDir
)
dataDir
:=
filepath
.
Join
(
e
.
dataD
ir
,
preimagesDir
)
dataDir
:=
filepath
.
Join
(
d
ir
,
preimagesDir
)
lastGeneratedState
:=
filepath
.
Join
(
dir
,
finalState
)
args
:=
[]
string
{
"run"
,
...
...
op-challenger/fault/cannon/executor_test.go
View file @
c13a4f88
...
...
@@ -22,7 +22,9 @@ const execTestCannonPrestate = "/foo/pre.json"
func
TestGenerateProof
(
t
*
testing
.
T
)
{
input
:=
"starting.json"
cfg
:=
config
.
NewConfig
(
common
.
Address
{
0xbb
},
"http://localhost:8888"
,
config
.
TraceTypeCannon
,
true
)
cfg
.
CannonDatadir
=
t
.
TempDir
()
tempDir
:=
t
.
TempDir
()
dir
:=
filepath
.
Join
(
tempDir
,
"gameDir"
)
cfg
.
CannonDatadir
=
tempDir
cfg
.
CannonAbsolutePreState
=
"pre.json"
cfg
.
CannonBin
=
"./bin/cannon"
cfg
.
CannonServer
=
"./bin/op-program"
...
...
@@ -58,7 +60,7 @@ func TestGenerateProof(t *testing.T) {
}
return
nil
}
err
:=
executor
.
GenerateProof
(
context
.
Background
(),
cfg
.
CannonData
dir
,
proofAt
)
err
:=
executor
.
GenerateProof
(
context
.
Background
(),
dir
,
proofAt
)
require
.
NoError
(
t
,
err
)
return
binary
,
subcommand
,
args
}
...
...
@@ -68,15 +70,15 @@ func TestGenerateProof(t *testing.T) {
cfg
.
CannonRollupConfigPath
=
""
cfg
.
CannonL2GenesisPath
=
""
binary
,
subcommand
,
args
:=
captureExec
(
t
,
cfg
,
150
_000_000
)
require
.
DirExists
(
t
,
filepath
.
Join
(
cfg
.
CannonData
dir
,
preimagesDir
))
require
.
DirExists
(
t
,
filepath
.
Join
(
cfg
.
CannonData
dir
,
proofsDir
))
require
.
DirExists
(
t
,
filepath
.
Join
(
cfg
.
CannonData
dir
,
snapsDir
))
require
.
DirExists
(
t
,
filepath
.
Join
(
dir
,
preimagesDir
))
require
.
DirExists
(
t
,
filepath
.
Join
(
dir
,
proofsDir
))
require
.
DirExists
(
t
,
filepath
.
Join
(
dir
,
snapsDir
))
require
.
Equal
(
t
,
cfg
.
CannonBin
,
binary
)
require
.
Equal
(
t
,
"run"
,
subcommand
)
require
.
Equal
(
t
,
input
,
args
[
"--input"
])
require
.
Contains
(
t
,
args
,
"--meta"
)
require
.
Equal
(
t
,
""
,
args
[
"--meta"
])
require
.
Equal
(
t
,
filepath
.
Join
(
cfg
.
CannonData
dir
,
finalState
),
args
[
"--output"
])
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
finalState
),
args
[
"--output"
])
require
.
Equal
(
t
,
"=150000000"
,
args
[
"--proof-at"
])
require
.
Equal
(
t
,
"=150000001"
,
args
[
"--stop-at"
])
require
.
Equal
(
t
,
"%500"
,
args
[
"--snapshot-at"
])
...
...
@@ -86,9 +88,9 @@ func TestGenerateProof(t *testing.T) {
require
.
Equal
(
t
,
"--server"
,
args
[
cfg
.
CannonServer
])
require
.
Equal
(
t
,
cfg
.
L1EthRpc
,
args
[
"--l1"
])
require
.
Equal
(
t
,
cfg
.
CannonL2
,
args
[
"--l2"
])
require
.
Equal
(
t
,
filepath
.
Join
(
cfg
.
CannonData
dir
,
preimagesDir
),
args
[
"--datadir"
])
require
.
Equal
(
t
,
filepath
.
Join
(
cfg
.
CannonData
dir
,
proofsDir
,
"%d.json"
),
args
[
"--proof-fmt"
])
require
.
Equal
(
t
,
filepath
.
Join
(
cfg
.
CannonData
dir
,
snapsDir
,
"%d.json"
),
args
[
"--snapshot-fmt"
])
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
preimagesDir
),
args
[
"--datadir"
])
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
proofsDir
,
"%d.json"
),
args
[
"--proof-fmt"
])
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
snapsDir
,
"%d.json"
),
args
[
"--snapshot-fmt"
])
require
.
Equal
(
t
,
cfg
.
CannonNetwork
,
args
[
"--network"
])
require
.
NotContains
(
t
,
args
,
"--rollup.config"
)
require
.
NotContains
(
t
,
args
,
"--l2.genesis"
)
...
...
op-challenger/fault/cannon/provider.go
View file @
c13a4f88
...
...
@@ -64,13 +64,14 @@ func NewTraceProvider(ctx context.Context, logger log.Logger, cfg *config.Config
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"fetch local game inputs: %w"
,
err
)
}
return
NewTraceProviderFromInputs
(
logger
,
cfg
,
localInputs
),
nil
return
NewTraceProviderFromInputs
(
logger
,
cfg
,
gameAddr
.
Hex
(),
localInputs
),
nil
}
func
NewTraceProviderFromInputs
(
logger
log
.
Logger
,
cfg
*
config
.
Config
,
localInputs
LocalGameInputs
)
*
CannonTraceProvider
{
func
NewTraceProviderFromInputs
(
logger
log
.
Logger
,
cfg
*
config
.
Config
,
gameDirName
string
,
localInputs
LocalGameInputs
)
*
CannonTraceProvider
{
dir
:=
filepath
.
Join
(
cfg
.
CannonDatadir
,
gameDirName
)
return
&
CannonTraceProvider
{
logger
:
logger
,
dir
:
cfg
.
CannonData
dir
,
dir
:
dir
,
prestate
:
cfg
.
CannonAbsolutePreState
,
generator
:
NewExecutor
(
logger
,
cfg
,
localInputs
),
}
...
...
op-challenger/fault/cannon/provider_test.go
View file @
c13a4f88
...
...
@@ -11,6 +11,7 @@ import (
"testing"
"github.com/ethereum-optimism/optimism/cannon/mipsevm"
"github.com/ethereum-optimism/optimism/op-challenger/config"
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum/go-ethereum/common"
...
...
@@ -149,7 +150,6 @@ func TestGetStepData(t *testing.T) {
func
TestAbsolutePreState
(
t
*
testing
.
T
)
{
dataDir
:=
t
.
TempDir
()
_
=
os
.
Mkdir
(
dataDir
,
0
o777
)
prestate
:=
"state.json"
...
...
@@ -189,6 +189,21 @@ func TestAbsolutePreState(t *testing.T) {
})
}
func
TestUseGameSpecificSubdir
(
t
*
testing
.
T
)
{
tempDir
:=
t
.
TempDir
()
dataDir
:=
filepath
.
Join
(
tempDir
,
"data"
)
setupPreState
(
t
,
tempDir
,
"state.json"
)
logger
:=
testlog
.
Logger
(
t
,
log
.
LvlInfo
)
cfg
:=
&
config
.
Config
{
CannonAbsolutePreState
:
filepath
.
Join
(
tempDir
,
"state.json"
),
CannonDatadir
:
dataDir
,
}
gameDirName
:=
"gameSubdir"
localInputs
:=
LocalGameInputs
{}
provider
:=
NewTraceProviderFromInputs
(
logger
,
cfg
,
gameDirName
,
localInputs
)
require
.
Equal
(
t
,
filepath
.
Join
(
dataDir
,
gameDirName
),
provider
.
dir
,
"should use game specific subdir"
)
}
func
setupPreState
(
t
*
testing
.
T
,
dataDir
string
,
filename
string
)
{
srcDir
:=
filepath
.
Join
(
"test_data"
)
path
:=
filepath
.
Join
(
srcDir
,
filename
)
...
...
op-e2e/e2eutils/disputegame/helper.go
View file @
c13a4f88
...
...
@@ -170,7 +170,7 @@ func (h *FactoryHelper) StartCannonGameWithCorrectRoot(ctx context.Context, roll
L2Claim
:
challengedOutput
.
OutputRoot
,
L2BlockNumber
:
challengedOutput
.
L2BlockNumber
,
}
provider
:=
cannon
.
NewTraceProviderFromInputs
(
testlog
.
Logger
(
h
.
t
,
log
.
LvlInfo
)
.
New
(
"role"
,
"CorrectTrace"
),
cfg
,
inputs
)
provider
:=
cannon
.
NewTraceProviderFromInputs
(
testlog
.
Logger
(
h
.
t
,
log
.
LvlInfo
)
.
New
(
"role"
,
"CorrectTrace"
),
cfg
,
"correct"
,
inputs
)
rootClaim
,
err
:=
provider
.
Get
(
ctx
,
math
.
MaxUint64
)
h
.
require
.
NoError
(
err
,
"Compute correct root hash"
)
...
...
op-e2e/faultproof_test.go
View file @
c13a4f88
...
...
@@ -50,7 +50,6 @@ func TestMultipleAlphabetGames(t *testing.T) {
}
func
TestMultipleCannonGames
(
t
*
testing
.
T
)
{
t
.
Skip
(
"Cannon provider doesn't currently isolate different game traces"
)
InitParallel
(
t
)
ctx
:=
context
.
Background
()
...
...
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