Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions op-acceptance-tests/tests/base/disputegame_v2/init_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package disputegame_v2

import (
"testing"

"github.com/ethereum-optimism/optimism/op-devstack/presets"
)

func TestMain(m *testing.M) {
presets.DoMain(m, presets.WithMinimal(), presets.WithDisputeGameV2())
}
27 changes: 27 additions & 0 deletions op-acceptance-tests/tests/base/disputegame_v2/smoke_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package disputegame_v2

import (
"testing"

challengerTypes "github.com/ethereum-optimism/optimism/op-challenger/game/fault/types"
"github.com/ethereum-optimism/optimism/op-devstack/devtest"
"github.com/ethereum-optimism/optimism/op-devstack/presets"
)

func TestSmoke(gt *testing.T) {
gt.Skip("TODO(#17257): Re-enable once opcm.deploy supports v2 dispute games")
t := devtest.SerialT(gt)
sys := presets.NewMinimal(t)
require := t.Require()
dgf := sys.DisputeGameFactory()

gameArgs := dgf.GameArgs(challengerTypes.PermissionedGameType)
require.NotEmpty(gameArgs, "game args is must be set for permissioned v2 dispute games")
gameArgs = dgf.GameArgs(challengerTypes.CannonGameType)
require.NotEmpty(gameArgs, "game args is must be set for cannon v2 dispute games")

permissionedGame := dgf.GameImpl(challengerTypes.PermissionedGameType)
require.NotEmpty(permissionedGame.Address, "permissioned game impl must be set")
cannonGame := dgf.GameImpl(challengerTypes.CannonGameType)
require.NotEmpty(cannonGame.Address, "cannon game impl must be set")
}
7 changes: 2 additions & 5 deletions op-chain-ops/interopgen/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis/beacondeposit"
"github.com/ethereum-optimism/optimism/op-chain-ops/script"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/manage"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
"github.com/ethereum-optimism/optimism/op-service/eth"
Expand All @@ -27,10 +28,6 @@ var (
// sysGenesisDeployer is used as tx.origin/msg.sender on system genesis script calls.
// At the end we verify none of the deployed contracts persist (there may be temporary ones, to insert bytecode).
sysGenesisDeployer = common.Address(crypto.Keccak256([]byte("System genesis deployer"))[12:])

// OptimismPortalInteropDevFlag is the feature bitmap that enables the OptimismPortalInterop contract.
OptimismPortalInteropDevFlag = common.Hash{31: 0x01} // 0x0000000000000000000000000000000000000000000000000000000000000001

)

