@aztec/sequencer-client 2.0.3-rc.16 → 2.0.3-rc.18

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,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
  }
@@ -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,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,EAAE,MAAM,EAAE,EAClB,eAAe,EAAE,sBAAsB,GAAG,SAAS,EACnD,SAAS,EAAE,kBAAkB,GAC5B,OAAO,CAAC,IAAI,CAAC;IAkBhB;;;;OAIG;cACa,WAAW,IAAI,OAAO,CAClC;QACE,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,EAAE,CAAC;QACZ,WAAW,EAAE,MAAM,CAAC;QACpB,4BAA4B,EAAE,mBAAmB,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,7 +4,7 @@ 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';
@@ -72,10 +72,7 @@ export { SequencerState };
72
72
  publisher;
73
73
  constructor(publisherFactory, validatorClient, globalsBuilder, p2pClient, worldState, slasherClient, l2BlockSource, l1ToL2MessageSource, blockBuilder, l1Constants, dateProvider, epochCache, rollupContract, config, telemetry = getTelemetryClient(), log = createLogger('sequencer')){
74
74
  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');
75
+ this.metrics = new SequencerMetrics(telemetry, this.rollupContract, 'Sequencer');
79
76
  // Initialize config
80
77
  this.updateConfig(this.config);
81
78
  }
@@ -140,7 +137,6 @@ export { SequencerState };
140
137
  /**
141
138
  * Starts the sequencer and moves to IDLE state.
142
139
  */ start() {
143
- this.metrics.start();
144
140
  this.runningPromise = new RunningPromise(this.work.bind(this), this.log, this.pollingIntervalMs);
145
141
  this.setState(SequencerState.IDLE, undefined, {
146
142
  force: true
@@ -152,7 +148,6 @@ export { SequencerState };
152
148
  * Stops the sequencer from processing txs and moves to STOPPED state.
153
149
  */ async stop() {
154
150
  this.log.info(`Stopping sequencer`);
155
- this.metrics.stop();
156
151
  this.publisher?.interrupt();
157
152
  await this.validatorClient?.stop();
158
153
  await this.runningPromise?.stop();
@@ -259,7 +254,6 @@ export { SequencerState };
259
254
  this.publisher = publisher;
260
255
  const coinbase = this.validatorClient.getCoinbaseForAttestor(attestorAddress);
261
256
  const feeRecipient = this.validatorClient.getFeeRecipientForAttestor(attestorAddress);
262
- this.metrics.setCoinbase(coinbase);
263
257
  // Prepare invalidation request if the pending chain is invalid (returns undefined if no need)
264
258
  const invalidateBlock = await publisher.simulateInvalidateBlock(syncedTo.pendingChainValidationStatus);
265
259
  const canProposeCheck = await publisher.canProposeAtNextEthBlock(chainTipArchive, proposerAddressInNextSlot, invalidateBlock);
@@ -317,6 +311,7 @@ export { SequencerState };
317
311
  publisher.enqueueInvalidateBlock(invalidateBlock);
318
312
  }
319
313
  this.setState(SequencerState.INITIALIZING_PROPOSAL, slot);
314
+ this.metrics.incOpenSlot(slot, proposerAddressInNextSlot.toString());
320
315
  this.log.verbose(`Preparing proposal for block ${newBlockNumber} at slot ${slot}`, {
321
316
  proposer: proposerInNextSlot?.toString(),
322
317
  coinbase,
@@ -379,7 +374,7 @@ export { SequencerState };
379
374
  blockNumber: newBlockNumber,
380
375
  slot: Number(slot)
381
376
  });
382
- this.metrics.incFilledSlot(publisher.getSenderAddress().toString());
377
+ await this.metrics.incFilledSlot(publisher.getSenderAddress().toString(), coinbase);
383
378
  } else if (block) {
384
379
  this.emit('block-publish-failed', l1Response ?? {});
385
380
  }
@@ -452,6 +447,7 @@ export { SequencerState };
452
447
  maxTransactions: this.maxTxsPerBlock,
453
448
  maxBlockSize: this.maxBlockSizeInBytes,
454
449
  maxBlockGas: this.maxBlockGas,
450
+ maxBlobFields: BLOBS_PER_BLOCK * FIELDS_PER_BLOB,
455
451
  deadline
456
452
  };
457
453
  }
@@ -470,7 +466,6 @@ export { SequencerState };
470
466
  const blockNumber = newGlobalVariables.blockNumber;
471
467
  const slot = proposalHeader.slotNumber.toBigInt();
472
468
  const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(blockNumber);
473
- // this.metrics.recordNewBlock(blockNumber, validTxs.length);
474
469
  const workTimer = new Timer();
475
470
  this.setState(SequencerState.CREATING_BLOCK, slot);
