@aztec/txe 0.66.0 → 0.67.1
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 +3 -3
- package/dest/node/txe_node.d.ts +349 -0
- package/dest/node/txe_node.d.ts.map +1 -0
- package/dest/node/txe_node.js +521 -0
- package/dest/oracle/txe_oracle.d.ts +18 -6
- package/dest/oracle/txe_oracle.d.ts.map +1 -1
- package/dest/oracle/txe_oracle.js +135 -28
- package/dest/txe_service/txe_service.d.ts +4 -1
- package/dest/txe_service/txe_service.d.ts.map +1 -1
- package/dest/txe_service/txe_service.js +15 -6
- package/dest/util/txe_database.d.ts +3 -3
- package/dest/util/txe_database.d.ts.map +1 -1
- package/dest/util/txe_database.js +4 -3
- package/package.json +18 -14
- package/src/bin/index.ts +2 -2
- package/src/node/txe_node.ts +666 -0
- package/src/oracle/txe_oracle.ts +187 -32
- package/src/txe_service/txe_service.ts +18 -5
- package/src/util/txe_database.ts +6 -5
|
@@ -0,0 +1,666 @@
|
|
|
1
|
+
import { type ContractArtifact, createLogger } from '@aztec/aztec.js';
|
|
2
|
+
import {
|
|
3
|
+
type AztecNode,
|
|
4
|
+
type EpochProofQuote,
|
|
5
|
+
type GetUnencryptedLogsResponse,
|
|
6
|
+
type InBlock,
|
|
7
|
+
type L2Block,
|
|
8
|
+
type L2BlockNumber,
|
|
9
|
+
type L2Tips,
|
|
10
|
+
type LogFilter,
|
|
11
|
+
type MerkleTreeId,
|
|
12
|
+
type NullifierMembershipWitness,
|
|
13
|
+
type ProverConfig,
|
|
14
|
+
type PublicDataWitness,
|
|
15
|
+
type PublicSimulationOutput,
|
|
16
|
+
type SequencerConfig,
|
|
17
|
+
type SiblingPath,
|
|
18
|
+
type Tx,
|
|
19
|
+
type TxEffect,
|
|
20
|
+
TxHash,
|
|
21
|
+
type TxReceipt,
|
|
22
|
+
TxScopedL2Log,
|
|
23
|
+
type UnencryptedL2Log,
|
|
24
|
+
} from '@aztec/circuit-types';
|
|
25
|
+
import {
|
|
26
|
+
type ARCHIVE_HEIGHT,
|
|
27
|
+
type AztecAddress,
|
|
28
|
+
type BlockHeader,
|
|
29
|
+
type ContractClassPublic,
|
|
30
|
+
type ContractInstanceWithAddress,
|
|
31
|
+
type GasFees,
|
|
32
|
+
type L1_TO_L2_MSG_TREE_HEIGHT,
|
|
33
|
+
type NOTE_HASH_TREE_HEIGHT,
|
|
34
|
+
type NULLIFIER_TREE_HEIGHT,
|
|
35
|
+
type NodeInfo,
|
|
36
|
+
type PUBLIC_DATA_TREE_HEIGHT,
|
|
37
|
+
type PrivateLog,
|
|
38
|
+
type ProtocolContractAddresses,
|
|
39
|
+
} from '@aztec/circuits.js';
|
|
40
|
+
import { type L1ContractAddresses } from '@aztec/ethereum';
|
|
41
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
42
|
+
|
|
43
|
+
export class TXENode implements AztecNode {
|
|
44
|
+
#logsByTags = new Map<string, TxScopedL2Log[]>();
|
|
45
|
+
#txEffectsByTxHash = new Map<string, InBlock<TxEffect> | undefined>();
|
|
46
|
+
#blockNumberToNullifiers = new Map<number, Fr[]>();
|
|
47
|
+
#noteIndex = 0;
|
|
48
|
+
|
|
49
|
+
#blockNumber: number;
|
|
50
|
+
#logger = createLogger('aztec:txe_node');
|
|
51
|
+
|
|
52
|
+
constructor(blockNumber: number) {
|
|
53
|
+
this.#blockNumber = blockNumber;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Fetches the current block number.
|
|
58
|
+
* @returns The block number.
|
|
59
|
+
*/
|
|
60
|
+
getBlockNumber(): Promise<number> {
|
|
61
|
+
return Promise.resolve(this.#blockNumber);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Sets the current block number of the node.
|
|
66
|
+
* @param - The block number to set.
|
|
67
|
+
*/
|
|
68
|
+
setBlockNumber(blockNumber: number) {
|
|
69
|
+
this.#blockNumber = blockNumber;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Get a tx effect.
|
|
74
|
+
* @param txHash - The hash of a transaction which resulted in the returned tx effect.
|
|
75
|
+
* @returns The requested tx effect.
|
|
76
|
+
*/
|
|
77
|
+
getTxEffect(txHash: TxHash): Promise<InBlock<TxEffect> | undefined> {
|
|
78
|
+
const txEffect = this.#txEffectsByTxHash.get(new Fr(txHash.toBuffer()).toString());
|
|
79
|
+
|
|
80
|
+
return Promise.resolve(txEffect);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Sets a tx effect for a given block number.
|
|
85
|
+
* @param blockNumber - The block number that this tx effect resides.
|
|
86
|
+
* @param txHash - The transaction hash of the transaction.
|
|
87
|
+
* @param effect - The tx effect to set.
|
|
88
|
+
*/
|
|
89
|
+
setTxEffect(blockNumber: number, txHash: TxHash, effect: TxEffect) {
|
|
90
|
+
this.#txEffectsByTxHash.set(new Fr(txHash.toBuffer()).toString(), {
|
|
91
|
+
l2BlockHash: blockNumber.toString(),
|
|
92
|
+
l2BlockNumber: blockNumber,
|
|
93
|
+
data: effect,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Returns the indexes of the given nullifiers in the nullifier tree,
|
|
99
|
+
* scoped to the block they were included in.
|
|
100
|
+
* @param blockNumber - The block number at which to get the data.
|
|
101
|
+
* @param nullifiers - The nullifiers to search for.
|
|
102
|
+
* @returns The block scoped indexes of the given nullifiers in the nullifier tree, or undefined if not found.
|
|
103
|
+
*/
|
|
104
|
+
async findNullifiersIndexesWithBlock(
|
|
105
|
+
blockNumber: L2BlockNumber,
|
|
106
|
+
nullifiers: Fr[],
|
|
107
|
+
): Promise<(InBlock<bigint> | undefined)[]> {
|
|
108
|
+
const parsedBlockNumber = blockNumber === 'latest' ? await this.getBlockNumber() : blockNumber;
|
|
109
|
+
|
|
110
|
+
const nullifiersInBlock: Fr[] = [];
|
|
111
|
+
for (const [key, val] of this.#blockNumberToNullifiers.entries()) {
|
|
112
|
+
if (key < parsedBlockNumber) {
|
|
113
|
+
nullifiersInBlock.push(...val);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return nullifiers.map(nullifier => {
|
|
118
|
+
const possibleNullifierIndex = nullifiersInBlock.findIndex(nullifierInBlock =>
|
|
119
|
+
nullifierInBlock.equals(nullifier),
|
|
120
|
+
);
|
|
121
|
+
return possibleNullifierIndex === -1
|
|
122
|
+
? undefined
|
|
123
|
+
: {
|
|
124
|
+
l2BlockNumber: parsedBlockNumber,
|
|
125
|
+
l2BlockHash: new Fr(parsedBlockNumber).toString(),
|
|
126
|
+
data: BigInt(possibleNullifierIndex),
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Returns the indexes of the given nullifiers in the nullifier tree,
|
|
133
|
+
* scoped to the block they were included in.
|
|
134
|
+
* @param blockNumber - The block number at which to get the data.
|
|
135
|
+
* @param nullifiers - The nullifiers to search for.
|
|
136
|
+
* @returns The block scoped indexes of the given nullifiers in the nullifier tree, or undefined if not found.
|
|
137
|
+
*/
|
|
138
|
+
setNullifiersIndexesWithBlock(blockNumber: number, nullifiers: Fr[]) {
|
|
139
|
+
this.#blockNumberToNullifiers.set(blockNumber, nullifiers);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Adds note logs to the txe node, given a block
|
|
144
|
+
* @param blockNumber - The block number at which to add the note logs.
|
|
145
|
+
* @param privateLogs - The privateLogs that contain the note logs to be added.
|
|
146
|
+
*/
|
|
147
|
+
addNoteLogsByTags(blockNumber: number, privateLogs: PrivateLog[]) {
|
|
148
|
+
privateLogs.forEach(log => {
|
|
149
|
+
const tag = log.fields[0];
|
|
150
|
+
const currentLogs = this.#logsByTags.get(tag.toString()) ?? [];
|
|
151
|
+
const scopedLog = new TxScopedL2Log(
|
|
152
|
+
new TxHash(new Fr(blockNumber).toBuffer()),
|
|
153
|
+
this.#noteIndex,
|
|
154
|
+
blockNumber,
|
|
155
|
+
false,
|
|
156
|
+
log.toBuffer(),
|
|
157
|
+
);
|
|
158
|
+
currentLogs.push(scopedLog);
|
|
159
|
+
this.#logsByTags.set(tag.toString(), currentLogs);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// TODO: DISTINGUISH BETWEEN EVENT LOGS AND NOTE LOGS ?
|
|
163
|
+
this.#noteIndex += privateLogs.length;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Adds public logs to the txe node, given a block
|
|
168
|
+
* @param blockNumber - The block number at which to add the public logs.
|
|
169
|
+
* @param privateLogs - The unencrypted logs to be added.
|
|
170
|
+
*/
|
|
171
|
+
addPublicLogsByTags(blockNumber: number, unencryptedLogs: UnencryptedL2Log[]) {
|
|
172
|
+
unencryptedLogs.forEach(log => {
|
|
173
|
+
if (log.data.length < 32 * 33) {
|
|
174
|
+
// TODO remove when #9835 and #9836 are fixed
|
|
175
|
+
this.#logger.warn(`Skipping unencrypted log with insufficient data length: ${log.data.length}`);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
try {
|
|
179
|
+
// TODO remove when #9835 and #9836 are fixed. The partial note logs are emitted as bytes, but encoded as Fields.
|
|
180
|
+
// This means that for every 32 bytes of payload, we only have 1 byte of data.
|
|
181
|
+
// Also, the tag is not stored in the first 32 bytes of the log, (that's the length of public fields now) but in the next 32.
|
|
182
|
+
const correctedBuffer = Buffer.alloc(32);
|
|
183
|
+
const initialOffset = 32;
|
|
184
|
+
for (let i = 0; i < 32; i++) {
|
|
185
|
+
const byte = Fr.fromBuffer(log.data.subarray(i * 32 + initialOffset, i * 32 + 32 + initialOffset)).toNumber();
|
|
186
|
+
correctedBuffer.writeUInt8(byte, i);
|
|
187
|
+
}
|
|
188
|
+
const tag = new Fr(correctedBuffer);
|
|
189
|
+
|
|
190
|
+
this.#logger.verbose(
|
|
191
|
+
`Found tagged unencrypted log with tag ${tag.toString()} in block ${this.getBlockNumber()}`,
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
const currentLogs = this.#logsByTags.get(tag.toString()) ?? [];
|
|
195
|
+
const scopedLog = new TxScopedL2Log(
|
|
196
|
+
new TxHash(new Fr(blockNumber).toBuffer()),
|
|
197
|
+
this.#noteIndex,
|
|
198
|
+
blockNumber,
|
|
199
|
+
true,
|
|
200
|
+
log.toBuffer(),
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
currentLogs.push(scopedLog);
|
|
204
|
+
this.#logsByTags.set(tag.toString(), currentLogs);
|
|
205
|
+
} catch (err) {
|
|
206
|
+
this.#logger.warn(`Failed to add tagged log to store: ${err}`);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Gets all logs that match any of the received tags (i.e. logs with their first field equal to a tag).
|
|
212
|
+
* @param tags - The tags to filter the logs by.
|
|
213
|
+
* @returns For each received tag, an array of matching logs and metadata (e.g. tx hash) is returned. An empty
|
|
214
|
+
array implies no logs match that tag.
|
|
215
|
+
*/
|
|
216
|
+
getLogsByTags(tags: Fr[]): Promise<TxScopedL2Log[][]> {
|
|
217
|
+
const noteLogs = tags.map(tag => this.#logsByTags.get(tag.toString()) ?? []);
|
|
218
|
+
|
|
219
|
+
return Promise.resolve(noteLogs);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Returns the tips of the L2 chain.
|
|
224
|
+
*/
|
|
225
|
+
getL2Tips(): Promise<L2Tips> {
|
|
226
|
+
throw new Error('TXE Node method getL2Tips not implemented');
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Find the indexes of the given leaves in the given tree.
|
|
231
|
+
* @param blockNumber - The block number at which to get the data or 'latest' for latest data
|
|
232
|
+
* @param treeId - The tree to search in.
|
|
233
|
+
* @param leafValue - The values to search for
|
|
234
|
+
* @returns The indexes of the given leaves in the given tree or undefined if not found.
|
|
235
|
+
*/
|
|
236
|
+
findLeavesIndexes(
|
|
237
|
+
_blockNumber: L2BlockNumber,
|
|
238
|
+
_treeId: MerkleTreeId,
|
|
239
|
+
_leafValues: Fr[],
|
|
240
|
+
): Promise<(bigint | undefined)[]> {
|
|
241
|
+
throw new Error('TXE Node method findLeavesIndexes not implemented');
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Returns a sibling path for the given index in the nullifier tree.
|
|
246
|
+
* @param blockNumber - The block number at which to get the data.
|
|
247
|
+
* @param leafIndex - The index of the leaf for which the sibling path is required.
|
|
248
|
+
* @returns The sibling path for the leaf index.
|
|
249
|
+
*/
|
|
250
|
+
getNullifierSiblingPath(
|
|
251
|
+
_blockNumber: L2BlockNumber,
|
|
252
|
+
_leafIndex: bigint,
|
|
253
|
+
): Promise<SiblingPath<typeof NULLIFIER_TREE_HEIGHT>> {
|
|
254
|
+
throw new Error('TXE Node method getNullifierSiblingPath not implemented');
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Returns a sibling path for the given index in the note hash tree.
|
|
259
|
+
* @param blockNumber - The block number at which to get the data.
|
|
260
|
+
* @param leafIndex - The index of the leaf for which the sibling path is required.
|
|
261
|
+
* @returns The sibling path for the leaf index.
|
|
262
|
+
*/
|
|
263
|
+
getNoteHashSiblingPath(
|
|
264
|
+
_blockNumber: L2BlockNumber,
|
|
265
|
+
_leafIndex: bigint,
|
|
266
|
+
): Promise<SiblingPath<typeof NOTE_HASH_TREE_HEIGHT>> {
|
|
267
|
+
throw new Error('TXE Node method getNoteHashSiblingPath not implemented');
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Returns the index and a sibling path for a leaf in the committed l1 to l2 data tree.
|
|
272
|
+
* @param blockNumber - The block number at which to get the data.
|
|
273
|
+
* @param l1ToL2Message - The l1ToL2Message to get the index / sibling path for.
|
|
274
|
+
* @returns A tuple of the index and the sibling path of the L1ToL2Message (undefined if not found).
|
|
275
|
+
*/
|
|
276
|
+
getL1ToL2MessageMembershipWitness(
|
|
277
|
+
_blockNumber: L2BlockNumber,
|
|
278
|
+
_l1ToL2Message: Fr,
|
|
279
|
+
): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>] | undefined> {
|
|
280
|
+
throw new Error('TXE Node method getL1ToL2MessageMembershipWitness not implemented');
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Returns whether an L1 to L2 message is synced by archiver and if it's ready to be included in a block.
|
|
285
|
+
* @param l1ToL2Message - The L1 to L2 message to check.
|
|
286
|
+
* @returns Whether the message is synced and ready to be included in a block.
|
|
287
|
+
*/
|
|
288
|
+
isL1ToL2MessageSynced(_l1ToL2Message: Fr): Promise<boolean> {
|
|
289
|
+
throw new Error('TXE Node method isL1ToL2MessageSynced not implemented');
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Returns a membership witness of an l2ToL1Message in an ephemeral l2 to l1 message tree.
|
|
294
|
+
* @dev Membership witness is a consists of the index and the sibling path of the l2ToL1Message.
|
|
295
|
+
* @remarks This tree is considered ephemeral because it is created on-demand by: taking all the l2ToL1 messages
|
|
296
|
+
* in a single block, and then using them to make a variable depth append-only tree with these messages as leaves.
|
|
297
|
+
* The tree is discarded immediately after calculating what we need from it.
|
|
298
|
+
* @param blockNumber - The block number at which to get the data.
|
|
299
|
+
* @param l2ToL1Message - The l2ToL1Message to get the membership witness for.
|
|
300
|
+
* @returns A tuple of the index and the sibling path of the L2ToL1Message.
|
|
301
|
+
*/
|
|
302
|
+
getL2ToL1MessageMembershipWitness(
|
|
303
|
+
_blockNumber: L2BlockNumber,
|
|
304
|
+
_l2ToL1Message: Fr,
|
|
305
|
+
): Promise<[bigint, SiblingPath<number>]> {
|
|
306
|
+
throw new Error('TXE Node method getL2ToL1MessageMembershipWitness not implemented');
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Returns a sibling path for a leaf in the committed historic blocks tree.
|
|
311
|
+
* @param blockNumber - The block number at which to get the data.
|
|
312
|
+
* @param leafIndex - Index of the leaf in the tree.
|
|
313
|
+
* @returns The sibling path.
|
|
314
|
+
*/
|
|
315
|
+
getArchiveSiblingPath(_blockNumber: L2BlockNumber, _leafIndex: bigint): Promise<SiblingPath<typeof ARCHIVE_HEIGHT>> {
|
|
316
|
+
throw new Error('TXE Node method getArchiveSiblingPath not implemented');
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Returns a sibling path for a leaf in the committed public data tree.
|
|
321
|
+
* @param blockNumber - The block number at which to get the data.
|
|
322
|
+
* @param leafIndex - Index of the leaf in the tree.
|
|
323
|
+
* @returns The sibling path.
|
|
324
|
+
*/
|
|
325
|
+
getPublicDataSiblingPath(
|
|
326
|
+
_blockNumber: L2BlockNumber,
|
|
327
|
+
_leafIndex: bigint,
|
|
328
|
+
): Promise<SiblingPath<typeof PUBLIC_DATA_TREE_HEIGHT>> {
|
|
329
|
+
throw new Error('TXE Node method getPublicDataSiblingPath not implemented');
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Returns a nullifier membership witness for a given nullifier at a given block.
|
|
334
|
+
* @param blockNumber - The block number at which to get the data.
|
|
335
|
+
* @param nullifier - Nullifier we try to find witness for.
|
|
336
|
+
* @returns The nullifier membership witness (if found).
|
|
337
|
+
*/
|
|
338
|
+
getNullifierMembershipWitness(
|
|
339
|
+
_blockNumber: L2BlockNumber,
|
|
340
|
+
_nullifier: Fr,
|
|
341
|
+
): Promise<NullifierMembershipWitness | undefined> {
|
|
342
|
+
throw new Error('TXE Node method getNullifierMembershipWitness not implemented');
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
347
|
+
* @param blockNumber - The block number at which to get the data.
|
|
348
|
+
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
349
|
+
* @returns The low nullifier membership witness (if found).
|
|
350
|
+
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
351
|
+
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
352
|
+
* we are trying to prove non-inclusion for.
|
|
353
|
+
*/
|
|
354
|
+
getLowNullifierMembershipWitness(
|
|
355
|
+
_blockNumber: L2BlockNumber,
|
|
356
|
+
_nullifier: Fr,
|
|
357
|
+
): Promise<NullifierMembershipWitness | undefined> {
|
|
358
|
+
throw new Error('TXE Node method getLowNullifierMembershipWitness not implemented');
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Returns a public data tree witness for a given leaf slot at a given block.
|
|
363
|
+
* @param blockNumber - The block number at which to get the data.
|
|
364
|
+
* @param leafSlot - The leaf slot we try to find the witness for.
|
|
365
|
+
* @returns The public data witness (if found).
|
|
366
|
+
* @remarks The witness can be used to compute the current value of the public data tree leaf. If the low leaf preimage corresponds to an
|
|
367
|
+
* "in range" slot, means that the slot doesn't exist and the value is 0. If the low leaf preimage corresponds to the exact slot, the current value
|
|
368
|
+
* is contained in the leaf preimage.
|
|
369
|
+
*/
|
|
370
|
+
getPublicDataTreeWitness(_blockNumber: L2BlockNumber, _leafSlot: Fr): Promise<PublicDataWitness | undefined> {
|
|
371
|
+
throw new Error('TXE Node method getPublicDataTreeWitness not implemented');
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Get a block specified by its number.
|
|
376
|
+
* @param number - The block number being requested.
|
|
377
|
+
* @returns The requested block.
|
|
378
|
+
*/
|
|
379
|
+
getBlock(_number: number): Promise<L2Block | undefined> {
|
|
380
|
+
throw new Error('TXE Node method getBlock not implemented');
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Fetches the latest proven block number.
|
|
385
|
+
* @returns The block number.
|
|
386
|
+
*/
|
|
387
|
+
getProvenBlockNumber(): Promise<number> {
|
|
388
|
+
throw new Error('TXE Node method getProvenBlockNumber not implemented');
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Method to determine if the node is ready to accept transactions.
|
|
393
|
+
* @returns - Flag indicating the readiness for tx submission.
|
|
394
|
+
*/
|
|
395
|
+
isReady(): Promise<boolean> {
|
|
396
|
+
throw new Error('TXE Node method isReady not implemented');
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Method to request blocks. Will attempt to return all requested blocks but will return only those available.
|
|
401
|
+
* @param from - The start of the range of blocks to return.
|
|
402
|
+
* @param limit - The maximum number of blocks to return.
|
|
403
|
+
* @returns The blocks requested.
|
|
404
|
+
*/
|
|
405
|
+
getBlocks(_from: number, _limit: number): Promise<L2Block[]> {
|
|
406
|
+
throw new Error('TXE Node method getBlocks not implemented');
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Method to fetch the version of the package.
|
|
411
|
+
* @returns The node package version
|
|
412
|
+
*/
|
|
413
|
+
getNodeVersion(): Promise<string> {
|
|
414
|
+
throw new Error('TXE Node method getNodeVersion not implemented');
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Method to fetch the version of the rollup the node is connected to.
|
|
419
|
+
* @returns The rollup version.
|
|
420
|
+
*/
|
|
421
|
+
getVersion(): Promise<number> {
|
|
422
|
+
throw new Error('TXE Node method getVersion not implemented');
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Method to fetch the chain id of the base-layer for the rollup.
|
|
427
|
+
* @returns The chain id.
|
|
428
|
+
*/
|
|
429
|
+
getChainId(): Promise<number> {
|
|
430
|
+
throw new Error('TXE Node method getChainId not implemented');
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Method to fetch the currently deployed l1 contract addresses.
|
|
435
|
+
* @returns The deployed contract addresses.
|
|
436
|
+
*/
|
|
437
|
+
getL1ContractAddresses(): Promise<L1ContractAddresses> {
|
|
438
|
+
throw new Error('TXE Node method getL1ContractAddresses not implemented');
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Method to fetch the protocol contract addresses.
|
|
443
|
+
*/
|
|
444
|
+
getProtocolContractAddresses(): Promise<ProtocolContractAddresses> {
|
|
445
|
+
throw new Error('TXE Node method getProtocolContractAddresses not implemented');
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Method to add a contract artifact to the database.
|
|
450
|
+
* @param aztecAddress
|
|
451
|
+
* @param artifact
|
|
452
|
+
*/
|
|
453
|
+
addContractArtifact(_address: AztecAddress, _artifact: ContractArtifact): Promise<void> {
|
|
454
|
+
throw new Error('TXE Node method addContractArtifact not implemented');
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Gets unencrypted logs based on the provided filter.
|
|
459
|
+
* @param filter - The filter to apply to the logs.
|
|
460
|
+
* @returns The requested logs.
|
|
461
|
+
*/
|
|
462
|
+
getUnencryptedLogs(_filter: LogFilter): Promise<GetUnencryptedLogsResponse> {
|
|
463
|
+
throw new Error('TXE Node method getUnencryptedLogs not implemented');
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Gets contract class logs based on the provided filter.
|
|
468
|
+
* @param filter - The filter to apply to the logs.
|
|
469
|
+
* @returns The requested logs.
|
|
470
|
+
*/
|
|
471
|
+
getContractClassLogs(_filter: LogFilter): Promise<GetUnencryptedLogsResponse> {
|
|
472
|
+
throw new Error('TXE Node method getContractClassLogs not implemented');
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Method to submit a transaction to the p2p pool.
|
|
477
|
+
* @param tx - The transaction to be submitted.
|
|
478
|
+
* @returns Nothing.
|
|
479
|
+
*/
|
|
480
|
+
sendTx(_tx: Tx): Promise<void> {
|
|
481
|
+
throw new Error('TXE Node method sendTx not implemented');
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Fetches a transaction receipt for a given transaction hash. Returns a mined receipt if it was added
|
|
486
|
+
* to the chain, a pending receipt if it's still in the mempool of the connected Aztec node, or a dropped
|
|
487
|
+
* receipt if not found in the connected Aztec node.
|
|
488
|
+
*
|
|
489
|
+
* @param txHash - The transaction hash.
|
|
490
|
+
* @returns A receipt of the transaction.
|
|
491
|
+
*/
|
|
492
|
+
getTxReceipt(_txHash: TxHash): Promise<TxReceipt> {
|
|
493
|
+
throw new Error('TXE Node method getTxReceipt not implemented');
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Method to retrieve pending txs.
|
|
498
|
+
* @returns The pending txs.
|
|
499
|
+
*/
|
|
500
|
+
getPendingTxs(): Promise<Tx[]> {
|
|
501
|
+
throw new Error('TXE Node method getPendingTxs not implemented');
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Retrieves the number of pending txs
|
|
506
|
+
* @returns The number of pending txs.
|
|
507
|
+
*/
|
|
508
|
+
getPendingTxCount(): Promise<number> {
|
|
509
|
+
throw new Error('TXE Node method getPendingTxCount not implemented');
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Method to retrieve a single pending tx.
|
|
514
|
+
* @param txHash - The transaction hash to return.
|
|
515
|
+
* @returns The pending tx if it exists.
|
|
516
|
+
*/
|
|
517
|
+
getTxByHash(_txHash: TxHash): Promise<Tx | undefined> {
|
|
518
|
+
throw new Error('TXE Node method getTxByHash not implemented');
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Gets the storage value at the given contract storage slot.
|
|
523
|
+
*
|
|
524
|
+
* @remarks The storage slot here refers to the slot as it is defined in Noir not the index in the merkle tree.
|
|
525
|
+
* Aztec's version of `eth_getStorageAt`.
|
|
526
|
+
*
|
|
527
|
+
* @param contract - Address of the contract to query.
|
|
528
|
+
* @param slot - Slot to query.
|
|
529
|
+
* @param blockNumber - The block number at which to get the data or 'latest'.
|
|
530
|
+
* @returns Storage value at the given contract slot.
|
|
531
|
+
*/
|
|
532
|
+
getPublicStorageAt(_contract: AztecAddress, _slot: Fr, _blockNumber: L2BlockNumber): Promise<Fr> {
|
|
533
|
+
throw new Error('TXE Node method getPublicStorageAt not implemented');
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Returns the currently committed block header.
|
|
538
|
+
* @returns The current committed block header.
|
|
539
|
+
*/
|
|
540
|
+
getBlockHeader(_blockNumber?: L2BlockNumber): Promise<BlockHeader> {
|
|
541
|
+
throw new Error('TXE Node method getBlockHeader not implemented');
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Simulates the public part of a transaction with the current state.
|
|
546
|
+
* This currently just checks that the transaction execution succeeds.
|
|
547
|
+
* @param tx - The transaction to simulate.
|
|
548
|
+
**/
|
|
549
|
+
simulatePublicCalls(_tx: Tx): Promise<PublicSimulationOutput> {
|
|
550
|
+
throw new Error('TXE Node method simulatePublicCalls not implemented');
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Returns true if the transaction is valid for inclusion at the current state. Valid transactions can be
|
|
555
|
+
* made invalid by *other* transactions if e.g. they emit the same nullifiers, or come become invalid
|
|
556
|
+
* due to e.g. the max_block_number property.
|
|
557
|
+
* @param tx - The transaction to validate for correctness.
|
|
558
|
+
* @param isSimulation - True if the transaction is a simulated one without generated proofs. (Optional)
|
|
559
|
+
*/
|
|
560
|
+
isValidTx(_tx: Tx, _isSimulation?: boolean): Promise<boolean> {
|
|
561
|
+
throw new Error('TXE Node method isValidTx not implemented');
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Updates the configuration of this node.
|
|
566
|
+
* @param config - Updated configuration to be merged with the current one.
|
|
567
|
+
*/
|
|
568
|
+
setConfig(_config: Partial<SequencerConfig & ProverConfig>): Promise<void> {
|
|
569
|
+
throw new Error('TXE Node method setConfig not implemented');
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Returns a registered contract class given its id.
|
|
574
|
+
* @param id - Id of the contract class.
|
|
575
|
+
*/
|
|
576
|
+
getContractClass(_id: Fr): Promise<ContractClassPublic | undefined> {
|
|
577
|
+
throw new Error('TXE Node method getContractClass not implemented');
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Returns a publicly deployed contract instance given its address.
|
|
582
|
+
* @param address - Address of the deployed contract.
|
|
583
|
+
*/
|
|
584
|
+
getContract(_address: AztecAddress): Promise<ContractInstanceWithAddress | undefined> {
|
|
585
|
+
throw new Error('TXE Node method getContract not implemented');
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/** Forces the next block to be built bypassing all time and pending checks. Useful for testing. */
|
|
589
|
+
flushTxs(): Promise<void> {
|
|
590
|
+
throw new Error('TXE Node method flushTxs not implemented');
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Returns the ENR of this node for peer discovery, if available.
|
|
595
|
+
*/
|
|
596
|
+
getEncodedEnr(): Promise<string | undefined> {
|
|
597
|
+
throw new Error('TXE Node method getEncodedEnr not implemented');
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Receives a quote for an epoch proof and stores it in its EpochProofQuotePool
|
|
602
|
+
* @param quote - The quote to store
|
|
603
|
+
*/
|
|
604
|
+
addEpochProofQuote(_quote: EpochProofQuote): Promise<void> {
|
|
605
|
+
throw new Error('TXE Node method addEpochProofQuote not implemented');
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Returns the received quotes for a given epoch
|
|
610
|
+
* @param epoch - The epoch for which to get the quotes
|
|
611
|
+
*/
|
|
612
|
+
getEpochProofQuotes(_epoch: bigint): Promise<EpochProofQuote[]> {
|
|
613
|
+
throw new Error('TXE Node method getEpochProofQuotes not implemented');
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Adds a contract class bypassing the registerer.
|
|
618
|
+
* TODO(#10007): Remove this method.
|
|
619
|
+
* @param contractClass - The class to register.
|
|
620
|
+
*/
|
|
621
|
+
addContractClass(_contractClass: ContractClassPublic): Promise<void> {
|
|
622
|
+
throw new Error('TXE Node method addContractClass not implemented');
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Method to fetch the current base fees.
|
|
627
|
+
* @returns The current base fees.
|
|
628
|
+
*/
|
|
629
|
+
getCurrentBaseFees(): Promise<GasFees> {
|
|
630
|
+
throw new Error('TXE Node method getCurrentBaseFees not implemented');
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Retrieves all private logs from up to `limit` blocks, starting from the block number `from`.
|
|
635
|
+
* @param from - The block number from which to begin retrieving logs.
|
|
636
|
+
* @param limit - The maximum number of blocks to retrieve logs from.
|
|
637
|
+
* @returns An array of private logs from the specified range of blocks.
|
|
638
|
+
*/
|
|
639
|
+
getPrivateLogs(_from: number, _limit: number): Promise<PrivateLog[]> {
|
|
640
|
+
throw new Error('TXE Node method getPrivateLogs not implemented');
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Find the block numbers of the given leaf indices in the given tree.
|
|
645
|
+
* @param blockNumber - The block number at which to get the data or 'latest' for latest data
|
|
646
|
+
* @param treeId - The tree to search in.
|
|
647
|
+
* @param leafIndices - The values to search for
|
|
648
|
+
* @returns The indexes of the given leaves in the given tree or undefined if not found.
|
|
649
|
+
*/
|
|
650
|
+
findBlockNumbersForIndexes(
|
|
651
|
+
_blockNumber: L2BlockNumber,
|
|
652
|
+
_treeId: MerkleTreeId,
|
|
653
|
+
_leafIndices: bigint[],
|
|
654
|
+
): Promise<(bigint | undefined)[]> {
|
|
655
|
+
throw new Error('TXE Node method findBlockNumbersForIndexes not implemented');
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Returns the information about the server's node. Includes current Node version, compatible Noir version,
|
|
660
|
+
* L1 chain identifier, protocol version, and L1 address of the rollup contract.
|
|
661
|
+
* @returns - The node information.
|
|
662
|
+
*/
|
|
663
|
+
getNodeInfo(): Promise<NodeInfo> {
|
|
664
|
+
throw new Error('TXE Node method getNodeInfo not implemented');
|
|
665
|
+
}
|
|
666
|
+
}
|