@@ -5,6 +5,7 @@ import { EthAddress } from '@aztec/aztec.js/addresses';
55import { waitForProven } from '@aztec/aztec.js/contracts' ;
66import { generateClaimSecret } from '@aztec/aztec.js/ethereum' ;
77import { Fr } from '@aztec/aztec.js/fields' ;
8+ import { waitForL1ToL2MessageReady } from '@aztec/aztec.js/messaging' ;
89import { RollupCheatCodes } from '@aztec/aztec/testing' ;
910import { FeeAssetHandlerContract , RegistryContract , RollupContract } from '@aztec/ethereum/contracts' ;
1011import { deployRollupForUpgrade } from '@aztec/ethereum/deploy-aztec-l1-contracts' ;
@@ -13,6 +14,7 @@ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses'
1314import { L1TxUtils , createL1TxUtils } from '@aztec/ethereum/l1-tx-utils' ;
1415import type { ExtendedViemWalletClient } from '@aztec/ethereum/types' ;
1516import { CheckpointNumber , EpochNumber , SlotNumber } from '@aztec/foundation/branded-types' ;
17+ import { retryUntil } from '@aztec/foundation/retry' ;
1618import { sleep } from '@aztec/foundation/sleep' ;
1719import {
1820 GovernanceAbi ,
@@ -42,7 +44,6 @@ import { shouldCollectMetrics } from '../fixtures/fixtures.js';
4244import { sendL1ToL2Message } from '../fixtures/l1_to_l2_messaging.js' ;
4345import { ATTESTER_PRIVATE_KEYS_START_INDEX , createNodes , createProverNode } from '../fixtures/setup_p2p_test.js' ;
4446import { setupSharedBlobStorage } from '../fixtures/utils.js' ;
45- import { waitForL1ToL2MessageSeen } from '../shared/wait_for_l1_to_l2_message.js' ;
4647import { TestWallet } from '../test-wallet/test_wallet.js' ;
4748import { P2PNetworkTest , SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES } from './p2p_network.js' ;
4849
@@ -53,7 +54,7 @@ const BOOT_NODE_UDP_PORT = 4500;
5354const DATA_DIR = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'add-rollup-old-' ) ) ;
5455const DATA_DIR_NEW = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'add-rollup-new-' ) ) ;
5556
56- jest . setTimeout ( 1000 * 60 * 10 ) ;
57+ jest . setTimeout ( 1000 * 60 * 20 ) ;
5758
5859/**
5960 * This test emulates the addition of a new rollup to the registry and tests that cross-chain messages work.
@@ -80,6 +81,14 @@ describe('e2e_p2p_add_rollup', () => {
8081 ...SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES ,
8182 listenAddress : '127.0.0.1' ,
8283 governanceProposerRoundSize : 10 ,
84+ enableProposerPipelining : true ,
85+ // Allow validators to build empty checkpoints under pipelining so the chain keeps
86+ // advancing while we wait for L1->L2 messages to land in the next checkpoint's inbox tree.
87+ minTxsPerBlock : 0 ,
88+ // Pipelining starts cycle for checkpoint N+1 during slot N, but the inbox tree for
89+ // checkpoint N is only sealed when checkpoint N is published. inboxLag: 2 sources
90+ // L1->L2 messages from checkpoint N-1 (already sealed), avoiding L1ToL2MessagesNotReadyError.
91+ inboxLag : 2 ,
8392 } ,
8493 startProverNode : false , // Start one later using p2p.
8594 } ) ;
@@ -307,7 +316,10 @@ describe('e2e_p2p_add_rollup', () => {
307316 } ) ;
308317
309318 const makeMessageConsumable = async ( msgHash : Fr ) => {
310- await waitForL1ToL2MessageSeen ( node , msgHash , { timeoutSeconds : 10 } ) ;
319+ // Wait until the message is ready to be consumed (the rollup has reached the message's checkpoint).
320+ // Using waitForL1ToL2MessageReady rather than isL1ToL2MessageSynced because with `inboxLag > 0`
321+ // a synced message is not yet present in the latest checkpoint's inbox tree.
322+ await waitForL1ToL2MessageReady ( node , msgHash , { timeoutSeconds : 120 } ) ;
311323
312324 const { receipt } = await testContract . methods
313325 . create_l2_to_l1_message_arbitrary_recipient_private ( contentOutFromRollup , ethRecipient )
@@ -578,6 +590,21 @@ describe('e2e_p2p_add_rollup', () => {
578590 // The new rollup should have no checkpoints
579591 expect ( await newRollup . getCheckpointNumber ( ) ) . toBe ( CheckpointNumber ( 0 ) ) ;
580592
593+ // Wait for the new rollup to publish its first checkpoint AND for `nodes[0]` to have synced
594+ // it locally, before the second bridging step. The bridge wallet uses
595+ // `syncChainTip: 'checkpointed'`, which falls back to the genesis block when no checkpoint
596+ // exists. After warping ~500 epochs forward, txs anchored at genesis would expire before
597+ // being included. We poll the node's local view (not just the L1 rollup contract) so the PXE
598+ // and the assertion observe the same chain state.
599+ t . logger . info ( `Waiting for new rollup to publish its first checkpoint` ) ;
600+ await retryUntil (
601+ async ( ) => Number ( await nodes [ 0 ] . getCheckpointNumber ( 'checkpointed' ) ) > 0 ,
602+ 'newRollup first checkpoint synced by node' ,
603+ 300 ,
604+ 2 ,
605+ ) ;
606+ t . logger . info ( `New rollup published its first checkpoint` ) ;
607+
581608 // Bridge into and out of the new rollup to ensure that it works.
582609 await bridging (
583610 nodes [ 0 ] ,
0 commit comments