@aztec/sequencer-client 0.76.4 → 0.77.0-testnet-ignition.21

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 (87) hide show
  1. package/dest/client/index.js +0 -1
  2. package/dest/client/sequencer-client.d.ts +12 -9
  3. package/dest/client/sequencer-client.d.ts.map +1 -1
  4. package/dest/client/sequencer-client.js +55 -60
  5. package/dest/config.d.ts +2 -2
  6. package/dest/config.d.ts.map +1 -1
  7. package/dest/config.js +41 -46
  8. package/dest/global_variable_builder/global_builder.d.ts +5 -2
  9. package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
  10. package/dest/global_variable_builder/global_builder.js +45 -31
  11. package/dest/global_variable_builder/index.js +0 -1
  12. package/dest/index.js +0 -1
  13. package/dest/publisher/config.d.ts.map +1 -1
  14. package/dest/publisher/config.js +33 -48
  15. package/dest/publisher/index.js +0 -1
  16. package/dest/publisher/sequencer-publisher-metrics.d.ts +5 -2
  17. package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
  18. package/dest/publisher/sequencer-publisher-metrics.js +47 -23
  19. package/dest/publisher/sequencer-publisher.d.ts +10 -9
  20. package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
  21. package/dest/publisher/sequencer-publisher.js +191 -160
  22. package/dest/sequencer/allowed.d.ts +1 -1
  23. package/dest/sequencer/allowed.d.ts.map +1 -1
  24. package/dest/sequencer/allowed.js +6 -13
  25. package/dest/sequencer/config.d.ts +1 -1
  26. package/dest/sequencer/config.d.ts.map +1 -1
  27. package/dest/sequencer/config.js +1 -2
  28. package/dest/sequencer/index.js +0 -1
  29. package/dest/sequencer/metrics.js +26 -18
  30. package/dest/sequencer/sequencer.d.ts +18 -12
  31. package/dest/sequencer/sequencer.d.ts.map +1 -1
  32. package/dest/sequencer/sequencer.js +589 -560
  33. package/dest/sequencer/timetable.d.ts +1 -1
  34. package/dest/sequencer/timetable.d.ts.map +1 -1
  35. package/dest/sequencer/timetable.js +33 -19
  36. package/dest/sequencer/utils.d.ts +2 -2
  37. package/dest/sequencer/utils.d.ts.map +1 -1
  38. package/dest/sequencer/utils.js +22 -32
  39. package/dest/slasher/factory.d.ts +4 -8
  40. package/dest/slasher/factory.d.ts.map +1 -1
  41. package/dest/slasher/factory.js +5 -7
  42. package/dest/slasher/index.js +0 -1
  43. package/dest/slasher/slasher_client.d.ts +10 -62
  44. package/dest/slasher/slasher_client.d.ts.map +1 -1
  45. package/dest/slasher/slasher_client.js +47 -231
  46. package/dest/test/index.d.ts +3 -3
  47. package/dest/test/index.d.ts.map +1 -1
  48. package/dest/test/index.js +4 -1
  49. package/dest/tx_validator/archive_cache.d.ts +3 -3
  50. package/dest/tx_validator/archive_cache.d.ts.map +1 -1
  51. package/dest/tx_validator/archive_cache.js +8 -8
  52. package/dest/tx_validator/gas_validator.d.ts +5 -3
  53. package/dest/tx_validator/gas_validator.d.ts.map +1 -1
  54. package/dest/tx_validator/gas_validator.js +70 -70
  55. package/dest/tx_validator/nullifier_cache.d.ts +2 -2
  56. package/dest/tx_validator/nullifier_cache.d.ts.map +1 -1
  57. package/dest/tx_validator/nullifier_cache.js +9 -9
  58. package/dest/tx_validator/phases_validator.d.ts +3 -2
  59. package/dest/tx_validator/phases_validator.d.ts.map +1 -1
  60. package/dest/tx_validator/phases_validator.js +29 -21
  61. package/dest/tx_validator/test_utils.d.ts +4 -2
  62. package/dest/tx_validator/test_utils.d.ts.map +1 -1
  63. package/dest/tx_validator/test_utils.js +2 -3
  64. package/dest/tx_validator/tx_validator_factory.d.ts +7 -5
  65. package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -1
  66. package/dest/tx_validator/tx_validator_factory.js +14 -13
  67. package/package.json +28 -29
  68. package/src/client/sequencer-client.ts +17 -14
  69. package/src/config.ts +6 -14
  70. package/src/global_variable_builder/global_builder.ts +18 -19
  71. package/src/publisher/config.ts +9 -17
  72. package/src/publisher/sequencer-publisher-metrics.ts +23 -2
  73. package/src/publisher/sequencer-publisher.ts +15 -17
  74. package/src/sequencer/allowed.ts +4 -4
  75. package/src/sequencer/config.ts +1 -1
  76. package/src/sequencer/sequencer.ts +40 -35
  77. package/src/sequencer/timetable.ts +1 -1
  78. package/src/sequencer/utils.ts +2 -2
  79. package/src/slasher/factory.ts +7 -13
  80. package/src/slasher/slasher_client.ts +30 -252
  81. package/src/test/index.ts +3 -3
  82. package/src/tx_validator/archive_cache.ts +4 -3
  83. package/src/tx_validator/gas_validator.ts +22 -31
  84. package/src/tx_validator/nullifier_cache.ts +3 -2
  85. package/src/tx_validator/phases_validator.ts +8 -8
  86. package/src/tx_validator/test_utils.ts +5 -3
  87. package/src/tx_validator/tx_validator_factory.ts +23 -17
