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
036a14a0
Unverified
Commit
036a14a0
authored
Jun 26, 2024
by
Adrian Sutton
Committed by
GitHub
Jun 26, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-challenger: Remove unused blockNumberFetcher (#11006)
parent
1bfd7e9b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
32 deletions
+21
-32
monitor.go
op-challenger/game/monitor.go
+20
-25
monitor_test.go
op-challenger/game/monitor_test.go
+0
-6
service.go
op-challenger/game/service.go
+1
-1
No files found.
op-challenger/game/monitor.go
View file @
036a14a0
...
@@ -19,8 +19,6 @@ import (
...
@@ -19,8 +19,6 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
)
)
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
{
GetGamesAtOrAfter
(
ctx
context
.
Context
,
blockHash
common
.
Hash
,
earliestTimestamp
uint64
)
([]
types
.
GameMetadata
,
error
)
GetGamesAtOrAfter
(
ctx
context
.
Context
,
blockHash
common
.
Hash
,
earliestTimestamp
uint64
)
([]
types
.
GameMetadata
,
error
)
...
@@ -44,18 +42,17 @@ type claimer interface {
...
@@ -44,18 +42,17 @@ type claimer interface {
}
}
type
gameMonitor
struct
{
type
gameMonitor
struct
{
logger
log
.
Logger
logger
log
.
Logger
clock
RWClock
clock
RWClock
source
gameSource
source
gameSource
scheduler
gameScheduler
scheduler
gameScheduler
preimages
preimageScheduler
preimages
preimageScheduler
gameWindow
time
.
Duration
gameWindow
time
.
Duration
claimer
claimer
claimer
claimer
fetchBlockNumber
blockNumberFetcher
allowedGames
[]
common
.
Address
allowedGames
[]
common
.
Address
l1HeadsSub
ethereum
.
Subscription
l1HeadsSub
ethereum
.
Subscription
l1Source
*
headSource
l1Source
*
headSource
runState
sync
.
Mutex
runState
sync
.
Mutex
}
}
type
MinimalSubscriber
interface
{
type
MinimalSubscriber
interface
{
...
@@ -78,21 +75,19 @@ func newGameMonitor(
...
@@ -78,21 +75,19 @@ func newGameMonitor(
preimages
preimageScheduler
,
preimages
preimageScheduler
,
gameWindow
time
.
Duration
,
gameWindow
time
.
Duration
,
claimer
claimer
,
claimer
claimer
,
fetchBlockNumber
blockNumberFetcher
,
allowedGames
[]
common
.
Address
,
allowedGames
[]
common
.
Address
,
l1Source
MinimalSubscriber
,
l1Source
MinimalSubscriber
,
)
*
gameMonitor
{
)
*
gameMonitor
{
return
&
gameMonitor
{
return
&
gameMonitor
{
logger
:
logger
,
logger
:
logger
,
clock
:
cl
,
clock
:
cl
,
scheduler
:
scheduler
,
scheduler
:
scheduler
,
preimages
:
preimages
,
preimages
:
preimages
,
source
:
source
,
source
:
source
,
gameWindow
:
gameWindow
,
gameWindow
:
gameWindow
,
claimer
:
claimer
,
claimer
:
claimer
,
fetchBlockNumber
:
fetchBlockNumber
,
allowedGames
:
allowedGames
,
allowedGames
:
allowedGames
,
l1Source
:
&
headSource
{
inner
:
l1Source
},
l1Source
:
&
headSource
{
inner
:
l1Source
},
}
}
}
}
...
...
op-challenger/game/monitor_test.go
View file @
036a14a0
...
@@ -155,11 +155,6 @@ func setupMonitorTest(
...
@@ -155,11 +155,6 @@ func setupMonitorTest(
)
(
*
gameMonitor
,
*
stubGameSource
,
*
stubScheduler
,
*
mockNewHeadSource
,
*
stubPreimageScheduler
,
*
mockScheduler
)
{
)
(
*
gameMonitor
,
*
stubGameSource
,
*
stubScheduler
,
*
mockNewHeadSource
,
*
stubPreimageScheduler
,
*
mockScheduler
)
{
logger
:=
testlog
.
Logger
(
t
,
log
.
LevelDebug
)
logger
:=
testlog
.
Logger
(
t
,
log
.
LevelDebug
)
source
:=
&
stubGameSource
{}
source
:=
&
stubGameSource
{}
i
:=
uint64
(
1
)
fetchBlockNum
:=
func
(
ctx
context
.
Context
)
(
uint64
,
error
)
{
i
++
return
i
,
nil
}
sched
:=
&
stubScheduler
{}
sched
:=
&
stubScheduler
{}
preimages
:=
&
stubPreimageScheduler
{}
preimages
:=
&
stubPreimageScheduler
{}
mockHeadSource
:=
&
mockNewHeadSource
{}
mockHeadSource
:=
&
mockNewHeadSource
{}
...
@@ -172,7 +167,6 @@ func setupMonitorTest(
...
@@ -172,7 +167,6 @@ func setupMonitorTest(
preimages
,
preimages
,
time
.
Duration
(
0
),
time
.
Duration
(
0
),
stubClaimer
,
stubClaimer
,
fetchBlockNum
,
allowedGames
,
allowedGames
,
mockHeadSource
,
mockHeadSource
,
)
)
...
...
op-challenger/game/service.go
View file @
036a14a0
...
@@ -251,7 +251,7 @@ func (s *Service) initLargePreimages() error {
...
@@ -251,7 +251,7 @@ func (s *Service) initLargePreimages() error {
}
}
func
(
s
*
Service
)
initMonitor
(
cfg
*
config
.
Config
)
{
func
(
s
*
Service
)
initMonitor
(
cfg
*
config
.
Config
)
{
s
.
monitor
=
newGameMonitor
(
s
.
logger
,
s
.
l1Clock
,
s
.
factoryContract
,
s
.
sched
,
s
.
preimages
,
cfg
.
GameWindow
,
s
.
claimer
,
s
.
l1Client
.
BlockNumber
,
cfg
.
GameAllowlist
,
s
.
pollClient
)
s
.
monitor
=
newGameMonitor
(
s
.
logger
,
s
.
l1Clock
,
s
.
factoryContract
,
s
.
sched
,
s
.
preimages
,
cfg
.
GameWindow
,
s
.
claimer
,
cfg
.
GameAllowlist
,
s
.
pollClient
)
}
}
func
(
s
*
Service
)
Start
(
ctx
context
.
Context
)
error
{
func
(
s
*
Service
)
Start
(
ctx
context
.
Context
)
error
{
...
...
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