diff --git a/yarn-project/circuit-types/src/interfaces/configs.ts b/yarn-project/circuit-types/src/interfaces/configs.ts index 98c77996484..661e893a450 100644 --- a/yarn-project/circuit-types/src/interfaces/configs.ts +++ b/yarn-project/circuit-types/src/interfaces/configs.ts @@ -20,10 +20,6 @@ export interface SequencerConfig { maxTxsPerBlock?: number; /** The minimum number of txs to include in a block. */ minTxsPerBlock?: number; - /** The minimum number of seconds in-between consecutive blocks. */ - minSecondsBetweenBlocks?: number; - /** The maximum number of seconds in-between consecutive blocks. Sequencer will produce a block with less than minTxsPerBlock once this threshold is reached. */ - maxSecondsBetweenBlocks?: number; /** Recipient of block reward. */ coinbase?: EthAddress; /** Address to receive fees. */ @@ -55,8 +51,6 @@ export const SequencerConfigSchema = z.object({ transactionPollingIntervalMS: z.number().optional(), maxTxsPerBlock: z.number().optional(), minTxsPerBlock: z.number().optional(), - minSecondsBetweenBlocks: z.number().optional(), - maxSecondsBetweenBlocks: z.number().optional(), coinbase: schemas.EthAddress.optional(), feeRecipient: schemas.AztecAddress.optional(), acvmWorkingDirectory: z.string().optional(), diff --git a/yarn-project/foundation/src/config/env_var.ts b/yarn-project/foundation/src/config/env_var.ts index 76c58270b1f..4828878d721 100644 --- a/yarn-project/foundation/src/config/env_var.ts +++ b/yarn-project/foundation/src/config/env_var.ts @@ -137,9 +137,7 @@ export type EnvVar = | 'ROLLUP_CONTRACT_ADDRESS' | 'SEQ_ALLOWED_SETUP_FN' | 'SEQ_MAX_BLOCK_SIZE_IN_BYTES' - | 'SEQ_MAX_SECONDS_BETWEEN_BLOCKS' | 'SEQ_MAX_TX_PER_BLOCK' - | 'SEQ_MIN_SECONDS_BETWEEN_BLOCKS' | 'SEQ_MIN_TX_PER_BLOCK' | 'SEQ_PUBLISH_RETRY_INTERVAL_MS' | 'SEQ_PUBLISHER_PRIVATE_KEY' diff --git a/yarn-project/sequencer-client/src/config.ts b/yarn-project/sequencer-client/src/config.ts index 47f06247b53..795b8f4b564 100644 --- a/yarn-project/sequencer-client/src/config.ts +++ b/yarn-project/sequencer-client/src/config.ts @@ -59,17 +59,6 @@ export const sequencerConfigMappings: ConfigMappingsType = { description: 'The minimum number of txs to include in a block.', ...numberConfigHelper(1), }, - minSecondsBetweenBlocks: { - env: 'SEQ_MIN_SECONDS_BETWEEN_BLOCKS', - description: 'The minimum number of seconds in-between consecutive blocks.', - ...numberConfigHelper(0), - }, - maxSecondsBetweenBlocks: { - env: 'SEQ_MAX_SECONDS_BETWEEN_BLOCKS', - description: - 'The maximum number of seconds in-between consecutive blocks. Sequencer will produce a block with less than minTxsPerBlock once this threshold is reached.', - ...numberConfigHelper(0), - }, coinbase: { env: 'COINBASE', parseEnv: (val: string) => EthAddress.fromString(val), diff --git a/yarn-project/sequencer-client/src/sequencer/sequencer.ts b/yarn-project/sequencer-client/src/sequencer/sequencer.ts index adc3bda49e2..6116485c849 100644 --- a/yarn-project/sequencer-client/src/sequencer/sequencer.ts +++ b/yarn-project/sequencer-client/src/sequencer/sequencer.ts @@ -77,8 +77,6 @@ export class Sequencer { private pollingIntervalMs: number = 1000; private maxTxsPerBlock = 32; private minTxsPerBLock = 1; - private minSecondsBetweenBlocks = 0; - private maxSecondsBetweenBlocks = 0; // TODO: zero values should not be allowed for the following 2 values in PROD private _coinbase = EthAddress.ZERO; private _feeRecipient = AztecAddress.ZERO; @@ -139,12 +137,6 @@ export class Sequencer { if (config.minTxsPerBlock !== undefined) { this.minTxsPerBLock = config.minTxsPerBlock; } - if (config.minSecondsBetweenBlocks !== undefined) { - this.minSecondsBetweenBlocks = config.minSecondsBetweenBlocks; - } - if (config.maxSecondsBetweenBlocks !== undefined) { - this.maxSecondsBetweenBlocks = config.maxSecondsBetweenBlocks; - } if (config.coinbase) { this._coinbase = config.coinbase; } @@ -353,15 +345,6 @@ export class Sequencer { } } - /** Whether to skip the check of min txs per block if more than maxSecondsBetweenBlocks has passed since the previous block. */ - private skipMinTxsPerBlockCheck(historicalHeader: BlockHeader | undefined): boolean { - const lastBlockTime = historicalHeader?.globalVariables.timestamp.toNumber() || 0; - const currentTime = Math.floor(Date.now() / 1000); - const elapsed = currentTime - lastBlockTime; - - return this.maxSecondsBetweenBlocks > 0 && elapsed >= this.maxSecondsBetweenBlocks; - } - async mayProposeBlock(tipArchive: Buffer, proposalBlockNumber: bigint): Promise { // This checks that we can propose, and gives us the slot that we are to propose for try { @@ -444,53 +427,29 @@ export class Sequencer { `Last block mined at ${lastBlockTime} current time is ${currentTime} (elapsed ${elapsedSinceLastBlock})`, ); - // If we haven't hit the maxSecondsBetweenBlocks, we need to have at least minTxsPerBLock txs. - // Do not go forward with new block if not enough time has passed since last block - if (this.minSecondsBetweenBlocks > 0 && elapsedSinceLastBlock < this.minSecondsBetweenBlocks) { + // We need to have at least minTxsPerBLock txs. + if (args.pendingTxsCount != undefined && args.pendingTxsCount < this.minTxsPerBLock) { this.log.verbose( - `Not creating block because not enough time ${this.minSecondsBetweenBlocks} has passed since last block`, + `Not creating block because not enough txs in the pool (got ${args.pendingTxsCount} min ${this.minTxsPerBLock})`, ); return false; } - const skipCheck = this.skipMinTxsPerBlockCheck(historicalHeader); - - // If we haven't hit the maxSecondsBetweenBlocks, we need to have at least minTxsPerBLock txs. - if (args.pendingTxsCount != undefined) { - if (args.pendingTxsCount < this.minTxsPerBLock) { - if (skipCheck) { - this.log.debug( - `Creating block with only ${args.pendingTxsCount} txs as more than ${this.maxSecondsBetweenBlocks}s have passed since last block`, - ); - } else { - this.log.verbose( - `Not creating block because not enough txs in the pool (got ${args.pendingTxsCount} min ${this.minTxsPerBLock})`, - ); - return false; - } - } - } - // Bail if we don't have enough valid txs - if (args.validTxsCount != undefined) { - // Bail if we don't have enough valid txs - if (!skipCheck && args.validTxsCount < this.minTxsPerBLock) { - this.log.verbose( - `Not creating block because not enough valid txs loaded from the pool (got ${args.validTxsCount} min ${this.minTxsPerBLock})`, - ); - return false; - } + if (args.validTxsCount != undefined && args.validTxsCount < this.minTxsPerBLock) { + this.log.verbose( + `Not creating block because not enough valid txs loaded from the pool (got ${args.validTxsCount} min ${this.minTxsPerBLock})`, + ); + return false; } // TODO: This check should be processedTxs.length < this.minTxsPerBLock, so we don't publish a block with // less txs than the minimum. But that'd cause the entire block to be aborted and retried. Instead, we should // go back to the p2p pool and load more txs until we hit our minTxsPerBLock target. Only if there are no txs // we should bail. - if (args.processedTxsCount != undefined) { - if (args.processedTxsCount === 0 && !skipCheck && this.minTxsPerBLock > 0) { - this.log.verbose('No txs processed correctly to build block.'); - return false; - } + if (args.processedTxsCount === 0 && this.minTxsPerBLock > 0) { + this.log.verbose('No txs processed correctly to build block.'); + return false; } return true;