@aztec/sequencer-client 0.0.1-commit.135b523 → 0.0.1-commit.181e2d196

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 (70) 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 +15 -4
  4. package/dest/config.d.ts +3 -4
  5. package/dest/config.d.ts.map +1 -1
  6. package/dest/config.js +29 -19
  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/publisher/config.d.ts +35 -17
  10. package/dest/publisher/config.d.ts.map +1 -1
  11. package/dest/publisher/config.js +106 -42
  12. package/dest/publisher/index.d.ts +2 -1
  13. package/dest/publisher/index.d.ts.map +1 -1
  14. package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
  15. package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
  16. package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
  17. package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +59 -0
  18. package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
  19. package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +1 -0
  20. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
  21. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
  22. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +34 -0
  23. package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
  24. package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
  25. package/dest/publisher/l1_tx_failed_store/index.js +2 -0
  26. package/dest/publisher/sequencer-publisher-factory.d.ts +11 -3
  27. package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
  28. package/dest/publisher/sequencer-publisher-factory.js +27 -2
  29. package/dest/publisher/sequencer-publisher.d.ts +26 -7
  30. package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
  31. package/dest/publisher/sequencer-publisher.js +299 -30
  32. package/dest/sequencer/checkpoint_proposal_job.d.ts +7 -1
  33. package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
  34. package/dest/sequencer/checkpoint_proposal_job.js +99 -53
  35. package/dest/sequencer/metrics.d.ts +17 -5
  36. package/dest/sequencer/metrics.d.ts.map +1 -1
  37. package/dest/sequencer/metrics.js +86 -15
  38. package/dest/sequencer/sequencer.d.ts +20 -8
  39. package/dest/sequencer/sequencer.d.ts.map +1 -1
  40. package/dest/sequencer/sequencer.js +30 -27
  41. package/dest/sequencer/timetable.d.ts +1 -4
  42. package/dest/sequencer/timetable.d.ts.map +1 -1
  43. package/dest/sequencer/timetable.js +2 -5
  44. package/dest/test/index.d.ts +3 -5
  45. package/dest/test/index.d.ts.map +1 -1
  46. package/dest/test/mock_checkpoint_builder.d.ts +5 -3
  47. package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
  48. package/dest/test/mock_checkpoint_builder.js +6 -4
  49. package/dest/test/utils.d.ts +3 -3
  50. package/dest/test/utils.d.ts.map +1 -1
  51. package/dest/test/utils.js +5 -4
  52. package/package.json +28 -28
  53. package/src/client/sequencer-client.ts +25 -7
  54. package/src/config.ts +40 -27
  55. package/src/global_variable_builder/global_builder.ts +1 -1
  56. package/src/publisher/config.ts +121 -43
  57. package/src/publisher/index.ts +3 -0
  58. package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
  59. package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +55 -0
  60. package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +46 -0
  61. package/src/publisher/l1_tx_failed_store/index.ts +3 -0
  62. package/src/publisher/sequencer-publisher-factory.ts +38 -6
  63. package/src/publisher/sequencer-publisher.ts +300 -43
  64. package/src/sequencer/checkpoint_proposal_job.ts +135 -48
  65. package/src/sequencer/metrics.ts +92 -18
  66. package/src/sequencer/sequencer.ts +40 -32
  67. package/src/sequencer/timetable.ts +7 -6
  68. package/src/test/index.ts +2 -4
  69. package/src/test/mock_checkpoint_builder.ts +12 -1
  70. package/src/test/utils.ts +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/sequencer-client",
3
- "version": "0.0.1-commit.135b523",
3
+ "version": "0.0.1-commit.181e2d196",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -26,38 +26,38 @@
26
26
  "test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
27
27
  },
