@aztec/sequencer-client 0.0.1-commit.6d3c34e → 0.0.1-commit.7035c9bd6

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 (97) hide show
  1. package/dest/client/sequencer-client.d.ts +12 -7
  2. package/dest/client/sequencer-client.d.ts.map +1 -1
  3. package/dest/client/sequencer-client.js +56 -17
  4. package/dest/config.d.ts +26 -7
  5. package/dest/config.d.ts.map +1 -1
  6. package/dest/config.js +47 -30
  7. package/dest/global_variable_builder/global_builder.d.ts +2 -4
  8. package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
  9. package/dest/global_variable_builder/global_builder.js +7 -6
  10. package/dest/index.d.ts +2 -2
  11. package/dest/index.d.ts.map +1 -1
  12. package/dest/index.js +1 -1
  13. package/dest/publisher/config.d.ts +35 -17
  14. package/dest/publisher/config.d.ts.map +1 -1
  15. package/dest/publisher/config.js +106 -42
  16. package/dest/publisher/index.d.ts +2 -1
  17. package/dest/publisher/index.d.ts.map +1 -1
  18. package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
  19. package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
  20. package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
  21. package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +59 -0
  22. package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
  23. package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +1 -0
  24. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
  25. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
  26. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +34 -0
  27. package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
  28. package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
  29. package/dest/publisher/l1_tx_failed_store/index.js +2 -0
  30. package/dest/publisher/sequencer-publisher-factory.d.ts +11 -3
  31. package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
  32. package/dest/publisher/sequencer-publisher-factory.js +27 -2
  33. package/dest/publisher/sequencer-publisher-metrics.d.ts +1 -1
  34. package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
  35. package/dest/publisher/sequencer-publisher-metrics.js +12 -4
  36. package/dest/publisher/sequencer-publisher.d.ts +30 -10
  37. package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
  38. package/dest/publisher/sequencer-publisher.js +362 -56
  39. package/dest/sequencer/checkpoint_proposal_job.d.ts +42 -11
  40. package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
  41. package/dest/sequencer/checkpoint_proposal_job.js +322 -122
  42. package/dest/sequencer/checkpoint_voter.d.ts +3 -2
  43. package/dest/sequencer/checkpoint_voter.d.ts.map +1 -1
  44. package/dest/sequencer/checkpoint_voter.js +34 -10
  45. package/dest/sequencer/events.d.ts +2 -1
  46. package/dest/sequencer/events.d.ts.map +1 -1
  47. package/dest/sequencer/index.d.ts +1 -2
  48. package/dest/sequencer/index.d.ts.map +1 -1
  49. package/dest/sequencer/index.js +0 -1
  50. package/dest/sequencer/metrics.d.ts +21 -5
  51. package/dest/sequencer/metrics.d.ts.map +1 -1
  52. package/dest/sequencer/metrics.js +122 -30
  53. package/dest/sequencer/sequencer.d.ts +43 -20
  54. package/dest/sequencer/sequencer.d.ts.map +1 -1
  55. package/dest/sequencer/sequencer.js +151 -82
  56. package/dest/sequencer/timetable.d.ts +4 -6
  57. package/dest/sequencer/timetable.d.ts.map +1 -1
  58. package/dest/sequencer/timetable.js +7 -11
  59. package/dest/sequencer/types.d.ts +2 -2
  60. package/dest/sequencer/types.d.ts.map +1 -1
  61. package/dest/test/index.d.ts +3 -5
  62. package/dest/test/index.d.ts.map +1 -1
  63. package/dest/test/mock_checkpoint_builder.d.ts +23 -19
  64. package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
  65. package/dest/test/mock_checkpoint_builder.js +67 -38
  66. package/dest/test/utils.d.ts +8 -8
  67. package/dest/test/utils.d.ts.map +1 -1
  68. package/dest/test/utils.js +12 -11
  69. package/package.json +29 -28
  70. package/src/client/sequencer-client.ts +77 -18
  71. package/src/config.ts +66 -41
  72. package/src/global_variable_builder/global_builder.ts +6 -5
  73. package/src/index.ts +1 -6
  74. package/src/publisher/config.ts +121 -43
  75. package/src/publisher/index.ts +3 -0
  76. package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
  77. package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +55 -0
  78. package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +46 -0
  79. package/src/publisher/l1_tx_failed_store/index.ts +3 -0
  80. package/src/publisher/sequencer-publisher-factory.ts +38 -6
  81. package/src/publisher/sequencer-publisher-metrics.ts +7 -3
  82. package/src/publisher/sequencer-publisher.ts +360 -69
  83. package/src/sequencer/checkpoint_proposal_job.ts +449 -142
  84. package/src/sequencer/checkpoint_voter.ts +32 -7
  85. package/src/sequencer/events.ts +1 -1
  86. package/src/sequencer/index.ts +0 -1
  87. package/src/sequencer/metrics.ts +138 -32
  88. package/src/sequencer/sequencer.ts +200 -91
  89. package/src/sequencer/timetable.ts +13 -12
  90. package/src/sequencer/types.ts +1 -1
  91. package/src/test/index.ts +2 -4
  92. package/src/test/mock_checkpoint_builder.ts +122 -78
  93. package/src/test/utils.ts +24 -14
  94. package/dest/sequencer/block_builder.d.ts +0 -26
  95. package/dest/sequencer/block_builder.d.ts.map +0 -1
  96. package/dest/sequencer/block_builder.js +0 -129
  97. package/src/sequencer/block_builder.ts +0 -216
