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
2b923b95
Unverified
Commit
2b923b95
authored
Sep 07, 2023
by
mergify[bot]
Committed by
GitHub
Sep 07, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into clabby/ctb/clean-foundry-toml
parents
ccf977b9
697d464e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
2 deletions
+33
-2
Makefile
op-bindings/Makefile
+1
-0
game_helper.go
op-e2e/e2eutils/disputegame/game_helper.go
+13
-0
honest_helper.go
op-e2e/e2eutils/disputegame/honest_helper.go
+15
-0
faultproof_test.go
op-e2e/faultproof_test.go
+4
-2
No files found.
op-bindings/Makefile
View file @
2b923b95
...
@@ -12,6 +12,7 @@ version:
...
@@ -12,6 +12,7 @@ version:
compile
:
compile
:
cd
$
(
contracts-dir
)
&&
\
cd
$
(
contracts-dir
)
&&
\
forge clean
&&
\
pnpm build
pnpm build
bindings
:
compile bindings-build
bindings
:
compile bindings-build
...
...
op-e2e/e2eutils/disputegame/game_helper.go
View file @
2b923b95
...
@@ -156,6 +156,19 @@ func (g *FaultGameHelper) Defend(ctx context.Context, claimIdx int64, claim comm
...
@@ -156,6 +156,19 @@ func (g *FaultGameHelper) Defend(ctx context.Context, claimIdx int64, claim comm
g
.
require
.
NoError
(
err
,
"Defend transaction was not OK"
)
g
.
require
.
NoError
(
err
,
"Defend transaction was not OK"
)
}
}
type
ErrWithData
interface
{
ErrorData
()
interface
{}
}
// StepFails attempts to call step and verifies that it fails with ValidStep()
func
(
g
*
FaultGameHelper
)
StepFails
(
claimIdx
int64
,
isAttack
bool
,
stateData
[]
byte
,
proof
[]
byte
)
{
g
.
t
.
Logf
(
"Attempting step against claim %v isAttack: %v"
,
claimIdx
,
isAttack
)
_
,
err
:=
g
.
game
.
Step
(
g
.
opts
,
big
.
NewInt
(
claimIdx
),
isAttack
,
stateData
,
proof
)
errData
,
ok
:=
err
.
(
ErrWithData
)
g
.
require
.
Truef
(
ok
,
"Error should provide ErrorData method: %v"
,
err
)
g
.
require
.
Equal
(
"0xfb4e40dd"
,
errData
.
ErrorData
(),
"Revert reason should be abi encoded ValidStep()"
)
}
func
(
g
*
FaultGameHelper
)
gameData
(
ctx
context
.
Context
)
string
{
func
(
g
*
FaultGameHelper
)
gameData
(
ctx
context
.
Context
)
string
{
opts
:=
&
bind
.
CallOpts
{
Context
:
ctx
}
opts
:=
&
bind
.
CallOpts
{
Context
:
ctx
}
maxDepth
:=
int
(
g
.
MaxDepth
(
ctx
))
maxDepth
:=
int
(
g
.
MaxDepth
(
ctx
))
...
...
op-e2e/e2eutils/disputegame/honest_helper.go
View file @
2b923b95
...
@@ -42,3 +42,18 @@ func (h *HonestHelper) Defend(ctx context.Context, claimIdx int64) {
...
@@ -42,3 +42,18 @@ func (h *HonestHelper) Defend(ctx context.Context, claimIdx int64) {
h
.
game
.
require
.
NoErrorf
(
err
,
"Get correct claim at trace index %v"
,
traceIdx
)
h
.
game
.
require
.
NoErrorf
(
err
,
"Get correct claim at trace index %v"
,
traceIdx
)
h
.
game
.
Defend
(
ctx
,
claimIdx
,
value
)
h
.
game
.
Defend
(
ctx
,
claimIdx
,
value
)
}
}
func
(
h
*
HonestHelper
)
StepFails
(
ctx
context
.
Context
,
claimIdx
int64
,
isAttack
bool
)
{
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
2
*
time
.
Minute
)
defer
cancel
()
claim
:=
h
.
game
.
getClaim
(
ctx
,
claimIdx
)
pos
:=
types
.
NewPositionFromGIndex
(
claim
.
Position
.
Uint64
())
traceIdx
:=
pos
.
TraceIndex
(
int
(
h
.
game
.
MaxDepth
(
ctx
)))
if
!
isAttack
{
// If we're defending, then the step will be from the trace to the next one
traceIdx
+=
1
}
prestate
,
proofData
,
_
,
err
:=
h
.
correctTrace
.
GetStepData
(
ctx
,
traceIdx
)
h
.
require
.
NoError
(
err
,
"Get step data"
)
h
.
game
.
StepFails
(
claimIdx
,
isAttack
,
prestate
,
proofData
)
}
op-e2e/faultproof_test.go
View file @
2b923b95
...
@@ -360,7 +360,7 @@ func TestCannonProposedOutputRootInvalid(t *testing.T) {
...
@@ -360,7 +360,7 @@ func TestCannonProposedOutputRootInvalid(t *testing.T) {
InitParallel
(
t
)
InitParallel
(
t
)
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
sys
,
l1Client
,
game
,
correctTrace
:=
setupDisputeGameForInvalidOutputRoot
(
t
,
common
.
Hash
{
0xab
})
sys
,
l1Client
,
game
,
correctTrace
:=
setupDisputeGameForInvalidOutputRoot
(
t
,
common
.
Hash
{
0x
01
,
0x
ab
})
t
.
Cleanup
(
sys
.
Close
)
t
.
Cleanup
(
sys
.
Close
)
maxDepth
:=
game
.
MaxDepth
(
ctx
)
maxDepth
:=
game
.
MaxDepth
(
ctx
)
...
@@ -385,7 +385,9 @@ func TestCannonProposedOutputRootInvalid(t *testing.T) {
...
@@ -385,7 +385,9 @@ func TestCannonProposedOutputRootInvalid(t *testing.T) {
game
.
WaitForClaimAtMaxDepth
(
ctx
,
false
)
game
.
WaitForClaimAtMaxDepth
(
ctx
,
false
)
// It's on us to call step if we want to win but shouldn't be possible
// It's on us to call step if we want to win but shouldn't be possible
// Need to add support for this to the helper
correctTrace
.
StepFails
(
ctx
,
maxDepth
,
true
)
// Defending should fail too
correctTrace
.
StepFails
(
ctx
,
maxDepth
,
false
)
// Time travel past when the game will be resolvable.
// Time travel past when the game will be resolvable.
sys
.
TimeTravelClock
.
AdvanceTime
(
game
.
GameDuration
(
ctx
))
sys
.
TimeTravelClock
.
AdvanceTime
(
game
.
GameDuration
(
ctx
))
...
...
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