@aztec/sequencer-client 0.73.0 → 0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2

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.
Files changed (88) hide show
  1. package/dest/client/index.js +0 -1
  2. package/dest/client/sequencer-client.js +55 -55
  3. package/dest/config.js +40 -42
  4. package/dest/global_variable_builder/global_builder.js +39 -26
  5. package/dest/global_variable_builder/index.js +0 -1
  6. package/dest/index.js +0 -1
  7. package/dest/publisher/config.js +49 -50
  8. package/dest/publisher/index.js +0 -1
  9. package/dest/publisher/sequencer-publisher-metrics.js +32 -23
  10. package/dest/publisher/sequencer-publisher.js +251 -253
  11. package/dest/sequencer/allowed.js +5 -12
  12. package/dest/sequencer/config.js +1 -2
  13. package/dest/sequencer/index.js +0 -1
  14. package/dest/sequencer/metrics.js +26 -18
  15. package/dest/sequencer/sequencer.js +648 -607
  16. package/dest/sequencer/timetable.js +33 -19
  17. package/dest/sequencer/utils.js +22 -32
  18. package/dest/slasher/factory.js +6 -5
  19. package/dest/slasher/index.js +0 -1
  20. package/dest/slasher/slasher_client.js +128 -122
  21. package/dest/test/index.js +4 -1
  22. package/dest/tx_validator/archive_cache.js +7 -7
  23. package/dest/tx_validator/gas_validator.js +76 -64
  24. package/dest/tx_validator/nullifier_cache.js +8 -8
  25. package/dest/tx_validator/phases_validator.js +27 -19
  26. package/dest/tx_validator/test_utils.js +1 -2
  27. package/dest/tx_validator/tx_validator_factory.js +5 -5
  28. package/package.json +23 -22
  29. package/src/client/sequencer-client.ts +23 -2
  30. package/src/config.ts +1 -1
  31. package/src/publisher/sequencer-publisher.ts +71 -91
  32. package/src/sequencer/sequencer.ts +29 -13
  33. package/src/slasher/factory.ts +3 -3
  34. package/src/slasher/slasher_client.ts +40 -31
  35. package/dest/client/index.d.ts +0 -2
  36. package/dest/client/index.d.ts.map +0 -1
  37. package/dest/client/sequencer-client.d.ts +0 -68
  38. package/dest/client/sequencer-client.d.ts.map +0 -1
  39. package/dest/config.d.ts +0 -37
  40. package/dest/config.d.ts.map +0 -1
  41. package/dest/global_variable_builder/global_builder.d.ts +0 -29
  42. package/dest/global_variable_builder/global_builder.d.ts.map +0 -1
  43. package/dest/global_variable_builder/index.d.ts +0 -2
  44. package/dest/global_variable_builder/index.d.ts.map +0 -1
  45. package/dest/index.d.ts +0 -8
  46. package/dest/index.d.ts.map +0 -1
  47. package/dest/publisher/config.d.ts +0 -38
  48. package/dest/publisher/config.d.ts.map +0 -1
  49. package/dest/publisher/index.d.ts +0 -2
  50. package/dest/publisher/index.d.ts.map +0 -1
  51. package/dest/publisher/sequencer-publisher-metrics.d.ts +0 -24
  52. package/dest/publisher/sequencer-publisher-metrics.d.ts.map +0 -1
  53. package/dest/publisher/sequencer-publisher.d.ts +0 -158
  54. package/dest/publisher/sequencer-publisher.d.ts.map +0 -1
  55. package/dest/sequencer/allowed.d.ts +0 -3
  56. package/dest/sequencer/allowed.d.ts.map +0 -1
  57. package/dest/sequencer/config.d.ts +0 -2
  58. package/dest/sequencer/config.d.ts.map +0 -1
  59. package/dest/sequencer/index.d.ts +0 -4
  60. package/dest/sequencer/index.d.ts.map +0 -1
  61. package/dest/sequencer/metrics.d.ts +0 -24
  62. package/dest/sequencer/metrics.d.ts.map +0 -1
  63. package/dest/sequencer/sequencer.d.ts +0 -172
  64. package/dest/sequencer/sequencer.d.ts.map +0 -1
  65. package/dest/sequencer/timetable.d.ts +0 -38
  66. package/dest/sequencer/timetable.d.ts.map +0 -1
  67. package/dest/sequencer/utils.d.ts +0 -47
  68. package/dest/sequencer/utils.d.ts.map +0 -1
  69. package/dest/slasher/factory.d.ts +0 -11
  70. package/dest/slasher/factory.d.ts.map +0 -1
  71. package/dest/slasher/index.d.ts +0 -3
  72. package/dest/slasher/index.d.ts.map +0 -1
  73. package/dest/slasher/slasher_client.d.ts +0 -127
  74. package/dest/slasher/slasher_client.d.ts.map +0 -1
  75. package/dest/test/index.d.ts +0 -17
  76. package/dest/test/index.d.ts.map +0 -1
  77. package/dest/tx_validator/archive_cache.d.ts +0 -14
  78. package/dest/tx_validator/archive_cache.d.ts.map +0 -1
  79. package/dest/tx_validator/gas_validator.d.ts +0 -12
  80. package/dest/tx_validator/gas_validator.d.ts.map +0 -1
  81. package/dest/tx_validator/nullifier_cache.d.ts +0 -16
  82. package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
  83. package/dest/tx_validator/phases_validator.d.ts +0 -11
  84. package/dest/tx_validator/phases_validator.d.ts.map +0 -1
  85. package/dest/tx_validator/test_utils.d.ts +0 -21
  86. package/dest/tx_validator/test_utils.d.ts.map +0 -1
  87. package/dest/tx_validator/tx_validator_factory.d.ts +0 -16
  88. package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
