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
230a1b90
Unverified
Commit
230a1b90
authored
Aug 11, 2023
by
mergify[bot]
Committed by
GitHub
Aug 11, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into jg/retry_when_dialing_in_fpp_host
parents
98e41122
4804504a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
15 deletions
+26
-15
helper.go
op-e2e/e2eutils/disputegame/helper.go
+25
-15
faultproof_test.go
op-e2e/faultproof_test.go
+1
-0
No files found.
op-e2e/e2eutils/disputegame/helper.go
View file @
230a1b90
...
@@ -84,7 +84,7 @@ func NewFactoryHelper(t *testing.T, ctx context.Context, deployments *genesis.L1
...
@@ -84,7 +84,7 @@ func NewFactoryHelper(t *testing.T, ctx context.Context, deployments *genesis.L1
}
}
func
(
h
*
FactoryHelper
)
StartAlphabetGame
(
ctx
context
.
Context
,
claimedAlphabet
string
)
*
AlphabetGameHelper
{
func
(
h
*
FactoryHelper
)
StartAlphabetGame
(
ctx
context
.
Context
,
claimedAlphabet
string
)
*
AlphabetGameHelper
{
h
.
waitForProposals
(
ctx
)
l2BlockNumber
:=
h
.
waitForProposals
(
ctx
)
l1Head
:=
h
.
checkpointL1Block
(
ctx
)
l1Head
:=
h
.
checkpointL1Block
(
ctx
)
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
1
*
time
.
Minute
)
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
1
*
time
.
Minute
)
...
@@ -94,7 +94,7 @@ func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet s
...
@@ -94,7 +94,7 @@ func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet s
rootClaim
,
err
:=
trace
.
Get
(
ctx
,
lastAlphabetTraceIndex
)
rootClaim
,
err
:=
trace
.
Get
(
ctx
,
lastAlphabetTraceIndex
)
h
.
require
.
NoError
(
err
,
"get root claim"
)
h
.
require
.
NoError
(
err
,
"get root claim"
)
extraData
:=
make
([]
byte
,
64
)
extraData
:=
make
([]
byte
,
64
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
24
:
],
uint64
(
8
)
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
24
:
],
l2BlockNumber
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
56
:
],
l1Head
.
Uint64
())
binary
.
BigEndian
.
PutUint64
(
extraData
[
56
:
],
l1Head
.
Uint64
())
tx
,
err
:=
h
.
factory
.
Create
(
h
.
opts
,
alphabetGameType
,
rootClaim
,
extraData
)
tx
,
err
:=
h
.
factory
.
Create
(
h
.
opts
,
alphabetGameType
,
rootClaim
,
extraData
)
h
.
require
.
NoError
(
err
,
"create fault dispute game"
)
h
.
require
.
NoError
(
err
,
"create fault dispute game"
)
...
@@ -120,14 +120,14 @@ func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet s
...
@@ -120,14 +120,14 @@ func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet s
}
}
func
(
h
*
FactoryHelper
)
StartCannonGame
(
ctx
context
.
Context
,
rootClaim
common
.
Hash
)
*
CannonGameHelper
{
func
(
h
*
FactoryHelper
)
StartCannonGame
(
ctx
context
.
Context
,
rootClaim
common
.
Hash
)
*
CannonGameHelper
{
h
.
waitForProposals
(
ctx
)
l2BlockNumber
:=
h
.
waitForProposals
(
ctx
)
l1Head
:=
h
.
checkpointL1Block
(
ctx
)
l1Head
:=
h
.
checkpointL1Block
(
ctx
)
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
1
*
time
.
Minute
)
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
1
*
time
.
Minute
)
defer
cancel
()
defer
cancel
()
extraData
:=
make
([]
byte
,
64
)
extraData
:=
make
([]
byte
,
64
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
24
:
],
uint64
(
8
)
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
24
:
],
l2BlockNumber
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
56
:
],
l1Head
.
Uint64
())
binary
.
BigEndian
.
PutUint64
(
extraData
[
56
:
],
l1Head
.
Uint64
())
tx
,
err
:=
h
.
factory
.
Create
(
h
.
opts
,
cannonGameType
,
rootClaim
,
extraData
)
tx
,
err
:=
h
.
factory
.
Create
(
h
.
opts
,
cannonGameType
,
rootClaim
,
extraData
)
h
.
require
.
NoError
(
err
,
"create fault dispute game"
)
h
.
require
.
NoError
(
err
,
"create fault dispute game"
)
...
@@ -153,20 +153,30 @@ func (h *FactoryHelper) StartCannonGame(ctx context.Context, rootClaim common.Ha
...
@@ -153,20 +153,30 @@ func (h *FactoryHelper) StartCannonGame(ctx context.Context, rootClaim common.Ha
// waitForProposals waits until there are at least two proposals in the output oracle
// waitForProposals waits until there are at least two proposals in the output oracle
// This is the minimum required for creating a game.
// This is the minimum required for creating a game.
func
(
h
*
FactoryHelper
)
waitForProposals
(
ctx
context
.
Context
)
{
// Returns the l2 block number of the latest available proposal
func
(
h
*
FactoryHelper
)
waitForProposals
(
ctx
context
.
Context
)
uint64
{
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
2
*
time
.
Minute
)
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
2
*
time
.
Minute
)
defer
cancel
()
defer
cancel
()
err
:=
utils
.
WaitFor
(
ctx
,
time
.
Second
,
func
()
(
bool
,
error
)
{
opts
:=
&
bind
.
CallOpts
{
Context
:
ctx
}
index
,
err
:=
h
.
l2oo
.
LatestOutputIndex
(
&
bind
.
CallOpts
{
Context
:
ctx
})
latestOutputIndex
,
err
:=
utils
.
WaitAndGet
(
ctx
,
time
.
Second
,
func
()
(
*
big
.
Int
,
error
)
{
index
,
err
:=
h
.
l2oo
.
LatestOutputIndex
(
opts
)
if
err
!=
nil
{
if
err
!=
nil
{
h
.
t
.
Logf
(
"Could not get latest output index: %v"
,
err
.
Error
())
h
.
t
.
Logf
(
"Could not get latest output index: %v"
,
err
.
Error
())
return
false
,
nil
return
nil
,
nil
}
}
h
.
t
.
Logf
(
"Latest output index: %v"
,
index
)
h
.
t
.
Logf
(
"Latest output index: %v"
,
index
)
return
index
.
Cmp
(
big
.
NewInt
(
1
))
>=
0
,
nil
return
index
,
nil
},
func
(
index
*
big
.
Int
)
bool
{
return
index
!=
nil
&&
index
.
Cmp
(
big
.
NewInt
(
1
))
>=
0
})
})
h
.
require
.
NoError
(
err
,
"Did not get two output roots"
)
h
.
require
.
NoError
(
err
,
"Did not get two output roots"
)
output
,
err
:=
h
.
l2oo
.
GetL2Output
(
opts
,
latestOutputIndex
)
h
.
require
.
NoErrorf
(
err
,
"Could not get latst output root index: %v"
,
latestOutputIndex
)
return
output
.
L2BlockNumber
.
Uint64
()
}
}
// checkpointL1Block stores the current L1 block in the oracle
// checkpointL1Block stores the current L1 block in the oracle
...
...
op-e2e/faultproof_test.go
View file @
230a1b90
...
@@ -21,6 +21,7 @@ func TestResolveDisputeGame(t *testing.T) {
...
@@ -21,6 +21,7 @@ func TestResolveDisputeGame(t *testing.T) {
t
.
Cleanup
(
sys
.
Close
)
t
.
Cleanup
(
sys
.
Close
)
disputeGameFactory
:=
disputegame
.
NewFactoryHelper
(
t
,
ctx
,
sys
.
cfg
.
L1Deployments
,
l1Client
)
disputeGameFactory
:=
disputegame
.
NewFactoryHelper
(
t
,
ctx
,
sys
.
cfg
.
L1Deployments
,
l1Client
)
game
:=
disputeGameFactory
.
StartAlphabetGame
(
ctx
,
"zyxwvut"
)
game
:=
disputeGameFactory
.
StartAlphabetGame
(
ctx
,
"zyxwvut"
)
require
.
NotNil
(
t
,
game
)
require
.
NotNil
(
t
,
game
)
gameDuration
:=
game
.
GameDuration
(
ctx
)
gameDuration
:=
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