Skip to content

Commit 6022263

Browse files
committed
refactor(fast-inbox): TXE pads L1-to-L2 bundle only for first-in-checkpoint blocks (A-1380)
Align the TXE world-state caller with the per-block message-insertion semantics of handleL2BlockAndMessages: pad the bundle only when the block is first in its checkpoint, matching native world state. TXE mines one block per checkpoint (always the first block), so this is a no-op for current behaviour but keeps the caller consistent with the new per-block shape.
1 parent 95ba308 commit 6022263

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

yarn-project/txe/src/state_machine/synchronizer.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@ export class TXESynchronizer implements WorldStateSynchronizer {
3535
}
3636

3737
public async handleL2Block(block: L2Block, l1ToL2Messages: Fr[] = []) {
38-
await this.nativeWorldStateService.handleL2BlockAndMessages(
39-
block,
40-
padArrayEnd<Fr, number>(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
41-
);
38+
// Pad the bundle only for a first-in-checkpoint block, matching how the circuits (and native world state) build the
39+
// message tree. TXE mines one block per checkpoint, so this is always the first block, but keep the condition
40+
// explicit so the caller matches the per-block message-insertion semantics of handleL2BlockAndMessages.
41+
const messages =
42+
block.indexWithinCheckpoint === 0
43+
? padArrayEnd<Fr, number>(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP)
44+
: l1ToL2Messages;
45+
await this.nativeWorldStateService.handleL2BlockAndMessages(block, messages);
4246

4347
this.blockNumber = block.header.globalVariables.blockNumber;
4448
}

0 commit comments

Comments
 (0)