@@ -19,6 +19,7 @@ import {
19
19
  GENESIS_ARCHIVE_ROOT,
20
20
  Gas,
21
21
  type GlobalVariables,
22
+ INITIAL_L2_BLOCK_NUM,
22
23
  StateReference,
23
24
  } from '@aztec/circuits.js';
24
25
  import { AztecAddress } from '@aztec/foundation/aztec-address';
@@ -232,20 +233,18 @@ export class Sequencer {
232
233
  protected async doRealWork() {
233
234
  this.setState(SequencerState.SYNCHRONIZING, 0n);
234
235
  // Update state when the previous block has been synced
235
- const prevBlockSynced = await this.isBlockSynced();
236
+ const chainTip = await this.getChainTip();
236
237
  // Do not go forward with new block if the previous one has not been mined and processed
237
- if (!prevBlockSynced) {
238
+ if (!chainTip) {
238
239
  return;
239
240
  }
240
241
 
241
242
  this.setState(SequencerState.PROPOSER_CHECK, 0n);
242
243
 
243
- const chainTip = await this.l2BlockSource.getBlock(-1);
244
-
245
- const newBlockNumber = (chainTip?.header.globalVariables.blockNumber.toNumber() ?? 0) + 1;
244
+ const newBlockNumber = chainTip.blockNumber + 1;
246
245
 
247
246
  // If we cannot find a tip archive, assume genesis.
248
- const chainTipArchive = chainTip?.archive.root ?? new Fr(GENESIS_ARCHIVE_ROOT);
247
+ const chainTipArchive = chainTip.archive;
249
248
 
250
249
  const slot = await this.slotForProposal(chainTipArchive.toBuffer(), BigInt(newBlockNumber));
251
250
  if (!slot) {
@@ -253,7 +252,7 @@ export class Sequencer {
253
252
  return;
254
253
  }
255
254
 
256
- this.log.info(`Can propose block ${newBlockNumber} at slot ${slot}`);
255
+ this.log.debug(`Can propose block ${newBlockNumber} at slot ${slot}`);
257
256
 
258
257
  const newGlobalVariables = await this.globalsBuilder.buildGlobalVariables(
259
258
  new Fr(newBlockNumber),
@@ -763,14 +762,16 @@ export class Sequencer {
763
762
  * We don't check against the previous block submitted since it may have been reorg'd out.
764
763
  * @returns Boolean indicating if our dependencies are synced to the latest block.
765
764
  */
766
- protected async isBlockSynced() {
765
+ protected async getChainTip(): Promise<{ blockNumber: number; archive: Fr } | undefined> {
767
766
  const syncedBlocks = await Promise.all([
768
767
  this.worldState.status().then((s: WorldStateSynchronizerStatus) => s.syncedToL2Block),
769
768
  this.l2BlockSource.getL2Tips().then(t => t.latest),
770
- this.p2pClient.getStatus().then(s => s.syncedToL2Block.number),
769
+ this.p2pClient.getStatus().then(p2p => p2p.syncedToL2Block),
771
770
  this.l1ToL2MessageSource.getBlockNumber(),
772
771
  ] as const);
772
+
773
773
  const [worldState, l2BlockSource, p2p, l1ToL2MessageSource] = syncedBlocks;
774
+
774
775
  const result =
775
776
  // check that world state has caught up with archiver
776
777
  // note that the archiver reports undefined hash for the genesis block
@@ -780,18 +781,33 @@ export class Sequencer {
780
781
  // this should change to hashes once p2p client handles reorgs
781
782
  // and once we stop pretending that the l1tol2message source is not
782
783
  // just the archiver under a different name
783
- p2p >= l2BlockSource.number &&
784
- l1ToL2MessageSource >= l2BlockSource.number;
784
+ (!l2BlockSource.hash || p2p.hash === l2BlockSource.hash) &&
785
+ l1ToL2MessageSource === l2BlockSource.number;
785
786
 
786
787
  this.log.debug(`Sequencer sync check ${result ? 'succeeded' : 'failed'}`, {
787
788
  worldStateNumber: worldState.number,
788
789
  worldStateHash: worldState.hash,
789
790
  l2BlockSourceNumber: l2BlockSource.number,
790
791
  l2BlockSourceHash: l2BlockSource.hash,
791
- p2pNumber: p2p,
792
+ p2pNumber: p2p.number,
793
+ p2pHash: p2p.hash,
792
794
  l1ToL2MessageSourceNumber: l1ToL2MessageSource,
793
795
  });
794
- return result;
796
+
797
+ if (!result) {
798
+ return undefined;
799
+ }
800
+ if (worldState.number >= INITIAL_L2_BLOCK_NUM) {
801
+ const block = await this.l2BlockSource.getBlock(worldState.number);
802
+ if (!block) {
803
+ // this shouldn't really happen because a moment ago we checked that all components were in synch
804
+ return undefined;
805
+ }
806
+
807
+ return { blockNumber: block.number, archive: block.archive.root };
808
+ } else {
809
+ return { blockNumber: INITIAL_L2_BLOCK_NUM - 1, archive: new Fr(GENESIS_ARCHIVE_ROOT) };
810
+ }
795
811
  }
796
812
 
797
813
  private getSlotStartTimestamp(slotNumber: number | bigint): number {
@@ -1,9 +1,9 @@
1
1
  import type { L2BlockSource } from '@aztec/circuit-types';
2
2
  import { type L1ContractsConfig, type L1ReaderConfig } from '@aztec/ethereum';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
- import { type AztecKVStore } from '@aztec/kv-store';
4
+ import { type AztecAsyncKVStore } from '@aztec/kv-store';
5
5
  import { type DataStoreConfig } from '@aztec/kv-store/config';
6
- import { createStore } from '@aztec/kv-store/lmdb';
6
+ import { createStore } from '@aztec/kv-store/lmdb-v2';
7
7
  import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
8
8
 
9
9
  import { SlasherClient } from './slasher_client.js';
@@ -13,7 +13,7 @@ export const createSlasherClient = async (
13
13
  _config: SlasherConfig & DataStoreConfig & L1ContractsConfig & L1ReaderConfig,
14
14
  l2BlockSource: L2BlockSource,
15
15
  telemetry: TelemetryClient = getTelemetryClient(),
16
- deps: { store?: AztecKVStore } = {},
16
+ deps: { store?: AztecAsyncKVStore } = {},
17
17
  ) => {
18
18
  const config = { ..._config };
19
19
  const store = deps.store ?? (await createStore('slasher', config, createLogger('slasher:lmdb')));
@@ -10,7 +10,7 @@ import { INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js/constants';
10
10
  import { type L1ContractsConfig, type L1ReaderConfig, createEthereumChain } from '@aztec/ethereum';
11
11
  import { EthAddress } from '@aztec/foundation/eth-address';
12
12
  import { createLogger } from '@aztec/foundation/log';
13
- import { type AztecKVStore, type AztecMap, type AztecSingleton } from '@aztec/kv-store';
13
+ import type { AztecAsyncKVStore, AztecAsyncMap, AztecAsyncSingleton } from '@aztec/kv-store';
14
14
  import { SlashFactoryAbi } from '@aztec/l1-artifacts';
15
15
  import { type TelemetryClient, WithTracer, getTelemetryClient } from '@aztec/telemetry-client';
16
16
 
@@ -92,9 +92,9 @@ export class SlasherClient extends WithTracer {
92
92
  private latestBlockNumberAtStart = -1;
93
93
  private provenBlockNumberAtStart = -1;
94
94
 
95
- private synchedBlockHashes: AztecMap<number, string>;
96
- private synchedLatestBlockNumber: AztecSingleton<number>;
97
- private synchedProvenBlockNumber: AztecSingleton<number>;
95
+ private synchedBlockHashes: AztecAsyncMap<number, string>;
96
+ private synchedLatestBlockNumber: AztecAsyncSingleton<number>;
97
+ private synchedProvenBlockNumber: AztecAsyncSingleton<number>;
98
98
 
99
99
  private blockStream;
100
100
 
@@ -110,7 +110,7 @@ export class SlasherClient extends WithTracer {
110
110
 
111
111
  constructor(
112
112
  private config: SlasherConfig & L1ContractsConfig & L1ReaderConfig,
113
- private store: AztecKVStore,
113
+ private store: AztecAsyncKVStore,
114
114
  private l2BlockSource: L2BlockSource,
115
115
  telemetry: TelemetryClient = getTelemetryClient(),
116
116
  private log = createLogger('slasher'),
@@ -178,17 +178,17 @@ export class SlasherClient extends WithTracer {
178
178
  }
179
179
 
180
180
  public getL2BlockHash(number: number): Promise<string | undefined> {
181
- return Promise.resolve(this.synchedBlockHashes.get(number));
181
+ return this.synchedBlockHashes.getAsync(number);
182
182
  }
183
183
 
184
- public getL2Tips(): Promise<L2Tips> {
185
- const latestBlockNumber = this.getSyncedLatestBlockNum();
184
+ public async getL2Tips(): Promise<L2Tips> {
185
+ const latestBlockNumber = await this.getSyncedLatestBlockNum();
186
186
  let latestBlockHash: string | undefined;
187
- const provenBlockNumber = this.getSyncedProvenBlockNum();
187
+ const provenBlockNumber = await this.getSyncedProvenBlockNum();
188
188
  let provenBlockHash: string | undefined;
189
189
 
190
190
  if (latestBlockNumber > 0) {
191
- latestBlockHash = this.synchedBlockHashes.get(latestBlockNumber);
191
+ latestBlockHash = await this.synchedBlockHashes.getAsync(latestBlockNumber);
192
192
  if (typeof latestBlockHash === 'undefined') {
193
193
  this.log.warn(`Block hash for latest block ${latestBlockNumber} not found`);
194
194
  throw new Error();
@@ -196,7 +196,7 @@ export class SlasherClient extends WithTracer {
196
196
  }
197
197
 
198
198
  if (provenBlockNumber > 0) {
199
- provenBlockHash = this.synchedBlockHashes.get(provenBlockNumber);
199
+ provenBlockHash = await this.synchedBlockHashes.getAsync(provenBlockNumber);
200
200
  if (typeof provenBlockHash === 'undefined') {
201
201
  this.log.warn(`Block hash for proven block ${provenBlockNumber} not found`);
202
202
  throw new Error();
@@ -220,7 +220,7 @@ export class SlasherClient extends WithTracer {
220
220
  // TODO (alexg): I think we can prune the block hashes map here
221
221
  break;
222
222
  case 'chain-proven': {
223
- const from = this.getSyncedProvenBlockNum() + 1;
223
+ const from = (await this.getSyncedProvenBlockNum()) + 1;
224
224
  const limit = event.blockNumber - from + 1;
225
225
  await this.handleProvenL2Blocks(await this.l2BlockSource.getBlocks(from, limit));
226
226
  break;
@@ -247,8 +247,8 @@ export class SlasherClient extends WithTracer {
247
247
  this.latestBlockNumberAtStart = await this.l2BlockSource.getBlockNumber();
248
248
  this.provenBlockNumberAtStart = await this.l2BlockSource.getProvenBlockNumber();
249
249
 
250
- const syncedLatestBlock = this.getSyncedLatestBlockNum() + 1;
251
- const syncedProvenBlock = this.getSyncedProvenBlockNum() + 1;
250
+ const syncedLatestBlock = (await this.getSyncedLatestBlockNum()) + 1;
251
+ const syncedProvenBlock = (await this.getSyncedProvenBlockNum()) + 1;
252
252
 
253
253
  // if there are blocks to be retrieved, go to a synching state
254
254
  if (syncedLatestBlock <= this.latestBlockNumberAtStart || syncedProvenBlock <= this.provenBlockNumberAtStart) {
@@ -278,6 +278,8 @@ export class SlasherClient extends WithTracer {
278
278
  this.log.debug('Stopping Slasher client...');
279
279
  await this.blockStream.stop();
280
280
  this.log.debug('Stopped block downloader');
281
+ await this.store.close();
282
+ this.log.debug('Stopped slasher store');
281
283
  this.setCurrentState(SlasherClientState.STOPPED);
282
284
  this.log.info('Slasher client stopped.');
283
285
  }
@@ -294,16 +296,16 @@ export class SlasherClient extends WithTracer {
294
296
  * Public function to check the latest block number that the slasher client is synced to.
295
297
  * @returns Block number of latest L2 Block we've synced with.
296
298
  */
297
- public getSyncedLatestBlockNum() {
298
- return this.synchedLatestBlockNumber.get() ?? INITIAL_L2_BLOCK_NUM - 1;
299
+ public async getSyncedLatestBlockNum(): Promise<number> {
300
+ return (await this.synchedLatestBlockNumber.getAsync()) ?? INITIAL_L2_BLOCK_NUM - 1;
299
301
  }
300
302
 
301
303
  /**
302
304
  * Public function to check the latest proven block number that the slasher client is synced to.
303
305
  * @returns Block number of latest proven L2 Block we've synced with.
304
306
  */
305
- public getSyncedProvenBlockNum() {
306
- return this.synchedProvenBlockNumber.get() ?? INITIAL_L2_BLOCK_NUM - 1;
307
+ public async getSyncedProvenBlockNum(): Promise<number> {
308
+ return (await this.synchedProvenBlockNumber.getAsync()) ?? INITIAL_L2_BLOCK_NUM - 1;
307
309
  }
308
310
 
309
311
  /**
@@ -311,7 +313,7 @@ export class SlasherClient extends WithTracer {
311
313
  * @returns Information about slasher client status: state & syncedToBlockNum.
312
314
  */
313
315
  public async getStatus(): Promise<SlasherSyncState> {
314
- const blockNumber = this.getSyncedLatestBlockNum();
316
+ const blockNumber = await this.getSyncedLatestBlockNum();
315
317
  const blockHash =
316
318
  blockNumber == 0
317
319
  ? ''
@@ -332,16 +334,19 @@ export class SlasherClient extends WithTracer {
332
334
  */
333
335
  private async handleLatestL2Blocks(blocks: L2Block[]): Promise<void> {
334
336
  if (!blocks.length) {
335
- return Promise.resolve();
337
+ return;
336
338
  }
337
339
 
338
- const lastBlockNum = blocks[blocks.length - 1].number;
339
- await Promise.all(
340
- blocks.map(async block => this.synchedBlockHashes.set(block.number, (await block.hash()).toString())),
341
- );
342
- await this.synchedLatestBlockNumber.set(lastBlockNum);
343
- this.log.debug(`Synched to latest block ${lastBlockNum}`);
344
- this.startServiceIfSynched();
340
+ await this.store.transactionAsync(async () => {
341
+ for (const block of blocks) {
342
+ await this.synchedBlockHashes.set(block.number, (await block.hash()).toString());
343
+ }
344
+
345
+ const lastBlockNum = blocks[blocks.length - 1].number;
346
+ await this.synchedLatestBlockNumber.set(lastBlockNum);
347
+ });
348
+
349
+ await this.startServiceIfSynched();
345
350
  }
346
351
 
347
352
  /**
@@ -357,7 +362,7 @@ export class SlasherClient extends WithTracer {
357
362
  await this.synchedProvenBlockNumber.set(lastBlockNum);
358
363
  this.log.debug(`Synched to proven block ${lastBlockNum}`);
359
364
 
360
- this.startServiceIfSynched();
365
+ await this.startServiceIfSynched();
361
366
  }
362
367
 
363
368
  private async handlePruneL2Blocks(latestBlock: number): Promise<void> {
@@ -381,11 +386,15 @@ export class SlasherClient extends WithTracer {
381
386
  await this.synchedLatestBlockNumber.set(latestBlock);
382
387
  }
383
388
 
384
- private startServiceIfSynched() {
389
+ private async startServiceIfSynched() {
390
+ const [latestBlock, provenBlock] = await Promise.all([
391
+ this.getSyncedLatestBlockNum(),
392
+ this.getSyncedProvenBlockNum(),
393
+ ]);
385
394
  if (
386
395
  this.currentState === SlasherClientState.SYNCHING &&
387
- this.getSyncedLatestBlockNum() >= this.latestBlockNumberAtStart &&
388
- this.getSyncedProvenBlockNum() >= this.provenBlockNumberAtStart
396
+ latestBlock >= this.latestBlockNumberAtStart &&
397
+ provenBlock >= this.provenBlockNumberAtStart
389
398
  ) {
390
399
  this.log.debug(`Synched to blocks at start`);
391
400
  this.setCurrentState(SlasherClientState.RUNNING);
@@ -1,2 +0,0 @@
1
- export * from './sequencer-client.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
@@ -1,68 +0,0 @@
1
- import { type BlobSinkClientInterface } from '@aztec/blob-sink/client';
2
- import { type L1ToL2MessageSource, type L2BlockSource, type WorldStateSynchronizer } from '@aztec/circuit-types';
3
- import { type AztecAddress, type ContractDataSource } from '@aztec/circuits.js';
4
- import { EpochCache } from '@aztec/epoch-cache';
5
- import { L1TxUtilsWithBlobs } from '@aztec/ethereum';
6
- import { EthAddress } from '@aztec/foundation/eth-address';
7
- import { type DateProvider } from '@aztec/foundation/timer';
8
- import { type P2P } from '@aztec/p2p';
9
- import { type TelemetryClient } from '@aztec/telemetry-client';
10
- import { type ValidatorClient } from '@aztec/validator-client';
11
- import { type SequencerClientConfig } from '../config.js';
12
- import { SequencerPublisher } from '../publisher/index.js';
13
- import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
14
- import { type SlasherClient } from '../slasher/index.js';
15
- /**
16
- * Encapsulates the full sequencer and publisher.
17
- */
18
- export declare class SequencerClient {
19
- protected sequencer: Sequencer;
20
- constructor(sequencer: Sequencer);
21
- /**
22
- * Initializes and starts a new instance.
23
- * @param config - Configuration for the sequencer, publisher, and L1 tx sender.
24
- * @param p2pClient - P2P client that provides the txs to be sequenced.
25
- * @param validatorClient - Validator client performs attestation duties when rotating proposers.
26
- * @param worldStateSynchronizer - Provides access to world state.
27
- * @param contractDataSource - Provides access to contract bytecode for public executions.
28
- * @param l2BlockSource - Provides information about the previously published blocks.
29
- * @param l1ToL2MessageSource - Provides access to L1 to L2 messages.
30
- * @param prover - An instance of a block prover
31
- * @param simulationProvider - An instance of a simulation provider
32
- * @returns A new running instance.
33
- */
34
- static new(config: SequencerClientConfig, deps: {
35
- validatorClient: ValidatorClient | undefined;
36
- p2pClient: P2P;
37
- worldStateSynchronizer: WorldStateSynchronizer;
38
- slasherClient: SlasherClient;
39
- contractDataSource: ContractDataSource;
40
- l2BlockSource: L2BlockSource;
41
- l1ToL2MessageSource: L1ToL2MessageSource;
42
- telemetry: TelemetryClient;
43
- publisher?: SequencerPublisher;
44
- blobSinkClient?: BlobSinkClientInterface;
45
- dateProvider: DateProvider;
46
- epochCache?: EpochCache;
47
- l1TxUtils?: L1TxUtilsWithBlobs;
48
- }): Promise<SequencerClient>;
49
- /**
50
- * Updates sequencer config.
51
- * @param config - New parameters.
52
- */
53
- updateSequencerConfig(config: SequencerConfig): Promise<void>;
54
- /**
55
- * Stops the sequencer from processing new txs.
56
- */
57
- stop(): Promise<void>;
58
- /** Forces the sequencer to bypass all time and tx count checks for the next block and build anyway. */
59
- flush(): void;
60
- /**
61
- * Restarts the sequencer after being stopped.
62
- */
63
- restart(): void;
64
- get coinbase(): EthAddress;
65
- get feeRecipient(): AztecAddress;
66
- get forwarderAddress(): EthAddress;
67
- }
68
- //# sourceMappingURL=sequencer-client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sequencer-client.d.ts","sourceRoot":"","sources":["../../src/client/sequencer-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,aAAa,EAAE,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACjH,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAEL,kBAAkB,EAKnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;GAEG;AACH,qBAAa,eAAe;IACd,SAAS,CAAC,SAAS,EAAE,SAAS;gBAApB,SAAS,EAAE,SAAS;IAE1C;;;;;;;;;;;;OAYG;WACiB,GAAG,CACrB,MAAM,EAAE,qBAAqB,EAC7B,IAAI,EAAE;QACJ,eAAe,EAAE,eAAe,GAAG,SAAS,CAAC;QAC7C,SAAS,EAAE,GAAG,CAAC;QACf,sBAAsB,EAAE,sBAAsB,CAAC;QAC/C,aAAa,EAAE,aAAa,CAAC;QAC7B,kBAAkB,EAAE,kBAAkB,CAAC;QACvC,aAAa,EAAE,aAAa,CAAC;QAC7B,mBAAmB,EAAE,mBAAmB,CAAC;QACzC,SAAS,EAAE,eAAe,CAAC;QAC3B,SAAS,CAAC,EAAE,kBAAkB,CAAC;QAC/B,cAAc,CAAC,EAAE,uBAAuB,CAAC;QACzC,YAAY,EAAE,YAAY,CAAC;QAC3B,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,SAAS,CAAC,EAAE,kBAAkB,CAAC;KAChC;IA8FH;;;OAGG;IACI,qBAAqB,CAAC,MAAM,EAAE,eAAe;IAIpD;;OAEG;IACU,IAAI;IAIjB,uGAAuG;IAChG,KAAK;IAIZ;;OAEG;IACI,OAAO;IAId,IAAI,QAAQ,IAAI,UAAU,CAEzB;IAED,IAAI,YAAY,IAAI,YAAY,CAE/B;IAED,IAAI,gBAAgB,IAAI,UAAU,CAEjC;CACF"}
package/dest/config.d.ts DELETED
@@ -1,37 +0,0 @@
1
- import { type AllowedElement, type SequencerConfig } from '@aztec/circuit-types/config';
2
- import { type L1ContractsConfig, type L1ReaderConfig } from '@aztec/ethereum';
3
- import { type ConfigMappingsType } from '@aztec/foundation/config';
4
- import { type PublisherConfig, type TxSenderConfig } from './publisher/config.js';
5
- export * from './publisher/config.js';
6
- export { SequencerConfig };
7
- /** Chain configuration. */
8
- type ChainConfig = {
9
- /** The chain id of the ethereum host. */
10
- l1ChainId: number;
11
- /** The version of the rollup. */
12
- version: number;
13
- };
14
- /**
15
- * Configuration settings for the SequencerClient.
16
- */
17
- export type SequencerClientConfig = PublisherConfig & TxSenderConfig & SequencerConfig & L1ReaderConfig & ChainConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
18
- export declare const sequencerConfigMappings: ConfigMappingsType<SequencerConfig>;
19
- export declare const chainConfigMappings: ConfigMappingsType<ChainConfig>;
20
- export declare const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig>;
21
- /**
22
- * Creates an instance of SequencerClientConfig out of environment variables using sensible defaults for integration testing if not set.
23
- */
24
- export declare function getConfigEnvVars(): SequencerClientConfig;
25
- /**
26
- * Parses a string to a list of allowed elements.
27
- * Each encoded is expected to be of one of the following formats
28
- * `I:${address}`
29
- * `I:${address}:${selector}`
30
- * `C:${classId}`
31
- * `C:${classId}:${selector}`
32
- *
33
- * @param value The string to parse
34
- * @returns A list of allowed elements
35
- */
36
- export declare function parseSequencerAllowList(value: string): AllowedElement[];
37
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAExF,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAGpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EAGpB,MAAM,uBAAuB,CAAC;AAE/B,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,2BAA2B;AAC3B,KAAK,WAAW,GAAG;IACjB,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,eAAe,GACjD,cAAc,GACd,eAAe,GACf,cAAc,GACd,WAAW,GACX,IAAI,CAAC,iBAAiB,EAAE,sBAAsB,GAAG,mBAAmB,GAAG,oBAAoB,CAAC,CAAC;AAE/F,eAAO,MAAM,uBAAuB,EAAE,kBAAkB,CAAC,eAAe,CA8EvE,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,kBAAkB,CAAC,WAAW,CAO/D,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,kBAAkB,CAAC,qBAAqB,CAOnF,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,CAExD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,CAqCvE"}
@@ -1,29 +0,0 @@
1
- import { type GlobalVariableBuilder as GlobalVariableBuilderInterface } from '@aztec/circuit-types';
2
- import { type AztecAddress, type EthAddress, GasFees, GlobalVariables } from '@aztec/circuits.js';
3
- import { type L1ContractsConfig, type L1ReaderConfig } from '@aztec/ethereum';
4
- import { Fr } from '@aztec/foundation/fields';
5
- /**
6
- * Simple global variables builder.
7
- */
8
- export declare class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
9
- private log;
10
- private rollupContract;
11
- private publicClient;
12
- private ethereumSlotDuration;
13
- constructor(config: L1ReaderConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration'>);
14
- /**
15
- * Computes the "current" base fees, e.g., the price that you currently should pay to get include in the next block
16
- * @returns Base fees for the expected next block
17
- */
18
- getCurrentBaseFees(): Promise<GasFees>;
19
- /**
20
- * Simple builder of global variables that use the minimum time possible.
21
- * @param blockNumber - The block number to build global variables for.
22
- * @param coinbase - The address to receive block reward.
23
- * @param feeRecipient - The address to receive fees.
24
- * @param slotNumber - The slot number to use for the global variables, if undefined it will be calculated.
25
- * @returns The global variables for the given block number.
26
- */
27
- buildGlobalVariables(blockNumber: Fr, coinbase: EthAddress, feeRecipient: AztecAddress, slotNumber?: bigint): Promise<GlobalVariables>;
28
- }
29
- //# sourceMappingURL=global_builder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"global_builder.d.ts","sourceRoot":"","sources":["../../src/global_variable_builder/global_builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,IAAI,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAuB,MAAM,iBAAiB,CAAC;AACnG,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAe9C;;GAEG;AACH,qBAAa,qBAAsB,YAAW,8BAA8B;IAC1E,OAAO,CAAC,GAAG,CAAqD;IAEhE,OAAO,CAAC,cAAc,CAAqF;IAC3G,OAAO,CAAC,YAAY,CAA4C;IAChE,OAAO,CAAC,oBAAoB,CAAS;gBAEzB,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;IAoBpF;;;OAGG;IACU,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IAanD;;;;;;;OAOG;IACU,oBAAoB,CAC/B,WAAW,EAAE,EAAE,EACf,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,eAAe,CAAC;CA8B5B"}
@@ -1,2 +0,0 @@
1
- export { GlobalVariableBuilder } from './global_builder.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/global_variable_builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
package/dest/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export * from './client/index.js';
2
- export * from './config.js';
3
- export * from './publisher/index.js';
4
- export * from './tx_validator/tx_validator_factory.js';
5
- export * from './slasher/index.js';
6
- export { Sequencer, SequencerState, getDefaultAllowedSetupFunctions } from './sequencer/index.js';
7
- export * from './global_variable_builder/index.js';
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,wCAAwC,CAAC;AACvD,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAIlG,cAAc,oCAAoC,CAAC"}
@@ -1,38 +0,0 @@
1
- import { type L1ReaderConfig, type L1TxUtilsConfig } from '@aztec/ethereum';
2
- import { type ConfigMappingsType } from '@aztec/foundation/config';
3
- import { EthAddress } from '@aztec/foundation/eth-address';
4
- /**
5
- * The configuration of the rollup transaction publisher.
6
- */
7
- export type TxSenderConfig = L1ReaderConfig & {
8
- /**
9
- * The private key to be used by the publisher.
10
- */
11
- publisherPrivateKey: `0x${string}`;
12
- /**
13
- * The number of confirmations required.
14
- */
15
- requiredConfirmations: number;
16
- /**
17
- * The address of the custom forwarder contract.
18
- */
19
- customForwarderContractAddress: EthAddress;
20
- };
21
- /**
22
- * Configuration of the L1Publisher.
23
- */
24
- export type PublisherConfig = L1TxUtilsConfig & {
25
- /**
26
- * The interval to wait between publish retries.
27
- */
28
- l1PublishRetryIntervalMS: number;
29
- /**
30
- * The URL of the blob sink.
31
- */
32
- blobSinkUrl?: string;
33
- };
34
- export declare const getTxSenderConfigMappings: (scope: 'PROVER' | 'SEQ') => ConfigMappingsType<Omit<TxSenderConfig, 'l1Contracts'>>;
35
- export declare function getTxSenderConfigFromEnv(scope: 'PROVER' | 'SEQ'): Omit<TxSenderConfig, 'l1Contracts'>;
36
- export declare const getPublisherConfigMappings: (scope: 'PROVER' | 'SEQ') => ConfigMappingsType<PublisherConfig & L1TxUtilsConfig>;
37
- export declare function getPublisherConfigFromEnv(scope: 'PROVER' | 'SEQ'): PublisherConfig;
38
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/publisher/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAqC,MAAM,iBAAiB,CAAC;AAC/G,OAAO,EAAE,KAAK,kBAAkB,EAA6C,MAAM,0BAA0B,CAAC;AAC9G,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C;;OAEG;IACH,mBAAmB,EAAE,KAAK,MAAM,EAAE,CAAC;IAEnC;;OAEG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,8BAA8B,EAAE,UAAU,CAAC;CAC5C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAC9C;;OAEG;IACH,wBAAwB,EAAE,MAAM,CAAC;IAEjC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,CACtC,KAAK,EAAE,QAAQ,GAAG,KAAK,KACpB,kBAAkB,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,CAkCzD,CAAC;AAEH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,QAAQ,GAAG,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,CAErG;AAED,eAAO,MAAM,0BAA0B,EAAE,CACvC,KAAK,EAAE,QAAQ,GAAG,KAAK,KACpB,kBAAkB,CAAC,eAAe,GAAG,eAAe,CAavD,CAAC;AAEH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,QAAQ,GAAG,KAAK,GAAG,eAAe,CAElF"}
@@ -1,2 +0,0 @@
1
- export { SequencerPublisher } from './sequencer-publisher.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/publisher/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,24 +0,0 @@
1
- import type { L1PublishBlockStats, L1PublishProofStats, L1PublishStats } from '@aztec/circuit-types/stats';
2
- import { type TelemetryClient } from '@aztec/telemetry-client';
3
- export type L1TxType = 'submitProof' | 'process' | 'claimEpochProofRight';
4
- export declare class SequencerPublisherMetrics {
5
- private gasPrice;
6
- private txCount;
7
- private txDuration;
8
- private txGas;
9
- private txCalldataSize;
10
- private txCalldataGas;
11
- private txBlobDataGasUsed;
12
- private txBlobDataGasCost;
13
- private readonly blobCountHistogram;
14
- private readonly blobInclusionBlocksHistogram;
15
- private readonly blobTxSuccessCounter;
16
- private readonly blobTxFailureCounter;
17
- constructor(client: TelemetryClient, name?: string);
18
- recordFailedTx(txType: L1TxType): void;
19
- recordSubmitProof(durationMs: number, stats: L1PublishProofStats): void;
20
- recordProcessBlockTx(durationMs: number, stats: L1PublishBlockStats): void;
21
- recordClaimEpochProofRightTx(durationMs: number, stats: L1PublishStats): void;
22
- private recordTx;
23
- }
24
- //# sourceMappingURL=sequencer-publisher-metrics.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sequencer-publisher-metrics.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC3G,OAAO,EAIL,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAIjC,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,SAAS,GAAG,sBAAsB,CAAC;AAE1E,qBAAa,yBAAyB;IACpC,OAAO,CAAC,QAAQ,CAAY;IAE5B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,cAAc,CAAY;IAClC,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,iBAAiB,CAAY;IACrC,OAAO,CAAC,iBAAiB,CAAY;IAErC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAY;IAC/C,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAY;IACzD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAgB;IACrD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAgB;gBAEzC,MAAM,EAAE,eAAe,EAAE,IAAI,SAAuB;IAsEhE,cAAc,CAAC,MAAM,EAAE,QAAQ;IAW/B,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB;IAIhE,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB;IAcnE,4BAA4B,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc;IAItE,OAAO,CAAC,QAAQ;CA6BjB"}