Skip to content

Commit de095be

Browse files
authored
Merge branch 'next' into jc/docs/how-to-update
2 parents 1a0dcd5 + 4660801 commit de095be

File tree

12 files changed

+286
-39
lines changed

12 files changed

+286
-39
lines changed

.github/workflows/deploy-aztec-infra.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ on:
100100
description: Whether to use an external ingress for the rpc
101101
required: true
102102
type: boolean
103+
otel_collector_url:
104+
description: The OpenTelemetry collector that will receive metrics from this deployment. Optional
105+
required: false
106+
type: string
103107
secrets:
104108
GCP_SA_KEY:
105109
description: The GCP service account key
@@ -207,6 +211,10 @@ on:
207211
description: Whether to use an external ingress for the rpc
208212
required: true
209213
type: boolean
214+
otel_collector_url:
215+
description: The OpenTelemetry collector that will receive metrics from this deployment. Optional
216+
required: false
217+
type: string
210218

211219
jobs:
212220
deploy_aztec_infra:
@@ -237,6 +245,7 @@ jobs:
237245
TF_VAR_PROVER_RESOURCE_PROFILE: ${{ inputs.prover_resource_profile }}
238246
TF_VAR_RPC_RESOURCE_PROFILE: ${{ inputs.rpc_resource_profile }}
239247
TF_VAR_RPC_EXTERNAL_INGRESS: ${{ inputs.rpc_external_ingress }}
248+
TF_VAR_OTEL_COLLECTOR_URL: ${{ inputs.otel_collector_url }}
240249

241250
steps:
242251
- name: Debug inputs

spartan/terraform/deploy-aztec-infra/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ locals {
5858
"global.customAztecNetwork.slashFactoryContractAddress" = var.SLASH_FACTORY_CONTRACT_ADDRESS
5959
"global.customAztecNetwork.feeAssetHandlerContractAddress" = var.FEE_ASSET_HANDLER_CONTRACT_ADDRESS
6060
"global.customAztecNetwork.l1ChainId" = var.L1_CHAIN_ID
61+
"global.otelCollectorEndpoint" = var.OTEL_COLLECTOR_URL
6162
}
6263

