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
980064ab
Unverified
Commit
980064ab
authored
Sep 13, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-challenger: Fix recording of cannon execution time.
Previously only recorded failed cannon executions.
parent
174bfbd4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
15 deletions
+23
-15
executor.go
op-challenger/game/fault/trace/cannon/executor.go
+1
-4
executor_test.go
op-challenger/game/fault/trace/cannon/executor_test.go
+12
-1
noop.go
op-challenger/metrics/noop.go
+10
-10
No files found.
op-challenger/game/fault/trace/cannon/executor.go
View file @
980064ab
...
@@ -124,10 +124,7 @@ func (e *Executor) GenerateProof(ctx context.Context, dir string, i uint64) erro
...
@@ -124,10 +124,7 @@ func (e *Executor) GenerateProof(ctx context.Context, dir string, i uint64) erro
e
.
logger
.
Info
(
"Generating trace"
,
"proof"
,
i
,
"cmd"
,
e
.
cannon
,
"args"
,
strings
.
Join
(
args
,
", "
))
e
.
logger
.
Info
(
"Generating trace"
,
"proof"
,
i
,
"cmd"
,
e
.
cannon
,
"args"
,
strings
.
Join
(
args
,
", "
))
execStart
:=
time
.
Now
()
execStart
:=
time
.
Now
()
err
=
e
.
cmdExecutor
(
ctx
,
e
.
logger
.
New
(
"proof"
,
i
),
e
.
cannon
,
args
...
)
err
=
e
.
cmdExecutor
(
ctx
,
e
.
logger
.
New
(
"proof"
,
i
),
e
.
cannon
,
args
...
)
if
err
!=
nil
{
e
.
metrics
.
RecordCannonExecutionTime
(
time
.
Since
(
execStart
)
.
Seconds
())
execDuration
:=
time
.
Since
(
execStart
)
.
Seconds
()
e
.
metrics
.
RecordCannonExecutionTime
(
execDuration
)
}
return
err
return
err
}
}
...
...
op-challenger/game/fault/trace/cannon/executor_test.go
View file @
980064ab
...
@@ -40,7 +40,8 @@ func TestGenerateProof(t *testing.T) {
...
@@ -40,7 +40,8 @@ func TestGenerateProof(t *testing.T) {
L2BlockNumber
:
big
.
NewInt
(
3333
),
L2BlockNumber
:
big
.
NewInt
(
3333
),
}
}
captureExec
:=
func
(
t
*
testing
.
T
,
cfg
config
.
Config
,
proofAt
uint64
)
(
string
,
string
,
map
[
string
]
string
)
{
captureExec
:=
func
(
t
*
testing
.
T
,
cfg
config
.
Config
,
proofAt
uint64
)
(
string
,
string
,
map
[
string
]
string
)
{
executor
:=
NewExecutor
(
testlog
.
Logger
(
t
,
log
.
LvlInfo
),
metrics
.
NoopMetrics
,
&
cfg
,
inputs
)
m
:=
&
cannonDurationMetrics
{}
executor
:=
NewExecutor
(
testlog
.
Logger
(
t
,
log
.
LvlInfo
),
m
,
&
cfg
,
inputs
)
executor
.
selectSnapshot
=
func
(
logger
log
.
Logger
,
dir
string
,
absolutePreState
string
,
i
uint64
)
(
string
,
error
)
{
executor
.
selectSnapshot
=
func
(
logger
log
.
Logger
,
dir
string
,
absolutePreState
string
,
i
uint64
)
(
string
,
error
)
{
return
input
,
nil
return
input
,
nil
}
}
...
@@ -63,6 +64,7 @@ func TestGenerateProof(t *testing.T) {
...
@@ -63,6 +64,7 @@ func TestGenerateProof(t *testing.T) {
}
}
err
:=
executor
.
GenerateProof
(
context
.
Background
(),
dir
,
proofAt
)
err
:=
executor
.
GenerateProof
(
context
.
Background
(),
dir
,
proofAt
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
1
,
m
.
executionTimeRecordCount
,
"Should record cannon execution time"
)
return
binary
,
subcommand
,
args
return
binary
,
subcommand
,
args
}
}
...
@@ -211,3 +213,12 @@ func TestFindStartingSnapshot(t *testing.T) {
...
@@ -211,3 +213,12 @@ func TestFindStartingSnapshot(t *testing.T) {
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
"100.json.gz"
),
snapshot
)
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
"100.json.gz"
),
snapshot
)
})
})
}
}
type
cannonDurationMetrics
struct
{
metrics
.
NoopMetricsImpl
executionTimeRecordCount
int
}
func
(
c
*
cannonDurationMetrics
)
RecordCannonExecutionTime
(
_
float64
)
{
c
.
executionTimeRecordCount
++
}
op-challenger/metrics/noop.go
View file @
980064ab
...
@@ -4,21 +4,21 @@ import (
...
@@ -4,21 +4,21 @@ import (
txmetrics
"github.com/ethereum-optimism/optimism/op-service/txmgr/metrics"
txmetrics
"github.com/ethereum-optimism/optimism/op-service/txmgr/metrics"
)
)
type
noopMetrics
struct
{
type
NoopMetricsImpl
struct
{
txmetrics
.
NoopTxMetrics
txmetrics
.
NoopTxMetrics
}
}
var
NoopMetrics
Metricer
=
new
(
noopMetrics
)
var
NoopMetrics
Metricer
=
new
(
NoopMetricsImpl
)
func
(
*
noopMetrics
)
RecordInfo
(
version
string
)
{}
func
(
*
NoopMetricsImpl
)
RecordInfo
(
version
string
)
{}
func
(
*
noopMetrics
)
RecordUp
()
{}
func
(
*
NoopMetricsImpl
)
RecordUp
()
{}
func
(
*
noopMetrics
)
RecordGameMove
()
{}
func
(
*
NoopMetricsImpl
)
RecordGameMove
()
{}
func
(
*
noopMetrics
)
RecordGameStep
()
{}
func
(
*
NoopMetricsImpl
)
RecordGameStep
()
{}
func
(
*
noopMetrics
)
RecordCannonExecutionTime
(
t
float64
)
{}
func
(
*
NoopMetricsImpl
)
RecordCannonExecutionTime
(
t
float64
)
{}
func
(
*
noopMetrics
)
RecordGamesStatus
(
inProgress
,
defenderWon
,
challengerWon
int
)
{}
func
(
*
NoopMetricsImpl
)
RecordGamesStatus
(
inProgress
,
defenderWon
,
challengerWon
int
)
{}
func
(
*
noopMetrics
)
RecordGameUpdateScheduled
()
{}
func
(
*
NoopMetricsImpl
)
RecordGameUpdateScheduled
()
{}
func
(
*
noopMetrics
)
RecordGameUpdateCompleted
()
{}
func
(
*
NoopMetricsImpl
)
RecordGameUpdateCompleted
()
{}
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