Skip to content

Commit c32de25

Browse files
committed
test(fast-inbox): gate L1->L2 message readiness on the PXE sync tip (A-1384)
The shared cross-chain readiness helper evaluated isL1ToL2MessageReady against the default 'latest' tip while these suites anchor the PXE to 'checkpointed'. With per-block inbox insertion the proposed chain reaches a message's consume-checkpoint before that checkpoint is published, so readiness flipped true a checkpoint early and the private consume simulated against a PXE that had not yet synced the message. Gate readiness on the configured PXE sync tip instead.
1 parent a17dce8 commit c32de25

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

yarn-project/end-to-end/src/single-node/cross-chain/cross_chain_messaging_test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { TestERC20Abi, TestERC20Bytecode, TokenPortalAbi, TokenPortalBytecode }
2121
import { TokenContract } from '@aztec/noir-contracts.js/Token';
2222
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
2323
import type { PXEConfig } from '@aztec/pxe/server';
24+
import type { BlockTag } from '@aztec/stdlib/block';
2425
import { getEpochAtSlot } from '@aztec/stdlib/epoch-helpers';
2526
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
2627

@@ -109,6 +110,17 @@ export class CrossChainMessagingTest extends SingleNodeTestContext {
109110
this.requireEpochProven = opts.startProverNode ?? false;
110111
}
111112

113+
/**
114+
* Chain tip the PXE syncs to. L1→L2 message readiness must be evaluated against this tip rather than
115+
* the default `'latest'`: with per-block inbox insertion the proposed chain reaches a message's
116+
* checkpoint before that checkpoint is published, so a `'latest'` readiness check flips true while a
117+
* PXE anchored to `'checkpointed'` (or `'proven'`) has not yet synced the block the consuming tx will
118+
* anchor to. Defaults to `'latest'` so suites that do not pin a sync tip keep their semantics.
119+
*/
120+
get pxeSyncChainTip(): BlockTag {
121+
return this.pxeOpts.syncChainTip ?? 'latest';
122+
}
123+
112124
override async setup(opts: SingleNodeTestOpts = {}, pxeOpts: Partial<PXEConfig> = {}) {
113125
this.logger.info('Setting up cross chain messaging test');
114126
// Recompute requireEpochProven from the merged options so per-call startProverNode is honored.

yarn-project/end-to-end/src/single-node/cross-chain/message_test_helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export function createL1ToL2MessageHelpers(deps: L1ToL2MessageHelperDeps): L1ToL
107107
aztecNode.getCheckpointNumber(),
108108
]);
109109
const witness = await aztecNode.getL1ToL2MessageMembershipWitness('latest', msgHash);
110-
const isReady = await isL1ToL2MessageReady(aztecNode, msgHash);
110+
const isReady = await isL1ToL2MessageReady(aztecNode, msgHash, t.pxeSyncChainTip);
111111
log.info(
112112
`Block is ${blockNumber}, checkpoint is ${checkpointNumber}. Message checkpoint is ${msgCheckpoint}. Witness ${!!witness}. Ready ${isReady}.`,
113113
);

0 commit comments

Comments
 (0)