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
1e956691
Commit
1e956691
authored
Sep 29, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update with position type in trace provider
parent
5d0c3b3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
provider.go
op-challenger/game/fault/trace/split/provider.go
+3
-5
provider_test.go
op-challenger/game/fault/trace/split/provider_test.go
+5
-5
No files found.
op-challenger/game/fault/trace/split/provider.go
View file @
1e956691
...
...
@@ -15,8 +15,7 @@ var (
NoProvidersErr
=
fmt
.
Errorf
(
"no trace providers configured"
)
)
// todo(refcell): the Get method traceIndex is update to be a Position so we have the depth
// var _ types.TraceProvider = (*SplitTraceProvider)(nil)
var
_
types
.
TraceProvider
=
(
*
SplitTraceProvider
)(
nil
)
// SplitTraceProvider is a [types.TraceProvider] implementation that
// routes requests to the correct internal trace provider based on the
...
...
@@ -56,8 +55,7 @@ func (s *SplitTraceProvider) Get(ctx context.Context, pos types.Position) (commo
}
reduced
,
provider
:=
s
.
providerForDepth
(
uint64
(
pos
.
Depth
()))
localizedPosition
:=
pos
.
Localize
(
reduced
)
// todo(refcell): we should just pass the localized position once `Get` is updated to accept a Position
return
provider
.
Get
(
ctx
,
localizedPosition
.
ToGIndex
())
return
provider
.
Get
(
ctx
,
localizedPosition
)
}
// AbsolutePreStateCommitment returns the absolute prestate from the lowest internal [types.TraceProvider]
...
...
@@ -77,7 +75,7 @@ func (s *SplitTraceProvider) AbsolutePreState(ctx context.Context) (preimage []b
}
// GetStepData routes the GetStepData request to the lowest internal [types.TraceProvider].
func
(
s
*
SplitTraceProvider
)
GetStepData
(
ctx
context
.
Context
,
i
uint64
)
(
prestate
[]
byte
,
proofData
[]
byte
,
preimageData
*
types
.
PreimageOracleData
,
err
error
)
{
func
(
s
*
SplitTraceProvider
)
GetStepData
(
ctx
context
.
Context
,
i
types
.
Position
)
(
prestate
[]
byte
,
proofData
[]
byte
,
preimageData
*
types
.
PreimageOracleData
,
err
error
)
{
if
len
(
s
.
providers
)
==
0
{
return
nil
,
nil
,
nil
,
NoProvidersErr
}
...
...
op-challenger/game/fault/trace/split/provider_test.go
View file @
1e956691
...
...
@@ -6,7 +6,7 @@ import (
"testing"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/types"
"github.com/ethereum-optimism/optimism/op-
nod
e/testlog"
"github.com/ethereum-optimism/optimism/op-
servic
e/testlog"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
...
...
@@ -105,7 +105,7 @@ func TestGetStepData(t *testing.T) {
providers
:
[]
types
.
TraceProvider
{
&
mockOutputProvider
},
depthTiers
:
[]
uint64
{
40
},
}
_
,
_
,
_
,
err
:=
splitProvider
.
GetStepData
(
context
.
Background
(),
0
)
_
,
_
,
_
,
err
:=
splitProvider
.
GetStepData
(
context
.
Background
(),
types
.
NewPosition
(
0
,
0
)
)
require
.
ErrorIs
(
t
,
err
,
mockGetError
)
})
}
...
...
@@ -119,11 +119,11 @@ type mockTraceProvider struct {
getStepDataError
error
}
func
(
m
*
mockTraceProvider
)
Get
(
ctx
context
.
Context
,
i
uint64
)
(
common
.
Hash
,
error
)
{
func
(
m
*
mockTraceProvider
)
Get
(
ctx
context
.
Context
,
pos
types
.
Position
)
(
common
.
Hash
,
error
)
{
if
m
.
getError
!=
nil
{
return
common
.
Hash
{},
m
.
getError
}
return
common
.
BytesToHash
([]
byte
{
byte
(
i
)}),
nil
return
common
.
BytesToHash
([]
byte
{
byte
(
pos
.
ToGIndex
()
)}),
nil
}
func
(
m
*
mockTraceProvider
)
AbsolutePreStateCommitment
(
ctx
context
.
Context
)
(
hash
common
.
Hash
,
err
error
)
{
...
...
@@ -140,7 +140,7 @@ func (m *mockTraceProvider) AbsolutePreState(ctx context.Context) (preimage []by
return
[]
byte
{},
nil
}
func
(
m
*
mockTraceProvider
)
GetStepData
(
ctx
context
.
Context
,
i
uint64
)
([]
byte
,
[]
byte
,
*
types
.
PreimageOracleData
,
error
)
{
func
(
m
*
mockTraceProvider
)
GetStepData
(
ctx
context
.
Context
,
pos
types
.
Position
)
([]
byte
,
[]
byte
,
*
types
.
PreimageOracleData
,
error
)
{
if
m
.
getStepDataError
!=
nil
{
return
nil
,
nil
,
nil
,
m
.
getStepDataError
}
...
...
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