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
9de9ae67
Unverified
Commit
9de9ae67
authored
Aug 10, 2023
by
mergify[bot]
Committed by
GitHub
Aug 10, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into aj/cannon-e2e-moves
parents
9b559a74
a14e19a4
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
1221 additions
and
350 deletions
+1221
-350
agent.go
op-challenger/fault/agent.go
+1
-1
updater.go
op-challenger/fault/alphabet/updater.go
+1
-1
updater_test.go
op-challenger/fault/alphabet/updater_test.go
+1
-1
provider.go
op-challenger/fault/cannon/provider.go
+1
-2
provider_test.go
op-challenger/fault/cannon/provider_test.go
+1
-1
updater.go
op-challenger/fault/cannon/updater.go
+8
-5
updater_test.go
op-challenger/fault/cannon/updater_test.go
+12
-4
types.go
op-challenger/fault/types/types.go
+1
-1
package.json
packages/contracts-bedrock/package.json
+1
-1
package.json
packages/sdk/package.json
+6
-6
pnpm-lock.yaml
pnpm-lock.yaml
+1188
-327
No files found.
op-challenger/fault/agent.go
View file @
9de9ae67
...
...
@@ -141,7 +141,7 @@ func (a *Agent) step(ctx context.Context, claim types.Claim, game types.Game) er
}
a
.
log
.
Info
(
"Updating oracle data"
,
"oracleKey"
,
oracleData
.
OracleKey
,
"oracleData"
,
oracleData
.
OracleData
)
if
err
:=
a
.
updater
.
UpdateOracle
(
ctx
,
*
oracleData
);
err
!=
nil
{
if
err
:=
a
.
updater
.
UpdateOracle
(
ctx
,
oracleData
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to load oracle data: %w"
,
err
)
}
...
...
op-challenger/fault/alphabet/updater.go
View file @
9de9ae67
...
...
@@ -21,7 +21,7 @@ func NewOracleUpdater(logger log.Logger) *alphabetUpdater {
}
// UpdateOracle updates the oracle with the given data.
func
(
u
*
alphabetUpdater
)
UpdateOracle
(
ctx
context
.
Context
,
data
types
.
PreimageOracleData
)
error
{
func
(
u
*
alphabetUpdater
)
UpdateOracle
(
ctx
context
.
Context
,
data
*
types
.
PreimageOracleData
)
error
{
u
.
logger
.
Info
(
"alphabet oracle updater called"
)
return
nil
}
op-challenger/fault/alphabet/updater_test.go
View file @
9de9ae67
...
...
@@ -15,5 +15,5 @@ import (
func
TestAlphabetUpdater
(
t
*
testing
.
T
)
{
logger
:=
testlog
.
Logger
(
t
,
log
.
LvlInfo
)
updater
:=
NewOracleUpdater
(
logger
)
require
.
Nil
(
t
,
updater
.
UpdateOracle
(
context
.
Background
(),
types
.
PreimageOracleData
{}))
require
.
Nil
(
t
,
updater
.
UpdateOracle
(
context
.
Background
(),
&
types
.
PreimageOracleData
{}))
}
op-challenger/fault/cannon/provider.go
View file @
9de9ae67
...
...
@@ -114,8 +114,7 @@ func (p *CannonTraceProvider) GetPreimage(ctx context.Context, i uint64) ([]byte
}
func
(
p
*
CannonTraceProvider
)
AbsolutePreState
(
ctx
context
.
Context
)
([]
byte
,
error
)
{
path
:=
filepath
.
Join
(
p
.
dir
,
p
.
prestate
)
state
,
err
:=
parseState
(
path
)
state
,
err
:=
parseState
(
p
.
prestate
)
if
err
!=
nil
{
return
[]
byte
{},
fmt
.
Errorf
(
"cannot load absolute pre-state: %w"
,
err
)
}
...
...
op-challenger/fault/cannon/provider_test.go
View file @
9de9ae67
...
...
@@ -240,7 +240,7 @@ func setupWithTestData(t *testing.T, dataDir string, prestate string) (*CannonTr
logger
:
testlog
.
Logger
(
t
,
log
.
LvlInfo
),
dir
:
dataDir
,
generator
:
generator
,
prestate
:
prestate
,
prestate
:
filepath
.
Join
(
dataDir
,
prestate
)
,
},
generator
}
...
...
op-challenger/fault/cannon/updater.go
View file @
9de9ae67
...
...
@@ -86,7 +86,10 @@ func NewOracleUpdaterWithOracle(
}
// UpdateOracle updates the oracle with the given data.
func
(
u
*
cannonUpdater
)
UpdateOracle
(
ctx
context
.
Context
,
data
types
.
PreimageOracleData
)
error
{
func
(
u
*
cannonUpdater
)
UpdateOracle
(
ctx
context
.
Context
,
data
*
types
.
PreimageOracleData
)
error
{
if
len
(
data
.
OracleKey
)
==
0
{
return
nil
}
if
data
.
IsLocal
{
return
u
.
sendLocalOracleData
(
ctx
,
data
)
}
...
...
@@ -94,7 +97,7 @@ func (u *cannonUpdater) UpdateOracle(ctx context.Context, data types.PreimageOra
}
// sendLocalOracleData sends the local oracle data to the [txmgr].
func
(
u
*
cannonUpdater
)
sendLocalOracleData
(
ctx
context
.
Context
,
data
types
.
PreimageOracleData
)
error
{
func
(
u
*
cannonUpdater
)
sendLocalOracleData
(
ctx
context
.
Context
,
data
*
types
.
PreimageOracleData
)
error
{
txData
,
err
:=
u
.
BuildLocalOracleData
(
data
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"local oracle tx data build: %w"
,
err
)
...
...
@@ -103,7 +106,7 @@ func (u *cannonUpdater) sendLocalOracleData(ctx context.Context, data types.Prei
}
// sendGlobalOracleData sends the global oracle data to the [txmgr].
func
(
u
*
cannonUpdater
)
sendGlobalOracleData
(
ctx
context
.
Context
,
data
types
.
PreimageOracleData
)
error
{
func
(
u
*
cannonUpdater
)
sendGlobalOracleData
(
ctx
context
.
Context
,
data
*
types
.
PreimageOracleData
)
error
{
txData
,
err
:=
u
.
BuildGlobalOracleData
(
data
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"global oracle tx data build: %w"
,
err
)
...
...
@@ -114,7 +117,7 @@ func (u *cannonUpdater) sendGlobalOracleData(ctx context.Context, data types.Pre
// BuildLocalOracleData takes the local preimage key and data
// and creates tx data to load the key, data pair into the
// PreimageOracle contract from the FaultDisputeGame contract call.
func
(
u
*
cannonUpdater
)
BuildLocalOracleData
(
data
types
.
PreimageOracleData
)
([]
byte
,
error
)
{
func
(
u
*
cannonUpdater
)
BuildLocalOracleData
(
data
*
types
.
PreimageOracleData
)
([]
byte
,
error
)
{
return
u
.
fdgAbi
.
Pack
(
"addLocalData"
,
data
.
GetIdent
(),
...
...
@@ -125,7 +128,7 @@ func (u *cannonUpdater) BuildLocalOracleData(data types.PreimageOracleData) ([]b
// BuildGlobalOracleData takes the global preimage key and data
// and creates tx data to load the key, data pair into the
// PreimageOracle contract.
func
(
u
*
cannonUpdater
)
BuildGlobalOracleData
(
data
types
.
PreimageOracleData
)
([]
byte
,
error
)
{
func
(
u
*
cannonUpdater
)
BuildGlobalOracleData
(
data
*
types
.
PreimageOracleData
)
([]
byte
,
error
)
{
return
u
.
preimageOracleAbi
.
Pack
(
"loadKeccak256PreimagePart"
,
big
.
NewInt
(
int64
(
data
.
OracleOffset
)),
...
...
op-challenger/fault/cannon/updater_test.go
View file @
9de9ae67
...
...
@@ -74,7 +74,8 @@ func newTestCannonUpdater(t *testing.T, sendFails bool) (*cannonUpdater, *mockTx
func
TestCannonUpdater_UpdateOracle
(
t
*
testing
.
T
)
{
t
.
Run
(
"succeeds"
,
func
(
t
*
testing
.
T
)
{
updater
,
mockTxMgr
:=
newTestCannonUpdater
(
t
,
false
)
require
.
Nil
(
t
,
updater
.
UpdateOracle
(
context
.
Background
(),
types
.
PreimageOracleData
{
require
.
NoError
(
t
,
updater
.
UpdateOracle
(
context
.
Background
(),
&
types
.
PreimageOracleData
{
OracleKey
:
common
.
Hash
{
0xaa
}
.
Bytes
(),
OracleData
:
common
.
Hex2Bytes
(
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
),
}))
require
.
Equal
(
t
,
1
,
mockTxMgr
.
sends
)
...
...
@@ -82,18 +83,25 @@ func TestCannonUpdater_UpdateOracle(t *testing.T) {
t
.
Run
(
"send fails"
,
func
(
t
*
testing
.
T
)
{
updater
,
mockTxMgr
:=
newTestCannonUpdater
(
t
,
true
)
require
.
Error
(
t
,
updater
.
UpdateOracle
(
context
.
Background
(),
types
.
PreimageOracleData
{
require
.
Error
(
t
,
updater
.
UpdateOracle
(
context
.
Background
(),
&
types
.
PreimageOracleData
{
OracleKey
:
common
.
Hash
{
0xaa
}
.
Bytes
(),
OracleData
:
common
.
Hex2Bytes
(
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
),
}))
require
.
Equal
(
t
,
1
,
mockTxMgr
.
failedSends
)
})
t
.
Run
(
"skip empty data"
,
func
(
t
*
testing
.
T
)
{
updater
,
mockTxMgr
:=
newTestCannonUpdater
(
t
,
true
)
require
.
NoError
(
t
,
updater
.
UpdateOracle
(
context
.
Background
(),
&
types
.
PreimageOracleData
{}))
require
.
Equal
(
t
,
0
,
mockTxMgr
.
sends
)
})
}
// TestCannonUpdater_BuildLocalOracleData tests the [cannonUpdater]
// builds a valid tx candidate for a local oracle update.
func
TestCannonUpdater_BuildLocalOracleData
(
t
*
testing
.
T
)
{
updater
,
_
:=
newTestCannonUpdater
(
t
,
false
)
oracleData
:=
types
.
PreimageOracleData
{
oracleData
:=
&
types
.
PreimageOracleData
{
OracleKey
:
common
.
Hex2Bytes
(
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
),
OracleData
:
common
.
Hex2Bytes
(
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
),
OracleOffset
:
7
,
...
...
@@ -117,7 +125,7 @@ func TestCannonUpdater_BuildLocalOracleData(t *testing.T) {
// builds a valid tx candidate for a global oracle update.
func
TestCannonUpdater_BuildGlobalOracleData
(
t
*
testing
.
T
)
{
updater
,
_
:=
newTestCannonUpdater
(
t
,
false
)
oracleData
:=
types
.
PreimageOracleData
{
oracleData
:=
&
types
.
PreimageOracleData
{
OracleKey
:
common
.
Hex2Bytes
(
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
),
OracleData
:
common
.
Hex2Bytes
(
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
),
OracleOffset
:
7
,
...
...
op-challenger/fault/types/types.go
View file @
9de9ae67
...
...
@@ -65,7 +65,7 @@ type StepCallData struct {
// OracleUpdater is a generic interface for updating oracles.
type
OracleUpdater
interface
{
// UpdateOracle updates the oracle with the given data.
UpdateOracle
(
ctx
context
.
Context
,
data
PreimageOracleData
)
error
UpdateOracle
(
ctx
context
.
Context
,
data
*
PreimageOracleData
)
error
}
// TraceProvider is a generic way to get a claim value at a specific step in the trace.
...
...
packages/contracts-bedrock/package.json
View file @
9de9ae67
...
...
@@ -10,7 +10,7 @@
],
"scripts"
:
{
"bindings"
:
"pnpm bindings:ts && pnpm bindings:go"
,
"bindings:ts"
:
"
pnpm generate:addresses &&
nx generate @eth-optimism/contracts-ts"
,
"bindings:ts"
:
"nx generate @eth-optimism/contracts-ts"
,
"bindings:go"
:
"cd ../../op-bindings && make"
,
"build"
:
"forge build"
,
"prebuild"
:
"./scripts/verify-foundry-install.sh"
,
...
...
packages/sdk/package.json
View file @
9de9ae67
...
...
@@ -42,22 +42,22 @@
"@nomiclabs/hardhat-ethers"
:
"^2.0.2"
,
"@nomiclabs/hardhat-waffle"
:
"^2.0.1"
,
"chai-as-promised"
:
"^7.1.1"
,
"ethereum-waffle"
:
"^
3.4.
0"
,
"ethereum-waffle"
:
"^
4.0.1
0"
,
"ethers"
:
"^5.7.0"
,
"hardhat"
:
"^2.9.6"
,
"hardhat-deploy"
:
"^0.11.4"
,
"isomorphic-fetch"
:
"^3.0.0"
,
"mocha"
:
"^10.0.0"
,
"nyc"
:
"^15.1.0"
,
"typedoc"
:
"^0.22.13"
,
"mocha"
:
"^10.0.0"
,
"vitest"
:
"^0.28.3"
,
"zod"
:
"^3.11.6"
,
"viem"
:
"^0.3.30"
,
"isomorphic-fetch"
:
"^3.0.0"
"vitest"
:
"^0.28.3"
,
"zod"
:
"^3.11.6"
},
"dependencies"
:
{
"@eth-optimism/contracts"
:
"0.6.0"
,
"@eth-optimism/core-utils"
:
"0.12.2"
,
"@eth-optimism/contracts-bedrock"
:
"0.16.0"
,
"@eth-optimism/core-utils"
:
"0.12.2"
,
"lodash"
:
"^4.17.21"
,
"merkletreejs"
:
"^0.2.27"
,
"rlp"
:
"^2.2.7"
...
...
pnpm-lock.yaml
View file @
9de9ae67
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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