@aztec/sequencer-client 0.0.0-test.1 → 0.0.1-commit.0b941701

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 (135) hide show
  1. package/dest/client/index.d.ts +1 -1
  2. package/dest/client/sequencer-client.d.ts +31 -31
  3. package/dest/client/sequencer-client.d.ts.map +1 -1
  4. package/dest/client/sequencer-client.js +82 -60
  5. package/dest/config.d.ts +15 -16
  6. package/dest/config.d.ts.map +1 -1
  7. package/dest/config.js +118 -70
  8. package/dest/global_variable_builder/global_builder.d.ts +26 -15
  9. package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
  10. package/dest/global_variable_builder/global_builder.js +62 -44
  11. package/dest/global_variable_builder/index.d.ts +1 -1
  12. package/dest/index.d.ts +2 -4
  13. package/dest/index.d.ts.map +1 -1
  14. package/dest/index.js +1 -3
  15. package/dest/publisher/config.d.ts +15 -12
  16. package/dest/publisher/config.d.ts.map +1 -1
  17. package/dest/publisher/config.js +32 -19
  18. package/dest/publisher/index.d.ts +3 -1
  19. package/dest/publisher/index.d.ts.map +1 -1
  20. package/dest/publisher/index.js +3 -0
  21. package/dest/publisher/sequencer-publisher-factory.d.ts +44 -0
  22. package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -0
  23. package/dest/publisher/sequencer-publisher-factory.js +51 -0
  24. package/dest/publisher/sequencer-publisher-metrics.d.ts +5 -4
  25. package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
  26. package/dest/publisher/sequencer-publisher-metrics.js +26 -62
  27. package/dest/publisher/sequencer-publisher.d.ts +134 -87
  28. package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
  29. package/dest/publisher/sequencer-publisher.js +1146 -249
  30. package/dest/sequencer/checkpoint_proposal_job.d.ts +79 -0
  31. package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
  32. package/dest/sequencer/checkpoint_proposal_job.js +1165 -0
  33. package/dest/sequencer/checkpoint_voter.d.ts +35 -0
  34. package/dest/sequencer/checkpoint_voter.d.ts.map +1 -0
  35. package/dest/sequencer/checkpoint_voter.js +109 -0
  36. package/dest/sequencer/config.d.ts +7 -1
  37. package/dest/sequencer/config.d.ts.map +1 -1
  38. package/dest/sequencer/errors.d.ts +11 -0
  39. package/dest/sequencer/errors.d.ts.map +1 -0
  40. package/dest/sequencer/errors.js +15 -0
  41. package/dest/sequencer/events.d.ts +46 -0
  42. package/dest/sequencer/events.d.ts.map +1 -0
  43. package/dest/sequencer/events.js +1 -0
  44. package/dest/sequencer/index.d.ts +4 -2
  45. package/dest/sequencer/index.d.ts.map +1 -1
  46. package/dest/sequencer/index.js +3 -1
  47. package/dest/sequencer/metrics.d.ts +48 -12
  48. package/dest/sequencer/metrics.d.ts.map +1 -1
  49. package/dest/sequencer/metrics.js +204 -69
  50. package/dest/sequencer/sequencer.d.ts +144 -137
  51. package/dest/sequencer/sequencer.d.ts.map +1 -1
  52. package/dest/sequencer/sequencer.js +967 -525
  53. package/dest/sequencer/timetable.d.ts +76 -24
  54. package/dest/sequencer/timetable.d.ts.map +1 -1
  55. package/dest/sequencer/timetable.js +177 -61
  56. package/dest/sequencer/types.d.ts +3 -0
  57. package/dest/sequencer/types.d.ts.map +1 -0
  58. package/dest/sequencer/types.js +1 -0
  59. package/dest/sequencer/utils.d.ts +20 -38
  60. package/dest/sequencer/utils.d.ts.map +1 -1
  61. package/dest/sequencer/utils.js +12 -47
  62. package/dest/test/index.d.ts +9 -1
  63. package/dest/test/index.d.ts.map +1 -1
  64. package/dest/test/index.js +0 -4
  65. package/dest/test/mock_checkpoint_builder.d.ts +95 -0
  66. package/dest/test/mock_checkpoint_builder.d.ts.map +1 -0
  67. package/dest/test/mock_checkpoint_builder.js +222 -0
  68. package/dest/test/utils.d.ts +53 -0
  69. package/dest/test/utils.d.ts.map +1 -0
  70. package/dest/test/utils.js +103 -0
  71. package/package.json +47 -45
  72. package/src/client/sequencer-client.ts +106 -107
  73. package/src/config.ts +131 -81
  74. package/src/global_variable_builder/global_builder.ts +84 -55
  75. package/src/index.ts +1 -3
  76. package/src/publisher/config.ts +45 -32
  77. package/src/publisher/index.ts +4 -0
  78. package/src/publisher/sequencer-publisher-factory.ts +92 -0
  79. package/src/publisher/sequencer-publisher-metrics.ts +30 -64
  80. package/src/publisher/sequencer-publisher.ts +967 -295
  81. package/src/sequencer/README.md +531 -0
  82. package/src/sequencer/checkpoint_proposal_job.ts +845 -0
  83. package/src/sequencer/checkpoint_voter.ts +130 -0
  84. package/src/sequencer/config.ts +8 -0
  85. package/src/sequencer/errors.ts +21 -0
  86. package/src/sequencer/events.ts +27 -0
  87. package/src/sequencer/index.ts +3 -1
  88. package/src/sequencer/metrics.ts +269 -72
  89. package/src/sequencer/sequencer.ts +708 -588
  90. package/src/sequencer/timetable.ts +221 -62
  91. package/src/sequencer/types.ts +6 -0
  92. package/src/sequencer/utils.ts +28 -60
  93. package/src/test/index.ts +12 -4
  94. package/src/test/mock_checkpoint_builder.ts +311 -0
  95. package/src/test/utils.ts +164 -0
  96. package/dest/sequencer/allowed.d.ts +0 -3
  97. package/dest/sequencer/allowed.d.ts.map +0 -1
  98. package/dest/sequencer/allowed.js +0 -27
  99. package/dest/slasher/factory.d.ts +0 -7
  100. package/dest/slasher/factory.d.ts.map +0 -1
  101. package/dest/slasher/factory.js +0 -8
  102. package/dest/slasher/index.d.ts +0 -3
  103. package/dest/slasher/index.d.ts.map +0 -1
  104. package/dest/slasher/index.js +0 -2
  105. package/dest/slasher/slasher_client.d.ts +0 -75
  106. package/dest/slasher/slasher_client.d.ts.map +0 -1
  107. package/dest/slasher/slasher_client.js +0 -132
  108. package/dest/tx_validator/archive_cache.d.ts +0 -14
  109. package/dest/tx_validator/archive_cache.d.ts.map +0 -1
  110. package/dest/tx_validator/archive_cache.js +0 -22
  111. package/dest/tx_validator/gas_validator.d.ts +0 -14
  112. package/dest/tx_validator/gas_validator.d.ts.map +0 -1
  113. package/dest/tx_validator/gas_validator.js +0 -78
  114. package/dest/tx_validator/nullifier_cache.d.ts +0 -16
  115. package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
  116. package/dest/tx_validator/nullifier_cache.js +0 -24
  117. package/dest/tx_validator/phases_validator.d.ts +0 -12
  118. package/dest/tx_validator/phases_validator.d.ts.map +0 -1
  119. package/dest/tx_validator/phases_validator.js +0 -80
  120. package/dest/tx_validator/test_utils.d.ts +0 -23
  121. package/dest/tx_validator/test_utils.d.ts.map +0 -1
  122. package/dest/tx_validator/test_utils.js +0 -26
  123. package/dest/tx_validator/tx_validator_factory.d.ts +0 -18
  124. package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
  125. package/dest/tx_validator/tx_validator_factory.js +0 -50
  126. package/src/sequencer/allowed.ts +0 -36
  127. package/src/slasher/factory.ts +0 -15
  128. package/src/slasher/index.ts +0 -2
  129. package/src/slasher/slasher_client.ts +0 -193
  130. package/src/tx_validator/archive_cache.ts +0 -28
  131. package/src/tx_validator/gas_validator.ts +0 -101
  132. package/src/tx_validator/nullifier_cache.ts +0 -30
  133. package/src/tx_validator/phases_validator.ts +0 -98
  134. package/src/tx_validator/test_utils.ts +0 -48
  135. package/src/tx_validator/tx_validator_factory.ts +0 -120
