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
023b3d5e
Unverified
Commit
023b3d5e
authored
Sep 06, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-e2e: Update e2e tests to demonstrate issues with vm status.
parent
db94109b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
9 deletions
+12
-9
game_helper.go
op-e2e/e2eutils/disputegame/game_helper.go
+8
-8
helper.go
op-e2e/e2eutils/disputegame/helper.go
+4
-0
faultproof_test.go
op-e2e/faultproof_test.go
+0
-1
No files found.
op-e2e/e2eutils/disputegame/game_helper.go
View file @
023b3d5e
...
@@ -65,16 +65,16 @@ func (g *FaultGameHelper) MaxDepth(ctx context.Context) int64 {
...
@@ -65,16 +65,16 @@ func (g *FaultGameHelper) MaxDepth(ctx context.Context) int64 {
}
}
func
(
g
*
FaultGameHelper
)
waitForClaim
(
ctx
context
.
Context
,
errorMsg
string
,
predicate
func
(
claim
ContractClaim
)
bool
)
{
func
(
g
*
FaultGameHelper
)
waitForClaim
(
ctx
context
.
Context
,
errorMsg
string
,
predicate
func
(
claim
ContractClaim
)
bool
)
{
c
tx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
time
.
Minute
)
timedC
tx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
time
.
Minute
)
defer
cancel
()
defer
cancel
()
err
:=
wait
.
For
(
c
tx
,
time
.
Second
,
func
()
(
bool
,
error
)
{
err
:=
wait
.
For
(
timedC
tx
,
time
.
Second
,
func
()
(
bool
,
error
)
{
count
,
err
:=
g
.
game
.
ClaimDataLen
(
&
bind
.
CallOpts
{
Context
:
c
tx
})
count
,
err
:=
g
.
game
.
ClaimDataLen
(
&
bind
.
CallOpts
{
Context
:
timedC
tx
})
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
fmt
.
Errorf
(
"retrieve number of claims: %w"
,
err
)
return
false
,
fmt
.
Errorf
(
"retrieve number of claims: %w"
,
err
)
}
}
// Search backwards because the new claims are at the end and more likely the ones we want.
// Search backwards because the new claims are at the end and more likely the ones we want.
for
i
:=
count
.
Int64
()
-
1
;
i
>=
0
;
i
--
{
for
i
:=
count
.
Int64
()
-
1
;
i
>=
0
;
i
--
{
claimData
,
err
:=
g
.
game
.
ClaimData
(
&
bind
.
CallOpts
{
Context
:
c
tx
},
big
.
NewInt
(
i
))
claimData
,
err
:=
g
.
game
.
ClaimData
(
&
bind
.
CallOpts
{
Context
:
timedC
tx
},
big
.
NewInt
(
i
))
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
fmt
.
Errorf
(
"retrieve claim %v: %w"
,
i
,
err
)
return
false
,
fmt
.
Errorf
(
"retrieve claim %v: %w"
,
i
,
err
)
}
}
...
@@ -127,10 +127,10 @@ func (g *FaultGameHelper) Resolve(ctx context.Context) {
...
@@ -127,10 +127,10 @@ func (g *FaultGameHelper) Resolve(ctx context.Context) {
func
(
g
*
FaultGameHelper
)
WaitForGameStatus
(
ctx
context
.
Context
,
expected
Status
)
{
func
(
g
*
FaultGameHelper
)
WaitForGameStatus
(
ctx
context
.
Context
,
expected
Status
)
{
g
.
t
.
Logf
(
"Waiting for game %v to have status %v"
,
g
.
addr
,
expected
)
g
.
t
.
Logf
(
"Waiting for game %v to have status %v"
,
g
.
addr
,
expected
)
c
tx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
time
.
Minute
)
timedC
tx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
time
.
Minute
)
defer
cancel
()
defer
cancel
()
err
:=
wait
.
For
(
c
tx
,
time
.
Second
,
func
()
(
bool
,
error
)
{
err
:=
wait
.
For
(
timedC
tx
,
time
.
Second
,
func
()
(
bool
,
error
)
{
ctx
,
cancel
:=
context
.
WithTimeout
(
c
tx
,
30
*
time
.
Second
)
ctx
,
cancel
:=
context
.
WithTimeout
(
timedC
tx
,
30
*
time
.
Second
)
defer
cancel
()
defer
cancel
()
status
,
err
:=
g
.
game
.
Status
(
&
bind
.
CallOpts
{
Context
:
ctx
})
status
,
err
:=
g
.
game
.
Status
(
&
bind
.
CallOpts
{
Context
:
ctx
})
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -139,7 +139,7 @@ func (g *FaultGameHelper) WaitForGameStatus(ctx context.Context, expected Status
...
@@ -139,7 +139,7 @@ func (g *FaultGameHelper) WaitForGameStatus(ctx context.Context, expected Status
g
.
t
.
Logf
(
"Game %v has state %v, waiting for state %v"
,
g
.
addr
,
Status
(
status
),
expected
)
g
.
t
.
Logf
(
"Game %v has state %v, waiting for state %v"
,
g
.
addr
,
Status
(
status
),
expected
)
return
expected
==
Status
(
status
),
nil
return
expected
==
Status
(
status
),
nil
})
})
g
.
require
.
NoError
(
err
,
"wait for game status"
)
g
.
require
.
NoError
f
(
err
,
"wait for game status. Game state:
\n
%v"
,
g
.
gameData
(
ctx
)
)
}
}
func
(
g
*
FaultGameHelper
)
Attack
(
ctx
context
.
Context
,
claimIdx
int64
,
claim
common
.
Hash
)
{
func
(
g
*
FaultGameHelper
)
Attack
(
ctx
context
.
Context
,
claimIdx
int64
,
claim
common
.
Hash
)
{
...
...
op-e2e/e2eutils/disputegame/helper.go
View file @
023b3d5e
...
@@ -9,6 +9,7 @@ import (
...
@@ -9,6 +9,7 @@ import (
"testing"
"testing"
"time"
"time"
"github.com/ethereum-optimism/optimism/cannon/mipsevm"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
...
@@ -174,6 +175,9 @@ func (h *FactoryHelper) StartCannonGameWithCorrectRoot(ctx context.Context, roll
...
@@ -174,6 +175,9 @@ func (h *FactoryHelper) StartCannonGameWithCorrectRoot(ctx context.Context, roll
provider
:=
cannon
.
NewTraceProviderFromInputs
(
testlog
.
Logger
(
h
.
t
,
log
.
LvlInfo
)
.
New
(
"role"
,
"CorrectTrace"
),
metrics
.
NoopMetrics
,
cfg
,
inputs
,
cfg
.
Datadir
)
provider
:=
cannon
.
NewTraceProviderFromInputs
(
testlog
.
Logger
(
h
.
t
,
log
.
LvlInfo
)
.
New
(
"role"
,
"CorrectTrace"
),
metrics
.
NoopMetrics
,
cfg
,
inputs
,
cfg
.
Datadir
)
rootClaim
,
err
:=
provider
.
Get
(
ctx
,
math
.
MaxUint64
)
rootClaim
,
err
:=
provider
.
Get
(
ctx
,
math
.
MaxUint64
)
h
.
require
.
NoError
(
err
,
"Compute correct root hash"
)
h
.
require
.
NoError
(
err
,
"Compute correct root hash"
)
// Override the VM status to claim the root is invalid
// Otherwise creating the game will fail
rootClaim
[
0
]
=
mipsevm
.
VMStatusInvalid
game
:=
h
.
createCannonGame
(
ctx
,
l2BlockNumber
,
l1Head
,
rootClaim
)
game
:=
h
.
createCannonGame
(
ctx
,
l2BlockNumber
,
l1Head
,
rootClaim
)
honestHelper
:=
&
HonestHelper
{
honestHelper
:=
&
HonestHelper
{
...
...
op-e2e/faultproof_test.go
View file @
023b3d5e
...
@@ -434,7 +434,6 @@ func setupDisputeGameForInvalidOutputRoot(t *testing.T, outputRoot common.Hash)
...
@@ -434,7 +434,6 @@ func setupDisputeGameForInvalidOutputRoot(t *testing.T, outputRoot common.Hash)
}
}
func
TestCannonChallengeWithCorrectRoot
(
t
*
testing
.
T
)
{
func
TestCannonChallengeWithCorrectRoot
(
t
*
testing
.
T
)
{
t
.
Skip
(
"Not currently handling this case as the correct approach will change when output root bisection is added"
)
InitParallel
(
t
)
InitParallel
(
t
)
ctx
:=
context
.
Background
()
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