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
200a2557
Unverified
Commit
200a2557
authored
Aug 21, 2023
by
mergify[bot]
Committed by
GitHub
Aug 21, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 08-17-feat_indexer_Run_the_migrations_in_the_docker-compose_file
parents
656eda80
4570f8cb
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
129 additions
and
81 deletions
+129
-81
go.mod
go.mod
+1
-1
go.sum
go.sum
+2
-2
config.go
op-challenger/config/config.go
+8
-16
executor.go
op-challenger/fault/cannon/executor.go
+1
-3
executor_test.go
op-challenger/fault/cannon/executor_test.go
+11
-9
provider.go
op-challenger/fault/cannon/provider.go
+4
-3
provider_test.go
op-challenger/fault/cannon/provider_test.go
+16
-1
init_game.sh
op-challenger/scripts/alphabet/init_game.sh
+2
-2
helper.go
op-e2e/e2eutils/disputegame/helper.go
+3
-3
waits.go
op-e2e/e2eutils/wait/waits.go
+2
-1
faultproof_test.go
op-e2e/faultproof_test.go
+0
-1
host.go
op-node/p2p/host.go
+0
-3
Deploy.s.sol
packages/contracts-bedrock/scripts/Deploy.s.sol
+79
-36
No files found.
go.mod
View file @
200a2557
...
@@ -43,7 +43,7 @@ require (
...
@@ -43,7 +43,7 @@ require (
golang.org/x/term v0.11.0
golang.org/x/term v0.11.0
golang.org/x/time v0.3.0
golang.org/x/time v0.3.0
gorm.io/driver/postgres v1.5.2
gorm.io/driver/postgres v1.5.2
gorm.io/gorm v1.25.
3
gorm.io/gorm v1.25.
4
)
)
require (
require (
...
...
go.sum
View file @
200a2557
...
@@ -1136,8 +1136,8 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
...
@@ -1136,8 +1136,8 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/postgres v1.5.2 h1:ytTDxxEv+MplXOfFe3Lzm7SjG09fcdb3Z/c056DTBx0=
gorm.io/driver/postgres v1.5.2 h1:ytTDxxEv+MplXOfFe3Lzm7SjG09fcdb3Z/c056DTBx0=
gorm.io/driver/postgres v1.5.2/go.mod h1:fmpX0m2I1PKuR7mKZiEluwrP3hbs+ps7JIGMUBpCgl8=
gorm.io/driver/postgres v1.5.2/go.mod h1:fmpX0m2I1PKuR7mKZiEluwrP3hbs+ps7JIGMUBpCgl8=
gorm.io/gorm v1.25.
3 h1:zi4rHZj1anhZS2EuEODMhDisGy+Daq9jtPrNGgbQYD8
=
gorm.io/gorm v1.25.
4 h1:iyNd8fNAe8W9dvtlgeRI5zSVZPsq3OpcTu37cYcpCmw
=
gorm.io/gorm v1.25.
3
/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/gorm v1.25.
4
/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o=
grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
...
...
op-challenger/config/config.go
View file @
200a2557
...
@@ -35,27 +35,19 @@ const (
...
@@ -35,27 +35,19 @@ const (
TraceTypeAlphabet
TraceType
=
"alphabet"
TraceTypeAlphabet
TraceType
=
"alphabet"
TraceTypeCannon
TraceType
=
"cannon"
TraceTypeCannon
TraceType
=
"cannon"
// Devnet game IDs
// Mainnet games
DevnetGameIDAlphabet
=
uint8
(
0
)
CannonFaultGameID
=
0
DevnetGameIDCannon
=
uint8
(
1
)
//
Mainnet game ID
s
//
Devnet game
s
MainnetGameIDFault
=
uint8
(
0
)
AlphabetFaultGameID
=
255
)
)
var
TraceTypes
=
[]
TraceType
{
TraceTypeAlphabet
,
TraceTypeCannon
}
var
TraceTypes
=
[]
TraceType
{
TraceTypeAlphabet
,
TraceTypeCannon
}
// GameIdToString maps game IDs to their string representation on a per-network basis.
// GameIdToString maps game IDs to their string representation.
var
GameIdToString
=
map
[
uint64
]
map
[
uint8
]
string
{
var
GameIdToString
=
map
[
uint8
]
string
{
// Mainnet
CannonFaultGameID
:
"Cannon"
,
1
:
{
AlphabetFaultGameID
:
"Alphabet"
,
MainnetGameIDFault
:
"fault-cannon"
,
},
// Devnet
900
:
{
DevnetGameIDAlphabet
:
"fault-alphabet"
,
DevnetGameIDCannon
:
"fault-cannon"
,
},
}
}
func
(
t
TraceType
)
String
()
string
{
func
(
t
TraceType
)
String
()
string
{
...
...
op-challenger/fault/cannon/executor.go
View file @
200a2557
...
@@ -39,7 +39,6 @@ type Executor struct {
...
@@ -39,7 +39,6 @@ type Executor struct {
rollupConfig
string
rollupConfig
string
l2Genesis
string
l2Genesis
string
absolutePreState
string
absolutePreState
string
dataDir
string
snapshotFreq
uint
snapshotFreq
uint
selectSnapshot
snapshotSelect
selectSnapshot
snapshotSelect
cmdExecutor
cmdExecutor
cmdExecutor
cmdExecutor
...
@@ -57,7 +56,6 @@ func NewExecutor(logger log.Logger, cfg *config.Config, inputs LocalGameInputs)
...
@@ -57,7 +56,6 @@ func NewExecutor(logger log.Logger, cfg *config.Config, inputs LocalGameInputs)
rollupConfig
:
cfg
.
CannonRollupConfigPath
,
rollupConfig
:
cfg
.
CannonRollupConfigPath
,
l2Genesis
:
cfg
.
CannonL2GenesisPath
,
l2Genesis
:
cfg
.
CannonL2GenesisPath
,
absolutePreState
:
cfg
.
CannonAbsolutePreState
,
absolutePreState
:
cfg
.
CannonAbsolutePreState
,
dataDir
:
cfg
.
CannonDatadir
,
snapshotFreq
:
cfg
.
CannonSnapshotFreq
,
snapshotFreq
:
cfg
.
CannonSnapshotFreq
,
selectSnapshot
:
findStartingSnapshot
,
selectSnapshot
:
findStartingSnapshot
,
cmdExecutor
:
runCmd
,
cmdExecutor
:
runCmd
,
...
@@ -71,7 +69,7 @@ func (e *Executor) GenerateProof(ctx context.Context, dir string, i uint64) erro
...
@@ -71,7 +69,7 @@ func (e *Executor) GenerateProof(ctx context.Context, dir string, i uint64) erro
return
fmt
.
Errorf
(
"find starting snapshot: %w"
,
err
)
return
fmt
.
Errorf
(
"find starting snapshot: %w"
,
err
)
}
}
proofDir
:=
filepath
.
Join
(
dir
,
proofsDir
)
proofDir
:=
filepath
.
Join
(
dir
,
proofsDir
)
dataDir
:=
filepath
.
Join
(
e
.
dataD
ir
,
preimagesDir
)
dataDir
:=
filepath
.
Join
(
d
ir
,
preimagesDir
)
lastGeneratedState
:=
filepath
.
Join
(
dir
,
finalState
)
lastGeneratedState
:=
filepath
.
Join
(
dir
,
finalState
)
args
:=
[]
string
{
args
:=
[]
string
{
"run"
,
"run"
,
...
...
op-challenger/fault/cannon/executor_test.go
View file @
200a2557
...
@@ -22,7 +22,9 @@ const execTestCannonPrestate = "/foo/pre.json"
...
@@ -22,7 +22,9 @@ const execTestCannonPrestate = "/foo/pre.json"
func
TestGenerateProof
(
t
*
testing
.
T
)
{
func
TestGenerateProof
(
t
*
testing
.
T
)
{
input
:=
"starting.json"
input
:=
"starting.json"
cfg
:=
config
.
NewConfig
(
common
.
Address
{
0xbb
},
"http://localhost:8888"
,
config
.
TraceTypeCannon
,
true
)
cfg
:=
config
.
NewConfig
(
common
.
Address
{
0xbb
},
"http://localhost:8888"
,
config
.
TraceTypeCannon
,
true
)
cfg
.
CannonDatadir
=
t
.
TempDir
()
tempDir
:=
t
.
TempDir
()
dir
:=
filepath
.
Join
(
tempDir
,
"gameDir"
)
cfg
.
CannonDatadir
=
tempDir
cfg
.
CannonAbsolutePreState
=
"pre.json"
cfg
.
CannonAbsolutePreState
=
"pre.json"
cfg
.
CannonBin
=
"./bin/cannon"
cfg
.
CannonBin
=
"./bin/cannon"
cfg
.
CannonServer
=
"./bin/op-program"
cfg
.
CannonServer
=
"./bin/op-program"
...
@@ -58,7 +60,7 @@ func TestGenerateProof(t *testing.T) {
...
@@ -58,7 +60,7 @@ func TestGenerateProof(t *testing.T) {
}
}
return
nil
return
nil
}
}
err
:=
executor
.
GenerateProof
(
context
.
Background
(),
cfg
.
CannonData
dir
,
proofAt
)
err
:=
executor
.
GenerateProof
(
context
.
Background
(),
dir
,
proofAt
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
return
binary
,
subcommand
,
args
return
binary
,
subcommand
,
args
}
}
...
@@ -68,15 +70,15 @@ func TestGenerateProof(t *testing.T) {
...
@@ -68,15 +70,15 @@ func TestGenerateProof(t *testing.T) {
cfg
.
CannonRollupConfigPath
=
""
cfg
.
CannonRollupConfigPath
=
""
cfg
.
CannonL2GenesisPath
=
""
cfg
.
CannonL2GenesisPath
=
""
binary
,
subcommand
,
args
:=
captureExec
(
t
,
cfg
,
150
_000_000
)
binary
,
subcommand
,
args
:=
captureExec
(
t
,
cfg
,
150
_000_000
)
require
.
DirExists
(
t
,
filepath
.
Join
(
cfg
.
CannonData
dir
,
preimagesDir
))
require
.
DirExists
(
t
,
filepath
.
Join
(
dir
,
preimagesDir
))
require
.
DirExists
(
t
,
filepath
.
Join
(
cfg
.
CannonData
dir
,
proofsDir
))
require
.
DirExists
(
t
,
filepath
.
Join
(
dir
,
proofsDir
))
require
.
DirExists
(
t
,
filepath
.
Join
(
cfg
.
CannonData
dir
,
snapsDir
))
require
.
DirExists
(
t
,
filepath
.
Join
(
dir
,
snapsDir
))
require
.
Equal
(
t
,
cfg
.
CannonBin
,
binary
)
require
.
Equal
(
t
,
cfg
.
CannonBin
,
binary
)
require
.
Equal
(
t
,
"run"
,
subcommand
)
require
.
Equal
(
t
,
"run"
,
subcommand
)
require
.
Equal
(
t
,
input
,
args
[
"--input"
])
require
.
Equal
(
t
,
input
,
args
[
"--input"
])
require
.
Contains
(
t
,
args
,
"--meta"
)
require
.
Contains
(
t
,
args
,
"--meta"
)
require
.
Equal
(
t
,
""
,
args
[
"--meta"
])
require
.
Equal
(
t
,
""
,
args
[
"--meta"
])
require
.
Equal
(
t
,
filepath
.
Join
(
cfg
.
CannonData
dir
,
finalState
),
args
[
"--output"
])
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
finalState
),
args
[
"--output"
])
require
.
Equal
(
t
,
"=150000000"
,
args
[
"--proof-at"
])
require
.
Equal
(
t
,
"=150000000"
,
args
[
"--proof-at"
])
require
.
Equal
(
t
,
"=150000001"
,
args
[
"--stop-at"
])
require
.
Equal
(
t
,
"=150000001"
,
args
[
"--stop-at"
])
require
.
Equal
(
t
,
"%500"
,
args
[
"--snapshot-at"
])
require
.
Equal
(
t
,
"%500"
,
args
[
"--snapshot-at"
])
...
@@ -86,9 +88,9 @@ func TestGenerateProof(t *testing.T) {
...
@@ -86,9 +88,9 @@ func TestGenerateProof(t *testing.T) {
require
.
Equal
(
t
,
"--server"
,
args
[
cfg
.
CannonServer
])
require
.
Equal
(
t
,
"--server"
,
args
[
cfg
.
CannonServer
])
require
.
Equal
(
t
,
cfg
.
L1EthRpc
,
args
[
"--l1"
])
require
.
Equal
(
t
,
cfg
.
L1EthRpc
,
args
[
"--l1"
])
require
.
Equal
(
t
,
cfg
.
CannonL2
,
args
[
"--l2"
])
require
.
Equal
(
t
,
cfg
.
CannonL2
,
args
[
"--l2"
])
require
.
Equal
(
t
,
filepath
.
Join
(
cfg
.
CannonData
dir
,
preimagesDir
),
args
[
"--datadir"
])
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
preimagesDir
),
args
[
"--datadir"
])
require
.
Equal
(
t
,
filepath
.
Join
(
cfg
.
CannonData
dir
,
proofsDir
,
"%d.json"
),
args
[
"--proof-fmt"
])
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
proofsDir
,
"%d.json"
),
args
[
"--proof-fmt"
])
require
.
Equal
(
t
,
filepath
.
Join
(
cfg
.
CannonData
dir
,
snapsDir
,
"%d.json"
),
args
[
"--snapshot-fmt"
])
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
snapsDir
,
"%d.json"
),
args
[
"--snapshot-fmt"
])
require
.
Equal
(
t
,
cfg
.
CannonNetwork
,
args
[
"--network"
])
require
.
Equal
(
t
,
cfg
.
CannonNetwork
,
args
[
"--network"
])
require
.
NotContains
(
t
,
args
,
"--rollup.config"
)
require
.
NotContains
(
t
,
args
,
"--rollup.config"
)
require
.
NotContains
(
t
,
args
,
"--l2.genesis"
)
require
.
NotContains
(
t
,
args
,
"--l2.genesis"
)
...
...
op-challenger/fault/cannon/provider.go
View file @
200a2557
...
@@ -64,13 +64,14 @@ func NewTraceProvider(ctx context.Context, logger log.Logger, cfg *config.Config
...
@@ -64,13 +64,14 @@ func NewTraceProvider(ctx context.Context, logger log.Logger, cfg *config.Config
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"fetch local game inputs: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"fetch local game inputs: %w"
,
err
)
}
}
return
NewTraceProviderFromInputs
(
logger
,
cfg
,
localInputs
),
nil
return
NewTraceProviderFromInputs
(
logger
,
cfg
,
gameAddr
.
Hex
(),
localInputs
),
nil
}
}
func
NewTraceProviderFromInputs
(
logger
log
.
Logger
,
cfg
*
config
.
Config
,
localInputs
LocalGameInputs
)
*
CannonTraceProvider
{
func
NewTraceProviderFromInputs
(
logger
log
.
Logger
,
cfg
*
config
.
Config
,
gameDirName
string
,
localInputs
LocalGameInputs
)
*
CannonTraceProvider
{
dir
:=
filepath
.
Join
(
cfg
.
CannonDatadir
,
gameDirName
)
return
&
CannonTraceProvider
{
return
&
CannonTraceProvider
{
logger
:
logger
,
logger
:
logger
,
dir
:
cfg
.
CannonData
dir
,
dir
:
dir
,
prestate
:
cfg
.
CannonAbsolutePreState
,
prestate
:
cfg
.
CannonAbsolutePreState
,
generator
:
NewExecutor
(
logger
,
cfg
,
localInputs
),
generator
:
NewExecutor
(
logger
,
cfg
,
localInputs
),
}
}
...
...
op-challenger/fault/cannon/provider_test.go
View file @
200a2557
...
@@ -11,6 +11,7 @@ import (
...
@@ -11,6 +11,7 @@ import (
"testing"
"testing"
"github.com/ethereum-optimism/optimism/cannon/mipsevm"
"github.com/ethereum-optimism/optimism/cannon/mipsevm"
"github.com/ethereum-optimism/optimism/op-challenger/config"
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
...
@@ -149,7 +150,6 @@ func TestGetStepData(t *testing.T) {
...
@@ -149,7 +150,6 @@ func TestGetStepData(t *testing.T) {
func
TestAbsolutePreState
(
t
*
testing
.
T
)
{
func
TestAbsolutePreState
(
t
*
testing
.
T
)
{
dataDir
:=
t
.
TempDir
()
dataDir
:=
t
.
TempDir
()
_
=
os
.
Mkdir
(
dataDir
,
0
o777
)
prestate
:=
"state.json"
prestate
:=
"state.json"
...
@@ -189,6 +189,21 @@ func TestAbsolutePreState(t *testing.T) {
...
@@ -189,6 +189,21 @@ func TestAbsolutePreState(t *testing.T) {
})
})
}
}
func
TestUseGameSpecificSubdir
(
t
*
testing
.
T
)
{
tempDir
:=
t
.
TempDir
()
dataDir
:=
filepath
.
Join
(
tempDir
,
"data"
)
setupPreState
(
t
,
tempDir
,
"state.json"
)
logger
:=
testlog
.
Logger
(
t
,
log
.
LvlInfo
)
cfg
:=
&
config
.
Config
{
CannonAbsolutePreState
:
filepath
.
Join
(
tempDir
,
"state.json"
),
CannonDatadir
:
dataDir
,
}
gameDirName
:=
"gameSubdir"
localInputs
:=
LocalGameInputs
{}
provider
:=
NewTraceProviderFromInputs
(
logger
,
cfg
,
gameDirName
,
localInputs
)
require
.
Equal
(
t
,
filepath
.
Join
(
dataDir
,
gameDirName
),
provider
.
dir
,
"should use game specific subdir"
)
}
func
setupPreState
(
t
*
testing
.
T
,
dataDir
string
,
filename
string
)
{
func
setupPreState
(
t
*
testing
.
T
,
dataDir
string
,
filename
string
)
{
srcDir
:=
filepath
.
Join
(
"test_data"
)
srcDir
:=
filepath
.
Join
(
"test_data"
)
path
:=
filepath
.
Join
(
srcDir
,
filename
)
path
:=
filepath
.
Join
(
srcDir
,
filename
)
...
...
op-challenger/scripts/alphabet/init_game.sh
View file @
200a2557
...
@@ -78,8 +78,8 @@ cast call $L2_OUTPUT_ORACLE_PROXY "getL2Output(uint256)" $PRIOR_INDEX
...
@@ -78,8 +78,8 @@ cast call $L2_OUTPUT_ORACLE_PROXY "getL2Output(uint256)" $PRIOR_INDEX
echo
"Getting the l2 output at index
$INDEX
"
echo
"Getting the l2 output at index
$INDEX
"
cast call
$L2_OUTPUT_ORACLE_PROXY
"getL2Output(uint256)"
$INDEX
cast call
$L2_OUTPUT_ORACLE_PROXY
"getL2Output(uint256)"
$INDEX
# (Alphabet) Fault game type =
0
# (Alphabet) Fault game type =
255
GAME_TYPE
=
0
GAME_TYPE
=
255
# Root claim commits to the entire trace.
# Root claim commits to the entire trace.
# Alphabet game claim construction: keccak256(abi.encode(trace_index, trace[trace_index]))
# Alphabet game claim construction: keccak256(abi.encode(trace_index, trace[trace_index]))
...
...
op-e2e/e2eutils/disputegame/helper.go
View file @
200a2557
...
@@ -26,8 +26,8 @@ import (
...
@@ -26,8 +26,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
)
)
const
alphabetGameType
uint8
=
0
const
alphabetGameType
uint8
=
255
const
cannonGameType
uint8
=
1
const
cannonGameType
uint8
=
0
const
alphabetGameDepth
=
4
const
alphabetGameDepth
=
4
const
lastAlphabetTraceIndex
=
1
<<
alphabetGameDepth
-
1
const
lastAlphabetTraceIndex
=
1
<<
alphabetGameDepth
-
1
...
@@ -170,7 +170,7 @@ func (h *FactoryHelper) StartCannonGameWithCorrectRoot(ctx context.Context, roll
...
@@ -170,7 +170,7 @@ func (h *FactoryHelper) StartCannonGameWithCorrectRoot(ctx context.Context, roll
L2Claim
:
challengedOutput
.
OutputRoot
,
L2Claim
:
challengedOutput
.
OutputRoot
,
L2BlockNumber
:
challengedOutput
.
L2BlockNumber
,
L2BlockNumber
:
challengedOutput
.
L2BlockNumber
,
}
}
provider
:=
cannon
.
NewTraceProviderFromInputs
(
testlog
.
Logger
(
h
.
t
,
log
.
LvlInfo
)
.
New
(
"role"
,
"CorrectTrace"
),
cfg
,
inputs
)
provider
:=
cannon
.
NewTraceProviderFromInputs
(
testlog
.
Logger
(
h
.
t
,
log
.
LvlInfo
)
.
New
(
"role"
,
"CorrectTrace"
),
cfg
,
"correct"
,
inputs
)
rootClaim
,
err
:=
provider
.
Get
(
ctx
,
math
.
MaxUint64
)
rootClaim
,
err
:=
provider
.
Get
(
ctx
,
math
.
MaxUint64
)
h
.
require
.
NoError
(
err
,
"Compute correct root hash"
)
h
.
require
.
NoError
(
err
,
"Compute correct root hash"
)
...
...
op-e2e/e2eutils/wait/waits.go
View file @
200a2557
...
@@ -56,7 +56,8 @@ func (s *jsonRawString) UnmarshalJSON(input []byte) error {
...
@@ -56,7 +56,8 @@ func (s *jsonRawString) UnmarshalJSON(input []byte) error {
// printDebugTrace logs debug_traceTransaction output to aid in debugging unexpected receipt statuses
// printDebugTrace logs debug_traceTransaction output to aid in debugging unexpected receipt statuses
func
printDebugTrace
(
ctx
context
.
Context
,
client
*
ethclient
.
Client
,
txHash
common
.
Hash
)
{
func
printDebugTrace
(
ctx
context
.
Context
,
client
*
ethclient
.
Client
,
txHash
common
.
Hash
)
{
var
trace
jsonRawString
var
trace
jsonRawString
options
:=
map
[
string
]
string
{}
options
:=
map
[
string
]
any
{}
options
[
"enableReturnData"
]
=
true
err
:=
client
.
Client
()
.
CallContext
(
ctx
,
&
trace
,
"debug_traceTransaction"
,
hexutil
.
Bytes
(
txHash
.
Bytes
()),
options
)
err
:=
client
.
Client
()
.
CallContext
(
ctx
,
&
trace
,
"debug_traceTransaction"
,
hexutil
.
Bytes
(
txHash
.
Bytes
()),
options
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Printf
(
"TxTrace unavailable: %v
\n
"
,
err
)
fmt
.
Printf
(
"TxTrace unavailable: %v
\n
"
,
err
)
...
...
op-e2e/faultproof_test.go
View file @
200a2557
...
@@ -50,7 +50,6 @@ func TestMultipleAlphabetGames(t *testing.T) {
...
@@ -50,7 +50,6 @@ func TestMultipleAlphabetGames(t *testing.T) {
}
}
func
TestMultipleCannonGames
(
t
*
testing
.
T
)
{
func
TestMultipleCannonGames
(
t
*
testing
.
T
)
{
t
.
Skip
(
"Cannon provider doesn't currently isolate different game traces"
)
InitParallel
(
t
)
InitParallel
(
t
)
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
...
...
op-node/p2p/host.go
View file @
200a2557
...
@@ -186,9 +186,6 @@ func (conf *Config) Host(log log.Logger, reporter metrics.Reporter, metrics Host
...
@@ -186,9 +186,6 @@ func (conf *Config) Host(log log.Logger, reporter metrics.Reporter, metrics Host
tcpTransport
:=
libp2p
.
Transport
(
tcpTransport
:=
libp2p
.
Transport
(
tcp
.
NewTCPTransport
,
tcp
.
NewTCPTransport
,
tcp
.
WithConnectionTimeout
(
time
.
Minute
*
60
))
// break unused connections
tcp
.
WithConnectionTimeout
(
time
.
Minute
*
60
))
// break unused connections
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to create TCP transport: %w"
,
err
)
}
// TODO: technically we can also run the node on websocket and QUIC transports. Maybe in the future?
// TODO: technically we can also run the node on websocket and QUIC transports. Maybe in the future?
var
nat
lconf
.
NATManagerC
// disabled if nil
var
nat
lconf
.
NATManagerC
// disabled if nil
...
...
packages/contracts-bedrock/scripts/Deploy.s.sol
View file @
200a2557
...
@@ -76,7 +76,8 @@ contract Deploy is Deployer {
...
@@ -76,7 +76,8 @@ contract Deploy is Deployer {
initializeL2OutputOracle();
initializeL2OutputOracle();
initializeOptimismPortal();
initializeOptimismPortal();
setFaultGameImplementation();
setAlphabetFaultGameImplementation();
setCannonFaultGameImplementation();
transferProxyAdminOwnership();
transferProxyAdminOwnership();
transferDisputeGameFactoryOwnership();
transferDisputeGameFactoryOwnership();
...
@@ -759,10 +760,13 @@ contract Deploy is Deployer {
...
@@ -759,10 +760,13 @@ contract Deploy is Deployer {
}
}
/// @notice Sets the implementation for the `FAULT` game type in the `DisputeGameFactory`
/// @notice Sets the implementation for the `FAULT` game type in the `DisputeGameFactory`
function setFaultGameImplementation() public onlyDevnet broadcast {
function setCannonFaultGameImplementation() public onlyDevnet broadcast {
// Create the absolute prestate dump
DisputeGameFactory factory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
Claim mipsAbsolutePrestate;
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
// Fetch the absolute prestate dump
string memory filePath = string.concat(vm.projectRoot(), "/../../op-program/bin/prestate-proof.json");
string memory filePath = string.concat(vm.projectRoot(), "/../../op-program/bin/prestate-proof.json");
bytes32 mipsAbsolutePrestate;
string[] memory commands = new string[](3);
string[] memory commands = new string[](3);
commands[0] = "bash";
commands[0] = "bash";
commands[1] = "-c";
commands[1] = "-c";
...
@@ -771,35 +775,74 @@ contract Deploy is Deployer {
...
@@ -771,35 +775,74 @@ contract Deploy is Deployer {
revert("Cannon prestate dump not found, generate it with `make cannon-prestate` in the monorepo root.");
revert("Cannon prestate dump not found, generate it with `make cannon-prestate` in the monorepo root.");
}
}
commands[2] = string.concat("cat ", filePath, " | jq -r .pre");
commands[2] = string.concat("cat ", filePath, " | jq -r .pre");
mipsAbsolutePrestate = abi.decode(vm.ffi(commands), (bytes32));
mipsAbsolutePrestate = Claim.wrap(abi.decode(vm.ffi(commands), (bytes32)));
console.log("Absolute prestate: %s", vm.toString(mipsAbsolutePrestate));
console.log(
"[Cannon Dispute Game] Using devnet MIPS Absolute prestate: %s",
vm.toString(Claim.unwrap(mipsAbsolutePrestate))
);
} else {
console.log(
"[Cannon Dispute Game] Using absolute prestate from config: %s", cfg.faultGameAbsolutePrestate()
);
mipsAbsolutePrestate = Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate()));
}
// Set the Cannon FaultDisputeGame implementation in the factory.
_setFaultGameImplementation(
factory, GameTypes.FAULT, mipsAbsolutePrestate, IBigStepper(mustGetAddress("Mips")), cfg.faultGameMaxDepth()
);
}
/// @notice Sets the implementation for the alphabet game type in the `DisputeGameFactory`
function setAlphabetFaultGameImplementation() public onlyDevnet broadcast {
DisputeGameFactory factory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
DisputeGameFactory factory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
for (uint8 i; i < 2; i++) {
Claim absolutePrestate =
// Set the Alphabet FaultDisputeGame implementation in the factory.
Claim.wrap(i == 0 ? bytes32(cfg.faultGameAbsolutePrestate()) : mipsAbsolutePrestate);
Claim alphabetAbsolutePrestate = Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate()));
IBigStepper faultVm =
_setFaultGameImplementation(
IBigStepper(i == 0 ? address(new AlphabetVM(absolutePrestate)) : mustGetAddress("Mips"));
factory,
GameType gameType = GameType.wrap(i);
GameType.wrap(255),
if (address(factory.gameImpls(gameType)) == address(0)) {
alphabetAbsolutePrestate,
factory.setImplementation(
IBigStepper(new AlphabetVM(alphabetAbsolutePrestate)),
gameType,
4 // The max game depth of the alphabet game is always 4.
);
}
/// @notice Sets the implementation for the given fault game type in the `DisputeGameFactory`.
function _setFaultGameImplementation(
DisputeGameFactory _factory,
GameType _gameType,
Claim _absolutePrestate,
IBigStepper _faultVm,
uint256 _maxGameDepth
)
internal
{
if (address(_factory.gameImpls(_gameType)) == address(0)) {
_factory.setImplementation(
_gameType,
new FaultDisputeGame({
new FaultDisputeGame({
_gameType: gameType,
_gameType:
_
gameType,
_absolutePrestate: absolutePrestate,
_absolutePrestate:
_
absolutePrestate,
_maxGameDepth:
i == 0 ? 4 : cfg.faultGameMaxDepth(), // The max depth of the alphabet game is always 4
_maxGameDepth:
_maxGameDepth,
_gameDuration: Duration.wrap(uint64(cfg.faultGameMaxDuration())),
_gameDuration: Duration.wrap(uint64(cfg.faultGameMaxDuration())),
_vm: faultVm,
_vm:
_
faultVm,
_l2oo: L2OutputOracle(mustGetAddress("L2OutputOracleProxy")),
_l2oo: L2OutputOracle(mustGetAddress("L2OutputOracleProxy")),
_blockOracle: BlockOracle(mustGetAddress("BlockOracle"))
_blockOracle: BlockOracle(mustGetAddress("BlockOracle"))
})
})
);
);
uint8 rawGameType = GameType.unwrap(_gameType);
console.log(
console.log(
"DisputeGameFactoryProxy: set `FaultDisputeGame` implementation (Backend: %s | GameType: %s)",
"DisputeGameFactoryProxy: set `FaultDisputeGame` implementation (Backend: %s | GameType: %s)",
i == 0 ? "AlphabetVM" : "MIPS",
rawGameType == 0 ? "Cannon" : "Alphabet",
vm.toString(i)
vm.toString(rawGameType)
);
} else {
console.log(
"[WARN] DisputeGameFactoryProxy: `FaultDisputeGame` implementation already set for game type: %s",
vm.toString(GameType.unwrap(_gameType))
);
);
}
}
}
}
}
}
}
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