@aztec/pxe 0.0.1-commit.5de5ca79e → 0.0.1-commit.6201a7b05
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/bin/check_oracle_version.js +4 -4
- package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
- package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
- package/dest/block_synchronizer/block_stream_source.js +37 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts +6 -2
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +30 -10
- package/dest/config/index.d.ts +1 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +7 -14
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +6 -4
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +10 -7
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -4
- 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 +3 -6
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -4
- 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 +3 -6
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +31 -20
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +28 -23
- package/dest/contract_function_simulator/oracle/oracle.d.ts +50 -20
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +157 -41
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +16 -15
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +36 -21
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +58 -42
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +205 -96
- package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +20 -3
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +3 -0
- 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 +3 -4
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +37 -35
- package/dest/contract_sync/helpers.d.ts +2 -3
- package/dest/contract_sync/helpers.d.ts.map +1 -1
- package/dest/contract_sync/helpers.js +7 -2
- package/dest/debug/pxe_debug_utils.d.ts +3 -3
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.d.ts +1 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +0 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +2 -2
- package/dest/entrypoints/client/lazy/index.d.ts +1 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +0 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +2 -2
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -1
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/pxe_creation_options.js +3 -1
- package/dest/entrypoints/server/index.d.ts +2 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +1 -2
- package/dest/entrypoints/server/utils.d.ts +2 -2
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +2 -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 +26 -5
- package/dest/events/private_event_filter_validator.d.ts +3 -2
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +15 -0
- package/dest/logs/log_service.d.ts +7 -8
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +27 -37
- package/dest/messages/message_context_service.d.ts +3 -3
- package/dest/messages/message_context_service.d.ts.map +1 -1
- package/dest/messages/message_context_service.js +3 -3
- package/dest/notes/note_service.d.ts +4 -5
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +14 -5
- package/dest/notes_filter.d.ts +2 -3
- package/dest/notes_filter.d.ts.map +1 -1
- package/dest/oracle_version.d.ts +4 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +20 -10
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +4 -7
- package/dest/private_kernel/private_kernel_oracle.d.ts +5 -5
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +12 -15
- package/dest/pxe.d.ts +19 -8
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +55 -24
- package/dest/storage/anchor_block_store/anchor_block_store.js +1 -1
- package/dest/storage/capsule_store/capsule_service.d.ts +21 -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 +36 -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/contract_store/contract_store.d.ts +1 -1
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +4 -2
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +1 -1
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +2 -2
- package/dest/storage/private_event_store/private_event_store.d.ts +1 -1
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +3 -0
- package/dest/storage/private_event_store/stored_private_event.js +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +2 -2
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +2 -16
- package/package.json +16 -16
- package/src/bin/check_oracle_version.ts +4 -4
- package/src/block_synchronizer/block_stream_source.ts +52 -0
- package/src/block_synchronizer/block_synchronizer.ts +33 -11
- package/src/config/index.ts +2 -8
- package/src/contract_function_simulator/contract_function_simulator.ts +13 -10
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -4
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -4
- package/src/contract_function_simulator/oracle/interfaces.ts +46 -18
- package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +20 -51
- package/src/contract_function_simulator/oracle/oracle.ts +222 -36
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +49 -23
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +345 -123
- package/src/contract_function_simulator/pick_notes.ts +22 -3
- package/src/contract_function_simulator/proxied_contract_data_source.ts +8 -1
- package/src/contract_logging.ts +18 -5
- package/src/contract_sync/contract_sync_service.ts +64 -69
- package/src/contract_sync/helpers.ts +4 -4
- package/src/debug/pxe_debug_utils.ts +3 -3
- package/src/entrypoints/client/bundle/index.ts +0 -1
- package/src/entrypoints/client/bundle/utils.ts +2 -3
- package/src/entrypoints/client/lazy/index.ts +0 -1
- package/src/entrypoints/client/lazy/utils.ts +2 -3
- package/src/entrypoints/pxe_creation_options.ts +7 -0
- package/src/entrypoints/server/index.ts +1 -2
- package/src/entrypoints/server/utils.ts +2 -3
- package/src/events/event_service.ts +30 -5
- package/src/events/private_event_filter_validator.ts +21 -1
- package/src/logs/log_service.ts +57 -78
- package/src/messages/message_context_service.ts +3 -4
- package/src/notes/note_service.ts +18 -8
- package/src/notes_filter.ts +1 -3
- package/src/oracle_version.ts +20 -10
- package/src/private_kernel/private_kernel_execution_prover.ts +4 -9
- package/src/private_kernel/private_kernel_oracle.ts +14 -14
- package/src/pxe.ts +96 -33
- package/src/storage/anchor_block_store/anchor_block_store.ts +1 -1
- package/src/storage/capsule_store/capsule_service.ts +90 -0
- package/src/storage/capsule_store/capsule_store.ts +44 -26
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/contract_store/contract_store.ts +8 -6
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +2 -5
- package/src/storage/private_event_store/private_event_store.ts +4 -0
- package/src/storage/private_event_store/stored_private_event.ts +1 -1
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +5 -15
- package/dest/access_scopes.d.ts +0 -9
- package/dest/access_scopes.d.ts.map +0 -1
- package/dest/access_scopes.js +0 -6
- package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts +0 -16
- package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts.map +0 -1
- package/dest/contract_function_simulator/noir-structs/message_tx_context.js +0 -57
- package/src/access_scopes.ts +0 -9
- package/src/contract_function_simulator/noir-structs/message_tx_context.ts +0 -55
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toACVMField } from '@aztec/simulator/client';
|
|
2
2
|
import type { ACIRCallback, ACVMField } from '@aztec/simulator/client';
|
|
3
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
4
|
|
|
4
5
|
import type { Oracle } from './oracle.js';
|
|
5
6
|
|
|
@@ -9,6 +10,8 @@ import type { Oracle } from './oracle.js';
|
|
|
9
10
|
* TODO(F-416): Remove these aliases on v5 when protocol contracts are redeployed.
|
|
10
11
|
*/
|
|
11
12
|
export function buildLegacyOracleCallbacks(oracle: Oracle): ACIRCallback {
|
|
13
|
+
// If you are about to add a new mapping ensure that the old oracle name is different from the new one - this can
|
|
14
|
+
// commonly occur when only the args are getting modified.
|
|
12
15
|
return {
|
|
13
16
|
// Simple prefix renames (privateXxx/utilityXxx → aztec_prv_/aztec_utl_)
|
|
14
17
|
utilityLog: (
|
|
@@ -18,16 +21,21 @@ export function buildLegacyOracleCallbacks(oracle: Oracle): ACIRCallback {
|
|
|
18
21
|
fields: ACVMField[],
|
|
19
22
|
): Promise<ACVMField[]> => oracle.aztec_utl_log(level, message, _ignoredFieldsSize, fields),
|
|
20
23
|
utilityAssertCompatibleOracleVersion: (version: ACVMField[]): Promise<ACVMField[]> =>
|
|
21
|
-
oracle.
|
|
24
|
+
oracle.aztec_utl_assertCompatibleOracleVersionV2(version, [toACVMField(0)]),
|
|
25
|
+
// Old 1-arg oracle before minor/major split. Maps to V2 with minor=0.
|
|
26
|
+
// eslint-disable-next-line camelcase
|
|
27
|
+
aztec_utl_assertCompatibleOracleVersion: (version: ACVMField[]): Promise<ACVMField[]> =>
|
|
28
|
+
oracle.aztec_utl_assertCompatibleOracleVersionV2(version, [toACVMField(0)]),
|
|
22
29
|
utilityLoadCapsule: (
|
|
23
30
|
contractAddress: ACVMField[],
|
|
24
31
|
slot: ACVMField[],
|
|
25
32
|
tSize: ACVMField[],
|
|
26
|
-
): Promise<(ACVMField | ACVMField[])[]> =>
|
|
33
|
+
): Promise<(ACVMField | ACVMField[])[]> =>
|
|
34
|
+
oracle.aztec_utl_getCapsule(contractAddress, slot, tSize, [toACVMField(AztecAddress.ZERO)]),
|
|
27
35
|
privateStoreInExecutionCache: (values: ACVMField[], hash: ACVMField[]): Promise<ACVMField[]> =>
|
|
28
|
-
oracle.
|
|
36
|
+
oracle.aztec_prv_setHashPreimage(values, hash),
|
|
29
37
|
privateLoadFromExecutionCache: (returnsHash: ACVMField[]): Promise<ACVMField[][]> =>
|
|
30
|
-
oracle.
|
|
38
|
+
oracle.aztec_prv_getHashPreimage(returnsHash),
|
|
31
39
|
privateCallPrivateFunction: (
|
|
32
40
|
contractAddress: ACVMField[],
|
|
33
41
|
functionSelector: ACVMField[],
|
|
@@ -60,76 +68,37 @@ export function buildLegacyOracleCallbacks(oracle: Oracle): ACIRCallback {
|
|
|
60
68
|
startStorageSlot: ACVMField[],
|
|
61
69
|
numberOfElements: ACVMField[],
|
|
62
70
|
): Promise<ACVMField[][]> =>
|
|
63
|
-
oracle.
|
|
71
|
+
oracle.aztec_utl_getFromPublicStorage(blockHash, contractAddress, startStorageSlot, numberOfElements),
|
|
64
72
|
utilityStoreCapsule: (
|
|
65
73
|
contractAddress: ACVMField[],
|
|
66
74
|
slot: ACVMField[],
|
|
67
75
|
capsule: ACVMField[],
|
|
68
|
-
): Promise<ACVMField[]> =>
|
|
76
|
+
): Promise<ACVMField[]> =>
|
|
77
|
+
oracle.aztec_utl_setCapsule(contractAddress, slot, capsule, [toACVMField(AztecAddress.ZERO)]),
|
|
69
78
|
utilityCopyCapsule: (
|
|
70
79
|
contractAddress: ACVMField[],
|
|
71
80
|
srcSlot: ACVMField[],
|
|
72
81
|
dstSlot: ACVMField[],
|
|
73
82
|
numEntries: ACVMField[],
|
|
74
|
-
): Promise<ACVMField[]> => oracle.aztec_utl_copyCapsule(contractAddress, srcSlot, dstSlot, numEntries),
|
|
75
|
-
utilityDeleteCapsule: (contractAddress: ACVMField[], slot: ACVMField[]): Promise<ACVMField[]> =>
|
|
76
|
-
oracle.aztec_utl_deleteCapsule(contractAddress, slot),
|
|
77
|
-
utilityGetSharedSecret: (
|
|
78
|
-
address: ACVMField[],
|
|
79
|
-
ephPKField0: ACVMField[],
|
|
80
|
-
ephPKField1: ACVMField[],
|
|
81
|
-
ephPKField2: ACVMField[],
|
|
82
|
-
): Promise<ACVMField[]> => oracle.aztec_utl_getSharedSecret(address, ephPKField0, ephPKField1, ephPKField2),
|
|
83
|
-
utilityFetchTaggedLogs: (pendingTaggedLogArrayBaseSlot: ACVMField[]): Promise<ACVMField[]> =>
|
|
84
|
-
oracle.aztec_utl_fetchTaggedLogs(pendingTaggedLogArrayBaseSlot),
|
|
85
|
-
utilityBulkRetrieveLogs: (
|
|
86
|
-
contractAddress: ACVMField[],
|
|
87
|
-
logRetrievalRequestsArrayBaseSlot: ACVMField[],
|
|
88
|
-
logRetrievalResponsesArrayBaseSlot: ACVMField[],
|
|
89
83
|
): Promise<ACVMField[]> =>
|
|
90
|
-
oracle.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
logRetrievalResponsesArrayBaseSlot,
|
|
94
|
-
),
|
|
84
|
+
oracle.aztec_utl_copyCapsule(contractAddress, srcSlot, dstSlot, numEntries, [toACVMField(AztecAddress.ZERO)]),
|
|
85
|
+
utilityDeleteCapsule: (contractAddress: ACVMField[], slot: ACVMField[]): Promise<ACVMField[]> =>
|
|
86
|
+
oracle.aztec_utl_deleteCapsule(contractAddress, slot, [toACVMField(AztecAddress.ZERO)]),
|
|
95
87
|
utilityGetL1ToL2MembershipWitness: (
|
|
96
88
|
contractAddress: ACVMField[],
|
|
97
89
|
messageHash: ACVMField[],
|
|
98
90
|
secret: ACVMField[],
|
|
99
91
|
): Promise<(ACVMField | ACVMField[])[]> =>
|
|
100
92
|
oracle.aztec_utl_getL1ToL2MembershipWitness(contractAddress, messageHash, secret),
|
|
101
|
-
utilityEmitOffchainEffect: (data: ACVMField[]): Promise<ACVMField[]> => oracle.aztec_utl_emitOffchainEffect(data),
|
|
102
|
-
// Adapter: old 3-param signature → new 5-param with injected constants.
|
|
103
|
-
// Values derived from: MAX_MESSAGE_CONTENT_LEN(11) - RESERVED_FIELDS (3 for notes, 1 for events).
|
|
104
|
-
utilityValidateAndStoreEnqueuedNotesAndEvents: (
|
|
105
|
-
contractAddress: ACVMField[],
|
|
106
|
-
noteValidationRequestsArrayBaseSlot: ACVMField[],
|
|
107
|
-
eventValidationRequestsArrayBaseSlot: ACVMField[],
|
|
108
|
-
): Promise<ACVMField[]> =>
|
|
109
|
-
oracle.aztec_utl_validateAndStoreEnqueuedNotesAndEvents(
|
|
110
|
-
contractAddress,
|
|
111
|
-
noteValidationRequestsArrayBaseSlot,
|
|
112
|
-
eventValidationRequestsArrayBaseSlot,
|
|
113
|
-
[new Fr(8).toString()],
|
|
114
|
-
[new Fr(10).toString()],
|
|
115
|
-
),
|
|
116
93
|
// Renames (same signature, different oracle name)
|
|
117
94
|
privateNotifySetMinRevertibleSideEffectCounter: (counter: ACVMField[]): Promise<ACVMField[]> =>
|
|
118
95
|
oracle.aztec_prv_notifyRevertiblePhaseStart(counter),
|
|
119
|
-
privateIsSideEffectCounterRevertible: (sideEffectCounter: ACVMField[]): Promise<ACVMField[]> =>
|
|
120
|
-
oracle.aztec_prv_inRevertiblePhase(sideEffectCounter),
|
|
121
96
|
// Signature changes: old 4-param oracles → new 1-param validatePublicCalldata
|
|
122
97
|
privateNotifyEnqueuedPublicFunctionCall: (
|
|
123
98
|
_contractAddress: ACVMField[],
|
|
124
99
|
calldataHash: ACVMField[],
|
|
125
100
|
_sideEffectCounter: ACVMField[],
|
|
126
101
|
_isStaticCall: ACVMField[],
|
|
127
|
-
): Promise<ACVMField[]> => oracle.
|
|
128
|
-
privateNotifySetPublicTeardownFunctionCall: (
|
|
129
|
-
_contractAddress: ACVMField[],
|
|
130
|
-
calldataHash: ACVMField[],
|
|
131
|
-
_sideEffectCounter: ACVMField[],
|
|
132
|
-
_isStaticCall: ACVMField[],
|
|
133
|
-
): Promise<ACVMField[]> => oracle.aztec_prv_validatePublicCalldata(calldataHash),
|
|
102
|
+
): Promise<ACVMField[]> => oracle.aztec_prv_assertValidPublicCalldata(calldataHash),
|
|
134
103
|
};
|
|
135
104
|
}
|
|
@@ -15,6 +15,7 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
15
15
|
import { BlockHash } from '@aztec/stdlib/block';
|
|
16
16
|
import { ContractClassLog, ContractClassLogFields } from '@aztec/stdlib/logs';
|
|
17
17
|
|
|
18
|
+
import { ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR } from '../../oracle_version.js';
|
|
18
19
|
import type { IMiscOracle, IPrivateExecutionOracle, IUtilityExecutionOracle } from './interfaces.js';
|
|
19
20
|
import { buildLegacyOracleCallbacks } from './legacy_oracle_mappings.js';
|
|
20
21
|
import { packAsHintedNote } from './note_packing_utils.js';
|
|
@@ -27,6 +28,25 @@ export class UnavailableOracleError extends Error {
|
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* A data source that has all the apis required by Aztec.nr.
|
|
31
|
+
*
|
|
32
|
+
* ## Oracle naming conventions
|
|
33
|
+
*
|
|
34
|
+
* We try to keep oracle naming consistent, please see below the conventions we adhere to.
|
|
35
|
+
*
|
|
36
|
+
* Each oracle method name has the form `aztec_{scope}_{verb}{Object}`, where:
|
|
37
|
+
*
|
|
38
|
+
* - **Scope prefix** indicates the execution context required:
|
|
39
|
+
* - `aztec_prv_` — available only during private function execution.
|
|
40
|
+
* - `aztec_utl_` — available during both utility and private execution.
|
|
41
|
+
*
|
|
42
|
+
* - **Verb** signals the operation's semantics (verb-first, then object):
|
|
43
|
+
* - `get` — read / lookup / get data from oracle into contract.
|
|
44
|
+
* - `does`/`is`/`has` — predicate (returns boolean).
|
|
45
|
+
* - `emit`/`notify` — propagate data from contract to oracle.
|
|
46
|
+
* - `set` — contract driven oracle state mutation (capsules, execution cache, tagging, etc).
|
|
47
|
+
* - `call` — trigger nested execution (control flow).
|
|
48
|
+
* - `assert` — validate a condition, throw on failure.
|
|
49
|
+
* - Standalone verbs (`delete`, `copy`, `decrypt`, `log`, etc) are used when no generic verb fits.
|
|
30
50
|
*/
|
|
31
51
|
export class Oracle {
|
|
32
52
|
constructor(private handler: IMiscOracle | IUtilityExecutionOracle | IPrivateExecutionOracle) {}
|
|
@@ -92,12 +112,67 @@ export class Oracle {
|
|
|
92
112
|
return acc;
|
|
93
113
|
}, {} as ACIRCallback);
|
|
94
114
|
|
|
95
|
-
|
|
115
|
+
const allCallbacks = { ...callback, ...buildLegacyOracleCallbacks(this) };
|
|
116
|
+
|
|
117
|
+
// Wrap in a Proxy to intercept access to missing oracle names and provide enhanced error messages when the
|
|
118
|
+
// contract's minor version is higher than the PXE's (i.e. the contract expects oracles that were added in a newer
|
|
119
|
+
// minor version).
|
|
120
|
+
const handler = this.handler;
|
|
121
|
+
return new Proxy(allCallbacks, {
|
|
122
|
+
get(target, prop: string) {
|
|
123
|
+
if (prop in target) {
|
|
124
|
+
return target[prop];
|
|
125
|
+
}
|
|
126
|
+
// Return a function that throws with an enhanced error message if applicable
|
|
127
|
+
return () => {
|
|
128
|
+
type NonOracleFunctionGetContractOracleVersion = {
|
|
129
|
+
nonOracleFunctionGetContractOracleVersion(): { major: number; minor: number } | undefined;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
let contractVersion = undefined;
|
|
133
|
+
if ('nonOracleFunctionGetContractOracleVersion' in handler) {
|
|
134
|
+
contractVersion = (
|
|
135
|
+
handler as unknown as NonOracleFunctionGetContractOracleVersion
|
|
136
|
+
).nonOracleFunctionGetContractOracleVersion();
|
|
137
|
+
}
|
|
138
|
+
if (!contractVersion) {
|
|
139
|
+
throw new Error(
|
|
140
|
+
`Oracle '${prop}' not found and the contract's oracle version is unknown (the version check oracle ` +
|
|
141
|
+
`was not called before '${prop}'). This usually means the contract was not compiled with the ` +
|
|
142
|
+
`#[aztec] macro, which injects the version check as the first oracle call in every private/utility ` +
|
|
143
|
+
`external function. If you're using a custom entry point, ensure assert_compatible_oracle_version() ` +
|
|
144
|
+
`is called before any other oracle calls. See https://docs.aztec.network/errors/8`,
|
|
145
|
+
);
|
|
146
|
+
} else if (contractVersion.minor > ORACLE_VERSION_MINOR) {
|
|
147
|
+
throw new Error(
|
|
148
|
+
`Oracle '${prop}' not found.` +
|
|
149
|
+
` This usually means the contract requires a newer private execution environment than you have.` +
|
|
150
|
+
` Upgrade your private execution environment to a compatible version. The contract was compiled with` +
|
|
151
|
+
` Aztec.nr oracle version ${contractVersion.major}.${contractVersion.minor}, but this private` +
|
|
152
|
+
` execution environment only supports up to ${ORACLE_VERSION_MAJOR}.${ORACLE_VERSION_MINOR}.` +
|
|
153
|
+
` See https://docs.aztec.network/errors/8`,
|
|
154
|
+
);
|
|
155
|
+
} else {
|
|
156
|
+
throw new Error(
|
|
157
|
+
`Oracle '${prop}' not found.` +
|
|
158
|
+
` The contract's oracle version (${contractVersion.major}.${contractVersion.minor}) is compatible` +
|
|
159
|
+
` with this private execution environment (${ORACLE_VERSION_MAJOR}.${ORACLE_VERSION_MINOR}), so all` +
|
|
160
|
+
` standard oracles should be available. This could mean the contract was compiled against a modified` +
|
|
161
|
+
` version of Aztec.nr, or that it references an oracle that does not exist.` +
|
|
162
|
+
` See https://docs.aztec.network/errors/8`,
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
});
|
|
96
168
|
}
|
|
97
169
|
|
|
98
170
|
// eslint-disable-next-line camelcase
|
|
99
|
-
|
|
100
|
-
this.handlerAsMisc().assertCompatibleOracleVersion(
|
|
171
|
+
aztec_utl_assertCompatibleOracleVersionV2([major]: ACVMField[], [minor]: ACVMField[]) {
|
|
172
|
+
this.handlerAsMisc().assertCompatibleOracleVersion(
|
|
173
|
+
Fr.fromString(major).toNumber(),
|
|
174
|
+
Fr.fromString(minor).toNumber(),
|
|
175
|
+
);
|
|
101
176
|
return Promise.resolve([]);
|
|
102
177
|
}
|
|
103
178
|
|
|
@@ -108,14 +183,14 @@ export class Oracle {
|
|
|
108
183
|
}
|
|
109
184
|
|
|
110
185
|
// eslint-disable-next-line camelcase
|
|
111
|
-
|
|
112
|
-
this.handlerAsPrivate().
|
|
186
|
+
aztec_prv_setHashPreimage(values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
|
|
187
|
+
this.handlerAsPrivate().setHashPreimage(values.map(Fr.fromString), Fr.fromString(hash));
|
|
113
188
|
return Promise.resolve([]);
|
|
114
189
|
}
|
|
115
190
|
|
|
116
191
|
// eslint-disable-next-line camelcase
|
|
117
|
-
async
|
|
118
|
-
const values = await this.handlerAsPrivate().
|
|
192
|
+
async aztec_prv_getHashPreimage([returnsHash]: ACVMField[]): Promise<ACVMField[][]> {
|
|
193
|
+
const values = await this.handlerAsPrivate().getHashPreimage(Fr.fromString(returnsHash));
|
|
119
194
|
return [values.map(toACVMField)];
|
|
120
195
|
}
|
|
121
196
|
|
|
@@ -252,9 +327,9 @@ export class Oracle {
|
|
|
252
327
|
}
|
|
253
328
|
|
|
254
329
|
// eslint-disable-next-line camelcase
|
|
255
|
-
async
|
|
330
|
+
async aztec_utl_getPublicKeysAndPartialAddress([address]: ACVMField[]): Promise<(ACVMField | ACVMField[])[]> {
|
|
256
331
|
const parsedAddress = AztecAddress.fromField(Fr.fromString(address));
|
|
257
|
-
const result = await this.handlerAsUtility().
|
|
332
|
+
const result = await this.handlerAsUtility().getPublicKeysAndPartialAddress(parsedAddress);
|
|
258
333
|
|
|
259
334
|
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
260
335
|
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
@@ -380,8 +455,8 @@ export class Oracle {
|
|
|
380
455
|
}
|
|
381
456
|
|
|
382
457
|
// eslint-disable-next-line camelcase
|
|
383
|
-
async
|
|
384
|
-
const exists = await this.handlerAsUtility().
|
|
458
|
+
async aztec_utl_doesNullifierExist([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
|
|
459
|
+
const exists = await this.handlerAsUtility().doesNullifierExist(Fr.fromString(innerNullifier));
|
|
385
460
|
return [toACVMField(exists)];
|
|
386
461
|
}
|
|
387
462
|
|
|
@@ -400,13 +475,13 @@ export class Oracle {
|
|
|
400
475
|
}
|
|
401
476
|
|
|
402
477
|
// eslint-disable-next-line camelcase
|
|
403
|
-
async
|
|
478
|
+
async aztec_utl_getFromPublicStorage(
|
|
404
479
|
[blockHash]: ACVMField[],
|
|
405
480
|
[contractAddress]: ACVMField[],
|
|
406
481
|
[startStorageSlot]: ACVMField[],
|
|
407
482
|
[numberOfElements]: ACVMField[],
|
|
408
483
|
): Promise<ACVMField[][]> {
|
|
409
|
-
const values = await this.handlerAsUtility().
|
|
484
|
+
const values = await this.handlerAsUtility().getFromPublicStorage(
|
|
410
485
|
BlockHash.fromString(blockHash),
|
|
411
486
|
new AztecAddress(Fr.fromString(contractAddress)),
|
|
412
487
|
Fr.fromString(startStorageSlot),
|
|
@@ -464,8 +539,8 @@ export class Oracle {
|
|
|
464
539
|
}
|
|
465
540
|
|
|
466
541
|
// eslint-disable-next-line camelcase
|
|
467
|
-
async
|
|
468
|
-
await this.handlerAsPrivate().
|
|
542
|
+
async aztec_prv_assertValidPublicCalldata([calldataHash]: ACVMField[]): Promise<ACVMField[]> {
|
|
543
|
+
await this.handlerAsPrivate().assertValidPublicCalldata(Fr.fromString(calldataHash));
|
|
469
544
|
return [];
|
|
470
545
|
}
|
|
471
546
|
|
|
@@ -476,8 +551,10 @@ export class Oracle {
|
|
|
476
551
|
}
|
|
477
552
|
|
|
478
553
|
// eslint-disable-next-line camelcase
|
|
479
|
-
async
|
|
480
|
-
const isRevertible = await this.handlerAsPrivate().
|
|
554
|
+
async aztec_prv_isExecutionInRevertiblePhase([sideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
|
|
555
|
+
const isRevertible = await this.handlerAsPrivate().isExecutionInRevertiblePhase(
|
|
556
|
+
Fr.fromString(sideEffectCounter).toNumber(),
|
|
557
|
+
);
|
|
481
558
|
return Promise.resolve([toACVMField(isRevertible)]);
|
|
482
559
|
}
|
|
483
560
|
|
|
@@ -491,11 +568,23 @@ export class Oracle {
|
|
|
491
568
|
}
|
|
492
569
|
|
|
493
570
|
// eslint-disable-next-line camelcase
|
|
494
|
-
async
|
|
495
|
-
|
|
571
|
+
async aztec_utl_getPendingTaggedLogs(
|
|
572
|
+
[pendingTaggedLogArrayBaseSlot]: ACVMField[],
|
|
573
|
+
[scope]: ACVMField[],
|
|
574
|
+
): Promise<ACVMField[]> {
|
|
575
|
+
await this.handlerAsUtility().getPendingTaggedLogs(
|
|
576
|
+
Fr.fromString(pendingTaggedLogArrayBaseSlot),
|
|
577
|
+
AztecAddress.fromString(scope),
|
|
578
|
+
);
|
|
496
579
|
return [];
|
|
497
580
|
}
|
|
498
581
|
|
|
582
|
+
// eslint-disable-next-line camelcase
|
|
583
|
+
async aztec_utl_getPendingTaggedLogs_v2([scope]: ACVMField[]): Promise<ACVMField[]> {
|
|
584
|
+
const slot = await this.handlerAsUtility().getPendingTaggedLogsV2(AztecAddress.fromString(scope));
|
|
585
|
+
return [toACVMField(slot)];
|
|
586
|
+
}
|
|
587
|
+
|
|
499
588
|
// eslint-disable-next-line camelcase
|
|
500
589
|
async aztec_utl_validateAndStoreEnqueuedNotesAndEvents(
|
|
501
590
|
[contractAddress]: ACVMField[],
|
|
@@ -503,6 +592,7 @@ export class Oracle {
|
|
|
503
592
|
[eventValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
504
593
|
[maxNotePackedLen]: ACVMField[],
|
|
505
594
|
[maxEventSerializedLen]: ACVMField[],
|
|
595
|
+
[scope]: ACVMField[],
|
|
506
596
|
): Promise<ACVMField[]> {
|
|
507
597
|
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
|
|
508
598
|
AztecAddress.fromString(contractAddress),
|
|
@@ -510,62 +600,103 @@ export class Oracle {
|
|
|
510
600
|
Fr.fromString(eventValidationRequestsArrayBaseSlot),
|
|
511
601
|
Fr.fromString(maxNotePackedLen).toNumber(),
|
|
512
602
|
Fr.fromString(maxEventSerializedLen).toNumber(),
|
|
603
|
+
AztecAddress.fromString(scope),
|
|
513
604
|
);
|
|
514
605
|
|
|
515
606
|
return [];
|
|
516
607
|
}
|
|
517
608
|
|
|
518
609
|
// eslint-disable-next-line camelcase
|
|
519
|
-
async
|
|
610
|
+
async aztec_utl_validateAndStoreEnqueuedNotesAndEvents_v2(
|
|
611
|
+
[noteValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
612
|
+
[eventValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
613
|
+
[maxNotePackedLen]: ACVMField[],
|
|
614
|
+
[maxEventSerializedLen]: ACVMField[],
|
|
615
|
+
[scope]: ACVMField[],
|
|
616
|
+
): Promise<ACVMField[]> {
|
|
617
|
+
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEventsV2(
|
|
618
|
+
Fr.fromString(noteValidationRequestsArrayBaseSlot),
|
|
619
|
+
Fr.fromString(eventValidationRequestsArrayBaseSlot),
|
|
620
|
+
Fr.fromString(maxNotePackedLen).toNumber(),
|
|
621
|
+
Fr.fromString(maxEventSerializedLen).toNumber(),
|
|
622
|
+
AztecAddress.fromString(scope),
|
|
623
|
+
);
|
|
624
|
+
return [];
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// eslint-disable-next-line camelcase
|
|
628
|
+
async aztec_utl_getLogsByTag(
|
|
520
629
|
[contractAddress]: ACVMField[],
|
|
521
630
|
[logRetrievalRequestsArrayBaseSlot]: ACVMField[],
|
|
522
631
|
[logRetrievalResponsesArrayBaseSlot]: ACVMField[],
|
|
632
|
+
[scope]: ACVMField[],
|
|
523
633
|
): Promise<ACVMField[]> {
|
|
524
|
-
await this.handlerAsUtility().
|
|
634
|
+
await this.handlerAsUtility().getLogsByTag(
|
|
525
635
|
AztecAddress.fromString(contractAddress),
|
|
526
636
|
Fr.fromString(logRetrievalRequestsArrayBaseSlot),
|
|
527
637
|
Fr.fromString(logRetrievalResponsesArrayBaseSlot),
|
|
638
|
+
AztecAddress.fromString(scope),
|
|
528
639
|
);
|
|
529
640
|
return [];
|
|
530
641
|
}
|
|
531
642
|
|
|
532
643
|
// eslint-disable-next-line camelcase
|
|
533
|
-
async
|
|
644
|
+
async aztec_utl_getMessageContextsByTxHash(
|
|
534
645
|
[contractAddress]: ACVMField[],
|
|
535
646
|
[messageContextRequestsArrayBaseSlot]: ACVMField[],
|
|
536
647
|
[messageContextResponsesArrayBaseSlot]: ACVMField[],
|
|
648
|
+
[scope]: ACVMField[],
|
|
537
649
|
): Promise<ACVMField[]> {
|
|
538
|
-
await this.handlerAsUtility().
|
|
650
|
+
await this.handlerAsUtility().getMessageContextsByTxHash(
|
|
539
651
|
AztecAddress.fromString(contractAddress),
|
|
540
652
|
Fr.fromString(messageContextRequestsArrayBaseSlot),
|
|
541
653
|
Fr.fromString(messageContextResponsesArrayBaseSlot),
|
|
654
|
+
AztecAddress.fromString(scope),
|
|
542
655
|
);
|
|
543
656
|
return [];
|
|
544
657
|
}
|
|
545
658
|
|
|
546
659
|
// eslint-disable-next-line camelcase
|
|
547
|
-
async
|
|
660
|
+
async aztec_utl_getLogsByTag_v2([requestArrayBaseSlot]: ACVMField[]): Promise<ACVMField[]> {
|
|
661
|
+
const responseSlot = await this.handlerAsUtility().getLogsByTagV2(Fr.fromString(requestArrayBaseSlot));
|
|
662
|
+
return [toACVMField(responseSlot)];
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// eslint-disable-next-line camelcase
|
|
666
|
+
async aztec_utl_getMessageContextsByTxHash_v2([requestArrayBaseSlot]: ACVMField[]): Promise<ACVMField[]> {
|
|
667
|
+
const responseSlot = await this.handlerAsUtility().getMessageContextsByTxHashV2(
|
|
668
|
+
Fr.fromString(requestArrayBaseSlot),
|
|
669
|
+
);
|
|
670
|
+
return [toACVMField(responseSlot)];
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// eslint-disable-next-line camelcase
|
|
674
|
+
aztec_utl_setCapsule(
|
|
548
675
|
[contractAddress]: ACVMField[],
|
|
549
676
|
[slot]: ACVMField[],
|
|
550
677
|
capsule: ACVMField[],
|
|
678
|
+
[scope]: ACVMField[],
|
|
551
679
|
): Promise<ACVMField[]> {
|
|
552
|
-
|
|
680
|
+
this.handlerAsUtility().setCapsule(
|
|
553
681
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
554
682
|
Fr.fromString(slot),
|
|
555
683
|
capsule.map(Fr.fromString),
|
|
684
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
556
685
|
);
|
|
557
|
-
return [];
|
|
686
|
+
return Promise.resolve([]);
|
|
558
687
|
}
|
|
559
688
|
|
|
560
689
|
// eslint-disable-next-line camelcase
|
|
561
|
-
async
|
|
690
|
+
async aztec_utl_getCapsule(
|
|
562
691
|
[contractAddress]: ACVMField[],
|
|
563
692
|
[slot]: ACVMField[],
|
|
564
693
|
[tSize]: ACVMField[],
|
|
694
|
+
[scope]: ACVMField[],
|
|
565
695
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
566
|
-
const values = await this.handlerAsUtility().
|
|
696
|
+
const values = await this.handlerAsUtility().getCapsule(
|
|
567
697
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
568
698
|
Fr.fromString(slot),
|
|
699
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
569
700
|
);
|
|
570
701
|
|
|
571
702
|
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
@@ -580,12 +711,17 @@ export class Oracle {
|
|
|
580
711
|
}
|
|
581
712
|
|
|
582
713
|
// eslint-disable-next-line camelcase
|
|
583
|
-
|
|
584
|
-
|
|
714
|
+
aztec_utl_deleteCapsule(
|
|
715
|
+
[contractAddress]: ACVMField[],
|
|
716
|
+
[slot]: ACVMField[],
|
|
717
|
+
[scope]: ACVMField[],
|
|
718
|
+
): Promise<ACVMField[]> {
|
|
719
|
+
this.handlerAsUtility().deleteCapsule(
|
|
585
720
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
586
721
|
Fr.fromString(slot),
|
|
722
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
587
723
|
);
|
|
588
|
-
return [];
|
|
724
|
+
return Promise.resolve([]);
|
|
589
725
|
}
|
|
590
726
|
|
|
591
727
|
// eslint-disable-next-line camelcase
|
|
@@ -594,18 +730,66 @@ export class Oracle {
|
|
|
594
730
|
[srcSlot]: ACVMField[],
|
|
595
731
|
[dstSlot]: ACVMField[],
|
|
596
732
|
[numEntries]: ACVMField[],
|
|
733
|
+
[scope]: ACVMField[],
|
|
597
734
|
): Promise<ACVMField[]> {
|
|
598
735
|
await this.handlerAsUtility().copyCapsule(
|
|
599
736
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
600
737
|
Fr.fromString(srcSlot),
|
|
601
738
|
Fr.fromString(dstSlot),
|
|
602
739
|
Fr.fromString(numEntries).toNumber(),
|
|
740
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
603
741
|
);
|
|
604
742
|
return [];
|
|
605
743
|
}
|
|
606
744
|
|
|
607
745
|
// eslint-disable-next-line camelcase
|
|
608
|
-
|
|
746
|
+
aztec_utl_pushEphemeral([slot]: ACVMField[], elements: ACVMField[]): Promise<ACVMField[]> {
|
|
747
|
+
const newLen = this.handlerAsUtility().pushEphemeral(Fr.fromString(slot), elements.map(Fr.fromString));
|
|
748
|
+
return Promise.resolve([toACVMField(newLen)]);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
// eslint-disable-next-line camelcase
|
|
752
|
+
aztec_utl_popEphemeral([slot]: ACVMField[]): Promise<ACVMField[][]> {
|
|
753
|
+
const element = this.handlerAsUtility().popEphemeral(Fr.fromString(slot));
|
|
754
|
+
return Promise.resolve([element.map(toACVMField)]);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// eslint-disable-next-line camelcase
|
|
758
|
+
aztec_utl_getEphemeral([slot]: ACVMField[], [index]: ACVMField[]): Promise<ACVMField[][]> {
|
|
759
|
+
const element = this.handlerAsUtility().getEphemeral(Fr.fromString(slot), Fr.fromString(index).toNumber());
|
|
760
|
+
return Promise.resolve([element.map(toACVMField)]);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
// eslint-disable-next-line camelcase
|
|
764
|
+
aztec_utl_setEphemeral([slot]: ACVMField[], [index]: ACVMField[], elements: ACVMField[]): Promise<ACVMField[]> {
|
|
765
|
+
this.handlerAsUtility().setEphemeral(
|
|
766
|
+
Fr.fromString(slot),
|
|
767
|
+
Fr.fromString(index).toNumber(),
|
|
768
|
+
elements.map(Fr.fromString),
|
|
769
|
+
);
|
|
770
|
+
return Promise.resolve([]);
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// eslint-disable-next-line camelcase
|
|
774
|
+
aztec_utl_getEphemeralLen([slot]: ACVMField[]): Promise<ACVMField[]> {
|
|
775
|
+
const len = this.handlerAsUtility().getEphemeralLen(Fr.fromString(slot));
|
|
776
|
+
return Promise.resolve([toACVMField(len)]);
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
// eslint-disable-next-line camelcase
|
|
780
|
+
aztec_utl_removeEphemeral([slot]: ACVMField[], [index]: ACVMField[]): Promise<ACVMField[]> {
|
|
781
|
+
this.handlerAsUtility().removeEphemeral(Fr.fromString(slot), Fr.fromString(index).toNumber());
|
|
782
|
+
return Promise.resolve([]);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// eslint-disable-next-line camelcase
|
|
786
|
+
aztec_utl_clearEphemeral([slot]: ACVMField[]): Promise<ACVMField[]> {
|
|
787
|
+
this.handlerAsUtility().clearEphemeral(Fr.fromString(slot));
|
|
788
|
+
return Promise.resolve([]);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
// eslint-disable-next-line camelcase
|
|
792
|
+
async aztec_utl_decryptAes128(
|
|
609
793
|
ciphertextBVecStorage: ACVMField[],
|
|
610
794
|
[ciphertextLength]: ACVMField[],
|
|
611
795
|
iv: ACVMField[],
|
|
@@ -617,7 +801,7 @@ export class Oracle {
|
|
|
617
801
|
|
|
618
802
|
// Noir Option<BoundedVec> is encoded as [is_some: Field, storage: Field[], length: Field].
|
|
619
803
|
try {
|
|
620
|
-
const plaintext = await this.handlerAsUtility().
|
|
804
|
+
const plaintext = await this.handlerAsUtility().decryptAes128(ciphertext, ivBuffer, symKeyBuffer);
|
|
621
805
|
const [storage, length] = bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
|
|
622
806
|
return [toACVMField(1), storage, length];
|
|
623
807
|
} catch {
|
|
@@ -632,22 +816,24 @@ export class Oracle {
|
|
|
632
816
|
[ephPKField0]: ACVMField[],
|
|
633
817
|
[ephPKField1]: ACVMField[],
|
|
634
818
|
[ephPKField2]: ACVMField[],
|
|
819
|
+
[contractAddress]: ACVMField[],
|
|
635
820
|
): Promise<ACVMField[]> {
|
|
636
821
|
const secret = await this.handlerAsUtility().getSharedSecret(
|
|
637
822
|
AztecAddress.fromField(Fr.fromString(address)),
|
|
638
823
|
Point.fromFields([ephPKField0, ephPKField1, ephPKField2].map(Fr.fromString)),
|
|
824
|
+
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
639
825
|
);
|
|
640
|
-
return secret
|
|
826
|
+
return [toACVMField(secret)];
|
|
641
827
|
}
|
|
642
828
|
|
|
643
829
|
// eslint-disable-next-line camelcase
|
|
644
|
-
|
|
830
|
+
aztec_utl_setContractSyncCacheInvalid(
|
|
645
831
|
[contractAddress]: ACVMField[],
|
|
646
832
|
scopes: ACVMField[],
|
|
647
833
|
[scopeCount]: ACVMField[],
|
|
648
834
|
): Promise<ACVMField[]> {
|
|
649
835
|
const scopeAddresses = scopes.slice(0, +scopeCount).map(s => AztecAddress.fromField(Fr.fromString(s)));
|
|
650
|
-
this.handlerAsUtility().
|
|
836
|
+
this.handlerAsUtility().setContractSyncCacheInvalid(
|
|
651
837
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
652
838
|
scopeAddresses,
|
|
653
839
|
);
|
|
@@ -76,7 +76,7 @@ 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();
|