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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
)

func TestChallengerPlaysGame(gt *testing.T) {
gt.Skip("Skipping until super node is available from the interop system")
t := devtest.ParallelT(gt)
sys := presets.NewSimpleInterop(t)
dsl.CheckAll(t,
Expand Down
30 changes: 22 additions & 8 deletions op-devstack/dsl/proofs/dispute_game_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,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/contract"
"github.com/ethereum-optimism/optimism/op-devstack/stack"
"github.com/ethereum-optimism/optimism/op-service/apis"
"github.com/ethereum-optimism/optimism/op-service/bigs"
"github.com/ethereum-optimism/optimism/op-service/txintent/bindings"
Expand All @@ -43,7 +44,7 @@ type DisputeGameFactory struct {
addr common.Address
l2CL *dsl.L2CLNode
l2EL *dsl.L2ELNode
superRoots SuperRootsSource
superNode stack.Supernode
gameHelper *GameHelper
challengerCfg *challengerConfig.Config

Expand All @@ -57,7 +58,7 @@ func NewDisputeGameFactory(
dgfAddr common.Address,
l2CL *dsl.L2CLNode,
l2EL *dsl.L2ELNode,
superRoots SuperRootsSource,
superNode stack.Supernode,
challengerCfg *challengerConfig.Config,
) *DisputeGameFactory {
dgf := bindings.NewDisputeGameFactory(bindings.WithClient(ethClient), bindings.WithTo(dgfAddr), bindings.WithTest(t))
Expand All @@ -71,7 +72,7 @@ func NewDisputeGameFactory(
addr: dgfAddr,
l2CL: l2CL,
l2EL: l2EL,
superRoots: superRoots,
superNode: superNode,
ethClient: ethClient,
challengerCfg: challengerCfg,

Expand Down Expand Up @@ -185,7 +186,7 @@ func (f *DisputeGameFactory) WaitForGame() *FaultDisputeGame {
}

func (f *DisputeGameFactory) StartSuperCannonGame(eoa *dsl.EOA, opts ...GameOpt) *SuperFaultDisputeGame {
f.require.NotNil(f.superRoots, "super roots source is required to start super games")
f.require.NotNil(f.superNode, "super node is required to start super games")

return f.startSuperCannonGameOfType(eoa, gameTypes.SuperCannonGameType, opts...)
}
Expand All @@ -198,7 +199,8 @@ func (f *DisputeGameFactory) startSuperCannonGameOfType(eoa *dsl.EOA, gameType g
}
timestamp := cfg.l2SequenceNumber
if !cfg.l2SequenceNumberSet {
timestamp = f.superRoots.SafeTimestamp()
f.t.Error("Can't retrieve safe timestamp from super node yet")
f.t.FailNow()
}
extraData := f.createSuperGameExtraData(timestamp, cfg)
rootClaim := cfg.rootClaim
Expand All @@ -211,11 +213,15 @@ func (f *DisputeGameFactory) startSuperCannonGameOfType(eoa *dsl.EOA, gameType g
}

func (f *DisputeGameFactory) createSuperGameExtraData(timestamp uint64, cfg *GameCfg) []byte {
f.require.NotNil(f.superRoots, "super roots is required create super games")
f.require.NotNil(f.superNode, "super node is required create super games")
if !cfg.allowFuture {
f.superRoots.AwaitMinVerifiedTimestamp(timestamp)
f.awaitMinVerifiedTimestamp(timestamp)
}
superV1 := f.superRoots.SuperV1AtTimestamp(timestamp)
resp, err := f.superNode.QueryAPI().SuperRootAtTimestamp(f.t.Ctx(), timestamp)
f.require.NoError(err, "Failed to fetch super root at timestamp")
f.require.NotNil(resp.Data, "Super root data must be present at timestamp %v", timestamp)
superV1, ok := resp.Data.Super.(*eth.SuperV1)
f.require.Truef(ok, "unsupported super type %T", resp.Data.Super)
if len(cfg.superOutputRoots) != 0 {
f.require.Len(cfg.superOutputRoots, len(superV1.Chains), "Super output roots length mismatch")
for i := range superV1.Chains {
Expand All @@ -226,6 +232,14 @@ func (f *DisputeGameFactory) createSuperGameExtraData(timestamp uint64, cfg *Gam
return extraData
}

func (f *DisputeGameFactory) awaitMinVerifiedTimestamp(timestamp uint64) {
f.t.Require().Eventually(func() bool {
resp, err := f.superNode.QueryAPI().SuperRootAtTimestamp(f.t.Ctx(), timestamp)
f.require.NoError(err, "Failed to fetch supernode status (superroot_atTimestamp)")
return resp.Data != nil
}, 2*time.Minute, 1*time.Second)
}

func (f *DisputeGameFactory) StartCannonGame(eoa *dsl.EOA, opts ...GameOpt) *FaultDisputeGame {
return f.startOutputRootGameOfType(eoa, gameTypes.CannonGameType, f.honestTraceForGame, opts...)
}
Expand Down
90 changes: 0 additions & 90 deletions op-devstack/dsl/proofs/super_roots_source.go

This file was deleted.

3 changes: 2 additions & 1 deletion op-devstack/presets/interop.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ func (s *SimpleInterop) L2Networks() []*dsl.L2Network {
}

func (s *SimpleInterop) DisputeGameFactory() *proofs.DisputeGameFactory {
return proofs.NewDisputeGameFactory(s.T, s.L1Network, s.L1EL.EthClient(), s.L2ChainA.DisputeGameFactoryProxyAddr(), nil, nil, proofs.NewSuperRootsFromSupervisor(s.Supervisor), nil)
var superNode stack.Supernode // System doesn't currently track super nodes so we can't get one.
return proofs.NewDisputeGameFactory(s.T, s.L1Network, s.L1EL.EthClient(), s.L2ChainA.DisputeGameFactoryProxyAddr(), nil, nil, superNode, nil)
}

func (s *SingleChainInterop) StandardBridge(l2Chain *dsl.L2Network) *dsl.StandardBridge {
Expand Down