@aztec/pxe 0.0.0-test.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/README.md +13 -0
- package/dest/bin/index.d.ts +3 -0
- package/dest/bin/index.d.ts.map +1 -0
- package/dest/bin/index.js +28 -0
- package/dest/config/index.d.ts +48 -0
- package/dest/config/index.d.ts.map +1 -0
- package/dest/config/index.js +74 -0
- package/dest/config/package_info.d.ts +5 -0
- package/dest/config/package_info.d.ts.map +1 -0
- package/dest/config/package_info.js +6 -0
- package/dest/entrypoints/client/bundle/index.d.ts +6 -0
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -0
- package/dest/entrypoints/client/bundle/index.js +5 -0
- package/dest/entrypoints/client/bundle/utils.d.ts +16 -0
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -0
- package/dest/entrypoints/client/bundle/utils.js +30 -0
- package/dest/entrypoints/client/lazy/index.d.ts +6 -0
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -0
- package/dest/entrypoints/client/lazy/index.js +5 -0
- package/dest/entrypoints/client/lazy/utils.d.ts +15 -0
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -0
- package/dest/entrypoints/client/lazy/utils.js +29 -0
- package/dest/entrypoints/client/pxe_creation_options.d.ts +11 -0
- package/dest/entrypoints/client/pxe_creation_options.d.ts.map +1 -0
- package/dest/entrypoints/client/pxe_creation_options.js +1 -0
- package/dest/entrypoints/server/index.d.ts +7 -0
- package/dest/entrypoints/server/index.d.ts.map +1 -0
- package/dest/entrypoints/server/index.js +6 -0
- package/dest/entrypoints/server/utils.d.ts +16 -0
- package/dest/entrypoints/server/utils.d.ts.map +1 -0
- package/dest/entrypoints/server/utils.js +45 -0
- package/dest/kernel_oracle/index.d.ts +45 -0
- package/dest/kernel_oracle/index.d.ts.map +1 -0
- package/dest/kernel_oracle/index.js +76 -0
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +28 -0
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +270 -0
- package/dest/kernel_prover/hints/index.d.ts +2 -0
- package/dest/kernel_prover/hints/index.d.ts.map +1 -0
- package/dest/kernel_prover/hints/index.js +1 -0
- package/dest/kernel_prover/index.d.ts +3 -0
- package/dest/kernel_prover/index.d.ts.map +1 -0
- package/dest/kernel_prover/index.js +2 -0
- package/dest/kernel_prover/kernel_prover.d.ts +38 -0
- package/dest/kernel_prover/kernel_prover.d.ts.map +1 -0
- package/dest/kernel_prover/kernel_prover.js +217 -0
- package/dest/kernel_prover/proving_data_oracle.d.ts +73 -0
- package/dest/kernel_prover/proving_data_oracle.d.ts.map +1 -0
- package/dest/kernel_prover/proving_data_oracle.js +4 -0
- package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +11 -0
- package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +1 -0
- package/dest/note_decryption_utils/add_public_values_to_payload.js +47 -0
- package/dest/pxe_http/index.d.ts +2 -0
- package/dest/pxe_http/index.d.ts.map +1 -0
- package/dest/pxe_http/index.js +1 -0
- package/dest/pxe_http/pxe_http_server.d.ts +16 -0
- package/dest/pxe_http/pxe_http_server.d.ts.map +1 -0
- package/dest/pxe_http/pxe_http_server.js +27 -0
- package/dest/pxe_oracle_interface/index.d.ts +159 -0
- package/dest/pxe_oracle_interface/index.d.ts.map +1 -0
- package/dest/pxe_oracle_interface/index.js +692 -0
- package/dest/pxe_oracle_interface/tagging_utils.d.ts +17 -0
- package/dest/pxe_oracle_interface/tagging_utils.d.ts.map +1 -0
- package/dest/pxe_oracle_interface/tagging_utils.js +23 -0
- package/dest/pxe_service/error_enriching.d.ts +11 -0
- package/dest/pxe_service/error_enriching.d.ts.map +1 -0
- package/dest/pxe_service/error_enriching.js +69 -0
- package/dest/pxe_service/index.d.ts +3 -0
- package/dest/pxe_service/index.d.ts.map +1 -0
- package/dest/pxe_service/index.js +2 -0
- package/dest/pxe_service/pxe_service.d.ts +111 -0
- package/dest/pxe_service/pxe_service.d.ts.map +1 -0
- package/dest/pxe_service/pxe_service.js +664 -0
- package/dest/storage/address_data_provider/address_data_provider.d.ts +13 -0
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -0
- package/dest/storage/address_data_provider/address_data_provider.js +50 -0
- package/dest/storage/address_data_provider/index.d.ts +2 -0
- package/dest/storage/address_data_provider/index.d.ts.map +1 -0
- package/dest/storage/address_data_provider/index.js +1 -0
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +11 -0
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +1 -0
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +20 -0
- package/dest/storage/auth_witness_data_provider/index.d.ts +2 -0
- package/dest/storage/auth_witness_data_provider/index.d.ts.map +1 -0
- package/dest/storage/auth_witness_data_provider/index.js +1 -0
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +16 -0
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -0
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +57 -0
- package/dest/storage/capsule_data_provider/index.d.ts +2 -0
- package/dest/storage/capsule_data_provider/index.d.ts.map +1 -0
- package/dest/storage/capsule_data_provider/index.js +1 -0
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +109 -0
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -0
- package/dest/storage/contract_data_provider/contract_data_provider.js +183 -0
- package/dest/storage/contract_data_provider/index.d.ts +3 -0
- package/dest/storage/contract_data_provider/index.d.ts.map +1 -0
- package/dest/storage/contract_data_provider/index.js +2 -0
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts +66 -0
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/contract_data_provider/private_functions_tree.js +99 -0
- package/dest/storage/data_provider.d.ts +4 -0
- package/dest/storage/data_provider.d.ts.map +1 -0
- package/dest/storage/data_provider.js +1 -0
- package/dest/storage/index.d.ts +10 -0
- package/dest/storage/index.d.ts.map +1 -0
- package/dest/storage/index.js +9 -0
- package/dest/storage/note_data_provider/index.d.ts +3 -0
- package/dest/storage/note_data_provider/index.d.ts.map +1 -0
- package/dest/storage/note_data_provider/index.js +2 -0
- package/dest/storage/note_data_provider/note_dao.d.ts +106 -0
- package/dest/storage/note_data_provider/note_dao.d.ts.map +1 -0
- package/dest/storage/note_data_provider/note_dao.js +106 -0
- package/dest/storage/note_data_provider/note_data_provider.d.ts +20 -0
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -0
- package/dest/storage/note_data_provider/note_data_provider.js +249 -0
- package/dest/storage/sync_data_provider/index.d.ts +2 -0
- package/dest/storage/sync_data_provider/index.d.ts.map +1 -0
- package/dest/storage/sync_data_provider/index.js +1 -0
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +12 -0
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +1 -0
- package/dest/storage/sync_data_provider/sync_data_provider.js +29 -0
- package/dest/storage/tagging_data_provider/index.d.ts +2 -0
- package/dest/storage/tagging_data_provider/index.d.ts.map +1 -0
- package/dest/storage/tagging_data_provider/index.js +1 -0
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +18 -0
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +1 -0
- package/dest/storage/tagging_data_provider/tagging_data_provider.js +65 -0
- package/dest/synchronizer/index.d.ts +2 -0
- package/dest/synchronizer/index.d.ts.map +1 -0
- package/dest/synchronizer/index.js +1 -0
- package/dest/synchronizer/synchronizer.d.ts +37 -0
- package/dest/synchronizer/synchronizer.d.ts.map +1 -0
- package/dest/synchronizer/synchronizer.js +103 -0
- package/dest/test/pxe_test_suite.d.ts +3 -0
- package/dest/test/pxe_test_suite.d.ts.map +1 -0
- package/dest/test/pxe_test_suite.js +97 -0
- package/package.json +105 -0
- package/src/bin/index.ts +38 -0
- package/src/config/index.ts +124 -0
- package/src/config/package_info.ts +3 -0
- package/src/entrypoints/client/bundle/index.ts +5 -0
- package/src/entrypoints/client/bundle/utils.ts +58 -0
- package/src/entrypoints/client/lazy/index.ts +5 -0
- package/src/entrypoints/client/lazy/utils.ts +53 -0
- package/src/entrypoints/client/pxe_creation_options.ts +7 -0
- package/src/entrypoints/server/index.ts +6 -0
- package/src/entrypoints/server/utils.ts +71 -0
- package/src/kernel_oracle/index.ts +117 -0
- package/src/kernel_prover/hints/build_private_kernel_reset_private_inputs.ts +472 -0
- package/src/kernel_prover/hints/index.ts +1 -0
- package/src/kernel_prover/index.ts +2 -0
- package/src/kernel_prover/kernel_prover.ts +351 -0
- package/src/kernel_prover/proving_data_oracle.ts +83 -0
- package/src/note_decryption_utils/add_public_values_to_payload.ts +64 -0
- package/src/pxe_http/index.ts +1 -0
- package/src/pxe_http/pxe_http_server.ts +29 -0
- package/src/pxe_oracle_interface/index.ts +925 -0
- package/src/pxe_oracle_interface/tagging_utils.ts +32 -0
- package/src/pxe_service/error_enriching.ts +106 -0
- package/src/pxe_service/index.ts +2 -0
- package/src/pxe_service/pxe_service.ts +949 -0
- package/src/storage/address_data_provider/address_data_provider.ts +71 -0
- package/src/storage/address_data_provider/index.ts +1 -0
- package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +34 -0
- package/src/storage/auth_witness_data_provider/index.ts +1 -0
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +80 -0
- package/src/storage/capsule_data_provider/index.ts +1 -0
- package/src/storage/contract_data_provider/contract_data_provider.ts +261 -0
- package/src/storage/contract_data_provider/index.ts +2 -0
- package/src/storage/contract_data_provider/private_functions_tree.ts +131 -0
- package/src/storage/data_provider.ts +3 -0
- package/src/storage/index.ts +10 -0
- package/src/storage/note_data_provider/index.ts +2 -0
- package/src/storage/note_data_provider/note_dao.ts +162 -0
- package/src/storage/note_data_provider/note_data_provider.ts +345 -0
- package/src/storage/sync_data_provider/index.ts +1 -0
- package/src/storage/sync_data_provider/sync_data_provider.ts +40 -0
- package/src/storage/tagging_data_provider/index.ts +1 -0
- package/src/storage/tagging_data_provider/tagging_data_provider.ts +92 -0
- package/src/synchronizer/index.ts +1 -0
- package/src/synchronizer/synchronizer.ts +121 -0
- package/src/test/pxe_test_suite.ts +111 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { IndexedTaggingSecret } from '@aztec/stdlib/logs';
|
|
3
|
+
export declare const WINDOW_HALF_SIZE = 10;
|
|
4
|
+
export declare function getIndexedTaggingSecretsForTheWindow(secretsAndWindows: {
|
|
5
|
+
appTaggingSecret: Fr;
|
|
6
|
+
leftMostIndex: number;
|
|
7
|
+
rightMostIndex: number;
|
|
8
|
+
}[]): IndexedTaggingSecret[];
|
|
9
|
+
/**
|
|
10
|
+
* Creates a map from app tagging secret to initial index.
|
|
11
|
+
* @param indexedTaggingSecrets - The indexed tagging secrets to get the initial indexes from.
|
|
12
|
+
* @returns The map from app tagging secret to initial index.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getInitialIndexesMap(indexedTaggingSecrets: IndexedTaggingSecret[]): {
|
|
15
|
+
[k: string]: number;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=tagging_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tagging_utils.d.ts","sourceRoot":"","sources":["../../src/pxe_oracle_interface/tagging_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG1D,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,wBAAgB,oCAAoC,CAClD,iBAAiB,EAAE;IAAE,gBAAgB,EAAE,EAAE,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,EAAE,GAC3F,oBAAoB,EAAE,CAQxB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,qBAAqB,EAAE,oBAAoB,EAAE,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAQ3G"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IndexedTaggingSecret } from '@aztec/stdlib/logs';
|
|
2
|
+
// Half the size of the window we slide over the tagging secret indexes.
|
|
3
|
+
export const WINDOW_HALF_SIZE = 10;
|
|
4
|
+
export function getIndexedTaggingSecretsForTheWindow(secretsAndWindows) {
|
|
5
|
+
const secrets = [];
|
|
6
|
+
for (const secretAndWindow of secretsAndWindows){
|
|
7
|
+
for(let i = secretAndWindow.leftMostIndex; i <= secretAndWindow.rightMostIndex; i++){
|
|
8
|
+
secrets.push(new IndexedTaggingSecret(secretAndWindow.appTaggingSecret, i));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return secrets;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a map from app tagging secret to initial index.
|
|
15
|
+
* @param indexedTaggingSecrets - The indexed tagging secrets to get the initial indexes from.
|
|
16
|
+
* @returns The map from app tagging secret to initial index.
|
|
17
|
+
*/ export function getInitialIndexesMap(indexedTaggingSecrets) {
|
|
18
|
+
const initialIndexes = {};
|
|
19
|
+
for (const indexedTaggingSecret of indexedTaggingSecrets){
|
|
20
|
+
initialIndexes[indexedTaggingSecret.appTaggingSecret.toString()] = indexedTaggingSecret.index;
|
|
21
|
+
}
|
|
22
|
+
return initialIndexes;
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
+
import { type SimulationError } from '@aztec/stdlib/errors';
|
|
3
|
+
import type { ContractDataProvider } from '../storage/contract_data_provider/contract_data_provider.js';
|
|
4
|
+
/**
|
|
5
|
+
* Adds contract and function names to a simulation error, if they
|
|
6
|
+
* can be found in the PXE database
|
|
7
|
+
* @param err - The error to enrich.
|
|
8
|
+
*/
|
|
9
|
+
export declare function enrichSimulationError(err: SimulationError, contractDataProvider: ContractDataProvider, logger: Logger): Promise<void>;
|
|
10
|
+
export declare function enrichPublicSimulationError(err: SimulationError, contractDataProvider: ContractDataProvider, logger: Logger): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=error_enriching.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error_enriching.d.ts","sourceRoot":"","sources":["../../src/pxe_service/error_enriching.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAIpD,OAAO,EAAE,KAAK,eAAe,EAA6B,MAAM,sBAAsB,CAAC;AAEvF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AAExG;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,eAAe,EACpB,oBAAoB,EAAE,oBAAoB,EAC1C,MAAM,EAAE,MAAM,iBAyCf;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,eAAe,EACpB,oBAAoB,EAAE,oBAAoB,EAC1C,MAAM,EAAE,MAAM,iBAyCf"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { PUBLIC_DISPATCH_SELECTOR } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { resolveAssertionMessageFromRevertData, resolveOpcodeLocations } from '@aztec/simulator/client';
|
|
4
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
5
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
+
import { isNoirCallStackUnresolved } from '@aztec/stdlib/errors';
|
|
7
|
+
/**
|
|
8
|
+
* Adds contract and function names to a simulation error, if they
|
|
9
|
+
* can be found in the PXE database
|
|
10
|
+
* @param err - The error to enrich.
|
|
11
|
+
*/ export async function enrichSimulationError(err, contractDataProvider, logger) {
|
|
12
|
+
// Maps contract addresses to the set of function names that were in error.
|
|
13
|
+
// Map and Set do reference equality for their keys instead of value equality, so we store the string
|
|
14
|
+
// representation to get e.g. different contract address objects with the same address value to match.
|
|
15
|
+
const mentionedFunctions = new Map();
|
|
16
|
+
err.getCallStack().forEach(({ contractAddress, functionName })=>{
|
|
17
|
+
if (!mentionedFunctions.has(contractAddress.toString())) {
|
|
18
|
+
mentionedFunctions.set(contractAddress.toString(), new Set());
|
|
19
|
+
}
|
|
20
|
+
mentionedFunctions.get(contractAddress.toString()).add(functionName?.toString() ?? '');
|
|
21
|
+
});
|
|
22
|
+
await Promise.all([
|
|
23
|
+
...mentionedFunctions.entries()
|
|
24
|
+
].map(async ([contractAddress, fnNames])=>{
|
|
25
|
+
const parsedContractAddress = AztecAddress.fromString(contractAddress);
|
|
26
|
+
const contract = await contractDataProvider.getContract(parsedContractAddress);
|
|
27
|
+
if (contract) {
|
|
28
|
+
err.enrichWithContractName(parsedContractAddress, contract.name);
|
|
29
|
+
for (const fnName of fnNames){
|
|
30
|
+
const functionArtifact = contract.functions.find((f)=>fnName === f.name);
|
|
31
|
+
if (functionArtifact) {
|
|
32
|
+
err.enrichWithFunctionName(parsedContractAddress, await FunctionSelector.fromNameAndParameters(functionArtifact), functionArtifact.name);
|
|
33
|
+
} else {
|
|
34
|
+
logger.warn(`Could not find function artifact in contract ${contract.name} for function '${fnName}' when enriching error callstack`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
logger.warn(`Could not find contract in database for address: ${parsedContractAddress} when enriching error callstack`);
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
export async function enrichPublicSimulationError(err, contractDataProvider, logger) {
|
|
43
|
+
const callStack = err.getCallStack();
|
|
44
|
+
const originalFailingFunction = callStack[callStack.length - 1];
|
|
45
|
+
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/8985): Properly fix this.
|
|
46
|
+
// To be able to resolve the assertion message, we need to use the information from the public dispatch function,
|
|
47
|
+
// no matter what the call stack selector points to (since we've modified it to point to the target function).
|
|
48
|
+
// We should remove this because the AVM (or public protocol) shouldn't be aware of the public dispatch calling convention.
|
|
49
|
+
const artifact = await contractDataProvider.getFunctionArtifact(originalFailingFunction.contractAddress, FunctionSelector.fromField(new Fr(PUBLIC_DISPATCH_SELECTOR)));
|
|
50
|
+
const assertionMessage = resolveAssertionMessageFromRevertData(err.revertData, artifact);
|
|
51
|
+
if (assertionMessage) {
|
|
52
|
+
err.setOriginalMessage(err.getOriginalMessage() + `${assertionMessage}`);
|
|
53
|
+
}
|
|
54
|
+
const debugInfo = await contractDataProvider.getFunctionDebugMetadata(originalFailingFunction.contractAddress, FunctionSelector.fromField(new Fr(PUBLIC_DISPATCH_SELECTOR)));
|
|
55
|
+
const noirCallStack = err.getNoirCallStack();
|
|
56
|
+
if (debugInfo) {
|
|
57
|
+
if (isNoirCallStackUnresolved(noirCallStack)) {
|
|
58
|
+
try {
|
|
59
|
+
// Public functions are simulated as a single Brillig entry point.
|
|
60
|
+
// Thus, we can safely assume here that the Brillig function id is `0`.
|
|
61
|
+
const parsedCallStack = resolveOpcodeLocations(noirCallStack, debugInfo, 0);
|
|
62
|
+
err.setNoirCallStack(parsedCallStack);
|
|
63
|
+
} catch (err) {
|
|
64
|
+
logger.warn(`Could not resolve noir call stack for ${originalFailingFunction.contractAddress.toString()}:${originalFailingFunction.functionName?.toString() ?? ''}: ${err}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
await enrichSimulationError(err, contractDataProvider, logger);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pxe_service/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import { Fr, type Point } from '@aztec/foundation/fields';
|
|
3
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
4
|
+
import type { SiblingPath } from '@aztec/foundation/trees';
|
|
5
|
+
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
6
|
+
import { type ProtocolContractsProvider } from '@aztec/protocol-contracts';
|
|
7
|
+
import { type SimulationProvider } from '@aztec/simulator/client';
|
|
8
|
+
import { type AbiDecoded, type ContractArtifact } from '@aztec/stdlib/abi';
|
|
9
|
+
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
10
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
|
+
import type { InBlock, L2Block } from '@aztec/stdlib/block';
|
|
12
|
+
import { CompleteAddress, type ContractClassWithId, type ContractInstanceWithAddress, type NodeInfo, type PartialAddress } from '@aztec/stdlib/contract';
|
|
13
|
+
import type { GasFees } from '@aztec/stdlib/gas';
|
|
14
|
+
import type { AztecNode, EventMetadataDefinition, GetContractClassLogsResponse, GetPublicLogsResponse, PXE, PXEInfo, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
15
|
+
import type { LogFilter } from '@aztec/stdlib/logs';
|
|
16
|
+
import { type NotesFilter, UniqueNote } from '@aztec/stdlib/note';
|
|
17
|
+
import { PrivateExecutionResult, type Tx, type TxEffect, type TxExecutionRequest, type TxHash, TxProvingResult, type TxReceipt, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
18
|
+
import type { PXEServiceConfig } from '../config/index.js';
|
|
19
|
+
/**
|
|
20
|
+
* A Private eXecution Environment (PXE) implementation.
|
|
21
|
+
*/
|
|
22
|
+
export declare class PXEService implements PXE {
|
|
23
|
+
#private;
|
|
24
|
+
private node;
|
|
25
|
+
private synchronizer;
|
|
26
|
+
private keyStore;
|
|
27
|
+
private contractDataProvider;
|
|
28
|
+
private noteDataProvider;
|
|
29
|
+
private capsuleDataProvider;
|
|
30
|
+
private syncDataProvider;
|
|
31
|
+
private taggingDataProvider;
|
|
32
|
+
private addressDataProvider;
|
|
33
|
+
private authWitnessDataProvider;
|
|
34
|
+
private simulator;
|
|
35
|
+
private packageVersion;
|
|
36
|
+
private proverEnabled;
|
|
37
|
+
private proofCreator;
|
|
38
|
+
private protocolContractsProvider;
|
|
39
|
+
private log;
|
|
40
|
+
private constructor();
|
|
41
|
+
/**
|
|
42
|
+
* Creates an instance of a PXE Service by instantiating all the necessary data providers and services.
|
|
43
|
+
* Also triggers the registration of the protocol contracts and makes sure the provided node
|
|
44
|
+
* can be contacted.
|
|
45
|
+
*
|
|
46
|
+
* @returns A promise that resolves PXE service is ready to be used.
|
|
47
|
+
*/
|
|
48
|
+
static create(node: AztecNode, store: AztecAsyncKVStore, proofCreator: PrivateKernelProver, simulationProvider: SimulationProvider, protocolContractsProvider: ProtocolContractsProvider, config: PXEServiceConfig, loggerOrSuffix?: string | Logger): Promise<PXEService>;
|
|
49
|
+
isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean>;
|
|
50
|
+
/** Returns an estimate of the db size in bytes. */
|
|
51
|
+
estimateDbSize(): Promise<number>;
|
|
52
|
+
addAuthWitness(witness: AuthWitness): Promise<void>;
|
|
53
|
+
getAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
|
|
54
|
+
storeCapsule(contract: AztecAddress, storageSlot: Fr, capsule: Fr[]): Promise<void>;
|
|
55
|
+
getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
56
|
+
getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<{
|
|
57
|
+
contractClass: ContractClassWithId | undefined;
|
|
58
|
+
isContractClassPubliclyRegistered: boolean;
|
|
59
|
+
artifact: ContractArtifact | undefined;
|
|
60
|
+
}>;
|
|
61
|
+
getContractMetadata(address: AztecAddress): Promise<{
|
|
62
|
+
contractInstance: ContractInstanceWithAddress | undefined;
|
|
63
|
+
isContractInitialized: boolean;
|
|
64
|
+
isContractPubliclyDeployed: boolean;
|
|
65
|
+
}>;
|
|
66
|
+
registerAccount(secretKey: Fr, partialAddress: PartialAddress): Promise<CompleteAddress>;
|
|
67
|
+
registerSender(address: AztecAddress): Promise<AztecAddress>;
|
|
68
|
+
getSenders(): Promise<AztecAddress[]>;
|
|
69
|
+
removeSender(address: AztecAddress): Promise<void>;
|
|
70
|
+
getRegisteredAccounts(): Promise<CompleteAddress[]>;
|
|
71
|
+
registerContractClass(artifact: ContractArtifact): Promise<void>;
|
|
72
|
+
registerContract(contract: {
|
|
73
|
+
instance: ContractInstanceWithAddress;
|
|
74
|
+
artifact?: ContractArtifact;
|
|
75
|
+
}): Promise<void>;
|
|
76
|
+
updateContract(contractAddress: AztecAddress, artifact: ContractArtifact): Promise<void>;
|
|
77
|
+
getContracts(): Promise<AztecAddress[]>;
|
|
78
|
+
getPublicStorageAt(contract: AztecAddress, slot: Fr): Promise<Fr>;
|
|
79
|
+
getNotes(filter: NotesFilter): Promise<UniqueNote[]>;
|
|
80
|
+
getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]>;
|
|
81
|
+
getL2ToL1MembershipWitness(blockNumber: number, l2Tol1Message: Fr): Promise<[bigint, SiblingPath<number>]>;
|
|
82
|
+
getBlock(blockNumber: number): Promise<L2Block | undefined>;
|
|
83
|
+
getCurrentBaseFees(): Promise<GasFees>;
|
|
84
|
+
proveTx(txRequest: TxExecutionRequest, privateExecutionResult: PrivateExecutionResult): Promise<TxProvingResult>;
|
|
85
|
+
simulateTx(txRequest: TxExecutionRequest, simulatePublic: boolean, msgSender?: AztecAddress | undefined, skipTxValidation?: boolean, skipFeeEnforcement?: boolean, profile?: boolean, scopes?: AztecAddress[]): Promise<TxSimulationResult>;
|
|
86
|
+
sendTx(tx: Tx): Promise<TxHash>;
|
|
87
|
+
simulateUnconstrained(functionName: string, args: any[], to: AztecAddress, _from?: AztecAddress, scopes?: AztecAddress[]): Promise<AbiDecoded>;
|
|
88
|
+
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
|
|
89
|
+
getTxEffect(txHash: TxHash): Promise<InBlock<TxEffect> | undefined>;
|
|
90
|
+
getBlockNumber(): Promise<number>;
|
|
91
|
+
getProvenBlockNumber(): Promise<number>;
|
|
92
|
+
/**
|
|
93
|
+
* Gets public logs based on the provided filter.
|
|
94
|
+
* @param filter - The filter to apply to the logs.
|
|
95
|
+
* @returns The requested logs.
|
|
96
|
+
*/
|
|
97
|
+
getPublicLogs(filter: LogFilter): Promise<GetPublicLogsResponse>;
|
|
98
|
+
/**
|
|
99
|
+
* Gets contract class logs based on the provided filter.
|
|
100
|
+
* @param filter - The filter to apply to the logs.
|
|
101
|
+
* @returns The requested logs.
|
|
102
|
+
*/
|
|
103
|
+
getContractClassLogs(filter: LogFilter): Promise<GetContractClassLogsResponse>;
|
|
104
|
+
getNodeInfo(): Promise<NodeInfo>;
|
|
105
|
+
getPXEInfo(): Promise<PXEInfo>;
|
|
106
|
+
getPrivateEvents<T>(eventMetadataDef: EventMetadataDefinition, from: number, limit: number, vpks: Point[]): Promise<T[]>;
|
|
107
|
+
getPublicEvents<T>(eventMetadataDef: EventMetadataDefinition, from: number, limit: number): Promise<T[]>;
|
|
108
|
+
resetNoteSyncData(): Promise<void>;
|
|
109
|
+
private contextualizeError;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=pxe_service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pxe_service.d.ts","sourceRoot":"","sources":["../../src/pxe_service/pxe_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,KAAK,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAA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