diff --git a/yarn-project/archiver/src/config.ts b/yarn-project/archiver/src/config.ts index e3ed77eb71dc..a2eb30464302 100644 --- a/yarn-project/archiver/src/config.ts +++ b/yarn-project/archiver/src/config.ts @@ -8,7 +8,12 @@ import { getConfigFromMappings, numberConfigHelper, } from '@aztec/foundation/config'; -import { type ChainConfig, chainConfigMappings } from '@aztec/stdlib/config'; +import { + type ChainConfig, + type PipelineConfig, + chainConfigMappings, + pipelineConfigMappings, +} from '@aztec/stdlib/config'; import type { ArchiverSpecificConfig } from '@aztec/stdlib/interfaces/server'; /** @@ -21,11 +26,13 @@ import type { ArchiverSpecificConfig } from '@aztec/stdlib/interfaces/server'; export type ArchiverConfig = ArchiverSpecificConfig & L1ReaderConfig & L1ContractsConfig & + PipelineConfig & // required to pass through to epoch cache BlobClientConfig & ChainConfig; export const archiverConfigMappings: ConfigMappingsType = { ...blobClientConfigMapping, + ...pipelineConfigMappings, archiverPollingIntervalMS: { env: 'ARCHIVER_POLLING_INTERVAL_MS', description: 'The polling interval in ms for retrieving new L2 blocks and encrypted logs.', diff --git a/yarn-project/epoch-cache/src/config.ts b/yarn-project/epoch-cache/src/config.ts index bd9b76c1cd58..bf6e92f13046 100644 --- a/yarn-project/epoch-cache/src/config.ts +++ b/yarn-project/epoch-cache/src/config.ts @@ -1,11 +1,17 @@ import { type L1ContractsConfig, getL1ContractsConfigEnvVars } from '@aztec/ethereum/config'; import { type L1ReaderConfig, getL1ReaderConfigFromEnv } from '@aztec/ethereum/l1-reader'; +import { type PipelineConfig, getPipelineConfigEnvVars } from '@aztec/stdlib/config'; export type EpochCacheConfig = Pick< - L1ReaderConfig & L1ContractsConfig, - 'l1RpcUrls' | 'l1ChainId' | 'viemPollingIntervalMS' | 'l1HttpTimeoutMS' | 'ethereumSlotDuration' + L1ReaderConfig & L1ContractsConfig & PipelineConfig, + | 'l1RpcUrls' + | 'l1ChainId' + | 'viemPollingIntervalMS' + | 'ethereumSlotDuration' + | 'l1HttpTimeoutMS' + | 'enableProposerPipelining' >; export function getEpochCacheConfigEnvVars(): EpochCacheConfig { - return { ...getL1ReaderConfigFromEnv(), ...getL1ContractsConfigEnvVars() }; + return { ...getL1ReaderConfigFromEnv(), ...getL1ContractsConfigEnvVars(), ...getPipelineConfigEnvVars() }; } diff --git a/yarn-project/foundation/src/config/env_var.ts b/yarn-project/foundation/src/config/env_var.ts index f692b1a4e0dd..159eba8cfb4a 100644 --- a/yarn-project/foundation/src/config/env_var.ts +++ b/yarn-project/foundation/src/config/env_var.ts @@ -219,6 +219,7 @@ export type EnvVar = | 'SEQ_PUBLISHER_ALLOW_INVALID_STATES' | 'SEQ_PUBLISHER_FORWARDER_ADDRESS' | 'SEQ_POLLING_INTERVAL_MS' + | 'SEQ_ENABLE_PROPOSER_PIPELINING' | 'SEQ_ENFORCE_TIME_TABLE' | 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT' | 'SEQ_ATTESTATION_PROPAGATION_TIME' diff --git a/yarn-project/sequencer-client/src/client/sequencer-client.ts b/yarn-project/sequencer-client/src/client/sequencer-client.ts index 0efeafb01f10..239c332e57f6 100644 --- a/yarn-project/sequencer-client/src/client/sequencer-client.ts +++ b/yarn-project/sequencer-client/src/client/sequencer-client.ts @@ -118,6 +118,7 @@ export class SequencerClient { l1ChainId: chainId, viemPollingIntervalMS: config.viemPollingIntervalMS, ethereumSlotDuration: config.ethereumSlotDuration, + enableProposerPipelining: config.enableProposerPipelining, }, { dateProvider: deps.dateProvider }, )); diff --git a/yarn-project/sequencer-client/src/config.ts b/yarn-project/sequencer-client/src/config.ts index e0ce28583791..577275cc0c09 100644 --- a/yarn-project/sequencer-client/src/config.ts +++ b/yarn-project/sequencer-client/src/config.ts @@ -13,8 +13,10 @@ import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config'; import { AztecAddress } from '@aztec/stdlib/aztec-address'; import { type ChainConfig, + type PipelineConfig, type SequencerConfig, chainConfigMappings, + pipelineConfigMappings, sharedSequencerConfigMappings, } from '@aztec/stdlib/config'; import type { ResolvedSequencerConfig } from '@aztec/stdlib/interfaces/server'; @@ -68,6 +70,7 @@ export type SequencerClientConfig = SequencerPublisherConfig & SequencerConfig & L1ReaderConfig & ChainConfig & + PipelineConfig & Pick & Pick; @@ -244,6 +247,7 @@ export const sequencerClientConfigMappings: ConfigMappingsType = { + enableProposerPipelining: { + env: 'SEQ_ENABLE_PROPOSER_PIPELINING', + description: 'Whether to enable build-ahead proposer pipelining.', + ...booleanConfigHelper(false), + }, +}; + +export const PipelineConfigSchema = zodFor()( + z.object({ + enableProposerPipelining: z.boolean(), + }), +); + +export function getPipelineConfigEnvVars(): PipelineConfig { + return getConfigFromMappings(pipelineConfigMappings); +} diff --git a/yarn-project/telemetry-client/src/metrics.ts b/yarn-project/telemetry-client/src/metrics.ts index f6678089bcf9..6bd63208404b 100644 --- a/yarn-project/telemetry-client/src/metrics.ts +++ b/yarn-project/telemetry-client/src/metrics.ts @@ -504,6 +504,16 @@ export const SEQUENCER_CHECKPOINT_SUCCESS_COUNT: MetricDefinition = { description: 'The number of times checkpoint publishing succeeded', valueType: ValueType.INT, }; +export const SEQUENCER_PIPELINE_DEPTH: MetricDefinition = { + name: 'aztec.sequencer.pipeline.depth', + description: 'Current pipeline depth when builder pipelining is enabled', + valueType: ValueType.INT, +}; +export const SEQUENCER_PIPELINE_DISCARDS_COUNT: MetricDefinition = { + name: 'aztec.sequencer.pipeline.discards_count', + description: 'The number of times a pipeline was discarded', + valueType: ValueType.INT, +}; // Fisherman fee analysis metrics export const FISHERMAN_FEE_ANALYSIS_WOULD_BE_INCLUDED: MetricDefinition = {