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
fb70f8c7
Unverified
Commit
fb70f8c7
authored
Nov 16, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add detail to TODO and reduce duplication in e2e helper.
parent
cc1719e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
25 deletions
+17
-25
output_cannon.go
op-challenger/game/fault/trace/outputs/output_cannon.go
+1
-1
helper.go
op-e2e/e2eutils/disputegame/helper.go
+16
-24
No files found.
op-challenger/game/fault/trace/outputs/output_cannon.go
View file @
fb70f8c7
...
...
@@ -17,7 +17,7 @@ func NewOutputCannonTraceAccessor(ctx context.Context, logger log.Logger, rollup
}
cannonCreator
:=
func
(
ctx
context
.
Context
,
pre
types
.
Claim
,
post
types
.
Claim
)
(
types
.
TraceProvider
,
error
)
{
// TODO(client-pod#43):
Implement thi
s.
// TODO(client-pod#43):
Actually create the cannon trace provider for the trace between the given claim
s.
return
nil
,
errors
.
New
(
"not implemented"
)
}
...
...
op-e2e/e2eutils/disputegame/helper.go
View file @
fb70f8c7
...
...
@@ -103,8 +103,7 @@ func NewFactoryHelper(t *testing.T, ctx context.Context, deployments *genesis.L1
}
func
(
h
*
FactoryHelper
)
StartAlphabetGame
(
ctx
context
.
Context
,
claimedAlphabet
string
)
*
AlphabetGameHelper
{
l2BlockNumber
:=
h
.
waitForProposals
(
ctx
)
l1Head
:=
h
.
checkpointL1Block
(
ctx
)
extraData
,
_
,
_
:=
h
.
createDisputeGameExtraData
(
ctx
)
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
2
*
time
.
Minute
)
defer
cancel
()
...
...
@@ -113,9 +112,6 @@ func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet s
pos
:=
faultTypes
.
NewPosition
(
alphabetGameDepth
,
lastAlphabetTraceIndex
)
rootClaim
,
err
:=
trace
.
Get
(
ctx
,
pos
)
h
.
require
.
NoError
(
err
,
"get root claim"
)
extraData
:=
make
([]
byte
,
64
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
24
:
],
l2BlockNumber
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
56
:
],
l1Head
.
Uint64
())
tx
,
err
:=
transactions
.
PadGasEstimate
(
h
.
opts
,
2
,
func
(
opts
*
bind
.
TransactOpts
)
(
*
types
.
Transaction
,
error
)
{
return
h
.
factory
.
Create
(
opts
,
alphabetGameType
,
rootClaim
,
extraData
)
})
...
...
@@ -144,15 +140,11 @@ func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet s
}
func
(
h
*
FactoryHelper
)
StartOutputCannonGame
(
ctx
context
.
Context
,
rollupEndpoint
string
,
rootClaim
common
.
Hash
)
*
OutputCannonGameHelper
{
l2BlockNumber
:=
h
.
waitForProposals
(
ctx
)
l1Head
:=
h
.
checkpointL1Block
(
ctx
)
extraData
,
_
,
_
:=
h
.
createDisputeGameExtraData
(
ctx
)
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
1
*
time
.
Minute
)
defer
cancel
()
extraData
:=
make
([]
byte
,
64
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
24
:
],
l2BlockNumber
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
56
:
],
l1Head
.
Uint64
())
tx
,
err
:=
transactions
.
PadGasEstimate
(
h
.
opts
,
2
,
func
(
opts
*
bind
.
TransactOpts
)
(
*
types
.
Transaction
,
error
)
{
return
h
.
factory
.
Create
(
opts
,
outputCannonGameType
,
rootClaim
,
extraData
)
})
...
...
@@ -184,12 +176,12 @@ func (h *FactoryHelper) StartOutputCannonGame(ctx context.Context, rollupEndpoin
}
func
(
h
*
FactoryHelper
)
StartCannonGame
(
ctx
context
.
Context
,
rootClaim
common
.
Hash
)
*
CannonGameHelper
{
l2BlockNumber
,
l1Head
:=
h
.
prepareCannonGame
(
ctx
)
return
h
.
createCannonGame
(
ctx
,
l2BlockNumber
,
l1Head
,
rootClaim
)
extraData
,
_
,
_
:=
h
.
createDisputeGameExtraData
(
ctx
)
return
h
.
createCannonGame
(
ctx
,
rootClaim
,
extraData
)
}
func
(
h
*
FactoryHelper
)
StartCannonGameWithCorrectRoot
(
ctx
context
.
Context
,
rollupCfg
*
rollup
.
Config
,
l2Genesis
*
core
.
Genesis
,
l1Endpoint
string
,
l2Endpoint
string
,
options
...
challenger
.
Option
)
(
*
CannonGameHelper
,
*
HonestHelper
)
{
l2BlockNumber
,
l1Head
:=
h
.
prepareCannonGame
(
ctx
)
extraData
,
l1Head
,
l2BlockNumber
:=
h
.
createDisputeGameExtraData
(
ctx
)
challengerOpts
:=
[]
challenger
.
Option
{
challenger
.
WithCannon
(
h
.
t
,
rollupCfg
,
l2Genesis
,
l2Endpoint
),
challenger
.
WithFactoryAddress
(
h
.
factoryAddr
),
...
...
@@ -243,7 +235,7 @@ func (h *FactoryHelper) StartCannonGameWithCorrectRoot(ctx context.Context, roll
// Otherwise creating the game will fail
rootClaim
[
0
]
=
mipsevm
.
VMStatusInvalid
game
:=
h
.
createCannonGame
(
ctx
,
l2BlockNumber
,
l1Head
,
rootClaim
)
game
:=
h
.
createCannonGame
(
ctx
,
rootClaim
,
extraData
)
correctMaxDepth
:=
game
.
MaxDepth
(
ctx
)
provider
.
SetMaxDepth
(
uint64
(
correctMaxDepth
))
honestHelper
:=
&
HonestHelper
{
...
...
@@ -255,13 +247,10 @@ func (h *FactoryHelper) StartCannonGameWithCorrectRoot(ctx context.Context, roll
return
game
,
honestHelper
}
func
(
h
*
FactoryHelper
)
createCannonGame
(
ctx
context
.
Context
,
l2BlockNumber
uint64
,
l1Head
*
big
.
Int
,
rootClaim
common
.
Hash
)
*
CannonGameHelper
{
func
(
h
*
FactoryHelper
)
createCannonGame
(
ctx
context
.
Context
,
rootClaim
common
.
Hash
,
extraData
[]
byte
)
*
CannonGameHelper
{
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
1
*
time
.
Minute
)
defer
cancel
()
extraData
:=
make
([]
byte
,
64
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
24
:
],
l2BlockNumber
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
56
:
],
l1Head
.
Uint64
())
tx
,
err
:=
transactions
.
PadGasEstimate
(
h
.
opts
,
2
,
func
(
opts
*
bind
.
TransactOpts
)
(
*
types
.
Transaction
,
error
)
{
return
h
.
factory
.
Create
(
opts
,
cannonGameType
,
rootClaim
,
extraData
)
})
...
...
@@ -287,6 +276,15 @@ func (h *FactoryHelper) createCannonGame(ctx context.Context, l2BlockNumber uint
}
}
func
(
h
*
FactoryHelper
)
createDisputeGameExtraData
(
ctx
context
.
Context
)
(
extraData
[]
byte
,
l1Head
*
big
.
Int
,
l2BlockNumber
uint64
)
{
l2BlockNumber
=
h
.
waitForProposals
(
ctx
)
l1Head
=
h
.
checkpointL1Block
(
ctx
)
extraData
=
make
([]
byte
,
64
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
24
:
],
l2BlockNumber
)
binary
.
BigEndian
.
PutUint64
(
extraData
[
56
:
],
l1Head
.
Uint64
())
return
}
func
(
h
*
FactoryHelper
)
StartChallenger
(
ctx
context
.
Context
,
l1Endpoint
string
,
name
string
,
options
...
challenger
.
Option
)
*
challenger
.
Helper
{
opts
:=
[]
challenger
.
Option
{
challenger
.
WithFactoryAddress
(
h
.
factoryAddr
),
...
...
@@ -299,12 +297,6 @@ func (h *FactoryHelper) StartChallenger(ctx context.Context, l1Endpoint string,
return
c
}
func
(
h
*
FactoryHelper
)
prepareCannonGame
(
ctx
context
.
Context
)
(
uint64
,
*
big
.
Int
)
{
l2BlockNumber
:=
h
.
waitForProposals
(
ctx
)
l1Head
:=
h
.
checkpointL1Block
(
ctx
)
return
l2BlockNumber
,
l1Head
}
// waitForProposals waits until there are at least two proposals in the output oracle
// This is the minimum required for creating a game.
// Returns the l2 block number of the latest available proposal
...
...
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