@@ -1,9 +1,10 @@
1
1
  import type { BlobClientInterface } from '@aztec/blob-client/client';
2
+ import { MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT } from '@aztec/constants';
2
3
  import { EpochCache } from '@aztec/epoch-cache';
3
4
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
4
5
  import { getPublicClient } from '@aztec/ethereum/client';
5
6
  import { GovernanceProposerContract, RollupContract } from '@aztec/ethereum/contracts';
6
- import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
7
+ import { type Delayer, L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
7
8
  import { PublisherManager } from '@aztec/ethereum/publisher-manager';
8
9
  import { EthAddress } from '@aztec/foundation/eth-address';
9
10
  import { createLogger } from '@aztec/foundation/log';
@@ -18,7 +19,7 @@ import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
18
19
  import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
19
20
  import { FullNodeCheckpointsBuilder, NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
20
21
 
21
- import type { SequencerClientConfig } from '../config.js';
22
+ import { type SequencerClientConfig, getPublisherConfigFromSequencerConfig } from '../config.js';
22
23
  import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
23
24
  import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
24
25
  import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
@@ -28,11 +29,12 @@ import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
28
29
  */
29
30
  export class SequencerClient {
30
31
  constructor(
31
- protected publisherManager: PublisherManager<L1TxUtilsWithBlobs>,
32
+ protected publisherManager: PublisherManager<L1TxUtils>,
32
33
  protected sequencer: Sequencer,
33
34
  protected checkpointsBuilder: FullNodeCheckpointsBuilder,
34
35
  protected validatorClient?: ValidatorClient,
35
36
  private l1Metrics?: L1Metrics,
37
+ private delayer_?: Delayer,
36
38
  ) {}
37
39
 
38
40
  /**
@@ -62,7 +64,7 @@ export class SequencerClient {
62
64
  blobClient: BlobClientInterface;
63
65
  dateProvider: DateProvider;
64
66
  epochCache?: EpochCache;
65
- l1TxUtils: L1TxUtilsWithBlobs[];
67
+ l1TxUtils: L1TxUtils[];
66
68
  nodeKeyStore: KeystoreManager;
67
69
  },
68
70
  ) {
@@ -85,7 +87,11 @@ export class SequencerClient {
85
87
  publicClient,
86
88
  l1TxUtils.map(x => x.getSenderAddress()),
87
89
  );
88
- const publisherManager = new PublisherManager(l1TxUtils, config);
90
+ const publisherManager = new PublisherManager(
91
+ l1TxUtils,
92
+ getPublisherConfigFromSequencerConfig(config),
93
+ log.getBindings(),
94
+ );
89
95
  const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
90
96
  const [l1GenesisTime, slotDuration, rollupVersion, rollupManaLimit] = await Promise.all([
91
97
  rollupContract.getL1GenesisTime(),
@@ -107,6 +113,7 @@ export class SequencerClient {
107
113
  l1ChainId: chainId,
108
114
  viemPollingIntervalMS: config.viemPollingIntervalMS,
109
115
  ethereumSlotDuration: config.ethereumSlotDuration,
116
+ enableProposerPipelining: config.enableProposerPipelining,
110
117
  },
111
118
  { dateProvider: deps.dateProvider },
112
119
  ));
@@ -132,17 +139,14 @@ export class SequencerClient {
132
139
  });
133
140
 
134
141
  const ethereumSlotDuration = config.ethereumSlotDuration;
135
- const l1Constants = { l1GenesisTime, slotDuration: Number(slotDuration), ethereumSlotDuration };
136
-
137
- const globalsBuilder = new GlobalVariableBuilder({ ...config, ...l1Constants, rollupVersion });
138
142
 
139
- let sequencerManaLimit = config.maxL2BlockGas ?? rollupManaLimit;
140
- if (sequencerManaLimit > rollupManaLimit) {
141
- log.warn(
142
- `Provided maxL2BlockGas ${sequencerManaLimit} is greater than the max allowed by L1. Setting limit to ${rollupManaLimit}.`,
143
- );
144
- sequencerManaLimit = rollupManaLimit;
145
- }
143
+ const globalsBuilder = new GlobalVariableBuilder({
144
+ ...config,
145
+ l1GenesisTime,
146
+ slotDuration: Number(slotDuration),
147
+ ethereumSlotDuration,
148
+ rollupVersion,
149
+ });
146
150
 
147
151
  // When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
148
152
  // Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
@@ -152,6 +156,10 @@ export class SequencerClient {
152
156
  const l1PublishingTimeBasedOnChain = isAnvilTestChain(config.l1ChainId) ? 1 : ethereumSlotDuration;
153
157
  const l1PublishingTime = config.l1PublishingTime ?? l1PublishingTimeBasedOnChain;
154
158
 
159
+ const { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock } = capPerBlockLimits(config, rollupManaLimit, log);
160
+
161
+ const l1Constants = { l1GenesisTime, slotDuration: Number(slotDuration), ethereumSlotDuration, rollupManaLimit };
162
+
155
163
  const sequencer = new Sequencer(
156
164
  publisherFactory,
157
165
  validatorClient,
@@ -166,14 +174,17 @@ export class SequencerClient {
166
174
  deps.dateProvider,
167
175
  epochCache,
168
176
  rollupContract,
169
- { ...config, l1PublishingTime, maxL2BlockGas: sequencerManaLimit },
177
+ { ...config, l1PublishingTime, maxL2BlockGas, maxDABlockGas, maxTxsPerBlock },
170
178
  telemetryClient,
171
179
  log,
172
180
  );
173
181
 
174
- await sequencer.init();
182
+ sequencer.init();
183
+
184
+ // Extract the shared delayer from the first L1TxUtils instance (all instances share the same delayer)
185
+ const delayer = l1TxUtils[0]?.delayer;
175
186
 
176
- return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics);
187
+ return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics, delayer);
177
188
  }
178
189
 
179
190
  /**
@@ -208,6 +219,16 @@ export class SequencerClient {
208
219
  return this.sequencer;
209
220
  }
210
221
 
222
+ /** Updates the publisher factory's node keystore adapter after a keystore reload. */
223
+ public updatePublisherNodeKeyStore(adapter: NodeKeystoreAdapter): void {
224
+ this.sequencer.updatePublisherNodeKeyStore(adapter);
225
+ }
226
+
227
+ /** Returns the shared tx delayer for sequencer L1 txs, if enabled. Test-only. */
228
+ getDelayer(): Delayer | undefined {
229
+ return this.delayer_;
230
+ }
231
+
211
232
  get validatorAddresses(): EthAddress[] | undefined {
212
233
  return this.sequencer.getValidatorAddresses();
213
234
  }
@@ -216,3 +237,41 @@ export class SequencerClient {
216
237
  return this.sequencer.maxL2BlockGas;
217
238
  }
218
239
  }
240
+
241
+ /**
242
+ * Caps operator-provided per-block limits at checkpoint-level limits.
243
+ * Returns undefined for any limit the operator didn't set — the checkpoint builder handles redistribution.
244
+ */
245
+ function capPerBlockLimits(
246
+ config: SequencerClientConfig,
247
+ rollupManaLimit: number,
248
+ log: ReturnType<typeof createLogger>,
249
+ ): { maxL2BlockGas: number | undefined; maxDABlockGas: number | undefined; maxTxsPerBlock: number | undefined } {
250
+ let maxL2BlockGas = config.maxL2BlockGas;
251
+ if (maxL2BlockGas !== undefined && maxL2BlockGas > rollupManaLimit) {
252
+ log.warn(`Provided MAX_L2_BLOCK_GAS ${maxL2BlockGas} exceeds rollup mana limit ${rollupManaLimit} (capping)`);
253
+ maxL2BlockGas = rollupManaLimit;
254
+ }
255
+
256
+ let maxDABlockGas = config.maxDABlockGas;
257
+ if (maxDABlockGas !== undefined && maxDABlockGas > MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT) {
258
+ log.warn(
259
+ `Provided MAX_DA_BLOCK_GAS ${maxDABlockGas} exceeds DA checkpoint limit ${MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT} (capping)`,
260
+ );
261
+ maxDABlockGas = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT;
262
+ }
263
+
264
+ let maxTxsPerBlock = config.maxTxsPerBlock;
265
+ if (
266
+ maxTxsPerBlock !== undefined &&
267
+ config.maxTxsPerCheckpoint !== undefined &&
268
+ maxTxsPerBlock > config.maxTxsPerCheckpoint
269
+ ) {
270
+ log.warn(
271
+ `Provided MAX_TX_PER_BLOCK ${maxTxsPerBlock} exceeds MAX_TX_PER_CHECKPOINT ${config.maxTxsPerCheckpoint} (capping)`,
272
+ );
273
+ maxTxsPerBlock = config.maxTxsPerCheckpoint;
274
+ }
275
+
276
+ return { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock };
277
+ }
package/src/config.ts CHANGED
@@ -11,60 +11,67 @@ import { EthAddress } from '@aztec/foundation/eth-address';
11
11
  import { type KeyStoreConfig, keyStoreConfigMappings } from '@aztec/node-keystore/config';
12
12
  import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
13
13
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
14
- import { type ChainConfig, type SequencerConfig, chainConfigMappings } from '@aztec/stdlib/config';
14
+ import {
15
+ type ChainConfig,
16
+ type PipelineConfig,
17
+ type SequencerConfig,
18
+ chainConfigMappings,
19
+ pipelineConfigMappings,
20
+ sharedSequencerConfigMappings,
21
+ } from '@aztec/stdlib/config';
15
22
  import type { ResolvedSequencerConfig } from '@aztec/stdlib/interfaces/server';
23
+ import { DEFAULT_P2P_PROPAGATION_TIME } from '@aztec/stdlib/timetable';
16
24
  import { type ValidatorClientConfig, validatorClientConfigMappings } from '@aztec/validator-client/config';
17
25
 
18
26
  import {
19
- type PublisherConfig,
20
- type TxSenderConfig,
21
- getPublisherConfigMappings,
22
- getTxSenderConfigMappings,
27
+ type SequencerPublisherConfig,
28
+ type SequencerTxSenderConfig,
29
+ sequencerPublisherConfigMappings,
30
+ sequencerTxSenderConfigMappings,
23
31
  } from './publisher/config.js';
24
32
 
25
33
  export * from './publisher/config.js';
26
34
  export type { SequencerConfig };
27
35
 
28
- export const DEFAULT_ATTESTATION_PROPAGATION_TIME = 2;
29
-
30
36
  /**
31
37
  * Default values for SequencerConfig.
32
38
  * Centralized location for all sequencer configuration defaults.
33
39
  */
34
- export const DefaultSequencerConfig: ResolvedSequencerConfig = {
40
+ export const DefaultSequencerConfig = {
35
41
  sequencerPollingIntervalMS: 500,
36
- maxTxsPerBlock: 32,
37
42
  minTxsPerBlock: 1,
38
43
  buildCheckpointIfEmpty: false,
39
44
  publishTxsWithProposals: false,
40
- maxL2BlockGas: 10e9,
41
- maxDABlockGas: 10e9,
42
- maxBlockSizeInBytes: 1024 * 1024,
45
+ perBlockAllocationMultiplier: 1.2,
46
+ redistributeCheckpointBudget: true,
43
47
  enforceTimeTable: true,
44
- attestationPropagationTime: DEFAULT_ATTESTATION_PROPAGATION_TIME,
48
+ attestationPropagationTime: DEFAULT_P2P_PROPAGATION_TIME,
45
49
  secondsBeforeInvalidatingBlockAsCommitteeMember: 144, // 12 L1 blocks
46
50
  secondsBeforeInvalidatingBlockAsNonCommitteeMember: 432, // 36 L1 blocks
47
51
  skipCollectingAttestations: false,
48
52
  skipInvalidateBlockAsProposer: false,
49
53
  broadcastInvalidBlockProposal: false,
50
54
  injectFakeAttestation: false,
55
+ injectHighSValueAttestation: false,
56
+ injectUnrecoverableSignatureAttestation: false,
51
57
  fishermanMode: false,
52
58
  shuffleAttestationOrdering: false,
53
- // TODO(palla/mbps): Change default to false once block sync is stable
54
- skipPushProposedBlocksToArchiver: true,
55
- };
59
+ skipPushProposedBlocksToArchiver: false,
60
+ skipPublishingCheckpointsPercent: 0,
61
+ } satisfies ResolvedSequencerConfig;
56
62
 
57
63
  /**
58
64
  * Configuration settings for the SequencerClient.
59
65
  */
60
- export type SequencerClientConfig = PublisherConfig &
66
+ export type SequencerClientConfig = SequencerPublisherConfig &
61
67
  KeyStoreConfig &
62
68
  ValidatorClientConfig &
63
- TxSenderConfig &
69
+ SequencerTxSenderConfig &
64
70
  SequencerConfig &
65
71
  L1ReaderConfig &
66
72
  ChainConfig &
67
- Pick<P2PConfig, 'txPublicSetupAllowList'> &
73
+ PipelineConfig &
74
+ Pick<P2PConfig, 'txPublicSetupAllowListExtend'> &
68
75
  Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
69
76
 
70
77
  export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
@@ -73,10 +80,10 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
73
80
  description: 'The number of ms to wait between polling for checking to build on the next slot.',
74
81
  ...numberConfigHelper(DefaultSequencerConfig.sequencerPollingIntervalMS),
75
82
  },
76
- maxTxsPerBlock: {
77
- env: 'SEQ_MAX_TX_PER_BLOCK',
78
- description: 'The maximum number of txs to include in a block.',
79
- ...numberConfigHelper(DefaultSequencerConfig.maxTxsPerBlock),
83
+ maxTxsPerCheckpoint: {
84
+ env: 'SEQ_MAX_TX_PER_CHECKPOINT',
85
+ description: 'The maximum number of txs across all blocks in a checkpoint.',
86
+ parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
80
87
  },
81
88
  minTxsPerBlock: {
82
89
  env: 'SEQ_MIN_TX_PER_BLOCK',
@@ -95,12 +102,25 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
95
102
  maxL2BlockGas: {
96
103
  env: 'SEQ_MAX_L2_BLOCK_GAS',
97
104
  description: 'The maximum L2 block gas.',
98
- ...numberConfigHelper(DefaultSequencerConfig.maxL2BlockGas),
105
+ parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
99
106
  },
100
107
  maxDABlockGas: {
101
108
  env: 'SEQ_MAX_DA_BLOCK_GAS',
102
109
  description: 'The maximum DA block gas.',
103
- ...numberConfigHelper(DefaultSequencerConfig.maxDABlockGas),
110
+ parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
111
+ },
112
+ perBlockAllocationMultiplier: {
113
+ env: 'SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER',
114
+ description:
115
+ 'Per-block gas budget multiplier for both L2 and DA gas. Budget per block is (checkpointLimit / maxBlocks) * multiplier.' +
116
+ ' Values greater than one allow early blocks to use more than their even share, relying on checkpoint-level capping for later blocks.',
117
+ ...numberConfigHelper(DefaultSequencerConfig.perBlockAllocationMultiplier),
118
+ },
119
+ redistributeCheckpointBudget: {
120
+ env: 'SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET',
121
+ description:
122
+ 'Redistribute remaining checkpoint budget evenly across remaining blocks instead of allowing a single block to consume the entire remaining budget.',
123
+ ...booleanConfigHelper(DefaultSequencerConfig.redistributeCheckpointBudget),
104
124
  },
105
125
  coinbase: {
106
126
  env: 'COINBASE',
@@ -120,11 +140,6 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
120
140
  env: 'ACVM_BINARY_PATH',
121
141
  description: 'The path to the ACVM binary',
122
142
  },
123
- maxBlockSizeInBytes: {
124
- env: 'SEQ_MAX_BLOCK_SIZE_IN_BYTES',
125
- description: 'Max block size',
126
- ...numberConfigHelper(DefaultSequencerConfig.maxBlockSizeInBytes),
127
- },
128
143
  enforceTimeTable: {
129
144
  env: 'SEQ_ENFORCE_TIME_TABLE',
130
145
  description: 'Whether to enforce the time table when building blocks',
@@ -182,6 +197,14 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
182
197
  description: 'Inject a fake attestation (for testing only)',
183
198
  ...booleanConfigHelper(DefaultSequencerConfig.injectFakeAttestation),
184
199
  },
200
+ injectHighSValueAttestation: {
201
+ description: 'Inject a malleable attestation with a high-s value (for testing only)',
202
+ ...booleanConfigHelper(DefaultSequencerConfig.injectHighSValueAttestation),
203
+ },
204
+ injectUnrecoverableSignatureAttestation: {
205
+ description: 'Inject an attestation with an unrecoverable signature (for testing only)',
206
+ ...booleanConfigHelper(DefaultSequencerConfig.injectUnrecoverableSignatureAttestation),
207
+ },
185
208
  fishermanMode: {
186
209
  env: 'FISHERMAN_MODE',
187
210
  description:
@@ -192,24 +215,25 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
192
215
  description: 'Shuffle attestation ordering to create invalid ordering (for testing only)',
193
216
  ...booleanConfigHelper(DefaultSequencerConfig.shuffleAttestationOrdering),
194
217
  },
195
- blockDurationMs: {
196
- env: 'SEQ_BLOCK_DURATION_MS',
197
- description:
198
- 'Duration per block in milliseconds when building multiple blocks per slot. ' +
199
- 'If undefined (default), builds a single block per slot using the full slot duration.',
200
- parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
201
- },
218
+ ...sharedSequencerConfigMappings,
202
219
  buildCheckpointIfEmpty: {
203
220
  env: 'SEQ_BUILD_CHECKPOINT_IF_EMPTY',
204
221
  description: 'Have sequencer build and publish an empty checkpoint if there are no txs',
205
222
  ...booleanConfigHelper(DefaultSequencerConfig.buildCheckpointIfEmpty),
206
223
  },
207
- // TODO(palla/mbps): Change default to false once block sync is stable
208
224
  skipPushProposedBlocksToArchiver: {
209
225
  description: 'Skip pushing proposed blocks to archiver (default: true)',
210
226
  ...booleanConfigHelper(DefaultSequencerConfig.skipPushProposedBlocksToArchiver),
211
227
  },
212
- ...pickConfigMappings(p2pConfigMappings, ['txPublicSetupAllowList']),
228
+ minBlocksForCheckpoint: {
229
+ description: 'Minimum number of blocks required for a checkpoint proposal (test only)',
230
+ },
231
+ skipPublishingCheckpointsPercent: {
232
+ env: 'SEQ_SKIP_CHECKPOINT_PUBLISH_PERCENT',
233
+ description: 'Percent probability (0 - 100) of sequencer skipping checkpoint publishing (testing only)',
234
+ ...numberConfigHelper(DefaultSequencerConfig.skipPublishingCheckpointsPercent),
235
+ },
236
+ ...pickConfigMappings(p2pConfigMappings, ['txPublicSetupAllowListExtend']),
213
237
  };
214
238
 
215
239
  export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig> = {
@@ -217,9 +241,10 @@ export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientCo
217
241
  ...sequencerConfigMappings,
218
242
  ...keyStoreConfigMappings,
219
243
  ...l1ReaderConfigMappings,
220
- ...getTxSenderConfigMappings('SEQ'),
221
- ...getPublisherConfigMappings('SEQ'),
244
+ ...sequencerTxSenderConfigMappings,
245
+ ...sequencerPublisherConfigMappings,
222
246
  ...chainConfigMappings,
247
+ ...pipelineConfigMappings,
223
248
  ...pickConfigMappings(l1ContractsConfigMappings, ['ethereumSlotDuration', 'aztecSlotDuration', 'aztecEpochDuration']),
224
249
  };
225
250
 
@@ -1,4 +1,5 @@
1
1
  import { createEthereumChain } from '@aztec/ethereum/chain';
2
+ import { makeL1HttpTransport } from '@aztec/ethereum/client';
2
3
  import type { L1ContractsConfig } from '@aztec/ethereum/config';
3
4
  import { RollupContract } from '@aztec/ethereum/contracts';
4
5
  import type { L1ReaderConfig } from '@aztec/ethereum/l1-reader';
@@ -16,7 +17,7 @@ import type {
16
17
  } from '@aztec/stdlib/tx';
17
18
  import { GlobalVariables } from '@aztec/stdlib/tx';
18
19
 
19
- import { createPublicClient, fallback, http } from 'viem';
20
+ import { createPublicClient } from 'viem';
20
21
 
21
22
  /**
22
23
  * Simple global variables builder.
@@ -53,7 +54,7 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
53
54
 
54
55
  this.publicClient = createPublicClient({
55
56
  chain: chain.chainInfo,
56
- transport: fallback(chain.rpcUrls.map(url => http(url, { batch: false }))),
57
+ transport: makeL1HttpTransport(chain.rpcUrls, { timeout: config.l1HttpTimeoutMS }),
57
58
  pollingInterval: config.viemPollingIntervalMS,
58
59
  });
59
60
 
@@ -69,9 +70,9 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
69
70
  // we need to fetch the last block written, and estimate the earliest timestamp for the next block.
70
71
  // The timestamp of that last block will act as a lower bound for the next block.
71
72
 
72
- const lastBlock = await this.rollupContract.getPendingCheckpoint();
73
+ const lastCheckpoint = await this.rollupContract.getPendingCheckpoint();
73
74
  const earliestTimestamp = await this.rollupContract.getTimestampForSlot(
74
- SlotNumber.fromBigInt(BigInt(lastBlock.slotNumber) + 1n),
75
+ SlotNumber.fromBigInt(BigInt(lastCheckpoint.slotNumber) + 1n),
75
76
  );
76
77
  const nextEthTimestamp = BigInt((await this.publicClient.getBlock()).timestamp + BigInt(this.ethereumSlotDuration));
77
78
  const timestamp = earliestTimestamp > nextEthTimestamp ? earliestTimestamp : nextEthTimestamp;
@@ -120,7 +121,7 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
120
121
  coinbase: EthAddress,
121
122
  feeRecipient: AztecAddress,
122
123
  slotNumber: SlotNumber,
123
- ): Promise<CheckpointGlobalVariables & { timestamp: bigint }> {
124
+ ): Promise<CheckpointGlobalVariables> {
124
125
  const { chainId, version } = this;
125
126
 
126
127
  const timestamp = getTimestampForSlot(slotNumber, {
package/src/index.ts CHANGED
@@ -1,12 +1,7 @@
1
1
  export * from './client/index.js';
2
2
  export * from './config.js';
3
3
  export * from './publisher/index.js';
4
- export {
5
- FullNodeBlockBuilder as BlockBuilder,
6
- Sequencer,
7
- SequencerState,
8
- type SequencerEvents,
9
- } from './sequencer/index.js';
4
+ export { Sequencer, SequencerState, type SequencerEvents } from './sequencer/index.js';
10
5
 
11
6
  // Used by the node to simulate public parts of transactions. Should these be moved to a shared library?
12
7
  // ISSUE(#9832)
@@ -1,32 +1,45 @@
1
1
  import { type BlobClientConfig, blobClientConfigMapping } from '@aztec/blob-client/client/config';
2
2
  import { type L1ReaderConfig, l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
3
3
  import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from '@aztec/ethereum/l1-tx-utils/config';
4
- import {
5
- type ConfigMappingsType,
6
- SecretValue,
7
- booleanConfigHelper,
8
- getConfigFromMappings,
9
- } from '@aztec/foundation/config';
4
+ import { type ConfigMappingsType, SecretValue, booleanConfigHelper } from '@aztec/foundation/config';
10
5
  import { EthAddress } from '@aztec/foundation/eth-address';
11
6
 
12
- /**
13
- * The configuration of the rollup transaction publisher.
14
- */
7
+ /** Configuration of the transaction publisher. */
15
8
  export type TxSenderConfig = L1ReaderConfig & {
16
- /**
17
- * The private key to be used by the publisher.
18
- */
9
+ /** The private key to be used by the publisher. */
19
10
  publisherPrivateKeys?: SecretValue<`0x${string}`>[];
20
11
 
21
- /**
22
- * Publisher addresses to be used with a remote signer
23
- */
12
+ /** Publisher addresses to be used with a remote signer */
24
13
  publisherAddresses?: EthAddress[];
25
14
  };
26
15
 
27
- /**
28
- * Configuration of the L1Publisher.
29
- */
16
+ export type ProverTxSenderConfig = L1ReaderConfig & {
17
+ proverPublisherPrivateKeys?: SecretValue<`0x${string}`>[];
18
+ proverPublisherAddresses?: EthAddress[];
19
+ };
20
+
21
+ export type SequencerTxSenderConfig = L1ReaderConfig & {
22
+ sequencerPublisherPrivateKeys?: SecretValue<`0x${string}`>[];
23
+ sequencerPublisherAddresses?: EthAddress[];
24
+ };
25
+
26
+ export function getTxSenderConfigFromProverConfig(config: ProverTxSenderConfig): TxSenderConfig {
27
+ return {
28
+ ...config,
29
+ publisherPrivateKeys: config.proverPublisherPrivateKeys,
30
+ publisherAddresses: config.proverPublisherAddresses,
31
+ };
32
+ }
33
+
34
+ export function getTxSenderConfigFromSequencerConfig(config: SequencerTxSenderConfig): TxSenderConfig {
35
+ return {
36
+ ...config,
37
+ publisherPrivateKeys: config.sequencerPublisherPrivateKeys,
38
+ publisherAddresses: config.sequencerPublisherAddresses,
39
+ };
40
+ }
41
+
42
+ /** Configuration of the L1Publisher. */
30
43
  export type PublisherConfig = L1TxUtilsConfig &
31
44
  BlobClientConfig & {
32
45
  /** True to use publishers in invalid states (timed out, cancelled, etc) if no other is available */
@@ -35,37 +48,83 @@ export type PublisherConfig = L1TxUtilsConfig &
35
48
  fishermanMode?: boolean;
36
49
  /** Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only) */
37
50
  publisherForwarderAddress?: EthAddress;
51
+ /** Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path */
52
+ l1TxFailedStore?: string;
53
+ };
54
+
55
+ export type ProverPublisherConfig = L1TxUtilsConfig &
56
+ BlobClientConfig & {
57
+ fishermanMode?: boolean;
58
+ proverPublisherAllowInvalidStates?: boolean;
59
+ proverPublisherForwarderAddress?: EthAddress;
38
60
  };
39
61
 
40
- export const getTxSenderConfigMappings: (
41
- scope: 'PROVER' | 'SEQ',
42
- ) => ConfigMappingsType<Omit<TxSenderConfig, 'l1Contracts'>> = (scope: 'PROVER' | 'SEQ') => ({
62
+ export type SequencerPublisherConfig = L1TxUtilsConfig &
63
+ BlobClientConfig & {
64
+ fishermanMode?: boolean;
65
+ sequencerPublisherAllowInvalidStates?: boolean;
66
+ sequencerPublisherForwarderAddress?: EthAddress;
67
+ /** Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path */
68
+ l1TxFailedStore?: string;
69
+ };
70
+
71
+ export function getPublisherConfigFromProverConfig(config: ProverPublisherConfig): PublisherConfig {
72
+ return {
73
+ ...config,
74
+ publisherAllowInvalidStates: config.proverPublisherAllowInvalidStates,
75
+ publisherForwarderAddress: config.proverPublisherForwarderAddress,
76
+ };
77
+ }
78
+
79
+ export function getPublisherConfigFromSequencerConfig(config: SequencerPublisherConfig): PublisherConfig {
80
+ return {
81
+ ...config,
82
+ publisherAllowInvalidStates: config.sequencerPublisherAllowInvalidStates,
83
+ publisherForwarderAddress: config.sequencerPublisherForwarderAddress,
84
+ l1TxFailedStore: config.l1TxFailedStore,
85
+ };
86
+ }
87
+
88
+ export const proverTxSenderConfigMappings: ConfigMappingsType<Omit<ProverTxSenderConfig, 'l1Contracts'>> = {
43
89
  ...l1ReaderConfigMappings,
44
- publisherPrivateKeys: {
45
- env: scope === 'PROVER' ? `PROVER_PUBLISHER_PRIVATE_KEYS` : `SEQ_PUBLISHER_PRIVATE_KEYS`,
46
- description: 'The private keys to be used by the publisher.',
90
+ proverPublisherPrivateKeys: {
91
+ env: `PROVER_PUBLISHER_PRIVATE_KEYS`,
92
+ description: 'The private keys to be used by the prover publisher.',
47
93
  parseEnv: (val: string) => val.split(',').map(key => new SecretValue(`0x${key.replace('0x', '')}`)),
48
94
  defaultValue: [],
49
- fallback: [scope === 'PROVER' ? `PROVER_PUBLISHER_PRIVATE_KEY` : `SEQ_PUBLISHER_PRIVATE_KEY`],
95
+ fallback: [`PROVER_PUBLISHER_PRIVATE_KEY`],
50
96
  },
51
- publisherAddresses: {
52
- env: scope === 'PROVER' ? `PROVER_PUBLISHER_ADDRESSES` : `SEQ_PUBLISHER_ADDRESSES`,
97
+ proverPublisherAddresses: {
98
+ env: `PROVER_PUBLISHER_ADDRESSES`,
53
99
  description: 'The addresses of the publishers to use with remote signers',
54
100
  parseEnv: (val: string) => val.split(',').map(address => EthAddress.fromString(address)),
55
101
  defaultValue: [],
56
102
  },
57
- });
103
+ };
58
104
 
59
- export function getTxSenderConfigFromEnv(scope: 'PROVER' | 'SEQ'): Omit<TxSenderConfig, 'l1Contracts'> {
60
- return getConfigFromMappings(getTxSenderConfigMappings(scope));
61
- }
105
+ export const sequencerTxSenderConfigMappings: ConfigMappingsType<Omit<SequencerTxSenderConfig, 'l1Contracts'>> = {
106
+ ...l1ReaderConfigMappings,
107
+ sequencerPublisherPrivateKeys: {
108
+ env: `SEQ_PUBLISHER_PRIVATE_KEYS`,
109
+ description: 'The private keys to be used by the sequencer publisher.',
110
+ parseEnv: (val: string) => val.split(',').map(key => new SecretValue(`0x${key.replace('0x', '')}`)),
111
+ defaultValue: [],
112
+ fallback: [`SEQ_PUBLISHER_PRIVATE_KEY`],
113
+ },
114
+ sequencerPublisherAddresses: {
115
+ env: `SEQ_PUBLISHER_ADDRESSES`,
116
+ description: 'The addresses of the publishers to use with remote signers',
117
+ parseEnv: (val: string) => val.split(',').map(address => EthAddress.fromString(address)),
118
+ defaultValue: [],
119
+ },
120
+ };
62
121
 
63
- export const getPublisherConfigMappings: (
64
- scope: 'PROVER' | 'SEQ',
65
- ) => ConfigMappingsType<PublisherConfig & L1TxUtilsConfig> = scope => ({
66
- publisherAllowInvalidStates: {
122
+ export const sequencerPublisherConfigMappings: ConfigMappingsType<SequencerPublisherConfig & L1TxUtilsConfig> = {
123
+ ...l1TxUtilsConfigMappings,
124
+ ...blobClientConfigMapping,
125
+ sequencerPublisherAllowInvalidStates: {
126
+ env: `SEQ_PUBLISHER_ALLOW_INVALID_STATES`,
67
127
  description: 'True to use publishers in invalid states (timed out, cancelled, etc) if no other is available',
68
- env: scope === `PROVER` ? `PROVER_PUBLISHER_ALLOW_INVALID_STATES` : `SEQ_PUBLISHER_ALLOW_INVALID_STATES`,
69
128
  ...booleanConfigHelper(true),
70
129
  },
71
130
  fishermanMode: {
@@ -74,15 +133,34 @@ export const getPublisherConfigMappings: (
74
133
  'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
75
134
  ...booleanConfigHelper(false),
76
135
  },
77
- publisherForwarderAddress: {
78
- env: scope === `PROVER` ? `PROVER_PUBLISHER_FORWARDER_ADDRESS` : `SEQ_PUBLISHER_FORWARDER_ADDRESS`,
136
+ sequencerPublisherForwarderAddress: {
137
+ env: `SEQ_PUBLISHER_FORWARDER_ADDRESS`,
79
138
  description: 'Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only)',
80
139
  parseEnv: (val: string) => (val ? EthAddress.fromString(val) : undefined),
81
140
  },
141
+ l1TxFailedStore: {
142
+ env: 'L1_TX_FAILED_STORE',
143
+ description: 'Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path',
144
+ },
145
+ };
146
+
147
+ export const proverPublisherConfigMappings: ConfigMappingsType<ProverPublisherConfig & L1TxUtilsConfig> = {
82
148
  ...l1TxUtilsConfigMappings,
83
149
  ...blobClientConfigMapping,
84
- });
85
-
86
- export function getPublisherConfigFromEnv(scope: 'PROVER' | 'SEQ'): PublisherConfig {
87
- return getConfigFromMappings(getPublisherConfigMappings(scope));
88
- }
150
+ proverPublisherAllowInvalidStates: {
151
+ env: `PROVER_PUBLISHER_ALLOW_INVALID_STATES`,
152
+ description: 'True to use publishers in invalid states (timed out, cancelled, etc) if no other is available',
153
+ ...booleanConfigHelper(true),
154
+ },
155
+ fishermanMode: {
156
+ env: 'FISHERMAN_MODE',
157
+ description:
158
+ 'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
159
+ ...booleanConfigHelper(false),
160
+ },
161
+ proverPublisherForwarderAddress: {
162
+ env: `PROVER_PUBLISHER_FORWARDER_ADDRESS`,
163
+ description: 'Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only)',
164
+ parseEnv: (val: string) => (val ? EthAddress.fromString(val) : undefined),
165
+ },
166
+ };
@@ -3,3 +3,6 @@ export { SequencerPublisherFactory } from './sequencer-publisher-factory.js';
3
3
 
4
4
  // Used for tests
5
5
  export { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
6
+
7
+ // Failed L1 tx store (optional, for test networks)
8
+ export { type FailedL1Tx, type FailedL1TxUri, type L1TxFailedStore } from './l1_tx_failed_store/index.js';