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
d27ee1b5
Unverified
Commit
d27ee1b5
authored
Aug 29, 2023
by
Andrew Huang
Committed by
GitHub
Aug 29, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ethereum-optimism:develop' into netrestrict
parents
4f35b852
66af76fe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
8 deletions
+37
-8
Dockerfile
op-challenger/Dockerfile
+12
-1
player.go
op-challenger/game/fault/player.go
+24
-6
player_test.go
op-challenger/game/fault/player_test.go
+1
-1
No files found.
op-challenger/Dockerfile
View file @
d27ee1b5
...
...
@@ -6,6 +6,8 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
# build op-challenger with the shared go.mod & go.sum files
COPY
./op-challenger /app/op-challenger
COPY
./op-program /app/op-program
COPY
./op-preimage /app/op-preimage
COPY
./op-bindings /app/op-bindings
COPY
./op-node /app/op-node
COPY
./op-service /app/op-service
...
...
@@ -19,16 +21,25 @@ COPY ./cannon /app/cannon
COPY
./op-preimage /app/op-preimage
COPY
./op-chain-ops /app/op-chain-ops
WORKDIR
/app/op-
challenger
WORKDIR
/app/op-
program
RUN
go mod download
ARG
TARGETOS TARGETARCH
RUN
make op-program-host
VERSION
=
"
$VERSION
"
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
WORKDIR
/app/op-challenger
RUN
make op-challenger
VERSION
=
"
$VERSION
"
GOOS
=
$TARGETOS
GOARCH
=
$TARGETARCH
FROM
alpine:3.18
# Make the bundled op-program the default cannon server
ENV
OP_CHALLENGER_CANNON_SERVER /usr/local/bin/op-program
COPY
--from=builder /app/op-challenger/bin/op-challenger /usr/local/bin
COPY
--from=builder /app/op-program/bin/op-program /usr/local/bin
CMD
["op-challenger"]
op-challenger/game/fault/player.go
View file @
d27ee1b5
...
...
@@ -18,9 +18,7 @@ import (
"github.com/ethereum/go-ethereum/log"
)
type
Actor
interface
{
Act
(
ctx
context
.
Context
)
error
}
type
actor
func
(
ctx
context
.
Context
)
error
type
GameInfo
interface
{
GetGameStatus
(
context
.
Context
)
(
types
.
GameStatus
,
error
)
...
...
@@ -28,7 +26,7 @@ type GameInfo interface {
}
type
GamePlayer
struct
{
a
gent
A
ctor
a
ct
a
ctor
agreeWithProposedOutput
bool
loader
GameInfo
logger
log
.
Logger
...
...
@@ -53,6 +51,25 @@ func NewGamePlayer(
loader
:=
NewLoader
(
contract
)
status
,
err
:=
loader
.
GetGameStatus
(
ctx
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to fetch game status: %w"
,
err
)
}
if
status
!=
types
.
GameStatusInProgress
{
logger
.
Info
(
"Game already resolved"
,
"status"
,
status
)
// Game is already complete so skip creating the trace provider, loading game inputs etc.
return
&
GamePlayer
{
logger
:
logger
,
loader
:
loader
,
agreeWithProposedOutput
:
cfg
.
AgreeWithProposedOutput
,
completed
:
true
,
// Act function does nothing because the game is already complete
act
:
func
(
ctx
context
.
Context
)
error
{
return
nil
},
},
nil
}
gameDepth
,
err
:=
loader
.
FetchGameDepth
(
ctx
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to fetch the game depth: %w"
,
err
)
...
...
@@ -88,10 +105,11 @@ func NewGamePlayer(
}
return
&
GamePlayer
{
a
gent
:
NewAgent
(
loader
,
int
(
gameDepth
),
provider
,
responder
,
updater
,
cfg
.
AgreeWithProposedOutput
,
logger
)
,
a
ct
:
NewAgent
(
loader
,
int
(
gameDepth
),
provider
,
responder
,
updater
,
cfg
.
AgreeWithProposedOutput
,
logger
)
.
Act
,
agreeWithProposedOutput
:
cfg
.
AgreeWithProposedOutput
,
loader
:
loader
,
logger
:
logger
,
completed
:
status
!=
types
.
GameStatusInProgress
,
},
nil
}
...
...
@@ -102,7 +120,7 @@ func (g *GamePlayer) ProgressGame(ctx context.Context) bool {
return
true
}
g
.
logger
.
Trace
(
"Checking if actions are required"
)
if
err
:=
g
.
a
gent
.
A
ct
(
ctx
);
err
!=
nil
{
if
err
:=
g
.
act
(
ctx
);
err
!=
nil
{
g
.
logger
.
Error
(
"Error when acting on game"
,
"err"
,
err
)
}
if
status
,
err
:=
g
.
loader
.
GetGameStatus
(
ctx
);
err
!=
nil
{
...
...
op-challenger/game/fault/player_test.go
View file @
d27ee1b5
...
...
@@ -157,7 +157,7 @@ func setupProgressGameTest(t *testing.T, agreeWithProposedRoot bool) (*testlog.C
logger
.
SetHandler
(
handler
)
gameState
:=
&
stubGameState
{
claimCount
:
1
}
game
:=
&
GamePlayer
{
a
gent
:
gameState
,
a
ct
:
gameState
.
Act
,
agreeWithProposedOutput
:
agreeWithProposedRoot
,
loader
:
gameState
,
logger
:
logger
,
...
...
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