Skip to content

Commit 4d20c57

Browse files
committed
feat: Handle multiple blocks per slot in timetable
Also includes a refactor of the sequencer, checkpoint proposal job, and timetable unit tests, as well as a README with how block building works now within a slot.
1 parent 331b458 commit 4d20c57

File tree

17 files changed

+2229
-926
lines changed

17 files changed

+2229
-926
lines changed

yarn-project/archiver/src/test/mock_l2_block_source.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
1010
import {
1111
L2Block,
1212
L2BlockHash,
13+
L2BlockNew,
1314
type L2BlockSource,
1415
type L2Tips,
1516
PublishedL2Block,
@@ -105,6 +106,16 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
105106
return Promise.resolve(this.l2Blocks[number - 1]);
106107
}
107108

109+
/**
110+
* Gets an L2 block (new format).
111+
* @param number - The block number to return.
112+
* @returns The requested L2 block.
113+
*/
114+
public getL2BlockNew(number: BlockNumber): Promise<L2BlockNew | undefined> {
115+
const block = this.l2Blocks[number - 1];
116+
return Promise.resolve(block?.toL2Block());
117+
}
118+
108119
/**
109120
* Gets up to `limit` amount of L2 blocks starting from `from`.
110121
* @param from - Number of the first block to return (inclusive).

yarn-project/end-to-end/src/e2e_block_building.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,11 @@ describe('e2e_block_building', () => {
101101
// This will leave the sequencer with just a few seconds to build the block, so it shouldn't
102102
// be able to squeeze in more than a few txs in each. This is sensitive to the time it takes
103103
// to pick up and validate the txs, so we may need to bump it to work on CI.
104-
jest
105-
.spyOn(sequencer.sequencer.timetable, 'getProposerExecTimeEnd')
106-
.mockImplementation((secondsIntoSlot: number) => secondsIntoSlot + 1);
104+
jest.spyOn(sequencer.sequencer.timetable, 'canStartNextBlock').mockImplementation((secondsIntoSlot: number) => ({
105+
canStart: true,
106+
deadline: secondsIntoSlot + 1, // Give only 1 second for building
107+
isLastBlock: true,
108+
}));
107109

108110
// Flood the mempool with TX_COUNT simultaneous txs
109111
const methods = times(TX_COUNT, i => contract.methods.increment_public_value(ownerAddress, i));

0 commit comments

Comments
 (0)