@aztec/sequencer-client 0.0.0-test.0 → 0.0.1-commit.001888fc

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 (151) hide show
  1. package/dest/client/index.d.ts +1 -1
  2. package/dest/client/sequencer-client.d.ts +50 -33
  3. package/dest/client/sequencer-client.d.ts.map +1 -1
  4. package/dest/client/sequencer-client.js +164 -57
  5. package/dest/config.d.ts +35 -17
  6. package/dest/config.d.ts.map +1 -1
  7. package/dest/config.js +150 -81
  8. package/dest/global_variable_builder/global_builder.d.ts +24 -15
  9. package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
  10. package/dest/global_variable_builder/global_builder.js +63 -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 +48 -27
  16. package/dest/publisher/config.d.ts.map +1 -1
  17. package/dest/publisher/config.js +109 -32
  18. package/dest/publisher/index.d.ts +4 -1
  19. package/dest/publisher/index.d.ts.map +1 -1
  20. package/dest/publisher/index.js +3 -0
  21. package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
  22. package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
  23. package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
  24. package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +59 -0
  25. package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
  26. package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +1 -0
  27. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
  28. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
  29. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +34 -0
  30. package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
  31. package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
  32. package/dest/publisher/l1_tx_failed_store/index.js +2 -0
  33. package/dest/publisher/sequencer-publisher-factory.d.ts +52 -0
  34. package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -0
  35. package/dest/publisher/sequencer-publisher-factory.js +76 -0
  36. package/dest/publisher/sequencer-publisher-metrics.d.ts +5 -4
  37. package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
  38. package/dest/publisher/sequencer-publisher-metrics.js +34 -62
  39. package/dest/publisher/sequencer-publisher.d.ts +158 -93
  40. package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
  41. package/dest/publisher/sequencer-publisher.js +1452 -255
  42. package/dest/sequencer/checkpoint_proposal_job.d.ts +100 -0
  43. package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
  44. package/dest/sequencer/checkpoint_proposal_job.js +1240 -0
  45. package/dest/sequencer/checkpoint_voter.d.ts +35 -0
  46. package/dest/sequencer/checkpoint_voter.d.ts.map +1 -0
  47. package/dest/sequencer/checkpoint_voter.js +109 -0
  48. package/dest/sequencer/config.d.ts +7 -1
  49. package/dest/sequencer/config.d.ts.map +1 -1
  50. package/dest/sequencer/errors.d.ts +11 -0
  51. package/dest/sequencer/errors.d.ts.map +1 -0
  52. package/dest/sequencer/errors.js +15 -0
  53. package/dest/sequencer/events.d.ts +46 -0
  54. package/dest/sequencer/events.d.ts.map +1 -0
  55. package/dest/sequencer/events.js +1 -0
  56. package/dest/sequencer/index.d.ts +4 -2
  57. package/dest/sequencer/index.d.ts.map +1 -1
  58. package/dest/sequencer/index.js +3 -1
  59. package/dest/sequencer/metrics.d.ts +60 -12
  60. package/dest/sequencer/metrics.d.ts.map +1 -1
  61. package/dest/sequencer/metrics.js +283 -67
  62. package/dest/sequencer/sequencer.d.ts +157 -135
  63. package/dest/sequencer/sequencer.d.ts.map +1 -1
  64. package/dest/sequencer/sequencer.js +966 -523
  65. package/dest/sequencer/timetable.d.ts +75 -25
  66. package/dest/sequencer/timetable.d.ts.map +1 -1
  67. package/dest/sequencer/timetable.js +174 -62
  68. package/dest/sequencer/types.d.ts +3 -0
  69. package/dest/sequencer/types.d.ts.map +1 -0
  70. package/dest/sequencer/types.js +1 -0
  71. package/dest/sequencer/utils.d.ts +20 -38
  72. package/dest/sequencer/utils.d.ts.map +1 -1
  73. package/dest/sequencer/utils.js +12 -47
  74. package/dest/test/index.d.ts +9 -3
  75. package/dest/test/index.d.ts.map +1 -1
  76. package/dest/test/index.js +0 -4
  77. package/dest/test/mock_checkpoint_builder.d.ts +99 -0
  78. package/dest/test/mock_checkpoint_builder.d.ts.map +1 -0
  79. package/dest/test/mock_checkpoint_builder.js +231 -0
  80. package/dest/test/utils.d.ts +53 -0
  81. package/dest/test/utils.d.ts.map +1 -0
  82. package/dest/test/utils.js +104 -0
  83. package/package.json +46 -45
  84. package/src/client/sequencer-client.ts +220 -104
  85. package/src/config.ts +172 -96
  86. package/src/global_variable_builder/global_builder.ts +85 -55
  87. package/src/index.ts +1 -3
  88. package/src/publisher/config.ts +150 -59
  89. package/src/publisher/index.ts +7 -0
  90. package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
  91. package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +55 -0
  92. package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +46 -0
  93. package/src/publisher/l1_tx_failed_store/index.ts +3 -0
  94. package/src/publisher/sequencer-publisher-factory.ts +124 -0
  95. package/src/publisher/sequencer-publisher-metrics.ts +33 -63
  96. package/src/publisher/sequencer-publisher.ts +1266 -311
  97. package/src/sequencer/README.md +531 -0
  98. package/src/sequencer/checkpoint_proposal_job.ts +967 -0
  99. package/src/sequencer/checkpoint_voter.ts +130 -0
  100. package/src/sequencer/config.ts +8 -0
  101. package/src/sequencer/errors.ts +21 -0
  102. package/src/sequencer/events.ts +27 -0
  103. package/src/sequencer/index.ts +3 -1
  104. package/src/sequencer/metrics.ts +362 -73
  105. package/src/sequencer/sequencer.ts +712 -586
  106. package/src/sequencer/timetable.ts +224 -64
  107. package/src/sequencer/types.ts +6 -0
  108. package/src/sequencer/utils.ts +28 -60
  109. package/src/test/index.ts +11 -5
  110. package/src/test/mock_checkpoint_builder.ts +323 -0
  111. package/src/test/utils.ts +167 -0
  112. package/dest/sequencer/allowed.d.ts +0 -3
  113. package/dest/sequencer/allowed.d.ts.map +0 -1
  114. package/dest/sequencer/allowed.js +0 -27
  115. package/dest/slasher/factory.d.ts +0 -7
  116. package/dest/slasher/factory.d.ts.map +0 -1
  117. package/dest/slasher/factory.js +0 -8
  118. package/dest/slasher/index.d.ts +0 -3
  119. package/dest/slasher/index.d.ts.map +0 -1
  120. package/dest/slasher/index.js +0 -2
  121. package/dest/slasher/slasher_client.d.ts +0 -75
  122. package/dest/slasher/slasher_client.d.ts.map +0 -1
  123. package/dest/slasher/slasher_client.js +0 -132
  124. package/dest/tx_validator/archive_cache.d.ts +0 -14
  125. package/dest/tx_validator/archive_cache.d.ts.map +0 -1
  126. package/dest/tx_validator/archive_cache.js +0 -22
  127. package/dest/tx_validator/gas_validator.d.ts +0 -14
  128. package/dest/tx_validator/gas_validator.d.ts.map +0 -1
  129. package/dest/tx_validator/gas_validator.js +0 -78
  130. package/dest/tx_validator/nullifier_cache.d.ts +0 -16
  131. package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
  132. package/dest/tx_validator/nullifier_cache.js +0 -24
  133. package/dest/tx_validator/phases_validator.d.ts +0 -12
  134. package/dest/tx_validator/phases_validator.d.ts.map +0 -1
  135. package/dest/tx_validator/phases_validator.js +0 -80
  136. package/dest/tx_validator/test_utils.d.ts +0 -23
  137. package/dest/tx_validator/test_utils.d.ts.map +0 -1
  138. package/dest/tx_validator/test_utils.js +0 -26
  139. package/dest/tx_validator/tx_validator_factory.d.ts +0 -18
  140. package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
  141. package/dest/tx_validator/tx_validator_factory.js +0 -50
  142. package/src/sequencer/allowed.ts +0 -36
  143. package/src/slasher/factory.ts +0 -15
  144. package/src/slasher/index.ts +0 -2
  145. package/src/slasher/slasher_client.ts +0 -193
  146. package/src/tx_validator/archive_cache.ts +0 -28
  147. package/src/tx_validator/gas_validator.ts +0 -101
  148. package/src/tx_validator/nullifier_cache.ts +0 -30
  149. package/src/tx_validator/phases_validator.ts +0 -98
  150. package/src/tx_validator/test_utils.ts +0 -48
  151. 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,34 @@
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
- import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
3
+ import { type Delayer, L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
4
+ import { PublisherManager } from '@aztec/ethereum/publisher-manager';
4
5
  import { EthAddress } from '@aztec/foundation/eth-address';
6
+ import { createLogger } from '@aztec/foundation/log';
5
7
  import type { DateProvider } from '@aztec/foundation/timer';
8
+ import type { KeystoreManager } from '@aztec/node-keystore';
6
9
  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';
10
+ import type { SlasherClientInterface } from '@aztec/slasher';
11
+ import type { L2BlockSink, L2BlockSource } from '@aztec/stdlib/block';
12
+ import type { ValidatorClientFullConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
11
13
  import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
12
- import type { TelemetryClient } from '@aztec/telemetry-client';
13
- import type { ValidatorClient } from '@aztec/validator-client';
14
- import type { SequencerClientConfig } from '../config.js';
15
- import { SequencerPublisher } from '../publisher/index.js';
14
+ import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
15
+ import { FullNodeCheckpointsBuilder, NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
16
+ import { type SequencerClientConfig } from '../config.js';
17
+ import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
16
18
  import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
17
- import type { SlasherClient } from '../slasher/index.js';
18
19
  /**
19
20
  * Encapsulates the full sequencer and publisher.
20
21
  */
21
22
  export declare class SequencerClient {
23
+ protected publisherManager: PublisherManager<L1TxUtils>;
22
24
  protected sequencer: Sequencer;
23
- constructor(sequencer: Sequencer);
25
+ protected checkpointsBuilder: FullNodeCheckpointsBuilder;
26
+ protected validatorClient?: ValidatorClient | undefined;
27
+ private l1Metrics?;
28
+ private delayer_?;
29
+ constructor(publisherManager: PublisherManager<L1TxUtils>, sequencer: Sequencer, checkpointsBuilder: FullNodeCheckpointsBuilder, validatorClient?: ValidatorClient | undefined, l1Metrics?: L1Metrics | undefined, delayer_?: Delayer | undefined);
24
30
  /**
25
- * Initializes and starts a new instance.
31
+ * Initializes a new instance.
26
32
  * @param config - Configuration for the sequencer, publisher, and L1 tx sender.
27
33
  * @param p2pClient - P2P client that provides the txs to be sequenced.
28
34
  * @param validatorClient - Validator client performs attestation duties when rotating proposers.
@@ -31,41 +37,52 @@ export declare class SequencerClient {
31
37
  * @param l2BlockSource - Provides information about the previously published blocks.
32
38
  * @param l1ToL2MessageSource - Provides access to L1 to L2 messages.
33
39
  * @param prover - An instance of a block prover
34
- * @param simulationProvider - An instance of a simulation provider
35
40
  * @returns A new running instance.
36
41
  */
37
42
  static new(config: SequencerClientConfig, deps: {
38
- validatorClient: ValidatorClient | undefined;
43
+ validatorClient: ValidatorClient;
39
44
  p2pClient: P2P;
40
45
  worldStateSynchronizer: WorldStateSynchronizer;
41
- slasherClient: SlasherClient;
42
- contractDataSource: ContractDataSource;
43
- l2BlockSource: L2BlockSource;
46
+ slasherClient: SlasherClientInterface | undefined;
47
+ checkpointsBuilder: FullNodeCheckpointsBuilder;
48
+ l2BlockSource: L2BlockSource & L2BlockSink;
44
49
  l1ToL2MessageSource: L1ToL2MessageSource;
45
50
  telemetry: TelemetryClient;
46
- publisher?: SequencerPublisher;
47
- blobSinkClient?: BlobSinkClientInterface;
51
+ publisherFactory?: SequencerPublisherFactory;
52
+ blobClient: BlobClientInterface;
48
53
  dateProvider: DateProvider;
49
54
  epochCache?: EpochCache;
50
- l1TxUtils?: L1TxUtilsWithBlobs;
55
+ l1TxUtils: L1TxUtils[];
56
+ nodeKeyStore: KeystoreManager;
51
57
  }): Promise<SequencerClient>;
52
58
  /**
53
- * Updates sequencer config.
59
+ * Updates sequencer and validator client config.
54
60
  * @param config - New parameters.
55
61
  */
56
- updateSequencerConfig(config: SequencerConfig): Promise<void>;
62
+ updateConfig(config: SequencerConfig & Partial<ValidatorClientFullConfig>): void;
63
+ /** Starts the sequencer. */
64
+ start(): Promise<void>;
57
65
  /**
58
66
  * Stops the sequencer from processing new txs.
59
67
  */
60
68
  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;
69
+ getSequencer(): Sequencer;
70
+ /** Updates the publisher factory's node keystore adapter after a keystore reload. */
71
+ updatePublisherNodeKeyStore(adapter: NodeKeystoreAdapter): void;
72
+ /** Returns the shared tx delayer for sequencer L1 txs, if enabled. Test-only. */
73
+ getDelayer(): Delayer | undefined;
74
+ get validatorAddresses(): EthAddress[] | undefined;
75
+ get maxL2BlockGas(): number | undefined;
70
76
  }
71
- //# sourceMappingURL=sequencer-client.d.ts.map
77
+ /**
78
+ * Computes per-block L2 gas, DA gas, and TX count budgets based on the L1 rollup limits and the timetable.
79
+ * If the user explicitly set a limit, it is capped at the corresponding checkpoint limit.
80
+ * Otherwise, derives it as (checkpointLimit / maxBlocks) * multiplier, capped at the checkpoint limit.
81
+ */
82
+ export declare function computeBlockLimits(config: SequencerClientConfig, rollupManaLimit: number, l1PublishingTime: number, log: ReturnType<typeof createLogger>): {
83
+ maxL2BlockGas: number;
84
+ maxDABlockGas: number;
85
+ maxTxsPerBlock: number;
86
+ maxBlocksPerCheckpoint: number;
87
+ };
88
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VxdWVuY2VyLWNsaWVudC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaWVudC9zZXF1ZW5jZXItY2xpZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFckUsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBSWhELE9BQU8sRUFBRSxLQUFLLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUN0RSxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUNyRSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDM0QsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ3JELE9BQU8sS0FBSyxFQUFFLFlBQVksR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AU,EAAE,mBAAmB,CAAC;QAChC,YAAY,EAAE,YAAY,CAAC;QAC3B,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,SAAS,EAAE,SAAS,EAAE,CAAC;QACvB,YAAY,EAAE,eAAe,CAAC;KAC/B,4BA2HF;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,qFAAqF;IAC9E,2BAA2B,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAErE;IAED,iFAAiF;IACjF,UAAU,IAAI,OAAO,GAAG,SAAS,CAEhC;IAED,IAAI,kBAAkB,IAAI,UAAU,EAAE,GAAG,SAAS,CAEjD;IAED,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;CACF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,qBAAqB,EAC7B,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,EACxB,GAAG,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,GACnC;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,sBAAsB,EAAE,MAAM,CAAA;CAAE,CA2E1G"}
@@ -1,22 +1,38 @@
1
+ import { MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT } from '@aztec/constants';
1
2
  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';
3
+ import { isAnvilTestChain } from '@aztec/ethereum/chain';
4
+ import { getPublicClient } from '@aztec/ethereum/client';
5
+ import { GovernanceProposerContract, RollupContract } from '@aztec/ethereum/contracts';
6
+ import { PublisherManager } from '@aztec/ethereum/publisher-manager';
4
7
  import { EthAddress } from '@aztec/foundation/eth-address';
5
8
  import { createLogger } from '@aztec/foundation/log';
6
- import { LightweightBlockBuilderFactory } from '@aztec/prover-client/block-builder';
7
- import { PublicProcessorFactory } from '@aztec/simulator/server';
9
+ import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
10
+ import { L1Metrics } from '@aztec/telemetry-client';
11
+ import { NodeKeystoreAdapter } from '@aztec/validator-client';
12
+ import { DefaultSequencerConfig, getPublisherConfigFromSequencerConfig } from '../config.js';
8
13
  import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
9
- import { SequencerPublisher } from '../publisher/index.js';
14
+ import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
10
15
  import { Sequencer } from '../sequencer/index.js';
16
+ import { SequencerTimetable } from '../sequencer/timetable.js';
11
17
  /**
12
18
  * Encapsulates the full sequencer and publisher.
13
19
  */ export class SequencerClient {
20
+ publisherManager;
14
21
  sequencer;
15
- constructor(sequencer){
22
+ checkpointsBuilder;
23
+ validatorClient;
24
+ l1Metrics;
25
+ delayer_;
26
+ constructor(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics, delayer_){
27
+ this.publisherManager = publisherManager;
16
28
  this.sequencer = sequencer;
29
+ this.checkpointsBuilder = checkpointsBuilder;
30
+ this.validatorClient = validatorClient;
31
+ this.l1Metrics = l1Metrics;
32
+ this.delayer_ = delayer_;
17
33
  }
18
34
  /**
19
- * Initializes and starts a new instance.
35
+ * Initializes a new instance.
20
36
  * @param config - Configuration for the sequencer, publisher, and L1 tx sender.
21
37
  * @param p2pClient - P2P client that provides the txs to be sequenced.
22
38
  * @param validatorClient - Validator client performs attestation duties when rotating proposers.
@@ -25,93 +41,184 @@ import { Sequencer } from '../sequencer/index.js';
25
41
  * @param l2BlockSource - Provides information about the previously published blocks.
26
42
  * @param l1ToL2MessageSource - Provides access to L1 to L2 messages.
27
43
  * @param prover - An instance of a block prover
28
- * @param simulationProvider - An instance of a simulation provider
29
44
  * @returns A new running instance.
30
45
  */ 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);
46
+ const { validatorClient, p2pClient, worldStateSynchronizer, slasherClient, checkpointsBuilder, l2BlockSource, l1ToL2MessageSource, telemetry: telemetryClient } = deps;
47
+ const { l1RpcUrls: rpcUrls, l1ChainId: chainId } = config;
48
+ const log = createLogger('sequencer');
49
+ const publicClient = getPublicClient(config);
50
+ const l1TxUtils = deps.l1TxUtils;
51
+ const l1Metrics = new L1Metrics(telemetryClient.getMeter('L1PublisherMetrics'), publicClient, l1TxUtils.map((x)=>x.getSenderAddress()));
52
+ const publisherManager = new PublisherManager(l1TxUtils, getPublisherConfigFromSequencerConfig(config), log.getBindings());
37
53
  const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
38
- const [l1GenesisTime, slotDuration] = await Promise.all([
54
+ const [l1GenesisTime, slotDuration, rollupVersion, rollupManaLimit] = await Promise.all([
39
55
  rollupContract.getL1GenesisTime(),
40
- rollupContract.getSlotDuration()
56
+ rollupContract.getSlotDuration(),
57
+ rollupContract.getVersion(),
58
+ rollupContract.getManaLimit().then(Number)
41
59
  ]);
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
60
  const governanceProposerContract = new GovernanceProposerContract(publicClient, config.l1Contracts.governanceProposerAddress.toString());
44
- const slashingProposerAddress = await rollupContract.getSlashingProposerAddress();
45
- const slashingProposerContract = new SlashingProposerContract(publicClient, slashingProposerAddress.toString());
46
61
  const epochCache = deps.epochCache ?? await EpochCache.create(config.l1Contracts.rollupAddress, {
47
62
  l1RpcUrls: rpcUrls,
48
63
  l1ChainId: chainId,
49
64
  viemPollingIntervalMS: config.viemPollingIntervalMS,
50
- aztecSlotDuration: config.aztecSlotDuration,
51
- ethereumSlotDuration: config.ethereumSlotDuration,
52
- aztecEpochDuration: config.aztecEpochDuration
65
+ ethereumSlotDuration: config.ethereumSlotDuration
53
66
  }, {
54
67
  dateProvider: deps.dateProvider
55
68
  });
56
- const publisher = deps.publisher ?? new SequencerPublisher(config, {
57
- l1TxUtils,
69
+ const slashFactoryContract = new SlashFactoryContract(publicClient, config.l1Contracts.slashFactoryAddress?.toString() ?? EthAddress.ZERO.toString());
70
+ const publisherFactory = deps.publisherFactory ?? new SequencerPublisherFactory(config, {
58
71
  telemetry: telemetryClient,
59
- blobSinkClient: deps.blobSinkClient,
60
- rollupContract,
72
+ blobClient: deps.blobClient,
61
73
  epochCache,
62
- forwarderContract,
63
74
  governanceProposerContract,
64
- slashingProposerContract
75
+ slashFactoryContract,
76
+ rollupContract,
77
+ dateProvider: deps.dateProvider,
78
+ publisherManager,
79
+ nodeKeyStore: NodeKeystoreAdapter.fromKeyStoreManager(deps.nodeKeyStore),
80
+ logger: log
65
81
  });
66
- const globalsBuilder = new GlobalVariableBuilder(config);
67
- const publicProcessorFactory = new PublicProcessorFactory(contractDataSource, deps.dateProvider, telemetryClient);
68
82
  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.
83
+ const globalsBuilder = new GlobalVariableBuilder({
84
+ ...config,
85
+ l1GenesisTime,
86
+ slotDuration: Number(slotDuration),
87
+ ethereumSlotDuration,
88
+ rollupVersion
89
+ });
90
+ // When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
91
+ // Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
72
92
  // 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.
93
+ // reduce the publishing time allowance. However, we prefer being conservative.
74
94
  // See https://www.blocknative.com/blog/anatomy-of-a-slot#7 for more info.
75
- const maxL1TxInclusionTimeIntoSlot = config.maxL1TxInclusionTimeIntoSlot ?? isAnvilTestChain(config.l1ChainId) ? ethereumSlotDuration : 0;
95
+ const l1PublishingTimeBasedOnChain = isAnvilTestChain(config.l1ChainId) ? 1 : ethereumSlotDuration;
96
+ const l1PublishingTime = config.l1PublishingTime ?? l1PublishingTimeBasedOnChain;
97
+ const { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock, maxBlocksPerCheckpoint } = computeBlockLimits(config, rollupManaLimit, l1PublishingTime, log);
76
98
  const l1Constants = {
77
99
  l1GenesisTime,
78
100
  slotDuration: Number(slotDuration),
79
- ethereumSlotDuration
101
+ ethereumSlotDuration,
102
+ rollupManaLimit
80
103
  };
81
- const sequencer = new Sequencer(publisher, validatorClient, globalsBuilder, p2pClient, worldStateSynchronizer, slasherClient, new LightweightBlockBuilderFactory(telemetryClient), l2BlockSource, l1ToL2MessageSource, publicProcessorFactory, contractDataSource, l1Constants, deps.dateProvider, {
104
+ const sequencer = new Sequencer(publisherFactory, validatorClient, globalsBuilder, p2pClient, worldStateSynchronizer, slasherClient, l2BlockSource, l1ToL2MessageSource, checkpointsBuilder, l1Constants, deps.dateProvider, epochCache, rollupContract, {
82
105
  ...config,
83
- maxL1TxInclusionTimeIntoSlot
84
- }, telemetryClient);
85
- await validatorClient?.start();
86
- await sequencer.start();
87
- return new SequencerClient(sequencer);
106
+ l1PublishingTime,
107
+ maxL2BlockGas,
108
+ maxDABlockGas,
109
+ maxTxsPerBlock,
110
+ maxBlocksPerCheckpoint
111
+ }, telemetryClient, log);
112
+ sequencer.init();
113
+ // Extract the shared delayer from the first L1TxUtils instance (all instances share the same delayer)
114
+ const delayer = l1TxUtils[0]?.delayer;
115
+ return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics, delayer);
88
116
  }
89
117
  /**
90
- * Updates sequencer config.
118
+ * Updates sequencer and validator client config.
91
119
  * @param config - New parameters.
92
- */ updateSequencerConfig(config) {
93
- return this.sequencer.updateConfig(config);
120
+ */ updateConfig(config) {
121
+ this.sequencer.updateConfig(config);
122
+ this.checkpointsBuilder.updateConfig(config);
123
+ this.validatorClient?.updateConfig(config);
124
+ }
125
+ /** Starts the sequencer. */ async start() {
126
+ await this.validatorClient?.start();
127
+ this.sequencer.start();
128
+ this.l1Metrics?.start();
129
+ await this.publisherManager.loadState();
94
130
  }
95
131
  /**
96
132
  * Stops the sequencer from processing new txs.
97
133
  */ async stop() {
98
134
  await this.sequencer.stop();
135
+ await this.validatorClient?.stop();
136
+ this.publisherManager.interrupt();
137
+ this.l1Metrics?.stop();
99
138
  }
100
- /** Forces the sequencer to bypass all time and tx count checks for the next block and build anyway. */ flush() {
101
- this.sequencer.flush();
139
+ getSequencer() {
140
+ return this.sequencer;
102
141
  }
103
- /**
104
- * Restarts the sequencer after being stopped.
105
- */ restart() {
106
- this.sequencer.restart();
142
+ /** Updates the publisher factory's node keystore adapter after a keystore reload. */ updatePublisherNodeKeyStore(adapter) {
143
+ this.sequencer.updatePublisherNodeKeyStore(adapter);
144
+ }
145
+ /** Returns the shared tx delayer for sequencer L1 txs, if enabled. Test-only. */ getDelayer() {
146
+ return this.delayer_;
147
+ }
148
+ get validatorAddresses() {
149
+ return this.sequencer.getValidatorAddresses();
107
150
  }
108
- get coinbase() {
109
- return this.sequencer.coinbase;
151
+ get maxL2BlockGas() {
152
+ return this.sequencer.maxL2BlockGas;
153
+ }
154
+ }
155
+ /**
156
+ * Computes per-block L2 gas, DA gas, and TX count budgets based on the L1 rollup limits and the timetable.
157
+ * If the user explicitly set a limit, it is capped at the corresponding checkpoint limit.
158
+ * Otherwise, derives it as (checkpointLimit / maxBlocks) * multiplier, capped at the checkpoint limit.
159
+ */ export function computeBlockLimits(config, rollupManaLimit, l1PublishingTime, log) {
160
+ const maxNumberOfBlocks = new SequencerTimetable({
161
+ ethereumSlotDuration: config.ethereumSlotDuration,
162
+ aztecSlotDuration: config.aztecSlotDuration,
163
+ l1PublishingTime,
164
+ p2pPropagationTime: config.attestationPropagationTime,
165
+ blockDurationMs: config.blockDurationMs,
166
+ enforce: config.enforceTimeTable ?? DefaultSequencerConfig.enforceTimeTable
167
+ }).maxNumberOfBlocks;
168
+ const multiplier = config.perBlockAllocationMultiplier ?? DefaultSequencerConfig.perBlockAllocationMultiplier;
169
+ // Compute maxL2BlockGas
170
+ let maxL2BlockGas;
171
+ if (config.maxL2BlockGas !== undefined) {
172
+ if (config.maxL2BlockGas > rollupManaLimit) {
173
+ log.warn(`Provided MAX_L2_BLOCK_GAS ${config.maxL2BlockGas} exceeds L1 rollup mana limit ${rollupManaLimit} (capping)`);
174
+ maxL2BlockGas = rollupManaLimit;
175
+ } else {
176
+ maxL2BlockGas = config.maxL2BlockGas;
177
+ }
178
+ } else {
179
+ maxL2BlockGas = Math.min(rollupManaLimit, Math.ceil(rollupManaLimit / maxNumberOfBlocks * multiplier));
110
180
  }
111
- get feeRecipient() {
112
- return this.sequencer.feeRecipient;
181
+ // Compute maxDABlockGas
182
+ const daCheckpointLimit = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT;
183
+ let maxDABlockGas;
184
+ if (config.maxDABlockGas !== undefined) {
185
+ if (config.maxDABlockGas > daCheckpointLimit) {
186
+ log.warn(`Provided MAX_DA_BLOCK_GAS ${config.maxDABlockGas} exceeds DA checkpoint limit ${daCheckpointLimit} (capping)`);
187
+ maxDABlockGas = daCheckpointLimit;
188
+ } else {
189
+ maxDABlockGas = config.maxDABlockGas;
190
+ }
191
+ } else {
192
+ maxDABlockGas = Math.min(daCheckpointLimit, Math.ceil(daCheckpointLimit / maxNumberOfBlocks * multiplier));
113
193
  }
114
- get forwarderAddress() {
115
- return this.sequencer.getForwarderAddress();
194
+ // Compute maxTxsPerBlock
195
+ const defaultMaxTxsPerBlock = 32;
196
+ let maxTxsPerBlock;
197
+ if (config.maxTxsPerBlock !== undefined) {
198
+ if (config.maxTxsPerCheckpoint !== undefined && config.maxTxsPerBlock > config.maxTxsPerCheckpoint) {
199
+ log.warn(`Provided MAX_TX_PER_BLOCK ${config.maxTxsPerBlock} exceeds MAX_TX_PER_CHECKPOINT ${config.maxTxsPerCheckpoint} (capping)`);
200
+ maxTxsPerBlock = config.maxTxsPerCheckpoint;
201
+ } else {
202
+ maxTxsPerBlock = config.maxTxsPerBlock;
203
+ }
204
+ } else if (config.maxTxsPerCheckpoint !== undefined) {
205
+ maxTxsPerBlock = Math.min(config.maxTxsPerCheckpoint, Math.ceil(config.maxTxsPerCheckpoint / maxNumberOfBlocks * multiplier));
206
+ } else {
207
+ maxTxsPerBlock = defaultMaxTxsPerBlock;
116
208
  }
209
+ log.info(`Computed block limits L2=${maxL2BlockGas} DA=${maxDABlockGas} maxTxs=${maxTxsPerBlock}`, {
210
+ maxL2BlockGas,
211
+ maxDABlockGas,
212
+ maxTxsPerBlock,
213
+ rollupManaLimit,
214
+ daCheckpointLimit,
215
+ maxNumberOfBlocks,
216
+ multiplier
217
+ });
218
+ return {
219
+ maxL2BlockGas,
220
+ maxDABlockGas,
221
+ maxTxsPerBlock,
222
+ maxBlocksPerCheckpoint: maxNumberOfBlocks
223
+ };
117
224
  }
package/dest/config.d.ts CHANGED
@@ -1,29 +1,47 @@
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 PublisherConfig, type TxSenderConfig } from './publisher/config.js';
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 ValidatorClientConfig } from '@aztec/validator-client/config';
8
+ import { type SequencerPublisherConfig, type SequencerTxSenderConfig } from './publisher/config.js';
5
9
  export * from './publisher/config.js';
6
10
  export type { SequencerConfig };
11
+ /**
12
+ * Default values for SequencerConfig.
13
+ * Centralized location for all sequencer configuration defaults.
14
+ */
15
+ export declare const DefaultSequencerConfig: {
16
+ sequencerPollingIntervalMS: number;
17
+ minTxsPerBlock: number;
18
+ buildCheckpointIfEmpty: false;
19
+ publishTxsWithProposals: false;
20
+ perBlockAllocationMultiplier: number;
21
+ redistributeCheckpointBudget: true;
22
+ enforceTimeTable: true;
23
+ attestationPropagationTime: number;
24
+ secondsBeforeInvalidatingBlockAsCommitteeMember: number;
25
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: number;
26
+ skipCollectingAttestations: false;
27
+ skipInvalidateBlockAsProposer: false;
28
+ broadcastInvalidBlockProposal: false;
29
+ injectFakeAttestation: false;
30
+ injectHighSValueAttestation: false;
31
+ injectUnrecoverableSignatureAttestation: false;
32
+ fishermanMode: false;
33
+ shuffleAttestationOrdering: false;
34
+ skipPushProposedBlocksToArchiver: false;
35
+ skipPublishingCheckpointsPercent: number;
36
+ };
7
37
  /**
8
38
  * Configuration settings for the SequencerClient.
9
39
  */
10
- export type SequencerClientConfig = PublisherConfig & TxSenderConfig & SequencerConfig & L1ReaderConfig & ChainConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
40
+ export type SequencerClientConfig = SequencerPublisherConfig & KeyStoreConfig & ValidatorClientConfig & SequencerTxSenderConfig & SequencerConfig & L1ReaderConfig & ChainConfig & Pick<P2PConfig, 'txPublicSetupAllowListExtend'> & Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
11
41
  export declare const sequencerConfigMappings: ConfigMappingsType<SequencerConfig>;
12
42
  export declare const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig>;
13
43
  /**
14
44
  * Creates an instance of SequencerClientConfig out of environment variables using sensible defaults for integration testing if not set.
15
45
  */
16
46
  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
47
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLGlCQUFpQixFQUE2QixNQUFNLHdCQUF3QixDQUFDO0FBQzNGLE9BQU8sRUFBRSxLQUFLLGNBQWMsRUFBMEIsTUFBTSwyQkFBMkIsQ0FBQztBQUN4RixPQUFPLEVBQ0wsS0FBSyxrQkFBa0IsRUFLeEIsTUFBTSwwQkFBMEIsQ0FBQztBQUVsQyxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQTBCLE1BQU0sNkJBQTZCLENBQUM7QUFDMUYsT0FBTyxFQUFFLEtBQUssU0FBUyxFQUFxQixNQUFN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