func Deploy(logger log.Logger, fa *foundry.ArtifactsFS, srcFS *foundry.SourceMapFS, cfg *WorldConfig) (*WorldDeployment, *WorldOutput, error) {
Expand Down Expand Up @@ -195,7 +192,7 @@ func DeploySuperchainToL1(l1Host *script.Host, opcmScripts *opcm.Scripts, superC
ProofMaturityDelaySeconds: superCfg.Implementations.FaultProof.ProofMaturityDelaySeconds,
DisputeGameFinalityDelaySeconds: superCfg.Implementations.FaultProof.DisputeGameFinalityDelaySeconds,
MipsVersion: superCfg.Implementations.FaultProof.MipsVersion,
DevFeatureBitmap: OptimismPortalInteropDevFlag,
DevFeatureBitmap: deployer.OptimismPortalInteropDevFlag,
FaultGameV2MaxGameDepth: big.NewInt(73),
FaultGameV2SplitDepth: big.NewInt(30),
FaultGameV2ClockExtension: big.NewInt(10800),
Expand Down
2 changes: 1 addition & 1 deletion op-deployer/pkg/deployer/bootstrap/implementations.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (c *ImplementationsConfig) Check() error {
return errors.New("dispute game finality delay in seconds must be specified")
}
// Check V2 fault game parameters only if V2 dispute games feature is enabled
deployV2Games := deployer.IsDevFeatureEnabled(c.DevFeatureBitmap, deployer.DeployV2DisputeGames)
deployV2Games := deployer.IsDevFeatureEnabled(c.DevFeatureBitmap, deployer.DeployV2DisputeGamesDevFlag)
if deployV2Games {
if c.FaultGameMaxGameDepth == 0 {
return errors.New("fault game max game depth must be specified when V2 dispute games feature is enabled")
Expand Down
12 changes: 6 additions & 6 deletions op-deployer/pkg/deployer/devfeatures.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
// Development feature flag constants that mirror the solidity DevFeatures library.
// These use a 32 byte bitmap for easy integration between op-deployer and contracts.
var (
// OptimismPortalInterop enables the OptimismPortalInterop contract.
OptimismPortalInterop = common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001")
// OptimismPortalInteropDevFlag enables the OptimismPortalInterop contract.
OptimismPortalInteropDevFlag = common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001")

// CannonKona enables Kona as the default cannon prover.
CannonKona = common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000010")
// CannonKonaDevFlag enables Kona as the default cannon prover.
CannonKonaDevFlag = common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000010")

// DeployV2DisputeGames enables deployment of V2 dispute game contracts.
DeployV2DisputeGames = common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000100")
// DeployV2DisputeGamesDevFlag enables deployment of V2 dispute game contracts.
DeployV2DisputeGamesDevFlag = common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000100")
)

// IsDevFeatureEnabled checks if a specific development feature is enabled in a feature bitmap.
Expand Down
8 changes: 7 additions & 1 deletion op-devstack/dsl/proofs/dispute_game_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,16 @@ func (f *DisputeGameFactory) GameAtIndex(idx int64) *FaultDisputeGame {
return NewFaultDisputeGame(f.t, f.require, gameInfo.Proxy, f.getGameHelper, game)
}

func (f *DisputeGameFactory) gameImpl(gameType challengerTypes.GameType) *FaultDisputeGame {
func (f *DisputeGameFactory) GameImpl(gameType challengerTypes.GameType) *FaultDisputeGame {
implAddr := contract.Read(f.dgf.GameImpls(uint32(gameType)))
game := bindings.NewFaultDisputeGame(bindings.WithClient(f.ethClient), bindings.WithTo(implAddr), bindings.WithTest(f.t))
return NewFaultDisputeGame(f.t, f.require, implAddr, f.getGameHelper, game)
}

func (f *DisputeGameFactory) GameArgs(gameType challengerTypes.GameType) []byte {
return contract.Read(f.dgf.GameArgs(uint32(gameType)))
}

func (f *DisputeGameFactory) WaitForGame() *FaultDisputeGame {
initialCount := f.GameCount()
f.t.Require().Eventually(func() bool {
Expand All @@ -131,6 +135,7 @@ func (f *DisputeGameFactory) WaitForGame() *FaultDisputeGame {
}

func (f *DisputeGameFactory) StartSuperCannonGame(eoa *dsl.EOA, opts ...GameOpt) *SuperFaultDisputeGame {
f.require.NotNil(f.supervisor, "supervisor is required to start super games")
proposalTimestamp := f.supervisor.FetchSyncStatus().SafeTimestamp

return f.startSuperCannonGameOfType(eoa, proposalTimestamp, challengerTypes.SuperCannonGameType, opts...)
Expand All @@ -151,6 +156,7 @@ func (f *DisputeGameFactory) startSuperCannonGameOfType(eoa *dsl.EOA, timestamp
}

func (f *DisputeGameFactory) createSuperGameExtraData(timestamp uint64, cfg *GameCfg) []byte {
f.require.NotNil(f.supervisor, "supervisor is required create super games")
if !cfg.allowFuture {
f.supervisor.AwaitMinCrossSafeTimestamp(timestamp)
}
Expand Down
2 changes: 1 addition & 1 deletion op-devstack/dsl/proofs/game_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (gs *GameHelper) CreateGameWithClaims(
data, err := gs.abi.Pack("createGameWithClaims", factory.Address(), gameType, rootClaim, extraData, moves)
gs.require.NoError(err)

gameImpl := factory.gameImpl(gameType)
gameImpl := factory.GameImpl(gameType)
bonds := factory.initBond(gameType)
bonds = bonds.Add(gs.totalMoveBonds(gameImpl, moves))

Expand Down
11 changes: 11 additions & 0 deletions op-devstack/presets/disputegame_v2.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package presets

import (
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer"
"github.com/ethereum-optimism/optimism/op-devstack/stack"
"github.com/ethereum-optimism/optimism/op-devstack/sysgo"
)

func WithDisputeGameV2() stack.CommonOption {
return stack.MakeCommon(sysgo.WithDeployerOptions(sysgo.WithDevFeatureBitmap(deployer.DeployV2DisputeGamesDevFlag)))
}
5 changes: 5 additions & 0 deletions op-devstack/presets/minimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/ethereum-optimism/optimism/op-devstack/devtest"
"github.com/ethereum-optimism/optimism/op-devstack/dsl"
"github.com/ethereum-optimism/optimism/op-devstack/dsl/proofs"
"github.com/ethereum-optimism/optimism/op-devstack/shim"
"github.com/ethereum-optimism/optimism/op-devstack/stack"
"github.com/ethereum-optimism/optimism/op-devstack/stack/match"
Expand Down Expand Up @@ -42,6 +43,10 @@ func (m *Minimal) StandardBridge() *dsl.StandardBridge {
return dsl.NewStandardBridge(m.T, m.L2Chain, nil, m.L1EL)
}

func (m *Minimal) DisputeGameFactory() *proofs.DisputeGameFactory {
return proofs.NewDisputeGameFactory(m.T, m.L1Network, m.L1EL.EthClient(), m.L2Chain.DisputeGameFactoryProxyAddr(), nil)
}

func WithMinimal() stack.CommonOption {
return stack.MakeCommon(sysgo.DefaultMinimalSystem(&sysgo.DefaultMinimalSystemIDs{}))
}
Expand Down
4 changes: 2 additions & 2 deletions op-devstack/sysgo/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package sysgo

import (
"github.com/ethereum-optimism/optimism/op-chain-ops/devkeys"
"github.com/ethereum-optimism/optimism/op-chain-ops/interopgen"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer"
"github.com/ethereum-optimism/optimism/op-devstack/stack"
"github.com/ethereum-optimism/optimism/op-service/eth"
)
Expand Down Expand Up @@ -332,7 +332,7 @@ func defaultSuperProofsSystem(dest *DefaultInteropSystemIDs, deployerOpts ...Dep
WithCommons(ids.L1.ChainID()),
WithPrefundedL2(ids.L1.ChainID(), ids.L2A.ChainID()),
WithPrefundedL2(ids.L1.ChainID(), ids.L2B.ChainID()),
WithDevFeatureBitmap(interopgen.OptimismPortalInteropDevFlag),
WithDevFeatureBitmap(deployer.OptimismPortalInteropDevFlag),
}, deployerOpts...)...))

opt.Add(WithL1Nodes(ids.L1EL, ids.L1CL))
Expand Down
1 change: 1 addition & 0 deletions op-service/txintent/bindings/DisputeGameFactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type DisputeGameFactory struct {
GameCount func() TypedCall[*big.Int] `sol:"gameCount"`
GameAtIndex func(index *big.Int) TypedCall[DisputeGame] `sol:"gameAtIndex"`
GameImpls func(gameType uint32) TypedCall[common.Address] `sol:"gameImpls"`
GameArgs func(gameType uint32) TypedCall[[]byte] `sol:"gameArgs"`
Games func(gameType uint32, rootClaim common.Hash, extraData []byte) TypedCall[struct {
Proxy common.Address
Timestamp uint64
Expand Down