476
471
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/sequencer-client",
3
- "version": "2.0.3-rc.16",
3
+ "version": "2.0.3-rc.18",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -26,38 +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.16",
30
- "@aztec/bb-prover": "2.0.3-rc.16",
31
- "@aztec/blob-lib": "2.0.3-rc.16",
32
- "@aztec/blob-sink": "2.0.3-rc.16",
33
- "@aztec/constants": "2.0.3-rc.16",
34
- "@aztec/epoch-cache": "2.0.3-rc.16",
35
- "@aztec/ethereum": "2.0.3-rc.16",
36
- "@aztec/foundation": "2.0.3-rc.16",
37
- "@aztec/l1-artifacts": "2.0.3-rc.16",
38
- "@aztec/merkle-tree": "2.0.3-rc.16",
39
- "@aztec/node-keystore": "2.0.3-rc.16",
40
- "@aztec/noir-acvm_js": "2.0.3-rc.16",
41
- "@aztec/noir-contracts.js": "2.0.3-rc.16",
42
- "@aztec/noir-protocol-circuits-types": "2.0.3-rc.16",
43
- "@aztec/noir-types": "2.0.3-rc.16",
44
- "@aztec/p2p": "2.0.3-rc.16",
45
- "@aztec/protocol-contracts": "2.0.3-rc.16",
46
- "@aztec/prover-client": "2.0.3-rc.16",
47
- "@aztec/simulator": "2.0.3-rc.16",
48
- "@aztec/slasher": "2.0.3-rc.16",
49
- "@aztec/stdlib": "2.0.3-rc.16",
50
- "@aztec/telemetry-client": "2.0.3-rc.16",
51
- "@aztec/validator-client": "2.0.3-rc.16",
52
- "@aztec/world-state": "2.0.3-rc.16",
29
+ "@aztec/aztec.js": "2.0.3-rc.18",
30
+ "@aztec/bb-prover": "2.0.3-rc.18",
31
+ "@aztec/blob-lib": "2.0.3-rc.18",
32
+ "@aztec/blob-sink": "2.0.3-rc.18",
33
+ "@aztec/constants": "2.0.3-rc.18",
34
+ "@aztec/epoch-cache": "2.0.3-rc.18",
35
+ "@aztec/ethereum": "2.0.3-rc.18",
36
+ "@aztec/foundation": "2.0.3-rc.18",
37
+ "@aztec/l1-artifacts": "2.0.3-rc.18",
38
+ "@aztec/merkle-tree": "2.0.3-rc.18",
39
+ "@aztec/node-keystore": "2.0.3-rc.18",
40
+ "@aztec/noir-acvm_js": "2.0.3-rc.18",
41
+ "@aztec/noir-contracts.js": "2.0.3-rc.18",
42
+ "@aztec/noir-protocol-circuits-types": "2.0.3-rc.18",
43
+ "@aztec/noir-types": "2.0.3-rc.18",
44
+ "@aztec/p2p": "2.0.3-rc.18",
45
+ "@aztec/protocol-contracts": "2.0.3-rc.18",
46
+ "@aztec/prover-client": "2.0.3-rc.18",
47
+ "@aztec/simulator": "2.0.3-rc.18",
48
+ "@aztec/slasher": "2.0.3-rc.18",
49
+ "@aztec/stdlib": "2.0.3-rc.18",
50
+ "@aztec/telemetry-client": "2.0.3-rc.18",
51
+ "@aztec/validator-client": "2.0.3-rc.18",
52
+ "@aztec/world-state": "2.0.3-rc.18",
53
53
  "lodash.chunk": "^4.2.0",
54
54
  "lodash.pick": "^4.4.0",
55
55
  "tslib": "^2.4.0",
56
56
  "viem": "2.23.7"
57
57
  },
58
58
  "devDependencies": {
59
- "@aztec/archiver": "2.0.3-rc.16",
60
- "@aztec/kv-store": "2.0.3-rc.16",
59
+ "@aztec/archiver": "2.0.3-rc.18",
60
+ "@aztec/kv-store": "2.0.3-rc.18",
61
61
  "@jest/globals": "^30.0.0",
62
62
  "@types/jest": "^30.0.0",
63
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();
@@ -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
@@ -1,4 +1,4 @@
1
- import { EthAddress } from '@aztec/aztec.js';
1
+ import { EthAddress, type Logger, createLogger } from '@aztec/aztec.js';
2
2
  import type { BlobSinkClientInterface } from '@aztec/blob-sink/client';
3
3
  import type { EpochCache } from '@aztec/epoch-cache';
4
4
  import type { GovernanceProposerContract, PublisherFilter, PublisherManager, RollupContract } from '@aztec/ethereum';
@@ -10,7 +10,7 @@ import { NodeKeystoreAdapter } from '@aztec/validator-client';
10
10
 
11
11
  import type { SequencerClientConfig } from '../config.js';
12
12
  import { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
13
- import { SequencerPublisher } from './sequencer-publisher.js';
13
+ import { type Action, SequencerPublisher } from './sequencer-publisher.js';
14
14
 
15
15
  export type AttestorPublisherPair = {
16
16
  attestorAddress: EthAddress;
@@ -19,6 +19,12 @@ export type AttestorPublisherPair = {
19
19
 
20
20
  export class SequencerPublisherFactory {
21
21
  private publisherMetrics: SequencerPublisherMetrics;
22
+
23
+ /** Stores the last slot in which every action was carried out by a publisher */
24
+ private lastActions: Partial<Record<Action, bigint>> = {};
25
+
26
+ private logger: Logger;
27
+
22
28
  constructor(
23
29
  private sequencerConfig: SequencerClientConfig,
24
30
  private deps: {
@@ -31,9 +37,11 @@ export class SequencerPublisherFactory {
31
37
  governanceProposerContract: GovernanceProposerContract;
32
38
  slashFactoryContract: SlashFactoryContract;
33
39
  nodeKeyStore: NodeKeystoreAdapter;
40
+ logger?: Logger;
34
41
  },
35
42
  ) {
36
43
  this.publisherMetrics = new SequencerPublisherMetrics(deps.telemetry, 'SequencerPublisher');
44
+ this.logger = deps.logger ?? createLogger('sequencer');
37
45
  }
38
46
  /**
39
47
  * Creates a new SequencerPublisher instance.
@@ -69,6 +77,8 @@ export class SequencerPublisherFactory {
69
77
  slashFactoryContract: this.deps.slashFactoryContract,
70
78
  dateProvider: this.deps.dateProvider,
71
79
  metrics: this.publisherMetrics,
80
+ lastActions: this.lastActions,
81
+ log: this.logger.createChild('publisher'),
72
82
  });
73
83
 
74
84
  return {