@aztec/pxe 0.0.1-commit.43c09e3f → 0.0.1-commit.4d79d1f2d
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/contract_function_simulator/contract_function_simulator.d.ts +49 -27
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +65 -31
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +3 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +34 -36
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +71 -18
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +31 -11
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +58 -29
- package/dest/contract_sync/contract_sync_service.d.ts +3 -2
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +32 -17
- package/dest/debug/pxe_debug_utils.d.ts +2 -4
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +1 -4
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +9 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +9 -1
- package/dest/entrypoints/server/utils.js +9 -1
- package/dest/logs/log_service.d.ts +1 -1
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +4 -9
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/pxe.d.ts +67 -23
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +49 -34
- package/dest/storage/contract_store/contract_store.js +5 -5
- package/dest/storage/note_store/note_store.d.ts +1 -2
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +4 -2
- package/package.json +16 -16
- package/src/contract_function_simulator/contract_function_simulator.ts +109 -74
- package/src/contract_function_simulator/oracle/interfaces.ts +1 -1
- package/src/contract_function_simulator/oracle/oracle.ts +3 -3
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +91 -93
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +99 -28
- package/src/contract_sync/contract_sync_service.ts +41 -25
- package/src/debug/pxe_debug_utils.ts +4 -8
- package/src/entrypoints/client/bundle/utils.ts +9 -1
- package/src/entrypoints/client/lazy/utils.ts +9 -1
- package/src/entrypoints/server/utils.ts +7 -7
- package/src/logs/log_service.ts +4 -13
- package/src/oracle_version.ts +2 -2
- package/src/pxe.ts +113 -71
- package/src/storage/contract_store/contract_store.ts +4 -4
- package/src/storage/note_store/note_store.ts +5 -2
|
@@ -46,6 +46,14 @@ import { PXE_DATA_SCHEMA_VERSION } from '../../../storage/metadata.js';
|
|
|
46
46
|
const pxeLogger = loggers.pxe ?? createLogger('pxe:service', {
|
|
47
47
|
actor
|
|
48
48
|
});
|
|
49
|
-
const pxe = await PXE.create(
|
|
49
|
+
const pxe = await PXE.create({
|
|
50
|
+
node: aztecNode,
|
|
51
|
+
store,
|
|
52
|
+
proofCreator: prover,
|
|
53
|
+
simulator,
|
|
54
|
+
protocolContractsProvider,
|
|
55
|
+
config,
|
|
56
|
+
loggerOrSuffix: pxeLogger
|
|
57
|
+
});
|
|
50
58
|
return pxe;
|
|
51
59
|
}
|
|
@@ -12,4 +12,4 @@ import type { PXECreationOptions } from '../../pxe_creation_options.js';
|
|
|
12
12
|
* @returns A Promise that resolves to the started PXE instance.
|
|
13
13
|
*/
|
|
14
14
|
export declare function createPXE(aztecNode: AztecNode, config: PXEConfig, options?: PXECreationOptions): Promise<PXE>;
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9jbGllbnQvbGF6eS91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUMxRCxPQUFPLEVBQUUsR0FBRyxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFFdEMsT0FBTyxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUV4RTs7Ozs7Ozs7R0FRRztBQUNILHdCQUFzQixTQUFTLENBQzdCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLE1BQU0sRUFBRSxTQUFTLEVBQ2pCLE9BQU8sR0FBRSxrQkFBb0MsZ0JBdUM5QyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/lazy/utils.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExE;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,SAAS,EACjB,OAAO,GAAE,kBAAoC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/lazy/utils.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExE;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,SAAS,EACjB,OAAO,GAAE,kBAAoC,gBAuC9C"}
|
|
@@ -45,6 +45,14 @@ import { PXE_DATA_SCHEMA_VERSION } from '../../../storage/metadata.js';
|
|
|
45
45
|
const pxeLogger = loggers.pxe ?? createLogger('pxe:service', {
|
|
46
46
|
actor
|
|
47
47
|
});
|
|
48
|
-
const pxe = await PXE.create(
|
|
48
|
+
const pxe = await PXE.create({
|
|
49
|
+
node: aztecNode,
|
|
50
|
+
store,
|
|
51
|
+
proofCreator: prover,
|
|
52
|
+
simulator,
|
|
53
|
+
protocolContractsProvider,
|
|
54
|
+
config,
|
|
55
|
+
loggerOrSuffix: pxeLogger
|
|
56
|
+
});
|
|
49
57
|
return pxe;
|
|
50
58
|
}
|
|
@@ -50,6 +50,14 @@ export async function createPXE(aztecNode, config, options = {
|
|
|
50
50
|
const pxeLogger = loggers.pxe ?? createLogger('pxe:service', {
|
|
51
51
|
actor
|
|
52
52
|
});
|
|
53
|
-
const pxe = await PXE.create(
|
|
53
|
+
const pxe = await PXE.create({
|
|
54
|
+
node: aztecNode,
|
|
55
|
+
store: options.store,
|
|
56
|
+
proofCreator: prover,
|
|
57
|
+
simulator,
|
|
58
|
+
protocolContractsProvider,
|
|
59
|
+
config: configWithContracts,
|
|
60
|
+
loggerOrSuffix: pxeLogger
|
|
61
|
+
});
|
|
54
62
|
return pxe;
|
|
55
63
|
}
|
|
@@ -25,4 +25,4 @@ export declare class LogService {
|
|
|
25
25
|
bulkRetrieveLogs(logRetrievalRequests: LogRetrievalRequest[]): Promise<(LogRetrievalResponse | null)[]>;
|
|
26
26
|
fetchTaggedLogs(contractAddress: AztecAddress, pendingTaggedLogArrayBaseSlot: Fr, scopes?: AztecAddress[]): Promise<void>;
|
|
27
27
|
}
|
|
28
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nX3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2dzL2xvZ19zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3pELE9BQU8sRUFBZSxLQUFLLGNBQWMsRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUN2RixPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNqRCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDM0QsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFakUsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSxzRUFBc0UsQ0FBQztBQUNoSCxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBT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vQixHQUFHLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FpQm5IO0lBdURZLGVBQWUsQ0FDMUIsZUFBZSxFQUFFLFlBQVksRUFDN0IsNkJBQTZCLEVBQUUsRUFBRSxFQUNqQyxNQUFNLENBQUMsRUFBRSxZQUFZLEVBQUUsaUJBMEN4QjtDQXdERiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log_service.d.ts","sourceRoot":"","sources":["../../src/logs/log_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAe,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AACvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"log_service.d.ts","sourceRoot":"","sources":["../../src/logs/log_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAe,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AACvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sEAAsE,CAAC;AAChH,OAAO,EAAE,oBAAoB,EAAE,MAAM,uEAAuE,CAAC;AAC7G,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAOpG,qBAAa,UAAU;;IAInB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK;IAVxB,OAAO,CAAC,GAAG,CAAS;IAEpB,YACmB,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,WAAW,EAC9B,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,qBAAqB,EAAE,qBAAqB,EAC5C,sBAAsB,EAAE,sBAAsB,EAC9C,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,EAC9B,QAAQ,CAAC,EAAE,cAAc,EAG1B;IAEY,gBAAgB,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,CAAC,oBAAoB,GAAG,IAAI,CAAC,EAAE,CAAC,CAiBnH;IAuDY,eAAe,CAC1B,eAAe,EAAE,YAAY,EAC7B,6BAA6B,EAAE,EAAE,EACjC,MAAM,CAAC,EAAE,YAAY,EAAE,iBA0CxB;CAwDF"}
|
package/dest/logs/log_service.js
CHANGED
|
@@ -89,7 +89,10 @@ export class LogService {
|
|
|
89
89
|
}));
|
|
90
90
|
}
|
|
91
91
|
async #getSecretsForSenders(contractAddress, recipient) {
|
|
92
|
-
const recipientCompleteAddress = await this
|
|
92
|
+
const recipientCompleteAddress = await this.addressStore.getCompleteAddress(recipient);
|
|
93
|
+
if (!recipientCompleteAddress) {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
93
96
|
const recipientIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(recipient);
|
|
94
97
|
// We implicitly add all PXE accounts as senders, this helps us decrypt tags on notes that we send to ourselves
|
|
95
98
|
// (recipient = us, sender = us)
|
|
@@ -112,12 +115,4 @@ export class LogService {
|
|
|
112
115
|
// TODO: This looks like it could belong more at the oracle interface level
|
|
113
116
|
return this.capsuleStore.appendToCapsuleArray(contractAddress, capsuleArrayBaseSlot, pendingTaggedLogs, this.jobId);
|
|
114
117
|
}
|
|
115
|
-
async #getCompleteAddress(account) {
|
|
116
|
-
const completeAddress = await this.addressStore.getCompleteAddress(account);
|
|
117
|
-
if (!completeAddress) {
|
|
118
|
-
throw new Error(`No public key registered for address ${account}.
|
|
119
|
-
Register it by calling pxe.addAccount(...).\nSee docs for context: https://docs.aztec.network/developers/resources/debugging/aztecnr-errors#simulation-error-no-public-key-registered-for-address-0x0-register-it-by-calling-pxeregisterrecipient-or-pxeregisteraccount`);
|
|
120
|
-
}
|
|
121
|
-
return completeAddress;
|
|
122
|
-
}
|
|
123
118
|
}
|
package/dest/oracle_version.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const ORACLE_VERSION =
|
|
2
|
-
export declare const ORACLE_INTERFACE_HASH = "
|
|
1
|
+
export declare const ORACLE_VERSION = 12;
|
|
2
|
+
export declare const ORACLE_INTERFACE_HASH = "666a8a7fc697f72b29dbf0ae7464db269cf5afa019acac8861f814543147dbb4";
|
|
3
3
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3JhY2xlX3ZlcnNpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9vcmFjbGVfdmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNQSxlQUFPLE1BQU0sY0FBYyxLQUFLLENBQUM7QUFLakMsZUFBTyxNQUFNLHFCQUFxQixxRUFBcUUsQ0FBQyJ9
|
package/dest/oracle_version.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
///
|
|
5
5
|
/// @dev Whenever a contract function or Noir test is run, the `utilityAssertCompatibleOracleVersion` oracle is called
|
|
6
6
|
/// and if the oracle version is incompatible an error is thrown.
|
|
7
|
-
export const ORACLE_VERSION =
|
|
7
|
+
export const ORACLE_VERSION = 12;
|
|
8
8
|
/// This hash is computed as by hashing the Oracle interface and it is used to detect when the Oracle interface changes,
|
|
9
9
|
/// which in turn implies that you need to update the ORACLE_VERSION constant in this file and in
|
|
10
10
|
/// `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
|
|
11
|
-
export const ORACLE_INTERFACE_HASH = '
|
|
11
|
+
export const ORACLE_INTERFACE_HASH = '666a8a7fc697f72b29dbf0ae7464db269cf5afa019acac8861f814543147dbb4';
|
package/dest/pxe.d.ts
CHANGED
|
@@ -9,13 +9,59 @@ import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
|
9
9
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
10
|
import { CompleteAddress, type ContractInstanceWithAddress, type PartialAddress } from '@aztec/stdlib/contract';
|
|
11
11
|
import type { AztecNode, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
12
|
-
import { type InTx, SimulationOverrides, TxExecutionRequest, TxProfileResult, TxProvingResult, TxSimulationResult, UtilitySimulationResult } from '@aztec/stdlib/tx';
|
|
12
|
+
import { BlockHeader, type InTx, SimulationOverrides, TxExecutionRequest, TxProfileResult, TxProvingResult, TxSimulationResult, UtilitySimulationResult } from '@aztec/stdlib/tx';
|
|
13
13
|
import type { PXEConfig } from './config/index.js';
|
|
14
14
|
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
15
15
|
export type PackedPrivateEvent = InTx & {
|
|
16
16
|
packedEvent: Fr[];
|
|
17
17
|
eventSelector: EventSelector;
|
|
18
18
|
};
|
|
19
|
+
/** Options for PXE.profileTx. */
|
|
20
|
+
export type ProfileTxOpts = {
|
|
21
|
+
/** The profiling mode to use. */
|
|
22
|
+
profileMode: 'full' | 'execution-steps' | 'gates';
|
|
23
|
+
/** If true, proof generation is skipped during profiling. Defaults to true. */
|
|
24
|
+
skipProofGeneration?: boolean;
|
|
25
|
+
/** Addresses whose private state and keys are accessible during private execution. */
|
|
26
|
+
scopes?: AztecAddress[];
|
|
27
|
+
};
|
|
28
|
+
/** Options for PXE.simulateTx. */
|
|
29
|
+
export type SimulateTxOpts = {
|
|
30
|
+
/** Whether to simulate the public part of the transaction. */
|
|
31
|
+
simulatePublic: boolean;
|
|
32
|
+
/** If false, this function throws if the transaction is unable to be included in a block at the current state. */
|
|
33
|
+
skipTxValidation?: boolean;
|
|
34
|
+
/** If false, fees are enforced. */
|
|
35
|
+
skipFeeEnforcement?: boolean;
|
|
36
|
+
/** State overrides for the simulation, such as contract instances and artifacts. */
|
|
37
|
+
overrides?: SimulationOverrides;
|
|
38
|
+
/** Addresses whose private state and keys are accessible during private execution. Defaults to all. */
|
|
39
|
+
scopes?: AztecAddress[];
|
|
40
|
+
};
|
|
41
|
+
/** Options for PXE.simulateUtility. */
|
|
42
|
+
export type SimulateUtilityOpts = {
|
|
43
|
+
/** The authentication witnesses required for the function call. */
|
|
44
|
+
authwits?: AuthWitness[];
|
|
45
|
+
/** The accounts whose notes we can access in this call. Defaults to all. */
|
|
46
|
+
scopes?: AztecAddress[];
|
|
47
|
+
};
|
|
48
|
+
/** Args for PXE.create. */
|
|
49
|
+
export type PXECreateArgs = {
|
|
50
|
+
/** The Aztec node to connect to. */
|
|
51
|
+
node: AztecNode;
|
|
52
|
+
/** The key-value store for persisting PXE state. */
|
|
53
|
+
store: AztecAsyncKVStore;
|
|
54
|
+
/** The prover for generating private kernel proofs. */
|
|
55
|
+
proofCreator: PrivateKernelProver;
|
|
56
|
+
/** The circuit simulator for executing ACIR circuits. */
|
|
57
|
+
simulator: CircuitSimulator;
|
|
58
|
+
/** Provider for protocol contract artifacts and instances. */
|
|
59
|
+
protocolContractsProvider: ProtocolContractsProvider;
|
|
60
|
+
/** PXE configuration options. */
|
|
61
|
+
config: PXEConfig;
|
|
62
|
+
/** Optional logger instance or string suffix for the logger name. */
|
|
63
|
+
loggerOrSuffix?: string | Logger;
|
|
64
|
+
};
|
|
19
65
|
/**
|
|
20
66
|
* Private eXecution Environment (PXE) is a library used by wallets to simulate private phase of transactions and to
|
|
21
67
|
* manage private state of users.
|
|
@@ -51,7 +97,17 @@ export declare class PXE {
|
|
|
51
97
|
*
|
|
52
98
|
* @returns A promise that resolves PXE is ready to be used.
|
|
53
99
|
*/
|
|
54
|
-
static create(node
|
|
100
|
+
static create({ node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix }: PXECreateArgs): Promise<PXE>;
|
|
101
|
+
/**
|
|
102
|
+
* Returns the block header up to which the PXE has synced.
|
|
103
|
+
* @returns The synced block header
|
|
104
|
+
*/
|
|
105
|
+
getSyncedBlockHeader(): Promise<BlockHeader>;
|
|
106
|
+
/**
|
|
107
|
+
* Returns the contract instance for a given address, if it's registered in the PXE.
|
|
108
|
+
* @param address - The contract address.
|
|
109
|
+
* @returns The contract instance if found, undefined otherwise.
|
|
110
|
+
*/
|
|
55
111
|
getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
56
112
|
/**
|
|
57
113
|
* Returns the contract artifact for a given contract class id, if it's registered in the PXE.
|
|
@@ -134,21 +190,19 @@ export declare class PXE {
|
|
|
134
190
|
* (where validators prove the public portion).
|
|
135
191
|
*
|
|
136
192
|
* @param txRequest - An authenticated tx request ready for proving
|
|
193
|
+
* @param scopes - Addresses whose private state and keys are accessible during private execution.
|
|
137
194
|
* @returns A result containing the proof and public inputs of the tail circuit.
|
|
138
195
|
* @throws If contract code not found, or public simulation reverts.
|
|
139
196
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
140
197
|
*/
|
|
141
|
-
proveTx(txRequest: TxExecutionRequest): Promise<TxProvingResult>;
|
|
198
|
+
proveTx(txRequest: TxExecutionRequest, scopes: AztecAddress[]): Promise<TxProvingResult>;
|
|
142
199
|
/**
|
|
143
200
|
* Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
|
|
144
|
-
*
|
|
145
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
146
|
-
* @param msgSender - (Optional) The message sender to use for the simulation.
|
|
147
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
201
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
148
202
|
* @returns A trace of the program execution with gate counts.
|
|
149
203
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
150
204
|
*/
|
|
151
|
-
profileTx(txRequest: TxExecutionRequest, profileMode
|
|
205
|
+
profileTx(txRequest: TxExecutionRequest, { profileMode, skipProofGeneration, scopes }: ProfileTxOpts): Promise<TxProfileResult>;
|
|
152
206
|
/**
|
|
153
207
|
* Simulates a transaction based on the provided preauthenticated execution request.
|
|
154
208
|
* This will run a local simulation of private execution (and optionally of public as well), run the
|
|
@@ -160,29 +214,19 @@ export declare class PXE {
|
|
|
160
214
|
* In that case, the transaction returned is only potentially ready to be sent to the network for execution.
|
|
161
215
|
*
|
|
162
216
|
*
|
|
163
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
164
|
-
* @param simulatePublic - Whether to simulate the public part of the transaction.
|
|
165
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
166
|
-
* @param skipFeeEnforcement - (Optional) If false, fees are enforced.
|
|
167
|
-
* @param overrides - (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts.
|
|
168
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
217
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
169
218
|
* @returns A simulated transaction result object that includes public and private return values.
|
|
170
219
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
171
220
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
172
221
|
*
|
|
173
222
|
* TODO(#7456) Prevent msgSender being defined here for the first call
|
|
174
223
|
*/
|
|
175
|
-
simulateTx(txRequest: TxExecutionRequest, simulatePublic
|
|
224
|
+
simulateTx(txRequest: TxExecutionRequest, { simulatePublic, skipTxValidation, skipFeeEnforcement, overrides, scopes }: SimulateTxOpts): Promise<TxSimulationResult>;
|
|
176
225
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
226
|
+
* Simulates the execution of a contract utility function.
|
|
179
227
|
* @param call - The function call containing the function details, arguments, and target contract address.
|
|
180
|
-
* @param authwits - (Optional) The authentication witnesses required for the function call.
|
|
181
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will
|
|
182
|
-
* default to all.
|
|
183
|
-
* @returns The result of the utility function call, structured based on the function ABI.
|
|
184
228
|
*/
|
|
185
|
-
simulateUtility(call: FunctionCall, authwits
|
|
229
|
+
simulateUtility(call: FunctionCall, { authwits, scopes }?: SimulateUtilityOpts): Promise<UtilitySimulationResult>;
|
|
186
230
|
/**
|
|
187
231
|
* Returns the private events given search parameters.
|
|
188
232
|
* @param eventSelector - Event selector to search for.
|
|
@@ -202,4 +246,4 @@ export declare class PXE {
|
|
|
202
246
|
*/
|
|
203
247
|
stop(): Promise<void>;
|
|
204
248
|
}
|
|
205
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
249
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHhlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcHhlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFakUsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sRUFBRSxLQUFLLE1BQ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0FBQyxDQXdEbEM7SUFFRDs7Ozs7Ozs7Ozs7O09BWUc7SUFDVSxnQkFBZ0IsQ0FDM0IsYUFBYSxFQUFFLGFBQWEsRUFDNUIsTUFBTSxFQUFFLGtCQUFrQixHQUN6QixPQUFPLENBQUMsa0JBQWtCLEVBQUUsQ0FBQyxDQThCL0I7SUFFRDs7T0FFRztJQUNJLElBQUksSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLENBRTNCO0NBQ0YifQ==
|
package/dest/pxe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pxe.d.ts","sourceRoot":"","sources":["../src/pxe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,KAAK,MAAM,EAAqC,MAAM,uBAAuB,CAAC;AAIvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,KAAK,yBAAyB,EAAyB,MAAM,2BAA2B,CAAC;AAClG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,KAAK,gBAAgB,EACrB,aAAa,EACb,YAAY,EAGb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,eAAe,EACf,KAAK,2BAA2B,EAChC,KAAK,cAAc,EAGpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAMtF,OAAO,
|
|
1
|
+
{"version":3,"file":"pxe.d.ts","sourceRoot":"","sources":["../src/pxe.ts"],"names":[],"mappings":"AAAA,OAAO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@@ -84,11 +84,12 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
84
84
|
* can be contacted.
|
|
85
85
|
*
|
|
86
86
|
* @returns A promise that resolves PXE is ready to be used.
|
|
87
|
-
*/ static async create(node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix) {
|
|
87
|
+
*/ static async create({ node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix }) {
|
|
88
88
|
// Extract bindings from the logger, or use empty bindings if a string suffix is provided.
|
|
89
89
|
const bindings = loggerOrSuffix && typeof loggerOrSuffix !== 'string' ? loggerOrSuffix.getBindings() : undefined;
|
|
90
90
|
const log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:service:${loggerOrSuffix}` : `pxe:service`) : loggerOrSuffix;
|
|
91
|
-
const
|
|
91
|
+
const info = await node.getNodeInfo();
|
|
92
|
+
const proverEnabled = config.proverEnabled !== undefined ? config.proverEnabled : info.realProofs;
|
|
92
93
|
const addressStore = new AddressStore(store);
|
|
93
94
|
const privateEventStore = new PrivateEventStore(store);
|
|
94
95
|
const contractStore = new ContractStore(store);
|
|
@@ -117,14 +118,26 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
117
118
|
debugUtils.setPXEHelpers(pxe.#putInJobQueue.bind(pxe), pxe.#getSimulatorForTx.bind(pxe), pxe.#simulateUtility.bind(pxe));
|
|
118
119
|
pxe.jobQueue.start();
|
|
119
120
|
await pxe.#registerProtocolContracts();
|
|
120
|
-
const info = await node.getNodeInfo();
|
|
121
121
|
log.info(`Started PXE connected to chain ${info.l1ChainId} version ${info.rollupVersion}`);
|
|
122
122
|
return pxe;
|
|
123
123
|
}
|
|
124
124
|
// Internal methods
|
|
125
125
|
#getSimulatorForTx(overrides) {
|
|
126
126
|
const proxyContractStore = ProxiedContractStoreFactory.create(this.contractStore, overrides?.contracts);
|
|
127
|
-
return new ContractFunctionSimulator(
|
|
127
|
+
return new ContractFunctionSimulator({
|
|
128
|
+
contractStore: proxyContractStore,
|
|
129
|
+
noteStore: this.noteStore,
|
|
130
|
+
keyStore: this.keyStore,
|
|
131
|
+
addressStore: this.addressStore,
|
|
132
|
+
aztecNode: BenchmarkedNodeFactory.create(this.node),
|
|
133
|
+
senderTaggingStore: this.senderTaggingStore,
|
|
134
|
+
recipientTaggingStore: this.recipientTaggingStore,
|
|
135
|
+
senderAddressBookStore: this.senderAddressBookStore,
|
|
136
|
+
capsuleStore: this.capsuleStore,
|
|
137
|
+
privateEventStore: this.privateEventStore,
|
|
138
|
+
simulator: this.simulator,
|
|
139
|
+
contractSyncService: this.contractSyncService
|
|
140
|
+
});
|
|
128
141
|
}
|
|
129
142
|
#contextualizeError(err, ...context) {
|
|
130
143
|
let contextStr = '';
|
|
@@ -180,10 +193,14 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
180
193
|
const { origin: contractAddress, functionSelector } = txRequest;
|
|
181
194
|
try {
|
|
182
195
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
183
|
-
await this.contractSyncService.ensureContractSynced(contractAddress, functionSelector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [],
|
|
184
|
-
const result = await contractFunctionSimulator.run(txRequest,
|
|
185
|
-
|
|
186
|
-
|
|
196
|
+
await this.contractSyncService.ensureContractSynced(contractAddress, functionSelector, (privateSyncCall, execScopes)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, scopes);
|
|
197
|
+
const result = await contractFunctionSimulator.run(txRequest, {
|
|
198
|
+
contractAddress,
|
|
199
|
+
selector: functionSelector,
|
|
200
|
+
anchorBlockHeader,
|
|
201
|
+
scopes,
|
|
202
|
+
jobId
|
|
203
|
+
});
|
|
187
204
|
this.log.debug(`Private simulation completed for ${contractAddress.toString()}:${functionSelector}`);
|
|
188
205
|
return result;
|
|
189
206
|
} catch (err) {
|
|
@@ -257,7 +274,17 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
257
274
|
return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
|
|
258
275
|
}
|
|
259
276
|
// Public API
|
|
260
|
-
|
|
277
|
+
/**
|
|
278
|
+
* Returns the block header up to which the PXE has synced.
|
|
279
|
+
* @returns The synced block header
|
|
280
|
+
*/ getSyncedBlockHeader() {
|
|
281
|
+
return this.anchorBlockStore.getBlockHeader();
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Returns the contract instance for a given address, if it's registered in the PXE.
|
|
285
|
+
* @param address - The contract address.
|
|
286
|
+
* @returns The contract instance if found, undefined otherwise.
|
|
287
|
+
*/ getContractInstance(address) {
|
|
261
288
|
return this.contractStore.getContractInstance(address);
|
|
262
289
|
}
|
|
263
290
|
/**
|
|
@@ -424,10 +451,11 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
424
451
|
* (where validators prove the public portion).
|
|
425
452
|
*
|
|
426
453
|
* @param txRequest - An authenticated tx request ready for proving
|
|
454
|
+
* @param scopes - Addresses whose private state and keys are accessible during private execution.
|
|
427
455
|
* @returns A result containing the proof and public inputs of the tail circuit.
|
|
428
456
|
* @throws If contract code not found, or public simulation reverts.
|
|
429
457
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
430
|
-
*/ proveTx(txRequest) {
|
|
458
|
+
*/ proveTx(txRequest, scopes) {
|
|
431
459
|
let privateExecutionResult;
|
|
432
460
|
// We disable proving concurrently mostly out of caution, since it accesses some of our stores. Proving is so
|
|
433
461
|
// computationally demanding that it'd be rare for someone to try to do it concurrently regardless.
|
|
@@ -438,7 +466,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
438
466
|
await this.blockStateSynchronizer.sync();
|
|
439
467
|
const syncTime = syncTimer.ms();
|
|
440
468
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
441
|
-
privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest,
|
|
469
|
+
privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
|
|
442
470
|
const { publicInputs, chonkProof, executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
443
471
|
simulate: false,
|
|
444
472
|
skipFeeEnforcement: false,
|
|
@@ -488,13 +516,10 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
488
516
|
}
|
|
489
517
|
/**
|
|
490
518
|
* Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
|
|
491
|
-
*
|
|
492
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
493
|
-
* @param msgSender - (Optional) The message sender to use for the simulation.
|
|
494
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
519
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
495
520
|
* @returns A trace of the program execution with gate counts.
|
|
496
521
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
497
|
-
*/ profileTx(txRequest, profileMode, skipProofGeneration = true) {
|
|
522
|
+
*/ profileTx(txRequest, { profileMode, skipProofGeneration = true, scopes }) {
|
|
498
523
|
// We disable concurrent profiles for consistency with simulateTx.
|
|
499
524
|
return this.#putInJobQueue(async (jobId)=>{
|
|
500
525
|
const totalTimer = new Timer();
|
|
@@ -512,7 +537,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
512
537
|
await this.blockStateSynchronizer.sync();
|
|
513
538
|
const syncTime = syncTimer.ms();
|
|
514
539
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
515
|
-
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest,
|
|
540
|
+
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
|
|
516
541
|
const { executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
517
542
|
simulate: skipProofGeneration,
|
|
518
543
|
skipFeeEnforcement: false,
|
|
@@ -557,18 +582,13 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
557
582
|
* In that case, the transaction returned is only potentially ready to be sent to the network for execution.
|
|
558
583
|
*
|
|
559
584
|
*
|
|
560
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
561
|
-
* @param simulatePublic - Whether to simulate the public part of the transaction.
|
|
562
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
563
|
-
* @param skipFeeEnforcement - (Optional) If false, fees are enforced.
|
|
564
|
-
* @param overrides - (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts.
|
|
565
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
585
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
566
586
|
* @returns A simulated transaction result object that includes public and private return values.
|
|
567
587
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
568
588
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
569
589
|
*
|
|
570
590
|
* TODO(#7456) Prevent msgSender being defined here for the first call
|
|
571
|
-
*/ simulateTx(txRequest, simulatePublic, skipTxValidation = false, skipFeeEnforcement = false, overrides, scopes) {
|
|
591
|
+
*/ simulateTx(txRequest, { simulatePublic, skipTxValidation = false, skipFeeEnforcement = false, overrides, scopes }) {
|
|
572
592
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
573
593
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
574
594
|
// delete the same read value, or reading values that another simulation is currently modifying).
|
|
@@ -603,7 +623,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
603
623
|
let publicInputs;
|
|
604
624
|
let executionSteps = [];
|
|
605
625
|
if (skipKernels) {
|
|
606
|
-
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, this.contractStore));
|
|
626
|
+
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, (addr, sel)=>this.contractStore.getDebugFunctionName(addr, sel)));
|
|
607
627
|
} else {
|
|
608
628
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
609
629
|
({ publicInputs, executionSteps } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
@@ -668,14 +688,9 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
668
688
|
});
|
|
669
689
|
}
|
|
670
690
|
/**
|
|
671
|
-
*
|
|
672
|
-
*
|
|
691
|
+
* Simulates the execution of a contract utility function.
|
|
673
692
|
* @param call - The function call containing the function details, arguments, and target contract address.
|
|
674
|
-
|
|
675
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will
|
|
676
|
-
* default to all.
|
|
677
|
-
* @returns The result of the utility function call, structured based on the function ABI.
|
|
678
|
-
*/ simulateUtility(call, authwits, scopes) {
|
|
693
|
+
*/ simulateUtility(call, { authwits, scopes } = {}) {
|
|
679
694
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
680
695
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
681
696
|
// delete the same read value, or reading values that another simulation is currently modifying).
|
|
@@ -688,7 +703,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
688
703
|
const functionTimer = new Timer();
|
|
689
704
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
690
705
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
691
|
-
await this.contractSyncService.ensureContractSynced(call.to, call.selector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [],
|
|
706
|
+
await this.contractSyncService.ensureContractSynced(call.to, call.selector, (privateSyncCall, execScopes)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, scopes);
|
|
692
707
|
const executionResult = await this.#simulateUtility(contractFunctionSimulator, call, authwits ?? [], scopes, jobId);
|
|
693
708
|
const functionTime = functionTimer.ms();
|
|
694
709
|
const totalTime = totalTimer.ms();
|
|
@@ -738,7 +753,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
738
753
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
739
754
|
anchorBlockNumber = anchorBlockHeader.getBlockNumber();
|
|
740
755
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
741
|
-
await this.contractSyncService.ensureContractSynced(filter.contractAddress, null, async (privateSyncCall)=>await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [],
|
|
756
|
+
await this.contractSyncService.ensureContractSynced(filter.contractAddress, null, async (privateSyncCall, execScopes)=>await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, filter.scopes);
|
|
742
757
|
});
|
|
743
758
|
// anchorBlockNumber is set during the job and fixed to whatever it is after a block sync
|
|
744
759
|
const sanitizedFilter = new PrivateEventFilterValidator(anchorBlockNumber).validate(filter);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toArray } from '@aztec/foundation/iterable';
|
|
2
|
-
import { FunctionSelector, FunctionType, contractArtifactFromBuffer, contractArtifactToBuffer, encodeArguments, getFunctionDebugMetadata } from '@aztec/stdlib/abi';
|
|
2
|
+
import { FunctionCall, FunctionSelector, FunctionType, contractArtifactFromBuffer, contractArtifactToBuffer, encodeArguments, getFunctionDebugMetadata } from '@aztec/stdlib/abi';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import { SerializableContractInstance, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
5
5
|
import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
@@ -219,15 +219,15 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
219
219
|
if (!functionDao) {
|
|
220
220
|
throw new Error(`Unknown function ${functionName} in contract ${contract.name}.`);
|
|
221
221
|
}
|
|
222
|
-
return {
|
|
222
|
+
return FunctionCall.from({
|
|
223
223
|
name: functionDao.name,
|
|
224
|
-
|
|
224
|
+
to,
|
|
225
225
|
selector: await FunctionSelector.fromNameAndParameters(functionDao.name, functionDao.parameters),
|
|
226
226
|
type: functionDao.functionType,
|
|
227
|
-
to,
|
|
228
227
|
hideMsgSender: false,
|
|
229
228
|
isStatic: functionDao.isStatic,
|
|
229
|
+
args: encodeArguments(functionDao, args),
|
|
230
230
|
returnTypes: functionDao.returnTypes
|
|
231
|
-
};
|
|
231
|
+
});
|
|
232
232
|
}
|
|
233
233
|
}
|
|
@@ -35,7 +35,6 @@ export declare class NoteStore implements StagedStore {
|
|
|
35
35
|
* @params jobId - the job context to read from.
|
|
36
36
|
* @returns Filtered and deduplicated notes (a note might be present in multiple scopes - we ensure it is only
|
|
37
37
|
* returned once if this is the case)
|
|
38
|
-
* @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
|
|
39
38
|
*/
|
|
40
39
|
getNotes(filter: NotesFilter, jobId: string): Promise<NoteDao[]>;
|
|
41
40
|
/**
|
|
@@ -80,4 +79,4 @@ export declare class NoteStore implements StagedStore {
|
|
|
80
79
|
commit(jobId: string): Promise<void>;
|
|
81
80
|
discardStaged(jobId: string): Promise<void>;
|
|
82
81
|
}
|
|
83
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
82
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZV9zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2Uvbm90ZV9zdG9yZS9ub3RlX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSy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Ozs7Ozs7Ozs7T0FXRztJQUNVLFFBQVEsQ0FBQyxXQUFXLEVBQUUsTUFBTSxFQUFFLGtCQUFrQixFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBTXBGO0lBNkVEOzs7Ozs7Ozs7T0FTRztJQUNHLE1BQU0sQ0FBQyxLQUFLLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FVekM7SUFFRCxhQUFhLENBQUMsS0FBSyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBRzFDO0NBa0NGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note_store.d.ts","sourceRoot":"","sources":["../../../src/storage/note_store/note_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAG5E;;;;;IAKI;AACJ,qBAAa,SAAU,YAAW,WAAW;;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAU;IA+BpC,YAAY,KAAK,EAAE,iBAAiB,EAQnC;IAED;;;;;;;;;OASG;IACI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAarF;IAcD
|
|
1
|
+
{"version":3,"file":"note_store.d.ts","sourceRoot":"","sources":["../../../src/storage/note_store/note_store.ts"],"names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}
|
|
@@ -74,10 +74,9 @@ import { StoredNote } from './stored_note.js';
|
|
|
74
74
|
* @params jobId - the job context to read from.
|
|
75
75
|
* @returns Filtered and deduplicated notes (a note might be present in multiple scopes - we ensure it is only
|
|
76
76
|
* returned once if this is the case)
|
|
77
|
-
* @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
|
|
78
77
|
*/ getNotes(filter, jobId) {
|
|
79
78
|
if (filter.scopes !== undefined && filter.scopes.length === 0) {
|
|
80
|
-
return Promise.
|
|
79
|
+
return Promise.resolve([]);
|
|
81
80
|
}
|
|
82
81
|
return this.#store.transactionAsync(async ()=>{
|
|
83
82
|
const targetStatus = filter.status ?? NoteStatus.ACTIVE;
|
|
@@ -173,6 +172,9 @@ import { StoredNote } from './stored_note.js';
|
|
|
173
172
|
if (nullifiers.length === 0) {
|
|
174
173
|
return Promise.resolve([]);
|
|
175
174
|
}
|
|
175
|
+
if (nullifiers.some((n)=>n.l2BlockNumber === 0)) {
|
|
176
|
+
return Promise.reject(new Error('applyNullifiers: nullifiers cannot have been emitted at block 0'));
|
|
177
|
+
}
|
|
176
178
|
return this.#withJobLock(jobId, ()=>this.#store.transactionAsync(async ()=>{
|
|
177
179
|
const notesToNullify = await Promise.all(nullifiers.map(async (nullifierInBlock)=>{
|
|
178
180
|
const nullifier = nullifierInBlock.data.toString();
|