@@ -1,6 +1,4 @@
1
- import { type BlobSinkClientInterface } from '@aztec/blob-sink/client';
2
- import { type L1ToL2MessageSource, type L2BlockSource, type WorldStateSynchronizer } from '@aztec/circuit-types';
3
- import { type AztecAddress, type ContractDataSource } from '@aztec/circuits.js';
1
+ import type { BlobSinkClientInterface } from '@aztec/blob-sink/client';
4
2
  import { EpochCache } from '@aztec/epoch-cache';
5
3
  import {
6
4
  ForwarderContract,
@@ -14,18 +12,23 @@ import {
14
12
  import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
15
13
  import { EthAddress } from '@aztec/foundation/eth-address';
16
14
  import { createLogger } from '@aztec/foundation/log';
17
- import { type DateProvider } from '@aztec/foundation/timer';
18
- import { type P2P } from '@aztec/p2p';
15
+ import type { DateProvider } from '@aztec/foundation/timer';
16
+ import type { P2P } from '@aztec/p2p';
19
17
  import { LightweightBlockBuilderFactory } from '@aztec/prover-client/block-builder';
20
18
  import { PublicProcessorFactory } from '@aztec/simulator/server';
21
- import { type TelemetryClient } from '@aztec/telemetry-client';
22
- import { type ValidatorClient } from '@aztec/validator-client';
23
-
24
- import { type SequencerClientConfig } from '../config.js';
19
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
20
+ import type { L2BlockSource } from '@aztec/stdlib/block';
21
+ import type { ContractDataSource } from '@aztec/stdlib/contract';
22
+ import type { WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
23
+ import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
24
+ import type { TelemetryClient } from '@aztec/telemetry-client';
25
+ import type { ValidatorClient } from '@aztec/validator-client';
26
+
27
+ import type { SequencerClientConfig } from '../config.js';
25
28
  import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
26
29
  import { SequencerPublisher } from '../publisher/index.js';
27
30
  import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
28
- import { type SlasherClient } from '../slasher/index.js';
31
+ import type { SlasherClient } from '../slasher/index.js';
29
32
 
30
33
  /**
31
34
  * Encapsulates the full sequencer and publisher.
@@ -74,10 +77,10 @@ export class SequencerClient {
74
77
  l1ToL2MessageSource,
75
78
  telemetry: telemetryClient,
76
79
  } = deps;
77
- const { l1RpcUrl: rpcUrl, l1ChainId: chainId, publisherPrivateKey } = config;
78
- const chain = createEthereumChain(rpcUrl, chainId);
80
+ const { l1RpcUrls: rpcUrls, l1ChainId: chainId, publisherPrivateKey } = config;
81
+ const chain = createEthereumChain(rpcUrls, chainId);
79
82
  const log = createLogger('sequencer-client');
80
- const { publicClient, walletClient } = createL1Clients(rpcUrl, publisherPrivateKey, chain.chainInfo);
83
+ const { publicClient, walletClient } = createL1Clients(rpcUrls, publisherPrivateKey, chain.chainInfo);
81
84
  const l1TxUtils = deps.l1TxUtils ?? new L1TxUtilsWithBlobs(publicClient, walletClient, log, config);
82
85
  const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
83
86
  const [l1GenesisTime, slotDuration] = await Promise.all([
@@ -110,7 +113,7 @@ export class SequencerClient {
110
113
  (await EpochCache.create(
111
114
  config.l1Contracts.rollupAddress,
112
115
  {
113
- l1RpcUrl: rpcUrl,
116
+ l1RpcUrls: rpcUrls,
114
117
  l1ChainId: chainId,
115
118
  viemPollingIntervalMS: config.viemPollingIntervalMS,
116
119
  aztecSlotDuration: config.aztecSlotDuration,
package/src/config.ts CHANGED
@@ -1,10 +1,3 @@
1
- import {
2
- type AllowedElement,
3
- type ChainConfig,
4
- type SequencerConfig,
5
- chainConfigMappings,
6
- } from '@aztec/circuit-types/config';
7
- import { AztecAddress, Fr, FunctionSelector } from '@aztec/circuits.js';
8
1
  import {
9
2
  type L1ContractsConfig,
10
3
  type L1ReaderConfig,
@@ -19,6 +12,10 @@ import {
19
12
  pickConfigMappings,
20
13
  } from '@aztec/foundation/config';
21
14
  import { EthAddress } from '@aztec/foundation/eth-address';
15
+ import { Fr } from '@aztec/foundation/fields';
16
+ import { FunctionSelector } from '@aztec/stdlib/abi';
17
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
18
+ import { type AllowedElement, type ChainConfig, type SequencerConfig, chainConfigMappings } from '@aztec/stdlib/config';
22
19
 
23
20
  import {
24
21
  type PublisherConfig,
@@ -28,7 +25,7 @@ import {
28
25
  } from './publisher/config.js';
29
26
 
30
27
  export * from './publisher/config.js';
31
- export { SequencerConfig };
28
+ export type { SequencerConfig };
32
29
 
33
30
  /**
34
31
  * Configuration settings for the SequencerClient.
@@ -68,7 +65,7 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
68
65
  },
69
66
  coinbase: {
70
67
  env: 'COINBASE',
71
- parseEnv: (val: string) => EthAddress.fromString(val),
68
+ parseEnv: (val: string) => (val ? EthAddress.fromString(val) : undefined),
72
69
  description: 'Recipient of block reward.',
73
70
  },
74
71
  feeRecipient: {
@@ -96,11 +93,6 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
96
93
  description: 'Max block size',
97
94
  ...numberConfigHelper(1024 * 1024),
98
95
  },
99
- enforceFees: {
100
- env: 'ENFORCE_FEES',
101
- description: 'Whether to require every tx to have a fee payer',
102
- ...booleanConfigHelper(),
103
- },
104
96
  enforceTimeTable: {
105
97
  env: 'SEQ_ENFORCE_TIME_TABLE',
106
98
  description: 'Whether to enforce the time table when building blocks',
@@ -1,20 +1,19 @@
1
- import { type GlobalVariableBuilder as GlobalVariableBuilderInterface } from '@aztec/circuit-types';
2
- import { type AztecAddress, type EthAddress, GasFees, GlobalVariables } from '@aztec/circuits.js';
3
- import { type L1ContractsConfig, type L1ReaderConfig, createEthereumChain } from '@aztec/ethereum';
1
+ import {
2
+ type L1ContractsConfig,
3
+ type L1ReaderConfig,
4
+ type ViemPublicClient,
5
+ createEthereumChain,
6
+ } from '@aztec/ethereum';
7
+ import type { EthAddress } from '@aztec/foundation/eth-address';
4
8
  import { Fr } from '@aztec/foundation/fields';
5
9
  import { createLogger } from '@aztec/foundation/log';
6
10
  import { RollupAbi } from '@aztec/l1-artifacts';
11
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
12
+ import { GasFees } from '@aztec/stdlib/gas';
13
+ import type { GlobalVariableBuilder as GlobalVariableBuilderInterface } from '@aztec/stdlib/tx';
14
+ import { GlobalVariables } from '@aztec/stdlib/tx';
7
15
 
8
- import {
9
- type GetContractReturnType,
10
- type HttpTransport,
11
- type PublicClient,
12
- createPublicClient,
13
- getAddress,
14
- getContract,
15
- http,
16
- } from 'viem';
17
- import type * as chains from 'viem/chains';
16
+ import { type GetContractReturnType, createPublicClient, fallback, getAddress, getContract, http } from 'viem';
18
17
 
19
18
  /**
20
19
  * Simple global variables builder.
@@ -22,20 +21,20 @@ import type * as chains from 'viem/chains';
22
21
  export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
23
22
  private log = createLogger('sequencer:global_variable_builder');
24
23
 
25
- private rollupContract: GetContractReturnType<typeof RollupAbi, PublicClient<HttpTransport, chains.Chain>>;
26
- private publicClient: PublicClient<HttpTransport, chains.Chain>;
24
+ private rollupContract: GetContractReturnType<typeof RollupAbi, ViemPublicClient>;
25
+ private publicClient: ViemPublicClient;
27
26
  private ethereumSlotDuration: number;
28
27
 
29
28
  constructor(config: L1ReaderConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration'>) {
30
- const { l1RpcUrl, l1ChainId: chainId, l1Contracts } = config;
29
+ const { l1RpcUrls, l1ChainId: chainId, l1Contracts } = config;
31
30
 
32
- const chain = createEthereumChain(l1RpcUrl, chainId);
31
+ const chain = createEthereumChain(l1RpcUrls, chainId);
33
32
 
34
33
  this.ethereumSlotDuration = config.ethereumSlotDuration;
35
34
 
36
35
  this.publicClient = createPublicClient({
37
36
  chain: chain.chainInfo,
38
- transport: http(chain.rpcUrl),
37
+ transport: fallback(chain.rpcUrls.map(url => http(url))),
39
38
  pollingInterval: config.viemPollingIntervalMS,
40
39
  });
41
40
 
@@ -77,7 +76,7 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
77
76
  feeRecipient: AztecAddress,
78
77
  slotNumber?: bigint,
79
78
  ): Promise<GlobalVariables> {
80
- const version = new Fr(await this.rollupContract.read.VERSION());
79
+ const version = new Fr(await this.rollupContract.read.getVersion());
81
80
  const chainId = new Fr(this.publicClient.chain.id);
82
81
 
83
82
  if (slotNumber === undefined) {
@@ -1,6 +1,12 @@
1
1
  import { type BlobSinkConfig, blobSinkConfigMapping } from '@aztec/blob-sink/client';
2
- import { type L1ReaderConfig, type L1TxUtilsConfig, NULL_KEY, l1TxUtilsConfigMappings } from '@aztec/ethereum';
3
- import { type ConfigMappingsType, getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config';
2
+ import {
3
+ type L1ReaderConfig,
4
+ type L1TxUtilsConfig,
5
+ NULL_KEY,
6
+ l1ReaderConfigMappings,
7
+ l1TxUtilsConfigMappings,
8
+ } from '@aztec/ethereum';
9
+ import { type ConfigMappingsType, getConfigFromMappings } from '@aztec/foundation/config';
4
10
  import { EthAddress } from '@aztec/foundation/eth-address';
5
11
 
6
12
  /**
@@ -37,16 +43,7 @@ export type PublisherConfig = L1TxUtilsConfig &
37
43
  export const getTxSenderConfigMappings: (
38
44
  scope: 'PROVER' | 'SEQ',
39
45
  ) => ConfigMappingsType<Omit<TxSenderConfig, 'l1Contracts'>> = (scope: 'PROVER' | 'SEQ') => ({
40
- l1RpcUrl: {
41
- env: 'ETHEREUM_HOST',
42
- description: 'The RPC Url of the ethereum host.',
43
- },
44
- l1ChainId: {
45
- env: 'L1_CHAIN_ID',
46
- parseEnv: (val: string) => +val,
47
- defaultValue: 31337,
48
- description: 'The chain ID of the ethereum host.',
49
- },
46
+ ...l1ReaderConfigMappings,
50
47
  customForwarderContractAddress: {
51
48
  env: `CUSTOM_FORWARDER_CONTRACT_ADDRESS`,
52
49
  parseEnv: (val: string) => EthAddress.fromString(val),
@@ -65,11 +62,6 @@ export const getTxSenderConfigMappings: (
65
62
  defaultValue: 1,
66
63
  description: 'The number of confirmations required.',
67
64
  },
68
- viemPollingIntervalMS: {
69
- env: `${scope}_VIEM_POLLING_INTERVAL_MS`,
70
- description: 'The polling interval viem uses in ms',
71
- ...numberConfigHelper(1_000),
72
- },
73
65
  });
74
66
 
75
67
  export function getTxSenderConfigFromEnv(scope: 'PROVER' | 'SEQ'): Omit<TxSenderConfig, 'l1Contracts'> {
@@ -1,6 +1,8 @@
1
- import type { L1PublishBlockStats, L1PublishStats } from '@aztec/circuit-types/stats';
1
+ import { createLogger } from '@aztec/aztec.js';
2
+ import type { L1PublishBlockStats, L1PublishStats } from '@aztec/stdlib/stats';
2
3
  import {
3
4
  Attributes,
5
+ type Gauge,
4
6
  type Histogram,
5
7
  Metrics,
6
8
  type TelemetryClient,
@@ -28,7 +30,13 @@ export class SequencerPublisherMetrics {
28
30
  private readonly blobTxSuccessCounter: UpDownCounter;
29
31
  private readonly blobTxFailureCounter: UpDownCounter;
30
32
 
31
- constructor(client: TelemetryClient, name = 'SequencerPublisher') {
33
+ private senderBalance: Gauge;
34
+
35
+ constructor(
36
+ client: TelemetryClient,
37
+ name = 'SequencerPublisher',
38
+ private logger = createLogger('sequencer:publisher:metrics'),
39
+ ) {
32
40
  const meter = client.getMeter(name);
33
41
 
34
42
  this.gasPrice = meter.createHistogram(Metrics.L1_PUBLISHER_GAS_PRICE, {
@@ -96,6 +104,12 @@ export class SequencerPublisherMetrics {
96
104
  this.blobTxFailureCounter = meter.createUpDownCounter(Metrics.L1_PUBLISHER_BLOB_TX_FAILURE, {
97
105
  description: 'Number of failed L1 transactions with blobs',
98
106
  });
107
+
108
+ this.senderBalance = meter.createGauge(Metrics.L1_PUBLISHER_BALANCE, {
109
+ unit: 'eth',
110
+ description: 'The balance of the sender address',
111
+ valueType: ValueType.DOUBLE,
112
+ });
99
113
  }
100
114
 
101
115
  recordFailedTx(txType: L1TxType) {
@@ -123,6 +137,13 @@ export class SequencerPublisherMetrics {
123
137
  }
124
138
  }
125
139
 
140
+ recordSenderBalance(wei: bigint, senderAddress: string) {
141
+ const eth = parseFloat(formatEther(wei, 'wei'));
142
+ this.senderBalance.record(eth, {
143
+ [Attributes.SENDER_ADDRESS]: senderAddress,
144
+ });
145
+ }
146
+
126
147
  private recordTx(txType: L1TxType, durationMs: number, stats: L1PublishStats) {
127
148
  const attributes = {
128
149
  [Attributes.L1_TX_TYPE]: txType,
@@ -1,15 +1,7 @@
1
+ import type { L2Block } from '@aztec/aztec.js';
1
2
  import { Blob } from '@aztec/blob-lib';
2
3
  import { type BlobSinkClientInterface, createBlobSinkClient } from '@aztec/blob-sink/client';
3
- import {
4
- ConsensusPayload,
5
- type L2Block,
6
- SignatureDomainSeparator,
7
- type TxHash,
8
- getHashedSignaturePayload,
9
- } from '@aztec/circuit-types';
10
- import type { L1PublishBlockStats } from '@aztec/circuit-types/stats';
11
- import { type BlockHeader, EthAddress } from '@aztec/circuits.js';
12
- import { type EpochCache } from '@aztec/epoch-cache';
4
+ import type { EpochCache } from '@aztec/epoch-cache';
13
5
  import {
14
6
  FormattedViemError,
15
7
  type ForwarderContract,
@@ -25,18 +17,22 @@ import {
25
17
  type TransactionStats,
26
18
  formatViemError,
27
19
  } from '@aztec/ethereum';
28
- import { type L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
20
+ import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
29
21
  import { toHex } from '@aztec/foundation/bigint-buffer';
30
- import { type Signature } from '@aztec/foundation/eth-signature';
22
+ import { EthAddress } from '@aztec/foundation/eth-address';
23
+ import type { Signature } from '@aztec/foundation/eth-signature';
31
24
  import { createLogger } from '@aztec/foundation/log';
32
25
  import { Timer } from '@aztec/foundation/timer';
33
26
  import { ForwarderAbi, RollupAbi } from '@aztec/l1-artifacts';
27
+ import { ConsensusPayload, SignatureDomainSeparator, getHashedSignaturePayload } from '@aztec/stdlib/p2p';
28
+ import type { L1PublishBlockStats } from '@aztec/stdlib/stats';
29
+ import { type BlockHeader, TxHash } from '@aztec/stdlib/tx';
34
30
  import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
35
31
 
36
32
  import pick from 'lodash.pick';
37
33
  import { type TransactionReceipt, encodeFunctionData } from 'viem';
38
34
 
39
- import { type PublisherConfig, type TxSenderConfig } from './config.js';
35
+ import type { PublisherConfig, TxSenderConfig } from './config.js';
40
36
  import { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
41
37
 
42
38
  /** Arguments to the process method of the rollup contract */
@@ -47,8 +43,6 @@ type L1ProcessArgs = {
47
43
  archive: Buffer;
48
44
  /** The L2 block's leaf in the archive tree. */
49
45
  blockHash: Buffer;
50
- /** L2 block body. TODO(#9101): Remove block body once we can extract blobs. */
51
- body: Buffer;
52
46
  /** L2 block blobs containing all tx effects. */
53
47
  blobs: Blob[];
54
48
  /** L2 block tx hashes */
@@ -234,6 +228,12 @@ export class SequencerPublisher {
234
228
  const viemError = formatViemError(err);
235
229
  this.log.error(`Failed to publish bundled transactions`, viemError);
236
230
  return undefined;
231
+ } finally {
232
+ try {
233
+ this.metrics.recordSenderBalance(await this.l1TxUtils.getSenderBalance(), this.l1TxUtils.getSenderAddress());
234
+ } catch (err) {
235
+ this.log.warn(`Failed to record balance after sending tx: ${err}`);
236
+ }
237
237
  }
238
238
  }
239
239
 
@@ -487,8 +487,6 @@ export class SequencerPublisher {
487
487
  txHashes,
488
488
  },
489
489
  attestations,
490
- // TODO(#9101): Extract blobs from beacon chain => calldata will only contain what's needed to verify blob and body input can be removed
491
- `0x${encodedData.body.toString('hex')}`,
492
490
  blobInput,
493
491
  ] as const;
494
492
 
@@ -1,8 +1,8 @@
1
- import { type AllowedElement } from '@aztec/circuit-types';
2
- import { getContractClassFromArtifact } from '@aztec/circuits.js';
3
1
  import { FPCContract } from '@aztec/noir-contracts.js/FPC';
4
2
  import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
5
3
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
4
+ import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
5
+ import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
6
6
 
7
7
  let defaultAllowedSetupFunctions: AllowedElement[] | undefined = undefined;
8
8
 
@@ -17,13 +17,13 @@ export async function getDefaultAllowedSetupFunctions(): Promise<AllowedElement[
17
17
  {
18
18
  address: ProtocolContractAddress.FeeJuice,
19
19
  // We can't restrict the selector because public functions get routed via dispatch.
20
- // selector: FunctionSelector.fromSignature('_increase_public_balance((Field),(Field,Field))'),
20
+ // selector: FunctionSelector.fromSignature('_increase_public_balance((Field),u128)'),
21
21
  },
22
22
  // needed for private transfers via FPC
23
23
  {
24
24
  classId: (await getContractClassFromArtifact(TokenContractArtifact)).id,
25
25
  // We can't restrict the selector because public functions get routed via dispatch.
26
- // selector: FunctionSelector.fromSignature('_increase_public_balance((Field),(Field,Field))'),
26
+ // selector: FunctionSelector.fromSignature('_increase_public_balance((Field),u128)'),
27
27
  },
28
28
  {
29
29
  classId: (await getContractClassFromArtifact(FPCContract.artifact)).id,
@@ -1 +1 @@
1
- export { type SequencerConfig } from '@aztec/circuit-types/config';
1
+ export { type SequencerConfig } from '@aztec/stdlib/config';
@@ -1,47 +1,47 @@
1
+ import type { L2Block } from '@aztec/aztec.js';
2
+ import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
3
+ import { omit } from '@aztec/foundation/collection';
4
+ import { EthAddress } from '@aztec/foundation/eth-address';
5
+ import type { Signature } from '@aztec/foundation/eth-signature';
6
+ import { Fr } from '@aztec/foundation/fields';
7
+ import { createLogger } from '@aztec/foundation/log';
8
+ import { RunningPromise } from '@aztec/foundation/running-promise';
9
+ import { type DateProvider, Timer, elapsed } from '@aztec/foundation/timer';
10
+ import type { P2P } from '@aztec/p2p';
11
+ import type { BlockBuilderFactory } from '@aztec/prover-client/block-builder';
12
+ import type { PublicProcessorFactory } from '@aztec/simulator/server';
13
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
14
+ import type { L2BlockSource } from '@aztec/stdlib/block';
15
+ import type { ContractDataSource } from '@aztec/stdlib/contract';
16
+ import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
17
+ import { Gas } from '@aztec/stdlib/gas';
1
18
  import {
2
- type L1RollupConstants,
3
- type L1ToL2MessageSource,
4
- type L2Block,
5
- type L2BlockSource,
19
+ type AllowedElement,
6
20
  SequencerConfigSchema,
7
- Tx,
8
- type TxHash,
9
21
  type WorldStateSynchronizer,
10
- } from '@aztec/circuit-types';
11
- import type { AllowedElement, WorldStateSynchronizerStatus } from '@aztec/circuit-types/interfaces';
12
- import { type L2BlockBuiltStats } from '@aztec/circuit-types/stats';
22
+ type WorldStateSynchronizerStatus,
23
+ } from '@aztec/stdlib/interfaces/server';
24
+ import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
25
+ import { pickFromSchema } from '@aztec/stdlib/schemas';
26
+ import type { L2BlockBuiltStats } from '@aztec/stdlib/stats';
27
+ import { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
13
28
  import {
14
- AppendOnlyTreeSnapshot,
15
29
  BlockHeader,
16
30
  ContentCommitment,
17
- type ContractDataSource,
18
- GENESIS_ARCHIVE_ROOT,
19
- Gas,
20
31
  type GlobalVariables,
21
- INITIAL_L2_BLOCK_NUM,
22
32
  StateReference,
23
- } from '@aztec/circuits.js';
24
- import { AztecAddress } from '@aztec/foundation/aztec-address';
25
- import { omit } from '@aztec/foundation/collection';
26
- import { EthAddress } from '@aztec/foundation/eth-address';
27
- import type { Signature } from '@aztec/foundation/eth-signature';
28
- import { Fr } from '@aztec/foundation/fields';
29
- import { createLogger } from '@aztec/foundation/log';
30
- import { RunningPromise } from '@aztec/foundation/running-promise';
31
- import { pickFromSchema } from '@aztec/foundation/schemas';
32
- import { type DateProvider, Timer, elapsed } from '@aztec/foundation/timer';
33
- import { type P2P } from '@aztec/p2p';
34
- import { type BlockBuilderFactory } from '@aztec/prover-client/block-builder';
35
- import { type PublicProcessorFactory } from '@aztec/simulator/server';
33
+ Tx,
34
+ type TxHash,
35
+ } from '@aztec/stdlib/tx';
36
36
  import { Attributes, type TelemetryClient, type Tracer, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
37
- import { type ValidatorClient } from '@aztec/validator-client';
37
+ import type { ValidatorClient } from '@aztec/validator-client';
38
38
 
39
- import { type GlobalVariableBuilder } from '../global_variable_builder/global_builder.js';
39
+ import type { GlobalVariableBuilder } from '../global_variable_builder/global_builder.js';
40
40
  import { type SequencerPublisher, VoteType } from '../publisher/sequencer-publisher.js';
41
- import { type SlasherClient } from '../slasher/slasher_client.js';
41
+ import type { SlasherClient } from '../slasher/slasher_client.js';
42
42
  import { createValidatorsForBlockBuilding } from '../tx_validator/tx_validator_factory.js';
43
43
  import { getDefaultAllowedSetupFunctions } from './allowed.js';
44
- import { type SequencerConfig } from './config.js';
44
+ import type { SequencerConfig } from './config.js';
45
45
  import { SequencerMetrics } from './metrics.js';
46
46
  import { SequencerTimetable, SequencerTooSlowError } from './timetable.js';
47
47
  import { SequencerState, orderAttestations } from './utils.js';
@@ -193,7 +193,7 @@ export class Sequencer {
193
193
  this.log.debug(`Stopping sequencer`);
194
194
  await this.validatorClient?.stop();
195
195
  await this.runningPromise?.stop();
196
- await this.slasherClient?.stop();
196
+ this.slasherClient.stop();
197
197
  this.publisher.interrupt();
198
198
  this.setState(SequencerState.STOPPED, 0n, true /** force */);
199
199
  this.log.info('Stopped sequencer');
@@ -452,7 +452,6 @@ export class Sequencer {
452
452
  publicProcessorFork,
453
453
  this.contractDataSource,
454
454
  newGlobalVariables,
455
- !!this.config.enforceFees,
456
455
  this.allowedInSetup,
457
456
  );
458
457
 
@@ -685,7 +684,12 @@ export class Sequencer {
685
684
  */
686
685
  protected async getChainTip(): Promise<{ blockNumber: number; archive: Fr } | undefined> {
687
686
  const syncedBlocks = await Promise.all([
688
- this.worldState.status().then((s: WorldStateSynchronizerStatus) => s.syncedToL2Block),
687
+ this.worldState.status().then((s: WorldStateSynchronizerStatus) => {
688
+ return {
689
+ number: s.syncSummary.latestBlockNumber,
690
+ hash: s.syncSummary.latestBlockHash,
691
+ };
692
+ }),
689
693
  this.l2BlockSource.getL2Tips().then(t => t.latest),
690
694
  this.p2pClient.getStatus().then(p2p => p2p.syncedToL2Block),
691
695
  this.l1ToL2MessageSource.getBlockNumber(),
@@ -727,7 +731,8 @@ export class Sequencer {
727
731
 
728
732
  return { blockNumber: block.number, archive: block.archive.root };
729
733
  } else {
730
- return { blockNumber: INITIAL_L2_BLOCK_NUM - 1, archive: new Fr(GENESIS_ARCHIVE_ROOT) };
734
+ const archive = new Fr((await this.worldState.getCommitted().getTreeInfo(MerkleTreeId.ARCHIVE)).root);
735
+ return { blockNumber: INITIAL_L2_BLOCK_NUM - 1, archive };
731
736
  }
732
737
  }
733
738
 
@@ -1,6 +1,6 @@
1
1
  import { createLogger } from '@aztec/aztec.js';
2
2
 
3
- import { type SequencerMetrics } from './metrics.js';
3
+ import type { SequencerMetrics } from './metrics.js';
4
4
  import { SequencerState } from './utils.js';
5
5
 
6
6
  export class SequencerTimetable {
@@ -1,6 +1,6 @@
1
- import type { BlockAttestation } from '@aztec/circuit-types';
2
- import { type EthAddress } from '@aztec/foundation/eth-address';
1
+ import type { EthAddress } from '@aztec/foundation/eth-address';
3
2
  import { Signature } from '@aztec/foundation/eth-signature';
3
+ import type { BlockAttestation } from '@aztec/stdlib/p2p';
4
4
 
5
5
  export enum SequencerState {
6
6
  /**
@@ -1,21 +1,15 @@
1
- import type { L2BlockSource } from '@aztec/circuit-types';
2
- import { type L1ContractsConfig, type L1ReaderConfig } from '@aztec/ethereum';
3
- import { createLogger } from '@aztec/foundation/log';
4
- import { type AztecAsyncKVStore } from '@aztec/kv-store';
5
- import { type DataStoreConfig } from '@aztec/kv-store/config';
6
- import { createStore } from '@aztec/kv-store/lmdb-v2';
1
+ import type { L1ContractsConfig, L1ReaderConfig } from '@aztec/ethereum';
2
+ import type { L2BlockSourceEventEmitter } from '@aztec/stdlib/block';
7
3
  import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
8
4
 
9
5
  import { SlasherClient } from './slasher_client.js';
10
- import { type SlasherConfig } from './slasher_client.js';
6
+ import type { SlasherConfig } from './slasher_client.js';
11
7
 
12
- export const createSlasherClient = async (
13
- _config: SlasherConfig & DataStoreConfig & L1ContractsConfig & L1ReaderConfig,
14
- l2BlockSource: L2BlockSource,
8
+ export const createSlasherClient = (
9
+ _config: SlasherConfig & L1ContractsConfig & L1ReaderConfig,
10
+ l2BlockSource: L2BlockSourceEventEmitter,
15
11
  telemetry: TelemetryClient = getTelemetryClient(),
16
- deps: { store?: AztecAsyncKVStore } = {},
17
12
  ) => {
18
13
  const config = { ..._config };
19
- const store = deps.store ?? (await createStore('slasher', config, createLogger('slasher:lmdb')));
20
- return new SlasherClient(config, store, l2BlockSource, telemetry);
14
+ return new SlasherClient(config, l2BlockSource, telemetry);
21
15
  };