@aztec/pxe 0.0.1-commit.ef17749e1 → 0.0.1-commit.f1b29a41e
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/block_synchronizer/block_synchronizer.d.ts +1 -1
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +6 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +9 -3
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +29 -6
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +17 -9
- package/dest/contract_function_simulator/index.d.ts +2 -1
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +1 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -5
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +7 -9
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -3
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -6
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +5 -10
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +21 -20
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +9 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +38 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts +39 -19
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +91 -44
- package/dest/contract_function_simulator/oracle/private_execution.js +5 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +11 -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 +12 -44
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +43 -25
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +157 -61
- package/dest/contract_logging.d.ts +9 -4
- package/dest/contract_logging.d.ts.map +1 -1
- package/dest/contract_logging.js +21 -6
- package/dest/contract_sync/contract_sync_service.d.ts +7 -4
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +59 -32
- package/dest/contract_sync/helpers.d.ts +2 -2
- package/dest/contract_sync/helpers.d.ts.map +1 -1
- package/dest/contract_sync/helpers.js +7 -2
- package/dest/events/event_service.d.ts +3 -2
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +16 -4
- package/dest/logs/log_service.d.ts +6 -7
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +24 -28
- package/dest/messages/message_context_service.d.ts +17 -0
- package/dest/messages/message_context_service.d.ts.map +1 -0
- package/dest/messages/message_context_service.js +36 -0
- package/dest/notes/note_service.d.ts +2 -2
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +14 -5
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/pxe.d.ts +6 -3
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +37 -21
- package/dest/storage/capsule_store/capsule_service.d.ts +22 -0
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_service.js +50 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +9 -9
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_store.js +33 -28
- package/dest/storage/capsule_store/index.d.ts +2 -1
- package/dest/storage/capsule_store/index.d.ts.map +1 -1
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +26 -25
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +141 -115
- package/dest/tagging/index.d.ts +2 -2
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +10 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +4 -3
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +20 -10
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +2 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +24 -11
- package/package.json +16 -16
- package/src/block_synchronizer/block_synchronizer.ts +6 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +40 -7
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +16 -11
- package/src/contract_function_simulator/index.ts +1 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +8 -8
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -4
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +3 -9
- package/src/contract_function_simulator/oracle/interfaces.ts +34 -28
- package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +98 -0
- package/src/contract_function_simulator/oracle/oracle.ts +120 -64
- package/src/contract_function_simulator/oracle/private_execution.ts +4 -4
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +14 -62
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +279 -72
- package/src/contract_logging.ts +18 -5
- package/src/contract_sync/contract_sync_service.ts +89 -49
- package/src/contract_sync/helpers.ts +3 -2
- package/src/events/event_service.ts +17 -4
- package/src/logs/log_service.ts +51 -46
- package/src/messages/message_context_service.ts +44 -0
- package/src/notes/note_service.ts +16 -5
- package/src/oracle_version.ts +2 -2
- package/src/pxe.ts +55 -19
- package/src/storage/capsule_store/capsule_service.ts +91 -0
- package/src/storage/capsule_store/capsule_store.ts +34 -26
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/metadata.ts +1 -1
- package/src/storage/tagging_store/sender_tagging_store.ts +182 -135
- package/src/tagging/index.ts +1 -1
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +19 -1
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +26 -11
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +19 -9
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { toACVMField } from '@aztec/simulator/client';
|
|
2
|
+
import type { ACIRCallback, ACVMField } from '@aztec/simulator/client';
|
|
3
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
|
|
5
|
+
import type { Oracle } from './oracle.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Builds legacy oracle name callbacks for pinned protocol contracts whose artifacts are committed and cannot be
|
|
9
|
+
* changed.
|
|
10
|
+
* TODO(F-416): Remove these aliases on v5 when protocol contracts are redeployed.
|
|
11
|
+
*/
|
|
12
|
+
export function buildLegacyOracleCallbacks(oracle: Oracle): ACIRCallback {
|
|
13
|
+
return {
|
|
14
|
+
// Simple prefix renames (privateXxx/utilityXxx → aztec_prv_/aztec_utl_)
|
|
15
|
+
utilityLog: (
|
|
16
|
+
level: ACVMField[],
|
|
17
|
+
message: ACVMField[],
|
|
18
|
+
_ignoredFieldsSize: ACVMField[],
|
|
19
|
+
fields: ACVMField[],
|
|
20
|
+
): Promise<ACVMField[]> => oracle.aztec_utl_log(level, message, _ignoredFieldsSize, fields),
|
|
21
|
+
utilityAssertCompatibleOracleVersion: (version: ACVMField[]): Promise<ACVMField[]> =>
|
|
22
|
+
oracle.aztec_utl_assertCompatibleOracleVersion(version),
|
|
23
|
+
utilityLoadCapsule: (
|
|
24
|
+
contractAddress: ACVMField[],
|
|
25
|
+
slot: ACVMField[],
|
|
26
|
+
tSize: ACVMField[],
|
|
27
|
+
): Promise<(ACVMField | ACVMField[])[]> =>
|
|
28
|
+
oracle.aztec_utl_getCapsule(contractAddress, slot, tSize, [toACVMField(AztecAddress.ZERO)]),
|
|
29
|
+
privateStoreInExecutionCache: (values: ACVMField[], hash: ACVMField[]): Promise<ACVMField[]> =>
|
|
30
|
+
oracle.aztec_prv_setHashPreimage(values, hash),
|
|
31
|
+
privateLoadFromExecutionCache: (returnsHash: ACVMField[]): Promise<ACVMField[][]> =>
|
|
32
|
+
oracle.aztec_prv_getHashPreimage(returnsHash),
|
|
33
|
+
privateCallPrivateFunction: (
|
|
34
|
+
contractAddress: ACVMField[],
|
|
35
|
+
functionSelector: ACVMField[],
|
|
36
|
+
argsHash: ACVMField[],
|
|
37
|
+
sideEffectCounter: ACVMField[],
|
|
38
|
+
isStaticCall: ACVMField[],
|
|
39
|
+
): Promise<ACVMField[][]> =>
|
|
40
|
+
oracle.aztec_prv_callPrivateFunction(
|
|
41
|
+
contractAddress,
|
|
42
|
+
functionSelector,
|
|
43
|
+
argsHash,
|
|
44
|
+
sideEffectCounter,
|
|
45
|
+
isStaticCall,
|
|
46
|
+
),
|
|
47
|
+
privateIsNullifierPending: (innerNullifier: ACVMField[], contractAddress: ACVMField[]): Promise<ACVMField[]> =>
|
|
48
|
+
oracle.aztec_prv_isNullifierPending(innerNullifier, contractAddress),
|
|
49
|
+
privateNotifyCreatedNullifier: (innerNullifier: ACVMField[]): Promise<ACVMField[]> =>
|
|
50
|
+
oracle.aztec_prv_notifyCreatedNullifier(innerNullifier),
|
|
51
|
+
privateNotifyCreatedContractClassLog: (
|
|
52
|
+
contractAddress: ACVMField[],
|
|
53
|
+
message: ACVMField[],
|
|
54
|
+
length: ACVMField[],
|
|
55
|
+
counter: ACVMField[],
|
|
56
|
+
): Promise<ACVMField[]> =>
|
|
57
|
+
oracle.aztec_prv_notifyCreatedContractClassLog(contractAddress, message, length, counter),
|
|
58
|
+
utilityGetUtilityContext: (): Promise<(ACVMField | ACVMField[])[]> => oracle.aztec_utl_getUtilityContext(),
|
|
59
|
+
utilityStorageRead: (
|
|
60
|
+
blockHash: ACVMField[],
|
|
61
|
+
contractAddress: ACVMField[],
|
|
62
|
+
startStorageSlot: ACVMField[],
|
|
63
|
+
numberOfElements: ACVMField[],
|
|
64
|
+
): Promise<ACVMField[][]> =>
|
|
65
|
+
oracle.aztec_utl_getFromPublicStorage(blockHash, contractAddress, startStorageSlot, numberOfElements),
|
|
66
|
+
utilityStoreCapsule: (
|
|
67
|
+
contractAddress: ACVMField[],
|
|
68
|
+
slot: ACVMField[],
|
|
69
|
+
capsule: ACVMField[],
|
|
70
|
+
): Promise<ACVMField[]> =>
|
|
71
|
+
oracle.aztec_utl_setCapsule(contractAddress, slot, capsule, [toACVMField(AztecAddress.ZERO)]),
|
|
72
|
+
utilityCopyCapsule: (
|
|
73
|
+
contractAddress: ACVMField[],
|
|
74
|
+
srcSlot: ACVMField[],
|
|
75
|
+
dstSlot: ACVMField[],
|
|
76
|
+
numEntries: ACVMField[],
|
|
77
|
+
): Promise<ACVMField[]> =>
|
|
78
|
+
oracle.aztec_utl_copyCapsule(contractAddress, srcSlot, dstSlot, numEntries, [toACVMField(AztecAddress.ZERO)]),
|
|
79
|
+
utilityDeleteCapsule: (contractAddress: ACVMField[], slot: ACVMField[]): Promise<ACVMField[]> =>
|
|
80
|
+
oracle.aztec_utl_deleteCapsule(contractAddress, slot, [toACVMField(AztecAddress.ZERO)]),
|
|
81
|
+
utilityGetL1ToL2MembershipWitness: (
|
|
82
|
+
contractAddress: ACVMField[],
|
|
83
|
+
messageHash: ACVMField[],
|
|
84
|
+
secret: ACVMField[],
|
|
85
|
+
): Promise<(ACVMField | ACVMField[])[]> =>
|
|
86
|
+
oracle.aztec_utl_getL1ToL2MembershipWitness(contractAddress, messageHash, secret),
|
|
87
|
+
// Renames (same signature, different oracle name)
|
|
88
|
+
privateNotifySetMinRevertibleSideEffectCounter: (counter: ACVMField[]): Promise<ACVMField[]> =>
|
|
89
|
+
oracle.aztec_prv_notifyRevertiblePhaseStart(counter),
|
|
90
|
+
// Signature changes: old 4-param oracles → new 1-param validatePublicCalldata
|
|
91
|
+
privateNotifyEnqueuedPublicFunctionCall: (
|
|
92
|
+
_contractAddress: ACVMField[],
|
|
93
|
+
calldataHash: ACVMField[],
|
|
94
|
+
_sideEffectCounter: ACVMField[],
|
|
95
|
+
_isStaticCall: ACVMField[],
|
|
96
|
+
): Promise<ACVMField[]> => oracle.aztec_prv_assertValidPublicCalldata(calldataHash),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -16,6 +16,7 @@ import { BlockHash } from '@aztec/stdlib/block';
|
|
|
16
16
|
import { ContractClassLog, ContractClassLogFields } from '@aztec/stdlib/logs';
|
|
17
17
|
|
|
18
18
|
import type { IMiscOracle, IPrivateExecutionOracle, IUtilityExecutionOracle } from './interfaces.js';
|
|
19
|
+
import { buildLegacyOracleCallbacks } from './legacy_oracle_mappings.js';
|
|
19
20
|
import { packAsHintedNote } from './note_packing_utils.js';
|
|
20
21
|
|
|
21
22
|
export class UnavailableOracleError extends Error {
|
|
@@ -26,6 +27,25 @@ export class UnavailableOracleError extends Error {
|
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* A data source that has all the apis required by Aztec.nr.
|
|
30
|
+
*
|
|
31
|
+
* ## Oracle naming conventions
|
|
32
|
+
*
|
|
33
|
+
* We try to keep oracle naming consistent, please see below the conventions we adhere to.
|
|
34
|
+
*
|
|
35
|
+
* Each oracle method name has the form `aztec_{scope}_{verb}{Object}`, where:
|
|
36
|
+
*
|
|
37
|
+
* - **Scope prefix** indicates the execution context required:
|
|
38
|
+
* - `aztec_prv_` — available only during private function execution.
|
|
39
|
+
* - `aztec_utl_` — available during both utility and private execution.
|
|
40
|
+
*
|
|
41
|
+
* - **Verb** signals the operation's semantics (verb-first, then object):
|
|
42
|
+
* - `get` — read / lookup / get data from oracle into contract.
|
|
43
|
+
* - `does`/`is`/`has` — predicate (returns boolean).
|
|
44
|
+
* - `emit`/`notify` — propagate data from contract to oracle.
|
|
45
|
+
* - `set` — contract driven oracle state mutation (capsules, execution cache, tagging, etc).
|
|
46
|
+
* - `call` — trigger nested execution (control flow).
|
|
47
|
+
* - `assert` — validate a condition, throw on failure.
|
|
48
|
+
* - Standalone verbs (`delete`, `copy`, `decrypt`, `log`, etc) are used when no generic verb fits.
|
|
29
49
|
*/
|
|
30
50
|
export class Oracle {
|
|
31
51
|
constructor(private handler: IMiscOracle | IUtilityExecutionOracle | IPrivateExecutionOracle) {}
|
|
@@ -85,11 +105,13 @@ export class Oracle {
|
|
|
85
105
|
});
|
|
86
106
|
|
|
87
107
|
// Build callback object and return it
|
|
88
|
-
|
|
108
|
+
const callback = oracleNames.reduce((acc, name) => {
|
|
89
109
|
const method = this[name as keyof Omit<Oracle, (typeof excludedProps)[number]>];
|
|
90
110
|
acc[name] = method.bind(this);
|
|
91
111
|
return acc;
|
|
92
112
|
}, {} as ACIRCallback);
|
|
113
|
+
|
|
114
|
+
return { ...callback, ...buildLegacyOracleCallbacks(this) };
|
|
93
115
|
}
|
|
94
116
|
|
|
95
117
|
// eslint-disable-next-line camelcase
|
|
@@ -105,14 +127,14 @@ export class Oracle {
|
|
|
105
127
|
}
|
|
106
128
|
|
|
107
129
|
// eslint-disable-next-line camelcase
|
|
108
|
-
|
|
109
|
-
this.handlerAsPrivate().
|
|
130
|
+
aztec_prv_setHashPreimage(values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
|
|
131
|
+
this.handlerAsPrivate().setHashPreimage(values.map(Fr.fromString), Fr.fromString(hash));
|
|
110
132
|
return Promise.resolve([]);
|
|
111
133
|
}
|
|
112
134
|
|
|
113
135
|
// eslint-disable-next-line camelcase
|
|
114
|
-
async
|
|
115
|
-
const values = await this.handlerAsPrivate().
|
|
136
|
+
async aztec_prv_getHashPreimage([returnsHash]: ACVMField[]): Promise<ACVMField[][]> {
|
|
137
|
+
const values = await this.handlerAsPrivate().getHashPreimage(Fr.fromString(returnsHash));
|
|
116
138
|
return [values.map(toACVMField)];
|
|
117
139
|
}
|
|
118
140
|
|
|
@@ -249,9 +271,9 @@ export class Oracle {
|
|
|
249
271
|
}
|
|
250
272
|
|
|
251
273
|
// eslint-disable-next-line camelcase
|
|
252
|
-
async
|
|
274
|
+
async aztec_utl_getPublicKeysAndPartialAddress([address]: ACVMField[]): Promise<(ACVMField | ACVMField[])[]> {
|
|
253
275
|
const parsedAddress = AztecAddress.fromField(Fr.fromString(address));
|
|
254
|
-
const result = await this.handlerAsUtility().
|
|
276
|
+
const result = await this.handlerAsUtility().getPublicKeysAndPartialAddress(parsedAddress);
|
|
255
277
|
|
|
256
278
|
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
257
279
|
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
@@ -377,8 +399,8 @@ export class Oracle {
|
|
|
377
399
|
}
|
|
378
400
|
|
|
379
401
|
// eslint-disable-next-line camelcase
|
|
380
|
-
async
|
|
381
|
-
const exists = await this.handlerAsUtility().
|
|
402
|
+
async aztec_utl_doesNullifierExist([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
|
|
403
|
+
const exists = await this.handlerAsUtility().doesNullifierExist(Fr.fromString(innerNullifier));
|
|
382
404
|
return [toACVMField(exists)];
|
|
383
405
|
}
|
|
384
406
|
|
|
@@ -397,13 +419,13 @@ export class Oracle {
|
|
|
397
419
|
}
|
|
398
420
|
|
|
399
421
|
// eslint-disable-next-line camelcase
|
|
400
|
-
async
|
|
422
|
+
async aztec_utl_getFromPublicStorage(
|
|
401
423
|
[blockHash]: ACVMField[],
|
|
402
424
|
[contractAddress]: ACVMField[],
|
|
403
425
|
[startStorageSlot]: ACVMField[],
|
|
404
426
|
[numberOfElements]: ACVMField[],
|
|
405
427
|
): Promise<ACVMField[][]> {
|
|
406
|
-
const values = await this.handlerAsUtility().
|
|
428
|
+
const values = await this.handlerAsUtility().getFromPublicStorage(
|
|
407
429
|
BlockHash.fromString(blockHash),
|
|
408
430
|
new AztecAddress(Fr.fromString(contractAddress)),
|
|
409
431
|
Fr.fromString(startStorageSlot),
|
|
@@ -461,50 +483,20 @@ export class Oracle {
|
|
|
461
483
|
}
|
|
462
484
|
|
|
463
485
|
// eslint-disable-next-line camelcase
|
|
464
|
-
async
|
|
465
|
-
|
|
466
|
-
[calldataHash]: ACVMField[],
|
|
467
|
-
[sideEffectCounter]: ACVMField[],
|
|
468
|
-
[isStaticCall]: ACVMField[],
|
|
469
|
-
): Promise<ACVMField[]> {
|
|
470
|
-
await this.handlerAsPrivate().notifyEnqueuedPublicFunctionCall(
|
|
471
|
-
AztecAddress.fromString(contractAddress),
|
|
472
|
-
Fr.fromString(calldataHash),
|
|
473
|
-
Fr.fromString(sideEffectCounter).toNumber(),
|
|
474
|
-
Fr.fromString(isStaticCall).toBool(),
|
|
475
|
-
);
|
|
486
|
+
async aztec_prv_assertValidPublicCalldata([calldataHash]: ACVMField[]): Promise<ACVMField[]> {
|
|
487
|
+
await this.handlerAsPrivate().assertValidPublicCalldata(Fr.fromString(calldataHash));
|
|
476
488
|
return [];
|
|
477
489
|
}
|
|
478
490
|
|
|
479
491
|
// eslint-disable-next-line camelcase
|
|
480
|
-
async
|
|
481
|
-
|
|
482
|
-
[calldataHash]: ACVMField[],
|
|
483
|
-
[sideEffectCounter]: ACVMField[],
|
|
484
|
-
[isStaticCall]: ACVMField[],
|
|
485
|
-
): Promise<ACVMField[]> {
|
|
486
|
-
await this.handlerAsPrivate().notifySetPublicTeardownFunctionCall(
|
|
487
|
-
AztecAddress.fromString(contractAddress),
|
|
488
|
-
Fr.fromString(calldataHash),
|
|
489
|
-
Fr.fromString(sideEffectCounter).toNumber(),
|
|
490
|
-
Fr.fromString(isStaticCall).toBool(),
|
|
491
|
-
);
|
|
492
|
-
return [];
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
// eslint-disable-next-line camelcase
|
|
496
|
-
async aztec_prv_notifySetMinRevertibleSideEffectCounter([minRevertibleSideEffectCounter]: ACVMField[]): Promise<
|
|
497
|
-
ACVMField[]
|
|
498
|
-
> {
|
|
499
|
-
await this.handlerAsPrivate().notifySetMinRevertibleSideEffectCounter(
|
|
500
|
-
Fr.fromString(minRevertibleSideEffectCounter).toNumber(),
|
|
501
|
-
);
|
|
492
|
+
async aztec_prv_notifyRevertiblePhaseStart([minRevertibleSideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
|
|
493
|
+
await this.handlerAsPrivate().notifyRevertiblePhaseStart(Fr.fromString(minRevertibleSideEffectCounter).toNumber());
|
|
502
494
|
return Promise.resolve([]);
|
|
503
495
|
}
|
|
504
496
|
|
|
505
497
|
// eslint-disable-next-line camelcase
|
|
506
|
-
async
|
|
507
|
-
const isRevertible = await this.handlerAsPrivate().
|
|
498
|
+
async aztec_prv_isExecutionInRevertiblePhase([sideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
|
|
499
|
+
const isRevertible = await this.handlerAsPrivate().isExecutionInRevertiblePhase(
|
|
508
500
|
Fr.fromString(sideEffectCounter).toNumber(),
|
|
509
501
|
);
|
|
510
502
|
return Promise.resolve([toACVMField(isRevertible)]);
|
|
@@ -520,8 +512,14 @@ export class Oracle {
|
|
|
520
512
|
}
|
|
521
513
|
|
|
522
514
|
// eslint-disable-next-line camelcase
|
|
523
|
-
async
|
|
524
|
-
|
|
515
|
+
async aztec_utl_getPendingTaggedLogs(
|
|
516
|
+
[pendingTaggedLogArrayBaseSlot]: ACVMField[],
|
|
517
|
+
[scope]: ACVMField[],
|
|
518
|
+
): Promise<ACVMField[]> {
|
|
519
|
+
await this.handlerAsUtility().getPendingTaggedLogs(
|
|
520
|
+
Fr.fromString(pendingTaggedLogArrayBaseSlot),
|
|
521
|
+
AztecAddress.fromString(scope),
|
|
522
|
+
);
|
|
525
523
|
return [];
|
|
526
524
|
}
|
|
527
525
|
|
|
@@ -530,53 +528,81 @@ export class Oracle {
|
|
|
530
528
|
[contractAddress]: ACVMField[],
|
|
531
529
|
[noteValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
532
530
|
[eventValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
531
|
+
[maxNotePackedLen]: ACVMField[],
|
|
532
|
+
[maxEventSerializedLen]: ACVMField[],
|
|
533
|
+
[scope]: ACVMField[],
|
|
533
534
|
): Promise<ACVMField[]> {
|
|
534
535
|
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
|
|
535
536
|
AztecAddress.fromString(contractAddress),
|
|
536
537
|
Fr.fromString(noteValidationRequestsArrayBaseSlot),
|
|
537
538
|
Fr.fromString(eventValidationRequestsArrayBaseSlot),
|
|
539
|
+
Fr.fromString(maxNotePackedLen).toNumber(),
|
|
540
|
+
Fr.fromString(maxEventSerializedLen).toNumber(),
|
|
541
|
+
AztecAddress.fromString(scope),
|
|
538
542
|
);
|
|
539
543
|
|
|
540
544
|
return [];
|
|
541
545
|
}
|
|
542
546
|
|
|
543
547
|
// eslint-disable-next-line camelcase
|
|
544
|
-
async
|
|
548
|
+
async aztec_utl_getLogsByTag(
|
|
545
549
|
[contractAddress]: ACVMField[],
|
|
546
550
|
[logRetrievalRequestsArrayBaseSlot]: ACVMField[],
|
|
547
551
|
[logRetrievalResponsesArrayBaseSlot]: ACVMField[],
|
|
552
|
+
[scope]: ACVMField[],
|
|
548
553
|
): Promise<ACVMField[]> {
|
|
549
|
-
await this.handlerAsUtility().
|
|
554
|
+
await this.handlerAsUtility().getLogsByTag(
|
|
550
555
|
AztecAddress.fromString(contractAddress),
|
|
551
556
|
Fr.fromString(logRetrievalRequestsArrayBaseSlot),
|
|
552
557
|
Fr.fromString(logRetrievalResponsesArrayBaseSlot),
|
|
558
|
+
AztecAddress.fromString(scope),
|
|
559
|
+
);
|
|
560
|
+
return [];
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// eslint-disable-next-line camelcase
|
|
564
|
+
async aztec_utl_getMessageContextsByTxHash(
|
|
565
|
+
[contractAddress]: ACVMField[],
|
|
566
|
+
[messageContextRequestsArrayBaseSlot]: ACVMField[],
|
|
567
|
+
[messageContextResponsesArrayBaseSlot]: ACVMField[],
|
|
568
|
+
[scope]: ACVMField[],
|
|
569
|
+
): Promise<ACVMField[]> {
|
|
570
|
+
await this.handlerAsUtility().getMessageContextsByTxHash(
|
|
571
|
+
AztecAddress.fromString(contractAddress),
|
|
572
|
+
Fr.fromString(messageContextRequestsArrayBaseSlot),
|
|
573
|
+
Fr.fromString(messageContextResponsesArrayBaseSlot),
|
|
574
|
+
AztecAddress.fromString(scope),
|
|
553
575
|
);
|
|
554
576
|
return [];
|
|
555
577
|
}
|
|
556
578
|
|
|
557
579
|
// eslint-disable-next-line camelcase
|
|
558
|
-
|
|
580
|
+
aztec_utl_setCapsule(
|
|
559
581
|
[contractAddress]: ACVMField[],
|
|
560
582
|
[slot]: ACVMField[],
|
|
561
583
|
capsule: ACVMField[],
|
|
584
|
+
[scope]: ACVMField[],
|
|
562
585
|
): Promise<ACVMField[]> {
|
|
563
|
-
|
|
586
|
+
this.handlerAsUtility().setCapsule(
|
|
564
587
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
565
588
|
Fr.fromString(slot),
|
|
566
589
|
capsule.map(Fr.fromString),
|
|
590
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
567
591
|
);
|
|
568
|
-
return [];
|
|
592
|
+
return Promise.resolve([]);
|
|
569
593
|
}
|
|
570
594
|
|
|
571
595
|
// eslint-disable-next-line camelcase
|
|
572
|
-
async
|
|
596
|
+
async aztec_utl_getCapsule(
|
|
573
597
|
[contractAddress]: ACVMField[],
|
|
574
598
|
[slot]: ACVMField[],
|
|
575
599
|
[tSize]: ACVMField[],
|
|
600
|
+
[scope]: ACVMField[],
|
|
576
601
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
577
|
-
const values = await this.handlerAsUtility().
|
|
602
|
+
const values = await this.handlerAsUtility().getCapsule(
|
|
578
603
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
579
604
|
Fr.fromString(slot),
|
|
605
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
580
606
|
);
|
|
581
607
|
|
|
582
608
|
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
@@ -591,12 +617,17 @@ export class Oracle {
|
|
|
591
617
|
}
|
|
592
618
|
|
|
593
619
|
// eslint-disable-next-line camelcase
|
|
594
|
-
|
|
595
|
-
|
|
620
|
+
aztec_utl_deleteCapsule(
|
|
621
|
+
[contractAddress]: ACVMField[],
|
|
622
|
+
[slot]: ACVMField[],
|
|
623
|
+
[scope]: ACVMField[],
|
|
624
|
+
): Promise<ACVMField[]> {
|
|
625
|
+
this.handlerAsUtility().deleteCapsule(
|
|
596
626
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
597
627
|
Fr.fromString(slot),
|
|
628
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
598
629
|
);
|
|
599
|
-
return [];
|
|
630
|
+
return Promise.resolve([]);
|
|
600
631
|
}
|
|
601
632
|
|
|
602
633
|
// eslint-disable-next-line camelcase
|
|
@@ -605,18 +636,20 @@ export class Oracle {
|
|
|
605
636
|
[srcSlot]: ACVMField[],
|
|
606
637
|
[dstSlot]: ACVMField[],
|
|
607
638
|
[numEntries]: ACVMField[],
|
|
639
|
+
[scope]: ACVMField[],
|
|
608
640
|
): Promise<ACVMField[]> {
|
|
609
641
|
await this.handlerAsUtility().copyCapsule(
|
|
610
642
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
611
643
|
Fr.fromString(srcSlot),
|
|
612
644
|
Fr.fromString(dstSlot),
|
|
613
645
|
Fr.fromString(numEntries).toNumber(),
|
|
646
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
614
647
|
);
|
|
615
648
|
return [];
|
|
616
649
|
}
|
|
617
650
|
|
|
618
651
|
// eslint-disable-next-line camelcase
|
|
619
|
-
async
|
|
652
|
+
async aztec_utl_decryptAes128(
|
|
620
653
|
ciphertextBVecStorage: ACVMField[],
|
|
621
654
|
[ciphertextLength]: ACVMField[],
|
|
622
655
|
iv: ACVMField[],
|
|
@@ -626,8 +659,15 @@ export class Oracle {
|
|
|
626
659
|
const ivBuffer = fromUintArray(iv, 8);
|
|
627
660
|
const symKeyBuffer = fromUintArray(symKey, 8);
|
|
628
661
|
|
|
629
|
-
|
|
630
|
-
|
|
662
|
+
// Noir Option<BoundedVec> is encoded as [is_some: Field, storage: Field[], length: Field].
|
|
663
|
+
try {
|
|
664
|
+
const plaintext = await this.handlerAsUtility().decryptAes128(ciphertext, ivBuffer, symKeyBuffer);
|
|
665
|
+
const [storage, length] = bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
|
|
666
|
+
return [toACVMField(1), storage, length];
|
|
667
|
+
} catch {
|
|
668
|
+
const zeroStorage = Array(ciphertextBVecStorage.length).fill(toACVMField(0));
|
|
669
|
+
return [toACVMField(0), zeroStorage, toACVMField(0)];
|
|
670
|
+
}
|
|
631
671
|
}
|
|
632
672
|
|
|
633
673
|
// eslint-disable-next-line camelcase
|
|
@@ -636,17 +676,33 @@ export class Oracle {
|
|
|
636
676
|
[ephPKField0]: ACVMField[],
|
|
637
677
|
[ephPKField1]: ACVMField[],
|
|
638
678
|
[ephPKField2]: ACVMField[],
|
|
679
|
+
[contractAddress]: ACVMField[],
|
|
639
680
|
): Promise<ACVMField[]> {
|
|
640
681
|
const secret = await this.handlerAsUtility().getSharedSecret(
|
|
641
682
|
AztecAddress.fromField(Fr.fromString(address)),
|
|
642
683
|
Point.fromFields([ephPKField0, ephPKField1, ephPKField2].map(Fr.fromString)),
|
|
684
|
+
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
685
|
+
);
|
|
686
|
+
return [toACVMField(secret)];
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// eslint-disable-next-line camelcase
|
|
690
|
+
aztec_utl_setContractSyncCacheInvalid(
|
|
691
|
+
[contractAddress]: ACVMField[],
|
|
692
|
+
scopes: ACVMField[],
|
|
693
|
+
[scopeCount]: ACVMField[],
|
|
694
|
+
): Promise<ACVMField[]> {
|
|
695
|
+
const scopeAddresses = scopes.slice(0, +scopeCount).map(s => AztecAddress.fromField(Fr.fromString(s)));
|
|
696
|
+
this.handlerAsUtility().setContractSyncCacheInvalid(
|
|
697
|
+
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
698
|
+
scopeAddresses,
|
|
643
699
|
);
|
|
644
|
-
return
|
|
700
|
+
return Promise.resolve([]);
|
|
645
701
|
}
|
|
646
702
|
|
|
647
703
|
// eslint-disable-next-line camelcase
|
|
648
704
|
async aztec_utl_emitOffchainEffect(data: ACVMField[]) {
|
|
649
|
-
await this.
|
|
705
|
+
await this.handlerAsUtility().emitOffchainEffect(data.map(Fr.fromString));
|
|
650
706
|
return [];
|
|
651
707
|
}
|
|
652
708
|
|
|
@@ -76,12 +76,12 @@ export async function executePrivateFunction(
|
|
|
76
76
|
|
|
77
77
|
const contractClassLogs = privateExecutionOracle.getContractClassLogs();
|
|
78
78
|
|
|
79
|
-
const rawReturnValues = await privateExecutionOracle.
|
|
79
|
+
const rawReturnValues = await privateExecutionOracle.getHashPreimage(publicInputs.returnsHash);
|
|
80
80
|
|
|
81
81
|
const newNotes = privateExecutionOracle.getNewNotes();
|
|
82
82
|
const noteHashNullifierCounterMap = privateExecutionOracle.getNoteHashNullifierCounterMap();
|
|
83
83
|
const offchainEffects = privateExecutionOracle.getOffchainEffects();
|
|
84
|
-
const
|
|
84
|
+
const taggingIndexRanges = privateExecutionOracle.getUsedTaggingIndexRanges();
|
|
85
85
|
const nestedExecutionResults = privateExecutionOracle.getNestedExecutionResults();
|
|
86
86
|
|
|
87
87
|
let timerSubtractionList = nestedExecutionResults;
|
|
@@ -103,8 +103,8 @@ export async function executePrivateFunction(
|
|
|
103
103
|
newNotes,
|
|
104
104
|
noteHashNullifierCounterMap,
|
|
105
105
|
rawReturnValues,
|
|
106
|
-
offchainEffects,
|
|
107
|
-
|
|
106
|
+
offchainEffects.map(e => ({ data: e.data })),
|
|
107
|
+
taggingIndexRanges,
|
|
108
108
|
nestedExecutionResults,
|
|
109
109
|
contractClassLogs,
|
|
110
110
|
{
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
15
15
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
16
16
|
import { PrivateContextInputs } from '@aztec/stdlib/kernel';
|
|
17
|
-
import { type ContractClassLog, ExtendedDirectionalAppTaggingSecret, type
|
|
17
|
+
import { type ContractClassLog, ExtendedDirectionalAppTaggingSecret, type TaggingIndexRange } from '@aztec/stdlib/logs';
|
|
18
18
|
import { Tag } from '@aztec/stdlib/logs';
|
|
19
19
|
import { Note, type NoteStatus } from '@aztec/stdlib/note';
|
|
20
20
|
import {
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
} from '@aztec/stdlib/tx';
|
|
27
27
|
|
|
28
28
|
import type { AccessScopes } from '../../access_scopes.js';
|
|
29
|
-
import type { ContractSyncService } from '../../contract_sync/contract_sync_service.js';
|
|
30
29
|
import { NoteService } from '../../notes/note_service.js';
|
|
31
30
|
import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
|
|
32
31
|
import { syncSenderTaggingIndexes } from '../../tagging/index.js';
|
|
@@ -49,7 +48,6 @@ export type PrivateExecutionOracleArgs = Omit<UtilityExecutionOracleArgs, 'contr
|
|
|
49
48
|
noteCache: ExecutionNoteCache;
|
|
50
49
|
taggingIndexCache: ExecutionTaggingIndexCache;
|
|
51
50
|
senderTaggingStore: SenderTaggingStore;
|
|
52
|
-
contractSyncService: ContractSyncService;
|
|
53
51
|
totalPublicCalldataCount?: number;
|
|
54
52
|
sideEffectCounter?: number;
|
|
55
53
|
senderForTags?: AztecAddress;
|
|
@@ -73,7 +71,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
73
71
|
private newNotes: NoteAndSlot[] = [];
|
|
74
72
|
private noteHashNullifierCounterMap: Map<number, number> = new Map();
|
|
75
73
|
private contractClassLogs: CountedContractClassLog[] = [];
|
|
76
|
-
private offchainEffects: { data: Fr[] }[] = [];
|
|
77
74
|
private nestedExecutionResults: PrivateCallExecutionResult[] = [];
|
|
78
75
|
|
|
79
76
|
private readonly argsHash: Fr;
|
|
@@ -84,7 +81,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
84
81
|
private readonly noteCache: ExecutionNoteCache;
|
|
85
82
|
private readonly taggingIndexCache: ExecutionTaggingIndexCache;
|
|
86
83
|
private readonly senderTaggingStore: SenderTaggingStore;
|
|
87
|
-
private readonly contractSyncService: ContractSyncService;
|
|
88
84
|
private totalPublicCalldataCount: number;
|
|
89
85
|
protected sideEffectCounter: number;
|
|
90
86
|
private senderForTags?: AztecAddress;
|
|
@@ -104,7 +100,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
104
100
|
this.noteCache = args.noteCache;
|
|
105
101
|
this.taggingIndexCache = args.taggingIndexCache;
|
|
106
102
|
this.senderTaggingStore = args.senderTaggingStore;
|
|
107
|
-
this.contractSyncService = args.contractSyncService;
|
|
108
103
|
this.totalPublicCalldataCount = args.totalPublicCalldataCount ?? 0;
|
|
109
104
|
this.sideEffectCounter = args.sideEffectCounter ?? 0;
|
|
110
105
|
this.senderForTags = args.senderForTags;
|
|
@@ -159,17 +154,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
159
154
|
}
|
|
160
155
|
|
|
161
156
|
/**
|
|
162
|
-
*
|
|
157
|
+
* Returns the tagging index ranges that were used in this execution (and that need to be stored in the db).
|
|
163
158
|
*/
|
|
164
|
-
public
|
|
165
|
-
return this.
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Returns the pre-tags that were used in this execution (and that need to be stored in the db).
|
|
170
|
-
*/
|
|
171
|
-
public getUsedPreTags(): PreTag[] {
|
|
172
|
-
return this.taggingIndexCache.getUsedPreTags();
|
|
159
|
+
public getUsedTaggingIndexRanges(): TaggingIndexRange[] {
|
|
160
|
+
return this.taggingIndexCache.getUsedTaggingIndexRanges();
|
|
173
161
|
}
|
|
174
162
|
|
|
175
163
|
/**
|
|
@@ -277,7 +265,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
277
265
|
* @param values - Values to store.
|
|
278
266
|
* @returns The hash of the values.
|
|
279
267
|
*/
|
|
280
|
-
public
|
|
268
|
+
public setHashPreimage(values: Fr[], hash: Fr) {
|
|
281
269
|
return this.executionCache.store(values, hash);
|
|
282
270
|
}
|
|
283
271
|
|
|
@@ -286,7 +274,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
286
274
|
* @param hash - Hash of the values.
|
|
287
275
|
* @returns The values.
|
|
288
276
|
*/
|
|
289
|
-
public
|
|
277
|
+
public getHashPreimage(hash: Fr): Promise<Fr[]> {
|
|
290
278
|
const preimage = this.executionCache.getPreimage(hash);
|
|
291
279
|
if (!preimage) {
|
|
292
280
|
throw new Error(`Preimage for hash ${hash.toString()} not found in cache`);
|
|
@@ -294,7 +282,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
294
282
|
return Promise.resolve(preimage);
|
|
295
283
|
}
|
|
296
284
|
|
|
297
|
-
override async
|
|
285
|
+
override async doesNullifierExist(innerNullifier: Fr): Promise<boolean> {
|
|
298
286
|
// This oracle must be overridden because while utility execution can only meaningfully check if a nullifier exists
|
|
299
287
|
// in the synched block, during private execution there's also the possibility of it being pending, i.e. created
|
|
300
288
|
// in the current transaction.
|
|
@@ -307,7 +295,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
307
295
|
|
|
308
296
|
return (
|
|
309
297
|
this.noteCache.getNullifiers(this.contractAddress).has(nullifier) ||
|
|
310
|
-
(await super.
|
|
298
|
+
(await super.doesNullifierExist(innerNullifier))
|
|
311
299
|
);
|
|
312
300
|
}
|
|
313
301
|
|
|
@@ -567,8 +555,9 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
567
555
|
senderTaggingStore: this.senderTaggingStore,
|
|
568
556
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
569
557
|
senderAddressBookStore: this.senderAddressBookStore,
|
|
570
|
-
|
|
558
|
+
capsuleService: this.capsuleService,
|
|
571
559
|
privateEventStore: this.privateEventStore,
|
|
560
|
+
messageContextService: this.messageContextService,
|
|
572
561
|
contractSyncService: this.contractSyncService,
|
|
573
562
|
jobId: this.jobId,
|
|
574
563
|
totalPublicCalldataCount: this.totalPublicCalldataCount,
|
|
@@ -608,7 +597,8 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
608
597
|
};
|
|
609
598
|
}
|
|
610
599
|
|
|
611
|
-
|
|
600
|
+
/** Validates the calldata preimage exists in the cache and checks cumulative calldata size is within limits. */
|
|
601
|
+
public assertValidPublicCalldata(calldataHash: Fr) {
|
|
612
602
|
const calldata = this.executionCache.getPreimage(calldataHash);
|
|
613
603
|
if (!calldata) {
|
|
614
604
|
throw new Error('Calldata for public call not found in cache');
|
|
@@ -618,47 +608,14 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
618
608
|
if (this.totalPublicCalldataCount > MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS) {
|
|
619
609
|
throw new Error(`Too many total args to all enqueued public calls! (> ${MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS})`);
|
|
620
610
|
}
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* Verify relevant information when a public function is enqueued.
|
|
625
|
-
* @param targetContractAddress - The address of the contract to call.
|
|
626
|
-
* @param calldataHash - The hash of the function selector and arguments.
|
|
627
|
-
* @param sideEffectCounter - The side effect counter at the start of the call.
|
|
628
|
-
* @param isStaticCall - Whether the call is a static call.
|
|
629
|
-
*/
|
|
630
|
-
public notifyEnqueuedPublicFunctionCall(
|
|
631
|
-
_targetContractAddress: AztecAddress,
|
|
632
|
-
calldataHash: Fr,
|
|
633
|
-
_sideEffectCounter: number,
|
|
634
|
-
_isStaticCall: boolean,
|
|
635
|
-
) {
|
|
636
|
-
this.#onNewPublicFunctionCall(calldataHash);
|
|
637
611
|
return Promise.resolve();
|
|
638
612
|
}
|
|
639
613
|
|
|
640
|
-
|
|
641
|
-
* Verify relevant information when a public teardown function is set.
|
|
642
|
-
* @param targetContractAddress - The address of the contract to call.
|
|
643
|
-
* @param argsHash - The arguments hash to pass to the function.
|
|
644
|
-
* @param sideEffectCounter - The side effect counter at the start of the call.
|
|
645
|
-
* @param isStaticCall - Whether the call is a static call.
|
|
646
|
-
*/
|
|
647
|
-
public notifySetPublicTeardownFunctionCall(
|
|
648
|
-
_targetContractAddress: AztecAddress,
|
|
649
|
-
calldataHash: Fr,
|
|
650
|
-
_sideEffectCounter: number,
|
|
651
|
-
_isStaticCall: boolean,
|
|
652
|
-
) {
|
|
653
|
-
this.#onNewPublicFunctionCall(calldataHash);
|
|
654
|
-
return Promise.resolve();
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
public notifySetMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void> {
|
|
614
|
+
public notifyRevertiblePhaseStart(minRevertibleSideEffectCounter: number): Promise<void> {
|
|
658
615
|
return this.noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
|
|
659
616
|
}
|
|
660
617
|
|
|
661
|
-
public
|
|
618
|
+
public isExecutionInRevertiblePhase(sideEffectCounter: number): Promise<boolean> {
|
|
662
619
|
return Promise.resolve(this.noteCache.isSideEffectCounterRevertible(sideEffectCounter));
|
|
663
620
|
}
|
|
664
621
|
|
|
@@ -685,9 +642,4 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
685
642
|
public getDebugFunctionName() {
|
|
686
643
|
return this.contractStore.getDebugFunctionName(this.contractAddress, this.callContext.functionSelector);
|
|
687
644
|
}
|
|
688
|
-
|
|
689
|
-
public emitOffchainEffect(data: Fr[]): Promise<void> {
|
|
690
|
-
this.offchainEffects.push({ data });
|
|
691
|
-
return Promise.resolve();
|
|
692
|
-
}
|
|
693
645
|
}
|