@aztec/pxe 0.81.0 → 0.82.1-alpha-testnet.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/config/index.js +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/entrypoints/server/utils.d.ts +15 -7
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +17 -9
- package/dest/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.d.ts +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
- package/dest/private_kernel/hints/index.d.ts.map +1 -0
- package/dest/private_kernel/index.d.ts +3 -0
- package/dest/private_kernel/index.d.ts.map +1 -0
- package/dest/private_kernel/index.js +2 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +36 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
- package/dest/{kernel_prover/kernel_prover.js → private_kernel/private_kernel_execution_prover.js} +67 -76
- package/dest/{kernel_prover/proving_data_oracle.d.ts → private_kernel/private_kernel_oracle.d.ts} +17 -28
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_oracle.js +4 -0
- package/dest/{kernel_oracle/index.d.ts → private_kernel/private_kernel_oracle_impl.d.ts} +6 -6
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -0
- package/dest/{kernel_oracle/index.js → private_kernel/private_kernel_oracle_impl.js} +13 -3
- package/dest/pxe_oracle_interface/pxe_oracle_interface.d.ts +7 -16
- package/dest/pxe_oracle_interface/pxe_oracle_interface.d.ts.map +1 -1
- package/dest/pxe_oracle_interface/pxe_oracle_interface.js +17 -32
- package/dest/pxe_service/error_enriching.d.ts.map +1 -1
- package/dest/pxe_service/error_enriching.js +5 -8
- package/dest/pxe_service/pxe_service.d.ts +13 -27
- package/dest/pxe_service/pxe_service.d.ts.map +1 -1
- package/dest/pxe_service/pxe_service.js +215 -239
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +10 -44
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +93 -68
- package/dest/storage/contract_data_provider/index.d.ts +0 -1
- package/dest/storage/contract_data_provider/index.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts +2 -41
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/private_functions_tree.js +9 -61
- package/dest/storage/index.d.ts +1 -2
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +1 -2
- package/dest/storage/metadata.d.ts +2 -0
- package/dest/storage/metadata.d.ts.map +1 -0
- package/dest/storage/metadata.js +1 -0
- package/dest/test/pxe_test_suite.d.ts.map +1 -1
- package/dest/test/pxe_test_suite.js +1 -1
- package/package.json +15 -15
- package/src/config/index.ts +1 -1
- package/src/config/package_info.ts +1 -1
- package/src/entrypoints/server/utils.ts +25 -11
- package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts +4 -4
- package/src/private_kernel/index.ts +2 -0
- package/src/{kernel_prover/kernel_prover.ts → private_kernel/private_kernel_execution_prover.ts} +80 -91
- package/src/{kernel_prover/proving_data_oracle.ts → private_kernel/private_kernel_oracle.ts} +17 -29
- package/src/{kernel_oracle/index.ts → private_kernel/private_kernel_oracle_impl.ts} +19 -6
- package/src/pxe_oracle_interface/pxe_oracle_interface.ts +31 -40
- package/src/pxe_service/error_enriching.ts +8 -14
- package/src/pxe_service/pxe_service.ts +289 -297
- package/src/storage/contract_data_provider/contract_data_provider.ts +114 -75
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/private_functions_tree.ts +11 -75
- package/src/storage/index.ts +1 -3
- package/src/storage/metadata.ts +1 -0
- package/src/test/pxe_test_suite.ts +3 -1
- package/dest/kernel_oracle/index.d.ts.map +0 -1
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/kernel_prover/hints/index.d.ts.map +0 -1
- package/dest/kernel_prover/index.d.ts +0 -3
- package/dest/kernel_prover/index.d.ts.map +0 -1
- package/dest/kernel_prover/index.js +0 -2
- package/dest/kernel_prover/kernel_prover.d.ts +0 -38
- package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
- package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
- package/dest/kernel_prover/proving_data_oracle.js +0 -4
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
- package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
- package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
- package/dest/storage/auth_witness_data_provider/index.js +0 -1
- package/src/kernel_prover/index.ts +0 -2
- package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
- package/src/storage/auth_witness_data_provider/index.ts +0 -1
- /package/dest/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.js +0 -0
- /package/dest/{kernel_prover → private_kernel}/hints/index.d.ts +0 -0
- /package/dest/{kernel_prover → private_kernel}/hints/index.js +0 -0
- /package/src/{kernel_prover → private_kernel}/hints/index.ts +0 -0
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import type { Fr } from '@aztec/foundation/fields';
|
|
4
2
|
import type { MembershipWitness } from '@aztec/foundation/trees';
|
|
5
3
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
6
|
-
import { type ContractArtifact, type FunctionArtifact, type FunctionDebugMetadata, FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
|
+
import { type ContractArtifact, type FunctionAbi, type FunctionArtifact, type FunctionArtifactWithContractName, type FunctionDebugMetadata, FunctionSelector } from '@aztec/stdlib/abi';
|
|
7
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
6
|
import { type ContractClass, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
9
7
|
import type { DataProvider } from '../data_provider.js';
|
|
@@ -16,39 +14,15 @@ import type { DataProvider } from '../data_provider.js';
|
|
|
16
14
|
*/
|
|
17
15
|
export declare class ContractDataProvider implements DataProvider {
|
|
18
16
|
#private;
|
|
19
|
-
/** Map from contract class id to private function tree. */
|
|
20
|
-
private contractClassesCache;
|
|
21
17
|
constructor(store: AztecAsyncKVStore);
|
|
22
18
|
addContractArtifact(id: Fr, contract: ContractArtifact): Promise<void>;
|
|
23
19
|
addContractInstance(contract: ContractInstanceWithAddress): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Retrieve or create a ContractTree instance based on the provided class id.
|
|
26
|
-
* If an existing tree with the same class id is found in the cache, it will be returned.
|
|
27
|
-
* Otherwise, a new ContractTree instance will be created using the contract data from the database
|
|
28
|
-
* and added to the cache before returning.
|
|
29
|
-
*
|
|
30
|
-
* @param classId - The class id of the contract for which the ContractTree is required.
|
|
31
|
-
* @returns A ContractTree instance associated with the specified contract address.
|
|
32
|
-
* @throws An Error if the contract is not found in the ContractDatabase.
|
|
33
|
-
*/
|
|
34
|
-
private getTreeForClassId;
|
|
35
|
-
/**
|
|
36
|
-
* Retrieve or create a ContractTree instance based on the provided AztecAddress.
|
|
37
|
-
* If an existing tree with the same contract address is found in the cache, it will be returned.
|
|
38
|
-
* Otherwise, a new ContractTree instance will be created using the contract data from the database
|
|
39
|
-
* and added to the cache before returning.
|
|
40
|
-
*
|
|
41
|
-
* @param contractAddress - The AztecAddress of the contract for which the ContractTree is required.
|
|
42
|
-
* @returns A ContractTree instance associated with the specified contract address.
|
|
43
|
-
* @throws An Error if the contract is not found in the ContractDatabase.
|
|
44
|
-
*/
|
|
45
|
-
private getTreeForAddress;
|
|
46
20
|
getContractsAddresses(): Promise<AztecAddress[]>;
|
|
47
21
|
/** Returns a contract instance for a given address. Throws if not found. */
|
|
48
|
-
getContractInstance(contractAddress: AztecAddress): Promise<ContractInstanceWithAddress>;
|
|
49
|
-
getContractArtifact(contractClassId: Fr): Promise<ContractArtifact>;
|
|
22
|
+
getContractInstance(contractAddress: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
23
|
+
getContractArtifact(contractClassId: Fr): Promise<ContractArtifact | undefined>;
|
|
50
24
|
/** Returns a contract class for a given class id. Throws if not found. */
|
|
51
|
-
getContractClass(contractClassId: Fr): Promise<ContractClass>;
|
|
25
|
+
getContractClass(contractClassId: Fr): Promise<ContractClass | undefined>;
|
|
52
26
|
getContract(address: AztecAddress): Promise<(ContractInstanceWithAddress & ContractArtifact) | undefined>;
|
|
53
27
|
/**
|
|
54
28
|
* Retrieves the artifact of a specified function within a given contract.
|
|
@@ -59,7 +33,8 @@ export declare class ContractDataProvider implements DataProvider {
|
|
|
59
33
|
* @param selector - The function selector.
|
|
60
34
|
* @returns The corresponding function's artifact as an object.
|
|
61
35
|
*/
|
|
62
|
-
getFunctionArtifact(contractAddress: AztecAddress, selector: FunctionSelector): Promise<
|
|
36
|
+
getFunctionArtifact(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionArtifactWithContractName | undefined>;
|
|
37
|
+
getPublicFunctionArtifact(contractAddress: AztecAddress): Promise<FunctionArtifactWithContractName | undefined>;
|
|
63
38
|
/**
|
|
64
39
|
* Retrieves the artifact of a specified function within a given contract.
|
|
65
40
|
* The function is identified by its name, which is unique within a contract.
|
|
@@ -70,6 +45,7 @@ export declare class ContractDataProvider implements DataProvider {
|
|
|
70
45
|
* @returns The corresponding function's artifact as an object
|
|
71
46
|
*/
|
|
72
47
|
getFunctionArtifactByName(contractAddress: AztecAddress, functionName: string): Promise<FunctionArtifact | undefined>;
|
|
48
|
+
getFunctionAbi(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionAbi | undefined>;
|
|
73
49
|
/**
|
|
74
50
|
* Retrieves the debug metadata of a specified function within a given contract.
|
|
75
51
|
* The function is identified by its selector, which is a unique code generated from the function's signature.
|
|
@@ -81,17 +57,7 @@ export declare class ContractDataProvider implements DataProvider {
|
|
|
81
57
|
* @returns The corresponding function's artifact as an object.
|
|
82
58
|
*/
|
|
83
59
|
getFunctionDebugMetadata(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionDebugMetadata | undefined>;
|
|
84
|
-
|
|
85
|
-
* Retrieve the bytecode of a specific function in a contract at the given address.
|
|
86
|
-
* The returned bytecode is required for executing and verifying the function's behavior
|
|
87
|
-
* in the Aztec network. Throws an error if the contract or function cannot be found.
|
|
88
|
-
*
|
|
89
|
-
* @param contractAddress - The contract's address.
|
|
90
|
-
* @param selector - The function selector.
|
|
91
|
-
* @returns A Promise that resolves to a Buffer containing the bytecode of the specified function.
|
|
92
|
-
* @throws Error if the contract address is unknown or not found.
|
|
93
|
-
*/
|
|
94
|
-
getBytecode(contractAddress: AztecAddress, selector: FunctionSelector): Promise<Buffer>;
|
|
60
|
+
getPublicFunctionDebugMetadata(contractAddress: AztecAddress): Promise<FunctionDebugMetadata | undefined>;
|
|
95
61
|
/**
|
|
96
62
|
* Retrieve the function membership witness for the given contract class and function selector.
|
|
97
63
|
* The function membership witness represents a proof that the function belongs to the specified contract.
|
|
@@ -101,8 +67,8 @@ export declare class ContractDataProvider implements DataProvider {
|
|
|
101
67
|
* @param selector - The function selector.
|
|
102
68
|
* @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
|
|
103
69
|
*/
|
|
104
|
-
getFunctionMembershipWitness(contractClassId: Fr, selector: FunctionSelector): Promise<MembershipWitness<5
|
|
105
|
-
getDebugContractName(contractAddress: AztecAddress): Promise<string>;
|
|
70
|
+
getFunctionMembershipWitness(contractClassId: Fr, selector: FunctionSelector): Promise<MembershipWitness<5> | undefined>;
|
|
71
|
+
getDebugContractName(contractAddress: AztecAddress): Promise<string | undefined>;
|
|
106
72
|
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
|
|
107
73
|
getSize(): Promise<number>;
|
|
108
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/contract_data_provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contract_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/contract_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,gCAAgC,EACrC,KAAK,qBAAqB,EAC1B,gBAAgB,EAKjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,2BAA2B,EAGjC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;;;;GAMG;AACH,qBAAa,oBAAqB,YAAW,YAAY;;gBAW3C,KAAK,EAAE,iBAAiB;IAOvB,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB7E,mBAAmB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;IAmDzE,qBAAqB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAKtD,4EAA4E;IAC/D,mBAAmB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC;IAKpG,mBAAmB,CAAC,eAAe,EAAE,EAAE,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAM5F,0EAA0E;IAC7D,gBAAgB,CAAC,eAAe,EAAE,EAAE,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAKzE,WAAW,CACtB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,CAAC,2BAA2B,GAAG,gBAAgB,CAAC,GAAG,SAAS,CAAC;IAYxE;;;;;;;;OAQG;IACU,mBAAmB,CAC9B,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,gCAAgC,GAAG,SAAS,CAAC;IAM3C,yBAAyB,CACpC,eAAe,EAAE,YAAY,GAC5B,OAAO,CAAC,gCAAgC,GAAG,SAAS,CAAC;IAMxD;;;;;;;;OAQG;IACU,yBAAyB,CACpC,eAAe,EAAE,YAAY,EAC7B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAK3B,cAAc,CACzB,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAKnC;;;;;;;;;OASG;IACU,wBAAwB,CACnC,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IAMhC,8BAA8B,CACzC,eAAe,EAAE,YAAY,GAC5B,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IAM7C;;;;;;;;OAQG;IACU,4BAA4B,CACvC,eAAe,EAAE,EAAE,EACnB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAK/B,oBAAoB,CAAC,eAAe,EAAE,YAAY;IAKlD,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB;IAM9E,OAAO;CAiCrB"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { toArray } from '@aztec/foundation/iterable';
|
|
2
|
-
import { ContractClassNotFoundError, ContractNotFoundError } from '@aztec/simulator/client';
|
|
3
2
|
import { FunctionSelector, FunctionType, contractArtifactFromBuffer, contractArtifactToBuffer, getFunctionDebugMetadata } from '@aztec/stdlib/abi';
|
|
4
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import { SerializableContractInstance } from '@aztec/stdlib/contract';
|
|
4
|
+
import { SerializableContractInstance, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
6
5
|
import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
7
6
|
/**
|
|
8
7
|
* ContractDataProvider serves as a data manager and retriever for Aztec.nr contracts.
|
|
@@ -11,7 +10,9 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
11
10
|
* to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch
|
|
12
11
|
* the required information and facilitate cryptographic proof generation.
|
|
13
12
|
*/ export class ContractDataProvider {
|
|
14
|
-
/** Map from contract class id to private function tree. */
|
|
13
|
+
/** Map from contract class id to private function tree. */ // TODO: Update it to be LRU cache so that it doesn't keep all the data all the time.
|
|
14
|
+
#privateFunctionTrees = new Map();
|
|
15
|
+
/** Map from contract address to contract class id */ #contractClassIdMap = new Map();
|
|
15
16
|
#contractArtifacts;
|
|
16
17
|
#contractInstances;
|
|
17
18
|
constructor(store){
|
|
@@ -28,17 +29,19 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
28
29
|
await this.#contractArtifacts.set(id.toString(), contractArtifactToBuffer(contract));
|
|
29
30
|
}
|
|
30
31
|
async addContractInstance(contract) {
|
|
32
|
+
this.#contractClassIdMap.set(contract.address.toString(), contract.currentContractClassId);
|
|
31
33
|
await this.#contractInstances.set(contract.address.toString(), new SerializableContractInstance(contract).toBuffer());
|
|
32
34
|
}
|
|
33
35
|
// Private getters
|
|
34
|
-
async #
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
async #getContractClassId(contractAddress) {
|
|
37
|
+
if (!this.#contractClassIdMap.has(contractAddress.toString())) {
|
|
38
|
+
const instance = await this.getContractInstance(contractAddress);
|
|
39
|
+
if (!instance) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
this.#contractClassIdMap.set(contractAddress.toString(), instance.currentContractClassId);
|
|
43
|
+
}
|
|
44
|
+
return this.#contractClassIdMap.get(contractAddress.toString());
|
|
42
45
|
}
|
|
43
46
|
/**
|
|
44
47
|
* Retrieve or create a ContractTree instance based on the provided class id.
|
|
@@ -49,29 +52,20 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
49
52
|
* @param classId - The class id of the contract for which the ContractTree is required.
|
|
50
53
|
* @returns A ContractTree instance associated with the specified contract address.
|
|
51
54
|
* @throws An Error if the contract is not found in the ContractDatabase.
|
|
52
|
-
*/ async
|
|
53
|
-
if (!this.
|
|
54
|
-
const artifact = await this
|
|
55
|
+
*/ async #getPrivateFunctionTreeForClassId(classId) {
|
|
56
|
+
if (!this.#privateFunctionTrees.has(classId.toString())) {
|
|
57
|
+
const artifact = await this.getContractArtifact(classId);
|
|
55
58
|
if (!artifact) {
|
|
56
|
-
|
|
59
|
+
return;
|
|
57
60
|
}
|
|
58
61
|
const tree = await PrivateFunctionsTree.create(artifact);
|
|
59
|
-
this.
|
|
62
|
+
this.#privateFunctionTrees.set(classId.toString(), tree);
|
|
60
63
|
}
|
|
61
|
-
return this.
|
|
64
|
+
return this.#privateFunctionTrees.get(classId.toString());
|
|
62
65
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
* Otherwise, a new ContractTree instance will be created using the contract data from the database
|
|
67
|
-
* and added to the cache before returning.
|
|
68
|
-
*
|
|
69
|
-
* @param contractAddress - The AztecAddress of the contract for which the ContractTree is required.
|
|
70
|
-
* @returns A ContractTree instance associated with the specified contract address.
|
|
71
|
-
* @throws An Error if the contract is not found in the ContractDatabase.
|
|
72
|
-
*/ async getTreeForAddress(contractAddress) {
|
|
73
|
-
const instance = await this.getContractInstance(contractAddress);
|
|
74
|
-
return this.getTreeForClassId(instance.currentContractClassId);
|
|
66
|
+
async #getContractArtifactByAddress(contractAddress) {
|
|
67
|
+
const contractClassId = await this.#getContractClassId(contractAddress);
|
|
68
|
+
return contractClassId && this.getContractArtifact(contractClassId);
|
|
75
69
|
}
|
|
76
70
|
// Public getters
|
|
77
71
|
async getContractsAddresses() {
|
|
@@ -79,25 +73,26 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
79
73
|
return keys.map(AztecAddress.fromString);
|
|
80
74
|
}
|
|
81
75
|
/** Returns a contract instance for a given address. Throws if not found. */ async getContractInstance(contractAddress) {
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
throw new ContractNotFoundError(contractAddress.toString());
|
|
85
|
-
}
|
|
86
|
-
return instance;
|
|
76
|
+
const contract = await this.#contractInstances.getAsync(contractAddress.toString());
|
|
77
|
+
return contract && SerializableContractInstance.fromBuffer(contract).withAddress(contractAddress);
|
|
87
78
|
}
|
|
88
79
|
async getContractArtifact(contractClassId) {
|
|
89
|
-
const
|
|
90
|
-
|
|
80
|
+
const contract = await this.#contractArtifacts.getAsync(contractClassId.toString());
|
|
81
|
+
// TODO(@spalladino): AztecAsyncMap lies and returns Uint8Arrays instead of Buffers, hence the extra Buffer.from.
|
|
82
|
+
return contract && contractArtifactFromBuffer(Buffer.from(contract));
|
|
91
83
|
}
|
|
92
84
|
/** Returns a contract class for a given class id. Throws if not found. */ async getContractClass(contractClassId) {
|
|
93
|
-
const
|
|
94
|
-
return
|
|
85
|
+
const artifact = await this.getContractArtifact(contractClassId);
|
|
86
|
+
return artifact && getContractClassFromArtifact(artifact);
|
|
95
87
|
}
|
|
96
88
|
async getContract(address) {
|
|
97
89
|
const instance = await this.getContractInstance(address);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
if (!instance) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const artifact = await this.getContractArtifact(instance.currentContractClassId);
|
|
94
|
+
if (!artifact) {
|
|
95
|
+
return;
|
|
101
96
|
}
|
|
102
97
|
return {
|
|
103
98
|
...instance,
|
|
@@ -113,8 +108,20 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
113
108
|
* @param selector - The function selector.
|
|
114
109
|
* @returns The corresponding function's artifact as an object.
|
|
115
110
|
*/ async getFunctionArtifact(contractAddress, selector) {
|
|
116
|
-
const
|
|
117
|
-
|
|
111
|
+
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
112
|
+
const fnArtifact = artifact && await this.#findFunctionArtifactBySelector(artifact, selector);
|
|
113
|
+
return fnArtifact && {
|
|
114
|
+
...fnArtifact,
|
|
115
|
+
contractName: artifact.name
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
async getPublicFunctionArtifact(contractAddress) {
|
|
119
|
+
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
120
|
+
const fnArtifact = artifact && artifact.functions.find((fn)=>fn.functionType === FunctionType.PUBLIC);
|
|
121
|
+
return fnArtifact && {
|
|
122
|
+
...fnArtifact,
|
|
123
|
+
contractName: artifact.name
|
|
124
|
+
};
|
|
118
125
|
}
|
|
119
126
|
/**
|
|
120
127
|
* Retrieves the artifact of a specified function within a given contract.
|
|
@@ -125,8 +132,12 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
125
132
|
* @param functionName - The name of the function.
|
|
126
133
|
* @returns The corresponding function's artifact as an object
|
|
127
134
|
*/ async getFunctionArtifactByName(contractAddress, functionName) {
|
|
128
|
-
const
|
|
129
|
-
return
|
|
135
|
+
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
136
|
+
return artifact?.functions.find((fn)=>fn.name === functionName);
|
|
137
|
+
}
|
|
138
|
+
async getFunctionAbi(contractAddress, selector) {
|
|
139
|
+
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
140
|
+
return artifact && await this.#findFunctionAbiBySelector(artifact, selector);
|
|
130
141
|
}
|
|
131
142
|
/**
|
|
132
143
|
* Retrieves the debug metadata of a specified function within a given contract.
|
|
@@ -138,22 +149,14 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
138
149
|
* @param selector - The function selector.
|
|
139
150
|
* @returns The corresponding function's artifact as an object.
|
|
140
151
|
*/ async getFunctionDebugMetadata(contractAddress, selector) {
|
|
141
|
-
const
|
|
142
|
-
const
|
|
143
|
-
return getFunctionDebugMetadata(
|
|
152
|
+
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
153
|
+
const fnArtifact = artifact && await this.#findFunctionArtifactBySelector(artifact, selector);
|
|
154
|
+
return fnArtifact && getFunctionDebugMetadata(artifact, fnArtifact);
|
|
144
155
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
*
|
|
150
|
-
* @param contractAddress - The contract's address.
|
|
151
|
-
* @param selector - The function selector.
|
|
152
|
-
* @returns A Promise that resolves to a Buffer containing the bytecode of the specified function.
|
|
153
|
-
* @throws Error if the contract address is unknown or not found.
|
|
154
|
-
*/ async getBytecode(contractAddress, selector) {
|
|
155
|
-
const tree = await this.getTreeForAddress(contractAddress);
|
|
156
|
-
return tree.getBytecode(selector);
|
|
156
|
+
async getPublicFunctionDebugMetadata(contractAddress) {
|
|
157
|
+
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
158
|
+
const fnArtifact = artifact && artifact.functions.find((fn)=>fn.functionType === FunctionType.PUBLIC);
|
|
159
|
+
return fnArtifact && getFunctionDebugMetadata(artifact, fnArtifact);
|
|
157
160
|
}
|
|
158
161
|
/**
|
|
159
162
|
* Retrieve the function membership witness for the given contract class and function selector.
|
|
@@ -164,20 +167,42 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
164
167
|
* @param selector - The function selector.
|
|
165
168
|
* @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
|
|
166
169
|
*/ async getFunctionMembershipWitness(contractClassId, selector) {
|
|
167
|
-
const tree = await this
|
|
168
|
-
return tree
|
|
170
|
+
const tree = await this.#getPrivateFunctionTreeForClassId(contractClassId);
|
|
171
|
+
return tree?.getFunctionMembershipWitness(selector);
|
|
169
172
|
}
|
|
170
173
|
async getDebugContractName(contractAddress) {
|
|
171
|
-
const
|
|
172
|
-
return
|
|
174
|
+
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
175
|
+
return artifact?.name;
|
|
173
176
|
}
|
|
174
177
|
async getDebugFunctionName(contractAddress, selector) {
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
return `${contractName}:${functionName}`;
|
|
178
|
+
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
179
|
+
const fnArtifact = artifact && await this.#findFunctionAbiBySelector(artifact, selector);
|
|
180
|
+
return `${artifact?.name ?? contractAddress}:${fnArtifact?.name ?? selector}`;
|
|
179
181
|
}
|
|
180
182
|
async getSize() {
|
|
181
183
|
return (await toArray(this.#contractInstances.valuesAsync())).concat(await toArray(this.#contractArtifacts.valuesAsync())).reduce((sum, value)=>sum + value.length, 0);
|
|
182
184
|
}
|
|
185
|
+
async #findFunctionArtifactBySelector(artifact, selector) {
|
|
186
|
+
const functions = artifact.functions;
|
|
187
|
+
for(let i = 0; i < functions.length; i++){
|
|
188
|
+
const fn = functions[i];
|
|
189
|
+
const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
|
|
190
|
+
if (fnSelector.equals(selector)) {
|
|
191
|
+
return fn;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
async #findFunctionAbiBySelector(artifact, selector) {
|
|
196
|
+
const functions = [
|
|
197
|
+
...artifact.functions,
|
|
198
|
+
...artifact.nonDispatchPublicFunctions ?? []
|
|
199
|
+
];
|
|
200
|
+
for(let i = 0; i < functions.length; i++){
|
|
201
|
+
const fn = functions[i];
|
|
202
|
+
const fnSelector = await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters);
|
|
203
|
+
if (fnSelector.equals(selector)) {
|
|
204
|
+
return fn;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
183
208
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
|
|
4
|
-
import {
|
|
5
|
-
import { MembershipWitness, type MerkleTree } from '@aztec/foundation/trees';
|
|
2
|
+
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
6
3
|
import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
|
|
7
|
-
import { type ContractClassWithId } from '@aztec/stdlib/contract';
|
|
8
4
|
/**
|
|
9
5
|
* Represents a Merkle tree of functions for a particular Contract Class.
|
|
10
6
|
* It manages the construction of the function tree, computes its root, and generates membership witnesses
|
|
@@ -12,45 +8,10 @@ import { type ContractClassWithId } from '@aztec/stdlib/contract';
|
|
|
12
8
|
* It is used in combination with the AztecNode to compute various data for executing private transactions.
|
|
13
9
|
*/
|
|
14
10
|
export declare class PrivateFunctionsTree {
|
|
15
|
-
private readonly
|
|
16
|
-
private contractClass;
|
|
11
|
+
private readonly privateFunctions;
|
|
17
12
|
private tree?;
|
|
18
13
|
private constructor();
|
|
19
14
|
static create(artifact: ContractArtifact): Promise<PrivateFunctionsTree>;
|
|
20
|
-
/**
|
|
21
|
-
* Retrieve the artifact of a given function.
|
|
22
|
-
* The function is identified by its selector, which represents a unique identifier for the function's signature.
|
|
23
|
-
* Throws an error if the function with the provided selector is not found in the contract.
|
|
24
|
-
*
|
|
25
|
-
* @param selector - The function selector.
|
|
26
|
-
* @returns The artifact object containing relevant information about the targeted function.
|
|
27
|
-
*/
|
|
28
|
-
getFunctionArtifact(selector: FunctionSelector): Promise<import("@aztec/stdlib/abi").FunctionArtifact>;
|
|
29
|
-
/**
|
|
30
|
-
* Retrieve the bytecode of a function in the contract by its function selector.
|
|
31
|
-
* The function selector is a unique identifier for each function in a contract.
|
|
32
|
-
* Throws an error if the function with the given selector is not found in the contract.
|
|
33
|
-
*
|
|
34
|
-
* @param selector - The selector of a function to get bytecode for.
|
|
35
|
-
* @returns The bytecode of the function as a string.
|
|
36
|
-
*/
|
|
37
|
-
getBytecode(selector: FunctionSelector): Promise<Buffer>;
|
|
38
|
-
/**
|
|
39
|
-
* Calculate and return the root of the function tree for the current contract.
|
|
40
|
-
* This root is a cryptographic commitment to the set of constrained functions within the contract,
|
|
41
|
-
* which is used in the Aztec node's proof system. The root will be cached after the first call.
|
|
42
|
-
*
|
|
43
|
-
* @returns A promise that resolves to the Fr (finite field element) representation of the function tree root.
|
|
44
|
-
*/
|
|
45
|
-
getFunctionTreeRoot(): Promise<MerkleTree>;
|
|
46
|
-
/** Returns the contract class object. */
|
|
47
|
-
getContractClass(): ContractClassWithId;
|
|
48
|
-
/** Returns the contract artifact. */
|
|
49
|
-
getArtifact(): ContractArtifact;
|
|
50
|
-
/**
|
|
51
|
-
* Returns the contract class identifier for the given artifact.
|
|
52
|
-
*/
|
|
53
|
-
getContractClassId(): Fr;
|
|
54
15
|
/**
|
|
55
16
|
* Retrieve the membership witness of a function within a contract's function tree.
|
|
56
17
|
* A membership witness represents the position and authentication path of a target function
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/private_functions_tree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/private_functions_tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,iBAAiB,EAAmB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AAQ1F;;;;;GAKG;AACH,qBAAa,oBAAoB;IAGX,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAFrD,OAAO,CAAC,IAAI,CAAC,CAAa;IAE1B,OAAO;WAEM,MAAM,CAAC,QAAQ,EAAE,gBAAgB;IAS9C;;;;;;;;OAQG;IACU,4BAA4B,CACvC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC;YAiB5C,OAAO;CAMtB"}
|
|
@@ -2,73 +2,22 @@ import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
|
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { assertLength } from '@aztec/foundation/serialize';
|
|
4
4
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
5
|
-
import {
|
|
6
|
-
import { computePrivateFunctionLeaf, computePrivateFunctionsTree,
|
|
5
|
+
import { FunctionType } from '@aztec/stdlib/abi';
|
|
6
|
+
import { computePrivateFunctionLeaf, computePrivateFunctionsTree, getContractClassPrivateFunctionFromArtifact } from '@aztec/stdlib/contract';
|
|
7
7
|
/**
|
|
8
8
|
* Represents a Merkle tree of functions for a particular Contract Class.
|
|
9
9
|
* It manages the construction of the function tree, computes its root, and generates membership witnesses
|
|
10
10
|
* for constrained functions. This class also enables lookup of specific function artifact using selectors.
|
|
11
11
|
* It is used in combination with the AztecNode to compute various data for executing private transactions.
|
|
12
12
|
*/ export class PrivateFunctionsTree {
|
|
13
|
-
|
|
14
|
-
contractClass;
|
|
13
|
+
privateFunctions;
|
|
15
14
|
tree;
|
|
16
|
-
constructor(
|
|
17
|
-
this.
|
|
18
|
-
this.contractClass = contractClass;
|
|
15
|
+
constructor(privateFunctions){
|
|
16
|
+
this.privateFunctions = privateFunctions;
|
|
19
17
|
}
|
|
20
18
|
static async create(artifact) {
|
|
21
|
-
const
|
|
22
|
-
return new PrivateFunctionsTree(
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Retrieve the artifact of a given function.
|
|
26
|
-
* The function is identified by its selector, which represents a unique identifier for the function's signature.
|
|
27
|
-
* Throws an error if the function with the provided selector is not found in the contract.
|
|
28
|
-
*
|
|
29
|
-
* @param selector - The function selector.
|
|
30
|
-
* @returns The artifact object containing relevant information about the targeted function.
|
|
31
|
-
*/ async getFunctionArtifact(selector) {
|
|
32
|
-
const functionsAndSelectors = await Promise.all(this.artifact.functions.map(async (f)=>({
|
|
33
|
-
f,
|
|
34
|
-
selector: await FunctionSelector.fromNameAndParameters(f.name, f.parameters)
|
|
35
|
-
})));
|
|
36
|
-
const artifact = functionsAndSelectors.find((f)=>selector.equals(f.selector))?.f;
|
|
37
|
-
if (!artifact) {
|
|
38
|
-
throw new Error(`Unknown function. Selector ${selector.toString()} not found in the artifact ${this.artifact.name} with class ${this.getContractClassId().toString()}.`);
|
|
39
|
-
}
|
|
40
|
-
return artifact;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Retrieve the bytecode of a function in the contract by its function selector.
|
|
44
|
-
* The function selector is a unique identifier for each function in a contract.
|
|
45
|
-
* Throws an error if the function with the given selector is not found in the contract.
|
|
46
|
-
*
|
|
47
|
-
* @param selector - The selector of a function to get bytecode for.
|
|
48
|
-
* @returns The bytecode of the function as a string.
|
|
49
|
-
*/ async getBytecode(selector) {
|
|
50
|
-
const artifact = await this.getFunctionArtifact(selector);
|
|
51
|
-
return artifact.bytecode;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Calculate and return the root of the function tree for the current contract.
|
|
55
|
-
* This root is a cryptographic commitment to the set of constrained functions within the contract,
|
|
56
|
-
* which is used in the Aztec node's proof system. The root will be cached after the first call.
|
|
57
|
-
*
|
|
58
|
-
* @returns A promise that resolves to the Fr (finite field element) representation of the function tree root.
|
|
59
|
-
*/ getFunctionTreeRoot() {
|
|
60
|
-
return this.getTree();
|
|
61
|
-
}
|
|
62
|
-
/** Returns the contract class object. */ getContractClass() {
|
|
63
|
-
return this.contractClass;
|
|
64
|
-
}
|
|
65
|
-
/** Returns the contract artifact. */ getArtifact() {
|
|
66
|
-
return this.artifact;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Returns the contract class identifier for the given artifact.
|
|
70
|
-
*/ getContractClassId() {
|
|
71
|
-
return this.getContractClass().id;
|
|
19
|
+
const privateFunctions = await Promise.all(artifact.functions.filter((fn)=>fn.functionType === FunctionType.PRIVATE).map(getContractClassPrivateFunctionFromArtifact));
|
|
20
|
+
return new PrivateFunctionsTree(privateFunctions);
|
|
72
21
|
}
|
|
73
22
|
/**
|
|
74
23
|
* Retrieve the membership witness of a function within a contract's function tree.
|
|
@@ -79,7 +28,7 @@ import { computePrivateFunctionLeaf, computePrivateFunctionsTree, getContractCla
|
|
|
79
28
|
* @param selector - The function selector.
|
|
80
29
|
* @returns A MembershipWitness instance representing the position and authentication path of the function in the function tree.
|
|
81
30
|
*/ async getFunctionMembershipWitness(selector) {
|
|
82
|
-
const fn = this.
|
|
31
|
+
const fn = this.privateFunctions.find((f)=>f.selector.equals(selector));
|
|
83
32
|
if (!fn) {
|
|
84
33
|
throw new Error(`Private function with selector ${selector.toString()} not found in contract class.`);
|
|
85
34
|
}
|
|
@@ -91,8 +40,7 @@ import { computePrivateFunctionLeaf, computePrivateFunctionsTree, getContractCla
|
|
|
91
40
|
}
|
|
92
41
|
async getTree() {
|
|
93
42
|
if (!this.tree) {
|
|
94
|
-
|
|
95
|
-
this.tree = await computePrivateFunctionsTree(fns);
|
|
43
|
+
this.tree = await computePrivateFunctionsTree(this.privateFunctions);
|
|
96
44
|
}
|
|
97
45
|
return this.tree;
|
|
98
46
|
}
|
package/dest/storage/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export * from './address_data_provider/index.js';
|
|
2
|
-
export * from './auth_witness_data_provider/index.js';
|
|
3
2
|
export * from './capsule_data_provider/index.js';
|
|
4
3
|
export * from './contract_data_provider/index.js';
|
|
5
4
|
export * from './note_data_provider/index.js';
|
|
6
5
|
export * from './sync_data_provider/index.js';
|
|
7
6
|
export * from './tagging_data_provider/index.js';
|
|
8
7
|
export * from './data_provider.js';
|
|
9
|
-
export
|
|
8
|
+
export * from './metadata.js';
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
|
package/dest/storage/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export * from './address_data_provider/index.js';
|
|
2
|
-
export * from './auth_witness_data_provider/index.js';
|
|
3
2
|
export * from './capsule_data_provider/index.js';
|
|
4
3
|
export * from './contract_data_provider/index.js';
|
|
5
4
|
export * from './note_data_provider/index.js';
|
|
6
5
|
export * from './sync_data_provider/index.js';
|
|
7
6
|
export * from './tagging_data_provider/index.js';
|
|
8
7
|
export * from './data_provider.js';
|
|
9
|
-
export
|
|
8
|
+
export * from './metadata.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/storage/metadata.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PXE_DATA_SCHEMA_VERSION = 2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pxe_test_suite.d.ts","sourceRoot":"","sources":["../../src/test/pxe_test_suite.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAS3D,eAAO,MAAM,YAAY,aAAc,MAAM,YAAY,MAAM,QAAQ,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"pxe_test_suite.d.ts","sourceRoot":"","sources":["../../src/test/pxe_test_suite.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAS3D,eAAO,MAAM,YAAY,aAAc,MAAM,YAAY,MAAM,QAAQ,GAAG,CAAC,SAmG1E,CAAC"}
|
|
@@ -69,7 +69,7 @@ export const pxeTestSuite = (testName, pxeSetup)=>{
|
|
|
69
69
|
const instance = await randomContractInstanceWithAddress();
|
|
70
70
|
await expect(pxe.registerContract({
|
|
71
71
|
instance
|
|
72
|
-
})).rejects.toThrow(/
|
|
72
|
+
})).rejects.toThrow(/Artifact not found when registering an instance/);
|
|
73
73
|
});
|
|
74
74
|
it('refuses to register a contract with an artifact with mismatching class id', async ()=>{
|
|
75
75
|
const artifact = randomContractArtifact();
|