@aztec/pxe 0.0.1-commit.0208eb9 → 0.0.1-commit.033589e
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/block_synchronizer/block_synchronizer.d.ts +4 -2
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +7 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +54 -28
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +177 -71
- 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 +3 -3
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
- 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 +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +44 -44
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +44 -44
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +133 -90
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +55 -54
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +99 -54
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +58 -39
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +86 -66
- package/dest/contract_logging.d.ts +22 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +23 -0
- package/dest/contract_sync/contract_sync_service.d.ts +43 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +97 -0
- package/dest/contract_sync/helpers.d.ts +29 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/{index.js → helpers.js} +8 -14
- package/dest/debug/pxe_debug_utils.d.ts +14 -10
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +16 -15
- package/dest/entrypoints/client/bundle/index.d.ts +4 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +3 -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 +4 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +3 -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 +4 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +3 -1
- 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 +9 -14
- 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 +3 -3
- 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/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +129 -68
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +203 -0
- 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 +19 -11
- package/dest/private_kernel/private_kernel_oracle.d.ts +6 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +7 -3
- package/dest/pxe.d.ts +71 -24
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +100 -64
- package/dest/storage/contract_store/contract_store.d.ts +42 -15
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +145 -69
- 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 +6 -4
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +4 -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/index.d.ts +2 -2
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -5
- 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 +7 -7
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +6 -7
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +12 -11
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -8
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +3 -6
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -7
- 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 +14 -15
- package/package.json +25 -16
- package/src/access_scopes.ts +9 -0
- package/src/block_synchronizer/block_synchronizer.ts +6 -0
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +326 -131
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +43 -43
- package/src/contract_function_simulator/oracle/oracle.ts +136 -108
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +124 -132
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +131 -71
- package/src/contract_logging.ts +39 -0
- package/src/contract_sync/contract_sync_service.ts +152 -0
- package/src/contract_sync/{index.ts → helpers.ts} +13 -34
- package/src/debug/pxe_debug_utils.ts +48 -18
- package/src/entrypoints/client/bundle/index.ts +3 -0
- package/src/entrypoints/client/bundle/utils.ts +9 -1
- package/src/entrypoints/client/lazy/index.ts +3 -0
- package/src/entrypoints/client/lazy/utils.ts +9 -1
- package/src/entrypoints/server/index.ts +3 -1
- package/src/entrypoints/server/utils.ts +7 -7
- package/src/logs/log_service.ts +17 -24
- package/src/notes/note_service.ts +4 -3
- package/src/notes_filter.ts +26 -0
- package/src/oracle_version.ts +3 -3
- 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/hints/private_kernel_reset_private_inputs_builder.ts +164 -117
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +19 -12
- package/src/private_kernel/private_kernel_oracle.ts +7 -7
- package/src/pxe.ts +181 -116
- package/src/storage/contract_store/contract_store.ts +174 -75
- package/src/storage/note_store/note_store.ts +12 -5
- package/src/storage/tagging_store/recipient_tagging_store.ts +9 -5
- package/src/storage/tagging_store/sender_tagging_store.ts +8 -8
- package/src/tagging/get_all_logs_by_tags.ts +28 -4
- package/src/tagging/index.ts +1 -1
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +7 -10
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +10 -15
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +4 -9
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +11 -20
- package/dest/contract_sync/index.d.ts +0 -24
- package/dest/contract_sync/index.d.ts.map +0 -1
- 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
|
@@ -48,11 +48,11 @@ export class UnavailableOracleError extends Error {
|
|
|
48
48
|
];
|
|
49
49
|
// Get all the oracle function names
|
|
50
50
|
const oracleNames = Object.getOwnPropertyNames(Oracle.prototype).filter((name)=>!excludedProps.includes(name));
|
|
51
|
-
// Validate oracle names - these must be prefixed with either "
|
|
51
|
+
// Validate oracle names - these must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate their scope
|
|
52
52
|
// and must correspond to a function on the Oracle class.
|
|
53
53
|
oracleNames.forEach((name)=>{
|
|
54
|
-
if (!name.startsWith('
|
|
55
|
-
throw new Error(`Oracle function "${name}" must be prefixed with either "
|
|
54
|
+
if (!name.startsWith('aztec_prv_') && !name.startsWith('aztec_utl_')) {
|
|
55
|
+
throw new Error(`Oracle function "${name}" must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate its scope`);
|
|
56
56
|
}
|
|
57
57
|
const method = this[name];
|
|
58
58
|
if (typeof method !== 'function') {
|
|
@@ -66,36 +66,43 @@ export class UnavailableOracleError extends Error {
|
|
|
66
66
|
return acc;
|
|
67
67
|
}, {});
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
// eslint-disable-next-line camelcase
|
|
70
|
+
aztec_utl_assertCompatibleOracleVersion([version]) {
|
|
71
|
+
this.handlerAsMisc().assertCompatibleOracleVersion(Fr.fromString(version).toNumber());
|
|
71
72
|
return Promise.resolve([]);
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
// eslint-disable-next-line camelcase
|
|
75
|
+
aztec_utl_getRandomField() {
|
|
76
|
+
const val = this.handlerAsMisc().getRandomField();
|
|
75
77
|
return Promise.resolve([
|
|
76
78
|
toACVMField(val)
|
|
77
79
|
]);
|
|
78
80
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
// eslint-disable-next-line camelcase
|
|
82
|
+
aztec_prv_storeInExecutionCache(values, [hash]) {
|
|
83
|
+
this.handlerAsPrivate().storeInExecutionCache(values.map(Fr.fromString), Fr.fromString(hash));
|
|
81
84
|
return Promise.resolve([]);
|
|
82
85
|
}
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
// eslint-disable-next-line camelcase
|
|
87
|
+
async aztec_prv_loadFromExecutionCache([returnsHash]) {
|
|
88
|
+
const values = await this.handlerAsPrivate().loadFromExecutionCache(Fr.fromString(returnsHash));
|
|
85
89
|
return [
|
|
86
90
|
values.map(toACVMField)
|
|
87
91
|
];
|
|
88
92
|
}
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
// eslint-disable-next-line camelcase
|
|
94
|
+
aztec_utl_getUtilityContext() {
|
|
95
|
+
const context = this.handlerAsUtility().getUtilityContext();
|
|
91
96
|
return Promise.resolve(context.toNoirRepresentation());
|
|
92
97
|
}
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
// eslint-disable-next-line camelcase
|
|
99
|
+
async aztec_utl_getKeyValidationRequest([pkMHash]) {
|
|
100
|
+
const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(Fr.fromString(pkMHash));
|
|
95
101
|
return keyValidationRequest.toFields().map(toACVMField);
|
|
96
102
|
}
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
// eslint-disable-next-line camelcase
|
|
104
|
+
async aztec_utl_getContractInstance([address]) {
|
|
105
|
+
const instance = await this.handlerAsUtility().getContractInstance(AztecAddress.fromField(Fr.fromString(address)));
|
|
99
106
|
return [
|
|
100
107
|
instance.salt,
|
|
101
108
|
instance.deployer,
|
|
@@ -104,62 +111,69 @@ export class UnavailableOracleError extends Error {
|
|
|
104
111
|
...instance.publicKeys.toFields()
|
|
105
112
|
].map(toACVMField);
|
|
106
113
|
}
|
|
107
|
-
|
|
114
|
+
// eslint-disable-next-line camelcase
|
|
115
|
+
async aztec_utl_getNoteHashMembershipWitness([anchorBlockHash], [noteHash]) {
|
|
108
116
|
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
109
117
|
const parsedNoteHash = Fr.fromString(noteHash);
|
|
110
|
-
const witness = await this.handlerAsUtility().
|
|
118
|
+
const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(parsedAnchorBlockHash, parsedNoteHash);
|
|
111
119
|
if (!witness) {
|
|
112
120
|
throw new Error(`Note hash ${noteHash} not found in the note hash tree at anchor block hash ${parsedAnchorBlockHash.toString()}.`);
|
|
113
121
|
}
|
|
114
122
|
return witness.toNoirRepresentation();
|
|
115
123
|
}
|
|
116
|
-
|
|
124
|
+
// eslint-disable-next-line camelcase
|
|
125
|
+
async aztec_utl_getBlockHashMembershipWitness([anchorBlockHash], [blockHash]) {
|
|
117
126
|
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
118
127
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
119
|
-
const witness = await this.handlerAsUtility().
|
|
128
|
+
const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(parsedAnchorBlockHash, parsedBlockHash);
|
|
120
129
|
if (!witness) {
|
|
121
130
|
throw new Error(`Block hash ${parsedBlockHash.toString()} not found in the archive tree at anchor block ${parsedAnchorBlockHash.toString()}.`);
|
|
122
131
|
}
|
|
123
132
|
return witness.toNoirRepresentation();
|
|
124
133
|
}
|
|
125
|
-
|
|
134
|
+
// eslint-disable-next-line camelcase
|
|
135
|
+
async aztec_utl_getNullifierMembershipWitness([blockHash], [nullifier]) {
|
|
126
136
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
127
137
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
128
|
-
const witness = await this.handlerAsUtility().
|
|
138
|
+
const witness = await this.handlerAsUtility().getNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
129
139
|
if (!witness) {
|
|
130
140
|
throw new Error(`Nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`);
|
|
131
141
|
}
|
|
132
142
|
return witness.toNoirRepresentation();
|
|
133
143
|
}
|
|
134
|
-
|
|
144
|
+
// eslint-disable-next-line camelcase
|
|
145
|
+
async aztec_utl_getLowNullifierMembershipWitness([blockHash], [nullifier]) {
|
|
135
146
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
136
147
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
137
|
-
const witness = await this.handlerAsUtility().
|
|
148
|
+
const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
138
149
|
if (!witness) {
|
|
139
150
|
throw new Error(`Low nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`);
|
|
140
151
|
}
|
|
141
152
|
return witness.toNoirRepresentation();
|
|
142
153
|
}
|
|
143
|
-
|
|
154
|
+
// eslint-disable-next-line camelcase
|
|
155
|
+
async aztec_utl_getPublicDataWitness([blockHash], [leafSlot]) {
|
|
144
156
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
145
157
|
const parsedLeafSlot = Fr.fromString(leafSlot);
|
|
146
|
-
const witness = await this.handlerAsUtility().
|
|
158
|
+
const witness = await this.handlerAsUtility().getPublicDataWitness(parsedBlockHash, parsedLeafSlot);
|
|
147
159
|
if (!witness) {
|
|
148
160
|
throw new Error(`Public data witness not found for slot ${parsedLeafSlot} at block hash ${parsedBlockHash.toString()}.`);
|
|
149
161
|
}
|
|
150
162
|
return witness.toNoirRepresentation();
|
|
151
163
|
}
|
|
152
|
-
|
|
164
|
+
// eslint-disable-next-line camelcase
|
|
165
|
+
async aztec_utl_getBlockHeader([blockNumber]) {
|
|
153
166
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
154
|
-
const header = await this.handlerAsUtility().
|
|
167
|
+
const header = await this.handlerAsUtility().getBlockHeader(BlockNumber(parsedBlockNumber));
|
|
155
168
|
if (!header) {
|
|
156
169
|
throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
|
|
157
170
|
}
|
|
158
171
|
return header.toFields().map(toACVMField);
|
|
159
172
|
}
|
|
160
|
-
|
|
173
|
+
// eslint-disable-next-line camelcase
|
|
174
|
+
async aztec_utl_getAuthWitness([messageHash]) {
|
|
161
175
|
const messageHashField = Fr.fromString(messageHash);
|
|
162
|
-
const witness = await this.handlerAsUtility().
|
|
176
|
+
const witness = await this.handlerAsUtility().getAuthWitness(messageHashField);
|
|
163
177
|
if (!witness) {
|
|
164
178
|
throw new Error(`Unknown auth witness for message hash ${messageHashField}`);
|
|
165
179
|
}
|
|
@@ -167,9 +181,10 @@ export class UnavailableOracleError extends Error {
|
|
|
167
181
|
witness.map(toACVMField)
|
|
168
182
|
];
|
|
169
183
|
}
|
|
170
|
-
|
|
184
|
+
// eslint-disable-next-line camelcase
|
|
185
|
+
async aztec_utl_tryGetPublicKeysAndPartialAddress([address]) {
|
|
171
186
|
const parsedAddress = AztecAddress.fromField(Fr.fromString(address));
|
|
172
|
-
const result = await this.handlerAsUtility().
|
|
187
|
+
const result = await this.handlerAsUtility().tryGetPublicKeysAndPartialAddress(parsedAddress);
|
|
173
188
|
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
174
189
|
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
175
190
|
if (result === undefined) {
|
|
@@ -189,10 +204,11 @@ export class UnavailableOracleError extends Error {
|
|
|
189
204
|
];
|
|
190
205
|
}
|
|
191
206
|
}
|
|
192
|
-
|
|
207
|
+
// eslint-disable-next-line camelcase
|
|
208
|
+
async aztec_utl_getNotes([ownerSome], [ownerValue], [storageSlot], [numSelects], selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, [limit], [offset], [status], [maxNotes], [packedHintedNoteLength]) {
|
|
193
209
|
// Parse Option<AztecAddress>: ownerSome is 0 for None, 1 for Some
|
|
194
210
|
const owner = Fr.fromString(ownerSome).toNumber() === 1 ? AztecAddress.fromString(ownerValue) : undefined;
|
|
195
|
-
const noteDatas = await this.handlerAsUtility().
|
|
211
|
+
const noteDatas = await this.handlerAsUtility().getNotes(owner, Fr.fromString(storageSlot), +numSelects, selectByIndexes.map((s)=>+s), selectByOffsets.map((s)=>+s), selectByLengths.map((s)=>+s), selectValues.map(Fr.fromString), selectComparators.map((s)=>+s), sortByIndexes.map((s)=>+s), sortByOffsets.map((s)=>+s), sortByLengths.map((s)=>+s), sortOrder.map((s)=>+s), +limit, +offset, +status);
|
|
196
212
|
const returnDataAsArrayOfPackedHintedNotes = noteDatas.map((noteData)=>packAsHintedNote({
|
|
197
213
|
contractAddress: noteData.contractAddress,
|
|
198
214
|
owner: noteData.owner,
|
|
@@ -207,57 +223,67 @@ export class UnavailableOracleError extends Error {
|
|
|
207
223
|
// At last we convert the array of arrays to a bounded vec of arrays
|
|
208
224
|
return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +packedHintedNoteLength);
|
|
209
225
|
}
|
|
210
|
-
|
|
211
|
-
|
|
226
|
+
// eslint-disable-next-line camelcase
|
|
227
|
+
aztec_prv_notifyCreatedNote([owner], [storageSlot], [randomness], [noteTypeId], note, [noteHash], [counter]) {
|
|
228
|
+
this.handlerAsPrivate().notifyCreatedNote(AztecAddress.fromString(owner), Fr.fromString(storageSlot), Fr.fromString(randomness), NoteSelector.fromField(Fr.fromString(noteTypeId)), note.map(Fr.fromString), Fr.fromString(noteHash), +counter);
|
|
212
229
|
return Promise.resolve([]);
|
|
213
230
|
}
|
|
214
|
-
|
|
215
|
-
|
|
231
|
+
// eslint-disable-next-line camelcase
|
|
232
|
+
async aztec_prv_notifyNullifiedNote([innerNullifier], [noteHash], [counter]) {
|
|
233
|
+
await this.handlerAsPrivate().notifyNullifiedNote(Fr.fromString(innerNullifier), Fr.fromString(noteHash), +counter);
|
|
216
234
|
return [];
|
|
217
235
|
}
|
|
218
|
-
|
|
219
|
-
|
|
236
|
+
// eslint-disable-next-line camelcase
|
|
237
|
+
async aztec_prv_notifyCreatedNullifier([innerNullifier]) {
|
|
238
|
+
await this.handlerAsPrivate().notifyCreatedNullifier(Fr.fromString(innerNullifier));
|
|
220
239
|
return [];
|
|
221
240
|
}
|
|
222
|
-
|
|
223
|
-
|
|
241
|
+
// eslint-disable-next-line camelcase
|
|
242
|
+
async aztec_prv_isNullifierPending([innerNullifier], [contractAddress]) {
|
|
243
|
+
const isPending = await this.handlerAsPrivate().isNullifierPending(Fr.fromString(innerNullifier), AztecAddress.fromString(contractAddress));
|
|
224
244
|
return [
|
|
225
245
|
toACVMField(isPending)
|
|
226
246
|
];
|
|
227
247
|
}
|
|
228
|
-
|
|
229
|
-
|
|
248
|
+
// eslint-disable-next-line camelcase
|
|
249
|
+
async aztec_utl_checkNullifierExists([innerNullifier]) {
|
|
250
|
+
const exists = await this.handlerAsUtility().checkNullifierExists(Fr.fromString(innerNullifier));
|
|
230
251
|
return [
|
|
231
252
|
toACVMField(exists)
|
|
232
253
|
];
|
|
233
254
|
}
|
|
234
|
-
|
|
235
|
-
|
|
255
|
+
// eslint-disable-next-line camelcase
|
|
256
|
+
async aztec_utl_getL1ToL2MembershipWitness([contractAddress], [messageHash], [secret]) {
|
|
257
|
+
const message = await this.handlerAsUtility().getL1ToL2MembershipWitness(AztecAddress.fromString(contractAddress), Fr.fromString(messageHash), Fr.fromString(secret));
|
|
236
258
|
return message.toNoirRepresentation();
|
|
237
259
|
}
|
|
238
|
-
|
|
239
|
-
|
|
260
|
+
// eslint-disable-next-line camelcase
|
|
261
|
+
async aztec_utl_storageRead([blockHash], [contractAddress], [startStorageSlot], [numberOfElements]) {
|
|
262
|
+
const values = await this.handlerAsUtility().storageRead(BlockHash.fromString(blockHash), new AztecAddress(Fr.fromString(contractAddress)), Fr.fromString(startStorageSlot), +numberOfElements);
|
|
240
263
|
return [
|
|
241
264
|
values.map(toACVMField)
|
|
242
265
|
];
|
|
243
266
|
}
|
|
244
|
-
|
|
267
|
+
// eslint-disable-next-line camelcase
|
|
268
|
+
aztec_prv_notifyCreatedContractClassLog([contractAddress], message, [length], [counter]) {
|
|
245
269
|
const logFields = new ContractClassLogFields(message.map(Fr.fromString));
|
|
246
270
|
const log = new ContractClassLog(new AztecAddress(Fr.fromString(contractAddress)), logFields, +length);
|
|
247
|
-
this.handlerAsPrivate().
|
|
271
|
+
this.handlerAsPrivate().notifyCreatedContractClassLog(log, +counter);
|
|
248
272
|
return Promise.resolve([]);
|
|
249
273
|
}
|
|
250
|
-
|
|
274
|
+
// eslint-disable-next-line camelcase
|
|
275
|
+
async aztec_utl_log(level, message, _ignoredFieldsSize, fields) {
|
|
251
276
|
const levelFr = Fr.fromString(level[0]);
|
|
252
277
|
const messageStr = message.map((acvmField)=>String.fromCharCode(Fr.fromString(acvmField).toNumber())).join('');
|
|
253
278
|
const fieldsFr = fields.map(Fr.fromString);
|
|
254
|
-
this.handlerAsMisc().
|
|
255
|
-
return
|
|
279
|
+
await this.handlerAsMisc().log(levelFr.toNumber(), messageStr, fieldsFr);
|
|
280
|
+
return [];
|
|
256
281
|
}
|
|
257
282
|
// This function's name is directly hardcoded in `circuit_recorder.ts`. Don't forget to update it there if you
|
|
258
283
|
// change the name here.
|
|
259
|
-
|
|
260
|
-
|
|
284
|
+
// eslint-disable-next-line camelcase
|
|
285
|
+
async aztec_prv_callPrivateFunction([contractAddress], [functionSelector], [argsHash], [sideEffectCounter], [isStaticCall]) {
|
|
286
|
+
const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().callPrivateFunction(AztecAddress.fromField(Fr.fromString(contractAddress)), FunctionSelector.fromField(Fr.fromString(functionSelector)), Fr.fromString(argsHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
261
287
|
return [
|
|
262
288
|
[
|
|
263
289
|
endSideEffectCounter,
|
|
@@ -265,48 +291,58 @@ export class UnavailableOracleError extends Error {
|
|
|
265
291
|
].map(toACVMField)
|
|
266
292
|
];
|
|
267
293
|
}
|
|
268
|
-
|
|
269
|
-
|
|
294
|
+
// eslint-disable-next-line camelcase
|
|
295
|
+
async aztec_prv_notifyEnqueuedPublicFunctionCall([contractAddress], [calldataHash], [sideEffectCounter], [isStaticCall]) {
|
|
296
|
+
await this.handlerAsPrivate().notifyEnqueuedPublicFunctionCall(AztecAddress.fromString(contractAddress), Fr.fromString(calldataHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
270
297
|
return [];
|
|
271
298
|
}
|
|
272
|
-
|
|
273
|
-
|
|
299
|
+
// eslint-disable-next-line camelcase
|
|
300
|
+
async aztec_prv_notifySetPublicTeardownFunctionCall([contractAddress], [calldataHash], [sideEffectCounter], [isStaticCall]) {
|
|
301
|
+
await this.handlerAsPrivate().notifySetPublicTeardownFunctionCall(AztecAddress.fromString(contractAddress), Fr.fromString(calldataHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
274
302
|
return [];
|
|
275
303
|
}
|
|
276
|
-
|
|
277
|
-
|
|
304
|
+
// eslint-disable-next-line camelcase
|
|
305
|
+
async aztec_prv_notifySetMinRevertibleSideEffectCounter([minRevertibleSideEffectCounter]) {
|
|
306
|
+
await this.handlerAsPrivate().notifySetMinRevertibleSideEffectCounter(Fr.fromString(minRevertibleSideEffectCounter).toNumber());
|
|
278
307
|
return Promise.resolve([]);
|
|
279
308
|
}
|
|
280
|
-
|
|
281
|
-
|
|
309
|
+
// eslint-disable-next-line camelcase
|
|
310
|
+
async aztec_prv_isSideEffectCounterRevertible([sideEffectCounter]) {
|
|
311
|
+
const isRevertible = await this.handlerAsPrivate().isSideEffectCounterRevertible(Fr.fromString(sideEffectCounter).toNumber());
|
|
282
312
|
return Promise.resolve([
|
|
283
313
|
toACVMField(isRevertible)
|
|
284
314
|
]);
|
|
285
315
|
}
|
|
286
|
-
|
|
287
|
-
|
|
316
|
+
// eslint-disable-next-line camelcase
|
|
317
|
+
async aztec_prv_getNextAppTagAsSender([sender], [recipient]) {
|
|
318
|
+
const tag = await this.handlerAsPrivate().getNextAppTagAsSender(AztecAddress.fromString(sender), AztecAddress.fromString(recipient));
|
|
288
319
|
return [
|
|
289
320
|
toACVMField(tag.value)
|
|
290
321
|
];
|
|
291
322
|
}
|
|
292
|
-
|
|
293
|
-
|
|
323
|
+
// eslint-disable-next-line camelcase
|
|
324
|
+
async aztec_utl_fetchTaggedLogs([pendingTaggedLogArrayBaseSlot]) {
|
|
325
|
+
await this.handlerAsUtility().fetchTaggedLogs(Fr.fromString(pendingTaggedLogArrayBaseSlot));
|
|
294
326
|
return [];
|
|
295
327
|
}
|
|
296
|
-
|
|
297
|
-
|
|
328
|
+
// eslint-disable-next-line camelcase
|
|
329
|
+
async aztec_utl_validateAndStoreEnqueuedNotesAndEvents([contractAddress], [noteValidationRequestsArrayBaseSlot], [eventValidationRequestsArrayBaseSlot]) {
|
|
330
|
+
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(AztecAddress.fromString(contractAddress), Fr.fromString(noteValidationRequestsArrayBaseSlot), Fr.fromString(eventValidationRequestsArrayBaseSlot));
|
|
298
331
|
return [];
|
|
299
332
|
}
|
|
300
|
-
|
|
301
|
-
|
|
333
|
+
// eslint-disable-next-line camelcase
|
|
334
|
+
async aztec_utl_bulkRetrieveLogs([contractAddress], [logRetrievalRequestsArrayBaseSlot], [logRetrievalResponsesArrayBaseSlot]) {
|
|
335
|
+
await this.handlerAsUtility().bulkRetrieveLogs(AztecAddress.fromString(contractAddress), Fr.fromString(logRetrievalRequestsArrayBaseSlot), Fr.fromString(logRetrievalResponsesArrayBaseSlot));
|
|
302
336
|
return [];
|
|
303
337
|
}
|
|
304
|
-
|
|
305
|
-
|
|
338
|
+
// eslint-disable-next-line camelcase
|
|
339
|
+
async aztec_utl_storeCapsule([contractAddress], [slot], capsule) {
|
|
340
|
+
await this.handlerAsUtility().storeCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot), capsule.map(Fr.fromString));
|
|
306
341
|
return [];
|
|
307
342
|
}
|
|
308
|
-
|
|
309
|
-
|
|
343
|
+
// eslint-disable-next-line camelcase
|
|
344
|
+
async aztec_utl_loadCapsule([contractAddress], [slot], [tSize]) {
|
|
345
|
+
const values = await this.handlerAsUtility().loadCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot));
|
|
310
346
|
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
311
347
|
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
312
348
|
if (values === null) {
|
|
@@ -323,35 +359,41 @@ export class UnavailableOracleError extends Error {
|
|
|
323
359
|
];
|
|
324
360
|
}
|
|
325
361
|
}
|
|
326
|
-
|
|
327
|
-
|
|
362
|
+
// eslint-disable-next-line camelcase
|
|
363
|
+
async aztec_utl_deleteCapsule([contractAddress], [slot]) {
|
|
364
|
+
await this.handlerAsUtility().deleteCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot));
|
|
328
365
|
return [];
|
|
329
366
|
}
|
|
330
|
-
|
|
331
|
-
|
|
367
|
+
// eslint-disable-next-line camelcase
|
|
368
|
+
async aztec_utl_copyCapsule([contractAddress], [srcSlot], [dstSlot], [numEntries]) {
|
|
369
|
+
await this.handlerAsUtility().copyCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(srcSlot), Fr.fromString(dstSlot), Fr.fromString(numEntries).toNumber());
|
|
332
370
|
return [];
|
|
333
371
|
}
|
|
334
|
-
|
|
372
|
+
// eslint-disable-next-line camelcase
|
|
373
|
+
async aztec_utl_aes128Decrypt(ciphertextBVecStorage, [ciphertextLength], iv, symKey) {
|
|
335
374
|
const ciphertext = fromUintBoundedVec(ciphertextBVecStorage, ciphertextLength, 8);
|
|
336
375
|
const ivBuffer = fromUintArray(iv, 8);
|
|
337
376
|
const symKeyBuffer = fromUintArray(symKey, 8);
|
|
338
|
-
const plaintext = await this.handlerAsUtility().
|
|
377
|
+
const plaintext = await this.handlerAsUtility().aes128Decrypt(ciphertext, ivBuffer, symKeyBuffer);
|
|
339
378
|
return bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
|
|
340
379
|
}
|
|
341
|
-
|
|
342
|
-
|
|
380
|
+
// eslint-disable-next-line camelcase
|
|
381
|
+
async aztec_utl_getSharedSecret([address], [ephPKField0], [ephPKField1], [ephPKField2]) {
|
|
382
|
+
const secret = await this.handlerAsUtility().getSharedSecret(AztecAddress.fromField(Fr.fromString(address)), Point.fromFields([
|
|
343
383
|
ephPKField0,
|
|
344
384
|
ephPKField1,
|
|
345
385
|
ephPKField2
|
|
346
386
|
].map(Fr.fromString)));
|
|
347
387
|
return secret.toFields().map(toACVMField);
|
|
348
388
|
}
|
|
349
|
-
|
|
350
|
-
|
|
389
|
+
// eslint-disable-next-line camelcase
|
|
390
|
+
async aztec_utl_emitOffchainEffect(data) {
|
|
391
|
+
await this.handlerAsPrivate().emitOffchainEffect(data.map(Fr.fromString));
|
|
351
392
|
return [];
|
|
352
393
|
}
|
|
353
|
-
|
|
354
|
-
|
|
394
|
+
// eslint-disable-next-line camelcase
|
|
395
|
+
async aztec_prv_getSenderForTags() {
|
|
396
|
+
const sender = await this.handlerAsPrivate().getSenderForTags();
|
|
355
397
|
// Return [1, address] for Some(address), [0, 0] for None
|
|
356
398
|
return sender ? [
|
|
357
399
|
toACVMField(1n),
|
|
@@ -361,8 +403,9 @@ export class UnavailableOracleError extends Error {
|
|
|
361
403
|
toACVMField(0n)
|
|
362
404
|
];
|
|
363
405
|
}
|
|
364
|
-
|
|
365
|
-
|
|
406
|
+
// eslint-disable-next-line camelcase
|
|
407
|
+
async aztec_prv_setSenderForTags([senderForTags]) {
|
|
408
|
+
await this.handlerAsPrivate().setSenderForTags(AztecAddress.fromField(Fr.fromString(senderForTags)));
|
|
366
409
|
return [];
|
|
367
410
|
}
|
|
368
411
|
}
|
|
@@ -45,7 +45,7 @@ import { Oracle } from './oracle.js';
|
|
|
45
45
|
appCircuitName: functionName
|
|
46
46
|
});
|
|
47
47
|
const contractClassLogs = privateExecutionOracle.getContractClassLogs();
|
|
48
|
-
const rawReturnValues = await privateExecutionOracle.
|
|
48
|
+
const rawReturnValues = await privateExecutionOracle.loadFromExecutionCache(publicInputs.returnsHash);
|
|
49
49
|
const newNotes = privateExecutionOracle.getNewNotes();
|
|
50
50
|
const noteHashNullifierCounterMap = privateExecutionOracle.getNoteHashNullifierCounterMap();
|
|
51
51
|
const offchainEffects = privateExecutionOracle.getOffchainEffects();
|