@aztec/aztec-node 0.66.0 → 0.67.1-devnet

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.
package/dest/bin/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env -S node --no-warnings
2
- import { createDebugLogger } from '@aztec/foundation/log';
2
+ import { createLogger } from '@aztec/foundation/log';
3
3
  import http from 'http';
4
4
  import { AztecNodeService, createAztecNodeRpcServer, getConfigEnvVars } from '../index.js';
5
5
  const { AZTEC_NODE_PORT = 8081, API_PREFIX = '' } = process.env;
6
- const logger = createDebugLogger('aztec:node');
6
+ const logger = createLogger('node');
7
7
  /**
8
8
  * Creates the node from provided config
9
9
  */
@@ -34,4 +34,4 @@ main().catch(err => {
34
34
  logger.error(err);
35
35
  process.exit(1);
36
36
  });
37
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYmluL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUUxRCxPQUFPLElBQUksTUFBTSxNQUFNLENBQUM7QUFFeEIsT0FBTyxFQUF3QixnQkFBZ0IsRUFBRSx3QkFBd0IsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUVqSCxNQUFNLEVBQUUsZUFBZSxHQUFHLElBQUksRUFBRSxVQUFVLEdBQUcsRUFBRSxFQUFFLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQztBQUVoRSxNQUFNLE1BQU0sR0FBRyxpQkFBaUIsQ0FBQyxZQUFZLENBQUMsQ0FBQztBQUUvQzs7R0FFRztBQUNILEtBQUssVUFBVSx3QkFBd0I7SUFDckMsTUFBTSxlQUFlLEdBQW9CLE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3
- "version": "0.66.0",
3
+ "version": "0.67.1-devnet",
4
4
  "main": "dest/index.js",
5
5
  "type": "module",
6
- "exports": "./dest/index.js",
6
+ "exports": {
7
+ ".": "./dest/index.js",
8
+ "./config": "./dest/aztec-node/config.js"
9
+ },
7
10
  "bin": "./dest/bin/index.js",
8
11
  "typedocOptions": {
9
12
  "entryPoints": [
@@ -57,26 +60,30 @@
57
60
  "summaryThreshold": 9999
58
61
  }
59
62
  ]
63
+ ],
64
+ "testTimeout": 30000,
65
+ "setupFiles": [
66
+ "../../foundation/src/jest/setup.mjs"
60
67
  ]
61
68
  },
