@@ -40,6 +40,7 @@ describe('e2e_epochs/epochs_l1_reorgs', () => {
4040 test = await EpochsTestContext . setup ( {
4141 maxSpeedUpAttempts : 0 , // Do not speed up l1 txs, we dont want them to land
4242 cancelTxOnTimeout : false ,
43+ aztecEpochDuration : 8 , // Bump epoch duration, epoch 0 is finishing before we had a chance to do anything
4344 ethereumSlotDuration : process . env . L1_BLOCK_TIME ? parseInt ( process . env . L1_BLOCK_TIME ) : 4 , // Got to speed these tests up for CI
4445 } ) ;
4546 ( { proverDelayer, sequencerDelayer, context, logger, monitor, L1_BLOCK_TIME_IN_S , L2_SLOT_DURATION_IN_S } = test ) ;
@@ -110,8 +111,8 @@ describe('e2e_epochs/epochs_l1_reorgs', () => {
110111
111112 // And check that the old node has processed the reorg as well
112113 logger . warn ( `Testing old node after reorg` ) ;
113- expect ( await node . getProvenBlockNumber ( ) ) . toEqual ( 0 ) ;
114- expect ( await node . getBlockNumber ( ) ) . toBeWithin ( currentBlock - 1 , currentBlock + 1 ) ;
114+ await retryUntil ( ( ) => node . getProvenBlockNumber ( ) . then ( b => b === 0 ) , 'prune' , L2_SLOT_DURATION_IN_S * 4 , 0.1 ) ;
115+ expect ( await node . getBlockNumber ( ) ) . toBeWithin ( monitor . l2BlockNumber - 1 , monitor . l2BlockNumber + 1 ) ;
115116
116117 logger . warn ( `Test succeeded` ) ;
117118 await newNode . stop ( ) ;
@@ -123,26 +124,25 @@ describe('e2e_epochs/epochs_l1_reorgs', () => {
123124 const provenBlock = await test . waitUntilProvenL2BlockNumber ( 1 ) ;
124125 await retryUntil ( ( ) => node . getProvenBlockNumber ( ) . then ( p => p >= provenBlock ) , 'node sync' , 10 , 0.1 ) ;
125126
127+ // Stop the prover node
128+ await proverNode . stop ( ) ;
129+
126130 // Remove the proof from L1 but do not change the block number
127131 await context . cheatCodes . eth . reorgWithReplacement ( 1 ) ;
128132 await expect ( monitor . run ( true ) . then ( m => m . l2ProvenBlockNumber ) ) . resolves . toEqual ( 0 ) ;
129133
130- // Create another prover node so it submits a proof
131- await test . createProverNode ( ) ;
132-
133- // Wait until the end of the proof submission window for the first epoch
134- await test . waitUntilLastSlotOfProofSubmissionWindow ( 0 ) ;
135-
136- // And expect that the other node has submitted a proof
134+ // Create another prover node so it submits a proof and wait until it is submitted
135+ const newProverNode = await test . createProverNode ( ) ;
136+ const provenBlockRetry = await test . waitUntilProvenL2BlockNumber ( 1 ) ;
137137 await expect ( monitor . run ( true ) . then ( m => m . l2ProvenBlockNumber ) ) . resolves . toBeGreaterThanOrEqual ( 1 ) ;
138138
139139 // Check that the node has followed along
140140 logger . warn ( `Testing old node` ) ;
141- const currentBlock = monitor . l2BlockNumber ;
142- expect ( await node . getProvenBlockNumber ( ) ) . toBeGreaterThanOrEqual ( 1 ) ;
143- expect ( await node . getBlockNumber ( ) ) . toBeWithin ( currentBlock - 1 , currentBlock + 1 ) ;
141+ await retryUntil ( ( ) => node . getProvenBlockNumber ( ) . then ( b => b >= provenBlockRetry ) , 'proof sync' , 10 , 0.1 ) ;
142+ expect ( await node . getBlockNumber ( ) ) . toBeWithin ( monitor . l2BlockNumber - 1 , monitor . l2BlockNumber + 1 ) ;
144143
145144 logger . warn ( `Test succeeded` ) ;
145+ await newProverNode . stop ( ) ;
146146 } ) ;
147147
148148 it ( 'restores L2 blocks if a proof is added due to an L1 reorg' , async ( ) => {
0 commit comments