@aztec/txe 0.81.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/bin/index.js +1 -0
- package/dest/node/txe_node.d.ts +3 -33
- package/dest/node/txe_node.d.ts.map +1 -1
- package/dest/node/txe_node.js +50 -55
- package/dest/oracle/txe_oracle.d.ts +4 -3
- package/dest/oracle/txe_oracle.d.ts.map +1 -1
- package/dest/oracle/txe_oracle.js +11 -13
- package/dest/txe_service/txe_service.d.ts +1 -1
- package/dest/txe_service/txe_service.d.ts.map +1 -1
- package/dest/txe_service/txe_service.js +21 -39
- package/dest/util/txe_public_contract_data_source.d.ts +0 -1
- package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.js +0 -5
- package/package.json +12 -12
- package/src/bin/index.ts +1 -0
- package/src/node/txe_node.ts +56 -76
- package/src/oracle/txe_oracle.ts +7 -11
- package/src/txe_service/txe_service.ts +18 -17
- package/src/util/txe_public_contract_data_source.ts +0 -6
package/dest/bin/index.js
CHANGED
|
@@ -18,6 +18,7 @@ import { createTXERpcServer } from '../index.js';
|
|
|
18
18
|
logger.info(`Setting up TXE...`);
|
|
19
19
|
const txeServer = createTXERpcServer(logger);
|
|
20
20
|
const { port } = await startHttpRpcServer(txeServer, {
|
|
21
|
+
host: '0.0.0.0',
|
|
21
22
|
port: TXE_PORT,
|
|
22
23
|
timeoutMs: 1e3 * 60 * 5
|
|
23
24
|
});
|
package/dest/node/txe_node.d.ts
CHANGED
|
@@ -43,22 +43,6 @@ export declare class TXENode implements AztecNode {
|
|
|
43
43
|
* @param effect - The tx effect to set.
|
|
44
44
|
*/
|
|
45
45
|
setTxEffect(blockNumber: number, txHash: TxHash, effect: TxEffect): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Returns the indexes of the given nullifiers in the nullifier tree,
|
|
48
|
-
* scoped to the block they were included in.
|
|
49
|
-
* @param blockNumber - The block number at which to get the data.
|
|
50
|
-
* @param nullifiers - The nullifiers to search for.
|
|
51
|
-
* @returns The block scoped indexes of the given nullifiers in the nullifier tree, or undefined if not found.
|
|
52
|
-
*/
|
|
53
|
-
findNullifiersIndexesWithBlock(blockNumber: L2BlockNumber, nullifiers: Fr[]): Promise<(InBlock<bigint> | undefined)[]>;
|
|
54
|
-
/**
|
|
55
|
-
* Returns the indexes of the given nullifiers in the nullifier tree,
|
|
56
|
-
* scoped to the block they were included in.
|
|
57
|
-
* @param blockNumber - The block number at which to get the data.
|
|
58
|
-
* @param nullifiers - The nullifiers to search for.
|
|
59
|
-
* @returns The block scoped indexes of the given nullifiers in the nullifier tree, or undefined if not found.
|
|
60
|
-
*/
|
|
61
|
-
setNullifiersIndexesWithBlock(blockNumber: number, nullifiers: Fr[]): void;
|
|
62
46
|
/**
|
|
63
47
|
* Adds private logs to the txe node, given a block
|
|
64
48
|
* @param blockNumber - The block number at which to add the private logs.
|
|
@@ -87,9 +71,9 @@ export declare class TXENode implements AztecNode {
|
|
|
87
71
|
* @param blockNumber - The block number at which to get the data or 'latest' for latest data
|
|
88
72
|
* @param treeId - The tree to search in.
|
|
89
73
|
* @param leafValue - The values to search for
|
|
90
|
-
* @returns The
|
|
74
|
+
* @returns The indices of leaves and the block metadata of a block in which the leaf was inserted.
|
|
91
75
|
*/
|
|
92
|
-
findLeavesIndexes(blockNumber: L2BlockNumber, treeId: MerkleTreeId, leafValues: Fr[]): Promise<(bigint | undefined)[]>;
|
|
76
|
+
findLeavesIndexes(blockNumber: L2BlockNumber, treeId: MerkleTreeId, leafValues: Fr[]): Promise<(InBlock<bigint> | undefined)[]>;
|
|
93
77
|
/**
|
|
94
78
|
* Returns a sibling path for the given index in the nullifier tree.
|
|
95
79
|
* @param blockNumber - The block number at which to get the data.
|
|
@@ -168,7 +152,7 @@ export declare class TXENode implements AztecNode {
|
|
|
168
152
|
* "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
|
|
169
153
|
* is contained in the leaf preimage.
|
|
170
154
|
*/
|
|
171
|
-
|
|
155
|
+
getPublicDataWitness(_blockNumber: L2BlockNumber, _leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
172
156
|
/**
|
|
173
157
|
* Get a block specified by its number.
|
|
174
158
|
* @param number - The block number being requested.
|
|
@@ -319,12 +303,6 @@ export declare class TXENode implements AztecNode {
|
|
|
319
303
|
* Returns the ENR of this node for peer discovery, if available.
|
|
320
304
|
*/
|
|
321
305
|
getEncodedEnr(): Promise<string | undefined>;
|
|
322
|
-
/**
|
|
323
|
-
* Adds a contract class bypassing the registerer.
|
|
324
|
-
* TODO(#10007): Remove this method.
|
|
325
|
-
* @param contractClass - The class to register.
|
|
326
|
-
*/
|
|
327
|
-
addContractClass(_contractClass: ContractClassPublic): Promise<void>;
|
|
328
306
|
/**
|
|
329
307
|
* Method to fetch the current base fees.
|
|
330
308
|
* @returns The current base fees.
|
|
@@ -337,14 +315,6 @@ export declare class TXENode implements AztecNode {
|
|
|
337
315
|
* @returns An array of private logs from the specified range of blocks.
|
|
338
316
|
*/
|
|
339
317
|
getPrivateLogs(_from: number, _limit: number): Promise<PrivateLog[]>;
|
|
340
|
-
/**
|
|
341
|
-
* Find the block numbers of the given leaf indices in the given tree.
|
|
342
|
-
* @param blockNumber - The block number at which to get the data or 'latest' for latest data
|
|
343
|
-
* @param treeId - The tree to search in.
|
|
344
|
-
* @param leafIndices - The values to search for
|
|
345
|
-
* @returns The indexes of the given leaves in the given tree or undefined if not found.
|
|
346
|
-
*/
|
|
347
|
-
findBlockNumbersForIndexes(_blockNumber: L2BlockNumber, _treeId: MerkleTreeId, _leafIndices: bigint[]): Promise<(bigint | undefined)[]>;
|
|
348
318
|
/**
|
|
349
319
|
* Returns the information about the server's node. Includes current Node version, compatible Noir version,
|
|
350
320
|
* L1 chain identifier, protocol version, and L1 address of the rollup contract.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"txe_node.d.ts","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CAAC;IAItC;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAIpE;;;;OAIG;IACH,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC;IAIhC;;OAEG;IACH,uBAAuB,IAAI,OAAO,CAAC,oBAAoB,CAAC;CAGzD"}
|
package/dest/node/txe_node.js
CHANGED
|
@@ -15,7 +15,6 @@ export class TXENode {
|
|
|
15
15
|
#logsByTags;
|
|
16
16
|
#txEffectsByTxHash;
|
|
17
17
|
#txReceiptsByTxHash;
|
|
18
|
-
#blockNumberToNullifiers;
|
|
19
18
|
#noteIndex;
|
|
20
19
|
#logger;
|
|
21
20
|
constructor(blockNumber, version, chainId, nativeWorldStateService, baseFork){
|
|
@@ -27,7 +26,6 @@ export class TXENode {
|
|
|
27
26
|
this.#logsByTags = new Map();
|
|
28
27
|
this.#txEffectsByTxHash = new Map();
|
|
29
28
|
this.#txReceiptsByTxHash = new Map();
|
|
30
|
-
this.#blockNumberToNullifiers = new Map();
|
|
31
29
|
this.#noteIndex = 0;
|
|
32
30
|
this.#logger = createLogger('aztec:txe_node');
|
|
33
31
|
}
|
|
@@ -69,39 +67,7 @@ export class TXENode {
|
|
|
69
67
|
});
|
|
70
68
|
// We also set the receipt since we want to be able to serve `getTxReceipt` - we don't care about most values here,
|
|
71
69
|
// but we do need to be able to retrieve the block number of a given txHash.
|
|
72
|
-
this.#txReceiptsByTxHash.set(txHash.toString(), new TxReceipt(txHash, TxReceipt.statusFromRevertCode(effect.revertCode), '', undefined, new L2BlockHash(blockHash.toBuffer()), blockNumber
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Returns the indexes of the given nullifiers in the nullifier tree,
|
|
76
|
-
* scoped to the block they were included in.
|
|
77
|
-
* @param blockNumber - The block number at which to get the data.
|
|
78
|
-
* @param nullifiers - The nullifiers to search for.
|
|
79
|
-
* @returns The block scoped indexes of the given nullifiers in the nullifier tree, or undefined if not found.
|
|
80
|
-
*/ async findNullifiersIndexesWithBlock(blockNumber, nullifiers) {
|
|
81
|
-
const parsedBlockNumber = blockNumber === 'latest' ? await this.getBlockNumber() : blockNumber;
|
|
82
|
-
const nullifiersInBlock = [];
|
|
83
|
-
for (const [key, val] of this.#blockNumberToNullifiers.entries()){
|
|
84
|
-
if (key <= parsedBlockNumber) {
|
|
85
|
-
nullifiersInBlock.push(...val);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return nullifiers.map((nullifier)=>{
|
|
89
|
-
const possibleNullifierIndex = nullifiersInBlock.findIndex((nullifierInBlock)=>nullifierInBlock.equals(nullifier));
|
|
90
|
-
return possibleNullifierIndex === -1 ? undefined : {
|
|
91
|
-
l2BlockNumber: parsedBlockNumber,
|
|
92
|
-
l2BlockHash: new Fr(parsedBlockNumber).toString(),
|
|
93
|
-
data: BigInt(possibleNullifierIndex)
|
|
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
|
-
*/ setNullifiersIndexesWithBlock(blockNumber, nullifiers) {
|
|
104
|
-
this.#blockNumberToNullifiers.set(blockNumber, nullifiers);
|
|
70
|
+
this.#txReceiptsByTxHash.set(txHash.toString(), new TxReceipt(txHash, TxReceipt.statusFromRevertCode(effect.revertCode), '', undefined, new L2BlockHash(blockHash.toBuffer()), blockNumber));
|
|
105
71
|
}
|
|
106
72
|
/**
|
|
107
73
|
* Adds private logs to the txe node, given a block
|
|
@@ -151,14 +117,59 @@ export class TXENode {
|
|
|
151
117
|
* @param blockNumber - The block number at which to get the data or 'latest' for latest data
|
|
152
118
|
* @param treeId - The tree to search in.
|
|
153
119
|
* @param leafValue - The values to search for
|
|
154
|
-
* @returns The
|
|
120
|
+
* @returns The indices of leaves and the block metadata of a block in which the leaf was inserted.
|
|
155
121
|
*/ async findLeavesIndexes(blockNumber, treeId, leafValues) {
|
|
156
122
|
// Temporary workaround to be able to respond this query: the trees are currently stored in the TXE oracle, but we
|
|
157
123
|
// hold a reference to them.
|
|
158
124
|
// We should likely migrate this so that the trees are owned by the node.
|
|
159
125
|
// TODO: blockNumber is being passed as undefined, figure out why
|
|
160
126
|
const db = blockNumber === await this.getBlockNumber() || blockNumber === 'latest' || blockNumber === undefined ? this.baseFork : this.nativeWorldStateService.getSnapshot(blockNumber);
|
|
161
|
-
|
|
127
|
+
const maybeIndices = await db.findLeafIndices(treeId, leafValues.map((x)=>x.toBuffer()));
|
|
128
|
+
// We filter out undefined values
|
|
129
|
+
const indices = maybeIndices.filter((x)=>x !== undefined);
|
|
130
|
+
// Now we find the block numbers for the indices
|
|
131
|
+
const blockNumbers = await db.getBlockNumbersForLeafIndices(treeId, indices);
|
|
132
|
+
// If any of the block numbers are undefined, we throw an error.
|
|
133
|
+
for(let i = 0; i < indices.length; i++){
|
|
134
|
+
if (blockNumbers[i] === undefined) {
|
|
135
|
+
throw new Error(`Block number is undefined for leaf index ${indices[i]} in tree ${MerkleTreeId[treeId]}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Get unique block numbers in order to optimize num calls to getLeafValue function.
|
|
139
|
+
const uniqueBlockNumbers = [
|
|
140
|
+
...new Set(blockNumbers.filter((x)=>x !== undefined))
|
|
141
|
+
];
|
|
142
|
+
// Now we obtain the block hashes from the archive tree by calling await `committedDb.getLeafValue(treeId, index)`
|
|
143
|
+
// (note that block number corresponds to the leaf index in the archive tree).
|
|
144
|
+
const blockHashes = await Promise.all(uniqueBlockNumbers.map((blockNumber)=>{
|
|
145
|
+
return db.getLeafValue(MerkleTreeId.ARCHIVE, blockNumber);
|
|
146
|
+
}));
|
|
147
|
+
// If any of the block hashes are undefined, we throw an error.
|
|
148
|
+
for(let i = 0; i < uniqueBlockNumbers.length; i++){
|
|
149
|
+
if (blockHashes[i] === undefined) {
|
|
150
|
+
throw new Error(`Block hash is undefined for block number ${uniqueBlockNumbers[i]}`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// Create InBlock objects by combining indices, blockNumbers and blockHashes
|
|
154
|
+
return maybeIndices.map((index, i)=>{
|
|
155
|
+
if (index === undefined) {
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
const blockNumber = blockNumbers[i];
|
|
159
|
+
if (blockNumber === undefined) {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
const blockHashIndex = uniqueBlockNumbers.indexOf(blockNumber);
|
|
163
|
+
const blockHash = blockHashes[blockHashIndex]?.toString();
|
|
164
|
+
if (!blockHash) {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
l2BlockNumber: Number(blockNumber),
|
|
169
|
+
l2BlockHash: blockHash,
|
|
170
|
+
data: index
|
|
171
|
+
};
|
|
172
|
+
});
|
|
162
173
|
}
|
|
163
174
|
/**
|
|
164
175
|
* Returns a sibling path for the given index in the nullifier tree.
|
|
@@ -246,8 +257,8 @@ export class TXENode {
|
|
|
246
257
|
* @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
|
|
247
258
|
* "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
|
|
248
259
|
* is contained in the leaf preimage.
|
|
249
|
-
*/
|
|
250
|
-
throw new Error('TXE Node method
|
|
260
|
+
*/ getPublicDataWitness(_blockNumber, _leafSlot) {
|
|
261
|
+
throw new Error('TXE Node method getPublicDataWitness not implemented');
|
|
251
262
|
}
|
|
252
263
|
/**
|
|
253
264
|
* Get a block specified by its number.
|
|
@@ -441,13 +452,6 @@ export class TXENode {
|
|
|
441
452
|
throw new Error('TXE Node method getEncodedEnr not implemented');
|
|
442
453
|
}
|
|
443
454
|
/**
|
|
444
|
-
* Adds a contract class bypassing the registerer.
|
|
445
|
-
* TODO(#10007): Remove this method.
|
|
446
|
-
* @param contractClass - The class to register.
|
|
447
|
-
*/ addContractClass(_contractClass) {
|
|
448
|
-
throw new Error('TXE Node method addContractClass not implemented');
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
455
|
* Method to fetch the current base fees.
|
|
452
456
|
* @returns The current base fees.
|
|
453
457
|
*/ getCurrentBaseFees() {
|
|
@@ -462,15 +466,6 @@ export class TXENode {
|
|
|
462
466
|
throw new Error('TXE Node method getPrivateLogs not implemented');
|
|
463
467
|
}
|
|
464
468
|
/**
|
|
465
|
-
* Find the block numbers of the given leaf indices in the given tree.
|
|
466
|
-
* @param blockNumber - The block number at which to get the data or 'latest' for latest data
|
|
467
|
-
* @param treeId - The tree to search in.
|
|
468
|
-
* @param leafIndices - The values to search for
|
|
469
|
-
* @returns The indexes of the given leaves in the given tree or undefined if not found.
|
|
470
|
-
*/ findBlockNumbersForIndexes(_blockNumber, _treeId, _leafIndices) {
|
|
471
|
-
throw new Error('TXE Node method findBlockNumbersForIndexes not implemented');
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
469
|
* Returns the information about the server's node. Includes current Node version, compatible Noir version,
|
|
475
470
|
* L1 chain identifier, protocol version, and L1 address of the rollup contract.
|
|
476
471
|
* @returns - The node information.
|
|
@@ -10,6 +10,7 @@ import { AddressDataProvider, ContractDataProvider } from '@aztec/pxe/server';
|
|
|
10
10
|
import { type MessageLoadOracleInputs, type NoteData, type TypedOracle } from '@aztec/simulator/client';
|
|
11
11
|
import { type PublicTxResult } from '@aztec/simulator/server';
|
|
12
12
|
import { type ContractArtifact, type FunctionAbi, FunctionSelector, type NoteSelector } from '@aztec/stdlib/abi';
|
|
13
|
+
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
13
14
|
import { PublicDataWrite } from '@aztec/stdlib/avm';
|
|
14
15
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
15
16
|
import type { ContractInstance, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
@@ -30,7 +31,6 @@ export declare class TXE implements TypedOracle {
|
|
|
30
31
|
private syncDataProvider;
|
|
31
32
|
private taggingDataProvider;
|
|
32
33
|
private addressDataProvider;
|
|
33
|
-
private authWitnessDataProvider;
|
|
34
34
|
private accountDataProvider;
|
|
35
35
|
private executionCache;
|
|
36
36
|
private contractAddress;
|
|
@@ -55,6 +55,7 @@ export declare class TXE implements TypedOracle {
|
|
|
55
55
|
private node;
|
|
56
56
|
private simulationProvider;
|
|
57
57
|
private noteCache;
|
|
58
|
+
private authwits;
|
|
58
59
|
private constructor();
|
|
59
60
|
static create(logger: Logger, store: AztecAsyncKVStore, protocolContracts: ProtocolContract[]): Promise<TXE>;
|
|
60
61
|
getNativeWorldStateService(): NativeWorldStateService;
|
|
@@ -83,7 +84,7 @@ export declare class TXE implements TypedOracle {
|
|
|
83
84
|
masterTaggingSecretKey: import("@aztec/aztec.js").Fq;
|
|
84
85
|
publicKeys: import("@aztec/aztec.js").PublicKeys;
|
|
85
86
|
}>;
|
|
86
|
-
addAuthWitness(address: AztecAddress, messageHash: Fr): Promise<
|
|
87
|
+
addAuthWitness(address: AztecAddress, messageHash: Fr): Promise<Map<string, AuthWitness>>;
|
|
87
88
|
addPublicDataWrites(writes: PublicDataWrite[]): Promise<void>;
|
|
88
89
|
checkNullifiersNotInTree(contractAddress: AztecAddress, nullifiers: Fr[]): Promise<void>;
|
|
89
90
|
addSiloedNullifiersFromPublic(siloedNullifiers: Fr[]): void;
|
|
@@ -102,7 +103,7 @@ export declare class TXE implements TypedOracle {
|
|
|
102
103
|
getMembershipWitness(blockNumber: number, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[] | undefined>;
|
|
103
104
|
getSiblingPath(blockNumber: number, treeId: MerkleTreeId, leafIndex: Fr): Promise<Fr[]>;
|
|
104
105
|
getNullifierMembershipWitness(blockNumber: number, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
|
|
105
|
-
|
|
106
|
+
getPublicDataWitness(blockNumber: number, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
106
107
|
getLowNullifierMembershipWitness(blockNumber: number, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
|
|
107
108
|
getBlockHeader(blockNumber: number): Promise<BlockHeader | undefined>;
|
|
108
109
|
getCompleteAddress(account: AztecAddress): Promise<import("@aztec/aztec.js").CompleteAddress>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"txe_oracle.d.ts","sourceRoot":"","sources":["../../src/oracle/txe_oracle.ts"],"names":[],"mappings":";;AACA,OAAO,EACL,KAAK,wBAAwB,EAS9B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,KAAK,MAAM,EAAyB,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EACL,mBAAmB,
|
|
1
|
+
{"version":3,"file":"txe_oracle.d.ts","sourceRoot":"","sources":["../../src/oracle/txe_oracle.ts"],"names":[],"mappings":";;AACA,OAAO,EACL,KAAK,wBAAwB,EAS9B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,KAAK,MAAM,EAAyB,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,gBA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AO,CAAC,OAAO,CAAC;IAO3F,sBAAsB,CAAC,SAAS,EAAE,EAAE;IAQpC,qBAAqB,CAAC,QAAQ,EAAE,EAAE;IAMlC,oBAAoB,CAAC,IAAI,EAAE,EAAE;IAgBnC,YAAY,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnF,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC;IAQ1E,aAAa,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQrE,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQvG,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAK9E,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;CAGrE"}
|
|
@@ -6,7 +6,7 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
6
6
|
import { applyStringFormatting } from '@aztec/foundation/log';
|
|
7
7
|
import { Timer } from '@aztec/foundation/timer';
|
|
8
8
|
import { KeyStore } from '@aztec/key-store';
|
|
9
|
-
import { AddressDataProvider,
|
|
9
|
+
import { AddressDataProvider, CapsuleDataProvider, ContractDataProvider, NoteDataProvider, PXEOracleInterface, SyncDataProvider, TaggingDataProvider, enrichPublicSimulationError } from '@aztec/pxe/server';
|
|
10
10
|
import { ExecutionNoteCache, HashedValuesCache, Oracle, WASMSimulator, extractCallStack, extractPrivateCircuitPublicInputs, pickNotes, toACVMWitness, witnessMapToFields } from '@aztec/simulator/client';
|
|
11
11
|
import { createTxForPublicCalls } from '@aztec/simulator/public/fixtures';
|
|
12
12
|
import { ExecutionError, PublicContractsDB, PublicTxSimulator, createSimulationError, resolveAssertionMessageFromError } from '@aztec/simulator/server';
|
|
@@ -36,7 +36,6 @@ export class TXE {
|
|
|
36
36
|
syncDataProvider;
|
|
37
37
|
taggingDataProvider;
|
|
38
38
|
addressDataProvider;
|
|
39
|
-
authWitnessDataProvider;
|
|
40
39
|
accountDataProvider;
|
|
41
40
|
executionCache;
|
|
42
41
|
contractAddress;
|
|
@@ -62,7 +61,8 @@ export class TXE {
|
|
|
62
61
|
node;
|
|
63
62
|
simulationProvider;
|
|
64
63
|
noteCache;
|
|
65
|
-
|
|
64
|
+
authwits;
|
|
65
|
+
constructor(logger, keyStore, contractDataProvider, noteDataProvider, capsuleDataProvider, syncDataProvider, taggingDataProvider, addressDataProvider, accountDataProvider, executionCache, contractAddress, nativeWorldStateService, baseFork){
|
|
66
66
|
this.logger = logger;
|
|
67
67
|
this.keyStore = keyStore;
|
|
68
68
|
this.contractDataProvider = contractDataProvider;
|
|
@@ -71,7 +71,6 @@ export class TXE {
|
|
|
71
71
|
this.syncDataProvider = syncDataProvider;
|
|
72
72
|
this.taggingDataProvider = taggingDataProvider;
|
|
73
73
|
this.addressDataProvider = addressDataProvider;
|
|
74
|
-
this.authWitnessDataProvider = authWitnessDataProvider;
|
|
75
74
|
this.accountDataProvider = accountDataProvider;
|
|
76
75
|
this.executionCache = executionCache;
|
|
77
76
|
this.contractAddress = contractAddress;
|
|
@@ -92,18 +91,18 @@ export class TXE {
|
|
|
92
91
|
this.VERSION = 1;
|
|
93
92
|
this.CHAIN_ID = 1;
|
|
94
93
|
this.simulationProvider = new WASMSimulator();
|
|
94
|
+
this.authwits = new Map();
|
|
95
95
|
this.noteCache = new ExecutionNoteCache(this.getTxRequestHash());
|
|
96
96
|
this.node = new TXENode(this.blockNumber, this.VERSION, this.CHAIN_ID, nativeWorldStateService, baseFork);
|
|
97
97
|
// Default msg_sender (for entrypoints) is now Fr.max_value rather than 0 addr (see #7190 & #7404)
|
|
98
98
|
this.msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE);
|
|
99
|
-
this.pxeOracleInterface = new PXEOracleInterface(this.node, this.keyStore, this.simulationProvider, this.contractDataProvider, this.noteDataProvider, this.capsuleDataProvider, this.syncDataProvider, this.taggingDataProvider, this.addressDataProvider, this.
|
|
99
|
+
this.pxeOracleInterface = new PXEOracleInterface(this.node, this.keyStore, this.simulationProvider, this.contractDataProvider, this.noteDataProvider, this.capsuleDataProvider, this.syncDataProvider, this.taggingDataProvider, this.addressDataProvider, this.logger);
|
|
100
100
|
}
|
|
101
101
|
static async create(logger, store, protocolContracts) {
|
|
102
102
|
const executionCache = new HashedValuesCache();
|
|
103
103
|
const nativeWorldStateService = await NativeWorldStateService.tmp();
|
|
104
104
|
const baseFork = await nativeWorldStateService.fork();
|
|
105
105
|
const addressDataProvider = new AddressDataProvider(store);
|
|
106
|
-
const authWitnessDataProvider = new AuthWitnessDataProvider(store);
|
|
107
106
|
const contractDataProvider = new ContractDataProvider(store);
|
|
108
107
|
const noteDataProvider = await NoteDataProvider.create(store);
|
|
109
108
|
const syncDataProvider = new SyncDataProvider(store);
|
|
@@ -116,7 +115,7 @@ export class TXE {
|
|
|
116
115
|
await contractDataProvider.addContractArtifact(contractClass.id, artifact);
|
|
117
116
|
await contractDataProvider.addContractInstance(instance);
|
|
118
117
|
}
|
|
119
|
-
return new TXE(logger, keyStore, contractDataProvider, noteDataProvider, capsuleDataProvider, syncDataProvider, taggingDataProvider, addressDataProvider,
|
|
118
|
+
return new TXE(logger, keyStore, contractDataProvider, noteDataProvider, capsuleDataProvider, syncDataProvider, taggingDataProvider, addressDataProvider, accountDataProvider, executionCache, await AztecAddress.random(), nativeWorldStateService, baseFork);
|
|
120
119
|
}
|
|
121
120
|
// Utils
|
|
122
121
|
getNativeWorldStateService() {
|
|
@@ -205,7 +204,7 @@ export class TXE {
|
|
|
205
204
|
const authWitness = new AuthWitness(messageHash, [
|
|
206
205
|
...signature.toBuffer()
|
|
207
206
|
]);
|
|
208
|
-
return this.
|
|
207
|
+
return this.authwits.set(authWitness.requestHash.toString(), authWitness);
|
|
209
208
|
}
|
|
210
209
|
async addPublicDataWrites(writes) {
|
|
211
210
|
this.publicDataWrites.push(...writes);
|
|
@@ -316,7 +315,7 @@ export class TXE {
|
|
|
316
315
|
}
|
|
317
316
|
return new NullifierMembershipWitness(BigInt(index), leafPreimage, siblingPath);
|
|
318
317
|
}
|
|
319
|
-
async
|
|
318
|
+
async getPublicDataWitness(blockNumber, leafSlot) {
|
|
320
319
|
const snap = this.nativeWorldStateService.getSnapshot(blockNumber);
|
|
321
320
|
const lowLeafResult = await snap.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
|
|
322
321
|
if (!lowLeafResult) {
|
|
@@ -358,7 +357,8 @@ export class TXE {
|
|
|
358
357
|
return Promise.resolve(this.accountDataProvider.getAccount(account));
|
|
359
358
|
}
|
|
360
359
|
getAuthWitness(messageHash) {
|
|
361
|
-
|
|
360
|
+
const authwit = this.authwits.get(messageHash.toString());
|
|
361
|
+
return Promise.resolve(authwit?.witness);
|
|
362
362
|
}
|
|
363
363
|
async getNotes(storageSlot, numSelects, selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, limit, offset, status) {
|
|
364
364
|
// Nullified pending notes are already removed from the list.
|
|
@@ -508,7 +508,6 @@ export class TXE {
|
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
await this.node.setTxEffect(blockNumber, new TxHash(new Fr(blockNumber)), txEffect);
|
|
511
|
-
this.node.setNullifiersIndexesWithBlock(blockNumber, txEffect.nullifiers);
|
|
512
511
|
this.node.addPrivateLogsByTags(this.blockNumber, this.privateLogs);
|
|
513
512
|
this.node.addPublicLogsByTags(this.blockNumber, this.publicLogs);
|
|
514
513
|
const stateReference = await fork.getStateReference();
|
|
@@ -548,11 +547,10 @@ export class TXE {
|
|
|
548
547
|
this.setContractAddress(targetContractAddress);
|
|
549
548
|
this.setFunctionSelector(functionSelector);
|
|
550
549
|
const artifact = await this.contractDataProvider.getFunctionArtifact(targetContractAddress, functionSelector);
|
|
551
|
-
const acir = artifact.bytecode;
|
|
552
550
|
const initialWitness = await this.getInitialWitness(artifact, argsHash, sideEffectCounter, isStaticCall);
|
|
553
551
|
const acvmCallback = new Oracle(this);
|
|
554
552
|
const timer = new Timer();
|
|
555
|
-
const acirExecutionResult = await this.simulationProvider.executeUserCircuit(
|
|
553
|
+
const acirExecutionResult = await this.simulationProvider.executeUserCircuit(initialWitness, artifact, acvmCallback).catch((err)=>{
|
|
556
554
|
err.message = resolveAssertionMessageFromError(err, artifact);
|
|
557
555
|
const execError = new ExecutionError(err.message, {
|
|
558
556
|
contractAddress: targetContractAddress,
|
|
@@ -69,7 +69,7 @@ export declare class TXEService {
|
|
|
69
69
|
storageWrite(startStorageSlot: ForeignCallSingle, values: ForeignCallArray): Promise<{
|
|
70
70
|
values: (string | ForeignCallArray)[];
|
|
71
71
|
}>;
|
|
72
|
-
|
|
72
|
+
getPublicDataWitness(blockNumber: ForeignCallSingle, leafSlot: ForeignCallSingle): Promise<{
|
|
73
73
|
values: (string | ForeignCallArray)[];
|
|
74
74
|
}>;
|
|
75
75
|
getNotes(storageSlot: ForeignCallSingle, numSelects: ForeignCallSingle, selectByIndexes: ForeignCallArray, selectByOffsets: ForeignCallArray, selectByLengths: ForeignCallArray, selectValues: ForeignCallArray, selectComparators: ForeignCallArray, sortByIndexes: ForeignCallArray, sortByOffsets: ForeignCallArray, sortByLengths: ForeignCallArray, sortOrder: ForeignCallArray, limit: ForeignCallSingle, offset: ForeignCallSingle, status: ForeignCallSingle, returnSize: ForeignCallSingle): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"txe_service.d.ts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,EAAE,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB;;;IAS1E,aAAa,CACjB,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE,gBAAgB;;;IAyBlB,mBAAmB,CACvB,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE,gBAAgB;;;IAyBxB,oBAAoB;;;CAIrB"}
|
|
@@ -203,16 +203,14 @@ export class TXEService {
|
|
|
203
203
|
toArray(newValues)
|
|
204
204
|
]);
|
|
205
205
|
}
|
|
206
|
-
async
|
|
206
|
+
async getPublicDataWitness(blockNumber, leafSlot) {
|
|
207
207
|
const parsedBlockNumber = fromSingle(blockNumber).toNumber();
|
|
208
208
|
const parsedLeafSlot = fromSingle(leafSlot);
|
|
209
|
-
const witness = await this.typedOracle.
|
|
209
|
+
const witness = await this.typedOracle.getPublicDataWitness(parsedBlockNumber, parsedLeafSlot);
|
|
210
210
|
if (!witness) {
|
|
211
211
|
throw new Error(`Public data witness not found for slot ${parsedLeafSlot} at block ${parsedBlockNumber}.`);
|
|
212
212
|
}
|
|
213
|
-
return toForeignCallResult(
|
|
214
|
-
toArray(witness.toFields())
|
|
215
|
-
]);
|
|
213
|
+
return toForeignCallResult(witness.toNoirRepresentation());
|
|
216
214
|
}
|
|
217
215
|
async getNotes(storageSlot, numSelects, selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, limit, offset, status, returnSize) {
|
|
218
216
|
const noteDatas = await this.typedOracle.getNotes(fromSingle(storageSlot), fromSingle(numSelects).toNumber(), fromArray(selectByIndexes).map((fr)=>fr.toNumber()), fromArray(selectByOffsets).map((fr)=>fr.toNumber()), fromArray(selectByLengths).map((fr)=>fr.toNumber()), fromArray(selectValues), fromArray(selectComparators).map((fr)=>fr.toNumber()), fromArray(sortByIndexes).map((fr)=>fr.toNumber()), fromArray(sortByOffsets).map((fr)=>fr.toNumber()), fromArray(sortByLengths).map((fr)=>fr.toNumber()), fromArray(sortOrder).map((fr)=>fr.toNumber()), fromSingle(limit).toNumber(), fromSingle(offset).toNumber(), fromSingle(status).toNumber());
|
|
@@ -250,21 +248,15 @@ export class TXEService {
|
|
|
250
248
|
}
|
|
251
249
|
notifyCreatedNote(storageSlot, noteTypeId, note, noteHash, counter) {
|
|
252
250
|
this.typedOracle.notifyCreatedNote(fromSingle(storageSlot), NoteSelector.fromField(fromSingle(noteTypeId)), fromArray(note), fromSingle(noteHash), fromSingle(counter).toNumber());
|
|
253
|
-
return toForeignCallResult([
|
|
254
|
-
toSingle(new Fr(0))
|
|
255
|
-
]);
|
|
251
|
+
return toForeignCallResult([]);
|
|
256
252
|
}
|
|
257
253
|
async notifyNullifiedNote(innerNullifier, noteHash, counter) {
|
|
258
254
|
await this.typedOracle.notifyNullifiedNote(fromSingle(innerNullifier), fromSingle(noteHash), fromSingle(counter).toNumber());
|
|
259
|
-
return toForeignCallResult([
|
|
260
|
-
toSingle(new Fr(0))
|
|
261
|
-
]);
|
|
255
|
+
return toForeignCallResult([]);
|
|
262
256
|
}
|
|
263
257
|
async notifyCreatedNullifier(innerNullifier) {
|
|
264
258
|
await this.typedOracle.notifyCreatedNullifier(fromSingle(innerNullifier));
|
|
265
|
-
return toForeignCallResult([
|
|
266
|
-
toSingle(new Fr(0))
|
|
267
|
-
]);
|
|
259
|
+
return toForeignCallResult([]);
|
|
268
260
|
}
|
|
269
261
|
async checkNullifierExists(innerNullifier) {
|
|
270
262
|
const exists = await this.typedOracle.checkNullifierExists(fromSingle(innerNullifier));
|
|
@@ -275,14 +267,12 @@ export class TXEService {
|
|
|
275
267
|
async getContractInstance(address) {
|
|
276
268
|
const instance = await this.typedOracle.getContractInstance(addressFromSingle(address));
|
|
277
269
|
return toForeignCallResult([
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
])
|
|
285
|
-
]);
|
|
270
|
+
instance.salt,
|
|
271
|
+
instance.deployer.toField(),
|
|
272
|
+
instance.currentContractClassId,
|
|
273
|
+
instance.initializationHash,
|
|
274
|
+
...instance.publicKeys.toFields()
|
|
275
|
+
].map(toSingle));
|
|
286
276
|
}
|
|
287
277
|
async getPublicKeysAndPartialAddress(address) {
|
|
288
278
|
const parsedAddress = addressFromSingle(address);
|
|
@@ -296,9 +286,7 @@ export class TXEService {
|
|
|
296
286
|
}
|
|
297
287
|
async getKeyValidationRequest(pkMHash) {
|
|
298
288
|
const keyValidationRequest = await this.typedOracle.getKeyValidationRequest(fromSingle(pkMHash));
|
|
299
|
-
return toForeignCallResult(
|
|
300
|
-
toArray(keyValidationRequest.toFields())
|
|
301
|
-
]);
|
|
289
|
+
return toForeignCallResult(keyValidationRequest.toFields().map(toSingle));
|
|
302
290
|
}
|
|
303
291
|
async callPrivateFunction(targetContractAddress, functionSelector, argsHash, sideEffectCounter, isStaticCall) {
|
|
304
292
|
const result = await this.typedOracle.callPrivateFunction(addressFromSingle(targetContractAddress), FunctionSelector.fromField(fromSingle(functionSelector)), fromSingle(argsHash), fromSingle(sideEffectCounter).toNumber(), fromSingle(isStaticCall).toBool());
|
|
@@ -315,9 +303,7 @@ export class TXEService {
|
|
|
315
303
|
if (!witness) {
|
|
316
304
|
throw new Error(`Nullifier membership witness not found at block ${parsedBlockNumber}.`);
|
|
317
305
|
}
|
|
318
|
-
return toForeignCallResult(
|
|
319
|
-
toArray(witness.toFields())
|
|
320
|
-
]);
|
|
306
|
+
return toForeignCallResult(witness.toNoirRepresentation());
|
|
321
307
|
}
|
|
322
308
|
async getAuthWitness(messageHash) {
|
|
323
309
|
const parsedMessageHash = fromSingle(messageHash);
|
|
@@ -359,9 +345,7 @@ export class TXEService {
|
|
|
359
345
|
if (!header) {
|
|
360
346
|
throw new Error(`Block header not found for block ${blockNumber}.`);
|
|
361
347
|
}
|
|
362
|
-
return toForeignCallResult(
|
|
363
|
-
toArray(header.toFields())
|
|
364
|
-
]);
|
|
348
|
+
return toForeignCallResult(header.toFields().map(toSingle));
|
|
365
349
|
}
|
|
366
350
|
async getMembershipWitness(blockNumber, treeId, leafValue) {
|
|
367
351
|
const parsedBlockNumber = fromSingle(blockNumber).toNumber();
|
|
@@ -372,7 +356,8 @@ export class TXEService {
|
|
|
372
356
|
throw new Error(`Membership witness in tree ${MerkleTreeId[parsedTreeId]} not found for value ${parsedLeafValue} at block ${parsedBlockNumber}.`);
|
|
373
357
|
}
|
|
374
358
|
return toForeignCallResult([
|
|
375
|
-
|
|
359
|
+
toSingle(witness[0]),
|
|
360
|
+
toArray(witness.slice(1))
|
|
376
361
|
]);
|
|
377
362
|
}
|
|
378
363
|
async getLowNullifierMembershipWitness(blockNumber, nullifier) {
|
|
@@ -381,9 +366,7 @@ export class TXEService {
|
|
|
381
366
|
if (!witness) {
|
|
382
367
|
throw new Error(`Low nullifier witness not found for nullifier ${nullifier} at block ${parsedBlockNumber}.`);
|
|
383
368
|
}
|
|
384
|
-
return toForeignCallResult(
|
|
385
|
-
toArray(witness.toFields())
|
|
386
|
-
]);
|
|
369
|
+
return toForeignCallResult(witness.toNoirRepresentation());
|
|
387
370
|
}
|
|
388
371
|
async getIndexedTaggingSecretAsSender(sender, recipient) {
|
|
389
372
|
const secret = await this.typedOracle.getIndexedTaggingSecretAsSender(AztecAddress.fromField(fromSingle(sender)), AztecAddress.fromField(fromSingle(recipient)));
|
|
@@ -402,7 +385,8 @@ export class TXEService {
|
|
|
402
385
|
]);
|
|
403
386
|
}
|
|
404
387
|
async getLogByTag(tag) {
|
|
405
|
-
|
|
388
|
+
// TODO(AD): this was warning that getLogByTag did not return a promise.
|
|
389
|
+
const log = await Promise.resolve(this.typedOracle.getLogByTag(fromSingle(tag)));
|
|
406
390
|
if (log == null) {
|
|
407
391
|
return toForeignCallResult([
|
|
408
392
|
toSingle(Fr.ZERO),
|
|
@@ -458,9 +442,7 @@ export class TXEService {
|
|
|
458
442
|
}
|
|
459
443
|
async getSharedSecret(address, ephPk) {
|
|
460
444
|
const secret = await this.typedOracle.getSharedSecret(AztecAddress.fromField(fromSingle(address)), Point.fromFields(fromArray(ephPk)));
|
|
461
|
-
return toForeignCallResult(
|
|
462
|
-
toArray(secret.toFields())
|
|
463
|
-
]);
|
|
445
|
+
return toForeignCallResult(secret.toFields().map(toSingle));
|
|
464
446
|
}
|
|
465
447
|
// AVM opcodes
|
|
466
448
|
avmOpcodeEmitUnencryptedLog(_message) {
|
|
@@ -14,6 +14,5 @@ export declare class TXEPublicContractDataSource implements ContractDataSource {
|
|
|
14
14
|
getContractArtifact(address: AztecAddress): Promise<ContractArtifact | undefined>;
|
|
15
15
|
getContractFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
16
16
|
registerContractFunctionSignatures(_address: AztecAddress, _signatures: []): Promise<void>;
|
|
17
|
-
addContractClass(_contractClass: ContractClassPublic): Promise<void>;
|
|
18
17
|
}
|
|
19
18
|
//# sourceMappingURL=txe_public_contract_data_source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"txe_public_contract_data_source.d.ts","sourceRoot":"","sources":["../../src/util/txe_public_contract_data_source.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAGjC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAEnD,qBAAa,2BAA4B,YAAW,kBAAkB;IACxD,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,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AE,EAAE,EAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IA0BlE,qBAAqB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;IAKtD,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC;IAK1F,mBAAmB,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;IAI9B,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAKjF,uBAAuB,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAgB7G,kCAAkC,CAAC,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3F"}
|
|
@@ -70,9 +70,4 @@ export class TXEPublicContractDataSource {
|
|
|
70
70
|
registerContractFunctionSignatures(_address, _signatures) {
|
|
71
71
|
return Promise.resolve();
|
|
72
72
|
}
|
|
73
|
-
// TODO(#10007): Remove this method.
|
|
74
|
-
addContractClass(_contractClass) {
|
|
75
|
-
// We don't really need to do anything for the txe here
|
|
76
|
-
return Promise.resolve();
|
|
77
|
-
}
|
|
78
73
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/txe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"bin": "./dest/bin/index.js",
|
|
@@ -59,17 +59,17 @@
|
|
|
59
59
|
]
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@aztec/accounts": "0.
|
|
63
|
-
"@aztec/aztec.js": "0.
|
|
64
|
-
"@aztec/constants": "0.
|
|
65
|
-
"@aztec/foundation": "0.
|
|
66
|
-
"@aztec/key-store": "0.
|
|
67
|
-
"@aztec/kv-store": "0.
|
|
68
|
-
"@aztec/protocol-contracts": "0.
|
|
69
|
-
"@aztec/pxe": "0.
|
|
70
|
-
"@aztec/simulator": "0.
|
|
71
|
-
"@aztec/stdlib": "0.
|
|
72
|
-
"@aztec/world-state": "0.
|
|
62
|
+
"@aztec/accounts": "0.82.0",
|
|
63
|
+
"@aztec/aztec.js": "0.82.0",
|
|
64
|
+
"@aztec/constants": "0.82.0",
|
|
65
|
+
"@aztec/foundation": "0.82.0",
|
|
66
|
+
"@aztec/key-store": "0.82.0",
|
|
67
|
+
"@aztec/kv-store": "0.82.0",
|
|
68
|
+
"@aztec/protocol-contracts": "0.82.0",
|
|
69
|
+
"@aztec/pxe": "0.82.0",
|
|
70
|
+
"@aztec/simulator": "0.82.0",
|
|
71
|
+
"@aztec/stdlib": "0.82.0",
|
|
72
|
+
"@aztec/world-state": "0.82.0",
|
|
73
73
|
"zod": "^3.23.8"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
package/src/bin/index.ts
CHANGED
package/src/node/txe_node.ts
CHANGED
|
@@ -57,7 +57,6 @@ export class TXENode implements AztecNode {
|
|
|
57
57
|
#logsByTags = new Map<string, TxScopedL2Log[]>();
|
|
58
58
|
#txEffectsByTxHash = new Map<string, InBlock<TxEffect>>();
|
|
59
59
|
#txReceiptsByTxHash = new Map<string, TxReceipt>();
|
|
60
|
-
#blockNumberToNullifiers = new Map<number, Fr[]>();
|
|
61
60
|
#noteIndex = 0;
|
|
62
61
|
|
|
63
62
|
#logger = createLogger('aztec:txe_node');
|
|
@@ -125,56 +124,10 @@ export class TXENode implements AztecNode {
|
|
|
125
124
|
undefined,
|
|
126
125
|
new L2BlockHash(blockHash.toBuffer()),
|
|
127
126
|
blockNumber,
|
|
128
|
-
undefined,
|
|
129
127
|
),
|
|
130
128
|
);
|
|
131
129
|
}
|
|
132
130
|
|
|
133
|
-
/**
|
|
134
|
-
* Returns the indexes of the given nullifiers in the nullifier tree,
|
|
135
|
-
* scoped to the block they were included in.
|
|
136
|
-
* @param blockNumber - The block number at which to get the data.
|
|
137
|
-
* @param nullifiers - The nullifiers to search for.
|
|
138
|
-
* @returns The block scoped indexes of the given nullifiers in the nullifier tree, or undefined if not found.
|
|
139
|
-
*/
|
|
140
|
-
async findNullifiersIndexesWithBlock(
|
|
141
|
-
blockNumber: L2BlockNumber,
|
|
142
|
-
nullifiers: Fr[],
|
|
143
|
-
): Promise<(InBlock<bigint> | undefined)[]> {
|
|
144
|
-
const parsedBlockNumber = blockNumber === 'latest' ? await this.getBlockNumber() : blockNumber;
|
|
145
|
-
|
|
146
|
-
const nullifiersInBlock: Fr[] = [];
|
|
147
|
-
for (const [key, val] of this.#blockNumberToNullifiers.entries()) {
|
|
148
|
-
if (key <= parsedBlockNumber) {
|
|
149
|
-
nullifiersInBlock.push(...val);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return nullifiers.map(nullifier => {
|
|
154
|
-
const possibleNullifierIndex = nullifiersInBlock.findIndex(nullifierInBlock =>
|
|
155
|
-
nullifierInBlock.equals(nullifier),
|
|
156
|
-
);
|
|
157
|
-
return possibleNullifierIndex === -1
|
|
158
|
-
? undefined
|
|
159
|
-
: {
|
|
160
|
-
l2BlockNumber: parsedBlockNumber,
|
|
161
|
-
l2BlockHash: new Fr(parsedBlockNumber).toString(),
|
|
162
|
-
data: BigInt(possibleNullifierIndex),
|
|
163
|
-
};
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Returns the indexes of the given nullifiers in the nullifier tree,
|
|
169
|
-
* scoped to the block they were included in.
|
|
170
|
-
* @param blockNumber - The block number at which to get the data.
|
|
171
|
-
* @param nullifiers - The nullifiers to search for.
|
|
172
|
-
* @returns The block scoped indexes of the given nullifiers in the nullifier tree, or undefined if not found.
|
|
173
|
-
*/
|
|
174
|
-
setNullifiersIndexesWithBlock(blockNumber: number, nullifiers: Fr[]) {
|
|
175
|
-
this.#blockNumberToNullifiers.set(blockNumber, nullifiers);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
131
|
/**
|
|
179
132
|
* Adds private logs to the txe node, given a block
|
|
180
133
|
* @param blockNumber - The block number at which to add the private logs.
|
|
@@ -235,13 +188,13 @@ export class TXENode implements AztecNode {
|
|
|
235
188
|
* @param blockNumber - The block number at which to get the data or 'latest' for latest data
|
|
236
189
|
* @param treeId - The tree to search in.
|
|
237
190
|
* @param leafValue - The values to search for
|
|
238
|
-
* @returns The
|
|
191
|
+
* @returns The indices of leaves and the block metadata of a block in which the leaf was inserted.
|
|
239
192
|
*/
|
|
240
193
|
async findLeavesIndexes(
|
|
241
194
|
blockNumber: L2BlockNumber,
|
|
242
195
|
treeId: MerkleTreeId,
|
|
243
196
|
leafValues: Fr[],
|
|
244
|
-
): Promise<(bigint | undefined)[]> {
|
|
197
|
+
): Promise<(InBlock<bigint> | undefined)[]> {
|
|
245
198
|
// Temporary workaround to be able to respond this query: the trees are currently stored in the TXE oracle, but we
|
|
246
199
|
// hold a reference to them.
|
|
247
200
|
// We should likely migrate this so that the trees are owned by the node.
|
|
@@ -252,10 +205,61 @@ export class TXENode implements AztecNode {
|
|
|
252
205
|
? this.baseFork
|
|
253
206
|
: this.nativeWorldStateService.getSnapshot(blockNumber);
|
|
254
207
|
|
|
255
|
-
|
|
208
|
+
const maybeIndices = await db.findLeafIndices(
|
|
256
209
|
treeId,
|
|
257
210
|
leafValues.map(x => x.toBuffer()),
|
|
258
211
|
);
|
|
212
|
+
|
|
213
|
+
// We filter out undefined values
|
|
214
|
+
const indices = maybeIndices.filter(x => x !== undefined) as bigint[];
|
|
215
|
+
|
|
216
|
+
// Now we find the block numbers for the indices
|
|
217
|
+
const blockNumbers = await db.getBlockNumbersForLeafIndices(treeId, indices);
|
|
218
|
+
|
|
219
|
+
// If any of the block numbers are undefined, we throw an error.
|
|
220
|
+
for (let i = 0; i < indices.length; i++) {
|
|
221
|
+
if (blockNumbers[i] === undefined) {
|
|
222
|
+
throw new Error(`Block number is undefined for leaf index ${indices[i]} in tree ${MerkleTreeId[treeId]}`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
// Get unique block numbers in order to optimize num calls to getLeafValue function.
|
|
226
|
+
const uniqueBlockNumbers = [...new Set(blockNumbers.filter(x => x !== undefined))];
|
|
227
|
+
|
|
228
|
+
// Now we obtain the block hashes from the archive tree by calling await `committedDb.getLeafValue(treeId, index)`
|
|
229
|
+
// (note that block number corresponds to the leaf index in the archive tree).
|
|
230
|
+
const blockHashes = await Promise.all(
|
|
231
|
+
uniqueBlockNumbers.map(blockNumber => {
|
|
232
|
+
return db.getLeafValue(MerkleTreeId.ARCHIVE, blockNumber!);
|
|
233
|
+
}),
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
// If any of the block hashes are undefined, we throw an error.
|
|
237
|
+
for (let i = 0; i < uniqueBlockNumbers.length; i++) {
|
|
238
|
+
if (blockHashes[i] === undefined) {
|
|
239
|
+
throw new Error(`Block hash is undefined for block number ${uniqueBlockNumbers[i]}`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Create InBlock objects by combining indices, blockNumbers and blockHashes
|
|
244
|
+
return maybeIndices.map((index, i) => {
|
|
245
|
+
if (index === undefined) {
|
|
246
|
+
return undefined;
|
|
247
|
+
}
|
|
248
|
+
const blockNumber = blockNumbers[i];
|
|
249
|
+
if (blockNumber === undefined) {
|
|
250
|
+
return undefined;
|
|
251
|
+
}
|
|
252
|
+
const blockHashIndex = uniqueBlockNumbers.indexOf(blockNumber);
|
|
253
|
+
const blockHash = blockHashes[blockHashIndex]?.toString();
|
|
254
|
+
if (!blockHash) {
|
|
255
|
+
return undefined;
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
l2BlockNumber: Number(blockNumber),
|
|
259
|
+
l2BlockHash: blockHash,
|
|
260
|
+
data: index,
|
|
261
|
+
};
|
|
262
|
+
});
|
|
259
263
|
}
|
|
260
264
|
|
|
261
265
|
/**
|
|
@@ -384,8 +388,8 @@ export class TXENode implements AztecNode {
|
|
|
384
388
|
* "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
|
|
385
389
|
* is contained in the leaf preimage.
|
|
386
390
|
*/
|
|
387
|
-
|
|
388
|
-
throw new Error('TXE Node method
|
|
391
|
+
getPublicDataWitness(_blockNumber: L2BlockNumber, _leafSlot: Fr): Promise<PublicDataWitness | undefined> {
|
|
392
|
+
throw new Error('TXE Node method getPublicDataWitness not implemented');
|
|
389
393
|
}
|
|
390
394
|
|
|
391
395
|
/**
|
|
@@ -642,15 +646,6 @@ export class TXENode implements AztecNode {
|
|
|
642
646
|
throw new Error('TXE Node method getEncodedEnr not implemented');
|
|
643
647
|
}
|
|
644
648
|
|
|
645
|
-
/**
|
|
646
|
-
* Adds a contract class bypassing the registerer.
|
|
647
|
-
* TODO(#10007): Remove this method.
|
|
648
|
-
* @param contractClass - The class to register.
|
|
649
|
-
*/
|
|
650
|
-
addContractClass(_contractClass: ContractClassPublic): Promise<void> {
|
|
651
|
-
throw new Error('TXE Node method addContractClass not implemented');
|
|
652
|
-
}
|
|
653
|
-
|
|
654
649
|
/**
|
|
655
650
|
* Method to fetch the current base fees.
|
|
656
651
|
* @returns The current base fees.
|
|
@@ -669,21 +664,6 @@ export class TXENode implements AztecNode {
|
|
|
669
664
|
throw new Error('TXE Node method getPrivateLogs not implemented');
|
|
670
665
|
}
|
|
671
666
|
|
|
672
|
-
/**
|
|
673
|
-
* Find the block numbers of the given leaf indices in the given tree.
|
|
674
|
-
* @param blockNumber - The block number at which to get the data or 'latest' for latest data
|
|
675
|
-
* @param treeId - The tree to search in.
|
|
676
|
-
* @param leafIndices - The values to search for
|
|
677
|
-
* @returns The indexes of the given leaves in the given tree or undefined if not found.
|
|
678
|
-
*/
|
|
679
|
-
findBlockNumbersForIndexes(
|
|
680
|
-
_blockNumber: L2BlockNumber,
|
|
681
|
-
_treeId: MerkleTreeId,
|
|
682
|
-
_leafIndices: bigint[],
|
|
683
|
-
): Promise<(bigint | undefined)[]> {
|
|
684
|
-
throw new Error('TXE Node method findBlockNumbersForIndexes not implemented');
|
|
685
|
-
}
|
|
686
|
-
|
|
687
667
|
/**
|
|
688
668
|
* Returns the information about the server's node. Includes current Node version, compatible Noir version,
|
|
689
669
|
* L1 chain identifier, protocol version, and L1 address of the rollup contract.
|
package/src/oracle/txe_oracle.ts
CHANGED
|
@@ -20,7 +20,6 @@ import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
|
20
20
|
import type { ProtocolContract } from '@aztec/protocol-contracts';
|
|
21
21
|
import {
|
|
22
22
|
AddressDataProvider,
|
|
23
|
-
AuthWitnessDataProvider,
|
|
24
23
|
CapsuleDataProvider,
|
|
25
24
|
ContractDataProvider,
|
|
26
25
|
NoteDataProvider,
|
|
@@ -136,6 +135,8 @@ export class TXE implements TypedOracle {
|
|
|
136
135
|
|
|
137
136
|
private noteCache: ExecutionNoteCache;
|
|
138
137
|
|
|
138
|
+
private authwits: Map<string, AuthWitness> = new Map();
|
|
139
|
+
|
|
139
140
|
private constructor(
|
|
140
141
|
private logger: Logger,
|
|
141
142
|
private keyStore: KeyStore,
|
|
@@ -145,7 +146,6 @@ export class TXE implements TypedOracle {
|
|
|
145
146
|
private syncDataProvider: SyncDataProvider,
|
|
146
147
|
private taggingDataProvider: TaggingDataProvider,
|
|
147
148
|
private addressDataProvider: AddressDataProvider,
|
|
148
|
-
private authWitnessDataProvider: AuthWitnessDataProvider,
|
|
149
149
|
private accountDataProvider: TXEAccountDataProvider,
|
|
150
150
|
private executionCache: HashedValuesCache,
|
|
151
151
|
private contractAddress: AztecAddress,
|
|
@@ -168,7 +168,6 @@ export class TXE implements TypedOracle {
|
|
|
168
168
|
this.syncDataProvider,
|
|
169
169
|
this.taggingDataProvider,
|
|
170
170
|
this.addressDataProvider,
|
|
171
|
-
this.authWitnessDataProvider,
|
|
172
171
|
this.logger,
|
|
173
172
|
);
|
|
174
173
|
}
|
|
@@ -179,7 +178,6 @@ export class TXE implements TypedOracle {
|
|
|
179
178
|
const baseFork = await nativeWorldStateService.fork();
|
|
180
179
|
|
|
181
180
|
const addressDataProvider = new AddressDataProvider(store);
|
|
182
|
-
const authWitnessDataProvider = new AuthWitnessDataProvider(store);
|
|
183
181
|
const contractDataProvider = new ContractDataProvider(store);
|
|
184
182
|
const noteDataProvider = await NoteDataProvider.create(store);
|
|
185
183
|
const syncDataProvider = new SyncDataProvider(store);
|
|
@@ -204,7 +202,6 @@ export class TXE implements TypedOracle {
|
|
|
204
202
|
syncDataProvider,
|
|
205
203
|
taggingDataProvider,
|
|
206
204
|
addressDataProvider,
|
|
207
|
-
authWitnessDataProvider,
|
|
208
205
|
accountDataProvider,
|
|
209
206
|
executionCache,
|
|
210
207
|
await AztecAddress.random(),
|
|
@@ -331,7 +328,7 @@ export class TXE implements TypedOracle {
|
|
|
331
328
|
const schnorr = new Schnorr();
|
|
332
329
|
const signature = await schnorr.constructSignature(messageHash.toBuffer(), privateKey);
|
|
333
330
|
const authWitness = new AuthWitness(messageHash, [...signature.toBuffer()]);
|
|
334
|
-
return this.
|
|
331
|
+
return this.authwits.set(authWitness.requestHash.toString(), authWitness);
|
|
335
332
|
}
|
|
336
333
|
|
|
337
334
|
async addPublicDataWrites(writes: PublicDataWrite[]) {
|
|
@@ -471,7 +468,7 @@ export class TXE implements TypedOracle {
|
|
|
471
468
|
return new NullifierMembershipWitness(BigInt(index), leafPreimage as NullifierLeafPreimage, siblingPath);
|
|
472
469
|
}
|
|
473
470
|
|
|
474
|
-
async
|
|
471
|
+
async getPublicDataWitness(blockNumber: number, leafSlot: Fr): Promise<PublicDataWitness | undefined> {
|
|
475
472
|
const snap = this.nativeWorldStateService.getSnapshot(blockNumber);
|
|
476
473
|
|
|
477
474
|
const lowLeafResult = await snap.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
|
|
@@ -544,7 +541,8 @@ export class TXE implements TypedOracle {
|
|
|
544
541
|
}
|
|
545
542
|
|
|
546
543
|
getAuthWitness(messageHash: Fr) {
|
|
547
|
-
|
|
544
|
+
const authwit = this.authwits.get(messageHash.toString());
|
|
545
|
+
return Promise.resolve(authwit?.witness);
|
|
548
546
|
}
|
|
549
547
|
|
|
550
548
|
async getNotes(
|
|
@@ -758,7 +756,6 @@ export class TXE implements TypedOracle {
|
|
|
758
756
|
}
|
|
759
757
|
|
|
760
758
|
await this.node.setTxEffect(blockNumber, new TxHash(new Fr(blockNumber)), txEffect);
|
|
761
|
-
this.node.setNullifiersIndexesWithBlock(blockNumber, txEffect.nullifiers);
|
|
762
759
|
this.node.addPrivateLogsByTags(this.blockNumber, this.privateLogs);
|
|
763
760
|
this.node.addPublicLogsByTags(this.blockNumber, this.publicLogs);
|
|
764
761
|
|
|
@@ -829,12 +826,11 @@ export class TXE implements TypedOracle {
|
|
|
829
826
|
|
|
830
827
|
const artifact = await this.contractDataProvider.getFunctionArtifact(targetContractAddress, functionSelector);
|
|
831
828
|
|
|
832
|
-
const acir = artifact.bytecode;
|
|
833
829
|
const initialWitness = await this.getInitialWitness(artifact, argsHash, sideEffectCounter, isStaticCall);
|
|
834
830
|
const acvmCallback = new Oracle(this);
|
|
835
831
|
const timer = new Timer();
|
|
836
832
|
const acirExecutionResult = await this.simulationProvider
|
|
837
|
-
.executeUserCircuit(
|
|
833
|
+
.executeUserCircuit(initialWitness, artifact, acvmCallback)
|
|
838
834
|
.catch((err: Error) => {
|
|
839
835
|
err.message = resolveAssertionMessageFromError(err, artifact);
|
|
840
836
|
|
|
@@ -263,15 +263,15 @@ export class TXEService {
|
|
|
263
263
|
return toForeignCallResult([toArray(newValues)]);
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
async
|
|
266
|
+
async getPublicDataWitness(blockNumber: ForeignCallSingle, leafSlot: ForeignCallSingle) {
|
|
267
267
|
const parsedBlockNumber = fromSingle(blockNumber).toNumber();
|
|
268
268
|
const parsedLeafSlot = fromSingle(leafSlot);
|
|
269
269
|
|
|
270
|
-
const witness = await this.typedOracle.
|
|
270
|
+
const witness = await this.typedOracle.getPublicDataWitness(parsedBlockNumber, parsedLeafSlot);
|
|
271
271
|
if (!witness) {
|
|
272
272
|
throw new Error(`Public data witness not found for slot ${parsedLeafSlot} at block ${parsedBlockNumber}.`);
|
|
273
273
|
}
|
|
274
|
-
return toForeignCallResult(
|
|
274
|
+
return toForeignCallResult(witness.toNoirRepresentation());
|
|
275
275
|
}
|
|
276
276
|
|
|
277
277
|
async getNotes(
|
|
@@ -349,7 +349,7 @@ export class TXEService {
|
|
|
349
349
|
fromSingle(noteHash),
|
|
350
350
|
fromSingle(counter).toNumber(),
|
|
351
351
|
);
|
|
352
|
-
return toForeignCallResult([
|
|
352
|
+
return toForeignCallResult([]);
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
async notifyNullifiedNote(
|
|
@@ -362,12 +362,12 @@ export class TXEService {
|
|
|
362
362
|
fromSingle(noteHash),
|
|
363
363
|
fromSingle(counter).toNumber(),
|
|
364
364
|
);
|
|
365
|
-
return toForeignCallResult([
|
|
365
|
+
return toForeignCallResult([]);
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
async notifyCreatedNullifier(innerNullifier: ForeignCallSingle) {
|
|
369
369
|
await this.typedOracle.notifyCreatedNullifier(fromSingle(innerNullifier));
|
|
370
|
-
return toForeignCallResult([
|
|
370
|
+
return toForeignCallResult([]);
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
async checkNullifierExists(innerNullifier: ForeignCallSingle) {
|
|
@@ -377,15 +377,15 @@ export class TXEService {
|
|
|
377
377
|
|
|
378
378
|
async getContractInstance(address: ForeignCallSingle) {
|
|
379
379
|
const instance = await this.typedOracle.getContractInstance(addressFromSingle(address));
|
|
380
|
-
return toForeignCallResult(
|
|
381
|
-
|
|
380
|
+
return toForeignCallResult(
|
|
381
|
+
[
|
|
382
382
|
instance.salt,
|
|
383
383
|
instance.deployer.toField(),
|
|
384
384
|
instance.currentContractClassId,
|
|
385
385
|
instance.initializationHash,
|
|
386
386
|
...instance.publicKeys.toFields(),
|
|
387
|
-
]),
|
|
388
|
-
|
|
387
|
+
].map(toSingle),
|
|
388
|
+
);
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
async getPublicKeysAndPartialAddress(address: ForeignCallSingle) {
|
|
@@ -396,7 +396,7 @@ export class TXEService {
|
|
|
396
396
|
|
|
397
397
|
async getKeyValidationRequest(pkMHash: ForeignCallSingle) {
|
|
398
398
|
const keyValidationRequest = await this.typedOracle.getKeyValidationRequest(fromSingle(pkMHash));
|
|
399
|
-
return toForeignCallResult(
|
|
399
|
+
return toForeignCallResult(keyValidationRequest.toFields().map(toSingle));
|
|
400
400
|
}
|
|
401
401
|
|
|
402
402
|
async callPrivateFunction(
|
|
@@ -422,7 +422,7 @@ export class TXEService {
|
|
|
422
422
|
if (!witness) {
|
|
423
423
|
throw new Error(`Nullifier membership witness not found at block ${parsedBlockNumber}.`);
|
|
424
424
|
}
|
|
425
|
-
return toForeignCallResult(
|
|
425
|
+
return toForeignCallResult(witness.toNoirRepresentation());
|
|
426
426
|
}
|
|
427
427
|
|
|
428
428
|
async getAuthWitness(messageHash: ForeignCallSingle) {
|
|
@@ -485,7 +485,7 @@ export class TXEService {
|
|
|
485
485
|
if (!header) {
|
|
486
486
|
throw new Error(`Block header not found for block ${blockNumber}.`);
|
|
487
487
|
}
|
|
488
|
-
return toForeignCallResult(
|
|
488
|
+
return toForeignCallResult(header.toFields().map(toSingle));
|
|
489
489
|
}
|
|
490
490
|
|
|
491
491
|
async getMembershipWitness(blockNumber: ForeignCallSingle, treeId: ForeignCallSingle, leafValue: ForeignCallSingle) {
|
|
@@ -498,7 +498,7 @@ export class TXEService {
|
|
|
498
498
|
`Membership witness in tree ${MerkleTreeId[parsedTreeId]} not found for value ${parsedLeafValue} at block ${parsedBlockNumber}.`,
|
|
499
499
|
);
|
|
500
500
|
}
|
|
501
|
-
return toForeignCallResult([toArray(witness)]);
|
|
501
|
+
return toForeignCallResult([toSingle(witness[0]), toArray(witness.slice(1))]);
|
|
502
502
|
}
|
|
503
503
|
|
|
504
504
|
async getLowNullifierMembershipWitness(blockNumber: ForeignCallSingle, nullifier: ForeignCallSingle) {
|
|
@@ -508,7 +508,7 @@ export class TXEService {
|
|
|
508
508
|
if (!witness) {
|
|
509
509
|
throw new Error(`Low nullifier witness not found for nullifier ${nullifier} at block ${parsedBlockNumber}.`);
|
|
510
510
|
}
|
|
511
|
-
return toForeignCallResult(
|
|
511
|
+
return toForeignCallResult(witness.toNoirRepresentation());
|
|
512
512
|
}
|
|
513
513
|
|
|
514
514
|
async getIndexedTaggingSecretAsSender(sender: ForeignCallSingle, recipient: ForeignCallSingle) {
|
|
@@ -550,7 +550,8 @@ export class TXEService {
|
|
|
550
550
|
}
|
|
551
551
|
|
|
552
552
|
async getLogByTag(tag: ForeignCallSingle) {
|
|
553
|
-
|
|
553
|
+
// TODO(AD): this was warning that getLogByTag did not return a promise.
|
|
554
|
+
const log = await Promise.resolve(this.typedOracle.getLogByTag(fromSingle(tag)));
|
|
554
555
|
|
|
555
556
|
if (log == null) {
|
|
556
557
|
return toForeignCallResult([toSingle(Fr.ZERO), ...LogWithTxData.noirSerializationOfEmpty().map(toSingleOrArray)]);
|
|
@@ -629,7 +630,7 @@ export class TXEService {
|
|
|
629
630
|
AztecAddress.fromField(fromSingle(address)),
|
|
630
631
|
Point.fromFields(fromArray(ephPk)),
|
|
631
632
|
);
|
|
632
|
-
return toForeignCallResult(
|
|
633
|
+
return toForeignCallResult(secret.toFields().map(toSingle));
|
|
633
634
|
}
|
|
634
635
|
|
|
635
636
|
// AVM opcodes
|
|
@@ -84,10 +84,4 @@ export class TXEPublicContractDataSource implements ContractDataSource {
|
|
|
84
84
|
registerContractFunctionSignatures(_address: AztecAddress, _signatures: []): Promise<void> {
|
|
85
85
|
return Promise.resolve();
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
// TODO(#10007): Remove this method.
|
|
89
|
-
addContractClass(_contractClass: ContractClassPublic): Promise<void> {
|
|
90
|
-
// We don't really need to do anything for the txe here
|
|
91
|
-
return Promise.resolve();
|
|
92
|
-
}
|
|
93
87
|
}
|