28
28
  "dependencies": {
29
- "@aztec/aztec.js": "0.0.1-commit.135b523",
30
- "@aztec/bb-prover": "0.0.1-commit.135b523",
31
- "@aztec/blob-client": "0.0.1-commit.135b523",
32
- "@aztec/blob-lib": "0.0.1-commit.135b523",
33
- "@aztec/constants": "0.0.1-commit.135b523",
34
- "@aztec/epoch-cache": "0.0.1-commit.135b523",
35
- "@aztec/ethereum": "0.0.1-commit.135b523",
36
- "@aztec/foundation": "0.0.1-commit.135b523",
37
- "@aztec/l1-artifacts": "0.0.1-commit.135b523",
38
- "@aztec/merkle-tree": "0.0.1-commit.135b523",
39
- "@aztec/node-keystore": "0.0.1-commit.135b523",
40
- "@aztec/noir-acvm_js": "0.0.1-commit.135b523",
41
- "@aztec/noir-contracts.js": "0.0.1-commit.135b523",
42
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.135b523",
43
- "@aztec/noir-types": "0.0.1-commit.135b523",
44
- "@aztec/p2p": "0.0.1-commit.135b523",
45
- "@aztec/protocol-contracts": "0.0.1-commit.135b523",
46
- "@aztec/prover-client": "0.0.1-commit.135b523",
47
- "@aztec/simulator": "0.0.1-commit.135b523",
48
- "@aztec/slasher": "0.0.1-commit.135b523",
49
- "@aztec/stdlib": "0.0.1-commit.135b523",
50
- "@aztec/telemetry-client": "0.0.1-commit.135b523",
51
- "@aztec/validator-client": "0.0.1-commit.135b523",
52
- "@aztec/validator-ha-signer": "0.0.1-commit.135b523",
53
- "@aztec/world-state": "0.0.1-commit.135b523",
29
+ "@aztec/aztec.js": "0.0.1-commit.181e2d196",
30
+ "@aztec/bb-prover": "0.0.1-commit.181e2d196",
31
+ "@aztec/blob-client": "0.0.1-commit.181e2d196",
32
+ "@aztec/blob-lib": "0.0.1-commit.181e2d196",
33
+ "@aztec/constants": "0.0.1-commit.181e2d196",
34
+ "@aztec/epoch-cache": "0.0.1-commit.181e2d196",
35
+ "@aztec/ethereum": "0.0.1-commit.181e2d196",
36
+ "@aztec/foundation": "0.0.1-commit.181e2d196",
37
+ "@aztec/l1-artifacts": "0.0.1-commit.181e2d196",
38
+ "@aztec/merkle-tree": "0.0.1-commit.181e2d196",
39
+ "@aztec/node-keystore": "0.0.1-commit.181e2d196",
40
+ "@aztec/noir-acvm_js": "0.0.1-commit.181e2d196",
41
+ "@aztec/noir-contracts.js": "0.0.1-commit.181e2d196",
42
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.181e2d196",
43
+ "@aztec/noir-types": "0.0.1-commit.181e2d196",
44
+ "@aztec/p2p": "0.0.1-commit.181e2d196",
45
+ "@aztec/protocol-contracts": "0.0.1-commit.181e2d196",
46
+ "@aztec/prover-client": "0.0.1-commit.181e2d196",
47
+ "@aztec/simulator": "0.0.1-commit.181e2d196",
48
+ "@aztec/slasher": "0.0.1-commit.181e2d196",
49
+ "@aztec/stdlib": "0.0.1-commit.181e2d196",
50
+ "@aztec/telemetry-client": "0.0.1-commit.181e2d196",
51
+ "@aztec/validator-client": "0.0.1-commit.181e2d196",
52
+ "@aztec/validator-ha-signer": "0.0.1-commit.181e2d196",
53
+ "@aztec/world-state": "0.0.1-commit.181e2d196",
54
54
  "lodash.chunk": "^4.2.0",
55
55
  "tslib": "^2.4.0",
56
56
  "viem": "npm:@aztec/viem@2.38.2"
57
57
  },
