@aztec/aztec-node 0.80.0 → 0.82.0
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 +3 -0
- package/dest/aztec-node/config.d.ts.map +1 -1
- package/dest/aztec-node/config.js +6 -1
- package/dest/aztec-node/server.d.ts +14 -22
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +78 -54
- package/package.json +19 -19
- package/src/aztec-node/config.ts +8 -1
- package/src/aztec-node/server.ts +91 -66
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ArchiverConfig } from '@aztec/archiver/config';
|
|
2
|
+
import { type L1ContractAddresses } from '@aztec/ethereum';
|
|
2
3
|
import { type ConfigMappingsType } from '@aztec/foundation/config';
|
|
3
4
|
import { type DataStoreConfig } from '@aztec/kv-store/config';
|
|
4
5
|
import { type P2PConfig } from '@aztec/p2p/config';
|
|
@@ -15,6 +16,8 @@ export type AztecNodeConfig = ArchiverConfig & SequencerClientConfig & Validator
|
|
|
15
16
|
disableValidator: boolean;
|
|
16
17
|
/** Whether to populate the genesis state with initial fee juice for the test accounts */
|
|
17
18
|
testAccounts: boolean;
|
|
19
|
+
} & {
|
|
20
|
+
l1Contracts: L1ContractAddresses;
|
|
18
21
|
};
|
|
19
22
|
export declare const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig>;
|
|
20
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/aztec-node/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAA0B,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,KAAK,kBAAkB,EAA8C,MAAM,0BAA0B,CAAC;AAC/G,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,mBAAmB,CAAC;A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,MAAM,gCAAgC,CAAC;AAC3G,OAAO,EAAE,KAAK,gBAAgB,EAA4B,MAAM,2BAA2B,CAAC;AAM5F,OAAO,EAAE,6BAA6B,EAAE,KAAK,qBAAqB,EAAE,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,GAC1C,qBAAqB,GACrB,qBAAqB,GACrB,kBAAkB,GAClB,gBAAgB,GAChB,IAAI,CAAC,kBAAkB,EAAE,cAAc,GAAG,oBAAoB,GAAG,YAAY,CAAC,GAC9E,SAAS,GACT,eAAe,GAAG;IAChB,sDAAsD;IACtD,gBAAgB,EAAE,OAAO,CAAC;IAC1B,yFAAyF;IACzF,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG;IACF,WAAW,EAAE,mBAAmB,CAAC;CAClC,CAAC;AAEJ,eAAO,MAAM,uBAAuB,EAAE,kBAAkB,CAAC,eAAe,CAsBvE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,CAElD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,QAOhC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { archiverConfigMappings } from '@aztec/archiver/config';
|
|
2
|
+
import { l1ContractAddressesMapping } from '@aztec/ethereum';
|
|
2
3
|
import { booleanConfigHelper, getConfigFromMappings } from '@aztec/foundation/config';
|
|
3
4
|
import { dataConfigMappings } from '@aztec/kv-store/config';
|
|
4
5
|
import { p2pConfigMappings } from '@aztec/p2p/config';
|
|
@@ -11,13 +12,17 @@ import { dirname, resolve } from 'path';
|
|
|
11
12
|
import { fileURLToPath } from 'url';
|
|
12
13
|
export { sequencerClientConfigMappings };
|
|
13
14
|
export const aztecNodeConfigMappings = {
|
|
15
|
+
...dataConfigMappings,
|
|
14
16
|
...archiverConfigMappings,
|
|
15
17
|
...sequencerClientConfigMappings,
|
|
16
18
|
...validatorClientConfigMappings,
|
|
17
19
|
...proverClientConfigMappings,
|
|
18
20
|
...worldStateConfigMappings,
|
|
19
21
|
...p2pConfigMappings,
|
|
20
|
-
|
|
22
|
+
l1Contracts: {
|
|
23
|
+
description: 'The deployed L1 contract addresses',
|
|
24
|
+
nested: l1ContractAddressesMapping
|
|
25
|
+
},
|
|
21
26
|
disableValidator: {
|
|
22
27
|
env: 'VALIDATOR_DISABLED',
|
|
23
28
|
description: 'Whether the validator is disabled for this node.',
|
|
@@ -8,22 +8,22 @@ import { SiblingPath } from '@aztec/foundation/trees';
|
|
|
8
8
|
import { type P2P } from '@aztec/p2p';
|
|
9
9
|
import { GlobalVariableBuilder, SequencerClient, type SequencerPublisher } from '@aztec/sequencer-client';
|
|
10
10
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
|
-
import type { InBlock, L2Block, L2BlockNumber, L2BlockSource,
|
|
11
|
+
import type { InBlock, L2Block, L2BlockNumber, L2BlockSource, PublishedL2Block } from '@aztec/stdlib/block';
|
|
12
12
|
import type { ContractClassPublic, ContractDataSource, ContractInstanceWithAddress, NodeInfo, ProtocolContractAddresses } from '@aztec/stdlib/contract';
|
|
13
13
|
import type { GasFees } from '@aztec/stdlib/gas';
|
|
14
|
-
import type { AztecNode, GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
|
|
14
|
+
import type { AztecNode, AztecNodeAdmin, GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
|
|
15
15
|
import { type ClientProtocolCircuitVerifier, type L2LogsSource, type ProverConfig, type SequencerConfig, type Service, type WorldStateSyncStatus, type WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
16
16
|
import type { LogFilter, PrivateLog, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
17
17
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
18
|
-
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
19
18
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
19
|
+
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
20
20
|
import { type BlockHeader, PublicSimulationOutput, Tx, TxEffect, type TxHash, TxReceipt, type TxValidationResult } from '@aztec/stdlib/tx';
|
|
21
21
|
import { type TelemetryClient, type Traceable, type Tracer } from '@aztec/telemetry-client';
|
|
22
22
|
import { type AztecNodeConfig } from './config.js';
|
|
23
23
|
/**
|
|
24
24
|
* The aztec node.
|
|
25
25
|
*/
|
|
26
|
-
export declare class AztecNodeService implements AztecNode, Traceable {
|
|
26
|
+
export declare class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
27
27
|
#private;
|
|
28
28
|
protected config: AztecNodeConfig;
|
|
29
29
|
protected readonly p2pClient: P2P;
|
|
@@ -31,7 +31,6 @@ export declare class AztecNodeService implements AztecNode, Traceable {
|
|
|
31
31
|
protected readonly logsSource: L2LogsSource;
|
|
32
32
|
protected readonly contractDataSource: ContractDataSource;
|
|
33
33
|
protected readonly l1ToL2MessageSource: L1ToL2MessageSource;
|
|
34
|
-
protected readonly nullifierSource: NullifierWithBlockSource;
|
|
35
34
|
protected readonly worldStateSynchronizer: WorldStateSynchronizer;
|
|
36
35
|
protected readonly sequencer: SequencerClient | undefined;
|
|
37
36
|
protected readonly l1ChainId: number;
|
|
@@ -42,8 +41,9 @@ export declare class AztecNodeService implements AztecNode, Traceable {
|
|
|
42
41
|
private log;
|
|
43
42
|
private packageVersion;
|
|
44
43
|
private metrics;
|
|
44
|
+
private txQueue;
|
|
45
45
|
readonly tracer: Tracer;
|
|
46
|
-
constructor(config: AztecNodeConfig, p2pClient: P2P, blockSource: L2BlockSource & Partial<Service>, logsSource: L2LogsSource, contractDataSource: ContractDataSource, l1ToL2MessageSource: L1ToL2MessageSource,
|
|
46
|
+
constructor(config: AztecNodeConfig, p2pClient: P2P, blockSource: L2BlockSource & Partial<Service>, logsSource: L2LogsSource, contractDataSource: ContractDataSource, l1ToL2MessageSource: L1ToL2MessageSource, worldStateSynchronizer: WorldStateSynchronizer, sequencer: SequencerClient | undefined, l1ChainId: number, version: number, globalVariableBuilder: GlobalVariableBuilder, proofVerifier: ClientProtocolCircuitVerifier, telemetry?: TelemetryClient, log?: Logger);
|
|
47
47
|
getWorldStateSyncStatus(): Promise<WorldStateSyncStatus>;
|
|
48
48
|
getL2Tips(): Promise<import("@aztec/stdlib/block").L2Tips>;
|
|
49
49
|
/**
|
|
@@ -93,6 +93,7 @@ export declare class AztecNodeService implements AztecNode, Traceable {
|
|
|
93
93
|
* @returns The blocks requested.
|
|
94
94
|
*/
|
|
95
95
|
getBlocks(from: number, limit: number): Promise<L2Block[]>;
|
|
96
|
+
getPublishedBlocks(from: number, limit: number): Promise<PublishedL2Block[]>;
|
|
96
97
|
/**
|
|
97
98
|
* Method to fetch the current base fees.
|
|
98
99
|
* @returns The current base fees.
|
|
@@ -177,22 +178,14 @@ export declare class AztecNodeService implements AztecNode, Traceable {
|
|
|
177
178
|
*/
|
|
178
179
|
getTxsByHash(txHashes: TxHash[]): Promise<Tx[]>;
|
|
179
180
|
/**
|
|
180
|
-
* Find the indexes of the given leaves in the given tree
|
|
181
|
-
*
|
|
182
|
-
* @param
|
|
183
|
-
* @param leafValue - The values to search for
|
|
184
|
-
* @returns The indexes of the given leaves in the given tree or undefined if not found.
|
|
185
|
-
*/
|
|
186
|
-
findLeavesIndexes(blockNumber: L2BlockNumber, treeId: MerkleTreeId, leafValues: Fr[]): Promise<(bigint | undefined)[]>;
|
|
187
|
-
/**
|
|
188
|
-
* Find the block numbers of the given leaf indices in the given tree.
|
|
189
|
-
* @param blockNumber - The block number at which to get the data or 'latest' for latest data
|
|
181
|
+
* Find the indexes of the given leaves in the given tree along with a block metadata pointing to the block in which
|
|
182
|
+
* the leaves were inserted.
|
|
183
|
+
* @param blockNumber - The block number at which to get the data or 'latest' for latest data.
|
|
190
184
|
* @param treeId - The tree to search in.
|
|
191
|
-
* @param
|
|
192
|
-
* @returns The
|
|
185
|
+
* @param leafValues - The values to search for.
|
|
186
|
+
* @returns The indices of leaves and the block metadata of a block in which the leaves were inserted.
|
|
193
187
|
*/
|
|
194
|
-
|
|
195
|
-
findNullifiersIndexesWithBlock(blockNumber: L2BlockNumber, nullifiers: Fr[]): Promise<(InBlock<bigint> | undefined)[]>;
|
|
188
|
+
findLeavesIndexes(blockNumber: L2BlockNumber, treeId: MerkleTreeId, leafValues: Fr[]): Promise<(InBlock<bigint> | undefined)[]>;
|
|
196
189
|
/**
|
|
197
190
|
* Returns a sibling path for the given index in the nullifier tree.
|
|
198
191
|
* @param blockNumber - The block number at which to get the data.
|
|
@@ -267,7 +260,7 @@ export declare class AztecNodeService implements AztecNode, Traceable {
|
|
|
267
260
|
* TODO: This is a confusing behavior and we should eventually address that.
|
|
268
261
|
*/
|
|
269
262
|
getLowNullifierMembershipWitness(blockNumber: L2BlockNumber, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
|
|
270
|
-
|
|
263
|
+
getPublicDataWitness(blockNumber: L2BlockNumber, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
271
264
|
/**
|
|
272
265
|
* Gets the storage value at the given contract storage slot.
|
|
273
266
|
*
|
|
@@ -296,7 +289,6 @@ export declare class AztecNodeService implements AztecNode, Traceable {
|
|
|
296
289
|
}): Promise<TxValidationResult>;
|
|
297
290
|
setConfig(config: Partial<SequencerConfig & ProverConfig>): Promise<void>;
|
|
298
291
|
getProtocolContractAddresses(): Promise<ProtocolContractAddresses>;
|
|
299
|
-
addContractClass(contractClass: ContractClassPublic): Promise<void>;
|
|
300
292
|
registerContractFunctionSignatures(_address: AztecAddress, signatures: string[]): Promise<void>;
|
|
301
293
|
flushTxs(): Promise<void>;
|
|
302
294
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/aztec-node/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CA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mB,CAAC,EAAE,EAAE,EAAE,EAAE,kBAAkB,UAAQ,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAkDxF,SAAS,CACpB,EAAE,EAAE,EAAE,EACN,EAAE,YAAY,EAAE,kBAAkB,EAAE,GAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;KAAO,GAClG,OAAO,CAAC,kBAAkB,CAAC;IAejB,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,GAAG,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAW/E,4BAA4B,IAAI,OAAO,CAAC,yBAAyB,CAAC;IASlE,kCAAkC,CAAC,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/F,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CA8CjC"}
|
|
@@ -7,13 +7,14 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
7
7
|
import { createArchiver } from '@aztec/archiver';
|
|
8
8
|
import { BBCircuitVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
|
|
9
9
|
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
10
|
-
import { INITIAL_L2_BLOCK_NUM
|
|
10
|
+
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
11
11
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
12
12
|
import { createEthereumChain } from '@aztec/ethereum';
|
|
13
13
|
import { compactArray } from '@aztec/foundation/collection';
|
|
14
14
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
15
15
|
import { Fr } from '@aztec/foundation/fields';
|
|
16
16
|
import { createLogger } from '@aztec/foundation/log';
|
|
17
|
+
import { SerialQueue } from '@aztec/foundation/queue';
|
|
17
18
|
import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
18
19
|
import { SiblingPath } from '@aztec/foundation/trees';
|
|
19
20
|
import { openTmpStore } from '@aztec/kv-store/lmdb';
|
|
@@ -23,7 +24,7 @@ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
|
23
24
|
import { GlobalVariableBuilder, SequencerClient, createSlasherClient, createValidatorForAcceptingTxs, getDefaultAllowedSetupFunctions } from '@aztec/sequencer-client';
|
|
24
25
|
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
25
26
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
26
|
-
import { computePublicDataTreeLeafSlot
|
|
27
|
+
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
27
28
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
28
29
|
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
29
30
|
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
@@ -42,7 +43,6 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
42
43
|
logsSource;
|
|
43
44
|
contractDataSource;
|
|
44
45
|
l1ToL2MessageSource;
|
|
45
|
-
nullifierSource;
|
|
46
46
|
worldStateSynchronizer;
|
|
47
47
|
sequencer;
|
|
48
48
|
l1ChainId;
|
|
@@ -53,15 +53,16 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
53
53
|
log;
|
|
54
54
|
packageVersion;
|
|
55
55
|
metrics;
|
|
56
|
+
// Serial queue to ensure that we only send one tx at a time
|
|
57
|
+
txQueue;
|
|
56
58
|
tracer;
|
|
57
|
-
constructor(config, p2pClient, blockSource, logsSource, contractDataSource, l1ToL2MessageSource,
|
|
59
|
+
constructor(config, p2pClient, blockSource, logsSource, contractDataSource, l1ToL2MessageSource, worldStateSynchronizer, sequencer, l1ChainId, version, globalVariableBuilder, proofVerifier, telemetry = getTelemetryClient(), log = createLogger('node')){
|
|
58
60
|
this.config = config;
|
|
59
61
|
this.p2pClient = p2pClient;
|
|
60
62
|
this.blockSource = blockSource;
|
|
61
63
|
this.logsSource = logsSource;
|
|
62
64
|
this.contractDataSource = contractDataSource;
|
|
63
65
|
this.l1ToL2MessageSource = l1ToL2MessageSource;
|
|
64
|
-
this.nullifierSource = nullifierSource;
|
|
65
66
|
this.worldStateSynchronizer = worldStateSynchronizer;
|
|
66
67
|
this.sequencer = sequencer;
|
|
67
68
|
this.l1ChainId = l1ChainId;
|
|
@@ -70,9 +71,11 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
70
71
|
this.proofVerifier = proofVerifier;
|
|
71
72
|
this.telemetry = telemetry;
|
|
72
73
|
this.log = log;
|
|
74
|
+
this.txQueue = new SerialQueue();
|
|
73
75
|
this.packageVersion = getPackageVersion();
|
|
74
76
|
this.metrics = new NodeMetrics(telemetry, 'AztecNodeService');
|
|
75
77
|
this.tracer = telemetry.getTracer('AztecNodeService');
|
|
78
|
+
this.txQueue.start();
|
|
76
79
|
this.log.info(`Aztec Node version: ${this.packageVersion}`);
|
|
77
80
|
this.log.info(`Aztec Node started on chain 0x${l1ChainId.toString(16)}`, config.l1Contracts);
|
|
78
81
|
}
|
|
@@ -139,7 +142,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
139
142
|
dateProvider,
|
|
140
143
|
blobSinkClient
|
|
141
144
|
});
|
|
142
|
-
return new AztecNodeService(config, p2pClient, archiver, archiver, archiver, archiver,
|
|
145
|
+
return new AztecNodeService(config, p2pClient, archiver, archiver, archiver, archiver, worldStateSynchronizer, sequencer, ethereumChain.chainInfo.id, config.version, new GlobalVariableBuilder(config), proofVerifier, telemetry, log);
|
|
143
146
|
}
|
|
144
147
|
/**
|
|
145
148
|
* Returns the sequencer client instance.
|
|
@@ -205,6 +208,9 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
205
208
|
*/ async getBlocks(from, limit) {
|
|
206
209
|
return await this.blockSource.getBlocks(from, limit) ?? [];
|
|
207
210
|
}
|
|
211
|
+
async getPublishedBlocks(from, limit) {
|
|
212
|
+
return await this.blockSource.getPublishedBlocks(from, limit) ?? [];
|
|
213
|
+
}
|
|
208
214
|
/**
|
|
209
215
|
* Method to fetch the current base fees.
|
|
210
216
|
* @returns The current base fees.
|
|
@@ -238,25 +244,8 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
238
244
|
*/ getChainId() {
|
|
239
245
|
return Promise.resolve(this.l1ChainId);
|
|
240
246
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
// TODO(#10007): Remove this check. This is needed only because we're manually registering
|
|
244
|
-
// some contracts in the archiver so they are available to all nodes (see `registerCommonContracts`
|
|
245
|
-
// in `archiver/src/factory.ts`), but we still want clients to send the registration tx in order
|
|
246
|
-
// to emit the corresponding nullifier, which is now being checked. Note that this method
|
|
247
|
-
// is only called by the PXE to check if a contract is publicly registered.
|
|
248
|
-
if (klazz) {
|
|
249
|
-
const classNullifier = await siloNullifier(AztecAddress.fromNumber(REGISTERER_CONTRACT_ADDRESS), id);
|
|
250
|
-
const worldState = await this.#getWorldState('latest');
|
|
251
|
-
const [index] = await worldState.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, [
|
|
252
|
-
classNullifier.toBuffer()
|
|
253
|
-
]);
|
|
254
|
-
this.log.debug(`Registration nullifier ${classNullifier} for contract class ${id} found at index ${index}`);
|
|
255
|
-
if (index === undefined) {
|
|
256
|
-
return undefined;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
return klazz;
|
|
247
|
+
getContractClass(id) {
|
|
248
|
+
return this.contractDataSource.getContractClass(id);
|
|
260
249
|
}
|
|
261
250
|
getContract(address) {
|
|
262
251
|
return this.contractDataSource.getContract(address);
|
|
@@ -295,6 +284,15 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
295
284
|
* Method to submit a transaction to the p2p pool.
|
|
296
285
|
* @param tx - The transaction to be submitted.
|
|
297
286
|
*/ async sendTx(tx) {
|
|
287
|
+
await this.txQueue.put(async ()=>{
|
|
288
|
+
await this.#sendTx(tx);
|
|
289
|
+
}).catch((error)=>{
|
|
290
|
+
this.log.error(`Error sending tx`, {
|
|
291
|
+
error
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
async #sendTx(tx) {
|
|
298
296
|
const timer = new Timer();
|
|
299
297
|
const txHash = (await tx.getTxHash()).toString();
|
|
300
298
|
const valid = await this.isValidTx(tx);
|
|
@@ -335,6 +333,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
335
333
|
* Method to stop the aztec node.
|
|
336
334
|
*/ async stop() {
|
|
337
335
|
this.log.info(`Stopping`);
|
|
336
|
+
await this.txQueue.end();
|
|
338
337
|
await this.sequencer?.stop();
|
|
339
338
|
await this.p2pClient.stop();
|
|
340
339
|
await this.worldStateSynchronizer.stop();
|
|
@@ -367,30 +366,60 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
367
366
|
return compactArray(await Promise.all(txHashes.map((txHash)=>this.getTxByHash(txHash))));
|
|
368
367
|
}
|
|
369
368
|
/**
|
|
370
|
-
* Find the indexes of the given leaves in the given tree
|
|
371
|
-
*
|
|
369
|
+
* Find the indexes of the given leaves in the given tree along with a block metadata pointing to the block in which
|
|
370
|
+
* the leaves were inserted.
|
|
371
|
+
* @param blockNumber - The block number at which to get the data or 'latest' for latest data.
|
|
372
372
|
* @param treeId - The tree to search in.
|
|
373
|
-
* @param
|
|
374
|
-
* @returns The
|
|
373
|
+
* @param leafValues - The values to search for.
|
|
374
|
+
* @returns The indices of leaves and the block metadata of a block in which the leaves were inserted.
|
|
375
375
|
*/ async findLeavesIndexes(blockNumber, treeId, leafValues) {
|
|
376
376
|
const committedDb = await this.#getWorldState(blockNumber);
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
return await committedDb.getBlockNumbersForLeafIndices(treeId, leafIndices);
|
|
388
|
-
}
|
|
389
|
-
async findNullifiersIndexesWithBlock(blockNumber, nullifiers) {
|
|
390
|
-
if (blockNumber === 'latest') {
|
|
391
|
-
blockNumber = await this.getBlockNumber();
|
|
377
|
+
const maybeIndices = await committedDb.findLeafIndices(treeId, leafValues.map((x)=>x.toBuffer()));
|
|
378
|
+
// We filter out undefined values
|
|
379
|
+
const indices = maybeIndices.filter((x)=>x !== undefined);
|
|
380
|
+
// Now we find the block numbers for the indices
|
|
381
|
+
const blockNumbers = await committedDb.getBlockNumbersForLeafIndices(treeId, indices);
|
|
382
|
+
// If any of the block numbers are undefined, we throw an error.
|
|
383
|
+
for(let i = 0; i < indices.length; i++){
|
|
384
|
+
if (blockNumbers[i] === undefined) {
|
|
385
|
+
throw new Error(`Block number is undefined for leaf index ${indices[i]} in tree ${MerkleTreeId[treeId]}`);
|
|
386
|
+
}
|
|
392
387
|
}
|
|
393
|
-
|
|
388
|
+
// Get unique block numbers in order to optimize num calls to getLeafValue function.
|
|
389
|
+
const uniqueBlockNumbers = [
|
|
390
|
+
...new Set(blockNumbers.filter((x)=>x !== undefined))
|
|
391
|
+
];
|
|
392
|
+
// Now we obtain the block hashes from the archive tree by calling await `committedDb.getLeafValue(treeId, index)`
|
|
393
|
+
// (note that block number corresponds to the leaf index in the archive tree).
|
|
394
|
+
const blockHashes = await Promise.all(uniqueBlockNumbers.map((blockNumber)=>{
|
|
395
|
+
return committedDb.getLeafValue(MerkleTreeId.ARCHIVE, blockNumber);
|
|
396
|
+
}));
|
|
397
|
+
// If any of the block hashes are undefined, we throw an error.
|
|
398
|
+
for(let i = 0; i < uniqueBlockNumbers.length; i++){
|
|
399
|
+
if (blockHashes[i] === undefined) {
|
|
400
|
+
throw new Error(`Block hash is undefined for block number ${uniqueBlockNumbers[i]}`);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
// Create InBlock objects by combining indices, blockNumbers and blockHashes and return them.
|
|
404
|
+
return maybeIndices.map((index, i)=>{
|
|
405
|
+
if (index === undefined) {
|
|
406
|
+
return undefined;
|
|
407
|
+
}
|
|
408
|
+
const blockNumber = blockNumbers[i];
|
|
409
|
+
if (blockNumber === undefined) {
|
|
410
|
+
return undefined;
|
|
411
|
+
}
|
|
412
|
+
const blockHashIndex = uniqueBlockNumbers.indexOf(blockNumber);
|
|
413
|
+
const blockHash = blockHashes[blockHashIndex]?.toString();
|
|
414
|
+
if (!blockHash) {
|
|
415
|
+
return undefined;
|
|
416
|
+
}
|
|
417
|
+
return {
|
|
418
|
+
l2BlockNumber: Number(blockNumber),
|
|
419
|
+
l2BlockHash: blockHash,
|
|
420
|
+
data: index
|
|
421
|
+
};
|
|
422
|
+
});
|
|
394
423
|
}
|
|
395
424
|
/**
|
|
396
425
|
* Returns a sibling path for the given index in the nullifier tree.
|
|
@@ -564,7 +593,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
564
593
|
const siblingPath = await committedDb.getSiblingPath(MerkleTreeId.NULLIFIER_TREE, BigInt(index));
|
|
565
594
|
return new NullifierMembershipWitness(BigInt(index), preimageData, siblingPath);
|
|
566
595
|
}
|
|
567
|
-
async
|
|
596
|
+
async getPublicDataWitness(blockNumber, leafSlot) {
|
|
568
597
|
const committedDb = await this.#getWorldState(blockNumber);
|
|
569
598
|
const lowLeafResult = await committedDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
|
|
570
599
|
if (!lowLeafResult) {
|
|
@@ -612,14 +641,14 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
612
641
|
const feeRecipient = this.sequencer?.feeRecipient || AztecAddress.ZERO;
|
|
613
642
|
const newGlobalVariables = await this.globalVariableBuilder.buildGlobalVariables(new Fr(blockNumber), coinbase, feeRecipient);
|
|
614
643
|
const publicProcessorFactory = new PublicProcessorFactory(this.contractDataSource, new DateProvider(), this.telemetry);
|
|
615
|
-
const fork = await this.worldStateSynchronizer.fork();
|
|
616
644
|
this.log.verbose(`Simulating public calls for tx ${txHash}`, {
|
|
617
645
|
globalVariables: newGlobalVariables.toInspect(),
|
|
618
646
|
txHash,
|
|
619
647
|
blockNumber
|
|
620
648
|
});
|
|
649
|
+
const merkleTreeFork = await this.worldStateSynchronizer.fork();
|
|
621
650
|
try {
|
|
622
|
-
const processor = publicProcessorFactory.create(
|
|
651
|
+
const processor = publicProcessorFactory.create(merkleTreeFork, newGlobalVariables, skipFeeEnforcement);
|
|
623
652
|
// REFACTOR: Consider merging ProcessReturnValues into ProcessedTx
|
|
624
653
|
const [processedTxs, failedTxs, returns] = await processor.process([
|
|
625
654
|
tx
|
|
@@ -634,7 +663,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
634
663
|
const [processedTx] = processedTxs;
|
|
635
664
|
return new PublicSimulationOutput(processedTx.revertReason, processedTx.constants, processedTx.txEffect, returns, processedTx.gasUsed);
|
|
636
665
|
} finally{
|
|
637
|
-
await
|
|
666
|
+
await merkleTreeFork.close();
|
|
638
667
|
}
|
|
639
668
|
}
|
|
640
669
|
async isValidTx(tx, { isSimulation, skipFeeEnforcement } = {}) {
|
|
@@ -669,11 +698,6 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
669
698
|
multiCallEntrypoint: ProtocolContractAddress.MultiCallEntrypoint
|
|
670
699
|
});
|
|
671
700
|
}
|
|
672
|
-
// TODO(#10007): Remove this method
|
|
673
|
-
addContractClass(contractClass) {
|
|
674
|
-
this.log.info(`Adding contract class via API ${contractClass.id}`);
|
|
675
|
-
return this.contractDataSource.addContractClass(contractClass);
|
|
676
|
-
}
|
|
677
701
|
registerContractFunctionSignatures(_address, signatures) {
|
|
678
702
|
return this.contractDataSource.registerContractFunctionSignatures(_address, signatures);
|
|
679
703
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.0",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -62,24 +62,24 @@
|
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@aztec/archiver": "0.
|
|
66
|
-
"@aztec/bb-prover": "0.
|
|
67
|
-
"@aztec/blob-sink": "0.
|
|
68
|
-
"@aztec/constants": "0.
|
|
69
|
-
"@aztec/epoch-cache": "0.
|
|
70
|
-
"@aztec/ethereum": "0.
|
|
71
|
-
"@aztec/foundation": "0.
|
|
72
|
-
"@aztec/kv-store": "0.
|
|
73
|
-
"@aztec/merkle-tree": "0.
|
|
74
|
-
"@aztec/p2p": "0.
|
|
75
|
-
"@aztec/protocol-contracts": "0.
|
|
76
|
-
"@aztec/prover-client": "0.
|
|
77
|
-
"@aztec/sequencer-client": "0.
|
|
78
|
-
"@aztec/simulator": "0.
|
|
79
|
-
"@aztec/stdlib": "0.
|
|
80
|
-
"@aztec/telemetry-client": "0.
|
|
81
|
-
"@aztec/validator-client": "0.
|
|
82
|
-
"@aztec/world-state": "0.
|
|
65
|
+
"@aztec/archiver": "0.82.0",
|
|
66
|
+
"@aztec/bb-prover": "0.82.0",
|
|
67
|
+
"@aztec/blob-sink": "0.82.0",
|
|
68
|
+
"@aztec/constants": "0.82.0",
|
|
69
|
+
"@aztec/epoch-cache": "0.82.0",
|
|
70
|
+
"@aztec/ethereum": "0.82.0",
|
|
71
|
+
"@aztec/foundation": "0.82.0",
|
|
72
|
+
"@aztec/kv-store": "0.82.0",
|
|
73
|
+
"@aztec/merkle-tree": "0.82.0",
|
|
74
|
+
"@aztec/p2p": "0.82.0",
|
|
75
|
+
"@aztec/protocol-contracts": "0.82.0",
|
|
76
|
+
"@aztec/prover-client": "0.82.0",
|
|
77
|
+
"@aztec/sequencer-client": "0.82.0",
|
|
78
|
+
"@aztec/simulator": "0.82.0",
|
|
79
|
+
"@aztec/stdlib": "0.82.0",
|
|
80
|
+
"@aztec/telemetry-client": "0.82.0",
|
|
81
|
+
"@aztec/validator-client": "0.82.0",
|
|
82
|
+
"@aztec/world-state": "0.82.0",
|
|
83
83
|
"koa": "^2.14.2",
|
|
84
84
|
"koa-router": "^12.0.0",
|
|
85
85
|
"tslib": "^2.4.0"
|
package/src/aztec-node/config.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ArchiverConfig, archiverConfigMappings } from '@aztec/archiver/config';
|
|
2
|
+
import { type L1ContractAddresses, l1ContractAddressesMapping } from '@aztec/ethereum';
|
|
2
3
|
import { type ConfigMappingsType, booleanConfigHelper, getConfigFromMappings } from '@aztec/foundation/config';
|
|
3
4
|
import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
|
|
4
5
|
import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
|
|
@@ -28,16 +29,22 @@ export type AztecNodeConfig = ArchiverConfig &
|
|
|
28
29
|
disableValidator: boolean;
|
|
29
30
|
/** Whether to populate the genesis state with initial fee juice for the test accounts */
|
|
30
31
|
testAccounts: boolean;
|
|
32
|
+
} & {
|
|
33
|
+
l1Contracts: L1ContractAddresses;
|
|
31
34
|
};
|
|
32
35
|
|
|
33
36
|
export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
|
|
37
|
+
...dataConfigMappings,
|
|
34
38
|
...archiverConfigMappings,
|
|
35
39
|
...sequencerClientConfigMappings,
|
|
36
40
|
...validatorClientConfigMappings,
|
|
37
41
|
...proverClientConfigMappings,
|
|
38
42
|
...worldStateConfigMappings,
|
|
39
43
|
...p2pConfigMappings,
|
|
40
|
-
|
|
44
|
+
l1Contracts: {
|
|
45
|
+
description: 'The deployed L1 contract addresses',
|
|
46
|
+
nested: l1ContractAddressesMapping,
|
|
47
|
+
},
|
|
41
48
|
disableValidator: {
|
|
42
49
|
env: 'VALIDATOR_DISABLED',
|
|
43
50
|
description: 'Whether the validator is disabled for this node.',
|
package/src/aztec-node/server.ts
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
type NOTE_HASH_TREE_HEIGHT,
|
|
9
9
|
type NULLIFIER_TREE_HEIGHT,
|
|
10
10
|
type PUBLIC_DATA_TREE_HEIGHT,
|
|
11
|
-
REGISTERER_CONTRACT_ADDRESS,
|
|
12
11
|
} from '@aztec/constants';
|
|
13
12
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
14
13
|
import { type L1ContractAddresses, createEthereumChain } from '@aztec/ethereum';
|
|
@@ -16,6 +15,7 @@ import { compactArray } from '@aztec/foundation/collection';
|
|
|
16
15
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
17
16
|
import { Fr } from '@aztec/foundation/fields';
|
|
18
17
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
18
|
+
import { SerialQueue } from '@aztec/foundation/queue';
|
|
19
19
|
import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
20
20
|
import { SiblingPath } from '@aztec/foundation/trees';
|
|
21
21
|
import type { AztecKVStore } from '@aztec/kv-store';
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
} from '@aztec/sequencer-client';
|
|
34
34
|
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
35
35
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
36
|
-
import type { InBlock, L2Block, L2BlockNumber, L2BlockSource,
|
|
36
|
+
import type { InBlock, L2Block, L2BlockNumber, L2BlockSource, PublishedL2Block } from '@aztec/stdlib/block';
|
|
37
37
|
import type {
|
|
38
38
|
ContractClassPublic,
|
|
39
39
|
ContractDataSource,
|
|
@@ -42,8 +42,13 @@ import type {
|
|
|
42
42
|
ProtocolContractAddresses,
|
|
43
43
|
} from '@aztec/stdlib/contract';
|
|
44
44
|
import type { GasFees } from '@aztec/stdlib/gas';
|
|
45
|
-
import { computePublicDataTreeLeafSlot
|
|
46
|
-
import type {
|
|
45
|
+
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
46
|
+
import type {
|
|
47
|
+
AztecNode,
|
|
48
|
+
AztecNodeAdmin,
|
|
49
|
+
GetContractClassLogsResponse,
|
|
50
|
+
GetPublicLogsResponse,
|
|
51
|
+
} from '@aztec/stdlib/interfaces/client';
|
|
47
52
|
import {
|
|
48
53
|
type ClientProtocolCircuitVerifier,
|
|
49
54
|
type L2LogsSource,
|
|
@@ -57,8 +62,8 @@ import {
|
|
|
57
62
|
import type { LogFilter, PrivateLog, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
58
63
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
59
64
|
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
60
|
-
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
61
65
|
import type { NullifierLeafPreimage, PublicDataTreeLeaf, PublicDataTreeLeafPreimage } from '@aztec/stdlib/trees';
|
|
66
|
+
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
62
67
|
import {
|
|
63
68
|
type BlockHeader,
|
|
64
69
|
PublicSimulationOutput,
|
|
@@ -86,10 +91,13 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
86
91
|
/**
|
|
87
92
|
* The aztec node.
|
|
88
93
|
*/
|
|
89
|
-
export class AztecNodeService implements AztecNode, Traceable {
|
|
94
|
+
export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
90
95
|
private packageVersion: string;
|
|
91
96
|
private metrics: NodeMetrics;
|
|
92
97
|
|
|
98
|
+
// Serial queue to ensure that we only send one tx at a time
|
|
99
|
+
private txQueue: SerialQueue = new SerialQueue();
|
|
100
|
+
|
|
93
101
|
public readonly tracer: Tracer;
|
|
94
102
|
|
|
95
103
|
constructor(
|
|
@@ -99,7 +107,6 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
99
107
|
protected readonly logsSource: L2LogsSource,
|
|
100
108
|
protected readonly contractDataSource: ContractDataSource,
|
|
101
109
|
protected readonly l1ToL2MessageSource: L1ToL2MessageSource,
|
|
102
|
-
protected readonly nullifierSource: NullifierWithBlockSource,
|
|
103
110
|
protected readonly worldStateSynchronizer: WorldStateSynchronizer,
|
|
104
111
|
protected readonly sequencer: SequencerClient | undefined,
|
|
105
112
|
protected readonly l1ChainId: number,
|
|
@@ -112,6 +119,7 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
112
119
|
this.packageVersion = getPackageVersion();
|
|
113
120
|
this.metrics = new NodeMetrics(telemetry, 'AztecNodeService');
|
|
114
121
|
this.tracer = telemetry.getTracer('AztecNodeService');
|
|
122
|
+
this.txQueue.start();
|
|
115
123
|
|
|
116
124
|
this.log.info(`Aztec Node version: ${this.packageVersion}`);
|
|
117
125
|
this.log.info(`Aztec Node started on chain 0x${l1ChainId.toString(16)}`, config.l1Contracts);
|
|
@@ -215,7 +223,6 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
215
223
|
archiver,
|
|
216
224
|
archiver,
|
|
217
225
|
archiver,
|
|
218
|
-
archiver,
|
|
219
226
|
worldStateSynchronizer,
|
|
220
227
|
sequencer,
|
|
221
228
|
ethereumChain.chainInfo.id,
|
|
@@ -309,6 +316,10 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
309
316
|
return (await this.blockSource.getBlocks(from, limit)) ?? [];
|
|
310
317
|
}
|
|
311
318
|
|
|
319
|
+
public async getPublishedBlocks(from: number, limit: number): Promise<PublishedL2Block[]> {
|
|
320
|
+
return (await this.blockSource.getPublishedBlocks(from, limit)) ?? [];
|
|
321
|
+
}
|
|
322
|
+
|
|
312
323
|
/**
|
|
313
324
|
* Method to fetch the current base fees.
|
|
314
325
|
* @returns The current base fees.
|
|
@@ -353,25 +364,8 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
353
364
|
return Promise.resolve(this.l1ChainId);
|
|
354
365
|
}
|
|
355
366
|
|
|
356
|
-
public
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
// TODO(#10007): Remove this check. This is needed only because we're manually registering
|
|
360
|
-
// some contracts in the archiver so they are available to all nodes (see `registerCommonContracts`
|
|
361
|
-
// in `archiver/src/factory.ts`), but we still want clients to send the registration tx in order
|
|
362
|
-
// to emit the corresponding nullifier, which is now being checked. Note that this method
|
|
363
|
-
// is only called by the PXE to check if a contract is publicly registered.
|
|
364
|
-
if (klazz) {
|
|
365
|
-
const classNullifier = await siloNullifier(AztecAddress.fromNumber(REGISTERER_CONTRACT_ADDRESS), id);
|
|
366
|
-
const worldState = await this.#getWorldState('latest');
|
|
367
|
-
const [index] = await worldState.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, [classNullifier.toBuffer()]);
|
|
368
|
-
this.log.debug(`Registration nullifier ${classNullifier} for contract class ${id} found at index ${index}`);
|
|
369
|
-
if (index === undefined) {
|
|
370
|
-
return undefined;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
return klazz;
|
|
367
|
+
public getContractClass(id: Fr): Promise<ContractClassPublic | undefined> {
|
|
368
|
+
return this.contractDataSource.getContractClass(id);
|
|
375
369
|
}
|
|
376
370
|
|
|
377
371
|
public getContract(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined> {
|
|
@@ -421,6 +415,16 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
421
415
|
* @param tx - The transaction to be submitted.
|
|
422
416
|
*/
|
|
423
417
|
public async sendTx(tx: Tx) {
|
|
418
|
+
await this.txQueue
|
|
419
|
+
.put(async () => {
|
|
420
|
+
await this.#sendTx(tx);
|
|
421
|
+
})
|
|
422
|
+
.catch(error => {
|
|
423
|
+
this.log.error(`Error sending tx`, { error });
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
async #sendTx(tx: Tx) {
|
|
424
428
|
const timer = new Timer();
|
|
425
429
|
const txHash = (await tx.getTxHash()).toString();
|
|
426
430
|
|
|
@@ -466,6 +470,7 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
466
470
|
*/
|
|
467
471
|
public async stop() {
|
|
468
472
|
this.log.info(`Stopping`);
|
|
473
|
+
await this.txQueue.end();
|
|
469
474
|
await this.sequencer?.stop();
|
|
470
475
|
await this.p2pClient.stop();
|
|
471
476
|
await this.worldStateSynchronizer.stop();
|
|
@@ -506,48 +511,74 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
506
511
|
}
|
|
507
512
|
|
|
508
513
|
/**
|
|
509
|
-
* Find the indexes of the given leaves in the given tree
|
|
510
|
-
*
|
|
514
|
+
* Find the indexes of the given leaves in the given tree along with a block metadata pointing to the block in which
|
|
515
|
+
* the leaves were inserted.
|
|
516
|
+
* @param blockNumber - The block number at which to get the data or 'latest' for latest data.
|
|
511
517
|
* @param treeId - The tree to search in.
|
|
512
|
-
* @param
|
|
513
|
-
* @returns The
|
|
518
|
+
* @param leafValues - The values to search for.
|
|
519
|
+
* @returns The indices of leaves and the block metadata of a block in which the leaves were inserted.
|
|
514
520
|
*/
|
|
515
521
|
public async findLeavesIndexes(
|
|
516
522
|
blockNumber: L2BlockNumber,
|
|
517
523
|
treeId: MerkleTreeId,
|
|
518
524
|
leafValues: Fr[],
|
|
519
|
-
): Promise<(bigint | undefined)[]> {
|
|
525
|
+
): Promise<(InBlock<bigint> | undefined)[]> {
|
|
520
526
|
const committedDb = await this.#getWorldState(blockNumber);
|
|
521
|
-
|
|
527
|
+
const maybeIndices = await committedDb.findLeafIndices(
|
|
522
528
|
treeId,
|
|
523
529
|
leafValues.map(x => x.toBuffer()),
|
|
524
530
|
);
|
|
525
|
-
|
|
531
|
+
// We filter out undefined values
|
|
532
|
+
const indices = maybeIndices.filter(x => x !== undefined) as bigint[];
|
|
526
533
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
* @param blockNumber - The block number at which to get the data or 'latest' for latest data
|
|
530
|
-
* @param treeId - The tree to search in.
|
|
531
|
-
* @param leafIndices - The values to search for
|
|
532
|
-
* @returns The indexes of the given leaves in the given tree or undefined if not found.
|
|
533
|
-
*/
|
|
534
|
-
public async findBlockNumbersForIndexes(
|
|
535
|
-
blockNumber: L2BlockNumber,
|
|
536
|
-
treeId: MerkleTreeId,
|
|
537
|
-
leafIndices: bigint[],
|
|
538
|
-
): Promise<(bigint | undefined)[]> {
|
|
539
|
-
const committedDb = await this.#getWorldState(blockNumber);
|
|
540
|
-
return await committedDb.getBlockNumbersForLeafIndices(treeId, leafIndices);
|
|
541
|
-
}
|
|
534
|
+
// Now we find the block numbers for the indices
|
|
535
|
+
const blockNumbers = await committedDb.getBlockNumbersForLeafIndices(treeId, indices);
|
|
542
536
|
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
537
|
+
// If any of the block numbers are undefined, we throw an error.
|
|
538
|
+
for (let i = 0; i < indices.length; i++) {
|
|
539
|
+
if (blockNumbers[i] === undefined) {
|
|
540
|
+
throw new Error(`Block number is undefined for leaf index ${indices[i]} in tree ${MerkleTreeId[treeId]}`);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// Get unique block numbers in order to optimize num calls to getLeafValue function.
|
|
545
|
+
const uniqueBlockNumbers = [...new Set(blockNumbers.filter(x => x !== undefined))];
|
|
546
|
+
|
|
547
|
+
// Now we obtain the block hashes from the archive tree by calling await `committedDb.getLeafValue(treeId, index)`
|
|
548
|
+
// (note that block number corresponds to the leaf index in the archive tree).
|
|
549
|
+
const blockHashes = await Promise.all(
|
|
550
|
+
uniqueBlockNumbers.map(blockNumber => {
|
|
551
|
+
return committedDb.getLeafValue(MerkleTreeId.ARCHIVE, blockNumber!);
|
|
552
|
+
}),
|
|
553
|
+
);
|
|
554
|
+
|
|
555
|
+
// If any of the block hashes are undefined, we throw an error.
|
|
556
|
+
for (let i = 0; i < uniqueBlockNumbers.length; i++) {
|
|
557
|
+
if (blockHashes[i] === undefined) {
|
|
558
|
+
throw new Error(`Block hash is undefined for block number ${uniqueBlockNumbers[i]}`);
|
|
559
|
+
}
|
|
549
560
|
}
|
|
550
|
-
|
|
561
|
+
|
|
562
|
+
// Create InBlock objects by combining indices, blockNumbers and blockHashes and return them.
|
|
563
|
+
return maybeIndices.map((index, i) => {
|
|
564
|
+
if (index === undefined) {
|
|
565
|
+
return undefined;
|
|
566
|
+
}
|
|
567
|
+
const blockNumber = blockNumbers[i];
|
|
568
|
+
if (blockNumber === undefined) {
|
|
569
|
+
return undefined;
|
|
570
|
+
}
|
|
571
|
+
const blockHashIndex = uniqueBlockNumbers.indexOf(blockNumber);
|
|
572
|
+
const blockHash = blockHashes[blockHashIndex]?.toString();
|
|
573
|
+
if (!blockHash) {
|
|
574
|
+
return undefined;
|
|
575
|
+
}
|
|
576
|
+
return {
|
|
577
|
+
l2BlockNumber: Number(blockNumber),
|
|
578
|
+
l2BlockHash: blockHash,
|
|
579
|
+
data: index,
|
|
580
|
+
};
|
|
581
|
+
});
|
|
551
582
|
}
|
|
552
583
|
|
|
553
584
|
/**
|
|
@@ -786,7 +817,7 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
786
817
|
return new NullifierMembershipWitness(BigInt(index), preimageData as NullifierLeafPreimage, siblingPath);
|
|
787
818
|
}
|
|
788
819
|
|
|
789
|
-
async
|
|
820
|
+
async getPublicDataWitness(blockNumber: L2BlockNumber, leafSlot: Fr): Promise<PublicDataWitness | undefined> {
|
|
790
821
|
const committedDb = await this.#getWorldState(blockNumber);
|
|
791
822
|
const lowLeafResult = await committedDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
|
|
792
823
|
if (!lowLeafResult) {
|
|
@@ -865,7 +896,6 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
865
896
|
new DateProvider(),
|
|
866
897
|
this.telemetry,
|
|
867
898
|
);
|
|
868
|
-
const fork = await this.worldStateSynchronizer.fork();
|
|
869
899
|
|
|
870
900
|
this.log.verbose(`Simulating public calls for tx ${txHash}`, {
|
|
871
901
|
globalVariables: newGlobalVariables.toInspect(),
|
|
@@ -873,8 +903,9 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
873
903
|
blockNumber,
|
|
874
904
|
});
|
|
875
905
|
|
|
906
|
+
const merkleTreeFork = await this.worldStateSynchronizer.fork();
|
|
876
907
|
try {
|
|
877
|
-
const processor = publicProcessorFactory.create(
|
|
908
|
+
const processor = publicProcessorFactory.create(merkleTreeFork, newGlobalVariables, skipFeeEnforcement);
|
|
878
909
|
|
|
879
910
|
// REFACTOR: Consider merging ProcessReturnValues into ProcessedTx
|
|
880
911
|
const [processedTxs, failedTxs, returns] = await processor.process([tx]);
|
|
@@ -893,7 +924,7 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
893
924
|
processedTx.gasUsed,
|
|
894
925
|
);
|
|
895
926
|
} finally {
|
|
896
|
-
await
|
|
927
|
+
await merkleTreeFork.close();
|
|
897
928
|
}
|
|
898
929
|
}
|
|
899
930
|
|
|
@@ -935,12 +966,6 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
935
966
|
});
|
|
936
967
|
}
|
|
937
968
|
|
|
938
|
-
// TODO(#10007): Remove this method
|
|
939
|
-
public addContractClass(contractClass: ContractClassPublic): Promise<void> {
|
|
940
|
-
this.log.info(`Adding contract class via API ${contractClass.id}`);
|
|
941
|
-
return this.contractDataSource.addContractClass(contractClass);
|
|
942
|
-
}
|
|
943
|
-
|
|
944
969
|
public registerContractFunctionSignatures(_address: AztecAddress, signatures: string[]): Promise<void> {
|
|
945
970
|
return this.contractDataSource.registerContractFunctionSignatures(_address, signatures);
|
|
946
971
|
}
|