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
4cd7b947
Unverified
Commit
4cd7b947
authored
Oct 13, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-challenger: Rename GameData to GameMetadata.
parent
33328e78
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
38 additions
and
38 deletions
+38
-38
game_loader.go
op-challenger/game/loader/game_loader.go
+2
-2
game_loader_test.go
op-challenger/game/loader/game_loader_test.go
+9
-9
monitor.go
op-challenger/game/monitor.go
+3
-3
monitor_test.go
op-challenger/game/monitor_test.go
+9
-9
coordinator.go
op-challenger/game/scheduler/coordinator.go
+4
-4
coordinator_test.go
op-challenger/game/scheduler/coordinator_test.go
+4
-4
scheduler.go
op-challenger/game/scheduler/scheduler.go
+3
-3
scheduler_test.go
op-challenger/game/scheduler/scheduler_test.go
+2
-2
service.go
op-challenger/game/service.go
+1
-1
types.go
op-challenger/game/types/types.go
+1
-1
No files found.
op-challenger/game/loader/game_loader.go
View file @
4cd7b947
...
@@ -38,7 +38,7 @@ func NewGameLoader(caller MinimalDisputeGameFactoryCaller) *GameLoader {
...
@@ -38,7 +38,7 @@ func NewGameLoader(caller MinimalDisputeGameFactoryCaller) *GameLoader {
}
}
// FetchAllGamesAtBlock fetches all dispute games from the factory at a given block number.
// FetchAllGamesAtBlock fetches all dispute games from the factory at a given block number.
func
(
l
*
GameLoader
)
FetchAllGamesAtBlock
(
ctx
context
.
Context
,
earliestTimestamp
uint64
,
blockNumber
*
big
.
Int
)
([]
types
.
Game
D
ata
,
error
)
{
func
(
l
*
GameLoader
)
FetchAllGamesAtBlock
(
ctx
context
.
Context
,
earliestTimestamp
uint64
,
blockNumber
*
big
.
Int
)
([]
types
.
Game
Metad
ata
,
error
)
{
if
blockNumber
==
nil
{
if
blockNumber
==
nil
{
return
nil
,
ErrMissingBlockNumber
return
nil
,
ErrMissingBlockNumber
}
}
...
@@ -51,7 +51,7 @@ func (l *GameLoader) FetchAllGamesAtBlock(ctx context.Context, earliestTimestamp
...
@@ -51,7 +51,7 @@ func (l *GameLoader) FetchAllGamesAtBlock(ctx context.Context, earliestTimestamp
return
nil
,
fmt
.
Errorf
(
"failed to fetch game count: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"failed to fetch game count: %w"
,
err
)
}
}
games
:=
make
([]
types
.
Game
D
ata
,
0
)
games
:=
make
([]
types
.
Game
Metad
ata
,
0
)
if
gameCount
.
Uint64
()
==
0
{
if
gameCount
.
Uint64
()
==
0
{
return
games
,
nil
return
games
,
nil
}
}
...
...
op-challenger/game/loader/game_loader_test.go
View file @
4cd7b947
...
@@ -79,18 +79,18 @@ func TestGameLoader_FetchAllGames(t *testing.T) {
...
@@ -79,18 +79,18 @@ func TestGameLoader_FetchAllGames(t *testing.T) {
expectedGames
:=
test
.
caller
.
games
expectedGames
:=
test
.
caller
.
games
expectedGames
=
expectedGames
[
len
(
expectedGames
)
-
test
.
expectedLen
:
]
expectedGames
=
expectedGames
[
len
(
expectedGames
)
-
test
.
expectedLen
:
]
if
test
.
expectedErr
!=
nil
{
if
test
.
expectedErr
!=
nil
{
expectedGames
=
make
([]
types
.
Game
D
ata
,
0
)
expectedGames
=
make
([]
types
.
Game
Metad
ata
,
0
)
}
}
require
.
ElementsMatch
(
t
,
expectedGames
,
translateGames
(
games
))
require
.
ElementsMatch
(
t
,
expectedGames
,
translateGames
(
games
))
})
})
}
}
}
}
func
generateMockGames
(
count
uint64
)
[]
types
.
Game
D
ata
{
func
generateMockGames
(
count
uint64
)
[]
types
.
Game
Metad
ata
{
games
:=
make
([]
types
.
Game
D
ata
,
count
)
games
:=
make
([]
types
.
Game
Metad
ata
,
count
)
for
i
:=
uint64
(
0
);
i
<
count
;
i
++
{
for
i
:=
uint64
(
0
);
i
<
count
;
i
++
{
games
[
i
]
=
types
.
Game
D
ata
{
games
[
i
]
=
types
.
Game
Metad
ata
{
Proxy
:
common
.
BigToAddress
(
big
.
NewInt
(
int64
(
i
))),
Proxy
:
common
.
BigToAddress
(
big
.
NewInt
(
int64
(
i
))),
Timestamp
:
i
*
100
,
Timestamp
:
i
*
100
,
}
}
...
@@ -99,8 +99,8 @@ func generateMockGames(count uint64) []types.GameData {
...
@@ -99,8 +99,8 @@ func generateMockGames(count uint64) []types.GameData {
return
games
return
games
}
}
func
translateGames
(
games
[]
types
.
Game
Data
)
[]
types
.
GameD
ata
{
func
translateGames
(
games
[]
types
.
Game
Metadata
)
[]
types
.
GameMetad
ata
{
translated
:=
make
([]
types
.
Game
D
ata
,
len
(
games
))
translated
:=
make
([]
types
.
Game
Metad
ata
,
len
(
games
))
for
i
,
game
:=
range
games
{
for
i
,
game
:=
range
games
{
translated
[
i
]
=
translateFaultDisputeGame
(
game
)
translated
[
i
]
=
translateFaultDisputeGame
(
game
)
...
@@ -109,8 +109,8 @@ func translateGames(games []types.GameData) []types.GameData {
...
@@ -109,8 +109,8 @@ func translateGames(games []types.GameData) []types.GameData {
return
translated
return
translated
}
}
func
translateFaultDisputeGame
(
game
types
.
Game
Data
)
types
.
GameD
ata
{
func
translateFaultDisputeGame
(
game
types
.
Game
Metadata
)
types
.
GameMetad
ata
{
return
types
.
Game
D
ata
{
return
types
.
Game
Metad
ata
{
Proxy
:
game
.
Proxy
,
Proxy
:
game
.
Proxy
,
Timestamp
:
game
.
Timestamp
,
Timestamp
:
game
.
Timestamp
,
}
}
...
@@ -132,7 +132,7 @@ type mockMinimalDisputeGameFactoryCaller struct {
...
@@ -132,7 +132,7 @@ type mockMinimalDisputeGameFactoryCaller struct {
gameCountErr
bool
gameCountErr
bool
indexErrors
[]
bool
indexErrors
[]
bool
gameCount
uint64
gameCount
uint64
games
[]
types
.
Game
D
ata
games
[]
types
.
Game
Metad
ata
}
}
func
newMockMinimalDisputeGameFactoryCaller
(
count
uint64
,
gameCountErr
bool
,
indexErrors
bool
)
*
mockMinimalDisputeGameFactoryCaller
{
func
newMockMinimalDisputeGameFactoryCaller
(
count
uint64
,
gameCountErr
bool
,
indexErrors
bool
)
*
mockMinimalDisputeGameFactoryCaller
{
...
...
op-challenger/game/monitor.go
View file @
4cd7b947
...
@@ -23,11 +23,11 @@ type blockNumberFetcher func(ctx context.Context) (uint64, error)
...
@@ -23,11 +23,11 @@ type blockNumberFetcher func(ctx context.Context) (uint64, error)
// gameSource loads information about the games available to play
// gameSource loads information about the games available to play
type
gameSource
interface
{
type
gameSource
interface
{
FetchAllGamesAtBlock
(
ctx
context
.
Context
,
earliest
uint64
,
blockNumber
*
big
.
Int
)
([]
types
.
Game
D
ata
,
error
)
FetchAllGamesAtBlock
(
ctx
context
.
Context
,
earliest
uint64
,
blockNumber
*
big
.
Int
)
([]
types
.
Game
Metad
ata
,
error
)
}
}
type
gameScheduler
interface
{
type
gameScheduler
interface
{
Schedule
([]
types
.
Game
D
ata
)
error
Schedule
([]
types
.
Game
Metad
ata
)
error
}
}
type
gameMonitor
struct
{
type
gameMonitor
struct
{
...
@@ -105,7 +105,7 @@ func (m *gameMonitor) progressGames(ctx context.Context, blockNum uint64) error
...
@@ -105,7 +105,7 @@ func (m *gameMonitor) progressGames(ctx context.Context, blockNum uint64) error
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to load games: %w"
,
err
)
return
fmt
.
Errorf
(
"failed to load games: %w"
,
err
)
}
}
var
gamesToPlay
[]
types
.
Game
D
ata
var
gamesToPlay
[]
types
.
Game
Metad
ata
for
_
,
game
:=
range
games
{
for
_
,
game
:=
range
games
{
if
!
m
.
allowedGame
(
game
.
Proxy
)
{
if
!
m
.
allowedGame
(
game
.
Proxy
)
{
m
.
logger
.
Debug
(
"Skipping game not on allow list"
,
"game"
,
game
.
Proxy
)
m
.
logger
.
Debug
(
"Skipping game not on allow list"
,
"game"
,
game
.
Proxy
)
...
...
op-challenger/game/monitor_test.go
View file @
4cd7b947
...
@@ -52,7 +52,7 @@ func TestMonitorGames(t *testing.T) {
...
@@ -52,7 +52,7 @@ func TestMonitorGames(t *testing.T) {
addr1
:=
common
.
Address
{
0xaa
}
addr1
:=
common
.
Address
{
0xaa
}
addr2
:=
common
.
Address
{
0xbb
}
addr2
:=
common
.
Address
{
0xbb
}
monitor
,
source
,
sched
,
mockHeadSource
:=
setupMonitorTest
(
t
,
[]
common
.
Address
{})
monitor
,
source
,
sched
,
mockHeadSource
:=
setupMonitorTest
(
t
,
[]
common
.
Address
{})
source
.
games
=
[]
types
.
Game
D
ata
{
newFDG
(
addr1
,
9999
),
newFDG
(
addr2
,
9999
)}
source
.
games
=
[]
types
.
Game
Metad
ata
{
newFDG
(
addr1
,
9999
),
newFDG
(
addr2
,
9999
)}
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
defer
cancel
()
...
@@ -94,7 +94,7 @@ func TestMonitorGames(t *testing.T) {
...
@@ -94,7 +94,7 @@ func TestMonitorGames(t *testing.T) {
addr1
:=
common
.
Address
{
0xaa
}
addr1
:=
common
.
Address
{
0xaa
}
addr2
:=
common
.
Address
{
0xbb
}
addr2
:=
common
.
Address
{
0xbb
}
monitor
,
source
,
sched
,
mockHeadSource
:=
setupMonitorTest
(
t
,
[]
common
.
Address
{})
monitor
,
source
,
sched
,
mockHeadSource
:=
setupMonitorTest
(
t
,
[]
common
.
Address
{})
source
.
games
=
[]
types
.
Game
D
ata
{
newFDG
(
addr1
,
9999
),
newFDG
(
addr2
,
9999
)}
source
.
games
=
[]
types
.
Game
Metad
ata
{
newFDG
(
addr1
,
9999
),
newFDG
(
addr2
,
9999
)}
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
defer
cancel
()
...
@@ -140,7 +140,7 @@ func TestMonitorCreateAndProgressGameAgents(t *testing.T) {
...
@@ -140,7 +140,7 @@ func TestMonitorCreateAndProgressGameAgents(t *testing.T) {
addr1
:=
common
.
Address
{
0xaa
}
addr1
:=
common
.
Address
{
0xaa
}
addr2
:=
common
.
Address
{
0xbb
}
addr2
:=
common
.
Address
{
0xbb
}
source
.
games
=
[]
types
.
Game
D
ata
{
newFDG
(
addr1
,
9999
),
newFDG
(
addr2
,
9999
)}
source
.
games
=
[]
types
.
Game
Metad
ata
{
newFDG
(
addr1
,
9999
),
newFDG
(
addr2
,
9999
)}
require
.
NoError
(
t
,
monitor
.
progressGames
(
context
.
Background
(),
uint64
(
1
)))
require
.
NoError
(
t
,
monitor
.
progressGames
(
context
.
Background
(),
uint64
(
1
)))
...
@@ -152,7 +152,7 @@ func TestMonitorOnlyScheduleSpecifiedGame(t *testing.T) {
...
@@ -152,7 +152,7 @@ func TestMonitorOnlyScheduleSpecifiedGame(t *testing.T) {
addr1
:=
common
.
Address
{
0xaa
}
addr1
:=
common
.
Address
{
0xaa
}
addr2
:=
common
.
Address
{
0xbb
}
addr2
:=
common
.
Address
{
0xbb
}
monitor
,
source
,
sched
,
_
:=
setupMonitorTest
(
t
,
[]
common
.
Address
{
addr2
})
monitor
,
source
,
sched
,
_
:=
setupMonitorTest
(
t
,
[]
common
.
Address
{
addr2
})
source
.
games
=
[]
types
.
Game
D
ata
{
newFDG
(
addr1
,
9999
),
newFDG
(
addr2
,
9999
)}
source
.
games
=
[]
types
.
Game
Metad
ata
{
newFDG
(
addr1
,
9999
),
newFDG
(
addr2
,
9999
)}
require
.
NoError
(
t
,
monitor
.
progressGames
(
context
.
Background
(),
uint64
(
1
)))
require
.
NoError
(
t
,
monitor
.
progressGames
(
context
.
Background
(),
uint64
(
1
)))
...
@@ -160,8 +160,8 @@ func TestMonitorOnlyScheduleSpecifiedGame(t *testing.T) {
...
@@ -160,8 +160,8 @@ func TestMonitorOnlyScheduleSpecifiedGame(t *testing.T) {
require
.
Equal
(
t
,
[]
common
.
Address
{
addr2
},
sched
.
scheduled
[
0
])
require
.
Equal
(
t
,
[]
common
.
Address
{
addr2
},
sched
.
scheduled
[
0
])
}
}
func
newFDG
(
proxy
common
.
Address
,
timestamp
uint64
)
types
.
Game
D
ata
{
func
newFDG
(
proxy
common
.
Address
,
timestamp
uint64
)
types
.
Game
Metad
ata
{
return
types
.
Game
D
ata
{
return
types
.
Game
Metad
ata
{
Proxy
:
proxy
,
Proxy
:
proxy
,
Timestamp
:
timestamp
,
Timestamp
:
timestamp
,
}
}
...
@@ -223,14 +223,14 @@ func (m *mockSubscription) Err() <-chan error {
...
@@ -223,14 +223,14 @@ func (m *mockSubscription) Err() <-chan error {
}
}
type
stubGameSource
struct
{
type
stubGameSource
struct
{
games
[]
types
.
Game
D
ata
games
[]
types
.
Game
Metad
ata
}
}
func
(
s
*
stubGameSource
)
FetchAllGamesAtBlock
(
func
(
s
*
stubGameSource
)
FetchAllGamesAtBlock
(
ctx
context
.
Context
,
ctx
context
.
Context
,
earliest
uint64
,
earliest
uint64
,
blockNumber
*
big
.
Int
,
blockNumber
*
big
.
Int
,
)
([]
types
.
Game
D
ata
,
error
)
{
)
([]
types
.
Game
Metad
ata
,
error
)
{
return
s
.
games
,
nil
return
s
.
games
,
nil
}
}
...
@@ -238,7 +238,7 @@ type stubScheduler struct {
...
@@ -238,7 +238,7 @@ type stubScheduler struct {
scheduled
[][]
common
.
Address
scheduled
[][]
common
.
Address
}
}
func
(
s
*
stubScheduler
)
Schedule
(
games
[]
types
.
Game
D
ata
)
error
{
func
(
s
*
stubScheduler
)
Schedule
(
games
[]
types
.
Game
Metad
ata
)
error
{
var
addrs
[]
common
.
Address
var
addrs
[]
common
.
Address
for
_
,
game
:=
range
games
{
for
_
,
game
:=
range
games
{
addrs
=
append
(
addrs
,
game
.
Proxy
)
addrs
=
append
(
addrs
,
game
.
Proxy
)
...
...
op-challenger/game/scheduler/coordinator.go
View file @
4cd7b947
...
@@ -14,7 +14,7 @@ import (
...
@@ -14,7 +14,7 @@ import (
var
errUnknownGame
=
errors
.
New
(
"unknown game"
)
var
errUnknownGame
=
errors
.
New
(
"unknown game"
)
type
PlayerCreator
func
(
game
types
.
Game
D
ata
,
dir
string
)
(
GamePlayer
,
error
)
type
PlayerCreator
func
(
game
types
.
Game
Metad
ata
,
dir
string
)
(
GamePlayer
,
error
)
type
gameState
struct
{
type
gameState
struct
{
player
GamePlayer
player
GamePlayer
...
@@ -44,10 +44,10 @@ type coordinator struct {
...
@@ -44,10 +44,10 @@ type coordinator struct {
// To avoid deadlock, it may process results from the inbound resultQueue while adding jobs to the outbound jobQueue.
// To avoid deadlock, it may process results from the inbound resultQueue while adding jobs to the outbound jobQueue.
// Returns an error if a game couldn't be scheduled because of an error. It will continue attempting to progress
// Returns an error if a game couldn't be scheduled because of an error. It will continue attempting to progress
// all games even if an error occurs with one game.
// all games even if an error occurs with one game.
func
(
c
*
coordinator
)
schedule
(
ctx
context
.
Context
,
games
[]
types
.
Game
D
ata
)
error
{
func
(
c
*
coordinator
)
schedule
(
ctx
context
.
Context
,
games
[]
types
.
Game
Metad
ata
)
error
{
// First remove any game states we no longer require
// First remove any game states we no longer require
for
addr
,
state
:=
range
c
.
states
{
for
addr
,
state
:=
range
c
.
states
{
if
!
state
.
inflight
&&
!
slices
.
ContainsFunc
(
games
,
func
(
candidate
types
.
Game
D
ata
)
bool
{
if
!
state
.
inflight
&&
!
slices
.
ContainsFunc
(
games
,
func
(
candidate
types
.
Game
Metad
ata
)
bool
{
return
candidate
.
Proxy
==
addr
return
candidate
.
Proxy
==
addr
})
{
})
{
delete
(
c
.
states
,
addr
)
delete
(
c
.
states
,
addr
)
...
@@ -96,7 +96,7 @@ func (c *coordinator) schedule(ctx context.Context, games []types.GameData) erro
...
@@ -96,7 +96,7 @@ func (c *coordinator) schedule(ctx context.Context, games []types.GameData) erro
// createJob updates the state for the specified game and returns the job to enqueue for it, if any
// createJob updates the state for the specified game and returns the job to enqueue for it, if any
// Returns (nil, nil) when there is no error and no job to enqueue
// Returns (nil, nil) when there is no error and no job to enqueue
func
(
c
*
coordinator
)
createJob
(
game
types
.
Game
D
ata
)
(
*
job
,
error
)
{
func
(
c
*
coordinator
)
createJob
(
game
types
.
Game
Metad
ata
)
(
*
job
,
error
)
{
state
,
ok
:=
c
.
states
[
game
.
Proxy
]
state
,
ok
:=
c
.
states
[
game
.
Proxy
]
if
!
ok
{
if
!
ok
{
state
=
&
gameState
{}
state
=
&
gameState
{}
...
...
op-challenger/game/scheduler/coordinator_test.go
View file @
4cd7b947
...
@@ -263,7 +263,7 @@ type createdGames struct {
...
@@ -263,7 +263,7 @@ type createdGames struct {
created
map
[
common
.
Address
]
*
stubGame
created
map
[
common
.
Address
]
*
stubGame
}
}
func
(
c
*
createdGames
)
CreateGame
(
fdg
types
.
Game
D
ata
,
dir
string
)
(
GamePlayer
,
error
)
{
func
(
c
*
createdGames
)
CreateGame
(
fdg
types
.
Game
Metad
ata
,
dir
string
)
(
GamePlayer
,
error
)
{
addr
:=
fdg
.
Proxy
addr
:=
fdg
.
Proxy
if
c
.
creationFails
==
addr
{
if
c
.
creationFails
==
addr
{
return
nil
,
fmt
.
Errorf
(
"refusing to create player for game: %v"
,
addr
)
return
nil
,
fmt
.
Errorf
(
"refusing to create player for game: %v"
,
addr
)
...
@@ -305,10 +305,10 @@ func (s *stubDiskManager) RemoveAllExcept(addrs []common.Address) error {
...
@@ -305,10 +305,10 @@ func (s *stubDiskManager) RemoveAllExcept(addrs []common.Address) error {
return
nil
return
nil
}
}
func
asGames
(
addrs
...
common
.
Address
)
[]
types
.
Game
D
ata
{
func
asGames
(
addrs
...
common
.
Address
)
[]
types
.
Game
Metad
ata
{
var
games
[]
types
.
Game
D
ata
var
games
[]
types
.
Game
Metad
ata
for
_
,
addr
:=
range
addrs
{
for
_
,
addr
:=
range
addrs
{
games
=
append
(
games
,
types
.
Game
D
ata
{
games
=
append
(
games
,
types
.
Game
Metad
ata
{
Proxy
:
addr
,
Proxy
:
addr
,
})
})
}
}
...
...
op-challenger/game/scheduler/scheduler.go
View file @
4cd7b947
...
@@ -26,7 +26,7 @@ type Scheduler struct {
...
@@ -26,7 +26,7 @@ type Scheduler struct {
coordinator
*
coordinator
coordinator
*
coordinator
m
SchedulerMetricer
m
SchedulerMetricer
maxConcurrency
uint
maxConcurrency
uint
scheduleQueue
chan
[]
types
.
Game
D
ata
scheduleQueue
chan
[]
types
.
Game
Metad
ata
jobQueue
chan
job
jobQueue
chan
job
resultQueue
chan
job
resultQueue
chan
job
wg
sync
.
WaitGroup
wg
sync
.
WaitGroup
...
@@ -41,7 +41,7 @@ func NewScheduler(logger log.Logger, m SchedulerMetricer, disk DiskManager, maxC
...
@@ -41,7 +41,7 @@ func NewScheduler(logger log.Logger, m SchedulerMetricer, disk DiskManager, maxC
// scheduleQueue has a size of 1 so backpressure quickly propagates to the caller
// scheduleQueue has a size of 1 so backpressure quickly propagates to the caller
// allowing them to potentially skip update cycles.
// allowing them to potentially skip update cycles.
scheduleQueue
:=
make
(
chan
[]
types
.
Game
D
ata
,
1
)
scheduleQueue
:=
make
(
chan
[]
types
.
Game
Metad
ata
,
1
)
return
&
Scheduler
{
return
&
Scheduler
{
logger
:
logger
,
logger
:
logger
,
...
@@ -84,7 +84,7 @@ func (s *Scheduler) Close() error {
...
@@ -84,7 +84,7 @@ func (s *Scheduler) Close() error {
return
nil
return
nil
}
}
func
(
s
*
Scheduler
)
Schedule
(
games
[]
types
.
Game
D
ata
)
error
{
func
(
s
*
Scheduler
)
Schedule
(
games
[]
types
.
Game
Metad
ata
)
error
{
select
{
select
{
case
s
.
scheduleQueue
<-
games
:
case
s
.
scheduleQueue
<-
games
:
return
nil
return
nil
...
...
op-challenger/game/scheduler/scheduler_test.go
View file @
4cd7b947
...
@@ -15,7 +15,7 @@ import (
...
@@ -15,7 +15,7 @@ import (
func
TestSchedulerProcessesGames
(
t
*
testing
.
T
)
{
func
TestSchedulerProcessesGames
(
t
*
testing
.
T
)
{
logger
:=
testlog
.
Logger
(
t
,
log
.
LvlInfo
)
logger
:=
testlog
.
Logger
(
t
,
log
.
LvlInfo
)
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
createPlayer
:=
func
(
g
types
.
Game
D
ata
,
dir
string
)
(
GamePlayer
,
error
)
{
createPlayer
:=
func
(
g
types
.
Game
Metad
ata
,
dir
string
)
(
GamePlayer
,
error
)
{
return
&
stubPlayer
{},
nil
return
&
stubPlayer
{},
nil
}
}
removeExceptCalls
:=
make
(
chan
[]
common
.
Address
)
removeExceptCalls
:=
make
(
chan
[]
common
.
Address
)
...
@@ -43,7 +43,7 @@ func TestSchedulerProcessesGames(t *testing.T) {
...
@@ -43,7 +43,7 @@ func TestSchedulerProcessesGames(t *testing.T) {
func
TestReturnBusyWhenScheduleQueueFull
(
t
*
testing
.
T
)
{
func
TestReturnBusyWhenScheduleQueueFull
(
t
*
testing
.
T
)
{
logger
:=
testlog
.
Logger
(
t
,
log
.
LvlInfo
)
logger
:=
testlog
.
Logger
(
t
,
log
.
LvlInfo
)
createPlayer
:=
func
(
game
types
.
Game
D
ata
,
dir
string
)
(
GamePlayer
,
error
)
{
createPlayer
:=
func
(
game
types
.
Game
Metad
ata
,
dir
string
)
(
GamePlayer
,
error
)
{
return
&
stubPlayer
{},
nil
return
&
stubPlayer
{},
nil
}
}
removeExceptCalls
:=
make
(
chan
[]
common
.
Address
)
removeExceptCalls
:=
make
(
chan
[]
common
.
Address
)
...
...
op-challenger/game/service.go
View file @
4cd7b947
...
@@ -100,7 +100,7 @@ func NewService(ctx context.Context, logger log.Logger, cfg *config.Config) (*Se
...
@@ -100,7 +100,7 @@ func NewService(ctx context.Context, logger log.Logger, cfg *config.Config) (*Se
m
,
m
,
disk
,
disk
,
cfg
.
MaxConcurrency
,
cfg
.
MaxConcurrency
,
func
(
game
types
.
Game
D
ata
,
dir
string
)
(
scheduler
.
GamePlayer
,
error
)
{
func
(
game
types
.
Game
Metad
ata
,
dir
string
)
(
scheduler
.
GamePlayer
,
error
)
{
return
fault
.
NewGamePlayer
(
ctx
,
logger
,
m
,
cfg
,
dir
,
game
.
Proxy
,
txMgr
,
l1Client
)
return
fault
.
NewGamePlayer
(
ctx
,
logger
,
m
,
cfg
,
dir
,
game
.
Proxy
,
txMgr
,
l1Client
)
})
})
...
...
op-challenger/game/types/types.go
View file @
4cd7b947
...
@@ -36,7 +36,7 @@ func GameStatusFromUint8(i uint8) (GameStatus, error) {
...
@@ -36,7 +36,7 @@ func GameStatusFromUint8(i uint8) (GameStatus, error) {
return
GameStatus
(
i
),
nil
return
GameStatus
(
i
),
nil
}
}
type
Game
D
ata
struct
{
type
Game
Metad
ata
struct
{
GameType
uint8
GameType
uint8
Timestamp
uint64
Timestamp
uint64
Proxy
common
.
Address
Proxy
common
.
Address
...
...
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