@aztec/aztec-node 0.1.0-alpha23 → 0.1.0-alpha40

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.
@@ -2,18 +2,21 @@ import { Archiver } from '@aztec/archiver';
2
2
  import {
3
3
  CONTRACT_TREE_HEIGHT,
4
4
  CircuitsWasm,
5
+ EthAddress,
5
6
  Fr,
7
+ HistoricBlockData,
6
8
  L1_TO_L2_MSG_TREE_HEIGHT,
7
9
  PRIVATE_DATA_TREE_HEIGHT,
8
10
  } from '@aztec/circuits.js';
9
11
  import { AztecAddress } from '@aztec/foundation/aztec-address';
10
- import { SiblingPath } from '@aztec/merkle-tree';
12
+ import { createDebugLogger } from '@aztec/foundation/log';
11
13
  import { InMemoryTxPool, P2P, createP2PClient } from '@aztec/p2p';
12
- import { SequencerClient, getCombinedHistoricTreeRoots } from '@aztec/sequencer-client';
14
+ import { SequencerClient } from '@aztec/sequencer-client';
13
15
  import {
16
+ AztecNode,
14
17
  ContractData,
18
+ ContractDataAndBytecode,
15
19
  ContractDataSource,
16
- ContractPublicData,
17
20
  L1ToL2MessageAndIndex,
18
21
  L1ToL2MessageSource,
19
22
  L2Block,
@@ -22,6 +25,7 @@ import {
22
25
  L2LogsSource,
23
26
  LogType,
24
27
  MerkleTreeId,
28
+ SiblingPath,
25
29
  Tx,
26
30
  TxHash,
27
31
  } from '@aztec/types';
@@ -31,9 +35,10 @@ import {
31
35
  WorldStateSynchroniser,
32
36
  computePublicDataTreeLeafIndex,
33
37
  } from '@aztec/world-state';
38
+
34
39
  import { default as levelup } from 'levelup';
35
40
  import { MemDown, default as memdown } from 'memdown';
36
- import { AztecNode } from './aztec-node.js';
41
+
37
42
  import { AztecNodeConfig } from './config.js';
38
43
 
39
44
  export const createMemDown = () => (memdown as any)() as MemDown<any, any>;
@@ -54,6 +59,7 @@ export class AztecNodeService implements AztecNode {
54
59
  protected sequencer: SequencerClient,
55
60
  protected chainId: number,
56
61
  protected version: number,
62
+ private log = createDebugLogger('aztec:node'),
57
63
  ) {}
58
64
 
59
65
  /**
@@ -111,14 +117,23 @@ export class AztecNodeService implements AztecNode {
111
117
  return (await this.p2pClient.isReady()) ?? false;
112
118
  }
113
119
 
120
+ /**
121
+ * Get the a given block.
122
+ * @param number - The block number being requested.
123
+ * @returns The blocks requested.
124
+ */
125
+ public async getBlock(number: number): Promise<L2Block | undefined> {
126
+ return await this.blockSource.getL2Block(number);
127
+ }
128
+
114
129
  /**
115
130
  * Method to request blocks. Will attempt to return all requested blocks but will return only those available.
116
131
  * @param from - The start of the range of blocks to return.
117
- * @param take - The number of blocks desired.
132
+ * @param limit - The maximum number of blocks to obtain.
118
133
  * @returns The blocks requested.
119
134
  */
120
- public async getBlocks(from: number, take: number): Promise<L2Block[]> {
121
- return (await this.blockSource.getL2Blocks(from, take)) ?? [];
135
+ public async getBlocks(from: number, limit: number): Promise<L2Block[]> {
136
+ return (await this.blockSource.getL2Blocks(from, limit)) ?? [];
122
137
  }
123
138
 
124
139
  /**
@@ -145,36 +160,44 @@ export class AztecNodeService implements AztecNode {
145
160
  return Promise.resolve(this.chainId);
146
161
  }
147
162
 
163
+ /**
164
+ * Method to fetch the rollup contract address at the base-layer.
165
+ * @returns The rollup address.
166
+ */
167
+ public getRollupAddress(): Promise<EthAddress> {
168
+ return this.blockSource.getRollupAddress();
169
+ }
170
+
148
171
  /**
149
172
  * Lookup the L2 contract data for this contract.
150
173
  * Contains the ethereum portal address and bytecode.
151
174
  * @param contractAddress - The contract data address.
152
175
  * @returns The complete contract data including portal address & bytecode (if we didn't throw an error).
153
176
  */
154
- public async getContractData(contractAddress: AztecAddress): Promise<ContractPublicData | undefined> {
155
- return await this.contractDataSource.getL2ContractPublicData(contractAddress);
177
+ public async getContractDataAndBytecode(contractAddress: AztecAddress): Promise<ContractDataAndBytecode | undefined> {
178
+ return await this.contractDataSource.getContractDataAndBytecode(contractAddress);
156
179
  }
157
180
 
158
181
  /**
159
- * Lookup the L2 contract info for this contract.
182
+ * Lookup the contract data for this contract.
160
183
  * Contains the ethereum portal address .
161
184
  * @param contractAddress - The contract data address.
162
185
  * @returns The contract's address & portal address.
163
186
  */
164
- public async getContractInfo(contractAddress: AztecAddress): Promise<ContractData | undefined> {
165
- return await this.contractDataSource.getL2ContractInfo(contractAddress);
187
+ public async getContractData(contractAddress: AztecAddress): Promise<ContractData | undefined> {
188
+ return await this.contractDataSource.getContractData(contractAddress);
166
189
  }
167
190
 
168
191
  /**
169
- * Gets the `take` amount of logs starting from `from`.
192
+ * Gets up to `limit` amount of logs starting from `from`.
170
193
  * @param from - Number of the L2 block to which corresponds the first logs to be returned.
171
- * @param take - The number of logs to return.
194
+ * @param limit - The maximum number of logs to return.
172
195
  * @param logType - Specifies whether to return encrypted or unencrypted logs.
173
196
  * @returns The requested logs.
174
197
  */
175
- public getLogs(from: number, take: number, logType: LogType): Promise<L2BlockL2Logs[]> {
198
+ public getLogs(from: number, limit: number, logType: LogType): Promise<L2BlockL2Logs[]> {
176
199
  const logSource = logType === LogType.ENCRYPTED ? this.encryptedLogsSource : this.unencryptedLogsSource;
177
- return logSource.getLogs(from, take, logType);
200
+ return logSource.getLogs(from, limit, logType);
178
201
  }
179
202
 
180
203
  /**
@@ -182,11 +205,7 @@ export class AztecNodeService implements AztecNode {
182
205
  * @param tx - The transaction to be submitted.
183
206
  */
184
207
  public async sendTx(tx: Tx) {
185
- // TODO: Patch tx to inject historic tree roots until the private kernel circuit supplies this value
186
- if (tx.data.constants.historicTreeRoots.privateHistoricTreeRoots.isEmpty()) {
187
- tx.data.constants.historicTreeRoots = await getCombinedHistoricTreeRoots(this.merkleTreeDB.asLatest());
188
- }
189
-
208
+ this.log.info(`Received tx ${await tx.getTxHash()}`);
190
209
  await this.p2pClient!.sendTx(tx);
191
210
  }
192
211
 
@@ -199,6 +218,7 @@ export class AztecNodeService implements AztecNode {
199
218
  await this.worldStateSynchroniser.stop();
200
219
  await this.merkleTreeDB.stop();
201
220
  await this.blockSource.stop();
221
+ this.log.info(`Stopped`);
202
222
  }
203
223
 
204
224
  /**
@@ -287,7 +307,7 @@ export class AztecNodeService implements AztecNode {
287
307
  * @returns Storage value at the given contract slot (or undefined if not found).
288
308
  * Note: Aztec's version of `eth_getStorageAt`.
289
309
  */
290
- public async getStorageAt(contract: AztecAddress, slot: bigint): Promise<Buffer | undefined> {
310
+ public async getPublicStorageAt(contract: AztecAddress, slot: bigint): Promise<Buffer | undefined> {
291
311
  const leafIndex = computePublicDataTreeLeafIndex(contract, new Fr(slot), await CircuitsWasm.get());
292
312
  return this.merkleTreeDB.getLeafValue(MerkleTreeId.PUBLIC_DATA_TREE, leafIndex, false);
293
313
  }
@@ -306,9 +326,29 @@ export class AztecNodeService implements AztecNode {
306
326
  [MerkleTreeId.NULLIFIER_TREE]: await getTreeRoot(MerkleTreeId.NULLIFIER_TREE),
307
327
  [MerkleTreeId.PUBLIC_DATA_TREE]: await getTreeRoot(MerkleTreeId.PUBLIC_DATA_TREE),
308
328
  [MerkleTreeId.L1_TO_L2_MESSAGES_TREE]: await getTreeRoot(MerkleTreeId.L1_TO_L2_MESSAGES_TREE),
309
- [MerkleTreeId.L1_TO_L2_MESSAGES_ROOTS_TREE]: await getTreeRoot(MerkleTreeId.L1_TO_L2_MESSAGES_ROOTS_TREE),
310
- [MerkleTreeId.CONTRACT_TREE_ROOTS_TREE]: await getTreeRoot(MerkleTreeId.CONTRACT_TREE_ROOTS_TREE),
311
- [MerkleTreeId.PRIVATE_DATA_TREE_ROOTS_TREE]: await getTreeRoot(MerkleTreeId.PRIVATE_DATA_TREE_ROOTS_TREE),
329
+ [MerkleTreeId.BLOCKS_TREE]: await getTreeRoot(MerkleTreeId.BLOCKS_TREE),
312
330
  };
313
331
  }
332
+
333
+ /**
334
+ * Returns the currently committed historic block data.
335
+ * @returns The current committed block data.
336
+ */
337
+ public async getHistoricBlockData(): Promise<HistoricBlockData> {
338
+ const getTreeRoot = async (id: MerkleTreeId) =>
339
+ Fr.fromBuffer((await this.merkleTreeDB.getTreeInfo(id, false)).root);
340
+
341
+ const globalsHash = this.worldStateSynchroniser.latestGlobalVariablesHash;
342
+
343
+ return new HistoricBlockData(
344
+ await getTreeRoot(MerkleTreeId.PRIVATE_DATA_TREE),
345
+ await getTreeRoot(MerkleTreeId.NULLIFIER_TREE),
346
+ await getTreeRoot(MerkleTreeId.CONTRACT_TREE),
347
+ await getTreeRoot(MerkleTreeId.L1_TO_L2_MESSAGES_TREE),
348
+ await getTreeRoot(MerkleTreeId.BLOCKS_TREE),
349
+ Fr.ZERO,
350
+ await getTreeRoot(MerkleTreeId.PUBLIC_DATA_TREE),
351
+ globalsHash,
352
+ );
353
+ }
314
354
  }
package/src/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from './aztec-node/aztec-node.js';
2
1
  export * from './aztec-node/config.js';
3
2
  export * from './aztec-node/server.js';
4
3
  export * from './aztec-node/http-node.js';
@@ -1,126 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import { CONTRACT_TREE_HEIGHT, L1_TO_L2_MSG_TREE_HEIGHT, PRIVATE_DATA_TREE_HEIGHT } from '@aztec/circuits.js';
3
- import { AztecAddress } from '@aztec/foundation/aztec-address';
4
- import { ContractPublicData, ContractData, L2Block, MerkleTreeId, L1ToL2MessageAndIndex, L2BlockL2Logs, TxHash, Tx, LogType } from '@aztec/types';
5
- import { SiblingPath } from '@aztec/merkle-tree';
6
- import { Fr } from '@aztec/foundation/fields';
7
- /**
8
- * The aztec node.
9
- */
10
- export interface AztecNode {
11
- /**
12
- * Method to determine if the node is ready to accept transactions.
13
- * @returns - Flag indicating the readiness for tx submission.
14
- */
15
- isReady(): Promise<boolean>;
16
- /**
17
- * Method to request blocks. Will attempt to return all requested blocks but will return only those available.
18
- * @param from - The start of the range of blocks to return.
19
- * @param take - The number of blocks desired.
20
- * @returns The blocks requested.
21
- */
22
- getBlocks(from: number, take: number): Promise<L2Block[]>;
23
- /**
24
- * Method to fetch the current block height.
25
- * @returns The block height as a number.
26
- */
27
- getBlockHeight(): Promise<number>;
28
- /**
29
- * Method to fetch the version of the rollup the node is connected to.
30
- * @returns The rollup version.
31
- */
32
- getVersion(): Promise<number>;
33
- /**
34
- * Method to fetch the chain id of the base-layer for the rollup.
35
- * @returns The chain id.
36
- */
37
- getChainId(): Promise<number>;
38
- /**
39
- * Lookup the L2 contract data for this contract.
40
- * Contains the ethereum portal address and bytecode.
41
- * @param contractAddress - The contract data address.
42
- * @returns The complete contract data including portal address & bytecode (if we didn't throw an error).
43
- */
44
- getContractData(contractAddress: AztecAddress): Promise<ContractPublicData | undefined>;
45
- /**
46
- * Lookup the L2 contract info for this contract.
47
- * Contains the ethereum portal address .
48
- * @param contractAddress - The contract data address.
49
- * @returns The contract's address & portal address.
50
- */
51
- getContractInfo(contractAddress: AztecAddress): Promise<ContractData | undefined>;
52
- /**
53
- * Gets the `take` amount of logs starting from `from`.
54
- * @param from - Number of the L2 block to which corresponds the first logs to be returned.
55
- * @param take - The number of logs to return.
56
- * @param logType - Specifies whether to return encrypted or unencrypted logs.
57
- * @returns The requested logs.
58
- */
59
- getLogs(from: number, take: number, logType: LogType): Promise<L2BlockL2Logs[]>;
60
- /**
61
- * Method to submit a transaction to the p2p pool.
62
- * @param tx - The transaction to be submitted.
63
- */
64
- sendTx(tx: Tx): Promise<void>;
65
- /**
66
- * Method to retrieve pending txs.
67
- * @returns The pending txs.
68
- */
69
- getPendingTxs(): Promise<Tx[]>;
70
- /**
71
- * Method to retrieve a single pending tx.
72
- * @param txHash - The transaction hash to return.
73
- * @returns The pending tx if it exists.
74
- */
75
- getPendingTxByHash(txHash: TxHash): Promise<Tx | undefined>;
76
- /**
77
- * Find the index of the given contract.
78
- * @param leafValue - The value to search for.
79
- * @returns The index of the given leaf in the contracts tree or undefined if not found.
80
- */
81
- findContractIndex(leafValue: Buffer): Promise<bigint | undefined>;
82
- /**
83
- * Returns the sibling path for the given index in the contract tree.
84
- * @param leafIndex - The index of the leaf for which the sibling path is required.
85
- * @returns The sibling path for the leaf index.
86
- */
87
- getContractPath(leafIndex: bigint): Promise<SiblingPath<typeof CONTRACT_TREE_HEIGHT>>;
88
- /**
89
- * Find the index of the given commitment.
90
- * @param leafValue - The value to search for.
91
- * @returns The index of the given leaf of undefined if not found.
92
- */
93
- findCommitmentIndex(leafValue: Buffer): Promise<bigint | undefined>;
94
- /**
95
- * Returns the sibling path for the given index in the data tree.
96
- * @param leafIndex - The index of the leaf for which the sibling path is required.
97
- * @returns The sibling path for the leaf index.
98
- */
99
- getDataTreePath(leafIndex: bigint): Promise<SiblingPath<typeof PRIVATE_DATA_TREE_HEIGHT>>;
100
- /**
101
- * Gets a confirmed/consumed L1 to L2 message for the given message key (throws if not found).
102
- * and its index in the merkle tree
103
- * @param messageKey - The message key.
104
- * @returns The map containing the message and index.
105
- */
106
- getL1ToL2MessageAndIndex(messageKey: Fr): Promise<L1ToL2MessageAndIndex>;
107
- /**
108
- * Returns the sibling path for a leaf in the committed l1 to l2 data tree.
109
- * @param leafIndex - Index of the leaf in the tree.
110
- * @returns The sibling path.
111
- */
112
- getL1ToL2MessagesTreePath(leafIndex: bigint): Promise<SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>>;
113
- /**
114
- * Gets the storage value at the given contract slot. Our version of eth_getStorageAt.
115
- * @param contract - Address of the contract to query.
116
- * @param slot - Slot to query.
117
- * @returns Storage value at the given contract slot (or undefined if not found).
118
- */
119
- getStorageAt(contract: AztecAddress, slot: bigint): Promise<Buffer | undefined>;
120
- /**
121
- * Returns the current committed roots for the data trees.
122
- * @returns The current committed roots for the data trees.
123
- */
124
- getTreeRoots(): Promise<Record<MerkleTreeId, Fr>>;
125
- }
126
- //# sourceMappingURL=aztec-node.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aztec-node.d.ts","sourceRoot":"","sources":["../../src/aztec-node/aztec-node.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,wBAAwB,E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+0,0 @@
1
- import { CONTRACT_TREE_HEIGHT, L1_TO_L2_MSG_TREE_HEIGHT, PRIVATE_DATA_TREE_HEIGHT } from '@aztec/circuits.js';
2
- import { AztecAddress } from '@aztec/foundation/aztec-address';
3
- import {
4
- ContractPublicData,
5
- ContractData,
6
- L2Block,
7
- MerkleTreeId,
8
- L1ToL2MessageAndIndex,
9
- L2BlockL2Logs,
10
- TxHash,
11
- Tx,
12
- LogType,
13
- } from '@aztec/types';
14
- import { SiblingPath } from '@aztec/merkle-tree';
15
- import { Fr } from '@aztec/foundation/fields';
16
-
17
- /**
18
- * The aztec node.
19
- */
20
- export interface AztecNode {
21
- /**
22
- * Method to determine if the node is ready to accept transactions.
23
- * @returns - Flag indicating the readiness for tx submission.
24
- */
25
- isReady(): Promise<boolean>;
26
-
27
- /**
28
- * Method to request blocks. Will attempt to return all requested blocks but will return only those available.
29
- * @param from - The start of the range of blocks to return.
30
- * @param take - The number of blocks desired.
31
- * @returns The blocks requested.
32
- */
33
- getBlocks(from: number, take: number): Promise<L2Block[]>;
34
-
35
- /**
36
- * Method to fetch the current block height.
37
- * @returns The block height as a number.
38
- */
39
- getBlockHeight(): Promise<number>;
40
-
41
- /**
42
- * Method to fetch the version of the rollup the node is connected to.
43
- * @returns The rollup version.
44
- */
45
- getVersion(): Promise<number>;
46
-
47
- /**
48
- * Method to fetch the chain id of the base-layer for the rollup.
49
- * @returns The chain id.
50
- */
51
- getChainId(): Promise<number>;
52
-
53
- /**
54
- * Lookup the L2 contract data for this contract.
55
- * Contains the ethereum portal address and bytecode.
56
- * @param contractAddress - The contract data address.
57
- * @returns The complete contract data including portal address & bytecode (if we didn't throw an error).
58
- */
59
- getContractData(contractAddress: AztecAddress): Promise<ContractPublicData | undefined>;
60
-
61
- /**
62
- * Lookup the L2 contract info for this contract.
63
- * Contains the ethereum portal address .
64
- * @param contractAddress - The contract data address.
65
- * @returns The contract's address & portal address.
66
- */
67
- getContractInfo(contractAddress: AztecAddress): Promise<ContractData | undefined>;
68
-
69
- /**
70
- * Gets the `take` amount of logs starting from `from`.
71
- * @param from - Number of the L2 block to which corresponds the first logs to be returned.
72
- * @param take - The number of logs to return.
73
- * @param logType - Specifies whether to return encrypted or unencrypted logs.
74
- * @returns The requested logs.
75
- */
76
- getLogs(from: number, take: number, logType: LogType): Promise<L2BlockL2Logs[]>;
77
-
78
- /**
79
- * Method to submit a transaction to the p2p pool.
80
- * @param tx - The transaction to be submitted.
81
- */
82
- sendTx(tx: Tx): Promise<void>;
83
-
84
- /**
85
- * Method to retrieve pending txs.
86
- * @returns The pending txs.
87
- */
88
- getPendingTxs(): Promise<Tx[]>;
89
-
90
- /**
91
- * Method to retrieve a single pending tx.
92
- * @param txHash - The transaction hash to return.
93
- * @returns The pending tx if it exists.
94
- */
95
- getPendingTxByHash(txHash: TxHash): Promise<Tx | undefined>;
96
-
97
- /**
98
- * Find the index of the given contract.
99
- * @param leafValue - The value to search for.
100
- * @returns The index of the given leaf in the contracts tree or undefined if not found.
101
- */
102
- findContractIndex(leafValue: Buffer): Promise<bigint | undefined>;
103
-
104
- /**
105
- * Returns the sibling path for the given index in the contract tree.
106
- * @param leafIndex - The index of the leaf for which the sibling path is required.
107
- * @returns The sibling path for the leaf index.
108
- */
109
- getContractPath(leafIndex: bigint): Promise<SiblingPath<typeof CONTRACT_TREE_HEIGHT>>;
110
-
111
- /**
112
- * Find the index of the given commitment.
113
- * @param leafValue - The value to search for.
114
- * @returns The index of the given leaf of undefined if not found.
115
- */
116
- findCommitmentIndex(leafValue: Buffer): Promise<bigint | undefined>;
117
-
118
- /**
119
- * Returns the sibling path for the given index in the data tree.
120
- * @param leafIndex - The index of the leaf for which the sibling path is required.
121
- * @returns The sibling path for the leaf index.
122
- */
123
- getDataTreePath(leafIndex: bigint): Promise<SiblingPath<typeof PRIVATE_DATA_TREE_HEIGHT>>;
124
-
125
- /**
126
- * Gets a confirmed/consumed L1 to L2 message for the given message key (throws if not found).
127
- * and its index in the merkle tree
128
- * @param messageKey - The message key.
129
- * @returns The map containing the message and index.
130
- */
131
- getL1ToL2MessageAndIndex(messageKey: Fr): Promise<L1ToL2MessageAndIndex>;
132
-
133
- /**
134
- * Returns the sibling path for a leaf in the committed l1 to l2 data tree.
135
- * @param leafIndex - Index of the leaf in the tree.
136
- * @returns The sibling path.
137
- */
138
- getL1ToL2MessagesTreePath(leafIndex: bigint): Promise<SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>>;
139
-
140
- /**
141
- * Gets the storage value at the given contract slot. Our version of eth_getStorageAt.
142
- * @param contract - Address of the contract to query.
143
- * @param slot - Slot to query.
144
- * @returns Storage value at the given contract slot (or undefined if not found).
145
- */
146
- getStorageAt(contract: AztecAddress, slot: bigint): Promise<Buffer | undefined>;
147
-
148
- /**
149
- * Returns the current committed roots for the data trees.
150
- * @returns The current committed roots for the data trees.
151
- */
152
- getTreeRoots(): Promise<Record<MerkleTreeId, Fr>>;
153
- }