@aztec/pxe 0.0.1-commit.b655e406 → 0.0.1-commit.d3ec352c
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.d.ts +1 -1
- package/dest/config/index.d.ts +2 -10
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +7 -13
- package/dest/config/package_info.d.ts +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +4 -4
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +9 -10
- package/dest/contract_function_simulator/execution_data_provider.d.ts +11 -18
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.d.ts +8 -6
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +20 -12
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/hashed_values_cache.d.ts +1 -1
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +5 -3
- 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 +12 -3
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/index.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +15 -9
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +1 -3
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +5 -3
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +4 -3
- package/dest/contract_function_simulator/oracle/oracle.d.ts +5 -4
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +18 -12
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +3 -2
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +7 -11
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +19 -6
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +11 -10
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +3 -2
- package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
- 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_node.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +12 -11
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +15 -20
- package/dest/entrypoints/client/bundle/index.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.js +2 -2
- package/dest/entrypoints/client/lazy/index.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.js +2 -2
- package/dest/entrypoints/pxe_creation_options.d.ts +1 -1
- package/dest/entrypoints/server/index.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +4 -15
- package/dest/error_enriching.d.ts +1 -1
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +3 -3
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +7 -7
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +1 -1
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/index.d.ts +1 -1
- 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 +7 -6
- package/dest/private_kernel/private_kernel_oracle.d.ts +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +4 -4
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/pxe.d.ts +20 -13
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +19 -37
- package/dest/storage/address_data_provider/address_data_provider.d.ts +1 -1
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -1
- package/dest/storage/address_data_provider/index.d.ts +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
- package/dest/storage/capsule_data_provider/index.d.ts +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +2 -12
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +0 -12
- package/dest/storage/contract_data_provider/index.d.ts +1 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
- package/dest/storage/index.d.ts +1 -1
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/note_data_provider/index.d.ts +2 -2
- package/dest/storage/note_data_provider/index.d.ts.map +1 -1
- package/dest/storage/note_data_provider/index.js +1 -1
- package/dest/storage/note_data_provider/note_data_provider.d.ts +5 -5
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.js +17 -11
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +2 -8
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +3 -2
- package/dest/storage/sync_data_provider/index.d.ts +1 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +3 -2
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +1 -1
- package/dest/storage/tagging_data_provider/index.d.ts +1 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +1 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +1 -1
- package/dest/synchronizer/index.d.ts +1 -1
- package/dest/synchronizer/synchronizer.d.ts +3 -2
- package/dest/synchronizer/synchronizer.d.ts.map +1 -1
- package/dest/synchronizer/synchronizer.js +2 -1
- package/dest/tagging/constants.d.ts +1 -1
- package/dest/tagging/index.d.ts +1 -1
- package/dest/tagging/siloed_tag.d.ts +1 -1
- package/dest/tagging/siloed_tag.d.ts.map +1 -1
- package/dest/tagging/tag.d.ts +1 -1
- package/dest/tagging/tag.d.ts.map +1 -1
- package/dest/tagging/utils.d.ts +1 -1
- package/package.json +20 -19
- package/src/config/index.ts +8 -23
- package/src/contract_function_simulator/contract_function_simulator.ts +17 -12
- package/src/contract_function_simulator/execution_data_provider.ts +16 -17
- package/src/contract_function_simulator/execution_note_cache.ts +18 -10
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +13 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +22 -7
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +5 -3
- package/src/contract_function_simulator/oracle/oracle.ts +24 -8
- package/src/contract_function_simulator/oracle/private_execution.ts +2 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +16 -3
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +19 -7
- package/src/contract_function_simulator/pxe_oracle_interface.ts +54 -50
- package/src/entrypoints/client/bundle/utils.ts +2 -2
- package/src/entrypoints/client/lazy/utils.ts +2 -2
- package/src/entrypoints/server/utils.ts +4 -18
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +4 -8
- package/src/private_kernel/private_kernel_execution_prover.ts +8 -12
- package/src/private_kernel/private_kernel_oracle_impl.ts +2 -2
- package/src/pxe.ts +36 -64
- package/src/storage/contract_data_provider/contract_data_provider.ts +0 -17
- package/src/storage/note_data_provider/index.ts +1 -1
- package/src/storage/note_data_provider/note_data_provider.ts +22 -12
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +4 -9
- package/src/storage/sync_data_provider/sync_data_provider.ts +2 -1
- package/src/synchronizer/synchronizer.ts +2 -1
- package/dest/storage/note_data_provider/note_dao.d.ts +0 -100
- package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_dao.js +0 -102
- package/src/storage/note_data_provider/note_dao.ts +0 -154
|
@@ -32,12 +32,18 @@ import {
|
|
|
32
32
|
toACVMWitness,
|
|
33
33
|
witnessMapToFields,
|
|
34
34
|
} from '@aztec/simulator/client';
|
|
35
|
-
import type {
|
|
36
|
-
import { FunctionSelector, FunctionType
|
|
35
|
+
import type { FunctionCall } from '@aztec/stdlib/abi';
|
|
36
|
+
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
37
37
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
38
38
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
39
39
|
import { Gas } from '@aztec/stdlib/gas';
|
|
40
|
-
import {
|
|
40
|
+
import {
|
|
41
|
+
computeNoteHashNonce,
|
|
42
|
+
computeProtocolNullifier,
|
|
43
|
+
computeUniqueNoteHash,
|
|
44
|
+
siloNoteHash,
|
|
45
|
+
siloNullifier,
|
|
46
|
+
} from '@aztec/stdlib/hash';
|
|
41
47
|
import {
|
|
42
48
|
PartialPrivateTailPublicInputsForPublic,
|
|
43
49
|
PartialPrivateTailPublicInputsForRollup,
|
|
@@ -123,7 +129,7 @@ export class ContractFunctionSimulator {
|
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
// reserve the first side effect for the tx hash (inserted by the private kernel)
|
|
126
|
-
const startSideEffectCounter =
|
|
132
|
+
const startSideEffectCounter = 2;
|
|
127
133
|
|
|
128
134
|
const callContext = new CallContext(
|
|
129
135
|
msgSender,
|
|
@@ -132,8 +138,8 @@ export class ContractFunctionSimulator {
|
|
|
132
138
|
entryPointArtifact.isStatic,
|
|
133
139
|
);
|
|
134
140
|
|
|
135
|
-
const
|
|
136
|
-
const noteCache = new ExecutionNoteCache(
|
|
141
|
+
const protocolNullifier = await computeProtocolNullifier(await request.toTxRequest().hash());
|
|
142
|
+
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
137
143
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
138
144
|
|
|
139
145
|
const privateExecutionOracle = new PrivateExecutionOracle(
|
|
@@ -170,8 +176,8 @@ export class ContractFunctionSimulator {
|
|
|
170
176
|
request.functionSelector,
|
|
171
177
|
);
|
|
172
178
|
const simulatorTeardownTimer = new Timer();
|
|
173
|
-
const {
|
|
174
|
-
const firstNullifierHint =
|
|
179
|
+
const { usedProtocolNullifierForNonces } = noteCache.finish();
|
|
180
|
+
const firstNullifierHint = usedProtocolNullifierForNonces ? Fr.ZERO : noteCache.getAllNullifiers()[0];
|
|
175
181
|
|
|
176
182
|
const publicCallRequests = collectNested([executionResult], r =>
|
|
177
183
|
r.publicInputs.publicCallRequests
|
|
@@ -209,9 +215,9 @@ export class ContractFunctionSimulator {
|
|
|
209
215
|
* @param authwits - Authentication witnesses required for the function call.
|
|
210
216
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
211
217
|
* accounts if not specified.
|
|
212
|
-
* @returns A
|
|
218
|
+
* @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
|
|
213
219
|
*/
|
|
214
|
-
public async runUtility(call: FunctionCall, authwits: AuthWitness[], scopes?: AztecAddress[]): Promise<
|
|
220
|
+
public async runUtility(call: FunctionCall, authwits: AuthWitness[], scopes?: AztecAddress[]): Promise<Fr[]> {
|
|
215
221
|
await verifyCurrentClassId(call.to, this.executionDataProvider);
|
|
216
222
|
|
|
217
223
|
const entryPointArtifact = await this.executionDataProvider.getFunctionArtifact(call.to, call.selector);
|
|
@@ -244,9 +250,8 @@ export class ContractFunctionSimulator {
|
|
|
244
250
|
);
|
|
245
251
|
});
|
|
246
252
|
|
|
247
|
-
const returnWitness = witnessMapToFields(acirExecutionResult.returnWitness);
|
|
248
253
|
this.log.verbose(`Utility simulation for ${call.to}.${call.selector} completed`);
|
|
249
|
-
return
|
|
254
|
+
return witnessMapToFields(acirExecutionResult.returnWitness);
|
|
250
255
|
} catch (err) {
|
|
251
256
|
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
252
257
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import type { Fr, Point } from '@aztec/foundation/fields';
|
|
3
|
-
import type {
|
|
4
|
+
import type { FunctionArtifactWithContractName, FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
6
|
import type { L2Block } from '@aztec/stdlib/block';
|
|
6
7
|
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
@@ -74,6 +75,7 @@ export interface ExecutionDataProvider {
|
|
|
74
75
|
* Returns an object containing an array of note data.
|
|
75
76
|
*
|
|
76
77
|
* @param contractAddress - The contract address of the notes.
|
|
78
|
+
* @param owner - The owner of the notes.
|
|
77
79
|
* @param storageSlot - The storage slot of the notes.
|
|
78
80
|
* @param status - The status of notes to fetch.
|
|
79
81
|
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
@@ -81,6 +83,7 @@ export interface ExecutionDataProvider {
|
|
|
81
83
|
*/
|
|
82
84
|
getNotes(
|
|
83
85
|
contractAddress: AztecAddress,
|
|
86
|
+
owner: AztecAddress,
|
|
84
87
|
storageSlot: Fr,
|
|
85
88
|
status: NoteStatus,
|
|
86
89
|
scopes?: AztecAddress[],
|
|
@@ -106,16 +109,6 @@ export interface ExecutionDataProvider {
|
|
|
106
109
|
*/
|
|
107
110
|
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
|
|
108
111
|
|
|
109
|
-
/**
|
|
110
|
-
* Retrieves the artifact of a specified function within a given contract.
|
|
111
|
-
* The function is identified by its name, which is unique within a contract.
|
|
112
|
-
*
|
|
113
|
-
* @param contractAddress - The AztecAddress representing the contract containing the function.
|
|
114
|
-
* @param functionName - The name of the function.
|
|
115
|
-
* @returns The corresponding function's artifact as an object.
|
|
116
|
-
*/
|
|
117
|
-
getFunctionArtifactByName(contractAddress: AztecAddress, functionName: string): Promise<FunctionArtifact | undefined>;
|
|
118
|
-
|
|
119
112
|
/**
|
|
120
113
|
* Gets the index of a nullifier in the nullifier tree.
|
|
121
114
|
* @param nullifier - The nullifier.
|
|
@@ -159,7 +152,7 @@ export interface ExecutionDataProvider {
|
|
|
159
152
|
* @param leafValue - The leaf value
|
|
160
153
|
* @returns The index and sibling path concatenated [index, sibling_path]
|
|
161
154
|
*/
|
|
162
|
-
getMembershipWitness(blockNumber:
|
|
155
|
+
getMembershipWitness(blockNumber: BlockNumber, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]>;
|
|
163
156
|
|
|
164
157
|
/**
|
|
165
158
|
* Returns a nullifier membership witness for a given nullifier at a given block.
|
|
@@ -167,7 +160,10 @@ export interface ExecutionDataProvider {
|
|
|
167
160
|
* @param nullifier - Nullifier we try to find witness for.
|
|
168
161
|
* @returns The nullifier membership witness (if found).
|
|
169
162
|
*/
|
|
170
|
-
getNullifierMembershipWitness(
|
|
163
|
+
getNullifierMembershipWitness(
|
|
164
|
+
blockNumber: BlockNumber,
|
|
165
|
+
nullifier: Fr,
|
|
166
|
+
): Promise<NullifierMembershipWitness | undefined>;
|
|
171
167
|
|
|
172
168
|
/**
|
|
173
169
|
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
@@ -178,14 +174,17 @@ export interface ExecutionDataProvider {
|
|
|
178
174
|
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
179
175
|
* we are trying to prove non-inclusion for.
|
|
180
176
|
*/
|
|
181
|
-
getLowNullifierMembershipWitness(
|
|
177
|
+
getLowNullifierMembershipWitness(
|
|
178
|
+
blockNumber: BlockNumber,
|
|
179
|
+
nullifier: Fr,
|
|
180
|
+
): Promise<NullifierMembershipWitness | undefined>;
|
|
182
181
|
|
|
183
182
|
/**
|
|
184
183
|
* Returns a witness for a given slot of the public data tree at a given block.
|
|
185
184
|
* @param blockNumber - The block number at which to get the witness.
|
|
186
185
|
* @param leafSlot - The slot of the public data in the public data tree.
|
|
187
186
|
*/
|
|
188
|
-
getPublicDataWitness(blockNumber:
|
|
187
|
+
getPublicDataWitness(blockNumber: BlockNumber, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
189
188
|
|
|
190
189
|
/**
|
|
191
190
|
* Gets the storage value at the given contract storage slot.
|
|
@@ -199,14 +198,14 @@ export interface ExecutionDataProvider {
|
|
|
199
198
|
* @returns Storage value at the given contract slot.
|
|
200
199
|
* @throws If the contract is not deployed.
|
|
201
200
|
*/
|
|
202
|
-
getPublicStorageAt(blockNumber:
|
|
201
|
+
getPublicStorageAt(blockNumber: BlockNumber, contract: AztecAddress, slot: Fr): Promise<Fr>;
|
|
203
202
|
|
|
204
203
|
/**
|
|
205
204
|
* Fetch a block corresponding to the given block number.
|
|
206
205
|
* @param blockNumber - The block number of a block to fetch.
|
|
207
206
|
* @returns - The block corresponding to the given block number. Undefined if it does not exist.
|
|
208
207
|
*/
|
|
209
|
-
getBlock(blockNumber:
|
|
208
|
+
getBlock(blockNumber: BlockNumber): Promise<L2Block | undefined>;
|
|
210
209
|
|
|
211
210
|
/**
|
|
212
211
|
* Assert that the oracle version is compatible with the expected version.
|
|
@@ -44,9 +44,9 @@ export class ExecutionNoteCache {
|
|
|
44
44
|
* We don't need to use the tx request hash for nonces if another non revertible nullifier is emitted.
|
|
45
45
|
* In that case we disable injecting the tx request hash as a nullifier.
|
|
46
46
|
*/
|
|
47
|
-
private
|
|
47
|
+
private usedProtocolNullifierForNonces = true;
|
|
48
48
|
|
|
49
|
-
constructor(private readonly
|
|
49
|
+
constructor(private readonly protocolNullifier: Fr) {}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Enters the revertible phase of the transaction.
|
|
@@ -60,12 +60,11 @@ export class ExecutionNoteCache {
|
|
|
60
60
|
}
|
|
61
61
|
this.inRevertiblePhase = true;
|
|
62
62
|
this.minRevertibleSideEffectCounter = minRevertibleSideEffectCounter;
|
|
63
|
-
|
|
64
|
-
let nonceGenerator = this.txRequestHash;
|
|
63
|
+
let nonceGenerator = this.protocolNullifier;
|
|
65
64
|
const nullifiers = this.getAllNullifiers();
|
|
66
65
|
if (nullifiers.length > 0) {
|
|
67
66
|
nonceGenerator = new Fr(nullifiers[0]);
|
|
68
|
-
this.
|
|
67
|
+
this.usedProtocolNullifierForNonces = false;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
// The existing pending notes are all non-revertible.
|
|
@@ -92,14 +91,22 @@ export class ExecutionNoteCache {
|
|
|
92
91
|
updatedNotes.forEach(n => this.#addNote(n));
|
|
93
92
|
}
|
|
94
93
|
|
|
94
|
+
public isSideEffectCounterRevertible(sideEffectCounter: number): boolean {
|
|
95
|
+
if (!this.inRevertiblePhase) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
return sideEffectCounter >= this.minRevertibleSideEffectCounter;
|
|
99
|
+
}
|
|
100
|
+
|
|
95
101
|
public finish() {
|
|
96
|
-
// If we never entered the revertible phase, we need to use the
|
|
102
|
+
// If we never entered the revertible phase, we need to use the protocol nullifier to compute the nonces for the
|
|
103
|
+
// notes if no nullifiers have been emitted.
|
|
97
104
|
if (!this.inRevertiblePhase) {
|
|
98
|
-
this.
|
|
105
|
+
this.usedProtocolNullifierForNonces = this.getAllNullifiers().length === 0;
|
|
99
106
|
}
|
|
100
107
|
// If we entered the revertible phase, the nonce generator was decided based on wether or not a nullifier was emitted before entering.
|
|
101
108
|
return {
|
|
102
|
-
|
|
109
|
+
usedProtocolNullifierForNonces: this.usedProtocolNullifierForNonces,
|
|
103
110
|
};
|
|
104
111
|
}
|
|
105
112
|
|
|
@@ -166,11 +173,12 @@ export class ExecutionNoteCache {
|
|
|
166
173
|
* Return notes created up to current point in execution.
|
|
167
174
|
* If a nullifier for a note in this list is emitted, the note will be deleted.
|
|
168
175
|
* @param contractAddress - Contract address of the notes.
|
|
176
|
+
* @param owner - Owner of the notes.
|
|
169
177
|
* @param storageSlot - Storage slot of the notes.
|
|
170
178
|
**/
|
|
171
|
-
public getNotes(contractAddress: AztecAddress, storageSlot: Fr) {
|
|
179
|
+
public getNotes(contractAddress: AztecAddress, owner: AztecAddress, storageSlot: Fr) {
|
|
172
180
|
const notes = this.noteMap.get(contractAddress.toBigInt()) ?? [];
|
|
173
|
-
return notes.filter(n => n.note.storageSlot.equals(storageSlot)).map(n => n.note);
|
|
181
|
+
return notes.filter(n => n.note.owner.equals(owner) && n.note.storageSlot.equals(storageSlot)).map(n => n.note);
|
|
174
182
|
}
|
|
175
183
|
|
|
176
184
|
/**
|
|
@@ -42,7 +42,7 @@ export class LogRetrievalResponse {
|
|
|
42
42
|
return range(serializationLen).map(_ => Fr.zero());
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
static toSerializedOption(response
|
|
45
|
+
static toSerializedOption(response: LogRetrievalResponse | null): Fr[] {
|
|
46
46
|
if (response) {
|
|
47
47
|
return [new Fr(1), ...response.toFields()];
|
|
48
48
|
} else {
|
|
@@ -4,7 +4,7 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
4
4
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
5
5
|
|
|
6
6
|
// TODO(#14617): should we compute this from constants? This value is aztec-nr specific.
|
|
7
|
-
export const MAX_NOTE_PACKED_LEN =
|
|
7
|
+
export const MAX_NOTE_PACKED_LEN = 10;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Intermediate struct used to perform batch note validation by PXE. The `utilityValidateEnqueuedNotesAndEvents` oracle
|
|
@@ -13,7 +13,9 @@ export const MAX_NOTE_PACKED_LEN = 12;
|
|
|
13
13
|
export class NoteValidationRequest {
|
|
14
14
|
constructor(
|
|
15
15
|
public contractAddress: AztecAddress,
|
|
16
|
+
public owner: AztecAddress,
|
|
16
17
|
public storageSlot: Fr,
|
|
18
|
+
public randomness: Fr,
|
|
17
19
|
public noteNonce: Fr,
|
|
18
20
|
public content: Fr[],
|
|
19
21
|
public noteHash: Fr,
|
|
@@ -26,7 +28,9 @@ export class NoteValidationRequest {
|
|
|
26
28
|
const reader = FieldReader.asReader(fields);
|
|
27
29
|
|
|
28
30
|
const contractAddress = AztecAddress.fromField(reader.readField());
|
|
31
|
+
const owner = AztecAddress.fromField(reader.readField());
|
|
29
32
|
const storageSlot = reader.readField();
|
|
33
|
+
const randomness = reader.readField();
|
|
30
34
|
const noteNonce = reader.readField();
|
|
31
35
|
|
|
32
36
|
const contentStorage = reader.readFieldArray(MAX_NOTE_PACKED_LEN);
|
|
@@ -38,9 +42,17 @@ export class NoteValidationRequest {
|
|
|
38
42
|
const txHash = TxHash.fromField(reader.readField());
|
|
39
43
|
const recipient = AztecAddress.fromField(reader.readField());
|
|
40
44
|
|
|
45
|
+
if (reader.remainingFields() !== 0) {
|
|
46
|
+
throw new Error(
|
|
47
|
+
`Error converting array of fields to NoteValidationRequest. Hint: check that MAX_NOTE_PACKED_LEN is consistent with private_notes::MAX_NOTE_PACKED_LEN in Aztec-nr.`,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
41
51
|
return new NoteValidationRequest(
|
|
42
52
|
contractAddress,
|
|
53
|
+
owner,
|
|
43
54
|
storageSlot,
|
|
55
|
+
randomness,
|
|
44
56
|
noteNonce,
|
|
45
57
|
content,
|
|
46
58
|
noteHash,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { Fr, Point } from '@aztec/foundation/fields';
|
|
3
4
|
import type { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
4
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -21,8 +22,12 @@ export interface NoteData {
|
|
|
21
22
|
note: Note;
|
|
22
23
|
/** The address of the contract that owns the note. */
|
|
23
24
|
contractAddress: AztecAddress;
|
|
25
|
+
/** The owner of the note. */
|
|
26
|
+
owner: AztecAddress;
|
|
24
27
|
/** The storage slot of the note. */
|
|
25
28
|
storageSlot: Fr;
|
|
29
|
+
/** The randomness injected to the note */
|
|
30
|
+
randomness: Fr;
|
|
26
31
|
/** The nonce injected into the note hash preimage by kernels. */
|
|
27
32
|
noteNonce: Fr;
|
|
28
33
|
/** A hash of the note as it gets stored in the note hash tree. */
|
|
@@ -60,20 +65,21 @@ export interface IUtilityExecutionOracle {
|
|
|
60
65
|
utilityGetUtilityContext(): Promise<UtilityContext>;
|
|
61
66
|
utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest>;
|
|
62
67
|
utilityGetContractInstance(address: AztecAddress): Promise<ContractInstance>;
|
|
63
|
-
utilityGetMembershipWitness(blockNumber:
|
|
68
|
+
utilityGetMembershipWitness(blockNumber: BlockNumber, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[] | undefined>;
|
|
64
69
|
utilityGetNullifierMembershipWitness(
|
|
65
|
-
blockNumber:
|
|
70
|
+
blockNumber: BlockNumber,
|
|
66
71
|
nullifier: Fr,
|
|
67
72
|
): Promise<NullifierMembershipWitness | undefined>;
|
|
68
|
-
utilityGetPublicDataWitness(blockNumber:
|
|
73
|
+
utilityGetPublicDataWitness(blockNumber: BlockNumber, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
69
74
|
utilityGetLowNullifierMembershipWitness(
|
|
70
|
-
blockNumber:
|
|
75
|
+
blockNumber: BlockNumber,
|
|
71
76
|
nullifier: Fr,
|
|
72
77
|
): Promise<NullifierMembershipWitness | undefined>;
|
|
73
|
-
utilityGetBlockHeader(blockNumber:
|
|
78
|
+
utilityGetBlockHeader(blockNumber: BlockNumber): Promise<BlockHeader | undefined>;
|
|
74
79
|
utilityGetPublicKeysAndPartialAddress(account: AztecAddress): Promise<CompleteAddress>;
|
|
75
80
|
utilityGetAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
|
|
76
81
|
utilityGetNotes(
|
|
82
|
+
owner: AztecAddress,
|
|
77
83
|
storageSlot: Fr,
|
|
78
84
|
numSelects: number,
|
|
79
85
|
selectByIndexes: number[],
|
|
@@ -98,7 +104,7 @@ export interface IUtilityExecutionOracle {
|
|
|
98
104
|
utilityStorageRead(
|
|
99
105
|
contractAddress: AztecAddress,
|
|
100
106
|
startStorageSlot: Fr,
|
|
101
|
-
blockNumber:
|
|
107
|
+
blockNumber: BlockNumber,
|
|
102
108
|
numberOfElements: number,
|
|
103
109
|
): Promise<Fr[]>;
|
|
104
110
|
utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr): Promise<void>;
|
|
@@ -129,7 +135,15 @@ export interface IPrivateExecutionOracle {
|
|
|
129
135
|
|
|
130
136
|
privateStoreInExecutionCache(values: Fr[], hash: Fr): void;
|
|
131
137
|
privateLoadFromExecutionCache(hash: Fr): Promise<Fr[]>;
|
|
132
|
-
privateNotifyCreatedNote(
|
|
138
|
+
privateNotifyCreatedNote(
|
|
139
|
+
owner: AztecAddress,
|
|
140
|
+
storageSlot: Fr,
|
|
141
|
+
randomness: Fr,
|
|
142
|
+
noteTypeId: NoteSelector,
|
|
143
|
+
note: Fr[],
|
|
144
|
+
noteHash: Fr,
|
|
145
|
+
counter: number,
|
|
146
|
+
): void;
|
|
133
147
|
privateNotifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number): Promise<void>;
|
|
134
148
|
privateNotifyCreatedNullifier(innerNullifier: Fr): Promise<void>;
|
|
135
149
|
privateNotifyCreatedContractClassLog(log: ContractClassLog, counter: number): void;
|
|
@@ -153,6 +167,7 @@ export interface IPrivateExecutionOracle {
|
|
|
153
167
|
isStaticCall: boolean,
|
|
154
168
|
): Promise<void>;
|
|
155
169
|
privateNotifySetMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void>;
|
|
170
|
+
privateIsSideEffectCounterRevertible(sideEffectCounter: number): Promise<boolean>;
|
|
156
171
|
privateGetSenderForTags(): Promise<AztecAddress | undefined>;
|
|
157
172
|
privateSetSenderForTags(senderForTags: AztecAddress): Promise<void>;
|
|
158
173
|
privateGetNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag>;
|
|
@@ -24,6 +24,7 @@ function fromRawData(nonzeroNoteHashCounter: boolean, maybeNoteNonce: Fr): { sta
|
|
|
24
24
|
* and only after that it packs the retrieved note. Hence it doesn't map one to one with `RetrievedNote::pack()`.
|
|
25
25
|
*
|
|
26
26
|
* @param contractAddress - The address of the contract that owns the note
|
|
27
|
+
* @param randomness - The randomness injected into the note to get the hiding property of commitments
|
|
27
28
|
* @param noteNonce - The nonce injected into the note hash preimage by kernels.
|
|
28
29
|
* @param index - Optional index in the note hash tree. If undefined, indicates a transient note
|
|
29
30
|
* @param note - The note content containing the actual note data
|
|
@@ -31,22 +32,23 @@ function fromRawData(nonzeroNoteHashCounter: boolean, maybeNoteNonce: Fr): { sta
|
|
|
31
32
|
*/
|
|
32
33
|
export function packAsRetrievedNote({
|
|
33
34
|
contractAddress,
|
|
35
|
+
randomness,
|
|
34
36
|
noteNonce,
|
|
35
37
|
index,
|
|
36
38
|
note,
|
|
37
39
|
}: {
|
|
38
40
|
contractAddress: AztecAddress;
|
|
41
|
+
randomness: Fr;
|
|
39
42
|
noteNonce: Fr;
|
|
40
43
|
index?: bigint;
|
|
41
44
|
note: Note;
|
|
42
45
|
}) {
|
|
43
46
|
// If index is undefined, the note is transient which implies that the nonzero_note_hash_counter has to be true
|
|
44
|
-
const
|
|
45
|
-
const nonzeroNoteHashCounter = noteIsTransient ? true : false;
|
|
47
|
+
const nonzeroNoteHashCounter = index === undefined;
|
|
46
48
|
|
|
47
49
|
// To pack the note as retrieved note we first need to reconstruct the note metadata.
|
|
48
50
|
const noteMetadata = fromRawData(nonzeroNoteHashCounter, noteNonce);
|
|
49
51
|
|
|
50
52
|
// Pack metadata first (stage and maybe_note_nonce), followed by the rest
|
|
51
|
-
return [...note.items, contractAddress, new Fr(noteMetadata.stage), noteMetadata.maybeNoteNonce];
|
|
53
|
+
return [...note.items, contractAddress, randomness, new Fr(noteMetadata.stage), noteMetadata.maybeNoteNonce];
|
|
52
54
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { Fr, Point } from '@aztec/foundation/fields';
|
|
2
3
|
import {
|
|
3
4
|
type ACIRCallback,
|
|
@@ -100,8 +101,7 @@ export class Oracle {
|
|
|
100
101
|
return Promise.resolve([toACVMField(val)]);
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
|
|
104
|
-
privateStoreInExecutionCache(_length: ACVMField[], values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
|
|
104
|
+
privateStoreInExecutionCache(values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
|
|
105
105
|
this.handlerAsPrivate().privateStoreInExecutionCache(values.map(Fr.fromString), Fr.fromString(hash));
|
|
106
106
|
return Promise.resolve([]);
|
|
107
107
|
}
|
|
@@ -146,7 +146,7 @@ export class Oracle {
|
|
|
146
146
|
const parsedLeafValue = Fr.fromString(leafValue);
|
|
147
147
|
|
|
148
148
|
const witness = await this.handlerAsUtility().utilityGetMembershipWitness(
|
|
149
|
-
parsedBlockNumber,
|
|
149
|
+
BlockNumber(parsedBlockNumber),
|
|
150
150
|
parsedTreeId,
|
|
151
151
|
parsedLeafValue,
|
|
152
152
|
);
|
|
@@ -166,7 +166,7 @@ export class Oracle {
|
|
|
166
166
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
167
167
|
|
|
168
168
|
const witness = await this.handlerAsUtility().utilityGetNullifierMembershipWitness(
|
|
169
|
-
parsedBlockNumber,
|
|
169
|
+
BlockNumber(parsedBlockNumber),
|
|
170
170
|
parsedNullifier,
|
|
171
171
|
);
|
|
172
172
|
if (!witness) {
|
|
@@ -183,7 +183,7 @@ export class Oracle {
|
|
|
183
183
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
184
184
|
|
|
185
185
|
const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(
|
|
186
|
-
parsedBlockNumber,
|
|
186
|
+
BlockNumber(parsedBlockNumber),
|
|
187
187
|
parsedNullifier,
|
|
188
188
|
);
|
|
189
189
|
if (!witness) {
|
|
@@ -201,7 +201,10 @@ export class Oracle {
|
|
|
201
201
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
202
202
|
const parsedLeafSlot = Fr.fromString(leafSlot);
|
|
203
203
|
|
|
204
|
-
const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(
|
|
204
|
+
const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(
|
|
205
|
+
BlockNumber(parsedBlockNumber),
|
|
206
|
+
parsedLeafSlot,
|
|
207
|
+
);
|
|
205
208
|
if (!witness) {
|
|
206
209
|
throw new Error(`Public data witness not found for slot ${parsedLeafSlot} at block ${parsedBlockNumber}.`);
|
|
207
210
|
}
|
|
@@ -211,7 +214,7 @@ export class Oracle {
|
|
|
211
214
|
async utilityGetBlockHeader([blockNumber]: ACVMField[]): Promise<ACVMField[]> {
|
|
212
215
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
213
216
|
|
|
214
|
-
const header = await this.handlerAsUtility().utilityGetBlockHeader(parsedBlockNumber);
|
|
217
|
+
const header = await this.handlerAsUtility().utilityGetBlockHeader(BlockNumber(parsedBlockNumber));
|
|
215
218
|
if (!header) {
|
|
216
219
|
throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
|
|
217
220
|
}
|
|
@@ -236,6 +239,7 @@ export class Oracle {
|
|
|
236
239
|
}
|
|
237
240
|
|
|
238
241
|
async utilityGetNotes(
|
|
242
|
+
[owner]: ACVMField[],
|
|
239
243
|
[storageSlot]: ACVMField[],
|
|
240
244
|
[numSelects]: ACVMField[],
|
|
241
245
|
selectByIndexes: ACVMField[],
|
|
@@ -254,6 +258,7 @@ export class Oracle {
|
|
|
254
258
|
[packedRetrievedNoteLength]: ACVMField[],
|
|
255
259
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
256
260
|
const noteDatas = await this.handlerAsUtility().utilityGetNotes(
|
|
261
|
+
AztecAddress.fromString(owner),
|
|
257
262
|
Fr.fromString(storageSlot),
|
|
258
263
|
+numSelects,
|
|
259
264
|
selectByIndexes.map(s => +s),
|
|
@@ -282,14 +287,18 @@ export class Oracle {
|
|
|
282
287
|
}
|
|
283
288
|
|
|
284
289
|
privateNotifyCreatedNote(
|
|
290
|
+
[owner]: ACVMField[],
|
|
285
291
|
[storageSlot]: ACVMField[],
|
|
292
|
+
[randomness]: ACVMField[],
|
|
286
293
|
[noteTypeId]: ACVMField[],
|
|
287
294
|
note: ACVMField[],
|
|
288
295
|
[noteHash]: ACVMField[],
|
|
289
296
|
[counter]: ACVMField[],
|
|
290
297
|
): Promise<ACVMField[]> {
|
|
291
298
|
this.handlerAsPrivate().privateNotifyCreatedNote(
|
|
299
|
+
AztecAddress.fromString(owner),
|
|
292
300
|
Fr.fromString(storageSlot),
|
|
301
|
+
Fr.fromString(randomness),
|
|
293
302
|
NoteSelector.fromField(Fr.fromString(noteTypeId)),
|
|
294
303
|
note.map(Fr.fromString),
|
|
295
304
|
Fr.fromString(noteHash),
|
|
@@ -343,7 +352,7 @@ export class Oracle {
|
|
|
343
352
|
const values = await this.handlerAsUtility().utilityStorageRead(
|
|
344
353
|
new AztecAddress(Fr.fromString(contractAddress)),
|
|
345
354
|
Fr.fromString(startStorageSlot),
|
|
346
|
-
+blockNumber,
|
|
355
|
+
BlockNumber(+blockNumber),
|
|
347
356
|
+numberOfElements,
|
|
348
357
|
);
|
|
349
358
|
return [values.map(toACVMField)];
|
|
@@ -433,6 +442,13 @@ export class Oracle {
|
|
|
433
442
|
return Promise.resolve([]);
|
|
434
443
|
}
|
|
435
444
|
|
|
445
|
+
async privateIsSideEffectCounterRevertible([sideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
|
|
446
|
+
const isRevertible = await this.handlerAsPrivate().privateIsSideEffectCounterRevertible(
|
|
447
|
+
Fr.fromString(sideEffectCounter).toNumber(),
|
|
448
|
+
);
|
|
449
|
+
return Promise.resolve([toACVMField(isRevertible)]);
|
|
450
|
+
}
|
|
451
|
+
|
|
436
452
|
async privateGetNextAppTagAsSender([sender]: ACVMField[], [recipient]: ACVMField[]): Promise<ACVMField[]> {
|
|
437
453
|
const tag = await this.handlerAsPrivate().privateGetNextAppTagAsSender(
|
|
438
454
|
AztecAddress.fromString(sender),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH, PRIVATE_CONTEXT_INPUTS_LENGTH } from '@aztec/constants';
|
|
2
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
5
|
import { Timer } from '@aztec/foundation/timer';
|
|
@@ -162,7 +163,7 @@ export async function readCurrentClassId(
|
|
|
162
163
|
contractAddress: AztecAddress,
|
|
163
164
|
instance: ContractInstance,
|
|
164
165
|
executionDataProvider: ExecutionDataProvider | AztecNode,
|
|
165
|
-
blockNumber:
|
|
166
|
+
blockNumber: BlockNumber,
|
|
166
167
|
timestamp: UInt64,
|
|
167
168
|
) {
|
|
168
169
|
const { delayedPublicMutableSlot } = await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(contractAddress);
|
|
@@ -282,6 +282,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
282
282
|
* Real notes coming from DB will have a leafIndex which
|
|
283
283
|
* represents their index in the note hash tree.
|
|
284
284
|
*
|
|
285
|
+
* @param owner - The owner of the notes.
|
|
285
286
|
* @param storageSlot - The storage slot.
|
|
286
287
|
* @param numSelects - The number of valid selects in selectBy and selectValues.
|
|
287
288
|
* @param selectBy - An array of indices of the fields to selects.
|
|
@@ -295,6 +296,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
295
296
|
* @returns Array of note data.
|
|
296
297
|
*/
|
|
297
298
|
public override async utilityGetNotes(
|
|
299
|
+
owner: AztecAddress,
|
|
298
300
|
storageSlot: Fr,
|
|
299
301
|
numSelects: number,
|
|
300
302
|
selectByIndexes: number[],
|
|
@@ -311,11 +313,12 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
311
313
|
status: NoteStatus,
|
|
312
314
|
): Promise<NoteData[]> {
|
|
313
315
|
// Nullified pending notes are already removed from the list.
|
|
314
|
-
const pendingNotes = this.noteCache.getNotes(this.callContext.contractAddress, storageSlot);
|
|
316
|
+
const pendingNotes = this.noteCache.getNotes(this.callContext.contractAddress, owner, storageSlot);
|
|
315
317
|
|
|
316
318
|
const pendingNullifiers = this.noteCache.getNullifiers(this.callContext.contractAddress);
|
|
317
319
|
const dbNotes = await this.executionDataProvider.getNotes(
|
|
318
320
|
this.callContext.contractAddress,
|
|
321
|
+
owner,
|
|
319
322
|
storageSlot,
|
|
320
323
|
status,
|
|
321
324
|
this.scopes,
|
|
@@ -365,15 +368,18 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
365
368
|
/**
|
|
366
369
|
* Keep track of the new note created during execution.
|
|
367
370
|
* It can be used in subsequent calls (or transactions when chaining txs is possible).
|
|
368
|
-
* @param
|
|
371
|
+
* @param owner - The owner of the note.
|
|
369
372
|
* @param storageSlot - The storage slot.
|
|
373
|
+
* @param randomness - The randomness injected into the note.
|
|
370
374
|
* @param noteTypeId - The type ID of the note.
|
|
371
375
|
* @param noteItems - The items to be included in a Note.
|
|
372
376
|
* @param noteHash - A hash of the new note.
|
|
373
377
|
* @returns
|
|
374
378
|
*/
|
|
375
379
|
public privateNotifyCreatedNote(
|
|
380
|
+
owner: AztecAddress,
|
|
376
381
|
storageSlot: Fr,
|
|
382
|
+
randomness: Fr,
|
|
377
383
|
noteTypeId: NoteSelector,
|
|
378
384
|
noteItems: Fr[],
|
|
379
385
|
noteHash: Fr,
|
|
@@ -382,6 +388,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
382
388
|
this.log.debug(`Notified of new note with inner hash ${noteHash}`, {
|
|
383
389
|
contractAddress: this.callContext.contractAddress,
|
|
384
390
|
storageSlot,
|
|
391
|
+
randomness,
|
|
385
392
|
noteTypeId,
|
|
386
393
|
counter,
|
|
387
394
|
});
|
|
@@ -390,7 +397,9 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
390
397
|
this.noteCache.addNewNote(
|
|
391
398
|
{
|
|
392
399
|
contractAddress: this.callContext.contractAddress,
|
|
400
|
+
owner,
|
|
393
401
|
storageSlot,
|
|
402
|
+
randomness,
|
|
394
403
|
noteNonce: Fr.ZERO, // Nonce cannot be known during private execution.
|
|
395
404
|
note,
|
|
396
405
|
siloedNullifier: undefined, // Siloed nullifier cannot be known for newly created note.
|
|
@@ -398,7 +407,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
398
407
|
},
|
|
399
408
|
counter,
|
|
400
409
|
);
|
|
401
|
-
this.newNotes.push(
|
|
410
|
+
this.newNotes.push(NoteAndSlot.from({ note, storageSlot, randomness, noteTypeId }));
|
|
402
411
|
}
|
|
403
412
|
|
|
404
413
|
/**
|
|
@@ -594,6 +603,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
594
603
|
return this.noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
|
|
595
604
|
}
|
|
596
605
|
|
|
606
|
+
public privateIsSideEffectCounterRevertible(sideEffectCounter: number): Promise<boolean> {
|
|
607
|
+
return Promise.resolve(this.noteCache.isSideEffectCounterRevertible(sideEffectCounter));
|
|
608
|
+
}
|
|
609
|
+
|
|
597
610
|
/**
|
|
598
611
|
* Derives the call context for a nested execution.
|
|
599
612
|
* @param targetContractAddress - The address of the contract being called.
|