@aztec/pxe 0.0.1-commit.cd76b27 → 0.0.1-commit.d117d021b
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/config/index.d.ts +2 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +9 -9
- 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.d.ts +2 -3
- 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 +5 -4
- 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 +2 -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 -5
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +48 -45
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +43 -44
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +129 -91
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +20 -34
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +37 -64
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +36 -34
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +48 -50
- 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/entrypoints/client/bundle/index.d.ts +2 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +1 -0
- package/dest/entrypoints/client/lazy/index.d.ts +2 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +1 -0
- package/dest/logs/log_service.d.ts +1 -1
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +4 -4
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +3 -3
- 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 +125 -64
- 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 +13 -5
- 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 +3 -2
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +24 -16
- 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 +140 -64
- 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/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 +3 -3
- 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 +16 -16
- package/src/config/index.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +15 -16
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +8 -5
- 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 -6
- package/src/contract_function_simulator/oracle/interfaces.ts +48 -54
- package/src/contract_function_simulator/oracle/oracle.ts +136 -136
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +42 -80
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +55 -59
- package/src/contract_logging.ts +39 -0
- package/src/entrypoints/client/bundle/index.ts +1 -0
- package/src/entrypoints/client/lazy/index.ts +1 -0
- package/src/logs/log_service.ts +10 -5
- package/src/oracle_version.ts +3 -3
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +157 -110
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +13 -6
- package/src/private_kernel/private_kernel_oracle.ts +7 -7
- package/src/pxe.ts +23 -16
- package/src/storage/contract_store/contract_store.ts +170 -71
- 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/index.ts +1 -1
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +3 -6
- 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
|
@@ -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();
|
|
@@ -105,7 +105,7 @@ export declare class PrivateExecutionOracle extends UtilityExecutionOracle imple
|
|
|
105
105
|
* The value persists through nested calls, meaning all calls down the stack will use the same
|
|
106
106
|
* 'senderForTags' value (unless it is replaced).
|
|
107
107
|
*/
|
|
108
|
-
|
|
108
|
+
getSenderForTags(): Promise<AztecAddress | undefined>;
|
|
109
109
|
/**
|
|
110
110
|
* Set the sender for tags.
|
|
111
111
|
*
|
|
@@ -117,27 +117,27 @@ export declare class PrivateExecutionOracle extends UtilityExecutionOracle imple
|
|
|
117
117
|
* through nested calls, meaning all calls down the stack will use the same 'senderForTags'
|
|
118
118
|
* value (unless it is replaced by another call to this setter).
|
|
119
119
|
*/
|
|
120
|
-
|
|
120
|
+
setSenderForTags(senderForTags: AztecAddress): Promise<void>;
|
|
121
121
|
/**
|
|
122
122
|
* Returns the next app tag for a given sender and recipient pair.
|
|
123
123
|
* @param sender - The address sending the log
|
|
124
124
|
* @param recipient - The address receiving the log
|
|
125
125
|
* @returns An app tag to be used in a log.
|
|
126
126
|
*/
|
|
127
|
-
|
|
127
|
+
getNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag>;
|
|
128
128
|
/**
|
|
129
129
|
* Store values in the execution cache.
|
|
130
130
|
* @param values - Values to store.
|
|
131
131
|
* @returns The hash of the values.
|
|
132
132
|
*/
|
|
133
|
-
|
|
133
|
+
storeInExecutionCache(values: Fr[], hash: Fr): void;
|
|
134
134
|
/**
|
|
135
135
|
* Gets values from the execution cache.
|
|
136
136
|
* @param hash - Hash of the values.
|
|
137
137
|
* @returns The values.
|
|
138
138
|
*/
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
loadFromExecutionCache(hash: Fr): Promise<Fr[]>;
|
|
140
|
+
checkNullifierExists(innerNullifier: Fr): Promise<boolean>;
|
|
141
141
|
/**
|
|
142
142
|
* Gets some notes for a storage slot.
|
|
143
143
|
*
|
|
@@ -159,7 +159,7 @@ export declare class PrivateExecutionOracle extends UtilityExecutionOracle imple
|
|
|
159
159
|
* @param status - The status of notes to fetch.
|
|
160
160
|
* @returns Array of note data.
|
|
161
161
|
*/
|
|
162
|
-
|
|
162
|
+
getNotes(owner: AztecAddress | undefined, storageSlot: Fr, numSelects: number, selectByIndexes: number[], selectByOffsets: number[], selectByLengths: number[], selectValues: Fr[], selectComparators: number[], sortByIndexes: number[], sortByOffsets: number[], sortByLengths: number[], sortOrder: number[], limit: number, offset: number, status: NoteStatus): Promise<NoteData[]>;
|
|
163
163
|
/**
|
|
164
164
|
* Keep track of the new note created during execution.
|
|
165
165
|
* It can be used in subsequent calls (or transactions when chaining txs is possible).
|
|
@@ -171,29 +171,29 @@ export declare class PrivateExecutionOracle extends UtilityExecutionOracle imple
|
|
|
171
171
|
* @param noteHash - A hash of the new note.
|
|
172
172
|
* @returns
|
|
173
173
|
*/
|
|
174
|
-
|
|
174
|
+
notifyCreatedNote(owner: AztecAddress, storageSlot: Fr, randomness: Fr, noteTypeId: NoteSelector, noteItems: Fr[], noteHash: Fr, counter: number): void;
|
|
175
175
|
/**
|
|
176
176
|
* Adding a siloed nullifier into the current set of all pending nullifiers created
|
|
177
177
|
* within the current transaction/execution.
|
|
178
178
|
* @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
|
|
179
179
|
* @param noteHash - A hash of the new note.
|
|
180
180
|
*/
|
|
181
|
-
|
|
181
|
+
notifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number): Promise<void>;
|
|
182
182
|
/**
|
|
183
183
|
* Adding a siloed nullifier into the current set of all pending nullifiers created
|
|
184
184
|
* within the current transaction/execution.
|
|
185
185
|
* @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
|
|
186
186
|
* @param noteHash - A hash of the new note.
|
|
187
187
|
*/
|
|
188
|
-
|
|
188
|
+
notifyCreatedNullifier(innerNullifier: Fr): Promise<void>;
|
|
189
189
|
/**
|
|
190
|
-
* Check if a nullifier has been emitted in the same transaction, i.e. if
|
|
190
|
+
* Check if a nullifier has been emitted in the same transaction, i.e. if notifyCreatedNullifier has been
|
|
191
191
|
* called for this inner nullifier from the contract with the specified address.
|
|
192
192
|
* @param innerNullifier - The inner nullifier to check.
|
|
193
193
|
* @param contractAddress - Address of the contract that emitted the nullifier.
|
|
194
194
|
* @returns A boolean indicating whether the nullifier is pending or not.
|
|
195
195
|
*/
|
|
196
|
-
|
|
196
|
+
isNullifierPending(innerNullifier: Fr, contractAddress: AztecAddress): Promise<boolean>;
|
|
197
197
|
/**
|
|
198
198
|
* Emit a contract class log.
|
|
199
199
|
* This fn exists because we only carry a poseidon hash through the kernels, and need to
|
|
@@ -201,7 +201,7 @@ export declare class PrivateExecutionOracle extends UtilityExecutionOracle imple
|
|
|
201
201
|
* @param log - The contract class log to be emitted.
|
|
202
202
|
* @param counter - The contract class log's counter.
|
|
203
203
|
*/
|
|
204
|
-
|
|
204
|
+
notifyCreatedContractClassLog(log: ContractClassLog, counter: number): void;
|
|
205
205
|
/**
|
|
206
206
|
* Calls a private function as a nested execution.
|
|
207
207
|
* @param targetContractAddress - The address of the contract to call.
|
|
@@ -211,30 +211,16 @@ export declare class PrivateExecutionOracle extends UtilityExecutionOracle imple
|
|
|
211
211
|
* @param isStaticCall - Whether the call is a static call.
|
|
212
212
|
* @returns The execution result.
|
|
213
213
|
*/
|
|
214
|
-
|
|
214
|
+
callPrivateFunction(targetContractAddress: AztecAddress, functionSelector: FunctionSelector, argsHash: Fr, sideEffectCounter: number, isStaticCall: boolean): Promise<{
|
|
215
215
|
endSideEffectCounter: Fr;
|
|
216
216
|
returnsHash: Fr;
|
|
217
217
|
}>;
|
|
218
|
-
/**
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
* @param sideEffectCounter - The side effect counter at the start of the call.
|
|
223
|
-
* @param isStaticCall - Whether the call is a static call.
|
|
224
|
-
*/
|
|
225
|
-
privateNotifyEnqueuedPublicFunctionCall(_targetContractAddress: AztecAddress, calldataHash: Fr, _sideEffectCounter: number, _isStaticCall: boolean): Promise<void>;
|
|
226
|
-
/**
|
|
227
|
-
* Verify relevant information when a public teardown function is set.
|
|
228
|
-
* @param targetContractAddress - The address of the contract to call.
|
|
229
|
-
* @param argsHash - The arguments hash to pass to the function.
|
|
230
|
-
* @param sideEffectCounter - The side effect counter at the start of the call.
|
|
231
|
-
* @param isStaticCall - Whether the call is a static call.
|
|
232
|
-
*/
|
|
233
|
-
privateNotifySetPublicTeardownFunctionCall(_targetContractAddress: AztecAddress, calldataHash: Fr, _sideEffectCounter: number, _isStaticCall: boolean): Promise<void>;
|
|
234
|
-
privateNotifySetMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void>;
|
|
235
|
-
privateIsSideEffectCounterRevertible(sideEffectCounter: number): Promise<boolean>;
|
|
218
|
+
/** Validates the calldata preimage exists in the cache and checks cumulative calldata size is within limits. */
|
|
219
|
+
validatePublicCalldata(calldataHash: Fr): Promise<void>;
|
|
220
|
+
notifyRevertiblePhaseStart(minRevertibleSideEffectCounter: number): Promise<void>;
|
|
221
|
+
inRevertiblePhase(sideEffectCounter: number): Promise<boolean>;
|
|
236
222
|
private deriveCallContext;
|
|
237
223
|
getDebugFunctionName(): Promise<string>;
|
|
238
|
-
|
|
224
|
+
emitOffchainEffect(data: Fr[]): Promise<void>;
|
|
239
225
|
}
|
|
240
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
226
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9leGVjdXRpb25fb3JhY2xlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yL29yYWNsZS9wcml2YXRlX2V4ZWN1dGlvbl9vcmFjbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBR3BELE9BQU8sRUFBRSxLQUFLLGdCQUFnQixFQUFpQixNQUFNLHlCQUF5QixDQUFDO0FBQy9FLE9BQU8sRUF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RUFDbkMsZ0JBQWdCLEVBQUUsZ0JBQWdCLEVBQ2xDLFFBQVEsRUFBRSxFQUFFLEVBQ1osaUJBQWlCLEVBQUUsTUFBTSxFQUN6QixZQUFZLEVBQUUsT0FBTzs7O09BMkZ0QjtJQUVELGdIQUFnSDtJQUN6RyxzQkFBc0IsQ0FBQyxZQUFZLEVBQUUsRUFBRSxpQkFXN0M7SUFFTSwwQkFBMEIsQ0FBQyw4QkFBOEIsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUV2RjtJQUVNLGlCQUFpQixDQUFDLGlCQUFpQixFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBRXBFO1lBU2EsaUJBQWlCO0lBYXhCLG9CQUFvQixvQkFFMUI7SUFFTSxrQkFBa0IsQ0FBQyxJQUFJLEVBQUUsRUFBRSxFQUFFLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUduRDtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_execution_oracle.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/oracle/private_execution_oracle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,YAAY,EACjB,gBAAgB,EAChB,KAAK,YAAY,EAElB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,KAAK,gBAAgB,
|
|
1
|
+
{"version":3,"file":"private_execution_oracle.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/oracle/private_execution_oracle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EA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iBAAiB,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEpE;YASa,iBAAiB;IAaxB,oBAAoB,oBAE1B;IAEM,kBAAkB,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAGnD;CACF"}
|
|
@@ -6,7 +6,7 @@ import { toACVMWitness } from '@aztec/simulator/client';
|
|
|
6
6
|
import { FunctionSelector, countArgumentsSize } from '@aztec/stdlib/abi';
|
|
7
7
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
8
8
|
import { PrivateContextInputs } from '@aztec/stdlib/kernel';
|
|
9
|
-
import {
|
|
9
|
+
import { ExtendedDirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
|
|
10
10
|
import { Tag } from '@aztec/stdlib/logs';
|
|
11
11
|
import { Note } from '@aztec/stdlib/note';
|
|
12
12
|
import { CallContext, CountedContractClassLog, NoteAndSlot } from '@aztec/stdlib/tx';
|
|
@@ -126,7 +126,7 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
126
126
|
*
|
|
127
127
|
* The value persists through nested calls, meaning all calls down the stack will use the same
|
|
128
128
|
* 'senderForTags' value (unless it is replaced).
|
|
129
|
-
*/
|
|
129
|
+
*/ getSenderForTags() {
|
|
130
130
|
return Promise.resolve(this.senderForTags);
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
@@ -139,7 +139,7 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
139
139
|
* Account contracts typically set this value before calling other contracts. The value persists
|
|
140
140
|
* through nested calls, meaning all calls down the stack will use the same 'senderForTags'
|
|
141
141
|
* value (unless it is replaced by another call to this setter).
|
|
142
|
-
*/
|
|
142
|
+
*/ setSenderForTags(senderForTags) {
|
|
143
143
|
this.senderForTags = senderForTags;
|
|
144
144
|
return Promise.resolve();
|
|
145
145
|
}
|
|
@@ -148,20 +148,20 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
148
148
|
* @param sender - The address sending the log
|
|
149
149
|
* @param recipient - The address receiving the log
|
|
150
150
|
* @returns An app tag to be used in a log.
|
|
151
|
-
*/ async
|
|
152
|
-
const
|
|
153
|
-
const index = await this.#getIndexToUseForSecret(
|
|
154
|
-
this.
|
|
155
|
-
this.taggingIndexCache.setLastUsedIndex(
|
|
151
|
+
*/ async getNextAppTagAsSender(sender, recipient) {
|
|
152
|
+
const extendedSecret = await this.#calculateExtendedDirectionalAppTaggingSecret(this.contractAddress, sender, recipient);
|
|
153
|
+
const index = await this.#getIndexToUseForSecret(extendedSecret);
|
|
154
|
+
this.logger.debug(`Incrementing tagging index for sender: ${sender}, recipient: ${recipient}, contract: ${this.contractAddress} to ${index}`);
|
|
155
|
+
this.taggingIndexCache.setLastUsedIndex(extendedSecret, index);
|
|
156
156
|
return Tag.compute({
|
|
157
|
-
|
|
157
|
+
extendedSecret,
|
|
158
158
|
index
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
|
-
async #
|
|
161
|
+
async #calculateExtendedDirectionalAppTaggingSecret(contractAddress, sender, recipient) {
|
|
162
162
|
const senderCompleteAddress = await this.getCompleteAddressOrFail(sender);
|
|
163
163
|
const senderIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(sender);
|
|
164
|
-
return
|
|
164
|
+
return ExtendedDirectionalAppTaggingSecret.compute(senderCompleteAddress, senderIvsk, recipient, contractAddress, recipient);
|
|
165
165
|
}
|
|
166
166
|
async #getIndexToUseForSecret(secret) {
|
|
167
167
|
// If we have the tagging index in the cache, we use it. If not we obtain it from the execution data provider.
|
|
@@ -172,7 +172,7 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
172
172
|
// This is a tagging secret we've not yet used in this tx, so first sync our store to make sure its indices
|
|
173
173
|
// are up to date. We do this here because this store is not synced as part of the global sync because
|
|
174
174
|
// that'd be wasteful as most tagging secrets are not used in each tx.
|
|
175
|
-
await syncSenderTaggingIndexes(secret, this.
|
|
175
|
+
await syncSenderTaggingIndexes(secret, this.aztecNode, this.senderTaggingStore, await this.anchorBlockHeader.hash(), this.jobId);
|
|
176
176
|
const lastUsedIndex = await this.senderTaggingStore.getLastUsedIndex(secret, this.jobId);
|
|
177
177
|
// If lastUsedIndex is undefined, we've never used this secret, so start from 0
|
|
178
178
|
// Otherwise, the next index to use is one past the last used index
|
|
@@ -183,29 +183,29 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
183
183
|
* Store values in the execution cache.
|
|
184
184
|
* @param values - Values to store.
|
|
185
185
|
* @returns The hash of the values.
|
|
186
|
-
*/
|
|
186
|
+
*/ storeInExecutionCache(values, hash) {
|
|
187
187
|
return this.executionCache.store(values, hash);
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
190
190
|
* Gets values from the execution cache.
|
|
191
191
|
* @param hash - Hash of the values.
|
|
192
192
|
* @returns The values.
|
|
193
|
-
*/
|
|
193
|
+
*/ loadFromExecutionCache(hash) {
|
|
194
194
|
const preimage = this.executionCache.getPreimage(hash);
|
|
195
195
|
if (!preimage) {
|
|
196
196
|
throw new Error(`Preimage for hash ${hash.toString()} not found in cache`);
|
|
197
197
|
}
|
|
198
198
|
return Promise.resolve(preimage);
|
|
199
199
|
}
|
|
200
|
-
async
|
|
200
|
+
async checkNullifierExists(innerNullifier) {
|
|
201
201
|
// This oracle must be overridden because while utility execution can only meaningfully check if a nullifier exists
|
|
202
202
|
// in the synched block, during private execution there's also the possibility of it being pending, i.e. created
|
|
203
203
|
// in the current transaction.
|
|
204
|
-
this.
|
|
204
|
+
this.logger.debug(`Checking existence of inner nullifier ${innerNullifier}`, {
|
|
205
205
|
contractAddress: this.contractAddress
|
|
206
206
|
});
|
|
207
207
|
const nullifier = (await siloNullifier(this.contractAddress, innerNullifier)).toBigInt();
|
|
208
|
-
return this.noteCache.getNullifiers(this.contractAddress).has(nullifier) || await super.
|
|
208
|
+
return this.noteCache.getNullifiers(this.contractAddress).has(nullifier) || await super.checkNullifierExists(innerNullifier);
|
|
209
209
|
}
|
|
210
210
|
/**
|
|
211
211
|
* Gets some notes for a storage slot.
|
|
@@ -227,7 +227,7 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
227
227
|
* @param offset - The starting index for pagination.
|
|
228
228
|
* @param status - The status of notes to fetch.
|
|
229
229
|
* @returns Array of note data.
|
|
230
|
-
*/ async
|
|
230
|
+
*/ async getNotes(owner, storageSlot, numSelects, selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, limit, offset, status) {
|
|
231
231
|
// Nullified pending notes are already removed from the list.
|
|
232
232
|
const pendingNotes = this.noteCache.getNotes(this.callContext.contractAddress, owner, storageSlot);
|
|
233
233
|
const pendingNullifiers = this.noteCache.getNullifiers(this.callContext.contractAddress);
|
|
@@ -258,7 +258,7 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
258
258
|
limit,
|
|
259
259
|
offset
|
|
260
260
|
});
|
|
261
|
-
this.
|
|
261
|
+
this.logger.debug(`Returning ${notes.length} notes for ${this.callContext.contractAddress} at ${storageSlot}: ${notes.map((n)=>`${n.noteNonce.toString()}:[${n.note.items.map((i)=>i.toString()).join(',')}]`).join(', ')}`);
|
|
262
262
|
return notes;
|
|
263
263
|
}
|
|
264
264
|
/**
|
|
@@ -271,8 +271,8 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
271
271
|
* @param noteItems - The items to be included in a Note.
|
|
272
272
|
* @param noteHash - A hash of the new note.
|
|
273
273
|
* @returns
|
|
274
|
-
*/
|
|
275
|
-
this.
|
|
274
|
+
*/ notifyCreatedNote(owner, storageSlot, randomness, noteTypeId, noteItems, noteHash, counter) {
|
|
275
|
+
this.logger.debug(`Notified of new note with inner hash ${noteHash}`, {
|
|
276
276
|
contractAddress: this.callContext.contractAddress,
|
|
277
277
|
storageSlot,
|
|
278
278
|
randomness,
|
|
@@ -303,7 +303,7 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
303
303
|
* within the current transaction/execution.
|
|
304
304
|
* @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
|
|
305
305
|
* @param noteHash - A hash of the new note.
|
|
306
|
-
*/ async
|
|
306
|
+
*/ async notifyNullifiedNote(innerNullifier, noteHash, counter) {
|
|
307
307
|
const nullifiedNoteHashCounter = await this.noteCache.nullifyNote(this.callContext.contractAddress, innerNullifier, noteHash);
|
|
308
308
|
if (nullifiedNoteHashCounter !== undefined) {
|
|
309
309
|
this.noteHashNullifierCounterMap.set(nullifiedNoteHashCounter, counter);
|
|
@@ -314,19 +314,19 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
314
314
|
* within the current transaction/execution.
|
|
315
315
|
* @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
|
|
316
316
|
* @param noteHash - A hash of the new note.
|
|
317
|
-
*/
|
|
318
|
-
this.
|
|
317
|
+
*/ notifyCreatedNullifier(innerNullifier) {
|
|
318
|
+
this.logger.debug(`Notified of new inner nullifier ${innerNullifier}`, {
|
|
319
319
|
contractAddress: this.contractAddress
|
|
320
320
|
});
|
|
321
321
|
return this.noteCache.nullifierCreated(this.callContext.contractAddress, innerNullifier);
|
|
322
322
|
}
|
|
323
323
|
/**
|
|
324
|
-
* Check if a nullifier has been emitted in the same transaction, i.e. if
|
|
324
|
+
* Check if a nullifier has been emitted in the same transaction, i.e. if notifyCreatedNullifier has been
|
|
325
325
|
* called for this inner nullifier from the contract with the specified address.
|
|
326
326
|
* @param innerNullifier - The inner nullifier to check.
|
|
327
327
|
* @param contractAddress - Address of the contract that emitted the nullifier.
|
|
328
328
|
* @returns A boolean indicating whether the nullifier is pending or not.
|
|
329
|
-
*/ async
|
|
329
|
+
*/ async isNullifierPending(innerNullifier, contractAddress) {
|
|
330
330
|
const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
|
|
331
331
|
const isNullifierPending = this.noteCache.getNullifiers(contractAddress).has(siloedNullifier.toBigInt());
|
|
332
332
|
return Promise.resolve(isNullifierPending);
|
|
@@ -337,10 +337,10 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
337
337
|
* keep the preimage in ts for later.
|
|
338
338
|
* @param log - The contract class log to be emitted.
|
|
339
339
|
* @param counter - The contract class log's counter.
|
|
340
|
-
*/
|
|
340
|
+
*/ notifyCreatedContractClassLog(log, counter) {
|
|
341
341
|
this.contractClassLogs.push(new CountedContractClassLog(log, counter));
|
|
342
342
|
const text = log.toBuffer().toString('hex');
|
|
343
|
-
this.
|
|
343
|
+
this.logger.verbose(`Emitted log from ContractClassRegistry: "${text.length > 100 ? text.slice(0, 100) + '...' : text}"`);
|
|
344
344
|
}
|
|
345
345
|
#checkValidStaticCall(childExecutionResult) {
|
|
346
346
|
if (childExecutionResult.publicInputs.noteHashes.claimedLength > 0 || childExecutionResult.publicInputs.nullifiers.claimedLength > 0 || childExecutionResult.publicInputs.l2ToL1Msgs.claimedLength > 0 || childExecutionResult.publicInputs.privateLogs.claimedLength > 0 || childExecutionResult.publicInputs.contractClassLogsHashes.claimedLength > 0) {
|
|
@@ -355,24 +355,16 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
355
355
|
* @param sideEffectCounter - The side effect counter at the start of the call.
|
|
356
356
|
* @param isStaticCall - Whether the call is a static call.
|
|
357
357
|
* @returns The execution result.
|
|
358
|
-
*/ async
|
|
358
|
+
*/ async callPrivateFunction(targetContractAddress, functionSelector, argsHash, sideEffectCounter, isStaticCall) {
|
|
359
359
|
if (!this.simulator) {
|
|
360
360
|
// In practice it is only when creating inline private contexts in a Noir test using TXE that we create an
|
|
361
361
|
// instance of this class without a simulator.
|
|
362
362
|
throw new Error('No simulator provided, cannot perform a nested private call');
|
|
363
363
|
}
|
|
364
364
|
const simulatorSetupTimer = new Timer();
|
|
365
|
-
this.
|
|
365
|
+
this.logger.debug(`Calling private function ${targetContractAddress}:${functionSelector} from ${this.callContext.contractAddress}`);
|
|
366
366
|
isStaticCall = isStaticCall || this.callContext.isStaticCall;
|
|
367
|
-
|
|
368
|
-
// expand scopes to include it so nested private calls can sync and read the contract's own notes.
|
|
369
|
-
// We only expand for registered accounts because the log service needs the recipient's keys to derive
|
|
370
|
-
// tagging secrets, which are only available for registered accounts.
|
|
371
|
-
const expandedScopes = this.scopes !== 'ALL_SCOPES' && await this.keyStore.hasAccount(targetContractAddress) ? [
|
|
372
|
-
...this.scopes,
|
|
373
|
-
targetContractAddress
|
|
374
|
-
] : this.scopes;
|
|
375
|
-
await this.contractSyncService.ensureContractSynced(targetContractAddress, functionSelector, this.utilityExecutor, this.anchorBlockHeader, this.jobId, expandedScopes);
|
|
367
|
+
await this.contractSyncService.ensureContractSynced(targetContractAddress, functionSelector, this.utilityExecutor, this.anchorBlockHeader, this.jobId, this.scopes);
|
|
376
368
|
const targetArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(targetContractAddress, functionSelector);
|
|
377
369
|
const derivedTxContext = this.txContext.clone();
|
|
378
370
|
const derivedCallContext = await this.deriveCallContext(targetContractAddress, targetArtifact, isStaticCall);
|
|
@@ -401,8 +393,8 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
401
393
|
jobId: this.jobId,
|
|
402
394
|
totalPublicCalldataCount: this.totalPublicCalldataCount,
|
|
403
395
|
sideEffectCounter,
|
|
404
|
-
log: this.
|
|
405
|
-
scopes:
|
|
396
|
+
log: this.logger,
|
|
397
|
+
scopes: this.scopes,
|
|
406
398
|
senderForTags: this.senderForTags,
|
|
407
399
|
simulator: this.simulator
|
|
408
400
|
});
|
|
@@ -422,7 +414,7 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
422
414
|
returnsHash: publicInputs.returnsHash
|
|
423
415
|
};
|
|
424
416
|
}
|
|
425
|
-
|
|
417
|
+
/** Validates the calldata preimage exists in the cache and checks cumulative calldata size is within limits. */ validatePublicCalldata(calldataHash) {
|
|
426
418
|
const calldata = this.executionCache.getPreimage(calldataHash);
|
|
427
419
|
if (!calldata) {
|
|
428
420
|
throw new Error('Calldata for public call not found in cache');
|
|
@@ -431,31 +423,12 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
431
423
|
if (this.totalPublicCalldataCount > MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS) {
|
|
432
424
|
throw new Error(`Too many total args to all enqueued public calls! (> ${MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS})`);
|
|
433
425
|
}
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Verify relevant information when a public function is enqueued.
|
|
437
|
-
* @param targetContractAddress - The address of the contract to call.
|
|
438
|
-
* @param calldataHash - The hash of the function selector and arguments.
|
|
439
|
-
* @param sideEffectCounter - The side effect counter at the start of the call.
|
|
440
|
-
* @param isStaticCall - Whether the call is a static call.
|
|
441
|
-
*/ privateNotifyEnqueuedPublicFunctionCall(_targetContractAddress, calldataHash, _sideEffectCounter, _isStaticCall) {
|
|
442
|
-
this.#onNewPublicFunctionCall(calldataHash);
|
|
443
|
-
return Promise.resolve();
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Verify relevant information when a public teardown function is set.
|
|
447
|
-
* @param targetContractAddress - The address of the contract to call.
|
|
448
|
-
* @param argsHash - The arguments hash to pass to the function.
|
|
449
|
-
* @param sideEffectCounter - The side effect counter at the start of the call.
|
|
450
|
-
* @param isStaticCall - Whether the call is a static call.
|
|
451
|
-
*/ privateNotifySetPublicTeardownFunctionCall(_targetContractAddress, calldataHash, _sideEffectCounter, _isStaticCall) {
|
|
452
|
-
this.#onNewPublicFunctionCall(calldataHash);
|
|
453
426
|
return Promise.resolve();
|
|
454
427
|
}
|
|
455
|
-
|
|
428
|
+
notifyRevertiblePhaseStart(minRevertibleSideEffectCounter) {
|
|
456
429
|
return this.noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
|
|
457
430
|
}
|
|
458
|
-
|
|
431
|
+
inRevertiblePhase(sideEffectCounter) {
|
|
459
432
|
return Promise.resolve(this.noteCache.isSideEffectCounterRevertible(sideEffectCounter));
|
|
460
433
|
}
|
|
461
434
|
/**
|
|
@@ -470,7 +443,7 @@ import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
|
470
443
|
getDebugFunctionName() {
|
|
471
444
|
return this.contractStore.getDebugFunctionName(this.contractAddress, this.callContext.functionSelector);
|
|
472
445
|
}
|
|
473
|
-
|
|
446
|
+
emitOffchainEffect(data) {
|
|
474
447
|
this.offchainEffects.push({
|
|
475
448
|
data
|
|
476
449
|
});
|