diff --git a/yarn-project/end-to-end/src/e2e_block_building.test.ts b/yarn-project/end-to-end/src/e2e_block_building.test.ts index 4385c888c12..6a2ed021376 100644 --- a/yarn-project/end-to-end/src/e2e_block_building.test.ts +++ b/yarn-project/end-to-end/src/e2e_block_building.test.ts @@ -193,7 +193,7 @@ describe('e2e_block_building', () => { logger.info(`Updating aztec node config`); await aztecNode.setConfig({ minTxsPerBlock: 1, maxTxsPerBlock: TX_COUNT, enforceTimeTable: true }); - // We tweak the sequencer so it uses a fake simulator that adds a 200ms delay to every public tx. + // We tweak the sequencer so it uses a fake simulator that adds a delay to every public tx. const archiver = (aztecNode as AztecNodeService).getContractDataSource(); sequencer.sequencer.publicProcessorFactory = new TestPublicProcessorFactory( archiver, @@ -202,11 +202,13 @@ describe('e2e_block_building', () => { ); // We also cheat the sequencer's timetable so it allocates little time to processing. - // This will leave the sequencer with just 2s to build the block, so it shouldn't be - // able to squeeze in more than 10 txs in each. This is sensitive to the time it takes - // to pick up and validate the txs, so we may need to bump it to work on CI. - sequencer.sequencer.timeTable[SequencerState.WAITING_FOR_TXS] = 2; - sequencer.sequencer.timeTable[SequencerState.CREATING_BLOCK] = 2; + // This will leave the sequencer with just a few seconds to build the block, so it shouldn't + // be able to squeeze in more than ~12 txs in each. This is sensitive to the time it takes + // to pick up and validate the txs, so we may need to bump it to work on CI. Note that we need + // at least 3s here so the archiver has time to loop once and sync, and the sequencer has at + // least 1s to loop. + sequencer.sequencer.timeTable[SequencerState.WAITING_FOR_TXS] = 4; + sequencer.sequencer.timeTable[SequencerState.CREATING_BLOCK] = 4; sequencer.sequencer.processTxTime = 1; // Flood the mempool with TX_COUNT simultaneous txs @@ -615,9 +617,11 @@ type TestSequencer = Omit & { }; type TestSequencerClient = Omit & { sequencer: TestSequencer }; +const TEST_PUBLIC_TX_SIMULATION_DELAY_MS = 300; + class TestPublicTxSimulator extends PublicTxSimulator { public override async simulate(tx: Tx): Promise { - await sleep(200); + await sleep(TEST_PUBLIC_TX_SIMULATION_DELAY_MS); return super.simulate(tx); } } diff --git a/yarn-project/sequencer-client/src/sequencer/sequencer.test.ts b/yarn-project/sequencer-client/src/sequencer/sequencer.test.ts index b1a02401450..f45e80ed260 100644 --- a/yarn-project/sequencer-client/src/sequencer/sequencer.test.ts +++ b/yarn-project/sequencer-client/src/sequencer/sequencer.test.ts @@ -257,7 +257,7 @@ describe('sequencer', () => { await expect(sequencer.doRealWork()).rejects.toThrow( expect.objectContaining({ name: 'SequencerTooSlowError', - message: expect.stringContaining(`Too far into slot to transition to ${delayedState}.`), + message: expect.stringContaining(`Too far into slot to transition to ${delayedState}`), }), ); diff --git a/yarn-project/sequencer-client/src/sequencer/sequencer.ts b/yarn-project/sequencer-client/src/sequencer/sequencer.ts index 9f758c456cc..cedd98abfcf 100644 --- a/yarn-project/sequencer-client/src/sequencer/sequencer.ts +++ b/yarn-project/sequencer-client/src/sequencer/sequencer.ts @@ -60,7 +60,7 @@ export class SequencerTooSlowError extends Error { public readonly currentTime: number, ) { super( - `Too far into slot to transition to ${proposedState}. max allowed: ${maxAllowedTime}s, time into slot: ${currentTime}s`, + `Too far into slot to transition to ${proposedState} (max allowed: ${maxAllowedTime}s, time into slot: ${currentTime}s)`, ); this.name = 'SequencerTooSlowError'; } @@ -172,10 +172,10 @@ export class Sequencer { private setTimeTable() { // How late into the slot can we be to start working - const initialTime = 1; + const initialTime = 2; // How long it takes to validate the txs collected and get ready to start building - const blockPrepareTime = 2; + const blockPrepareTime = 1; // How long it takes to for attestations to travel across the p2p layer. const attestationPropagationTime = 2; @@ -430,7 +430,7 @@ export class Sequencer { const bufferSeconds = maxAllowedTime - secondsIntoSlot; if (bufferSeconds < 0) { - this.log.warn(`Too far into slot to transition to ${proposedState}`, { maxAllowedTime, secondsIntoSlot }); + this.log.debug(`Too far into slot to transition to ${proposedState}`, { maxAllowedTime, secondsIntoSlot }); return false; }