@aztec/sequencer-client 2.0.3-rc.2 → 2.0.3-rc.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  import type { EthAddress } from '@aztec/aztec.js';
2
2
  import type { RollupContract } from '@aztec/ethereum';
3
3
  import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
4
- import { type SequencerState, type SequencerStateCallback } from './utils.js';
4
+ import { type Hex } from 'viem';
5
+ import type { SequencerState } from './utils.js';
5
6
  export declare class SequencerMetrics {
6
- private coinbase;
7
7
  private rollup;
8
8
  readonly tracer: Tracer;
9
9
  private meter;
@@ -11,9 +11,6 @@ export declare class SequencerMetrics {
11
11
  private blockBuildDuration;
12
12
  private blockBuildManaPerSecond;
13
13
  private stateTransitionBufferDuration;
14
- private currentBlockNumber;
15
- private currentBlockSize;
16
- private blockBuilderInsertions;
17
14
  private timeToCollectAttestations;
18
15
  private allowanceToCollectAttestations;
19
16
  private requiredAttestions;
@@ -21,23 +18,14 @@ export declare class SequencerMetrics {
21
18
  private rewards;
22
19
  private slots;
23
20
  private filledSlots;
24
- private missedSlots;
25
21
  private lastSeenSlot?;
26
- constructor(client: TelemetryClient, getState: SequencerStateCallback, coinbase: EthAddress, rollup: RollupContract, name?: string);
27
- setCoinbase(coinbase: EthAddress): void;
28
- start(): void;
29
- stop(): void;
30
- private observe;
22
+ constructor(client: TelemetryClient, rollup: RollupContract, name?: string);
31
23
  recordRequiredAttestations(requiredAttestationsCount: number, allowanceMs: number): void;
32
24
  recordCollectedAttestations(count: number, durationMs: number): void;
33
- recordBlockBuilderTreeInsertions(timeUs: number): void;
34
- recordCancelledBlock(): void;
35
25
  recordBuiltBlock(buildDurationMs: number, totalMana: number): void;
36
26
  recordFailedBlock(): void;
37
- recordNewBlock(blockNumber: number, txCount: number): void;
38
27
  recordStateTransitionBufferMs(durationMs: number, state: SequencerState): void;
39
- observeSlotChange(slot: bigint | undefined, proposer: string): void;
40
- incFilledSlot(proposer: string): void;
41
- private setCurrentBlock;
28
+ incOpenSlot(slot: bigint, proposer: string): void;
29
+ incFilledSlot(proposer: string, coinbase: Hex | EthAddress | undefined): Promise<void>;
42
30
  }
43
31
  //# sourceMappingURL=metrics.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/sequencer/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAQL,KAAK,eAAe,EACpB,KAAK,MAAM,EAGZ,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,sBAAsB,EAA0B,MAAM,YAAY,CAAC;AAEtG,qBAAa,gBAAgB;IA6BzB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,MAAM;IA7BhB,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,KAAK,CAAQ;IAErB,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,kBAAkB,CAAY;IACtC,OAAO,CAAC,uBAAuB,CAAQ;IACvC,OAAO,CAAC,6BAA6B,CAAY;IACjD,OAAO,CAAC,kBAAkB,CAAQ;IAClC,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,sBAAsB,CAAY;IAG1C,OAAO,CAAC,yBAAyB,CAAQ;IACzC,OAAO,CAAC,8BAA8B,CAAQ;IAC9C,OAAO,CAAC,kBAAkB,CAAQ;IAClC,OAAO,CAAC,mBAAmB,CAAQ;IAEnC,OAAO,CAAC,OAAO,CAAkB;IAEjC,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,WAAW,CAAgB;IAEnC,OAAO,CAAC,YAAY,CAAC,CAAS;gBAG5B,MAAM,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CAAQ;IAErB,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,kBAAkB,CAAY;IACtC,OAAO,CAAC,uBAAuB,CAAQ;IACvC,OAAO,CAAC,6BAA6B,CAAY;IAGjD,OAAO,CAAC,yBAAyB,CAAQ;IACzC,OAAO,CAAC,8BAA8B,CAAQ;IAC9C,OAAO,CAAC,kBAAkB,CAAQ;IAClC,OAAO,CAAC,mBAAmB,CAAQ;IAEnC,OAAO,CAAC,OAAO,CAAQ;IAEvB,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,WAAW,CAAgB;IAEnC,OAAO,CAAC,YAAY,CAAC,CAAS;gBAG5B,MAAM,EAAE,eAAe,EACf,MAAM,EAAE,cAAc,EAC9B,IAAI,SAAc;IAkFb,0BAA0B,CAAC,yBAAyB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IASjF,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAKpE,gBAAgB,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAQ3D,iBAAiB;IAMjB,6BAA6B,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc;IAMvE,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAapC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAkB7F"}
@@ -1,8 +1,6 @@
1
1
  import { Attributes, Metrics, ValueType } from '@aztec/telemetry-client';
2
2
  import { formatUnits } from 'viem';
3
- import { sequencerStateToNumber } from './utils.js';
4
3
  export class SequencerMetrics {
5
- coinbase;
6
4
  rollup;
7
5
  tracer;
8
6
  meter;
@@ -10,9 +8,6 @@ export class SequencerMetrics {
10
8
  blockBuildDuration;
11
9
  blockBuildManaPerSecond;
12
10
  stateTransitionBufferDuration;
13
- currentBlockNumber;
14
- currentBlockSize;
15
- blockBuilderInsertions;
16
11
  // these are gauges because for individual sequencers building a block is not something that happens often enough to warrant a histogram
17
12
  timeToCollectAttestations;
18
13
  allowanceToCollectAttestations;
@@ -21,19 +16,9 @@ export class SequencerMetrics {
21
16
  rewards;
22
17
  slots;
23
18
  filledSlots;
24
- missedSlots;
25
19
  lastSeenSlot;
26
- constructor(client, getState, coinbase, rollup, name = 'Sequencer'){
27
- this.coinbase = coinbase;
20
+ constructor(client, rollup, name = 'Sequencer'){
28
21
  this.rollup = rollup;
29
- this.observe = async (observer)=>{
30
- let rewards = 0n;
31
- rewards = await this.rollup.getSequencerRewards(this.coinbase);
32
- const fmt = parseFloat(formatUnits(rewards, 18));
33
- observer.observe(this.rewards, fmt, {
34
- [Attributes.COINBASE]: this.coinbase.toString()
35
- });
36
- };
37
22
  this.meter = client.getMeter(name);
38
23
  this.tracer = client.getTracer(name);
39
24
  this.blockCounter = this.meter.createUpDownCounter(Metrics.SEQUENCER_BLOCK_COUNT);
@@ -52,37 +37,14 @@ export class SequencerMetrics {
52
37
  description: 'The time difference between when the sequencer needed to transition to a new state and when it actually did.',
53
38
  valueType: ValueType.INT
54
39
  });
55
- const currentState = this.meter.createObservableGauge(Metrics.SEQUENCER_CURRENT_STATE, {
56
- description: 'Current state of the sequencer'
57
- });
58
- currentState.addCallback((observer)=>{
59
- observer.observe(sequencerStateToNumber(getState()));
60
- });
61
- this.currentBlockNumber = this.meter.createGauge(Metrics.SEQUENCER_CURRENT_BLOCK_NUMBER, {
62
- description: 'Current block number',
63
- valueType: ValueType.INT
64
- });
65
- this.currentBlockSize = this.meter.createGauge(Metrics.SEQUENCER_CURRENT_BLOCK_SIZE, {
66
- description: 'Current block size',
67
- valueType: ValueType.INT
68
- });
69
- this.blockBuilderInsertions = this.meter.createHistogram(Metrics.SEQUENCER_BLOCK_BUILD_INSERTION_TIME, {
70
- description: 'Timer for tree insertions performed by the block builder',
71
- unit: 'us',
72
- valueType: ValueType.INT
73
- });
74
40
  // Init gauges and counters
75
- this.setCurrentBlock(0, 0);
76
- this.blockCounter.add(0, {
77
- [Attributes.STATUS]: 'cancelled'
78
- });
79
41
  this.blockCounter.add(0, {
80
42
  [Attributes.STATUS]: 'failed'
81
43
  });
82
44
  this.blockCounter.add(0, {
83
45
  [Attributes.STATUS]: 'built'
84
46
  });
85
- this.rewards = this.meter.createObservableGauge(Metrics.SEQUENCER_CURRENT_BLOCK_REWARDS, {
47
+ this.rewards = this.meter.createGauge(Metrics.SEQUENCER_CURRENT_BLOCK_REWARDS, {
86
48
  valueType: ValueType.DOUBLE,
87
49
  description: 'The rewards earned'
88
50
  });
@@ -90,14 +52,13 @@ export class SequencerMetrics {
90
52
  valueType: ValueType.INT,
91
53
  description: 'The number of slots this sequencer was selected for'
92
54
  });
93
- this.filledSlots = this.meter.createUpDownCounter(Metrics.SEQUENCER_FILLED_SLOT_COUNT, {
55
+ /**
56
+ * NOTE: we do not track missed slots as a separate metric. That would be difficult to determine
57
+ * Instead, use a computed metric, `slots - filledSlots` to get the number of slots a sequencer has missed.
58
+ */ this.filledSlots = this.meter.createUpDownCounter(Metrics.SEQUENCER_FILLED_SLOT_COUNT, {
94
59
  valueType: ValueType.INT,
95
60
  description: 'The number of slots this sequencer has filled'
96
61
  });
97
- this.missedSlots = this.meter.createUpDownCounter(Metrics.SEQUENCER_MISSED_SLOT_COUNT, {
98
- valueType: ValueType.INT,
99
- description: 'The number of slots this sequencer has missed to fill'
100
- });
101
62
  this.timeToCollectAttestations = this.meter.createGauge(Metrics.SEQUENCER_COLLECT_ATTESTATIONS_DURATION, {
102
63
  description: 'The time spent collecting attestations from committee members',
103
64
  unit: 'ms',
@@ -117,20 +78,6 @@ export class SequencerMetrics {
117
78
  description: 'The minimum number of attestations required to publish a block'
118
79
  });
119
80
  }
120
- setCoinbase(coinbase) {
121
- this.coinbase = coinbase;
122
- }
123
- start() {
124
- this.meter.addBatchObservableCallback(this.observe, [
125
- this.rewards
126
- ]);
127
- }
128
- stop() {
129
- this.meter.removeBatchObservableCallback(this.observe, [
130
- this.rewards
131
- ]);
132
- }
133
- observe;
134
81
  recordRequiredAttestations(requiredAttestationsCount, allowanceMs) {
135
82
  this.requiredAttestions.record(requiredAttestationsCount);
136
83
  this.allowanceToCollectAttestations.record(Math.ceil(allowanceMs));
@@ -142,15 +89,6 @@ export class SequencerMetrics {
142
89
  this.collectedAttestions.record(count);
143
90
  this.timeToCollectAttestations.record(Math.ceil(durationMs));
144
91
  }
145
- recordBlockBuilderTreeInsertions(timeUs) {
146
- this.blockBuilderInsertions.record(Math.ceil(timeUs));
147
- }
148
- recordCancelledBlock() {
149
- this.blockCounter.add(1, {
150
- [Attributes.STATUS]: 'cancelled'
151
- });
152
- this.setCurrentBlock(0, 0);
153
- }
154
92
  recordBuiltBlock(buildDurationMs, totalMana) {
155
93
  this.blockCounter.add(1, {
156
94
  [Attributes.STATUS]: 'built'
@@ -162,41 +100,37 @@ export class SequencerMetrics {
162
100
  this.blockCounter.add(1, {
163
101
  [Attributes.STATUS]: 'failed'
164
102
  });
165
- this.setCurrentBlock(0, 0);
166
- }
167
- recordNewBlock(blockNumber, txCount) {
168
- this.setCurrentBlock(blockNumber, txCount);
169
103
  }
170
104
  recordStateTransitionBufferMs(durationMs, state) {
171
105
  this.stateTransitionBufferDuration.record(durationMs, {
172
106
  [Attributes.SEQUENCER_STATE]: state
173
107
  });
174
108
  }
175
- observeSlotChange(slot, proposer) {
109
+ incOpenSlot(slot, proposer) {
176
110
  // sequencer went through the loop a second time. Noop
177
111
  if (slot === this.lastSeenSlot) {
178
112
  return;
179
113
  }
180
- if (typeof this.lastSeenSlot === 'bigint') {
181
- this.missedSlots.add(1, {
182
- [Attributes.BLOCK_PROPOSER]: proposer
183
- });
184
- }
185
- if (typeof slot === 'bigint') {
186
- this.slots.add(1, {
187
- [Attributes.BLOCK_PROPOSER]: proposer
188
- });
189
- }
114
+ this.slots.add(1, {
115
+ [Attributes.BLOCK_PROPOSER]: proposer
116
+ });
190
117
  this.lastSeenSlot = slot;
191
118
  }
192
- incFilledSlot(proposer) {
119
+ async incFilledSlot(proposer, coinbase) {
193
120
  this.filledSlots.add(1, {
194
121
  [Attributes.BLOCK_PROPOSER]: proposer
195
122
  });
196
123
  this.lastSeenSlot = undefined;
197
- }
198
- setCurrentBlock(blockNumber, txCount) {
199
- this.currentBlockNumber.record(blockNumber);
200
- this.currentBlockSize.record(txCount);
124
+ if (coinbase) {
125
+ try {
126
+ const rewards = await this.rollup.getSequencerRewards(coinbase);
127
+ const fmt = parseFloat(formatUnits(rewards, 18));
128
+ this.rewards.record(fmt, {
129
+ [Attributes.COINBASE]: coinbase.toString()
130
+ });
131
+ } catch {
132
+ // no-op
133
+ }
134
+ }
201
135
  }
202
136
  }
@@ -2,16 +2,17 @@ import type { L2Block } from '@aztec/aztec.js';
2
2
  import type { EpochCache } from '@aztec/epoch-cache';
3
3
  import { type RollupContract } from '@aztec/ethereum';
4
4
  import { EthAddress } from '@aztec/foundation/eth-address';
5
+ import { Signature } from '@aztec/foundation/eth-signature';
5
6
  import { Fr } from '@aztec/foundation/fields';
6
7
  import { type DateProvider } from '@aztec/foundation/timer';
7
8
  import type { TypedEventEmitter } from '@aztec/foundation/types';
8
9
  import type { P2P } from '@aztec/p2p';
9
10
  import type { SlasherClientInterface } from '@aztec/slasher';
10
- import type { CommitteeAttestation, L2BlockSource, ValidateBlockResult } from '@aztec/stdlib/block';
11
+ import { type CommitteeAttestation, CommitteeAttestationsAndSigners, type L2BlockSource, type ValidateBlockResult } from '@aztec/stdlib/block';
11
12
  import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
12
13
  import { type IFullNodeBlockBuilder, type PublicProcessorLimits, type WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
13
14
  import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
14
- import { Tx, type TxHash } from '@aztec/stdlib/tx';
15
+ import { Tx } from '@aztec/stdlib/tx';
15
16
  import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
16
17
  import type { ValidatorClient } from '@aztec/validator-client';
17
18
  import type { GlobalVariableBuilder } from '../global_variable_builder/global_builder.js';
@@ -160,7 +161,7 @@ export declare class Sequencer extends Sequencer_base {
160
161
  * Publishes the L2Block to the rollup contract.
161
162
  * @param block - The L2Block to be published.
162
163
  */
163
- protected enqueuePublishL2Block(block: L2Block, attestations: CommitteeAttestation[] | undefined, txHashes: TxHash[], invalidateBlock: InvalidateBlockRequest | undefined, publisher: SequencerPublisher): Promise<void>;
164
+ protected enqueuePublishL2Block(block: L2Block, attestationsAndSigners: CommitteeAttestationsAndSigners, attestationsAndSignersSignature: Signature, invalidateBlock: InvalidateBlockRequest | undefined, publisher: SequencerPublisher): Promise<void>;
164
165
  /**
165
166
  * Returns whether all dependencies have caught up.
166
167
  * We don't check against the previous block submitted since it may have been reorg'd out.
@@ -1 +1 @@
1
- {"version":3,"file":"sequencer.d.ts","sourceRoot":"","sources":["../../src/sequencer/sequencer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE5F,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,E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AAmB,CAAC;KACnD,GACD,SAAS,CACZ;IAsDD;;;;;OAKG;cACa,yBAAyB,CACvC,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EACpE,WAAW,EAAE,MAAM,EACnB,qBAAqB,EAAE,UAAU,EAAE,EACnC,SAAS,EAAE,kBAAkB,GAC5B,OAAO,CAAC,IAAI,CAAC;IA6DhB,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,kBAAkB;IAK1B,IAAI,iBAAiB,WAEpB;IAED,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;IAEM,gBAAgB,IAAI,sBAAsB,GAAG,SAAS;CAG9D"}
@@ -4,14 +4,16 @@ function _ts_decorate(decorators, target, key, desc) {
4
4
  else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  }
7
- import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
7
+ import { BLOBS_PER_BLOCK, FIELDS_PER_BLOB, INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
8
8
  import { FormattedViemError, NoCommitteeError } from '@aztec/ethereum';
9
9
  import { omit, pick } from '@aztec/foundation/collection';
10
10
  import { EthAddress } from '@aztec/foundation/eth-address';
11
+ import { Signature } from '@aztec/foundation/eth-signature';
11
12
  import { Fr } from '@aztec/foundation/fields';
12
13
  import { createLogger } from '@aztec/foundation/log';
13
14
  import { RunningPromise } from '@aztec/foundation/running-promise';
14
15
  import { Timer } from '@aztec/foundation/timer';
16
+ import { CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
15
17
  import { getSlotAtTimestamp } from '@aztec/stdlib/epoch-helpers';
16
18
  import { Gas } from '@aztec/stdlib/gas';
17
19
  import { SequencerConfigSchema } from '@aztec/stdlib/interfaces/server';
@@ -72,10 +74,7 @@ export { SequencerState };
72
74
  publisher;
73
75
  constructor(publisherFactory, validatorClient, globalsBuilder, p2pClient, worldState, slasherClient, l2BlockSource, l1ToL2MessageSource, blockBuilder, l1Constants, dateProvider, epochCache, rollupContract, config, telemetry = getTelemetryClient(), log = createLogger('sequencer')){
74
76
  super(), this.publisherFactory = publisherFactory, this.validatorClient = validatorClient, this.globalsBuilder = globalsBuilder, this.p2pClient = p2pClient, this.worldState = worldState, this.slasherClient = slasherClient, this.l2BlockSource = l2BlockSource, this.l1ToL2MessageSource = l1ToL2MessageSource, this.blockBuilder = blockBuilder, this.l1Constants = l1Constants, this.dateProvider = dateProvider, this.epochCache = epochCache, this.rollupContract = rollupContract, this.config = config, this.telemetry = telemetry, this.log = log, this.pollingIntervalMs = 1000, this.maxTxsPerBlock = 32, this.minTxsPerBlock = 1, this.maxL1TxInclusionTimeIntoSlot = 0, this.state = SequencerState.STOPPED, this.maxBlockSizeInBytes = 1024 * 1024, this.maxBlockGas = new Gas(100e9, 100e9), this.enforceTimeTable = false;
75
- // Set an initial coinbase for metrics purposes, but this will potentially change with each block.
76
- const validatorAddresses = this.validatorClient?.getValidatorAddresses() ?? [];
77
- const coinbase = validatorAddresses.length === 0 ? EthAddress.ZERO : this.validatorClient?.getCoinbaseForAttestor(validatorAddresses[0]) ?? EthAddress.ZERO;
78
- this.metrics = new SequencerMetrics(telemetry, ()=>this.state, coinbase, this.rollupContract, 'Sequencer');
77
+ this.metrics = new SequencerMetrics(telemetry, this.rollupContract, 'Sequencer');
79
78
  // Initialize config
80
79
  this.updateConfig(this.config);
81
80
  }
@@ -140,7 +139,6 @@ export { SequencerState };
140
139
  /**
141
140
  * Starts the sequencer and moves to IDLE state.
142
141
  */ start() {
143
- this.metrics.start();
144
142
  this.runningPromise = new RunningPromise(this.work.bind(this), this.log, this.pollingIntervalMs);
145
143
  this.setState(SequencerState.IDLE, undefined, {
146
144
  force: true
@@ -152,7 +150,6 @@ export { SequencerState };
152
150
  * Stops the sequencer from processing txs and moves to STOPPED state.
153
151
  */ async stop() {
154
152
  this.log.info(`Stopping sequencer`);
155
- this.metrics.stop();
156
153
  this.publisher?.interrupt();
157
154
  await this.validatorClient?.stop();
158
155
  await this.runningPromise?.stop();
@@ -259,7 +256,6 @@ export { SequencerState };
259
256
  this.publisher = publisher;
260
257
  const coinbase = this.validatorClient.getCoinbaseForAttestor(attestorAddress);
261
258
  const feeRecipient = this.validatorClient.getFeeRecipientForAttestor(attestorAddress);
262
- this.metrics.setCoinbase(coinbase);
263
259
  // Prepare invalidation request if the pending chain is invalid (returns undefined if no need)
264
260
  const invalidateBlock = await publisher.simulateInvalidateBlock(syncedTo.pendingChainValidationStatus);
265
261
  const canProposeCheck = await publisher.canProposeAtNextEthBlock(chainTipArchive, proposerAddressInNextSlot, invalidateBlock);
@@ -317,6 +313,7 @@ export { SequencerState };
317
313
  publisher.enqueueInvalidateBlock(invalidateBlock);
318
314
  }
319
315
  this.setState(SequencerState.INITIALIZING_PROPOSAL, slot);
316
+ this.metrics.incOpenSlot(slot, proposerAddressInNextSlot.toString());
320
317
  this.log.verbose(`Preparing proposal for block ${newBlockNumber} at slot ${slot}`, {
321
318
  proposer: proposerInNextSlot?.toString(),
322
319
  coinbase,
@@ -379,7 +376,7 @@ export { SequencerState };
379
376
  blockNumber: newBlockNumber,
380
377
  slot: Number(slot)
381
378
  });
382
- this.metrics.incFilledSlot(publisher.getSenderAddress().toString());
379
+ await this.metrics.incFilledSlot(publisher.getSenderAddress().toString(), coinbase);
383
380
  } else if (block) {
384
381
  this.emit('block-publish-failed', l1Response ?? {});
385
382
  }
@@ -452,6 +449,7 @@ export { SequencerState };
452
449
  maxTransactions: this.maxTxsPerBlock,
453
450
  maxBlockSize: this.maxBlockSizeInBytes,
454
451
  maxBlockGas: this.maxBlockGas,
452
+ maxBlobFields: BLOBS_PER_BLOCK * FIELDS_PER_BLOB,
455
453
  deadline
456
454
  };
457
455
  }
@@ -470,7 +468,6 @@ export { SequencerState };
470
468
  const blockNumber = newGlobalVariables.blockNumber;
471
469
  const slot = proposalHeader.slotNumber.toBigInt();
472
470
  const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(blockNumber);
473
- // this.metrics.recordNewBlock(blockNumber, validTxs.length);
474
471
  const workTimer = new Timer();
475
472
  this.setState(SequencerState.CREATING_BLOCK, slot);
476
473
  try {
@@ -515,7 +512,9 @@ export { SequencerState };
515
512
  blockNumber
516
513
  });
517
514
  }
518
- await this.enqueuePublishL2Block(block, attestations, txHashes, invalidateBlock, publisher);
515
+ const attestationsAndSigners = new CommitteeAttestationsAndSigners(attestations ?? []);
516
+ const attestationsAndSignersSignature = this.validatorClient ? await this.validatorClient.signAttestationsAndSigners(attestationsAndSigners, proposerAddress) : Signature.empty();
517
+ await this.enqueuePublishL2Block(block, attestationsAndSigners, attestationsAndSignersSignature, invalidateBlock, publisher);
519
518
  this.metrics.recordBuiltBlock(blockBuildDuration, publicGas.l2Gas);
520
519
  return block;
521
520
  } catch (err) {
@@ -561,32 +560,32 @@ export { SequencerState };
561
560
  const attestationTimeAllowed = this.enforceTimeTable ? this.timetable.getMaxAllowedTime(SequencerState.PUBLISHING_BLOCK) : this.aztecSlotDuration;
562
561
  this.metrics.recordRequiredAttestations(numberOfRequiredAttestations, attestationTimeAllowed);
563
562
  const timer = new Timer();
564
- let collectedAttestionsCount = 0;
563
+ let collectedAttestationsCount = 0;
565
564
  try {
566
565
  const attestationDeadline = new Date(this.dateProvider.now() + attestationTimeAllowed * 1000);
567
566
  const attestations = await this.validatorClient.collectAttestations(proposal, numberOfRequiredAttestations, attestationDeadline);
568
- collectedAttestionsCount = attestations.length;
567
+ collectedAttestationsCount = attestations.length;
569
568
  // note: the smart contract requires that the signatures are provided in the order of the committee
570
569
  return orderAttestations(attestations, committee);
571
570
  } catch (err) {
572
571
  if (err && err instanceof AttestationTimeoutError) {
573
- collectedAttestionsCount = err.collectedCount;
572
+ collectedAttestationsCount = err.collectedCount;
574
573
  }
575
574
  throw err;
576
575
  } finally{
577
- this.metrics.recordCollectedAttestations(collectedAttestionsCount, timer.ms());
576
+ this.metrics.recordCollectedAttestations(collectedAttestationsCount, timer.ms());
578
577
  }
579
578
  }
580
579
  /**
581
580
  * Publishes the L2Block to the rollup contract.
582
581
  * @param block - The L2Block to be published.
583
- */ async enqueuePublishL2Block(block, attestations, txHashes, invalidateBlock, publisher) {
582
+ */ async enqueuePublishL2Block(block, attestationsAndSigners, attestationsAndSignersSignature, invalidateBlock, publisher) {
584
583
  // Publishes new block to the network and awaits the tx to be mined
585
584
  this.setState(SequencerState.PUBLISHING_BLOCK, block.header.globalVariables.slotNumber.toBigInt());
586
585
  // Time out tx at the end of the slot
587
586
  const slot = block.header.globalVariables.slotNumber.toNumber();
588
587
  const txTimeoutAt = new Date((this.getSlotStartBuildTimestamp(slot) + this.aztecSlotDuration) * 1000);
589
- const enqueued = await publisher.enqueueProposeL2Block(block, attestations, txHashes, {
588
+ const enqueued = await publisher.enqueueProposeL2Block(block, attestationsAndSigners, attestationsAndSignersSignature, {
590
589
  txTimeoutAt,
591
590
  forcePendingBlockNumber: invalidateBlock?.forcePendingBlockNumber
592
591
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/sequencer-client",
3
- "version": "2.0.3-rc.2",
3
+ "version": "2.0.3-rc.21",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -26,37 +26,38 @@
26
26
  "test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
27
27
  },
28
28
  "dependencies": {
29
- "@aztec/aztec.js": "2.0.3-rc.2",
30
- "@aztec/bb-prover": "2.0.3-rc.2",
31
- "@aztec/blob-lib": "2.0.3-rc.2",
32
- "@aztec/blob-sink": "2.0.3-rc.2",
33
- "@aztec/constants": "2.0.3-rc.2",
34
- "@aztec/epoch-cache": "2.0.3-rc.2",
35
- "@aztec/ethereum": "2.0.3-rc.2",
36
- "@aztec/foundation": "2.0.3-rc.2",
37
- "@aztec/l1-artifacts": "2.0.3-rc.2",
38
- "@aztec/merkle-tree": "2.0.3-rc.2",
39
- "@aztec/noir-acvm_js": "2.0.3-rc.2",
40
- "@aztec/noir-contracts.js": "2.0.3-rc.2",
41
- "@aztec/noir-protocol-circuits-types": "2.0.3-rc.2",
42
- "@aztec/noir-types": "2.0.3-rc.2",
43
- "@aztec/p2p": "2.0.3-rc.2",
44
- "@aztec/protocol-contracts": "2.0.3-rc.2",
45
- "@aztec/prover-client": "2.0.3-rc.2",
46
- "@aztec/simulator": "2.0.3-rc.2",
47
- "@aztec/slasher": "2.0.3-rc.2",
48
- "@aztec/stdlib": "2.0.3-rc.2",
49
- "@aztec/telemetry-client": "2.0.3-rc.2",
50
- "@aztec/validator-client": "2.0.3-rc.2",
51
- "@aztec/world-state": "2.0.3-rc.2",
29
+ "@aztec/aztec.js": "2.0.3-rc.21",
30
+ "@aztec/bb-prover": "2.0.3-rc.21",
31
+ "@aztec/blob-lib": "2.0.3-rc.21",
32
+ "@aztec/blob-sink": "2.0.3-rc.21",
33
+ "@aztec/constants": "2.0.3-rc.21",
34
+ "@aztec/epoch-cache": "2.0.3-rc.21",
35
+ "@aztec/ethereum": "2.0.3-rc.21",
36
+ "@aztec/foundation": "2.0.3-rc.21",
37
+ "@aztec/l1-artifacts": "2.0.3-rc.21",
38
+ "@aztec/merkle-tree": "2.0.3-rc.21",
39
+ "@aztec/node-keystore": "2.0.3-rc.21",
40
+ "@aztec/noir-acvm_js": "2.0.3-rc.21",
41
+ "@aztec/noir-contracts.js": "2.0.3-rc.21",
42
+ "@aztec/noir-protocol-circuits-types": "2.0.3-rc.21",
43
+ "@aztec/noir-types": "2.0.3-rc.21",
44
+ "@aztec/p2p": "2.0.3-rc.21",
45
+ "@aztec/protocol-contracts": "2.0.3-rc.21",
46
+ "@aztec/prover-client": "2.0.3-rc.21",
47
+ "@aztec/simulator": "2.0.3-rc.21",
48
+ "@aztec/slasher": "2.0.3-rc.21",
49
+ "@aztec/stdlib": "2.0.3-rc.21",
50
+ "@aztec/telemetry-client": "2.0.3-rc.21",
51
+ "@aztec/validator-client": "2.0.3-rc.21",
52
+ "@aztec/world-state": "2.0.3-rc.21",
52
53
  "lodash.chunk": "^4.2.0",
53
54
  "lodash.pick": "^4.4.0",
54
55
  "tslib": "^2.4.0",
55
56
  "viem": "2.23.7"
56
57
  },
57
58
  "devDependencies": {
58
- "@aztec/archiver": "2.0.3-rc.2",
59
- "@aztec/kv-store": "2.0.3-rc.2",
59
+ "@aztec/archiver": "2.0.3-rc.21",
60
+ "@aztec/kv-store": "2.0.3-rc.21",
60
61
  "@jest/globals": "^30.0.0",
61
62
  "@types/jest": "^30.0.0",
62
63
  "@types/lodash.chunk": "^4.2.7",
@@ -84,7 +84,7 @@ export class SequencerClient {
84
84
  telemetry: telemetryClient,
85
85
  } = deps;
86
86
  const { l1RpcUrls: rpcUrls, l1ChainId: chainId } = config;
87
- const log = createLogger('sequencer-client');
87
+ const log = createLogger('sequencer');
88
88
  const publicClient = getPublicClient(config);
89
89
  const l1TxUtils = deps.l1TxUtils;
90
90
  const l1Metrics = new L1Metrics(
@@ -92,7 +92,7 @@ export class SequencerClient {
92
92
  publicClient,
93
93
  l1TxUtils.map(x => x.getSenderAddress()),
94
94
  );
95
- const publisherManager = new PublisherManager(l1TxUtils);
95
+ const publisherManager = new PublisherManager(l1TxUtils, config);
96
96
  const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
97
97
  const [l1GenesisTime, slotDuration] = await Promise.all([
98
98
  rollupContract.getL1GenesisTime(),
@@ -133,6 +133,7 @@ export class SequencerClient {
133
133
  dateProvider: deps.dateProvider,
134
134
  publisherManager,
135
135
  nodeKeyStore: NodeKeystoreAdapter.fromKeyStoreManager(deps.nodeKeyStore),
136
+ logger: log,
136
137
  });
137
138
  const globalsBuilder = new GlobalVariableBuilder(config);
138
139
 
@@ -178,6 +179,7 @@ export class SequencerClient {
178
179
  rollupContract,
179
180
  { ...config, maxL1TxInclusionTimeIntoSlot, maxL2BlockGas: sequencerManaLimit },
180
181
  telemetryClient,
182
+ log,
181
183
  );
182
184
 
183
185
  await sequencer.init();
package/src/config.ts CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  pickConfigMappings,
13
13
  } from '@aztec/foundation/config';
14
14
  import { EthAddress } from '@aztec/foundation/eth-address';
15
+ import { type KeyStoreConfig, keyStoreConfigMappings } from '@aztec/node-keystore';
15
16
  import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p';
16
17
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
17
18
  import { type ChainConfig, type SequencerConfig, chainConfigMappings } from '@aztec/stdlib/config';
@@ -33,6 +34,7 @@ export const DEFAULT_ATTESTATION_PROPAGATION_TIME = 2;
33
34
  * Configuration settings for the SequencerClient.
34
35
  */
35
36
  export type SequencerClientConfig = PublisherConfig &
37
+ KeyStoreConfig &
36
38
  ValidatorClientConfig &
37
39
  TxSenderConfig &
38
40
  SequencerConfig &
@@ -149,6 +151,7 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
149
151
  export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig> = {
150
152
  ...validatorClientConfigMappings,
151
153
  ...sequencerConfigMappings,
154
+ ...keyStoreConfigMappings,
152
155
  ...l1ReaderConfigMappings,
153
156
  ...getTxSenderConfigMappings('SEQ'),
154
157
  ...getPublisherConfigMappings('SEQ'),
@@ -5,7 +5,12 @@ import {
5
5
  l1ReaderConfigMappings,
6
6
  l1TxUtilsConfigMappings,
7
7
  } from '@aztec/ethereum';
8
- import { type ConfigMappingsType, SecretValue, getConfigFromMappings } from '@aztec/foundation/config';
8
+ import {
9
+ type ConfigMappingsType,
10
+ SecretValue,
11
+ booleanConfigHelper,
12
+ getConfigFromMappings,
13
+ } from '@aztec/foundation/config';
9
14
  import { EthAddress } from '@aztec/foundation/eth-address';
10
15
 
11
16
  /**
@@ -21,6 +26,9 @@ export type TxSenderConfig = L1ReaderConfig & {
21
26
  * Publisher addresses to be used with a remote signer
22
27
  */
23
28
  publisherAddresses?: EthAddress[];
29
+
30
+ /** Whether this publisher is enabled */
31
+ publisherEnabled?: boolean;
24
32
  };
25
33
 
26
34
  /**
@@ -28,10 +36,10 @@ export type TxSenderConfig = L1ReaderConfig & {
28
36
  */
29
37
  export type PublisherConfig = L1TxUtilsConfig &
30
38
  BlobSinkConfig & {
31
- /**
32
- * The interval to wait between publish retries.
33
- */
39
+ /** The interval to wait between publish retries. */
34
40
  l1PublishRetryIntervalMS: number;
41
+ /** True to use publishers in invalid states (timed out, cancelled, etc) if no other is available */
42
+ publisherAllowInvalidStates?: boolean;
35
43
  };
36
44
 
37
45
  export const getTxSenderConfigMappings: (
@@ -43,7 +51,7 @@ export const getTxSenderConfigMappings: (
43
51
  description: 'The private keys to be used by the publisher.',
44
52
  parseEnv: (val: string) => val.split(',').map(key => new SecretValue(`0x${key.replace('0x', '')}`)),
45
53
  defaultValue: [],
46
- fallback: scope === 'PROVER' ? ['PROVER_PUBLISHER_PRIVATE_KEY'] : ['SEQ_PUBLISHER_PRIVATE_KEY'],
54
+ fallback: [scope === 'PROVER' ? `PROVER_PUBLISHER_PRIVATE_KEY` : `SEQ_PUBLISHER_PRIVATE_KEY`],
47
55
  },
48
56
  publisherAddresses: {
49
57
  env: scope === 'PROVER' ? `PROVER_PUBLISHER_ADDRESSES` : `SEQ_PUBLISHER_ADDRESSES`,
@@ -51,6 +59,11 @@ export const getTxSenderConfigMappings: (
51
59
  parseEnv: (val: string) => val.split(',').map(address => EthAddress.fromString(address)),
52
60
  defaultValue: [],
53
61
  },
62
+ publisherEnabled: {
63
+ env: scope === 'PROVER' ? `PROVER_PUBLISHER_ENABLED` : `SEQ_PUBLISHER_ENABLED`,
64
+ description: 'Whether this L1 publisher is enabled',
65
+ ...booleanConfigHelper(true),
66
+ },
54
67
  });
55
68
 
56
69
  export function getTxSenderConfigFromEnv(scope: 'PROVER' | 'SEQ'): Omit<TxSenderConfig, 'l1Contracts'> {
@@ -66,6 +79,11 @@ export const getPublisherConfigMappings: (
66
79
  defaultValue: 1000,
67
80
  description: 'The interval to wait between publish retries.',
68
81
  },
82
+ publisherAllowInvalidStates: {
83
+ description: 'True to use publishers in invalid states (timed out, cancelled, etc) if no other is available',
84
+ env: scope === `PROVER` ? `PROVER_PUBLISHER_ALLOW_INVALID_STATES` : `SEQ_PUBLISHER_ALLOW_INVALID_STATES`,
85
+ ...booleanConfigHelper(false),
86
+ },
69
87
  ...l1TxUtilsConfigMappings,
70
88
  ...blobSinkConfigMapping,
71
89
  });
@@ -1,4 +1,4 @@
1
- export { SequencerPublisher, SignalType } from './sequencer-publisher.js';
1
+ export { SequencerPublisher } from './sequencer-publisher.js';
2
2
  export { SequencerPublisherFactory } from './sequencer-publisher-factory.js';
3
3
 
4
4
  // Used for tests