@@ -1,2 +1,2 @@
1
1
  export * from './sequencer-client.js';
2
- //# sourceMappingURL=index.d.ts.map
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbGllbnQvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyx1QkFBdUIsQ0FBQyJ9
@@ -1,28 +1,32 @@
1
- import type { BlobSinkClientInterface } from '@aztec/blob-sink/client';
1
+ import type { BlobClientInterface } from '@aztec/blob-client/client';
2
2
  import { EpochCache } from '@aztec/epoch-cache';
3
3
  import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
4
+ import { PublisherManager } from '@aztec/ethereum/publisher-manager';
4
5
  import { EthAddress } from '@aztec/foundation/eth-address';
5
6
  import type { DateProvider } from '@aztec/foundation/timer';
7
+ import type { KeystoreManager } from '@aztec/node-keystore';
6
8
  import type { P2P } from '@aztec/p2p';
7
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
8
- import type { L2BlockSource } from '@aztec/stdlib/block';
9
- import type { ContractDataSource } from '@aztec/stdlib/contract';
10
- import type { WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
9
+ import type { SlasherClientInterface } from '@aztec/slasher';
10
+ import type { L2BlockSink, L2BlockSource } from '@aztec/stdlib/block';
11
+ import type { ValidatorClientFullConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
11
12
  import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
12
- import type { TelemetryClient } from '@aztec/telemetry-client';
13
- import type { ValidatorClient } from '@aztec/validator-client';
13
+ import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
14
+ import { FullNodeCheckpointsBuilder, type ValidatorClient } from '@aztec/validator-client';
14
15
  import type { SequencerClientConfig } from '../config.js';
15
- import { SequencerPublisher } from '../publisher/index.js';
16
+ import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
16
17
  import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
17
- import type { SlasherClient } from '../slasher/index.js';
18
18
  /**
19
19
  * Encapsulates the full sequencer and publisher.
20
20
  */
21
21
  export declare class SequencerClient {
22
+ protected publisherManager: PublisherManager<L1TxUtilsWithBlobs>;
22
23
  protected sequencer: Sequencer;
23
- constructor(sequencer: Sequencer);
24
+ protected checkpointsBuilder: FullNodeCheckpointsBuilder;
25
+ protected validatorClient?: ValidatorClient | undefined;
26
+ private l1Metrics?;
27
+ constructor(publisherManager: PublisherManager<L1TxUtilsWithBlobs>, sequencer: Sequencer, checkpointsBuilder: FullNodeCheckpointsBuilder, validatorClient?: ValidatorClient | undefined, l1Metrics?: L1Metrics | undefined);
24
28
  /**
25
- * Initializes and starts a new instance.
29
+ * Initializes a new instance.
26
30
  * @param config - Configuration for the sequencer, publisher, and L1 tx sender.
27
31
  * @param p2pClient - P2P client that provides the txs to be sequenced.
28
32
  * @param validatorClient - Validator client performs attestation duties when rotating proposers.
@@ -31,41 +35,37 @@ export declare class SequencerClient {
31
35
  * @param l2BlockSource - Provides information about the previously published blocks.
32
36
  * @param l1ToL2MessageSource - Provides access to L1 to L2 messages.
33
37
  * @param prover - An instance of a block prover
34
- * @param simulationProvider - An instance of a simulation provider
35
38
  * @returns A new running instance.
36
39
  */
37
40
  static new(config: SequencerClientConfig, deps: {
38
- validatorClient: ValidatorClient | undefined;
41
+ validatorClient: ValidatorClient;
39
42
  p2pClient: P2P;
40
43
  worldStateSynchronizer: WorldStateSynchronizer;
41
- slasherClient: SlasherClient;
42
- contractDataSource: ContractDataSource;
43
- l2BlockSource: L2BlockSource;
44
+ slasherClient: SlasherClientInterface | undefined;
45
+ checkpointsBuilder: FullNodeCheckpointsBuilder;
46
+ l2BlockSource: L2BlockSource & L2BlockSink;
44
47
  l1ToL2MessageSource: L1ToL2MessageSource;
45
48
  telemetry: TelemetryClient;
46
- publisher?: SequencerPublisher;
47
- blobSinkClient?: BlobSinkClientInterface;
49
+ publisherFactory?: SequencerPublisherFactory;
50
+ blobClient: BlobClientInterface;
48
51
  dateProvider: DateProvider;
49
52
  epochCache?: EpochCache;
50
- l1TxUtils?: L1TxUtilsWithBlobs;
53
+ l1TxUtils: L1TxUtilsWithBlobs[];
54
+ nodeKeyStore: KeystoreManager;
51
55
  }): Promise<SequencerClient>;
52
56
  /**
53
- * Updates sequencer config.
57
+ * Updates sequencer and validator client config.
54
58
  * @param config - New parameters.
55
59
  */
56
- updateSequencerConfig(config: SequencerConfig): Promise<void>;
60
+ updateConfig(config: SequencerConfig & Partial<ValidatorClientFullConfig>): void;
61
+ /** Starts the sequencer. */
62
+ start(): Promise<void>;
57
63
  /**
58
64
  * Stops the sequencer from processing new txs.
59
65
  */
60
66
  stop(): Promise<void>;
61
- /** Forces the sequencer to bypass all time and tx count checks for the next block and build anyway. */
62
- flush(): void;
63
- /**
64
- * Restarts the sequencer after being stopped.
65
- */
66
- restart(): void;
67
- get coinbase(): EthAddress;
68
- get feeRecipient(): AztecAddress;
69
- get forwarderAddress(): EthAddress;
67
+ getSequencer(): Sequencer;
68
+ get validatorAddresses(): EthAddress[] | undefined;
69
+ get maxL2BlockGas(): number | undefined;
70
70
  }
71
- //# sourceMappingURL=sequencer-client.d.ts.map
71
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VxdWVuY2VyLWNsaWVudC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaWVudC9zZXF1ZW5jZXItY2xpZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDckUsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBSWhELE9BQU8sRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHdDQUF3QyxDQUFDO0FBQzVFLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBQ3JFLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUUzRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUM1RCxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUM1RCxPQUFPLEtBQUssRUFBRSxHQUFHLEVBQUUsTUFBTSxZQUFZLENBQUM7QUFDdEMsT0FBTyxLQUFLLEVBQUUsc0JBQXNCLEVBQUUs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,CAAC;QAClD,kBAAkB,EAAE,0BAA0B,CAAC;QAC/C,aAAa,EAAE,aAAa,GAAG,WAAW,CAAC;QAC3C,mBAAmB,EAAE,mBAAmB,CAAC;QACzC,SAAS,EAAE,eAAe,CAAC;QAC3B,gBAAgB,CAAC,EAAE,yBAAyB,CAAC;QAC7C,UAAU,EAAE,mBAAmB,CAAC;QAChC,YAAY,EAAE,YAAY,CAAC;QAC3B,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,SAAS,EAAE,kBAAkB,EAAE,CAAC;QAChC,YAAY,EAAE,eAAe,CAAC;KAC/B,4BA8GF;IAED;;;OAGG;IACI,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC,QAI/E;IAED,4BAA4B;IACf,KAAK,kBAKjB;IAED;;OAEG;IACU,IAAI,kBAKhB;IAEM,YAAY,IAAI,SAAS,CAE/B;IAED,IAAI,kBAAkB,IAAI,UAAU,EAAE,GAAG,SAAS,CAEjD;IAED,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;CACF"}
@@ -1,22 +1,33 @@
1
1
  import { EpochCache } from '@aztec/epoch-cache';
2
- import { ForwarderContract, GovernanceProposerContract, RollupContract, SlashingProposerContract, createEthereumChain, createL1Clients, isAnvilTestChain } from '@aztec/ethereum';
3
- import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
2
+ import { isAnvilTestChain } from '@aztec/ethereum/chain';
3
+ import { getPublicClient } from '@aztec/ethereum/client';
4
+ import { GovernanceProposerContract, RollupContract } from '@aztec/ethereum/contracts';
5
+ import { PublisherManager } from '@aztec/ethereum/publisher-manager';
4
6
  import { EthAddress } from '@aztec/foundation/eth-address';
5
7
  import { createLogger } from '@aztec/foundation/log';
6
- import { LightweightBlockBuilderFactory } from '@aztec/prover-client/block-builder';
7
- import { PublicProcessorFactory } from '@aztec/simulator/server';
8
+ import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
9
+ import { L1Metrics } from '@aztec/telemetry-client';
10
+ import { NodeKeystoreAdapter } from '@aztec/validator-client';
8
11
  import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
9
- import { SequencerPublisher } from '../publisher/index.js';
12
+ import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
10
13
  import { Sequencer } from '../sequencer/index.js';
11
14
  /**
12
15
  * Encapsulates the full sequencer and publisher.
13
16
  */ export class SequencerClient {
17
+ publisherManager;
14
18
  sequencer;
15
- constructor(sequencer){
19
+ checkpointsBuilder;
20
+ validatorClient;
21
+ l1Metrics;
22
+ constructor(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics){
23
+ this.publisherManager = publisherManager;
16
24
  this.sequencer = sequencer;
25
+ this.checkpointsBuilder = checkpointsBuilder;
26
+ this.validatorClient = validatorClient;
27
+ this.l1Metrics = l1Metrics;
17
28
  }
18
29
  /**
19
- * Initializes and starts a new instance.
30
+ * Initializes a new instance.
20
31
  * @param config - Configuration for the sequencer, publisher, and L1 tx sender.
21
32
  * @param p2pClient - P2P client that provides the txs to be sequenced.
22
33
  * @param validatorClient - Validator client performs attestation duties when rotating proposers.
@@ -25,93 +36,104 @@ import { Sequencer } from '../sequencer/index.js';
25
36
  * @param l2BlockSource - Provides information about the previously published blocks.
26
37
  * @param l1ToL2MessageSource - Provides access to L1 to L2 messages.
27
38
  * @param prover - An instance of a block prover
28
- * @param simulationProvider - An instance of a simulation provider
29
39
  * @returns A new running instance.
30
40
  */ static async new(config, deps) {
31
- const { validatorClient, p2pClient, worldStateSynchronizer, slasherClient, contractDataSource, l2BlockSource, l1ToL2MessageSource, telemetry: telemetryClient } = deps;
32
- const { l1RpcUrls: rpcUrls, l1ChainId: chainId, publisherPrivateKey } = config;
33
- const chain = createEthereumChain(rpcUrls, chainId);
34
- const log = createLogger('sequencer-client');
35
- const { publicClient, walletClient } = createL1Clients(rpcUrls, publisherPrivateKey, chain.chainInfo);
36
- const l1TxUtils = deps.l1TxUtils ?? new L1TxUtilsWithBlobs(publicClient, walletClient, log, config);
41
+ const { validatorClient, p2pClient, worldStateSynchronizer, slasherClient, checkpointsBuilder, l2BlockSource, l1ToL2MessageSource, telemetry: telemetryClient } = deps;
42
+ const { l1RpcUrls: rpcUrls, l1ChainId: chainId } = config;
43
+ const log = createLogger('sequencer');
44
+ const publicClient = getPublicClient(config);
45
+ const l1TxUtils = deps.l1TxUtils;
46
+ const l1Metrics = new L1Metrics(telemetryClient.getMeter('L1PublisherMetrics'), publicClient, l1TxUtils.map((x)=>x.getSenderAddress()));
47
+ const publisherManager = new PublisherManager(l1TxUtils, config);
37
48
  const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
38
- const [l1GenesisTime, slotDuration] = await Promise.all([
49
+ const [l1GenesisTime, slotDuration, rollupVersion, rollupManaLimit] = await Promise.all([
39
50
  rollupContract.getL1GenesisTime(),
40
- rollupContract.getSlotDuration()
51
+ rollupContract.getSlotDuration(),
52
+ rollupContract.getVersion(),
53
+ rollupContract.getManaLimit().then(Number)
41
54
  ]);
42
- const forwarderContract = config.customForwarderContractAddress && config.customForwarderContractAddress !== EthAddress.ZERO ? new ForwarderContract(publicClient, config.customForwarderContractAddress.toString(), config.l1Contracts.rollupAddress.toString()) : await ForwarderContract.create(walletClient.account.address, walletClient, publicClient, log, config.l1Contracts.rollupAddress.toString());
43
55
  const governanceProposerContract = new GovernanceProposerContract(publicClient, config.l1Contracts.governanceProposerAddress.toString());
44
- const slashingProposerAddress = await rollupContract.getSlashingProposerAddress();
45
- const slashingProposerContract = new SlashingProposerContract(publicClient, slashingProposerAddress.toString());
46
56
  const epochCache = deps.epochCache ?? await EpochCache.create(config.l1Contracts.rollupAddress, {
47
57
  l1RpcUrls: rpcUrls,
48
58
  l1ChainId: chainId,
49
59
  viemPollingIntervalMS: config.viemPollingIntervalMS,
50
- aztecSlotDuration: config.aztecSlotDuration,
51
- ethereumSlotDuration: config.ethereumSlotDuration,
52
- aztecEpochDuration: config.aztecEpochDuration
60
+ ethereumSlotDuration: config.ethereumSlotDuration
53
61
  }, {
54
62
  dateProvider: deps.dateProvider
55
63
  });
56
- const publisher = deps.publisher ?? new SequencerPublisher(config, {
57
- l1TxUtils,
64
+ const slashFactoryContract = new SlashFactoryContract(publicClient, config.l1Contracts.slashFactoryAddress?.toString() ?? EthAddress.ZERO.toString());
65
+ const publisherFactory = deps.publisherFactory ?? new SequencerPublisherFactory(config, {
58
66
  telemetry: telemetryClient,
59
- blobSinkClient: deps.blobSinkClient,
60
- rollupContract,
67
+ blobClient: deps.blobClient,
61
68
  epochCache,
62
- forwarderContract,
63
69
  governanceProposerContract,
64
- slashingProposerContract
70
+ slashFactoryContract,
71
+ rollupContract,
72
+ dateProvider: deps.dateProvider,
73
+ publisherManager,
74
+ nodeKeyStore: NodeKeystoreAdapter.fromKeyStoreManager(deps.nodeKeyStore),
75
+ logger: log
65
76
  });
66
- const globalsBuilder = new GlobalVariableBuilder(config);
67
- const publicProcessorFactory = new PublicProcessorFactory(contractDataSource, deps.dateProvider, telemetryClient);
68
77
  const ethereumSlotDuration = config.ethereumSlotDuration;
69
- // When running in anvil, assume we can post a tx up until the very last second of an L1 slot.
70
- // Otherwise, assume we must have broadcasted the tx before the slot started (we use a default
71
- // maxL1TxInclusionTimeIntoSlot of zero) to get the tx into that L1 slot.
72
- // In theory, the L1 slot has an initial 4s phase where the block is propagated, so we could
73
- // make it with a propagation time into slot equal to 4s. However, we prefer being conservative.
74
- // See https://www.blocknative.com/blog/anatomy-of-a-slot#7 for more info.
75
- const maxL1TxInclusionTimeIntoSlot = config.maxL1TxInclusionTimeIntoSlot ?? isAnvilTestChain(config.l1ChainId) ? ethereumSlotDuration : 0;
76
78
  const l1Constants = {
77
79
  l1GenesisTime,
78
80
  slotDuration: Number(slotDuration),
79
81
  ethereumSlotDuration
80
82
  };
81
- const sequencer = new Sequencer(publisher, validatorClient, globalsBuilder, p2pClient, worldStateSynchronizer, slasherClient, new LightweightBlockBuilderFactory(telemetryClient), l2BlockSource, l1ToL2MessageSource, publicProcessorFactory, contractDataSource, l1Constants, deps.dateProvider, {
83
+ const globalsBuilder = new GlobalVariableBuilder({
84
+ ...config,
85
+ ...l1Constants,
86
+ rollupVersion
87
+ });
88
+ let sequencerManaLimit = config.maxL2BlockGas ?? rollupManaLimit;
89
+ if (sequencerManaLimit > rollupManaLimit) {
90
+ log.warn(`Provided maxL2BlockGas ${sequencerManaLimit} is greater than the max allowed by L1. Setting limit to ${rollupManaLimit}.`);
91
+ sequencerManaLimit = rollupManaLimit;
92
+ }
93
+ // When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
94
+ // Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
95
+ // In theory, the L1 slot has an initial 4s phase where the block is propagated, so we could
96
+ // reduce the publishing time allowance. However, we prefer being conservative.
97
+ // See https://www.blocknative.com/blog/anatomy-of-a-slot#7 for more info.
98
+ const l1PublishingTimeBasedOnChain = isAnvilTestChain(config.l1ChainId) ? 1 : ethereumSlotDuration;
99
+ const l1PublishingTime = config.l1PublishingTime ?? l1PublishingTimeBasedOnChain;
100
+ const sequencer = new Sequencer(publisherFactory, validatorClient, globalsBuilder, p2pClient, worldStateSynchronizer, slasherClient, l2BlockSource, l1ToL2MessageSource, checkpointsBuilder, l1Constants, deps.dateProvider, epochCache, rollupContract, {
82
101
  ...config,
83
- maxL1TxInclusionTimeIntoSlot
84
- }, telemetryClient);
85
- await validatorClient?.start();
86
- await sequencer.start();
87
- return new SequencerClient(sequencer);
102
+ l1PublishingTime,
103
+ maxL2BlockGas: sequencerManaLimit
104
+ }, telemetryClient, log);
105
+ await sequencer.init();
106
+ return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics);
88
107
  }
89
108
  /**
90
- * Updates sequencer config.
109
+ * Updates sequencer and validator client config.
91
110
  * @param config - New parameters.
92
- */ updateSequencerConfig(config) {
93
- return this.sequencer.updateConfig(config);
111
+ */ updateConfig(config) {
112
+ this.sequencer.updateConfig(config);
113
+ this.checkpointsBuilder.updateConfig(config);
114
+ this.validatorClient?.updateConfig(config);
115
+ }
116
+ /** Starts the sequencer. */ async start() {
117
+ await this.validatorClient?.start();
118
+ this.sequencer.start();
119
+ this.l1Metrics?.start();
120
+ await this.publisherManager.loadState();
94
121
  }
95
122
  /**
96
123
  * Stops the sequencer from processing new txs.
97
124
  */ async stop() {
98
125
  await this.sequencer.stop();
126
+ await this.validatorClient?.stop();
127
+ this.publisherManager.interrupt();
128
+ this.l1Metrics?.stop();
99
129
  }
100
- /** Forces the sequencer to bypass all time and tx count checks for the next block and build anyway. */ flush() {
101
- this.sequencer.flush();
102
- }
103
- /**
104
- * Restarts the sequencer after being stopped.
105
- */ restart() {
106
- this.sequencer.restart();
107
- }
108
- get coinbase() {
109
- return this.sequencer.coinbase;
130
+ getSequencer() {
131
+ return this.sequencer;
110
132
  }
111
- get feeRecipient() {
112
- return this.sequencer.feeRecipient;
133
+ get validatorAddresses() {
134
+ return this.sequencer.getValidatorAddresses();
113
135
  }
114
- get forwarderAddress() {
115
- return this.sequencer.getForwarderAddress();
136
+ get maxL2BlockGas() {
137
+ return this.sequencer.maxL2BlockGas;
116
138
  }
117
139
  }
package/dest/config.d.ts CHANGED
@@ -1,29 +1,28 @@
1
- import { type L1ContractsConfig, type L1ReaderConfig } from '@aztec/ethereum';
1
+ import { type L1ContractsConfig } from '@aztec/ethereum/config';
2
+ import { type L1ReaderConfig } from '@aztec/ethereum/l1-reader';
2
3
  import { type ConfigMappingsType } from '@aztec/foundation/config';
3
- import { type AllowedElement, type ChainConfig, type SequencerConfig } from '@aztec/stdlib/config';
4
+ import { type KeyStoreConfig } from '@aztec/node-keystore/config';
5
+ import { type P2PConfig } from '@aztec/p2p/config';
6
+ import { type ChainConfig, type SequencerConfig } from '@aztec/stdlib/config';
7
+ import type { ResolvedSequencerConfig } from '@aztec/stdlib/interfaces/server';
8
+ import { type ValidatorClientConfig } from '@aztec/validator-client/config';
4
9
  import { type PublisherConfig, type TxSenderConfig } from './publisher/config.js';
5
10
  export * from './publisher/config.js';
6
11
  export type { SequencerConfig };
12
+ export declare const DEFAULT_ATTESTATION_PROPAGATION_TIME = 2;
13
+ /**
14
+ * Default values for SequencerConfig.
15
+ * Centralized location for all sequencer configuration defaults.
16
+ */
17
+ export declare const DefaultSequencerConfig: ResolvedSequencerConfig;
7
18
  /**
8
19
  * Configuration settings for the SequencerClient.
9
20
  */
10
- export type SequencerClientConfig = PublisherConfig & TxSenderConfig & SequencerConfig & L1ReaderConfig & ChainConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
21
+ export type SequencerClientConfig = PublisherConfig & KeyStoreConfig & ValidatorClientConfig & TxSenderConfig & SequencerConfig & L1ReaderConfig & ChainConfig & Pick<P2PConfig, 'txPublicSetupAllowList'> & Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
11
22
  export declare const sequencerConfigMappings: ConfigMappingsType<SequencerConfig>;
12
23
  export declare const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig>;
13
24
  /**
14
25
  * Creates an instance of SequencerClientConfig out of environment variables using sensible defaults for integration testing if not set.
15
26
  */
16
27
  export declare function getConfigEnvVars(): SequencerClientConfig;
17
- /**
18
- * Parses a string to a list of allowed elements.
19
- * Each encoded is expected to be of one of the following formats
20
- * `I:${address}`
21
- * `I:${address}:${selector}`
22
- * `C:${classId}`
23
- * `C:${classId}:${selector}`
24
- *
25
- * @param value The string to parse
26
- * @returns A list of allowed elements
27
- */
28
- export declare function parseSequencerAllowList(value: string): AllowedElement[];
29
- //# sourceMappingURL=config.d.ts.map
28
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGlu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wBAAgB,gBAAgB,IAAI,qBAAqB,CAExD"}
package/dest/config.js CHANGED
@@ -1,37 +1,72 @@
1
- import { l1ContractsConfigMappings, l1ReaderConfigMappings } from '@aztec/ethereum';
1
+ import { l1ContractsConfigMappings } from '@aztec/ethereum/config';
2
+ import { l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
2
3
  import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, pickConfigMappings } from '@aztec/foundation/config';
3
4
  import { EthAddress } from '@aztec/foundation/eth-address';
4
- import { Fr } from '@aztec/foundation/fields';
5
- import { FunctionSelector } from '@aztec/stdlib/abi';
5
+ import { keyStoreConfigMappings } from '@aztec/node-keystore/config';
6
+ import { p2pConfigMappings } from '@aztec/p2p/config';
6
7
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
7
8
  import { chainConfigMappings } from '@aztec/stdlib/config';
9
+ import { validatorClientConfigMappings } from '@aztec/validator-client/config';
8
10
  import { getPublisherConfigMappings, getTxSenderConfigMappings } from './publisher/config.js';
9
11
  export * from './publisher/config.js';
12
+ export const DEFAULT_ATTESTATION_PROPAGATION_TIME = 2;
13
+ /**
14
+ * Default values for SequencerConfig.
15
+ * Centralized location for all sequencer configuration defaults.
16
+ */ export const DefaultSequencerConfig = {
17
+ sequencerPollingIntervalMS: 500,
18
+ maxTxsPerBlock: 32,
19
+ minTxsPerBlock: 1,
20
+ buildCheckpointIfEmpty: false,
21
+ publishTxsWithProposals: false,
22
+ maxL2BlockGas: 10e9,
23
+ maxDABlockGas: 10e9,
24
+ maxBlockSizeInBytes: 1024 * 1024,
25
+ enforceTimeTable: true,
26
+ attestationPropagationTime: DEFAULT_ATTESTATION_PROPAGATION_TIME,
27
+ secondsBeforeInvalidatingBlockAsCommitteeMember: 144,
28
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: 432,
29
+ skipCollectingAttestations: false,
30
+ skipInvalidateBlockAsProposer: false,
31
+ broadcastInvalidBlockProposal: false,
32
+ injectFakeAttestation: false,
33
+ fishermanMode: false,
34
+ shuffleAttestationOrdering: false,
35
+ skipPushProposedBlocksToArchiver: false
36
+ };
10
37
  export const sequencerConfigMappings = {
11
- transactionPollingIntervalMS: {
12
- env: 'SEQ_TX_POLLING_INTERVAL_MS',
13
- description: 'The number of ms to wait between polling for pending txs.',
14
- ...numberConfigHelper(500)
38
+ sequencerPollingIntervalMS: {
39
+ env: 'SEQ_POLLING_INTERVAL_MS',
40
+ description: 'The number of ms to wait between polling for checking to build on the next slot.',
41
+ ...numberConfigHelper(DefaultSequencerConfig.sequencerPollingIntervalMS)
15
42
  },
16
43
  maxTxsPerBlock: {
17
44
  env: 'SEQ_MAX_TX_PER_BLOCK',
18
45
  description: 'The maximum number of txs to include in a block.',
19
- ...numberConfigHelper(32)
46
+ ...numberConfigHelper(DefaultSequencerConfig.maxTxsPerBlock)
20
47
  },
21
48
  minTxsPerBlock: {
22
49
  env: 'SEQ_MIN_TX_PER_BLOCK',
23
50
  description: 'The minimum number of txs to include in a block.',
24
- ...numberConfigHelper(1)
51
+ ...numberConfigHelper(DefaultSequencerConfig.minTxsPerBlock)
52
+ },
53
+ minValidTxsPerBlock: {
54
+ description: 'The minimum number of valid txs (after execution) to include in a block. If not set, falls back to minTxsPerBlock.'
55
+ },
56
+ publishTxsWithProposals: {
57
+ env: 'SEQ_PUBLISH_TXS_WITH_PROPOSALS',
58
+ description: 'Whether to publish txs with proposals.',
59
+ ...booleanConfigHelper(DefaultSequencerConfig.publishTxsWithProposals)
25
60
  },
26
61
  maxL2BlockGas: {
27
62
  env: 'SEQ_MAX_L2_BLOCK_GAS',
28
63
  description: 'The maximum L2 block gas.',
29
- ...numberConfigHelper(10e9)
64
+ ...numberConfigHelper(DefaultSequencerConfig.maxL2BlockGas)
30
65
  },
31
66
  maxDABlockGas: {
32
67
  env: 'SEQ_MAX_DA_BLOCK_GAS',
33
68
  description: 'The maximum DA block gas.',
34
- ...numberConfigHelper(10e9)
69
+ ...numberConfigHelper(DefaultSequencerConfig.maxDABlockGas)
35
70
  },
36
71
  coinbase: {
37
72
  env: 'COINBASE',
@@ -51,37 +86,94 @@ export const sequencerConfigMappings = {
51
86
  env: 'ACVM_BINARY_PATH',
52
87
  description: 'The path to the ACVM binary'
53
88
  },
54
- allowedInSetup: {
55
- env: 'SEQ_ALLOWED_SETUP_FN',
56
- parseEnv: (val)=>parseSequencerAllowList(val),
57
- description: 'The list of functions calls allowed to run in setup',
58
- printDefault: ()=>'AuthRegistry, FeeJuice.increase_public_balance, Token.increase_public_balance, FPC.prepare_fee'
59
- },
60
89
  maxBlockSizeInBytes: {
61
90
  env: 'SEQ_MAX_BLOCK_SIZE_IN_BYTES',
62
91
  description: 'Max block size',
63
- ...numberConfigHelper(1024 * 1024)
92
+ ...numberConfigHelper(DefaultSequencerConfig.maxBlockSizeInBytes)
64
93
  },
65
94
  enforceTimeTable: {
66
95
  env: 'SEQ_ENFORCE_TIME_TABLE',
67
96
  description: 'Whether to enforce the time table when building blocks',
68
- ...booleanConfigHelper(),
69
- defaultValue: false
97
+ ...booleanConfigHelper(DefaultSequencerConfig.enforceTimeTable)
70
98
  },
71
99
  governanceProposerPayload: {
72
100
  env: 'GOVERNANCE_PROPOSER_PAYLOAD_ADDRESS',
73
101
  description: 'The address of the payload for the governanceProposer',
74
- parseEnv: (val)=>EthAddress.fromString(val),
75
- defaultValue: EthAddress.ZERO
102
+ parseEnv: (val)=>EthAddress.fromString(val)
103
+ },
104
+ l1PublishingTime: {
105
+ env: 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT',
106
+ description: 'How much time (in seconds) we allow in the slot for publishing the L1 tx (defaults to 1 L1 slot).',
107
+ parseEnv: (val)=>val ? parseInt(val, 10) : undefined
108
+ },
109
+ attestationPropagationTime: {
110
+ env: 'SEQ_ATTESTATION_PROPAGATION_TIME',
111
+ description: 'How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way)',
112
+ ...numberConfigHelper(DefaultSequencerConfig.attestationPropagationTime)
113
+ },
114
+ fakeProcessingDelayPerTxMs: {
115
+ description: 'Used for testing to introduce a fake delay after processing each tx'
116
+ },
117
+ fakeThrowAfterProcessingTxCount: {
118
+ description: 'Used for testing to throw an error after processing N txs'
119
+ },
120
+ secondsBeforeInvalidatingBlockAsCommitteeMember: {
121
+ env: 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_COMMITTEE_MEMBER',
122
+ description: 'How many seconds to wait before trying to invalidate a block from the pending chain as a committee member (zero to never invalidate).' + ' The next proposer is expected to invalidate, so the committee acts as a fallback.',
123
+ ...numberConfigHelper(DefaultSequencerConfig.secondsBeforeInvalidatingBlockAsCommitteeMember)
124
+ },
125
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: {
126
+ env: 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_NON_COMMITTEE_MEMBER',
127
+ description: 'How many seconds to wait before trying to invalidate a block from the pending chain as a non-committee member (zero to never invalidate).' + ' The next proposer is expected to invalidate, then the committee, so other sequencers act as a fallback.',
128
+ ...numberConfigHelper(DefaultSequencerConfig.secondsBeforeInvalidatingBlockAsNonCommitteeMember)
76
129
  },
77
- maxL1TxInclusionTimeIntoSlot: {
78
- env: 'SEQ_MAX_L1_TX_INCLUSION_TIME_INTO_SLOT',
79
- description: 'How many seconds into an L1 slot we can still send a tx and get it mined.',
130
+ skipCollectingAttestations: {
131
+ description: 'Whether to skip collecting attestations from validators and only use self-attestations (for testing only)',
132
+ ...booleanConfigHelper(DefaultSequencerConfig.skipCollectingAttestations)
133
+ },
134
+ skipInvalidateBlockAsProposer: {
135
+ description: 'Do not invalidate the previous block if invalid when we are the proposer (for testing only)',
136
+ ...booleanConfigHelper(DefaultSequencerConfig.skipInvalidateBlockAsProposer)
137
+ },
138
+ broadcastInvalidBlockProposal: {
139
+ description: 'Broadcast invalid block proposals with corrupted state (for testing only)',
140
+ ...booleanConfigHelper(DefaultSequencerConfig.broadcastInvalidBlockProposal)
141
+ },
142
+ injectFakeAttestation: {
143
+ description: 'Inject a fake attestation (for testing only)',
144
+ ...booleanConfigHelper(DefaultSequencerConfig.injectFakeAttestation)
145
+ },
146
+ fishermanMode: {
147
+ env: 'FISHERMAN_MODE',
148
+ description: 'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
149
+ ...booleanConfigHelper(DefaultSequencerConfig.fishermanMode)
150
+ },
151
+ shuffleAttestationOrdering: {
152
+ description: 'Shuffle attestation ordering to create invalid ordering (for testing only)',
153
+ ...booleanConfigHelper(DefaultSequencerConfig.shuffleAttestationOrdering)
154
+ },
155
+ blockDurationMs: {
156
+ env: 'SEQ_BLOCK_DURATION_MS',
157
+ description: 'Duration per block in milliseconds when building multiple blocks per slot. ' + 'If undefined (default), builds a single block per slot using the full slot duration.',
80
158
  parseEnv: (val)=>val ? parseInt(val, 10) : undefined
81
- }
159
+ },
160
+ buildCheckpointIfEmpty: {
161
+ env: 'SEQ_BUILD_CHECKPOINT_IF_EMPTY',
162
+ description: 'Have sequencer build and publish an empty checkpoint if there are no txs',
163
+ ...booleanConfigHelper(DefaultSequencerConfig.buildCheckpointIfEmpty)
164
+ },
165
+ skipPushProposedBlocksToArchiver: {
166
+ description: 'Skip pushing proposed blocks to archiver (default: true)',
167
+ ...booleanConfigHelper(DefaultSequencerConfig.skipPushProposedBlocksToArchiver)
168
+ },
169
+ ...pickConfigMappings(p2pConfigMappings, [
170
+ 'txPublicSetupAllowList'
171
+ ])
82
172
  };
83
173
  export const sequencerClientConfigMappings = {
174
+ ...validatorClientConfigMappings,
84
175
  ...sequencerConfigMappings,
176
+ ...keyStoreConfigMappings,
85
177
  ...l1ReaderConfigMappings,
86
178
  ...getTxSenderConfigMappings('SEQ'),
87
179
  ...getPublisherConfigMappings('SEQ'),
@@ -97,47 +189,3 @@ export const sequencerClientConfigMappings = {
97
189
  */ export function getConfigEnvVars() {
98
190
  return getConfigFromMappings(sequencerClientConfigMappings);
99
191
  }
100
- /**
101
- * Parses a string to a list of allowed elements.
102
- * Each encoded is expected to be of one of the following formats
103
- * `I:${address}`
104
- * `I:${address}:${selector}`
105
- * `C:${classId}`
106
- * `C:${classId}:${selector}`
107
- *
108
- * @param value The string to parse
109
- * @returns A list of allowed elements
110
- */ export function parseSequencerAllowList(value) {
111
- const entries = [];
112
- if (!value) {
113
- return entries;
114
- }
115
- for (const val of value.split(',')){
116
- const [typeString, identifierString, selectorString] = val.split(':');
117
- const selector = selectorString !== undefined ? FunctionSelector.fromString(selectorString) : undefined;
118
- if (typeString === 'I') {
119
- if (selector) {
120
- entries.push({
121
- address: AztecAddress.fromString(identifierString),
122
- selector
123
- });
124
- } else {
125
- entries.push({
126
- address: AztecAddress.fromString(identifierString)
127
- });
128
- }
129
- } else if (typeString === 'C') {
130
- if (selector) {
131
- entries.push({
132
- classId: Fr.fromHexString(identifierString),
133
- selector
134
- });
135
- } else {
136
- entries.push({
137
- classId: Fr.fromHexString(identifierString)
138
- });
139
- }
140
- }
141
- }
142
- return entries;
143
- }