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
0b4fb000
Unverified
Commit
0b4fb000
authored
Feb 15, 2024
by
refcell
Committed by
GitHub
Feb 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(op-dispute-mon): isolate game caller package (#9544)
parent
0341b833
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
12 deletions
+15
-12
detector.go
op-dispute-mon/mon/detector.go
+2
-1
detector_test.go
op-dispute-mon/mon/detector_test.go
+2
-1
caller.go
op-dispute-mon/mon/extract/caller.go
+5
-5
caller_test.go
op-dispute-mon/mon/extract/caller_test.go
+1
-1
service.go
op-dispute-mon/mon/service.go
+5
-4
No files found.
op-dispute-mon/mon/detector.go
View file @
0b4fb000
...
@@ -5,6 +5,7 @@ import (
...
@@ -5,6 +5,7 @@ import (
"fmt"
"fmt"
"github.com/ethereum-optimism/optimism/op-challenger/game/types"
"github.com/ethereum-optimism/optimism/op-challenger/game/types"
"github.com/ethereum-optimism/optimism/op-dispute-mon/mon/extract"
monTypes
"github.com/ethereum-optimism/optimism/op-dispute-mon/mon/types"
monTypes
"github.com/ethereum-optimism/optimism/op-dispute-mon/mon/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
...
@@ -16,7 +17,7 @@ type OutputValidator interface {
...
@@ -16,7 +17,7 @@ type OutputValidator interface {
}
}
type
GameCallerCreator
interface
{
type
GameCallerCreator
interface
{
CreateContract
(
game
types
.
GameMetadata
)
(
GameCaller
,
error
)
CreateContract
(
game
types
.
GameMetadata
)
(
extract
.
GameCaller
,
error
)
}
}
type
DetectorMetrics
interface
{
type
DetectorMetrics
interface
{
...
...
op-dispute-mon/mon/detector_test.go
View file @
0b4fb000
...
@@ -7,6 +7,7 @@ import (
...
@@ -7,6 +7,7 @@ import (
faultTypes
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/types"
faultTypes
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/types"
"github.com/ethereum-optimism/optimism/op-challenger/game/types"
"github.com/ethereum-optimism/optimism/op-challenger/game/types"
"github.com/ethereum-optimism/optimism/op-dispute-mon/mon/extract"
monTypes
"github.com/ethereum-optimism/optimism/op-dispute-mon/mon/types"
monTypes
"github.com/ethereum-optimism/optimism/op-dispute-mon/mon/types"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
...
@@ -266,7 +267,7 @@ type mockGameCallerCreator struct {
...
@@ -266,7 +267,7 @@ type mockGameCallerCreator struct {
caller
*
mockGameCaller
caller
*
mockGameCaller
}
}
func
(
m
*
mockGameCallerCreator
)
CreateContract
(
game
types
.
GameMetadata
)
(
GameCaller
,
error
)
{
func
(
m
*
mockGameCallerCreator
)
CreateContract
(
game
types
.
GameMetadata
)
(
extract
.
GameCaller
,
error
)
{
m
.
calls
++
m
.
calls
++
if
m
.
err
!=
nil
{
if
m
.
err
!=
nil
{
return
nil
,
m
.
err
return
nil
,
m
.
err
...
...
op-dispute-mon/mon/caller.go
→
op-dispute-mon/mon/
extract/
caller.go
View file @
0b4fb000
package
mon
package
extract
import
(
import
(
"context"
"context"
...
@@ -20,19 +20,19 @@ type GameCaller interface {
...
@@ -20,19 +20,19 @@ type GameCaller interface {
GetAllClaims
(
ctx
context
.
Context
)
([]
faultTypes
.
Claim
,
error
)
GetAllClaims
(
ctx
context
.
Context
)
([]
faultTypes
.
Claim
,
error
)
}
}
type
g
ameCallerCreator
struct
{
type
G
ameCallerCreator
struct
{
cache
*
caching
.
LRUCache
[
common
.
Address
,
*
contracts
.
FaultDisputeGameContract
]
cache
*
caching
.
LRUCache
[
common
.
Address
,
*
contracts
.
FaultDisputeGameContract
]
caller
*
batching
.
MultiCaller
caller
*
batching
.
MultiCaller
}
}
func
NewGameCallerCreator
(
m
caching
.
Metrics
,
caller
*
batching
.
MultiCaller
)
*
g
ameCallerCreator
{
func
NewGameCallerCreator
(
m
caching
.
Metrics
,
caller
*
batching
.
MultiCaller
)
*
G
ameCallerCreator
{
return
&
g
ameCallerCreator
{
return
&
G
ameCallerCreator
{
caller
:
caller
,
caller
:
caller
,
cache
:
caching
.
NewLRUCache
[
common
.
Address
,
*
contracts
.
FaultDisputeGameContract
](
m
,
metricsLabel
,
100
),
cache
:
caching
.
NewLRUCache
[
common
.
Address
,
*
contracts
.
FaultDisputeGameContract
](
m
,
metricsLabel
,
100
),
}
}
}
}
func
(
g
*
g
ameCallerCreator
)
CreateContract
(
game
types
.
GameMetadata
)
(
GameCaller
,
error
)
{
func
(
g
*
G
ameCallerCreator
)
CreateContract
(
game
types
.
GameMetadata
)
(
GameCaller
,
error
)
{
if
fdg
,
ok
:=
g
.
cache
.
Get
(
game
.
Proxy
);
ok
{
if
fdg
,
ok
:=
g
.
cache
.
Get
(
game
.
Proxy
);
ok
{
return
fdg
,
nil
return
fdg
,
nil
}
}
...
...
op-dispute-mon/mon/caller_test.go
→
op-dispute-mon/mon/
extract/
caller_test.go
View file @
0b4fb000
package
mon
package
extract
import
(
import
(
"fmt"
"fmt"
...
...
op-dispute-mon/mon/service.go
View file @
0b4fb000
...
@@ -11,11 +11,12 @@ import (
...
@@ -11,11 +11,12 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/contracts"
"github.com/ethereum-optimism/optimism/op-dispute-mon/config"
"github.com/ethereum-optimism/optimism/op-dispute-mon/config"
"github.com/ethereum-optimism/optimism/op-dispute-mon/metrics"
"github.com/ethereum-optimism/optimism/op-dispute-mon/metrics"
"github.com/ethereum-optimism/optimism/op-dispute-mon/mon/extract"
"github.com/ethereum-optimism/optimism/op-dispute-mon/version"
"github.com/ethereum-optimism/optimism/op-dispute-mon/version"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/contracts"
"github.com/ethereum-optimism/optimism/op-service/clock"
"github.com/ethereum-optimism/optimism/op-service/clock"
"github.com/ethereum-optimism/optimism/op-service/dial"
"github.com/ethereum-optimism/optimism/op-service/dial"
"github.com/ethereum-optimism/optimism/op-service/httputil"
"github.com/ethereum-optimism/optimism/op-service/httputil"
...
@@ -35,7 +36,7 @@ type Service struct {
...
@@ -35,7 +36,7 @@ type Service struct {
cl
clock
.
Clock
cl
clock
.
Clock
forecast
*
forecast
forecast
*
forecast
game
*
g
ameCallerCreator
game
*
extract
.
G
ameCallerCreator
rollupClient
*
sources
.
RollupClient
rollupClient
*
sources
.
RollupClient
detector
*
detector
detector
*
detector
validator
*
outputValidator
validator
*
outputValidator
...
@@ -99,7 +100,7 @@ func (s *Service) initOutputValidator() {
...
@@ -99,7 +100,7 @@ func (s *Service) initOutputValidator() {
}
}
func
(
s
*
Service
)
initGameCallerCreator
()
{
func
(
s
*
Service
)
initGameCallerCreator
()
{
s
.
game
=
NewGameCallerCreator
(
s
.
metrics
,
batching
.
NewMultiCaller
(
s
.
l1Client
.
Client
(),
batching
.
DefaultBatchSize
))
s
.
game
=
extract
.
NewGameCallerCreator
(
s
.
metrics
,
batching
.
NewMultiCaller
(
s
.
l1Client
.
Client
(),
batching
.
DefaultBatchSize
))
}
}
func
(
s
*
Service
)
initForecast
(
cfg
*
config
.
Config
)
{
func
(
s
*
Service
)
initForecast
(
cfg
*
config
.
Config
)
{
...
...
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