@@ -452,6 +452,81 @@ func TestInteropFaultProofs_CascadeInvalidBlock(gt *testing.T) {
452452 runFppAndChallengerTests (gt , system , tests )
453453}
454454
455+ func TestInteropFaultProofs_MessageExpiry (gt * testing.T ) {
456+ t := helpers .NewDefaultTesting (gt )
457+ // TODO(#14234): Check message expiry in op-supervisor
458+ t .Skip ("Message expiry not yet implemented" )
459+
460+ system := dsl .NewInteropDSL (t )
461+
462+ actors := system .Actors
463+ alice := system .CreateUser ()
464+ emitterContract := dsl .NewEmitterContract (t )
465+ system .AddL2Block (actors .ChainA , dsl .WithL2BlockTransactions (
466+ emitterContract .Deploy (alice ),
467+ ))
468+ system .AddL2Block (actors .ChainA , dsl .WithL2BlockTransactions (
469+ emitterContract .EmitMessage (alice , "test message" ),
470+ ))
471+ emitTx := emitterContract .LastEmittedMessage ()
472+
473+ // Bring ChainB to the same height and timestamp
474+ system .AddL2Block (actors .ChainB , dsl .WithL2BlocksUntilTimestamp (actors .ChainA .Sequencer .L2Unsafe ().Time ))
475+ system .SubmitBatchData ()
476+
477+ // Advance the chain until the init msg expires
478+ msgExpiryTime := actors .ChainA .RollupCfg .GetMessageExpiryTimeInterop ()
479+ end := emitTx .Identifier ().Timestamp .Uint64 () + msgExpiryTime
480+ system .AddL2Block (actors .ChainA , dsl .WithL2BlocksUntilTimestamp (end ))
481+ system .AddL2Block (actors .ChainB , dsl .WithL2BlocksUntilTimestamp (end ))
482+ system .SubmitBatchData ()
483+
484+ system .AddL2Block (actors .ChainB , func (opts * dsl.AddL2BlockOpts ) {
485+ opts .TransactionCreators = []dsl.TransactionCreator {system .InboxContract .Execute (alice , emitTx .Identifier (), emitTx .MessagePayload ())}
486+ opts .BlockIsNotCrossUnsafe = true
487+ })
488+ system .AddL2Block (actors .ChainA )
489+
490+ system .SubmitBatchData (func (opts * dsl.SubmitBatchDataOpts ) {
491+ opts .SkipCrossSafeUpdate = true
492+ })
493+ execTx := system .InboxContract .LastTransaction ()
494+ execTx .CheckIncluded ()
495+
496+ endTimestamp := actors .ChainB .Sequencer .L2Unsafe ().Time
497+ startTimestamp := endTimestamp - 1
498+ optimisticEnd := system .Outputs .SuperRoot (endTimestamp )
499+
500+ preConsolidation := system .Outputs .TransitionState (startTimestamp , 1023 ,
501+ system .Outputs .OptimisticBlockAtTimestamp (actors .ChainA , endTimestamp ),
502+ system .Outputs .OptimisticBlockAtTimestamp (actors .ChainB , endTimestamp ),
503+ ).Marshal ()
504+
505+ // Induce block replacement
506+ system .ProcessCrossSafe ()
507+ // assert that the invalid message txs were reorged out
508+ execTx .CheckNotIncluded ()
509+ crossSafeEnd := system .Outputs .SuperRoot (endTimestamp )
510+
511+ tests := []* transitionTest {
512+ {
513+ name : "Consolidate-ExpectInvalidPendingBlock" ,
514+ agreedClaim : preConsolidation ,
515+ disputedClaim : optimisticEnd .Marshal (),
516+ disputedTraceIndex : 1023 ,
517+ expectValid : false ,
518+ },
519+ {
520+ name : "Consolidate-ReplaceInvalidBlocks" ,
521+ agreedClaim : preConsolidation ,
522+ disputedClaim : crossSafeEnd .Marshal (),
523+ disputedTraceIndex : 1023 ,
524+ expectValid : true ,
525+ },
526+ }
527+ runFppAndChallengerTests (gt , system , tests )
528+ }
529+
455530func TestInteropFaultProofsInvalidBlock (gt * testing.T ) {
456531 t := helpers .NewDefaultTesting (gt )
457532
0 commit comments