@aztec/sequencer-client 0.0.1-commit.7cf39cb55 → 0.0.1-commit.808bf7f90

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 (47) 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 -3
  5. package/dest/config.d.ts.map +1 -1
  6. package/dest/config.js +13 -4
  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 +31 -17
  10. package/dest/publisher/config.d.ts.map +1 -1
  11. package/dest/publisher/config.js +101 -42
  12. package/dest/publisher/sequencer-publisher-factory.d.ts +11 -3
  13. package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
  14. package/dest/publisher/sequencer-publisher-factory.js +13 -2
  15. package/dest/publisher/sequencer-publisher.d.ts +16 -7
  16. package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
  17. package/dest/publisher/sequencer-publisher.js +41 -21
  18. package/dest/sequencer/checkpoint_proposal_job.d.ts +1 -1
  19. package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
  20. package/dest/sequencer/checkpoint_proposal_job.js +38 -10
  21. package/dest/sequencer/metrics.d.ts +14 -5
  22. package/dest/sequencer/metrics.d.ts.map +1 -1
  23. package/dest/sequencer/metrics.js +61 -15
  24. package/dest/sequencer/sequencer.d.ts +15 -7
  25. package/dest/sequencer/sequencer.d.ts.map +1 -1
  26. package/dest/sequencer/sequencer.js +23 -25
  27. package/dest/test/index.d.ts +3 -5
  28. package/dest/test/index.d.ts.map +1 -1
  29. package/dest/test/mock_checkpoint_builder.d.ts +5 -3
  30. package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
  31. package/dest/test/mock_checkpoint_builder.js +6 -4
  32. package/dest/test/utils.d.ts +3 -3
  33. package/dest/test/utils.d.ts.map +1 -1
  34. package/dest/test/utils.js +4 -4
  35. package/package.json +28 -28
  36. package/src/client/sequencer-client.ts +25 -7
  37. package/src/config.ts +17 -8
  38. package/src/global_variable_builder/global_builder.ts +1 -1
  39. package/src/publisher/config.ts +112 -43
  40. package/src/publisher/sequencer-publisher-factory.ts +23 -6
  41. package/src/publisher/sequencer-publisher.ts +63 -28
  42. package/src/sequencer/checkpoint_proposal_job.ts +58 -9
  43. package/src/sequencer/metrics.ts +68 -18
  44. package/src/sequencer/sequencer.ts +31 -30
  45. package/src/test/index.ts +2 -4
  46. package/src/test/mock_checkpoint_builder.ts +12 -1
  47. package/src/test/utils.ts +4 -2
@@ -68,10 +68,10 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
68
68
  }
