@aztec/pxe 0.0.1-commit.87a0206 → 0.0.1-commit.8f9871590
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/access_scopes.d.ts +9 -0
- package/dest/access_scopes.d.ts.map +1 -0
- package/dest/access_scopes.js +6 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +53 -29
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +168 -64
- 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 +35 -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 +49 -31
- package/dest/contract_sync/contract_sync_service.d.ts +4 -2
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +34 -19
- package/dest/contract_sync/helpers.d.ts +3 -2
- package/dest/contract_sync/helpers.d.ts.map +1 -1
- package/dest/contract_sync/helpers.js +3 -3
- package/dest/debug/pxe_debug_utils.d.ts +5 -4
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +1 -1
- package/dest/entrypoints/client/bundle/index.d.ts +3 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +2 -0
- 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/index.d.ts +3 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +2 -0
- 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/index.d.ts +3 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +2 -0
- package/dest/entrypoints/server/utils.js +9 -1
- package/dest/logs/log_service.d.ts +3 -2
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +5 -10
- package/dest/notes/note_service.d.ts +4 -3
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +3 -2
- package/dest/notes_filter.d.ts +25 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/hints/index.js +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +6 -6
- package/dest/pxe.d.ts +57 -22
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +42 -35
- package/dest/storage/note_store/note_store.d.ts +3 -3
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +3 -4
- package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +17 -3
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +4 -4
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
- package/package.json +16 -16
- package/src/access_scopes.ts +9 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +315 -121
- 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 +92 -93
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +89 -30
- package/src/contract_sync/contract_sync_service.ts +49 -26
- package/src/contract_sync/helpers.ts +7 -2
- package/src/debug/pxe_debug_utils.ts +8 -6
- package/src/entrypoints/client/bundle/index.ts +2 -0
- package/src/entrypoints/client/bundle/utils.ts +9 -1
- package/src/entrypoints/client/lazy/index.ts +2 -0
- package/src/entrypoints/client/lazy/utils.ts +9 -1
- package/src/entrypoints/server/index.ts +2 -0
- package/src/entrypoints/server/utils.ts +7 -7
- package/src/logs/log_service.ts +7 -19
- package/src/notes/note_service.ts +4 -3
- package/src/notes_filter.ts +26 -0
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +1 -1
- package/src/private_kernel/private_kernel_execution_prover.ts +6 -6
- package/src/pxe.ts +104 -74
- package/src/storage/note_store/note_store.ts +8 -5
- package/src/tagging/get_all_logs_by_tags.ts +28 -4
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +4 -4
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
|
@@ -3,6 +3,7 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
3
3
|
import { type AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
4
4
|
import { Note, NoteStatus } from '@aztec/stdlib/note';
|
|
5
5
|
import type { BlockHeader, TxHash } from '@aztec/stdlib/tx';
|
|
6
|
+
import type { AccessScopes } from '../access_scopes.js';
|
|
6
7
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
7
8
|
export declare class NoteService {
|
|
8
9
|
private readonly noteStore;
|
|
@@ -19,7 +20,7 @@ export declare class NoteService {
|
|
|
19
20
|
* @param status - The status of notes to fetch.
|
|
20
21
|
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
21
22
|
*/
|
|
22
|
-
getNotes(contractAddress: AztecAddress, owner: AztecAddress | undefined, storageSlot: Fr, status: NoteStatus, scopes
|
|
23
|
+
getNotes(contractAddress: AztecAddress, owner: AztecAddress | undefined, storageSlot: Fr, status: NoteStatus, scopes: AccessScopes): Promise<{
|
|
23
24
|
contractAddress: AztecAddress;
|
|
24
25
|
owner: AztecAddress;
|
|
25
26
|
storageSlot: Fr;
|
|
@@ -42,7 +43,7 @@ export declare class NoteService {
|
|
|
42
43
|
*
|
|
43
44
|
* @param contractAddress - The contract whose notes should be checked and nullified.
|
|
44
45
|
*/
|
|
45
|
-
syncNoteNullifiers(contractAddress: AztecAddress): Promise<void>;
|
|
46
|
+
syncNoteNullifiers(contractAddress: AztecAddress, scopes: AccessScopes): Promise<void>;
|
|
46
47
|
validateAndStoreNote(contractAddress: AztecAddress, owner: AztecAddress, storageSlot: Fr, randomness: Fr, noteNonce: Fr, content: Fr[], noteHash: Fr, nullifier: Fr, txHash: TxHash, recipient: AztecAddress): Promise<void>;
|
|
47
48
|
}
|
|
48
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
49
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZV9zZXJ2aWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbm90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M,EAAE,YAAY;;;;;;;;;;SAyBrB;IAED;;;;;;;;;;;OAWG;IACU,kBAAkB,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAsClG;IAEY,oBAAoB,CAC/B,eAAe,EAAE,YAAY,EAC7B,KAAK,EAAE,YAAY,EACnB,WAAW,EAAE,EAAE,EACf,UAAU,EAAE,EAAE,EACd,SAAS,EAAE,EAAE,EACb,OAAO,EAAE,EAAE,EAAE,EACb,QAAQ,EAAE,EAAE,EACZ,SAAS,EAAE,EAAE,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,IAAI,CAAC,CAsEf;CACF"}
|
|
@@ -52,10 +52,11 @@ export class NoteService {
|
|
|
52
52
|
* This allows recent nullifications to be processed even if the node is not an archive node.
|
|
53
53
|
*
|
|
54
54
|
* @param contractAddress - The contract whose notes should be checked and nullified.
|
|
55
|
-
*/ async syncNoteNullifiers(contractAddress) {
|
|
55
|
+
*/ async syncNoteNullifiers(contractAddress, scopes) {
|
|
56
56
|
const anchorBlockHash = await this.anchorBlockHeader.hash();
|
|
57
57
|
const contractNotes = await this.noteStore.getNotes({
|
|
58
|
-
contractAddress
|
|
58
|
+
contractAddress,
|
|
59
|
+
scopes
|
|
59
60
|
}, this.jobId);
|
|
60
61
|
if (contractNotes.length === 0) {
|
|
61
62
|
return;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { NoteStatus } from '@aztec/stdlib/note';
|
|
4
|
+
import type { AccessScopes } from './access_scopes.js';
|
|
5
|
+
/**
|
|
6
|
+
* A filter used to fetch notes.
|
|
7
|
+
* @remarks This filter is applied as an intersection of all its params.
|
|
8
|
+
*/
|
|
9
|
+
export type NotesFilter = {
|
|
10
|
+
/**
|
|
11
|
+
* The contract address the note belongs to.
|
|
12
|
+
* @remarks Providing a contract address is required as we need that information to trigger private state sync.
|
|
13
|
+
*/
|
|
14
|
+
contractAddress: AztecAddress;
|
|
15
|
+
/** The owner of the note. */
|
|
16
|
+
owner?: AztecAddress;
|
|
17
|
+
/** The specific storage location of the note on the contract. */
|
|
18
|
+
storageSlot?: Fr;
|
|
19
|
+
/** The status of the note. Defaults to 'ACTIVE'. */
|
|
20
|
+
status?: NoteStatus;
|
|
21
|
+
/** The siloed nullifier for the note. */
|
|
22
|
+
siloedNullifier?: Fr;
|
|
23
|
+
scopes: AccessScopes;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZXNfZmlsdGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvbm90ZXNfZmlsdGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXJELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXZEOzs7R0FHRztBQUNILE1BQU0sTUFBTSxXQUFXLEdBQUc7SUFDeEI7OztPQUdHO0lBQ0gsZUFBZSxFQUFFLFlBQVksQ0FBQztJQUM5Qiw2QkFBNkI7SUFDN0IsS0FBSyxDQUFDLEVBQUUsWUFBWSxDQUFDO0lBQ3JCLGlFQUFpRTtJQUNqRSxXQUFXLENBQUMsRUFBRSxFQUFFLENBQUM7SUFDakIsb0RBQW9EO0lBQ3BELE1BQU0sQ0FBQyxFQUFFLFVBQVUsQ0FBQztJQUNwQix5Q0FBeUM7SUFDekMsZUFBZSxDQUFDLEVBQUUsRUFBRSxDQUFDO0lBQ3JCLE1BQU0sRUFBRSxZQUFZLENBQUM7Q0FDdEIsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notes_filter.d.ts","sourceRoot":"","sources":["../src/notes_filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,eAAe,EAAE,YAAY,CAAC;IAC9B,6BAA6B;IAC7B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,iEAAiE;IACjE,WAAW,CAAC,EAAE,EAAE,CAAC;IACjB,oDAAoD;IACpD,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,yCAAyC;IACzC,eAAe,CAAC,EAAE,EAAE,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC"}
|
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';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PrivateKernelCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
2
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
3
|
+
export declare function computeTxExpirationTimestamp(previousKernel: PrivateKernelCircuitPublicInputs, txLifetime?: number): UInt64;
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcHV0ZV90eF9leHBpcmF0aW9uX3RpbWVzdGFtcC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL2hpbnRzL2NvbXB1dGVfdHhfZXhwaXJhdGlvbl90aW1lc3RhbXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsZ0NBQWdDLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUM3RSxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQXFCbEQsd0JBQWdCLDRCQUE0QixDQUMxQyxjQUFjLEVBQUUsZ0NBQWdDLEVBQ2hELFVBQVUsU0FBa0IsR0FDM0IsTUFBTSxDQStCUiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute_tx_expiration_timestamp.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/compute_tx_expiration_timestamp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAqBlD,wBAAgB,4BAA4B,CAC1C,cAAc,EAAE,gCAAgC,EAChD,UAAU,SAAkB,GAC3B,MAAM,CA+BR"}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MAX_TX_LIFETIME } from '@aztec/constants';
|
|
2
2
|
const ROUNDED_DURATIONS = [
|
|
3
3
|
3600,
|
|
4
4
|
1800,
|
|
5
5
|
1
|
|
6
6
|
];
|
|
7
|
-
function roundTimestamp(blockTimestamp,
|
|
7
|
+
function roundTimestamp(blockTimestamp, expirationTimestamp) {
|
|
8
8
|
return ROUNDED_DURATIONS.reduce((timestamp, duration)=>{
|
|
9
9
|
if (timestamp <= blockTimestamp) {
|
|
10
10
|
// The timestamp must be greater than the block timestamp.
|
|
11
11
|
// If it is too small, round it down again using a smaller duration.
|
|
12
|
-
const totalDuration =
|
|
12
|
+
const totalDuration = expirationTimestamp - blockTimestamp;
|
|
13
13
|
const roundedDuration = totalDuration - totalDuration % BigInt(duration);
|
|
14
14
|
return blockTimestamp + roundedDuration;
|
|
15
15
|
}
|
|
16
16
|
return timestamp;
|
|
17
17
|
}, 0n);
|
|
18
18
|
}
|
|
19
|
-
export function
|
|
20
|
-
if (
|
|
21
|
-
throw new Error(`Custom
|
|
19
|
+
export function computeTxExpirationTimestamp(previousKernel, txLifetime = MAX_TX_LIFETIME) {
|
|
20
|
+
if (txLifetime > MAX_TX_LIFETIME) {
|
|
21
|
+
throw new Error(`Custom tx lifetime cannot be greater than the max allowed. Max allowed: ${MAX_TX_LIFETIME}. Custom value: ${txLifetime}.`);
|
|
22
22
|
}
|
|
23
23
|
const anchorBlockTimestamp = previousKernel.constants.anchorBlockHeader.globalVariables.timestamp;
|
|
24
|
-
const maxTimestamp = anchorBlockTimestamp + BigInt(
|
|
25
|
-
const
|
|
26
|
-
// If the
|
|
24
|
+
const maxTimestamp = anchorBlockTimestamp + BigInt(txLifetime);
|
|
25
|
+
const expirationTimestamp = previousKernel.expirationTimestamp;
|
|
26
|
+
// If the expirationTimestamp set during the tx execution is greater than or equal to the max allowed duration,
|
|
27
27
|
// use the maximum allowed timestamp.
|
|
28
28
|
// Note: It shouldn't be larger than the max allowed duration, but we check for it anyway.
|
|
29
|
-
if (
|
|
29
|
+
if (expirationTimestamp >= maxTimestamp) {
|
|
30
30
|
return maxTimestamp;
|
|
31
31
|
}
|
|
32
32
|
// Round it down to the nearest hour/min/second to reduce precision and avoid revealing the exact value.
|
|
33
33
|
// This makes it harder for others to infer what function calls may have been used to produce a specific timestamp.
|
|
34
|
-
const roundedTimestamp = roundTimestamp(anchorBlockTimestamp,
|
|
34
|
+
const roundedTimestamp = roundTimestamp(anchorBlockTimestamp, expirationTimestamp);
|
|
35
35
|
// The tx can't be published if the timestamp is the same or less than the anchor block's timestamp.
|
|
36
36
|
// Future blocks will have a greater timestamp, so the tx would never be included.
|
|
37
37
|
if (roundedTimestamp <= anchorBlockTimestamp) {
|
|
38
|
-
throw new Error(`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${
|
|
38
|
+
throw new Error(`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${expirationTimestamp}.`);
|
|
39
39
|
}
|
|
40
40
|
return roundedTimestamp;
|
|
41
41
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './private_kernel_reset_private_inputs_builder.js';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './compute_tx_expiration_timestamp.js';
|
|
3
3
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wcml2YXRlX2tlcm5lbC9oaW50cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGtEQUFrRCxDQUFDO0FBQ2pFLGNBQWMsc0NBQXNDLENBQUMifQ==
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './private_kernel_reset_private_inputs_builder.js';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './compute_tx_expiration_timestamp.js';
|
|
@@ -161,14 +161,14 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
161
161
|
this.log.debug(`Calling private kernel tail with hwm ${previousKernelData.publicInputs.minRevertibleSideEffectCounter}`);
|
|
162
162
|
// TODO: Enable padding once we better understand the final amounts to pad to.
|
|
163
163
|
const paddedSideEffectAmounts = PaddedSideEffectAmounts.empty();
|
|
164
|
-
// Use the aggregated
|
|
165
|
-
// TODO: Call `
|
|
166
|
-
const
|
|
164
|
+
// Use the aggregated expirationTimestamp set throughout the tx execution.
|
|
165
|
+
// TODO: Call `computeTxExpirationTimestamp` to round the value down and reduce precision, improving privacy.
|
|
166
|
+
const expirationTimestampUpperBound = previousKernelData.publicInputs.expirationTimestamp;
|
|
167
167
|
const anchorBlockTimestamp = previousKernelData.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp;
|
|
168
|
-
if (
|
|
169
|
-
throw new Error(`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${
|
|
168
|
+
if (expirationTimestampUpperBound <= anchorBlockTimestamp) {
|
|
169
|
+
throw new Error(`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${expirationTimestampUpperBound}.`);
|
|
170
170
|
}
|
|
171
|
-
const privateInputs = new PrivateKernelTailCircuitPrivateInputs(previousKernelData, paddedSideEffectAmounts,
|
|
171
|
+
const privateInputs = new PrivateKernelTailCircuitPrivateInputs(previousKernelData, paddedSideEffectAmounts, expirationTimestampUpperBound);
|
|
172
172
|
const witgenTimer = new Timer();
|
|
173
173
|
const tailOutput = generateWitnesses ? await this.proofCreator.generateTailOutput(privateInputs) : await this.proofCreator.simulateTail(privateInputs);
|
|
174
174
|
executionSteps.push({
|
package/dest/pxe.d.ts
CHANGED
|
@@ -10,12 +10,59 @@ 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
12
|
import { BlockHeader, type InTx, SimulationOverrides, TxExecutionRequest, TxProfileResult, TxProvingResult, TxSimulationResult, UtilitySimulationResult } from '@aztec/stdlib/tx';
|
|
13
|
+
import type { AccessScopes } from './access_scopes.js';
|
|
13
14
|
import type { PXEConfig } from './config/index.js';
|
|
14
15
|
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
15
16
|
export type PackedPrivateEvent = InTx & {
|
|
16
17
|
packedEvent: Fr[];
|
|
17
18
|
eventSelector: EventSelector;
|
|
18
19
|
};
|
|
20
|
+
/** Options for PXE.profileTx. */
|
|
21
|
+
export type ProfileTxOpts = {
|
|
22
|
+
/** The profiling mode to use. */
|
|
23
|
+
profileMode: 'full' | 'execution-steps' | 'gates';
|
|
24
|
+
/** If true, proof generation is skipped during profiling. Defaults to true. */
|
|
25
|
+
skipProofGeneration?: boolean;
|
|
26
|
+
/** Addresses whose private state and keys are accessible during private execution. */
|
|
27
|
+
scopes: AccessScopes;
|
|
28
|
+
};
|
|
29
|
+
/** Options for PXE.simulateTx. */
|
|
30
|
+
export type SimulateTxOpts = {
|
|
31
|
+
/** Whether to simulate the public part of the transaction. */
|
|
32
|
+
simulatePublic: boolean;
|
|
33
|
+
/** If false, this function throws if the transaction is unable to be included in a block at the current state. */
|
|
34
|
+
skipTxValidation?: boolean;
|
|
35
|
+
/** If false, fees are enforced. */
|
|
36
|
+
skipFeeEnforcement?: boolean;
|
|
37
|
+
/** State overrides for the simulation, such as contract instances and artifacts. */
|
|
38
|
+
overrides?: SimulationOverrides;
|
|
39
|
+
/** Addresses whose private state and keys are accessible during private execution */
|
|
40
|
+
scopes: AccessScopes;
|
|
41
|
+
};
|
|
42
|
+
/** Options for PXE.simulateUtility. */
|
|
43
|
+
export type SimulateUtilityOpts = {
|
|
44
|
+
/** The authentication witnesses required for the function call. */
|
|
45
|
+
authwits?: AuthWitness[];
|
|
46
|
+
/** The accounts whose notes we can access in this call */
|
|
47
|
+
scopes: AccessScopes;
|
|
48
|
+
};
|
|
49
|
+
/** Args for PXE.create. */
|
|
50
|
+
export type PXECreateArgs = {
|
|
51
|
+
/** The Aztec node to connect to. */
|
|
52
|
+
node: AztecNode;
|
|
53
|
+
/** The key-value store for persisting PXE state. */
|
|
54
|
+
store: AztecAsyncKVStore;
|
|
55
|
+
/** The prover for generating private kernel proofs. */
|
|
56
|
+
proofCreator: PrivateKernelProver;
|
|
57
|
+
/** The circuit simulator for executing ACIR circuits. */
|
|
58
|
+
simulator: CircuitSimulator;
|
|
59
|
+
/** Provider for protocol contract artifacts and instances. */
|
|
60
|
+
protocolContractsProvider: ProtocolContractsProvider;
|
|
61
|
+
/** PXE configuration options. */
|
|
62
|
+
config: PXEConfig;
|
|
63
|
+
/** Optional logger instance or string suffix for the logger name. */
|
|
64
|
+
loggerOrSuffix?: string | Logger;
|
|
65
|
+
};
|
|
19
66
|
/**
|
|
20
67
|
* Private eXecution Environment (PXE) is a library used by wallets to simulate private phase of transactions and to
|
|
21
68
|
* manage private state of users.
|
|
@@ -51,7 +98,7 @@ export declare class PXE {
|
|
|
51
98
|
*
|
|
52
99
|
* @returns A promise that resolves PXE is ready to be used.
|
|
53
100
|
*/
|
|
54
|
-
static create(node
|
|
101
|
+
static create({ node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix }: PXECreateArgs): Promise<PXE>;
|
|
55
102
|
/**
|
|
56
103
|
* Returns the block header up to which the PXE has synced.
|
|
57
104
|
* @returns The synced block header
|
|
@@ -144,21 +191,19 @@ export declare class PXE {
|
|
|
144
191
|
* (where validators prove the public portion).
|
|
145
192
|
*
|
|
146
193
|
* @param txRequest - An authenticated tx request ready for proving
|
|
194
|
+
* @param scopes - Addresses whose private state and keys are accessible during private execution.
|
|
147
195
|
* @returns A result containing the proof and public inputs of the tail circuit.
|
|
148
196
|
* @throws If contract code not found, or public simulation reverts.
|
|
149
197
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
150
198
|
*/
|
|
151
|
-
proveTx(txRequest: TxExecutionRequest): Promise<TxProvingResult>;
|
|
199
|
+
proveTx(txRequest: TxExecutionRequest, scopes: AztecAddress[]): Promise<TxProvingResult>;
|
|
152
200
|
/**
|
|
153
201
|
* Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
|
|
154
|
-
*
|
|
155
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
156
|
-
* @param msgSender - (Optional) The message sender to use for the simulation.
|
|
157
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
202
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
158
203
|
* @returns A trace of the program execution with gate counts.
|
|
159
204
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
160
205
|
*/
|
|
161
|
-
profileTx(txRequest: TxExecutionRequest, profileMode
|
|
206
|
+
profileTx(txRequest: TxExecutionRequest, { profileMode, skipProofGeneration, scopes }: ProfileTxOpts): Promise<TxProfileResult>;
|
|
162
207
|
/**
|
|
163
208
|
* Simulates a transaction based on the provided preauthenticated execution request.
|
|
164
209
|
* This will run a local simulation of private execution (and optionally of public as well), run the
|
|
@@ -170,29 +215,19 @@ export declare class PXE {
|
|
|
170
215
|
* In that case, the transaction returned is only potentially ready to be sent to the network for execution.
|
|
171
216
|
*
|
|
172
217
|
*
|
|
173
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
174
|
-
* @param simulatePublic - Whether to simulate the public part of the transaction.
|
|
175
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
176
|
-
* @param skipFeeEnforcement - (Optional) If false, fees are enforced.
|
|
177
|
-
* @param overrides - (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts.
|
|
178
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
218
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
179
219
|
* @returns A simulated transaction result object that includes public and private return values.
|
|
180
220
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
181
221
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
182
222
|
*
|
|
183
223
|
* TODO(#7456) Prevent msgSender being defined here for the first call
|
|
184
224
|
*/
|
|
185
|
-
simulateTx(txRequest: TxExecutionRequest, simulatePublic
|
|
225
|
+
simulateTx(txRequest: TxExecutionRequest, { simulatePublic, skipTxValidation, skipFeeEnforcement, overrides, scopes }: SimulateTxOpts): Promise<TxSimulationResult>;
|
|
186
226
|
/**
|
|
187
|
-
*
|
|
188
|
-
*
|
|
227
|
+
* Simulates the execution of a contract utility function.
|
|
189
228
|
* @param call - The function call containing the function details, arguments, and target contract address.
|
|
190
|
-
* @param authwits - (Optional) The authentication witnesses required for the function call.
|
|
191
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will
|
|
192
|
-
* default to all.
|
|
193
|
-
* @returns The result of the utility function call, structured based on the function ABI.
|
|
194
229
|
*/
|
|
195
|
-
simulateUtility(call: FunctionCall, authwits
|
|
230
|
+
simulateUtility(call: FunctionCall, { authwits, scopes }?: SimulateUtilityOpts): Promise<UtilitySimulationResult>;
|
|
196
231
|
/**
|
|
197
232
|
* Returns the private events given search parameters.
|
|
198
233
|
* @param eventSelector - Event selector to search for.
|
|
@@ -212,4 +247,4 @@ export declare class PXE {
|
|
|
212
247
|
*/
|
|
213
248
|
stop(): Promise<void>;
|
|
214
249
|
}
|
|
215
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
250
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHhlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcHhlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFakUsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBcUMsTUFBTSx1QkFBdUIsQ0FBQztBQUl2RixPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRXpELE9BQU8sRUFBRSxLQUFLLHlCQUF5QixFQUF5QixNQUFNLDJCQUEyQixDQUFDO0FBQ2xHLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDaEUsT0FBTyxFQUNMLEtBQUssZ0JBQWdCLEVBQ3JCLGFBQWEsRUFDYixZQUFZLEVBR2IsTUFBTSxtQkFBbUIsQ0FBQztBQUMzQixPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBT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Y,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6B9F;IAED;;;OAGG;IACI,YAAY,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAE7C;IAED;;;;;;;;;OASG;IACI,OAAO,CAAC,SAAS,EAAE,kBAAkB,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAuE9F;IAED;;;;;OAKG;IACI,SAAS,CACd,SAAS,EAAE,kBAAkB,EAC7B,EAAE,WAAW,EAAE,mBAA0B,EAAE,MAAM,EAAE,EAAE,aAAa,GACjE,OAAO,CAAC,eAAe,CAAC,CAkE1B;IAED;;;;;;;;;;;;;;;;;OAiBG;IACI,UAAU,CACf,SAAS,EAAE,kBAAkB,EAC7B,EAAE,cAAc,EAAE,gBAAwB,EAAE,kBAA0B,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,cAAc,GAC1G,OAAO,CAAC,kBAAkB,CAAC,CAgI7B;IAED;;;OAGG;IACI,eAAe,CACpB,IAAI,EAAE,YAAY,EAClB,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAE,mBAA8C,GACnE,OAAO,CAAC,uBAAuB,CAAC,CAwDlC;IAED;;;;;;;;;;;;OAYG;IACU,gBAAgB,CAC3B,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,EAAE,CAAC,CA8B/B;IAED;;OAEG;IACI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;CACF"}
|
package/dest/pxe.js
CHANGED
|
@@ -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) {
|
|
@@ -434,10 +451,11 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
434
451
|
* (where validators prove the public portion).
|
|
435
452
|
*
|
|
436
453
|
* @param txRequest - An authenticated tx request ready for proving
|
|
454
|
+
* @param scopes - Addresses whose private state and keys are accessible during private execution.
|
|
437
455
|
* @returns A result containing the proof and public inputs of the tail circuit.
|
|
438
456
|
* @throws If contract code not found, or public simulation reverts.
|
|
439
457
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
440
|
-
*/ proveTx(txRequest) {
|
|
458
|
+
*/ proveTx(txRequest, scopes) {
|
|
441
459
|
let privateExecutionResult;
|
|
442
460
|
// We disable proving concurrently mostly out of caution, since it accesses some of our stores. Proving is so
|
|
443
461
|
// computationally demanding that it'd be rare for someone to try to do it concurrently regardless.
|
|
@@ -448,7 +466,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
448
466
|
await this.blockStateSynchronizer.sync();
|
|
449
467
|
const syncTime = syncTimer.ms();
|
|
450
468
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
451
|
-
privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest,
|
|
469
|
+
privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
|
|
452
470
|
const { publicInputs, chonkProof, executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
453
471
|
simulate: false,
|
|
454
472
|
skipFeeEnforcement: false,
|
|
@@ -498,13 +516,10 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
498
516
|
}
|
|
499
517
|
/**
|
|
500
518
|
* Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
|
|
501
|
-
*
|
|
502
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
503
|
-
* @param msgSender - (Optional) The message sender to use for the simulation.
|
|
504
|
-
* @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.
|
|
505
520
|
* @returns A trace of the program execution with gate counts.
|
|
506
521
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
507
|
-
*/ profileTx(txRequest, profileMode, skipProofGeneration = true) {
|
|
522
|
+
*/ profileTx(txRequest, { profileMode, skipProofGeneration = true, scopes }) {
|
|
508
523
|
// We disable concurrent profiles for consistency with simulateTx.
|
|
509
524
|
return this.#putInJobQueue(async (jobId)=>{
|
|
510
525
|
const totalTimer = new Timer();
|
|
@@ -522,7 +537,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
522
537
|
await this.blockStateSynchronizer.sync();
|
|
523
538
|
const syncTime = syncTimer.ms();
|
|
524
539
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
525
|
-
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest,
|
|
540
|
+
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
|
|
526
541
|
const { executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
527
542
|
simulate: skipProofGeneration,
|
|
528
543
|
skipFeeEnforcement: false,
|
|
@@ -567,18 +582,13 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
567
582
|
* In that case, the transaction returned is only potentially ready to be sent to the network for execution.
|
|
568
583
|
*
|
|
569
584
|
*
|
|
570
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
571
|
-
* @param simulatePublic - Whether to simulate the public part of the transaction.
|
|
572
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
573
|
-
* @param skipFeeEnforcement - (Optional) If false, fees are enforced.
|
|
574
|
-
* @param overrides - (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts.
|
|
575
|
-
* @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.
|
|
576
586
|
* @returns A simulated transaction result object that includes public and private return values.
|
|
577
587
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
578
588
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
579
589
|
*
|
|
580
590
|
* TODO(#7456) Prevent msgSender being defined here for the first call
|
|
581
|
-
*/ simulateTx(txRequest, simulatePublic, skipTxValidation = false, skipFeeEnforcement = false, overrides, scopes) {
|
|
591
|
+
*/ simulateTx(txRequest, { simulatePublic, skipTxValidation = false, skipFeeEnforcement = false, overrides, scopes }) {
|
|
582
592
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
583
593
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
584
594
|
// delete the same read value, or reading values that another simulation is currently modifying).
|
|
@@ -613,7 +623,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
613
623
|
let publicInputs;
|
|
614
624
|
let executionSteps = [];
|
|
615
625
|
if (skipKernels) {
|
|
616
|
-
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, (addr, sel)=>this.contractStore.getDebugFunctionName(addr, sel)));
|
|
626
|
+
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, (addr, sel)=>this.contractStore.getDebugFunctionName(addr, sel), this.node));
|
|
617
627
|
} else {
|
|
618
628
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
619
629
|
({ publicInputs, executionSteps } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
@@ -673,19 +683,16 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
673
683
|
nodeRPCCalls: simulatorStats.nodeRPCCalls
|
|
674
684
|
});
|
|
675
685
|
} catch (err) {
|
|
676
|
-
throw this.#contextualizeError(err, inspect(txRequest), `simulatePublic=${simulatePublic}`, `skipTxValidation=${skipTxValidation}`, `scopes=${scopes
|
|
686
|
+
throw this.#contextualizeError(err, inspect(txRequest), `simulatePublic=${simulatePublic}`, `skipTxValidation=${skipTxValidation}`, `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map((s)=>s.toString()).join(', ')}`);
|
|
677
687
|
}
|
|
678
688
|
});
|
|
679
689
|
}
|
|
680
690
|
/**
|
|
681
|
-
*
|
|
682
|
-
*
|
|
691
|
+
* Simulates the execution of a contract utility function.
|
|
683
692
|
* @param call - The function call containing the function details, arguments, and target contract address.
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
* @returns The result of the utility function call, structured based on the function ABI.
|
|
688
|
-
*/ simulateUtility(call, authwits, scopes) {
|
|
693
|
+
*/ simulateUtility(call, { authwits, scopes } = {
|
|
694
|
+
scopes: 'ALL_SCOPES'
|
|
695
|
+
}) {
|
|
689
696
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
690
697
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
691
698
|
// delete the same read value, or reading values that another simulation is currently modifying).
|
|
@@ -698,7 +705,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
698
705
|
const functionTimer = new Timer();
|
|
699
706
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
700
707
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
701
|
-
await this.contractSyncService.ensureContractSynced(call.to, call.selector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [],
|
|
708
|
+
await this.contractSyncService.ensureContractSynced(call.to, call.selector, (privateSyncCall, execScopes)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, scopes);
|
|
702
709
|
const executionResult = await this.#simulateUtility(contractFunctionSimulator, call, authwits ?? [], scopes, jobId);
|
|
703
710
|
const functionTime = functionTimer.ms();
|
|
704
711
|
const totalTime = totalTimer.ms();
|
|
@@ -725,7 +732,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
725
732
|
} catch (err) {
|
|
726
733
|
const { to, name, args } = call;
|
|
727
734
|
const stringifiedArgs = args.map((arg)=>arg.toString()).join(', ');
|
|
728
|
-
throw this.#contextualizeError(err, `simulateUtility ${to}:${name}(${stringifiedArgs})`, `scopes=${scopes
|
|
735
|
+
throw this.#contextualizeError(err, `simulateUtility ${to}:${name}(${stringifiedArgs})`, `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map((s)=>s.toString()).join(', ')}`);
|
|
729
736
|
}
|
|
730
737
|
});
|
|
731
738
|
}
|
|
@@ -748,7 +755,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
748
755
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
749
756
|
anchorBlockNumber = anchorBlockHeader.getBlockNumber();
|
|
750
757
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
751
|
-
await this.contractSyncService.ensureContractSynced(filter.contractAddress, null, async (privateSyncCall)=>await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [],
|
|
758
|
+
await this.contractSyncService.ensureContractSynced(filter.contractAddress, null, async (privateSyncCall, execScopes)=>await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, filter.scopes);
|
|
752
759
|
});
|
|
753
760
|
// anchorBlockNumber is set during the job and fixed to whatever it is after a block sync
|
|
754
761
|
const sanitizedFilter = new PrivateEventFilterValidator(anchorBlockNumber).validate(filter);
|