6364
common_list_settings = {

spartan/terraform/deploy-aztec-infra/variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ variable "AZTEC_DOCKER_IMAGE" {
7979
default = "aztecprotocol/aztec:staging"
8080
}
8181

82-
variable "METRICS_NAMESPACE" {
83-
description = "Namespace to deploy the metrics to"
82+
variable "OTEL_COLLECTOR_URL" {
83+
description = "The URL of an OpenTelemtry collector to send metrics to"
8484
type = string
85-
default = "metrics"
85+
nullable = true
8686
}
8787

8888
variable "VALIDATOR_VALUES" {

spartan/terraform/deploy-metrics/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ output "otel_collector_ip" {
99
value = google_compute_address.otel_collector_ip.address
1010
}
1111

12+
output "otel_collector_base_url" {
13+
description = "OTEL Collector IP"
14+
value = "http://${google_compute_address.otel_collector_ip.address}:4318"
15+
}
16+

yarn-project/sequencer-client/src/sequencer/sequencer.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ describe('sequencer', () => {
322322

323323
expect(blockBuilder.buildBlock).not.toHaveBeenCalled();
324324
expect(publisher.enqueueProposeL2Block).not.toHaveBeenCalled();
325+
expect(publisher.canProposeAtNextEthBlock).not.toHaveBeenCalled();
325326
});
326327

327328
it('does not publish a block if it does not have enough time left in the slot after collecting attestations', async () => {

yarn-project/sequencer-client/src/sequencer/sequencer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,13 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
267267
return;
268268
}
269269

270-
this.setState(SequencerState.PROPOSER_CHECK, undefined);
271-
272270
const chainTipArchive = syncedTo.archive;
273271
const newBlockNumber = syncedTo.blockNumber + 1;
274272

275273
const { slot, ts, now } = this.epochCache.getEpochAndSlotInNextL1Slot();
276274

275+
this.setState(SequencerState.PROPOSER_CHECK, slot);
276+
277277
// Check that the archiver and dependencies have synced to the previous L1 slot at least
278278
// TODO(#14766): Archiver reports L1 timestamp based on L1 blocks seen, which means that a missed L1 block will
279279
// cause the archiver L1 timestamp to fall behind, and cause this sequencer to start processing one L1 slot later.

yarn-project/sequencer-client/src/sequencer/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export type SequencerStateWithSlot =
3737
| SequencerState.INITIALIZING_PROPOSAL
3838
| SequencerState.CREATING_BLOCK
3939
| SequencerState.COLLECTING_ATTESTATIONS
40-
| SequencerState.PUBLISHING_BLOCK;
40+
| SequencerState.PUBLISHING_BLOCK
41+
| SequencerState.PROPOSER_CHECK;
4142

4243
export type SequencerStateCallback = () => SequencerState;
4344

yarn-project/slasher/src/tally_slasher_client.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ describe('TallySlasherClient', () => {
245245
const targetRound = 3n;
246246

247247
await addPendingOffense({
248-
epochOrSlot: targetRound * BigInt(roundSize),
248+
epochOrSlot: targetRound * BigInt(roundSize) + BigInt(epochDuration),
249249
offenseType: OffenseType.PROPOSED_INSUFFICIENT_ATTESTATIONS, // slot-based
250250
});
251251

yarn-project/slasher/src/tally_slasher_client.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type { Prettify } from '@aztec/foundation/types';
99
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
1010
import {
1111
type Offense,
12+
OffenseType,
1213
type ProposerSlashAction,
1314
type ProposerSlashActionProvider,
1415
type SlashPayloadRound,
@@ -253,6 +254,7 @@ export class TallySlasherClient implements ProposerSlashActionProvider, SlasherC
253254
const offensesFromAlwaysSlash = (this.config.slashValidatorsAlways ?? []).map(validator => ({
254255
validator,
255256
amount: this.settings.slashingAmounts[2],
257+
offenseType: OffenseType.UNKNOWN,
256258
}));
257259
const [offensesToForgive, offensesToSlash] = partition([...offensesForRound, ...offensesFromAlwaysSlash], offense =>
258260
this.config.slashValidatorsNever?.some(v => v.equals(offense.validator)),
@@ -291,7 +293,8 @@ export class TallySlasherClient implements ProposerSlashActionProvider, SlasherC
291293
});
292294

293295
const committees = await this.collectCommitteesActiveDuringRound(slashedRound);
294-
const votes = getSlashConsensusVotesFromOffenses(offensesToSlash, committees, this.settings);
296+
const epochsForCommittees = getEpochsForRound(slashedRound, this.settings);
297+
const votes = getSlashConsensusVotesFromOffenses(offensesToSlash, committees, epochsForCommittees, this.settings);
295298
if (votes.every(v => v === 0)) {
296299
this.log.warn(`Computed votes for offenses are all zero. Skipping vote.`, {
297300
slotNumber,

yarn-project/stdlib/src/slashing/helpers.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,23 @@ export function getSlotForOffense(
106106
return getTimeUnitForOffense(offenseType) === 'epoch' ? epochOrSlot * BigInt(constants.epochDuration) : epochOrSlot;
107107
}
108108

109-
/** Returns the epoch for a given offense. */
109+
/** Returns the epoch for a given offense. If the offense type or epoch is not defined, returns undefined. */
110110
export function getEpochForOffense(
111111
offense: Pick<Offense, 'epochOrSlot' | 'offenseType'>,
112112
constants: Pick<L1RollupConstants, 'epochDuration'>,
113-
): bigint {
113+
): bigint;
114+
export function getEpochForOffense(
115+
offense: Partial<Pick<Offense, 'epochOrSlot' | 'offenseType'>>,
116+
constants: Pick<L1RollupConstants, 'epochDuration'>,
117+
): bigint | undefined;
118+
export function getEpochForOffense(
119+
offense: Partial<Pick<Offense, 'epochOrSlot' | 'offenseType'>>,
120+
constants: Pick<L1RollupConstants, 'epochDuration'>,
121+
): bigint | undefined {
114122
const { epochOrSlot, offenseType } = offense;
123+
if (epochOrSlot === undefined || offenseType === undefined) {
124+
return undefined;
125+
}
115126
return getTimeUnitForOffense(offenseType) === 'epoch' ? epochOrSlot : epochOrSlot / BigInt(constants.epochDuration);
116127
}
117128

0 commit comments

Comments
 (0)