69
69
  /**
70
70
  * Creates a checkpoint proposal from a block and signature
71
- */ export function createCheckpointProposal(block, checkpointSignature, blockSignature) {
71
+ */ export function createCheckpointProposal(block, checkpointSignature, blockSignature, feeAssetPriceModifier = 0n) {
72
72
  const txHashes = block.body.txEffects.map((tx)=>tx.txHash);
73
73
  const checkpointHeader = createCheckpointHeaderFromBlock(block);
74
- return new CheckpointProposal(checkpointHeader, block.archive.root, checkpointSignature, {
74
+ return new CheckpointProposal(checkpointHeader, block.archive.root, feeAssetPriceModifier, checkpointSignature, {
75
75
  blockHeader: block.header,
76
76
  indexWithinCheckpoint: block.indexWithinCheckpoint,
77
77
  txHashes,
@@ -82,9 +82,9 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
82
82
  * Creates a checkpoint attestation from a block and signature.
83
83
  * Note: We manually set the sender since we use random signatures in tests.
84
84
  * In production, the sender is recovered from the signature.
85
- */ export function createCheckpointAttestation(block, signature, sender) {
85
+ */ export function createCheckpointAttestation(block, signature, sender, feeAssetPriceModifier = 0n) {
86
86
  const checkpointHeader = createCheckpointHeaderFromBlock(block);
87
- const payload = new ConsensusPayload(checkpointHeader, block.archive.root);
87
+ const payload = new ConsensusPayload(checkpointHeader, block.archive.root, feeAssetPriceModifier);
88
88
  const attestation = new CheckpointAttestation(payload, signature, signature);
89
89
  // Set sender directly for testing (bypasses signature recovery)
90
90
  attestation.sender = sender;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/sequencer-client",
3
- "version": "0.0.1-commit.7cf39cb55",
3
+ "version": "0.0.1-commit.808bf7f90",
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.7cf39cb55",
30
- "@aztec/bb-prover": "0.0.1-commit.7cf39cb55",
31
- "@aztec/blob-client": "0.0.1-commit.7cf39cb55",
32
- "@aztec/blob-lib": "0.0.1-commit.7cf39cb55",
33
- "@aztec/constants": "0.0.1-commit.7cf39cb55",
34
- "@aztec/epoch-cache": "0.0.1-commit.7cf39cb55",
35
- "@aztec/ethereum": "0.0.1-commit.7cf39cb55",
36
- "@aztec/foundation": "0.0.1-commit.7cf39cb55",
37
- "@aztec/l1-artifacts": "0.0.1-commit.7cf39cb55",
38
- "@aztec/merkle-tree": "0.0.1-commit.7cf39cb55",
39
- "@aztec/node-keystore": "0.0.1-commit.7cf39cb55",
40
- "@aztec/noir-acvm_js": "0.0.1-commit.7cf39cb55",
41
- "@aztec/noir-contracts.js": "0.0.1-commit.7cf39cb55",
42
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.7cf39cb55",
43
- "@aztec/noir-types": "0.0.1-commit.7cf39cb55",
44
- "@aztec/p2p": "0.0.1-commit.7cf39cb55",
45
- "@aztec/protocol-contracts": "0.0.1-commit.7cf39cb55",
46
- "@aztec/prover-client": "0.0.1-commit.7cf39cb55",
47
- "@aztec/simulator": "0.0.1-commit.7cf39cb55",
48
- "@aztec/slasher": "0.0.1-commit.7cf39cb55",
49
- "@aztec/stdlib": "0.0.1-commit.7cf39cb55",
50
- "@aztec/telemetry-client": "0.0.1-commit.7cf39cb55",
51
- "@aztec/validator-client": "0.0.1-commit.7cf39cb55",
52
- "@aztec/validator-ha-signer": "0.0.1-commit.7cf39cb55",
53
- "@aztec/world-state": "0.0.1-commit.7cf39cb55",
29
+ "@aztec/aztec.js": "0.0.1-commit.808bf7f90",
30
+ "@aztec/bb-prover": "0.0.1-commit.808bf7f90",
31
+ "@aztec/blob-client": "0.0.1-commit.808bf7f90",
32
+ "@aztec/blob-lib": "0.0.1-commit.808bf7f90",
33
+ "@aztec/constants": "0.0.1-commit.808bf7f90",
34
+ "@aztec/epoch-cache": "0.0.1-commit.808bf7f90",
35
+ "@aztec/ethereum": "0.0.1-commit.808bf7f90",
36
+ "@aztec/foundation": "0.0.1-commit.808bf7f90",
37
+ "@aztec/l1-artifacts": "0.0.1-commit.808bf7f90",
38
+ "@aztec/merkle-tree": "0.0.1-commit.808bf7f90",
39
+ "@aztec/node-keystore": "0.0.1-commit.808bf7f90",
40
+ "@aztec/noir-acvm_js": "0.0.1-commit.808bf7f90",
41
+ "@aztec/noir-contracts.js": "0.0.1-commit.808bf7f90",
42
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.808bf7f90",
43
+ "@aztec/noir-types": "0.0.1-commit.808bf7f90",
44
+ "@aztec/p2p": "0.0.1-commit.808bf7f90",
45
+ "@aztec/protocol-contracts": "0.0.1-commit.808bf7f90",
46
+ "@aztec/prover-client": "0.0.1-commit.808bf7f90",
47
+ "@aztec/simulator": "0.0.1-commit.808bf7f90",
48
+ "@aztec/slasher": "0.0.1-commit.808bf7f90",
49
+ "@aztec/stdlib": "0.0.1-commit.808bf7f90",
50
+ "@aztec/telemetry-client": "0.0.1-commit.808bf7f90",
51
+ "@aztec/validator-client": "0.0.1-commit.808bf7f90",
52
+ "@aztec/validator-ha-signer": "0.0.1-commit.808bf7f90",
53
+ "@aztec/world-state": "0.0.1-commit.808bf7f90",
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.7cf39cb55",
60
- "@aztec/kv-store": "0.0.1-commit.7cf39cb55",
59
+ "@aztec/archiver": "0.0.1-commit.808bf7f90",
60
+ "@aztec/kv-store": "0.0.1-commit.808bf7f90",
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
@@ -22,10 +22,10 @@ import { DEFAULT_P2P_PROPAGATION_TIME } from '@aztec/stdlib/timetable';
22
22
  import { type ValidatorClientConfig, validatorClientConfigMappings } from '@aztec/validator-client/config';
23
23
 
24
24
  import {
25
- type PublisherConfig,
26
- type TxSenderConfig,
27
- getPublisherConfigMappings,
28
- getTxSenderConfigMappings,
25
+ type SequencerPublisherConfig,
26
+ type SequencerTxSenderConfig,
27
+ sequencerPublisherConfigMappings,
28
+ sequencerTxSenderConfigMappings,
29
29
  } from './publisher/config.js';
30
30
 
31
31
  export * from './publisher/config.js';
@@ -55,15 +55,16 @@ export const DefaultSequencerConfig: ResolvedSequencerConfig = {
55
55
  fishermanMode: false,
56
56
  shuffleAttestationOrdering: false,
57
57
  skipPushProposedBlocksToArchiver: false,
58
+ skipPublishingCheckpointsPercent: 0,
58
59
  };
59
60
 
60
61
  /**
61
62
  * Configuration settings for the SequencerClient.
62
63
  */
63
- export type SequencerClientConfig = PublisherConfig &
64
+ export type SequencerClientConfig = SequencerPublisherConfig &
64
65
  KeyStoreConfig &
65
66
  ValidatorClientConfig &
66
- TxSenderConfig &
67
+ SequencerTxSenderConfig &
67
68
  SequencerConfig &
68
69
  L1ReaderConfig &
69
70
  ChainConfig &
@@ -205,6 +206,14 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
205
206
  description: 'Skip pushing proposed blocks to archiver (default: true)',
206
207
  ...booleanConfigHelper(DefaultSequencerConfig.skipPushProposedBlocksToArchiver),
207
208
  },
209
+ minBlocksForCheckpoint: {
210
+ description: 'Minimum number of blocks required for a checkpoint proposal (test only)',
211
+ },
212
+ skipPublishingCheckpointsPercent: {
213
+ env: 'SEQ_SKIP_CHECKPOINT_PUBLISH_PERCENT',
214
+ description: 'Percent probability (0 - 100) of sequencer skipping checkpoint publishing (testing only)',
215
+ ...numberConfigHelper(DefaultSequencerConfig.skipPublishingCheckpointsPercent),
216
+ },
208
217
  ...pickConfigMappings(p2pConfigMappings, ['txPublicSetupAllowList']),
209
218
  };
210
219
 
@@ -213,8 +222,8 @@ export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientCo
213
222
  ...sequencerConfigMappings,
214
223
  ...keyStoreConfigMappings,
215
224
  ...l1ReaderConfigMappings,
216
- ...getTxSenderConfigMappings('SEQ'),
217
- ...getPublisherConfigMappings('SEQ'),
225
+ ...sequencerTxSenderConfigMappings,
226
+ ...sequencerPublisherConfigMappings,
218
227
  ...chainConfigMappings,
219
228
  ...pickConfigMappings(l1ContractsConfigMappings, ['ethereumSlotDuration', 'aztecSlotDuration', 'aztecEpochDuration']),
220
229
  };
@@ -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 */
@@ -37,35 +50,76 @@ export type PublisherConfig = L1TxUtilsConfig &
37
50
  publisherForwarderAddress?: EthAddress;
38
51
  };
39
52
 
40
- export const getTxSenderConfigMappings: (
41
- scope: 'PROVER' | 'SEQ',
42
- ) => ConfigMappingsType<Omit<TxSenderConfig, 'l1Contracts'>> = (scope: 'PROVER' | 'SEQ') => ({
53
+ export type ProverPublisherConfig = L1TxUtilsConfig &
54
+ BlobClientConfig & {
55
+ fishermanMode?: boolean;
56
+ proverPublisherAllowInvalidStates?: boolean;
57
+ proverPublisherForwarderAddress?: EthAddress;
58
+ };
59
+
60
+ export type SequencerPublisherConfig = L1TxUtilsConfig &
61
+ BlobClientConfig & {
62
+ fishermanMode?: boolean;
63
+ sequencerPublisherAllowInvalidStates?: boolean;
64
+ sequencerPublisherForwarderAddress?: EthAddress;
65
+ };
66
+
67
+ export function getPublisherConfigFromProverConfig(config: ProverPublisherConfig): PublisherConfig {
68
+ return {
69
+ ...config,
70
+ publisherAllowInvalidStates: config.proverPublisherAllowInvalidStates,
71
+ publisherForwarderAddress: config.proverPublisherForwarderAddress,
72
+ };
73
+ }
74
+
75
+ export function getPublisherConfigFromSequencerConfig(config: SequencerPublisherConfig): PublisherConfig {
76
+ return {
77
+ ...config,
78
+ publisherAllowInvalidStates: config.sequencerPublisherAllowInvalidStates,
79
+ publisherForwarderAddress: config.sequencerPublisherForwarderAddress,
80
+ };
81
+ }
82
+
83
+ export const proverTxSenderConfigMappings: ConfigMappingsType<Omit<ProverTxSenderConfig, 'l1Contracts'>> = {
43
84
  ...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.',
85
+ proverPublisherPrivateKeys: {
86
+ env: `PROVER_PUBLISHER_PRIVATE_KEYS`,
87
+ description: 'The private keys to be used by the prover publisher.',
47
88
  parseEnv: (val: string) => val.split(',').map(key => new SecretValue(`0x${key.replace('0x', '')}`)),
48
89
  defaultValue: [],
49
- fallback: [scope === 'PROVER' ? `PROVER_PUBLISHER_PRIVATE_KEY` : `SEQ_PUBLISHER_PRIVATE_KEY`],
90
+ fallback: [`PROVER_PUBLISHER_PRIVATE_KEY`],
50
91
  },
51
- publisherAddresses: {
52
- env: scope === 'PROVER' ? `PROVER_PUBLISHER_ADDRESSES` : `SEQ_PUBLISHER_ADDRESSES`,
92
+ proverPublisherAddresses: {
93
+ env: `PROVER_PUBLISHER_ADDRESSES`,
53
94
  description: 'The addresses of the publishers to use with remote signers',
54
95
  parseEnv: (val: string) => val.split(',').map(address => EthAddress.fromString(address)),
55
96
  defaultValue: [],
56
97
  },
57
- });
98
+ };
58
99
 
59
- export function getTxSenderConfigFromEnv(scope: 'PROVER' | 'SEQ'): Omit<TxSenderConfig, 'l1Contracts'> {
60
- return getConfigFromMappings(getTxSenderConfigMappings(scope));
61
- }
100
+ export const sequencerTxSenderConfigMappings: ConfigMappingsType<Omit<SequencerTxSenderConfig, 'l1Contracts'>> = {
101
+ ...l1ReaderConfigMappings,
102
+ sequencerPublisherPrivateKeys: {
103
+ env: `SEQ_PUBLISHER_PRIVATE_KEYS`,
104
+ description: 'The private keys to be used by the sequencer publisher.',
105
+ parseEnv: (val: string) => val.split(',').map(key => new SecretValue(`0x${key.replace('0x', '')}`)),
106
+ defaultValue: [],
107
+ fallback: [`SEQ_PUBLISHER_PRIVATE_KEY`],
108
+ },
109
+ sequencerPublisherAddresses: {
110
+ env: `SEQ_PUBLISHER_ADDRESSES`,
111
+ description: 'The addresses of the publishers to use with remote signers',
112
+ parseEnv: (val: string) => val.split(',').map(address => EthAddress.fromString(address)),
113
+ defaultValue: [],
114
+ },
115
+ };
62
116
 
63
- export const getPublisherConfigMappings: (
64
- scope: 'PROVER' | 'SEQ',
65
- ) => ConfigMappingsType<PublisherConfig & L1TxUtilsConfig> = scope => ({
66
- publisherAllowInvalidStates: {
117
+ export const sequencerPublisherConfigMappings: ConfigMappingsType<SequencerPublisherConfig & L1TxUtilsConfig> = {
118
+ ...l1TxUtilsConfigMappings,
119
+ ...blobClientConfigMapping,
120
+ sequencerPublisherAllowInvalidStates: {
121
+ env: `SEQ_PUBLISHER_ALLOW_INVALID_STATES`,
67
122
  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
123
  ...booleanConfigHelper(true),
70
124
  },
71
125
  fishermanMode: {
@@ -74,15 +128,30 @@ export const getPublisherConfigMappings: (
74
128
  'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
75
129
  ...booleanConfigHelper(false),
76
130
  },
77
- publisherForwarderAddress: {
78
- env: scope === `PROVER` ? `PROVER_PUBLISHER_FORWARDER_ADDRESS` : `SEQ_PUBLISHER_FORWARDER_ADDRESS`,
131
+ sequencerPublisherForwarderAddress: {
132
+ env: `SEQ_PUBLISHER_FORWARDER_ADDRESS`,
79
133
  description: 'Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only)',
80
134
  parseEnv: (val: string) => (val ? EthAddress.fromString(val) : undefined),
81
135
  },
136
+ };
137
+
138
+ export const proverPublisherConfigMappings: ConfigMappingsType<ProverPublisherConfig & L1TxUtilsConfig> = {
82
139
  ...l1TxUtilsConfigMappings,
83
140
  ...blobClientConfigMapping,
84
- });
85
-
86
- export function getPublisherConfigFromEnv(scope: 'PROVER' | 'SEQ'): PublisherConfig {
87
- return getConfigFromMappings(getPublisherConfigMappings(scope));
88
- }
141
+ proverPublisherAllowInvalidStates: {
142
+ env: `PROVER_PUBLISHER_ALLOW_INVALID_STATES`,
143
+ description: 'True to use publishers in invalid states (timed out, cancelled, etc) if no other is available',
144
+ ...booleanConfigHelper(true),
145
+ },
146
+ fishermanMode: {
147
+ env: 'FISHERMAN_MODE',
148
+ description:
149
+ 'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
150
+ ...booleanConfigHelper(false),
151
+ },
152
+ proverPublisherForwarderAddress: {
153
+ env: `PROVER_PUBLISHER_FORWARDER_ADDRESS`,
154
+ description: 'Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only)',
155
+ parseEnv: (val: string) => (val ? EthAddress.fromString(val) : undefined),
156
+ },
157
+ };
@@ -3,7 +3,7 @@ import { type Logger, createLogger } from '@aztec/aztec.js/log';
3
3
  import type { BlobClientInterface } from '@aztec/blob-client/client';
4
4
  import type { EpochCache } from '@aztec/epoch-cache';
5
5
  import type { GovernanceProposerContract, RollupContract } from '@aztec/ethereum/contracts';
6
- import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
6
+ import type { L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
7
7
  import type { PublisherFilter, PublisherManager } from '@aztec/ethereum/publisher-manager';
8
8
  import { SlotNumber } from '@aztec/foundation/branded-types';
9
9
  import type { DateProvider } from '@aztec/foundation/timer';
@@ -26,13 +26,15 @@ export class SequencerPublisherFactory {
26
26
  /** Stores the last slot in which every action was carried out by a publisher */
27
27
  private lastActions: Partial<Record<Action, SlotNumber>> = {};
28
28
 
29
+ private nodeKeyStore: NodeKeystoreAdapter;
30
+
29
31
  private logger: Logger;
30
32
 
31
33
  constructor(
32
34
  private sequencerConfig: SequencerClientConfig,
33
35
  private deps: {
34
36
  telemetry: TelemetryClient;
35
- publisherManager: PublisherManager<L1TxUtilsWithBlobs>;
37
+ publisherManager: PublisherManager<L1TxUtils>;
36
38
  blobClient: BlobClientInterface;
37
39
  dateProvider: DateProvider;
38
40
  epochCache: EpochCache;
@@ -45,7 +47,17 @@ export class SequencerPublisherFactory {
45
47
  ) {
46
48
  this.publisherMetrics = new SequencerPublisherMetrics(deps.telemetry, 'SequencerPublisher');
47
49
  this.logger = deps.logger ?? createLogger('sequencer');
50
+ this.nodeKeyStore = this.deps.nodeKeyStore;
51
+ }
52
+
53
+ /**
54
+ * Updates the node keystore adapter used for publisher lookups.
55
+ * Called when the keystore is reloaded at runtime to reflect new validator-publisher mappings.
56
+ */
57
+ public updateNodeKeyStore(adapter: NodeKeystoreAdapter): void {
58
+ this.nodeKeyStore = adapter;
48
59
  }
60
+
49
61
  /**
50
62
  * Creates a new SequencerPublisher instance.
51
63
  * @param _validatorAddress - The address of the validator that will be using the publisher.
@@ -54,17 +66,17 @@ export class SequencerPublisherFactory {
54
66
  public async create(validatorAddress?: EthAddress): Promise<AttestorPublisherPair> {
55
67
  // If we have been given an attestor address we must only allow publishers permitted for that attestor
56
68
 
57
- const allowedPublishers = !validatorAddress ? [] : this.deps.nodeKeyStore.getPublisherAddresses(validatorAddress);
58
- const filter: PublisherFilter<L1TxUtilsWithBlobs> = !validatorAddress
69
+ const allowedPublishers = !validatorAddress ? [] : this.nodeKeyStore.getPublisherAddresses(validatorAddress);
70
+ const filter: PublisherFilter<L1TxUtils> = !validatorAddress
59
71
  ? () => true
60
- : (utils: L1TxUtilsWithBlobs) => {
72
+ : (utils: L1TxUtils) => {
61
73
  const publisherAddress = utils.getSenderAddress();
62
74
  return allowedPublishers.some(allowedPublisher => allowedPublisher.equals(publisherAddress));
63
75
  };
64
76
 
65
77
  const l1Publisher = await this.deps.publisherManager.getAvailablePublisher(filter);
66
78
  const attestorAddress =
67
- validatorAddress ?? this.deps.nodeKeyStore.getAttestorForPublisher(l1Publisher.getSenderAddress());
79
+ validatorAddress ?? this.nodeKeyStore.getAttestorForPublisher(l1Publisher.getSenderAddress());
68
80
 
69
81
  const rollup = this.deps.rollupContract;
70
82
  const slashingProposerContract = await rollup.getSlashingProposer();
@@ -89,4 +101,9 @@ export class SequencerPublisherFactory {
89
101
  publisher,
90
102
  };
91
103
  }
104
+
105
+ /** Interrupts all publishers managed by this factory. Used during sequencer shutdown. */
106
+ public interruptAll(): void {
107
+ this.deps.publisherManager.interrupt();
108
+ }
92
109
  }