@@ -17,6 +17,8 @@ import (
17
17
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/disputegame"
18
18
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/disputegame/preimage"
19
19
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/wait"
20
+ "github.com/ethereum-optimism/optimism/op-e2e/interop"
21
+ "github.com/ethereum-optimism/optimism/op-service/eth"
20
22
"github.com/ethereum-optimism/optimism/op-service/sources/batching/rpcblock"
21
23
"github.com/ethereum/go-ethereum/common"
22
24
"github.com/ethereum/go-ethereum/common/hexutil"
@@ -248,10 +250,12 @@ func TestSuperCannonStepWithPreimage(t *testing.T) {
248
250
// So we don't waste time resolving the game - that's tested elsewhere.
249
251
}
250
252
251
- // TODO(#15311): Add blob preimage test case
252
- preimageConditions := []string {"keccak" , "sha256" }
253
+ preimageConditions := []string {"keccak" , "sha256" , "blob" }
253
254
for _ , preimageType := range preimageConditions {
254
255
preimageType := preimageType
256
+ if preimageType == "blob" || preimageType == "sha256" {
257
+ t .Skip ("TODO(#15311): Add blob preimage test case. sha256 is also used for blobs" )
258
+ }
255
259
t .Run ("non-existing preimage-" + preimageType , func (t * testing.T ) {
256
260
testPreimageStep (t , utils .FirstPreimageLoadOfType (preimageType ), false )
257
261
})
@@ -311,6 +315,7 @@ func TestSuperCannonRootChangeClaimedRoot(t *testing.T) {
311
315
}
312
316
313
317
func TestSuperInvalidateUnsafeProposal (t * testing.T ) {
318
+ t .Skip ("TODO(#15321): Challenger does not respond to unsafe proposals" )
314
319
op_e2e .InitParallel (t , op_e2e .UsesCannon )
315
320
ctx := context .Background ()
316
321
tests := []struct {
@@ -342,10 +347,33 @@ func TestSuperInvalidateUnsafeProposal(t *testing.T) {
342
347
t .Run (test .name , func (t * testing.T ) {
343
348
op_e2e .InitParallel (t , op_e2e .UsesCannon )
344
349
345
- timestamp := uint64 (1 )
346
350
sys , disputeGameFactory , _ := StartInteropFaultDisputeSystem (t , WithAllocType (config .AllocTypeMTCannon ))
351
+
352
+ client := sys .SupervisorClient ()
353
+ status , err := client .SyncStatus (ctx )
354
+ require .NoError (t , err , "Failed to get sync status" )
355
+ // Ensure that the superchain has progressed a bit past the genesis timestamp
356
+ disputeGameFactory .WaitForSuperTimestamp (status .SafeTimestamp + 4 , & disputegame.GameCfg {})
357
+ // halt the safe chain
358
+ for _ , id := range sys .L2IDs () {
359
+ require .NoError (t , sys .Batcher (id ).Stop (ctx ))
360
+ }
361
+
362
+ status , err = client .SyncStatus (ctx )
363
+ require .NoError (t , err , "Failed to get sync status" )
364
+
365
+ // Wait for any client to advance its unsafe head past the safe chain. We know this head will remain unsafe since the batc
366
+ l2Client := sys .L2GethClient (sys .L2IDs ()[0 ], "sequencer" )
367
+ wait .ForNextBlock (ctx , l2Client )
368
+ head , err := l2Client .BlockByNumber (ctx , nil )
369
+ require .NoError (t , err , "Failed to get head block" )
370
+ unsafeTimestamp := head .Time ()
371
+
347
372
// Root claim is _dishonest_ because the required data is not available on L1
348
- game := disputeGameFactory .StartSuperCannonGameWithCorrectRootAtTimestamp (ctx , timestamp , disputegame .WithUnsafeProposal ())
373
+ unsafeSuper := createSuperRoot (t , ctx , sys , unsafeTimestamp )
374
+ unsafeRoot := eth .SuperRoot (unsafeSuper )
375
+ game := disputeGameFactory .StartSuperCannonGameAtTimestamp (ctx , unsafeTimestamp , common .Hash (unsafeRoot ), disputegame .WithFutureProposal ())
376
+
349
377
correctTrace := game .CreateHonestActor (ctx , disputegame .WithPrivKey (malloryKey (t )), func (c * disputegame.HonestActorConfig ) {
350
378
c .ChallengerOpts = append (c .ChallengerOpts , challenger .WithDepset (t , sys .DependencySet ()))
351
379
})
@@ -661,3 +689,28 @@ func TestSuperCannonGame_HonestCallsSteps(t *testing.T) {
661
689
require .NoError (t , wait .ForNextBlock (ctx , sys .L1GethClient ()))
662
690
game .WaitForGameStatus (ctx , gameTypes .GameStatusDefenderWon )
663
691
}
692
+
693
+ func createSuperRoot (t * testing.T , ctx context.Context , sys interop.SuperSystem , timestamp uint64 ) * eth.SuperV1 {
694
+ chains := make (map [eth.ChainID ]eth.Bytes32 )
695
+ for _ , id := range sys .L2IDs () {
696
+ rollupCfg := sys .RollupConfig (id )
697
+ blockNum , err := rollupCfg .TargetBlockNumber (timestamp )
698
+ t .Logf ("Target block number for timestamp %v (%v): %v" , timestamp , rollupCfg .L2ChainID , blockNum )
699
+ require .NoError (t , err )
700
+
701
+ client := sys .L2RollupClient (id , "sequencer" )
702
+ output , err := client .OutputAtBlock (ctx , blockNum )
703
+ require .NoError (t , err )
704
+ chains [eth .ChainIDFromBig (rollupCfg .L2ChainID )] = output .OutputRoot
705
+ }
706
+
707
+ var output eth.SuperV1
708
+ for _ , chainID := range sys .DependencySet ().Chains () {
709
+ output .Chains = append (output .Chains , eth.ChainIDAndOutput {
710
+ ChainID : chainID ,
711
+ Output : chains [chainID ],
712
+ })
713
+ }
714
+ output .Timestamp = timestamp
715
+ return & output
716
+ }
0 commit comments