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
92e86c9d
Commit
92e86c9d
authored
Dec 08, 2023
by
refcell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(op-challenger): load local context in the alphabet trace provider
get step data method.
parent
73ef726b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
provider.go
op-challenger/game/fault/trace/alphabet/provider.go
+9
-1
provider_test.go
op-challenger/game/fault/trace/alphabet/provider_test.go
+7
-1
No files found.
op-challenger/game/fault/trace/alphabet/provider.go
View file @
92e86c9d
...
@@ -7,8 +7,11 @@ import (
...
@@ -7,8 +7,11 @@ import (
"math/big"
"math/big"
"strings"
"strings"
preimage
"github.com/ethereum-optimism/optimism/op-preimage"
"github.com/ethereum-optimism/optimism/cannon/mipsevm"
"github.com/ethereum-optimism/optimism/cannon/mipsevm"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/types"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
)
)
...
@@ -50,7 +53,12 @@ func (ap *AlphabetTraceProvider) GetStepData(ctx context.Context, i types.Positi
...
@@ -50,7 +53,12 @@ func (ap *AlphabetTraceProvider) GetStepData(ctx context.Context, i types.Positi
if
traceIndex
.
Cmp
(
big
.
NewInt
(
int64
(
len
(
ap
.
state
))))
>=
0
{
if
traceIndex
.
Cmp
(
big
.
NewInt
(
int64
(
len
(
ap
.
state
))))
>=
0
{
return
ap
.
GetStepData
(
ctx
,
types
.
NewPosition
(
int
(
ap
.
depth
),
big
.
NewInt
(
int64
(
len
(
ap
.
state
)))))
return
ap
.
GetStepData
(
ctx
,
types
.
NewPosition
(
int
(
ap
.
depth
),
big
.
NewInt
(
int64
(
len
(
ap
.
state
)))))
}
}
return
BuildAlphabetPreimage
(
traceIndex
,
ap
.
state
[
traceIndex
.
Uint64
()]),
[]
byte
{},
nil
,
nil
key
:=
preimage
.
LocalIndexKey
(
4
)
.
PreimageKey
()
// For alphabet output bisection, the state is the local context - that is, the
// pre-state l2 block number. So we can just use [ap.state] as the localContext.
localContext
:=
common
.
HexToHash
(
strings
.
Join
(
ap
.
state
,
""
))
localContextData
:=
types
.
NewPreimageOracleData
(
localContext
,
key
[
:
],
nil
,
0
)
return
BuildAlphabetPreimage
(
traceIndex
,
ap
.
state
[
traceIndex
.
Uint64
()]),
[]
byte
{},
localContextData
,
nil
}
}
// Get returns the claim value at the given index in the trace.
// Get returns the claim value at the given index in the trace.
...
...
op-challenger/game/fault/trace/alphabet/provider_test.go
View file @
92e86c9d
...
@@ -5,7 +5,10 @@ import (
...
@@ -5,7 +5,10 @@ import (
"math/big"
"math/big"
"testing"
"testing"
preimage
"github.com/ethereum-optimism/optimism/op-preimage"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/types"
"github.com/ethereum-optimism/optimism/op-challenger/game/fault/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
)
)
...
@@ -58,7 +61,10 @@ func TestGetStepData_Succeeds(t *testing.T) {
...
@@ -58,7 +61,10 @@ func TestGetStepData_Succeeds(t *testing.T) {
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
expected
,
retrieved
)
require
.
Equal
(
t
,
expected
,
retrieved
)
require
.
Empty
(
t
,
proof
)
require
.
Empty
(
t
,
proof
)
require
.
Nil
(
t
,
data
)
localContext
:=
common
.
HexToHash
(
"abc"
)
key
:=
preimage
.
LocalIndexKey
(
4
)
.
PreimageKey
()
expectedLocalContextData
:=
types
.
NewPreimageOracleData
(
localContext
,
key
[
:
],
nil
,
0
)
require
.
Equal
(
t
,
expectedLocalContextData
,
data
)
}
}
// TestGetPreimage_TooLargeIndex_Fails tests the GetPreimage
// TestGetPreimage_TooLargeIndex_Fails tests the GetPreimage
...
...
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