@aztec/aztec-node 0.67.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/aztec-node/config.d.ts +6 -6
- package/dest/aztec-node/config.d.ts.map +1 -1
- package/dest/aztec-node/config.js +7 -7
- package/dest/aztec-node/server.d.ts +5 -2
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +674 -656
- package/package.json +22 -19
- package/src/aztec-node/config.ts +6 -6
- package/src/aztec-node/server.ts +29 -12
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec-node",
|
|
3
|
-
"version": "0.67.
|
|
3
|
+
"version": "0.67.1-devnet",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"exports":
|
|
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": [
|
|
@@ -64,23 +67,23 @@
|
|
|
64
67
|
]
|
|
65
68
|
},
|
|
66
69
|
"dependencies": {
|
|
67
|
-
"@aztec/archiver": "0.67.
|
|
68
|
-
"@aztec/bb-prover": "0.67.
|
|
69
|
-
"@aztec/circuit-types": "0.67.
|
|
70
|
-
"@aztec/circuits.js": "0.67.
|
|
71
|
-
"@aztec/ethereum": "0.67.
|
|
72
|
-
"@aztec/foundation": "0.67.
|
|
73
|
-
"@aztec/kv-store": "0.67.
|
|
74
|
-
"@aztec/merkle-tree": "0.67.
|
|
75
|
-
"@aztec/p2p": "0.67.
|
|
76
|
-
"@aztec/protocol-contracts": "0.67.
|
|
77
|
-
"@aztec/prover-client": "0.67.
|
|
78
|
-
"@aztec/sequencer-client": "0.67.
|
|
79
|
-
"@aztec/simulator": "0.67.
|
|
80
|
-
"@aztec/telemetry-client": "0.67.
|
|
81
|
-
"@aztec/types": "0.67.
|
|
82
|
-
"@aztec/validator-client": "0.67.
|
|
83
|
-
"@aztec/world-state": "0.67.
|
|
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",
|
|
84
87
|
"koa": "^2.14.2",
|
|
85
88
|
"koa-router": "^12.0.0",
|
|
86
89
|
"tslib": "^2.4.0"
|
package/src/aztec-node/config.ts
CHANGED
|
@@ -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';
|
package/src/aztec-node/server.ts
CHANGED
|
@@ -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,
|
|
@@ -58,7 +59,7 @@ 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
61
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
61
|
-
import { Timer } from '@aztec/foundation/timer';
|
|
62
|
+
import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
62
63
|
import { type AztecKVStore } from '@aztec/kv-store';
|
|
63
64
|
import { openTmpStore } from '@aztec/kv-store/lmdb';
|
|
64
65
|
import { SHA256Trunc, StandardTree, UnbalancedTree } from '@aztec/merkle-tree';
|
|
@@ -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,
|
|
@@ -109,6 +111,7 @@ export class AztecNodeService implements AztecNode {
|
|
|
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
116
|
this.log.info(`Aztec Node started on chain 0x${l1ChainId.toString(16)}`, config.l1Contracts);
|
|
114
117
|
}
|
|
@@ -136,10 +139,12 @@ export class AztecNodeService implements AztecNode {
|
|
|
136
139
|
telemetry?: TelemetryClient;
|
|
137
140
|
logger?: Logger;
|
|
138
141
|
publisher?: L1Publisher;
|
|
142
|
+
dateProvider?: DateProvider;
|
|
139
143
|
} = {},
|
|
140
144
|
): Promise<AztecNodeService> {
|
|
141
145
|
const telemetry = deps.telemetry ?? new NoopTelemetryClient();
|
|
142
146
|
const log = deps.logger ?? createLogger('node');
|
|
147
|
+
const dateProvider = deps.dateProvider ?? new DateProvider();
|
|
143
148
|
const ethereumChain = createEthereumChain(config.l1RpcUrl, config.l1ChainId);
|
|
144
149
|
//validate that the actual chain id matches that specified in configuration
|
|
145
150
|
if (config.l1ChainId !== ethereumChain.chainInfo.id) {
|
|
@@ -152,7 +157,8 @@ export class AztecNodeService implements AztecNode {
|
|
|
152
157
|
|
|
153
158
|
// we identify the P2P transaction protocol by using the rollup contract address.
|
|
154
159
|
// this may well change in future
|
|
155
|
-
|
|
160
|
+
const rollupAddress = config.l1Contracts.rollupAddress;
|
|
161
|
+
config.transactionProtocol = `/aztec/tx/${rollupAddress.toString()}`;
|
|
156
162
|
|
|
157
163
|
// now create the merkle trees and the world state synchronizer
|
|
158
164
|
const worldStateSynchronizer = await createWorldStateSynchronizer(config, archiver, telemetry);
|
|
@@ -162,12 +168,19 @@ export class AztecNodeService implements AztecNode {
|
|
|
162
168
|
}
|
|
163
169
|
|
|
164
170
|
// create the tx pool and the p2p client, which will need the l2 block source
|
|
165
|
-
const p2pClient = await createP2PClient(
|
|
171
|
+
const p2pClient = await createP2PClient(
|
|
172
|
+
P2PClientType.Full,
|
|
173
|
+
config,
|
|
174
|
+
archiver,
|
|
175
|
+
proofVerifier,
|
|
176
|
+
worldStateSynchronizer,
|
|
177
|
+
telemetry,
|
|
178
|
+
);
|
|
166
179
|
|
|
167
180
|
// start both and wait for them to sync from the block source
|
|
168
181
|
await Promise.all([p2pClient.start(), worldStateSynchronizer.start()]);
|
|
169
182
|
|
|
170
|
-
const validatorClient = await createValidatorClient(config,
|
|
183
|
+
const validatorClient = await createValidatorClient(config, rollupAddress, { p2pClient, telemetry, dateProvider });
|
|
171
184
|
|
|
172
185
|
// now create the sequencer
|
|
173
186
|
const sequencer = config.disableValidator
|
|
@@ -457,7 +470,10 @@ export class AztecNodeService implements AztecNode {
|
|
|
457
470
|
leafValues: Fr[],
|
|
458
471
|
): Promise<(bigint | undefined)[]> {
|
|
459
472
|
const committedDb = await this.#getWorldState(blockNumber);
|
|
460
|
-
return await
|
|
473
|
+
return await committedDb.findLeafIndices(
|
|
474
|
+
treeId,
|
|
475
|
+
leafValues.map(x => x.toBuffer()),
|
|
476
|
+
);
|
|
461
477
|
}
|
|
462
478
|
|
|
463
479
|
/**
|
|
@@ -664,7 +680,7 @@ export class AztecNodeService implements AztecNode {
|
|
|
664
680
|
nullifier: Fr,
|
|
665
681
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
666
682
|
const db = await this.#getWorldState(blockNumber);
|
|
667
|
-
const index = await db.
|
|
683
|
+
const index = (await db.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, [nullifier.toBuffer()]))[0];
|
|
668
684
|
if (!index) {
|
|
669
685
|
return undefined;
|
|
670
686
|
}
|
|
@@ -779,6 +795,9 @@ export class AztecNodeService implements AztecNode {
|
|
|
779
795
|
* Simulates the public part of a transaction with the current state.
|
|
780
796
|
* @param tx - The transaction to simulate.
|
|
781
797
|
**/
|
|
798
|
+
@trackSpan('AztecNodeService.simulatePublicCalls', (tx: Tx) => ({
|
|
799
|
+
[Attributes.TX_HASH]: tx.tryGetTxHash()?.toString(),
|
|
800
|
+
}))
|
|
782
801
|
public async simulatePublicCalls(tx: Tx): Promise<PublicSimulationOutput> {
|
|
783
802
|
const txHash = tx.getTxHash();
|
|
784
803
|
const blockNumber = (await this.blockSource.getBlockNumber()) + 1;
|
|
@@ -836,9 +855,7 @@ export class AztecNodeService implements AztecNode {
|
|
|
836
855
|
new DataTxValidator(),
|
|
837
856
|
new MetadataTxValidator(new Fr(this.l1ChainId), new Fr(blockNumber)),
|
|
838
857
|
new DoubleSpendTxValidator({
|
|
839
|
-
|
|
840
|
-
return db.findLeafIndex(MerkleTreeId.NULLIFIER_TREE, nullifier.toBuffer());
|
|
841
|
-
},
|
|
858
|
+
getNullifierIndices: nullifiers => db.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, nullifiers),
|
|
842
859
|
}),
|
|
843
860
|
];
|
|
844
861
|
|