62
69
  "dependencies": {
63
- "@aztec/archiver": "0.66.0",
64
- "@aztec/bb-prover": "0.66.0",
65
- "@aztec/circuit-types": "0.66.0",
66
- "@aztec/circuits.js": "0.66.0",
67
- "@aztec/ethereum": "0.66.0",
68
- "@aztec/foundation": "0.66.0",
69
- "@aztec/kv-store": "0.66.0",
70
- "@aztec/merkle-tree": "0.66.0",
71
- "@aztec/p2p": "0.66.0",
72
- "@aztec/protocol-contracts": "0.66.0",
73
- "@aztec/prover-client": "0.66.0",
74
- "@aztec/sequencer-client": "0.66.0",
75
- "@aztec/simulator": "0.66.0",
76
- "@aztec/telemetry-client": "0.66.0",
77
- "@aztec/types": "0.66.0",
78
- "@aztec/validator-client": "0.66.0",
79
- "@aztec/world-state": "0.66.0",
70
+ "@aztec/archiver": "0.67.1-devnet",
71
+ "@aztec/bb-prover": "0.67.1-devnet",
72
+ "@aztec/circuit-types": "0.67.1-devnet",
73
+ "@aztec/circuits.js": "0.67.1-devnet",
74
+ "@aztec/ethereum": "0.67.1-devnet",
75
+ "@aztec/foundation": "0.67.1-devnet",
76
+ "@aztec/kv-store": "0.67.1-devnet",
77
+ "@aztec/merkle-tree": "0.67.1-devnet",
78
+ "@aztec/p2p": "0.67.1-devnet",
79
+ "@aztec/protocol-contracts": "0.67.1-devnet",
80
+ "@aztec/prover-client": "0.67.1-devnet",
81
+ "@aztec/sequencer-client": "0.67.1-devnet",
82
+ "@aztec/simulator": "0.67.1-devnet",
83
+ "@aztec/telemetry-client": "0.67.1-devnet",
84
+ "@aztec/types": "0.67.1-devnet",
85
+ "@aztec/validator-client": "0.67.1-devnet",
86
+ "@aztec/world-state": "0.67.1-devnet",
80
87
  "koa": "^2.14.2",
81
88
  "koa-router": "^12.0.0",
82
89
  "tslib": "^2.4.0"
@@ -1,11 +1,11 @@
1
- import { type ArchiverConfig, archiverConfigMappings } from '@aztec/archiver';
1
+ import { type ArchiverConfig, archiverConfigMappings } from '@aztec/archiver/config';
2
2
  import { type ConfigMappingsType, booleanConfigHelper, getConfigFromMappings } from '@aztec/foundation/config';
3
3
  import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
4
- import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p';
5
- import { type ProverClientConfig, proverClientConfigMappings } from '@aztec/prover-client';
6
- import { type SequencerClientConfig, sequencerClientConfigMappings } from '@aztec/sequencer-client';
7
- import { type ValidatorClientConfig, validatorClientConfigMappings } from '@aztec/validator-client';
8
- import { type WorldStateConfig, worldStateConfigMappings } from '@aztec/world-state';
4
+ import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
5
+ import { type ProverClientConfig, proverClientConfigMappings } from '@aztec/prover-client/config';
6
+ import { type SequencerClientConfig, sequencerClientConfigMappings } from '@aztec/sequencer-client/config';
7
+ import { type ValidatorClientConfig, validatorClientConfigMappings } from '@aztec/validator-client/config';
8
+ import { type WorldStateConfig, worldStateConfigMappings } from '@aztec/world-state/config';
9
9
 
10
10
  import { readFileSync } from 'fs';
11
11
  import { dirname, resolve } from 'path';
@@ -18,9 +18,6 @@ export class NodeMetrics {
18
18
  description: 'The duration of the receiveTx method',
19
19
  unit: 'ms',
20
20
  valueType: ValueType.INT,
21
- advice: {
22
- explicitBucketBoundaries: [10, 50, 100, 200, 500, 1000, 2000, 5000],
23
- },
24
21
  });
25
22
  }
26
23
 