58
58
  "devDependencies": {
59
- "@aztec/archiver": "0.0.1-commit.135b523",
60
- "@aztec/kv-store": "0.0.1-commit.135b523",
59
+ "@aztec/archiver": "0.0.1-commit.181e2d196",
60
+ "@aztec/kv-store": "0.0.1-commit.181e2d196",
61
61
  "@electric-sql/pglite": "^0.3.14",
62
62
  "@jest/globals": "^30.0.0",
63
63
  "@types/jest": "^30.0.0",
@@ -3,7 +3,7 @@ import { EpochCache } from '@aztec/epoch-cache';
3
3
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
4
4
  import { getPublicClient } from '@aztec/ethereum/client';
5
5
  import { GovernanceProposerContract, RollupContract } from '@aztec/ethereum/contracts';
6
- import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
6
+ import { type Delayer, L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
7
7
  import { PublisherManager } from '@aztec/ethereum/publisher-manager';
8
8
  import { EthAddress } from '@aztec/foundation/eth-address';
9
9
  import { createLogger } from '@aztec/foundation/log';
@@ -18,7 +18,7 @@ import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
18
18
  import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
19
19
  import { FullNodeCheckpointsBuilder, NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
20
20
 
21
- import type { SequencerClientConfig } from '../config.js';
21
+ import { type SequencerClientConfig, getPublisherConfigFromSequencerConfig } from '../config.js';
22
22
  import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
23
23
  import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
24
24
  import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
@@ -28,11 +28,12 @@ import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
28
28
  */
29
29
  export class SequencerClient {
30
30
  constructor(
31
- protected publisherManager: PublisherManager<L1TxUtilsWithBlobs>,
31
+ protected publisherManager: PublisherManager<L1TxUtils>,
32
32
  protected sequencer: Sequencer,
33
33
  protected checkpointsBuilder: FullNodeCheckpointsBuilder,
34
34
  protected validatorClient?: ValidatorClient,
35
35
  private l1Metrics?: L1Metrics,
36
+ private delayer_?: Delayer,
36
37
  ) {}
37
38
 
38
39
  /**
@@ -62,7 +63,7 @@ export class SequencerClient {
62
63
  blobClient: BlobClientInterface;
63
64
  dateProvider: DateProvider;
64
65
  epochCache?: EpochCache;
65
- l1TxUtils: L1TxUtilsWithBlobs[];
66
+ l1TxUtils: L1TxUtils[];
66
67
  nodeKeyStore: KeystoreManager;
67
68
  },
68
69
  ) {
@@ -85,7 +86,11 @@ export class SequencerClient {
85
86
  publicClient,
86
87
  l1TxUtils.map(x => x.getSenderAddress()),
87
88
  );
88
- const publisherManager = new PublisherManager(l1TxUtils, config, log.getBindings());
89
+ const publisherManager = new PublisherManager(
90
+ l1TxUtils,
91
+ getPublisherConfigFromSequencerConfig(config),
92
+ log.getBindings(),
93
+ );
89
94
  const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
90
95
  const [l1GenesisTime, slotDuration, rollupVersion, rollupManaLimit] = await Promise.all([
91
96
  rollupContract.getL1GenesisTime(),
@@ -171,9 +176,12 @@ export class SequencerClient {
171
176
  log,
172
177
  );
173
178
 
174
- await sequencer.init();
179
+ sequencer.init();
180
+
181
+ // Extract the shared delayer from the first L1TxUtils instance (all instances share the same delayer)
182
+ const delayer = l1TxUtils[0]?.delayer;
175
183
 
176
- return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics);
184
+ return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics, delayer);
177
185
  }
178
186
 
179
187
  /**
@@ -208,6 +216,16 @@ export class SequencerClient {
208
216
  return this.sequencer;
209
217
  }
210
218
 
219
+ /** Updates the publisher factory's node keystore adapter after a keystore reload. */
220
+ public updatePublisherNodeKeyStore(adapter: NodeKeystoreAdapter): void {
221
+ this.sequencer.updatePublisherNodeKeyStore(adapter);
222
+ }
223
+
224
+ /** Returns the shared tx delayer for sequencer L1 txs, if enabled. Test-only. */
225
+ getDelayer(): Delayer | undefined {
226
+ return this.delayer_;
227
+ }
228
+
211
229
  get validatorAddresses(): EthAddress[] | undefined {
212
230
  return this.sequencer.getValidatorAddresses();
213
231
  }
package/src/config.ts CHANGED
@@ -11,29 +11,34 @@ 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
+ DEFAULT_MAX_TXS_PER_BLOCK,
17
+ type SequencerConfig,
18
+ chainConfigMappings,
19
+ sharedSequencerConfigMappings,
20
+ } from '@aztec/stdlib/config';
15
21
  import type { ResolvedSequencerConfig } from '@aztec/stdlib/interfaces/server';
22
+ import { DEFAULT_P2P_PROPAGATION_TIME } from '@aztec/stdlib/timetable';
16
23
  import { type ValidatorClientConfig, validatorClientConfigMappings } from '@aztec/validator-client/config';
17
24
 
18
25
  import {
19
- type PublisherConfig,
20
- type TxSenderConfig,
21
- getPublisherConfigMappings,
22
- getTxSenderConfigMappings,
26
+ type SequencerPublisherConfig,
27
+ type SequencerTxSenderConfig,
28
+ sequencerPublisherConfigMappings,
29
+ sequencerTxSenderConfigMappings,
23
30
  } from './publisher/config.js';
24
31
 
25
32
  export * from './publisher/config.js';
26
33
  export type { SequencerConfig };
27
34
 
28
- export const DEFAULT_ATTESTATION_PROPAGATION_TIME = 2;
29
-
30
35
  /**
31
36
  * Default values for SequencerConfig.
32
37
  * Centralized location for all sequencer configuration defaults.
33
38
  */
34
39
  export const DefaultSequencerConfig: ResolvedSequencerConfig = {
35
40
  sequencerPollingIntervalMS: 500,
36
- maxTxsPerBlock: 32,
41
+ maxTxsPerBlock: DEFAULT_MAX_TXS_PER_BLOCK,
37
42
  minTxsPerBlock: 1,
38
43
  buildCheckpointIfEmpty: false,
39
44
  publishTxsWithProposals: false,
@@ -41,29 +46,32 @@ export const DefaultSequencerConfig: ResolvedSequencerConfig = {
41
46
  maxDABlockGas: 10e9,
42
47
  maxBlockSizeInBytes: 1024 * 1024,
43
48
  enforceTimeTable: true,
44
- attestationPropagationTime: DEFAULT_ATTESTATION_PROPAGATION_TIME,
49
+ attestationPropagationTime: DEFAULT_P2P_PROPAGATION_TIME,
45
50
  secondsBeforeInvalidatingBlockAsCommitteeMember: 144, // 12 L1 blocks
46
51
  secondsBeforeInvalidatingBlockAsNonCommitteeMember: 432, // 36 L1 blocks
47
52
  skipCollectingAttestations: false,
48
53
  skipInvalidateBlockAsProposer: false,
49
54
  broadcastInvalidBlockProposal: false,
50
55
  injectFakeAttestation: false,
56
+ injectHighSValueAttestation: false,
57
+ injectUnrecoverableSignatureAttestation: false,
51
58
  fishermanMode: false,
52
59
  shuffleAttestationOrdering: false,
53
60
  skipPushProposedBlocksToArchiver: false,
61
+ skipPublishingCheckpointsPercent: 0,
54
62
  };
55
63
 
56
64
  /**
57
65
  * Configuration settings for the SequencerClient.
58
66
  */
59
- export type SequencerClientConfig = PublisherConfig &
67
+ export type SequencerClientConfig = SequencerPublisherConfig &
60
68
  KeyStoreConfig &
61
69
  ValidatorClientConfig &
62
- TxSenderConfig &
70
+ SequencerTxSenderConfig &
63
71
  SequencerConfig &
64
72
  L1ReaderConfig &
65
73
  ChainConfig &
66
- Pick<P2PConfig, 'txPublicSetupAllowList'> &
74
+ Pick<P2PConfig, 'txPublicSetupAllowListExtend'> &
67
75
  Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
68
76
 
69
77
  export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
@@ -72,11 +80,6 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
72
80
  description: 'The number of ms to wait between polling for checking to build on the next slot.',
73
81
  ...numberConfigHelper(DefaultSequencerConfig.sequencerPollingIntervalMS),
74
82
  },
75
- maxTxsPerBlock: {
76
- env: 'SEQ_MAX_TX_PER_BLOCK',
77
- description: 'The maximum number of txs to include in a block.',
78
- ...numberConfigHelper(DefaultSequencerConfig.maxTxsPerBlock),
79
- },
80
83
  minTxsPerBlock: {
81
84
  env: 'SEQ_MIN_TX_PER_BLOCK',
82
85
  description: 'The minimum number of txs to include in a block.',
@@ -181,6 +184,14 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
181
184
  description: 'Inject a fake attestation (for testing only)',
182
185
  ...booleanConfigHelper(DefaultSequencerConfig.injectFakeAttestation),
183
186
  },
187
+ injectHighSValueAttestation: {
188
+ description: 'Inject a malleable attestation with a high-s value (for testing only)',
189
+ ...booleanConfigHelper(DefaultSequencerConfig.injectHighSValueAttestation),
190
+ },
191
+ injectUnrecoverableSignatureAttestation: {
192
+ description: 'Inject an attestation with an unrecoverable signature (for testing only)',
193
+ ...booleanConfigHelper(DefaultSequencerConfig.injectUnrecoverableSignatureAttestation),
194
+ },
184
195
  fishermanMode: {
185
196
  env: 'FISHERMAN_MODE',
186
197
  description:
@@ -191,13 +202,7 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
191
202
  description: 'Shuffle attestation ordering to create invalid ordering (for testing only)',
192
203
  ...booleanConfigHelper(DefaultSequencerConfig.shuffleAttestationOrdering),
193
204
  },
194
- blockDurationMs: {
195
- env: 'SEQ_BLOCK_DURATION_MS',
196
- description:
197
- 'Duration per block in milliseconds when building multiple blocks per slot. ' +
198
- 'If undefined (default), builds a single block per slot using the full slot duration.',
199
- parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
200
- },
205
+ ...sharedSequencerConfigMappings,
201
206
  buildCheckpointIfEmpty: {
202
207
  env: 'SEQ_BUILD_CHECKPOINT_IF_EMPTY',
203
208
  description: 'Have sequencer build and publish an empty checkpoint if there are no txs',
@@ -207,7 +212,15 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
207
212
  description: 'Skip pushing proposed blocks to archiver (default: true)',
208
213
  ...booleanConfigHelper(DefaultSequencerConfig.skipPushProposedBlocksToArchiver),
209
214
  },
210
- ...pickConfigMappings(p2pConfigMappings, ['txPublicSetupAllowList']),
215
+ minBlocksForCheckpoint: {
216
+ description: 'Minimum number of blocks required for a checkpoint proposal (test only)',
217
+ },
218
+ skipPublishingCheckpointsPercent: {
219
+ env: 'SEQ_SKIP_CHECKPOINT_PUBLISH_PERCENT',
220
+ description: 'Percent probability (0 - 100) of sequencer skipping checkpoint publishing (testing only)',
221
+ ...numberConfigHelper(DefaultSequencerConfig.skipPublishingCheckpointsPercent),
222
+ },
223
+ ...pickConfigMappings(p2pConfigMappings, ['txPublicSetupAllowListExtend']),
211
224
  };
212
225
 
213
226
  export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig> = {
@@ -215,8 +228,8 @@ export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientCo
215
228
  ...sequencerConfigMappings,
216
229
  ...keyStoreConfigMappings,
217
230
  ...l1ReaderConfigMappings,
218
- ...getTxSenderConfigMappings('SEQ'),
219
- ...getPublisherConfigMappings('SEQ'),
231
+ ...sequencerTxSenderConfigMappings,
232
+ ...sequencerPublisherConfigMappings,
220
233
  ...chainConfigMappings,
221
234
  ...pickConfigMappings(l1ContractsConfigMappings, ['ethereumSlotDuration', 'aztecSlotDuration', 'aztecEpochDuration']),
222
235
  };
@@ -120,7 +120,7 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
120
120
  coinbase: EthAddress,
121
121
  feeRecipient: AztecAddress,
122
122
  slotNumber: SlotNumber,
123
- ): Promise<CheckpointGlobalVariables & { timestamp: bigint }> {
123
+ ): Promise<CheckpointGlobalVariables> {
124
124
  const { chainId, version } = this;
125
125
 
126
126
  const timestamp = getTimestampForSlot(slotNumber, {
@@ -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';
@@ -0,0 +1,32 @@
1
+ import { type Logger, createLogger } from '@aztec/foundation/log';
2
+ import { createFileStore } from '@aztec/stdlib/file-store';
3
+
4
+ import type { L1TxFailedStore } from './failed_tx_store.js';
5
+ import { FileStoreL1TxFailedStore } from './file_store_failed_tx_store.js';
6
+
7
+ /**
8
+ * Creates an L1TxFailedStore from a config string.
9
+ * Supports any backend that FileStore supports (GCS, S3, R2, local filesystem).
10
+ * @param config - Config string (e.g., 'gs://bucket/path', 's3://bucket/path', 'file:///path'). If undefined, returns undefined.
11
+ * @param logger - Optional logger.
12
+ * @returns The store instance, or undefined if config is not provided.
13
+ */
14
+ export async function createL1TxFailedStore(
15
+ config: string | undefined,
16
+ logger: Logger = createLogger('sequencer:l1-tx-failed-store'),
17
+ ): Promise<L1TxFailedStore | undefined> {
18
+ if (!config) {
19
+ return undefined;
20
+ }
21
+
22
+ const fileStore = await createFileStore(config, logger);
23
+ if (!fileStore) {
24
+ throw new Error(
25
+ `Failed to create file store from config: '${config}'. ` +
26
+ `Supported formats: 'gs://bucket/path', 's3://bucket/path', 'file:///path'.`,
27
+ );
28
+ }
29
+
30
+ logger.info(`Created L1 tx failed store`, { config });
31
+ return new FileStoreL1TxFailedStore(fileStore, logger);
32
+ }
@@ -0,0 +1,55 @@
1
+ import type { Hex } from 'viem';
2
+
3
+ /** URI pointing to a stored failed L1 transaction. */
4
+ export type FailedL1TxUri = string & { __brand: 'FailedL1TxUri' };
5
+
6
+ /** A failed L1 transaction captured for debugging and replay. */
7
+ export type FailedL1Tx = {
8
+ /** Tx hash (for reverts) or keccak256(request.data) (for simulation/send failures). */
9
+ id: Hex;
10
+ /** Unix timestamp (ms) when failure occurred. */
11
+ timestamp: number;
12
+ /** Whether the failure was during simulation or after sending. */
13
+ failureType: 'simulation' | 'revert' | 'send-error';
14
+ /** The actual L1 transaction for replay (multicall-encoded for bundled txs). */
15
+ request: {
16
+ to: Hex;
17
+ data: Hex;
18
+ value?: string; // bigint as string
19
+ };
20
+ /** Raw blob data as hex for replay. */
21
+ blobData?: Hex[];
22
+ /** L1 block number at time of failure (simulation target or receipt block). */
23
+ l1BlockNumber: string; // bigint as string
24
+ /** Receipt info (present only for on-chain reverts). */
25
+ receipt?: {
26
+ transactionHash: Hex;
27
+ blockNumber: string; // bigint as string
28
+ gasUsed: string; // bigint as string
29
+ status: 'reverted';
30
+ };
31
+ /** Error information. */
32
+ error: {
33
+ message: string;
34
+ /** Decoded error name (e.g., 'Rollup__InvalidProposer'). */
35
+ name?: string;
36
+ };
37
+ /** Context metadata. */
38
+ context: {
39
+ /** Actions involved (e.g., ['propose', 'governance-signal']). */
40
+ actions: string[];
41
+ /** Individual request data for each action (metadata, not used for replay). */
42
+ requests?: Array<{ action: string; to: Hex; data: Hex }>;
43
+ checkpointNumber?: number;
44
+ slot?: number;
45
+ sender: Hex;
46
+ };
47
+ };
48
+
49
+ /** Store for failed L1 transactions for debugging purposes. */
50
+ export interface L1TxFailedStore {
51
+ /** Saves a failed transaction and returns its URI. */
52
+ saveFailedTx(tx: FailedL1Tx): Promise<FailedL1TxUri>;
53
+ /** Retrieves a failed transaction by its URI. */
54
+ getFailedTx(uri: FailedL1TxUri): Promise<FailedL1Tx>;
55
+ }