Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion yarn-project/archiver/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
Expand All @@ -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<ArchiverConfig> = {
...blobClientConfigMapping,
...pipelineConfigMappings,
archiverPollingIntervalMS: {
env: 'ARCHIVER_POLLING_INTERVAL_MS',
description: 'The polling interval in ms for retrieving new L2 blocks and encrypted logs.',
Expand Down
12 changes: 9 additions & 3 deletions yarn-project/epoch-cache/src/config.ts
Original file line number Diff line number Diff line change
@@ -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() };
}
1 change: 1 addition & 0 deletions yarn-project/foundation/src/config/env_var.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export class SequencerClient {
l1ChainId: chainId,
viemPollingIntervalMS: config.viemPollingIntervalMS,
ethereumSlotDuration: config.ethereumSlotDuration,
enableProposerPipelining: config.enableProposerPipelining,
},
{ dateProvider: deps.dateProvider },
));
Expand Down
4 changes: 4 additions & 0 deletions yarn-project/sequencer-client/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -68,6 +70,7 @@ export type SequencerClientConfig = SequencerPublisherConfig &
SequencerConfig &
L1ReaderConfig &
ChainConfig &
PipelineConfig &
Pick<P2PConfig, 'txPublicSetupAllowListExtend'> &
Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;

Expand Down Expand Up @@ -244,6 +247,7 @@ export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientCo
...sequencerTxSenderConfigMappings,
...sequencerPublisherConfigMappings,
...chainConfigMappings,
...pipelineConfigMappings,
...pickConfigMappings(l1ContractsConfigMappings, ['ethereumSlotDuration', 'aztecSlotDuration', 'aztecEpochDuration']),
};

Expand Down
14 changes: 14 additions & 0 deletions yarn-project/sequencer-client/src/sequencer/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export class SequencerMetrics {
private checkpointBlockCount: Gauge;
private checkpointTxCount: Gauge;
private checkpointTotalMana: Gauge;
private pipelineDepth: Gauge;
private pipelineDiscards: UpDownCounter;

// Fisherman fee analysis metrics
private fishermanWouldBeIncluded: UpDownCounter;
Expand Down Expand Up @@ -143,6 +145,10 @@ export class SequencerMetrics {

this.slashingAttempts = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_SLASHING_ATTEMPTS_COUNT);

this.pipelineDepth = this.meter.createGauge(Metrics.SEQUENCER_PIPELINE_DEPTH);
this.pipelineDiscards = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_PIPELINE_DISCARDS_COUNT);
this.pipelineDepth.record(0);

// Fisherman fee analysis metrics
this.fishermanWouldBeIncluded = createUpDownCounterWithDefault(
this.meter,
Expand Down Expand Up @@ -234,6 +240,14 @@ export class SequencerMetrics {
});
}

recordPipelineDepth(depth: number) {
this.pipelineDepth.record(depth);
}

recordPipelineDiscard(count = 1) {
this.pipelineDiscards.add(count);
}

incOpenSlot(slot: SlotNumber, proposer: string) {
// sequencer went through the loop a second time. Noop
if (slot === this.lastSeenSlot) {
Expand Down
1 change: 1 addition & 0 deletions yarn-project/stdlib/src/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './chain-config.js';
export * from './node-rpc-config.js';
export * from './pipelining-config.js';
export * from './sequencer-config.js';
31 changes: 31 additions & 0 deletions yarn-project/stdlib/src/config/pipelining-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { type ConfigMappingsType, booleanConfigHelper, getConfigFromMappings } from '@aztec/foundation/config';

import { z } from 'zod';

import { zodFor } from '../schemas/index.js';

export interface PipelineConfig {
/** Whether to enable build-ahead proposer pipelining. */
enableProposerPipelining: boolean;
}

/**
* Pipelining config mappings for fields that need to be shared across packages.
*/
export const pipelineConfigMappings: ConfigMappingsType<PipelineConfig> = {
enableProposerPipelining: {
env: 'SEQ_ENABLE_PROPOSER_PIPELINING',
description: 'Whether to enable build-ahead proposer pipelining.',
...booleanConfigHelper(false),
},
};

export const PipelineConfigSchema = zodFor<PipelineConfig>()(
z.object({
enableProposerPipelining: z.boolean(),
}),
);

export function getPipelineConfigEnvVars(): PipelineConfig {
return getConfigFromMappings(pipelineConfigMappings);
}
10 changes: 10 additions & 0 deletions yarn-project/telemetry-client/src/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Loading