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
b92dc8ff
Unverified
Commit
b92dc8ff
authored
Jun 07, 2024
by
Adrian Sutton
Committed by
GitHub
Jun 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
challenger: Include game resolution time in list-claims output. (#10756)
parent
7ee8cc86
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
4 deletions
+38
-4
list_claims.go
op-challenger/cmd/list_claims.go
+17
-4
faultdisputegame.go
op-challenger/game/fault/contracts/faultdisputegame.go
+12
-0
faultdisputegame_test.go
op-challenger/game/fault/contracts/faultdisputegame_test.go
+9
-0
No files found.
op-challenger/cmd/list_claims.go
View file @
b92dc8ff
...
...
@@ -11,6 +11,7 @@ import (
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/contracts"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/contracts/metrics"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/types"
gameTypes
"github.com/ethereum-optimism/optimism/op-challenger/game/types"
opservice
"github.com/ethereum-optimism/optimism/op-service"
"github.com/ethereum-optimism/optimism/op-service/dial"
"github.com/ethereum-optimism/optimism/op-service/eth"
...
...
@@ -91,6 +92,14 @@ func listClaims(ctx context.Context, game contracts.FaultDisputeGameContract, ve
return
fmt
.
Errorf
(
"failed to retrieve claims: %w"
,
err
)
}
var
resolutionTime
time
.
Time
if
status
!=
gameTypes
.
GameStatusInProgress
{
resolutionTime
,
err
=
game
.
GetResolvedAt
(
ctx
,
rpcblock
.
Latest
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to retrieve resolved at: %w"
,
err
)
}
}
// The top game runs from depth 0 to split depth *inclusive*.
// The - 1 here accounts for the fact that the split depth is included in the top game.
bottomDepth
:=
maxDepth
-
splitDepth
-
1
...
...
@@ -162,12 +171,16 @@ func listClaims(ctx context.Context, game contracts.FaultDisputeGameContract, ve
info
=
info
+
fmt
.
Sprintf
(
lineFormat
,
i
,
move
,
parent
,
pos
.
Depth
(),
traceIdx
,
value
,
claim
.
Claimant
,
bond
,
timestamp
,
elapsed
,
countered
)
}
blockNumChallenger
:=
"
L2 Block:
Unchallenged"
blockNumChallenger
:=
"Unchallenged"
if
metadata
.
L2BlockNumberChallenged
{
blockNumChallenger
=
"L2 Block: ❌ "
+
metadata
.
L2BlockNumberChallenger
.
Hex
()
blockNumChallenger
=
"❌ "
+
metadata
.
L2BlockNumberChallenger
.
Hex
()
}
statusStr
:=
status
.
String
()
if
status
!=
gameTypes
.
GameStatusInProgress
{
statusStr
=
fmt
.
Sprintf
(
"%v • Resolution Time: %v"
,
statusStr
,
resolutionTime
.
Format
(
time
.
DateTime
))
}
fmt
.
Printf
(
"Status: %v • L2 Blocks: %v to %v
• Split Depth: %v • Max Depth: %v •
%v • Claim Count: %v
\n
%v
\n
"
,
status
,
l2StartBlockNum
,
l2BlockNum
,
splitDepth
,
maxDepth
,
blockNumChallenger
,
len
(
claims
),
info
)
fmt
.
Printf
(
"Status: %v • L2 Blocks: %v to %v
(%v) • Split Depth: %v • Max Depth:
%v • Claim Count: %v
\n
%v
\n
"
,
status
Str
,
l2StartBlockNum
,
l2BlockNum
,
blockNumChallenger
,
splitDepth
,
maxDepth
,
len
(
claims
),
info
)
return
nil
}
...
...
op-challenger/game/fault/contracts/faultdisputegame.go
View file @
b92dc8ff
...
...
@@ -35,6 +35,7 @@ var (
methodClaimCount
=
"claimDataLen"
methodClaim
=
"claimData"
methodL1Head
=
"l1Head"
methodResolvedAt
=
"resolvedAt"
methodResolvedSubgames
=
"resolvedSubgames"
methodResolve
=
"resolve"
methodResolveClaim
=
"resolveClaim"
...
...
@@ -221,6 +222,16 @@ func (f *FaultDisputeGameContractLatest) GetGameMetadata(ctx context.Context, bl
},
nil
}
func
(
f
*
FaultDisputeGameContractLatest
)
GetResolvedAt
(
ctx
context
.
Context
,
block
rpcblock
.
Block
)
(
time
.
Time
,
error
)
{
defer
f
.
metrics
.
StartContractRequest
(
"GetResolvedAt"
)()
result
,
err
:=
f
.
multiCaller
.
SingleCall
(
ctx
,
block
,
f
.
contract
.
Call
(
methodResolvedAt
))
if
err
!=
nil
{
return
time
.
Time
{},
fmt
.
Errorf
(
"failed to retrieve resolution time: %w"
,
err
)
}
resolvedAt
:=
time
.
Unix
(
int64
(
result
.
GetUint64
(
0
)),
0
)
return
resolvedAt
,
nil
}
func
(
f
*
FaultDisputeGameContractLatest
)
GetStartingRootHash
(
ctx
context
.
Context
)
(
common
.
Hash
,
error
)
{
defer
f
.
metrics
.
StartContractRequest
(
"GetStartingRootHash"
)()
startingRootHash
,
err
:=
f
.
multiCaller
.
SingleCall
(
ctx
,
rpcblock
.
Latest
,
f
.
contract
.
Call
(
methodStartingRootHash
))
...
...
@@ -595,6 +606,7 @@ type FaultDisputeGameContract interface {
GetBalanceAndDelay
(
ctx
context
.
Context
,
block
rpcblock
.
Block
)
(
*
big
.
Int
,
time
.
Duration
,
common
.
Address
,
error
)
GetBlockRange
(
ctx
context
.
Context
)
(
prestateBlock
uint64
,
poststateBlock
uint64
,
retErr
error
)
GetGameMetadata
(
ctx
context
.
Context
,
block
rpcblock
.
Block
)
(
GameMetadata
,
error
)
GetResolvedAt
(
ctx
context
.
Context
,
block
rpcblock
.
Block
)
(
time
.
Time
,
error
)
GetStartingRootHash
(
ctx
context
.
Context
)
(
common
.
Hash
,
error
)
GetSplitDepth
(
ctx
context
.
Context
)
(
types
.
Depth
,
error
)
GetCredit
(
ctx
context
.
Context
,
recipient
common
.
Address
)
(
*
big
.
Int
,
gameTypes
.
GameStatus
,
error
)
...
...
op-challenger/game/fault/contracts/faultdisputegame_test.go
View file @
b92dc8ff
...
...
@@ -158,6 +158,15 @@ func TestSimpleGetters(t *testing.T) {
return
game
.
CallResolve
(
context
.
Background
())
},
},
{
methodAlias
:
"resolvedAt"
,
method
:
methodResolvedAt
,
result
:
uint64
(
240402
),
expected
:
time
.
Unix
(
240402
,
0
),
call
:
func
(
game
FaultDisputeGameContract
)
(
any
,
error
)
{
return
game
.
GetResolvedAt
(
context
.
Background
(),
rpcblock
.
Latest
)
},
},
}
for
_
,
version
:=
range
versions
{
version
:=
version
...
...
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