@@ -15,6 +15,7 @@ import {
15
15
  MerkleTreeId,
16
16
  NullifierMembershipWitness,
17
17
  type NullifierWithBlockSource,
18
+ P2PClientType,
18
19
  type ProcessedTx,
19
20
  type ProverConfig,
20
21
  PublicDataWitness,
@@ -34,13 +35,13 @@ import {
34
35
  } from '@aztec/circuit-types';
35
36
  import {
36
37
  type ARCHIVE_HEIGHT,
38
+ type BlockHeader,
37
39
  type ContractClassPublic,
38
40
  type ContractDataSource,
39
41
  type ContractInstanceWithAddress,
40
42
  EthAddress,
41
43
  Fr,
42
44
  type GasFees,
43
- type Header,
44
45
  INITIAL_L2_BLOCK_NUM,
45
46
  type L1_TO_L2_MSG_TREE_HEIGHT,
46
47
  type NOTE_HASH_TREE_HEIGHT,
@@ -57,10 +58,10 @@ import { type L1ContractAddresses, createEthereumChain } from '@aztec/ethereum';
57
58
  import { type ContractArtifact } from '@aztec/foundation/abi';
58
59
  import { AztecAddress } from '@aztec/foundation/aztec-address';
59
60
  import { padArrayEnd } from '@aztec/foundation/collection';
60
- import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log';
61
- import { Timer } from '@aztec/foundation/timer';
61
+ import { type Logger, createLogger } from '@aztec/foundation/log';
62
+ import { DateProvider, Timer } from '@aztec/foundation/timer';
62
63
  import { type AztecKVStore } from '@aztec/kv-store';
63
- import { openTmpStore } from '@aztec/kv-store/utils';
64
+ import { openTmpStore } from '@aztec/kv-store/lmdb';
64
65
  import { SHA256Trunc, StandardTree, UnbalancedTree } from '@aztec/merkle-tree';
65
66
  import {
66
67
  AggregateTxValidator,
@@ -74,7 +75,7 @@ import {
74
75
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
75
76
  import { GlobalVariableBuilder, type L1Publisher, SequencerClient } from '@aztec/sequencer-client';
76
77
  import { PublicProcessorFactory } from '@aztec/simulator';
77
- import { type TelemetryClient } from '@aztec/telemetry-client';
78
+ import { Attributes, type TelemetryClient, type Traceable, type Tracer, trackSpan } from '@aztec/telemetry-client';
78
79
  import { NoopTelemetryClient } from '@aztec/telemetry-client/noop';
79
80
  import { createValidatorClient } from '@aztec/validator-client';
80
81
  import { createWorldStateSynchronizer } from '@aztec/world-state';
@@ -85,11 +86,12 @@ import { NodeMetrics } from './node_metrics.js';
85
86
  /**
86
87
  * The aztec node.
87
88
  */
88
- export class AztecNodeService implements AztecNode {
89
+ export class AztecNodeService implements AztecNode, Traceable {
89
90
  private packageVersion: string;
90
-
91
91
  private metrics: NodeMetrics;
92
92
 
93
+ public readonly tracer: Tracer;
94
+
93
95
  constructor(
94
96
  protected config: AztecNodeConfig,
95
97
  protected readonly p2pClient: P2P,
@@ -105,18 +107,13 @@ export class AztecNodeService implements AztecNode {
105
107
  protected readonly globalVariableBuilder: GlobalVariableBuilder,
106
108
  private proofVerifier: ClientProtocolCircuitVerifier,
107
109
  private telemetry: TelemetryClient,
108
- private log = createDebugLogger('aztec:node'),
110
+ private log = createLogger('node'),
109
111
  ) {
110
112
  this.packageVersion = getPackageInfo().version;
111
113
  this.metrics = new NodeMetrics(telemetry, 'AztecNodeService');
114
+ this.tracer = telemetry.getTracer('AztecNodeService');
112
115
 
113
- const message =
114
- `Started Aztec Node against chain 0x${l1ChainId.toString(16)} with contracts - \n` +
115
- `Rollup: ${config.l1Contracts.rollupAddress.toString()}\n` +
116
- `Registry: ${config.l1Contracts.registryAddress.toString()}\n` +
117
- `Inbox: ${config.l1Contracts.inboxAddress.toString()}\n` +
118
- `Outbox: ${config.l1Contracts.outboxAddress.toString()}`;
119
- this.log.info(message);
116
+ this.log.info(`Aztec Node started on chain 0x${l1ChainId.toString(16)}`, config.l1Contracts);
120
117
  }
121
118
 
122
119
  public addEpochProofQuote(quote: EpochProofQuote): Promise<void> {
@@ -140,12 +137,14 @@ export class AztecNodeService implements AztecNode {
140
137
  config: AztecNodeConfig,
141
138
  deps: {
142
139
  telemetry?: TelemetryClient;
143
- logger?: DebugLogger;
140
+ logger?: Logger;
144
141
  publisher?: L1Publisher;
142
+ dateProvider?: DateProvider;
145
143
  } = {},
146
144
  ): Promise<AztecNodeService> {
147
145
  const telemetry = deps.telemetry ?? new NoopTelemetryClient();
148
- const log = deps.logger ?? createDebugLogger('aztec:node');
146
+ const log = deps.logger ?? createLogger('node');
147
+ const dateProvider = deps.dateProvider ?? new DateProvider();
149
148
  const ethereumChain = createEthereumChain(config.l1RpcUrl, config.l1ChainId);
150
149
  //validate that the actual chain id matches that specified in configuration
151
150
  if (config.l1ChainId !== ethereumChain.chainInfo.id) {
@@ -158,20 +157,30 @@ export class AztecNodeService implements AztecNode {
158
157
 
159
158
  // we identify the P2P transaction protocol by using the rollup contract address.
160
159
  // this may well change in future
161
- config.transactionProtocol = `/aztec/tx/${config.l1Contracts.rollupAddress.toString()}`;
160
+ const rollupAddress = config.l1Contracts.rollupAddress;
161
+ config.transactionProtocol = `/aztec/tx/${rollupAddress.toString()}`;
162
162
 
163
163
  // now create the merkle trees and the world state synchronizer
164
164
  const worldStateSynchronizer = await createWorldStateSynchronizer(config, archiver, telemetry);
165
165
  const proofVerifier = config.realProofs ? await BBCircuitVerifier.new(config) : new TestCircuitVerifier();
166
- log.info(`Aztec node accepting ${config.realProofs ? 'real' : 'test'} proofs`);
166
+ if (!config.realProofs) {
167
+ log.warn(`Aztec node is accepting fake proofs`);
168
+ }
167
169
 
168
170
  // create the tx pool and the p2p client, which will need the l2 block source
169
- const p2pClient = await createP2PClient(config, archiver, proofVerifier, worldStateSynchronizer, telemetry);
171
+ const p2pClient = await createP2PClient(
172
+ P2PClientType.Full,
173
+ config,
174
+ archiver,
175
+ proofVerifier,
176
+ worldStateSynchronizer,
177
+ telemetry,
178
+ );
170
179
 
171
180
  // start both and wait for them to sync from the block source
172
181
  await Promise.all([p2pClient.start(), worldStateSynchronizer.start()]);
173
182
 
174
- const validatorClient = await createValidatorClient(config, config.l1Contracts.rollupAddress, p2pClient, telemetry);
183
+ const validatorClient = await createValidatorClient(config, rollupAddress, { p2pClient, telemetry, dateProvider });
175
184
 
176
185
  // now create the sequencer
177
186
  const sequencer = config.disableValidator
@@ -218,6 +227,10 @@ export class AztecNodeService implements AztecNode {
218
227
  return this.blockSource;
219
228
  }
220
229
 
230
+ public getP2P(): P2P {
231
+ return this.p2pClient;
232
+ }
233
+
221
234
  /**
222
235
  * Method to return the currently deployed L1 contract addresses.
223
236
  * @returns - The currently deployed L1 contract addresses.
@@ -427,11 +440,12 @@ export class AztecNodeService implements AztecNode {
427
440
  * @returns - The pending txs.
428
441
  */
429
442
  public getPendingTxs() {
430
- return Promise.resolve(this.p2pClient!.getTxs('pending'));
443
+ return this.p2pClient!.getPendingTxs();
431
444
  }
432
445
 
433
- public getPendingTxCount() {
434
- return Promise.resolve(this.p2pClient!.getTxs('pending').length);
446
+ public async getPendingTxCount() {
447
+ const pendingTxs = await this.getPendingTxs();
448
+ return pendingTxs.length;
435
449
  }
436
450
 
437
451
  /**
@@ -456,7 +470,10 @@ export class AztecNodeService implements AztecNode {
456
470
  leafValues: Fr[],
457
471
  ): Promise<(bigint | undefined)[]> {
458
472
  const committedDb = await this.#getWorldState(blockNumber);
459
- return await Promise.all(leafValues.map(leafValue => committedDb.findLeafIndex(treeId, leafValue.toBuffer())));
473
+ return await committedDb.findLeafIndices(
474
+ treeId,
475
+ leafValues.map(x => x.toBuffer()),
476
+ );
460
477
  }
461
478
 
462
479
  /**
@@ -663,7 +680,7 @@ export class AztecNodeService implements AztecNode {
663
680
  nullifier: Fr,
664
681
  ): Promise<NullifierMembershipWitness | undefined> {
665
682
  const db = await this.#getWorldState(blockNumber);
666
- const index = await db.findLeafIndex(MerkleTreeId.NULLIFIER_TREE, nullifier.toBuffer());
683
+ const index = (await db.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, [nullifier.toBuffer()]))[0];
667
684
  if (!index) {
668
685
  return undefined;
669
686
  }
@@ -767,7 +784,7 @@ export class AztecNodeService implements AztecNode {
767
784
  * Returns the currently committed block header, or the initial header if no blocks have been produced.
768
785
  * @returns The current committed block header.
769
786
  */
770
- public async getBlockHeader(blockNumber: L2BlockNumber = 'latest'): Promise<Header> {
787
+ public async getBlockHeader(blockNumber: L2BlockNumber = 'latest'): Promise<BlockHeader> {
771
788
  return (
772
789
  (await this.getBlock(blockNumber === 'latest' ? -1 : blockNumber))?.header ??
773
790
  this.worldStateSynchronizer.getCommitted().getInitialHeader()
@@ -778,8 +795,11 @@ export class AztecNodeService implements AztecNode {
778
795
  * Simulates the public part of a transaction with the current state.
779
796
  * @param tx - The transaction to simulate.
780
797
  **/
798
+ @trackSpan('AztecNodeService.simulatePublicCalls', (tx: Tx) => ({
799
+ [Attributes.TX_HASH]: tx.tryGetTxHash()?.toString(),
800
+ }))
781
801
  public async simulatePublicCalls(tx: Tx): Promise<PublicSimulationOutput> {
782
- this.log.info(`Simulating tx ${tx.getTxHash()}`);
802
+ const txHash = tx.getTxHash();
783
803
  const blockNumber = (await this.blockSource.getBlockNumber()) + 1;
784
804
 
785
805
  // If sequencer is not initialized, we just set these values to zero for simulation.
@@ -793,9 +813,14 @@ export class AztecNodeService implements AztecNode {
793
813
  );
794
814
  const prevHeader = (await this.blockSource.getBlock(-1))?.header;
795
815
  const publicProcessorFactory = new PublicProcessorFactory(this.contractDataSource, this.telemetry);
796
-
797
816
  const fork = await this.worldStateSynchronizer.fork();
798
817
 
818
+ this.log.verbose(`Simulating public calls for tx ${tx.getTxHash()}`, {
819
+ globalVariables: newGlobalVariables.toInspect(),
820
+ txHash,
821
+ blockNumber,
822
+ });
823
+
799
824
  try {
800
825
  const processor = publicProcessorFactory.create(fork, prevHeader, newGlobalVariables);
801
826
 
@@ -803,13 +828,11 @@ export class AztecNodeService implements AztecNode {
803
828
  const [processedTxs, failedTxs, returns] = await processor.process([tx]);
804
829
  // REFACTOR: Consider returning the error rather than throwing
805
830
  if (failedTxs.length) {
806
- this.log.warn(`Simulated tx ${tx.getTxHash()} fails: ${failedTxs[0].error}`);
831
+ this.log.warn(`Simulated tx ${tx.getTxHash()} fails: ${failedTxs[0].error}`, { txHash });
807
832
  throw failedTxs[0].error;
808
833
  }
809
834
 
810
835
  const [processedTx] = processedTxs;
811
- this.log.debug(`Simulated tx ${tx.getTxHash()} ${processedTx.revertReason ? 'Reverts' : 'Succeeds'}`);
812
-
813
836
  return new PublicSimulationOutput(
814
837
  processedTx.revertReason,
815
838
  processedTx.constants,
@@ -832,9 +855,7 @@ export class AztecNodeService implements AztecNode {
832
855
  new DataTxValidator(),
833
856
  new MetadataTxValidator(new Fr(this.l1ChainId), new Fr(blockNumber)),
834
857
  new DoubleSpendTxValidator({
835
- getNullifierIndex(nullifier) {
836
- return db.findLeafIndex(MerkleTreeId.NULLIFIER_TREE, nullifier.toBuffer());
837
- },
858
+ getNullifierIndices: nullifiers => db.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, nullifiers),
838
859
  }),
839
860
  ];
840
861
 
package/src/bin/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env -S node --no-warnings
2
- import { createDebugLogger } from '@aztec/foundation/log';
2
+ import { createLogger } from '@aztec/foundation/log';
3
3
 
4
4
  import http from 'http';
5
5
 
@@ -7,7 +7,7 @@ import { type AztecNodeConfig, AztecNodeService, createAztecNodeRpcServer, getCo
7
7
 
8
8
  const { AZTEC_NODE_PORT = 8081, API_PREFIX = '' } = process.env;
9
9
 
10
- const logger = createDebugLogger('aztec:node');
10
+ const logger = createLogger('node');
11
11
 
12
12
  /**
13
13
  * Creates the node from provided config