Skip to content

Commit 4b91fa1

Browse files
committed
test(fast-inbox): drop pre-flip L1-to-L2 message tests from the world-state synchronizer suite (A-1384)
The flip makes streaming the only consumption path: messages derive per-block from the Inbox rather than being attached to the first block of a checkpoint, and non-first blocks may carry messages. The two transitional tests (first-block-only message fetch, non-first- block rejection) and their now-unused mock/helper no longer reflect the behavior and fail. Removes them, matching the up-stack cleanup.
1 parent bffc4a3 commit 4b91fa1

1 file changed

Lines changed: 1 addition & 47 deletions

File tree

yarn-project/world-state/src/synchronizer/server_world_state_synchronizer.test.ts

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BlockNumber, CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
1+
import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
22
import { timesParallel } from '@aztec/foundation/collection';
33
import { Fr } from '@aztec/foundation/curves/bn254';
44
import { type Logger, createLogger } from '@aztec/foundation/log';
@@ -51,9 +51,6 @@ describe('ServerWorldStateSynchronizer', () => {
5151
beforeEach(() => {
5252
blockAndMessagesSource = mock<L2BlockSource & L1ToL2MessageSource>();
5353
blockAndMessagesSource.getBlockNumber.mockResolvedValue(BlockNumber(LATEST_BLOCK_NUMBER));
54-
blockAndMessagesSource.getL1ToL2Messages.mockImplementation(checkNumber => {
55-
return Promise.resolve(checkpoints.find(c => c.checkpoint.number === checkNumber)?.messages ?? []);
56-
});
5754

5855
merkleTreeRead = mock<MerkleTreeReadOperations>();
5956
merkleTreeRead.getInitialHeader.mockReturnValue({
@@ -251,45 +248,6 @@ describe('ServerWorldStateSynchronizer', () => {
251248
await expect(pushBlocks(1, 5)).rejects.toThrow(/Test error/i);
252249
});
253250

254-
it('fetches L1->L2 messages only for the first block in a checkpoint', async () => {
255-
// Generate 3 mock checkpoints, each with i + 1 block and i + 2 message.
256-
checkpoints = await timesParallel(3, i =>
257-
mockCheckpointAndMessages(CheckpointNumber(i + 1), {
258-
startBlockNumber: BlockNumber(
259-
Array(i + 1)
260-
.fill(0)
261-
.reduce((acc, _, index) => acc + index, 1),
262-
),
263-
numBlocks: i + 1,
264-
numL1ToL2Messages: i + 2,
265-
}),
266-
);
267-
268-
void server.start();
269-
await pushBlocks(1, 6);
270-
271-
await expectServerStatus(WorldStateRunningState.RUNNING, 6);
272-
273-
expect(merkleTreeDb.handleL2BlockAndMessages).toHaveBeenCalledTimes(6);
274-
expect(merkleTreeDb.handleL2BlockAndMessages.mock.calls[0][1]).toEqual(checkpoints[0].messages);
275-
expect(merkleTreeDb.handleL2BlockAndMessages.mock.calls[1][1]).toEqual(checkpoints[1].messages);
276-
expect(merkleTreeDb.handleL2BlockAndMessages.mock.calls[2][1]).toEqual([]);
277-
expect(merkleTreeDb.handleL2BlockAndMessages.mock.calls[3][1]).toEqual(checkpoints[2].messages);
278-
expect(merkleTreeDb.handleL2BlockAndMessages.mock.calls[4][1]).toEqual([]);
279-
expect(merkleTreeDb.handleL2BlockAndMessages.mock.calls[5][1]).toEqual([]);
280-
});
281-
282-
it('rejects a non-first block that carries L1->L2 messages (transitional invariant)', async () => {
283-
// World state accepts a bundle on any block, but pre-flip the synchronizer must only attach messages to the first
284-
// block of a checkpoint. The call-site guard enforces that until the flip switches to per-block derivation.
285-
const nonFirstBlock = await L2Block.random(BlockNumber(2), { indexWithinCheckpoint: IndexWithinCheckpoint(1) });
286-
287-
await expect(server.callHandleL2Block(nonFirstBlock, [Fr.random()])).rejects.toThrow(
288-
'L1 to L2 messages must be empty for non-first blocks',
289-
);
290-
expect(merkleTreeDb.handleL2BlockAndMessages).not.toHaveBeenCalled();
291-
});
292-
293251
describe('getVerifiedSnapshot', () => {
294252
let snapshot: MockProxy<MerkleTreeReadOperations>;
295253

@@ -366,10 +324,6 @@ class TestWorldStateSynchronizer extends ServerWorldStateSynchronizer {
366324
return this.mockBlockStream;
367325
}
368326

369-
public callHandleL2Block(block: L2Block, messages: Fr[]) {
370-
return this.handleL2Block(block, messages);
371-
}
372-
373327
public override getL2Tips() {
374328
return Promise.resolve({
375329
proposed: this.latest,

0 commit comments

Comments
 (0)