@aztec/pxe 3.0.0-devnet.5 → 3.0.0-devnet.6-patch.1
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/bin/check_oracle_version.js +105 -15
- 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 +6 -6
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +15 -16
- package/dest/contract_function_simulator/execution_data_provider.d.ts +13 -19
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.d.ts +9 -7
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +21 -13
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +3 -3
- 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 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +6 -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 +12 -3
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -1
- package/dest/contract_function_simulator/oracle/index.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +17 -10
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +2 -4
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +10 -4
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +10 -5
- 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 +31 -14
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +4 -3
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +8 -12
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +20 -7
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +13 -11
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +5 -4
- package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +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 +15 -13
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +50 -25
- 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.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +13 -4
- 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.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +13 -4
- package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +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 +13 -20
- package/dest/error_enriching.d.ts +1 -1
- package/dest/events/index.d.ts +2 -0
- package/dest/events/index.d.ts.map +1 -0
- package/dest/events/index.js +1 -0
- package/dest/events/private_event_filter_validator.d.ts +8 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +39 -0
- 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 +4 -4
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +26 -25
- package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +6 -5
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/pxe.d.ts +26 -19
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +35 -50
- 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 +2 -2
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +1 -1
- package/dest/storage/capsule_data_provider/index.d.ts +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +3 -13
- 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/contract_data_provider/private_functions_tree.js +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 +8 -7
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.js +27 -13
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +30 -14
- 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 +47 -25
- 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 +2 -2
- package/dest/tagging/siloed_tag.d.ts.map +1 -1
- package/dest/tagging/siloed_tag.js +1 -1
- package/dest/tagging/tag.d.ts +2 -2
- package/dest/tagging/tag.d.ts.map +1 -1
- package/dest/tagging/tag.js +1 -1
- package/dest/tagging/utils.d.ts +1 -1
- package/package.json +20 -19
- package/src/bin/check_oracle_version.ts +130 -20
- package/src/config/index.ts +8 -23
- package/src/contract_function_simulator/contract_function_simulator.ts +23 -18
- package/src/contract_function_simulator/execution_data_provider.ts +18 -18
- package/src/contract_function_simulator/execution_note_cache.ts +22 -11
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +2 -2
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +14 -2
- package/src/contract_function_simulator/noir-structs/utility_context.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +24 -8
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +21 -5
- package/src/contract_function_simulator/oracle/oracle.ts +40 -10
- package/src/contract_function_simulator/oracle/private_execution.ts +3 -2
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +17 -4
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +22 -9
- package/src/contract_function_simulator/pick_notes.ts +1 -1
- package/src/contract_function_simulator/pxe_oracle_interface.ts +98 -59
- package/src/entrypoints/client/bundle/utils.ts +10 -4
- package/src/entrypoints/client/lazy/utils.ts +10 -5
- package/src/entrypoints/pxe_creation_options.ts +4 -1
- package/src/entrypoints/server/utils.ts +13 -31
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +47 -0
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +5 -9
- package/src/private_kernel/private_kernel_execution_prover.ts +27 -31
- package/src/private_kernel/private_kernel_oracle.ts +2 -1
- package/src/private_kernel/private_kernel_oracle_impl.ts +4 -3
- package/src/pxe.ts +50 -75
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +1 -1
- package/src/storage/contract_data_provider/contract_data_provider.ts +1 -18
- package/src/storage/contract_data_provider/private_functions_tree.ts +1 -1
- package/src/storage/note_data_provider/index.ts +1 -1
- package/src/storage/note_data_provider/note_data_provider.ts +34 -15
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +69 -35
- package/src/storage/sync_data_provider/sync_data_provider.ts +2 -1
- package/src/synchronizer/synchronizer.ts +2 -1
- package/src/tagging/siloed_tag.ts +2 -2
- package/src/tagging/tag.ts +2 -2
- 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
|
@@ -17,8 +17,8 @@ import {
|
|
|
17
17
|
MAX_PRIVATE_LOGS_PER_TX,
|
|
18
18
|
} from '@aztec/constants';
|
|
19
19
|
import { arrayNonEmptyLength, padArrayEnd } from '@aztec/foundation/collection';
|
|
20
|
-
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
21
|
-
import { Fr } from '@aztec/foundation/
|
|
20
|
+
import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
|
|
21
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
22
22
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
23
23
|
import { Timer } from '@aztec/foundation/timer';
|
|
24
24
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
@@ -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,
|
|
@@ -51,7 +57,7 @@ import {
|
|
|
51
57
|
} from '@aztec/stdlib/kernel';
|
|
52
58
|
import { PrivateLog } from '@aztec/stdlib/logs';
|
|
53
59
|
import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
|
|
54
|
-
import {
|
|
60
|
+
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
55
61
|
import {
|
|
56
62
|
CallContext,
|
|
57
63
|
HashedValues,
|
|
@@ -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
|
}
|
|
@@ -269,7 +274,7 @@ class OrderedSideEffect<T> {
|
|
|
269
274
|
}
|
|
270
275
|
|
|
271
276
|
/**
|
|
272
|
-
* Generates the final public inputs of the tail kernel circuit, an empty
|
|
277
|
+
* Generates the final public inputs of the tail kernel circuit, an empty Chonk proof
|
|
273
278
|
* and the execution steps for a `PrivateExecutionResult` as if it had been
|
|
274
279
|
* processed by the private kernel prover. This skips many of the checks performed by the kernels
|
|
275
280
|
* (allowing state overrides) and is much faster, while still generating a valid
|
|
@@ -489,8 +494,8 @@ export async function generateSimulatedProvingResult(
|
|
|
489
494
|
|
|
490
495
|
return {
|
|
491
496
|
publicInputs,
|
|
492
|
-
|
|
493
|
-
executionSteps
|
|
497
|
+
chonkProof: ChonkProof.empty(),
|
|
498
|
+
executionSteps,
|
|
494
499
|
};
|
|
495
500
|
}
|
|
496
501
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import type { Point } from '@aztec/foundation/curves/grumpkin';
|
|
5
|
+
import type { FunctionArtifactWithContractName, FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
6
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
7
|
import type { L2Block } from '@aztec/stdlib/block';
|
|
6
8
|
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
@@ -74,6 +76,7 @@ export interface ExecutionDataProvider {
|
|
|
74
76
|
* Returns an object containing an array of note data.
|
|
75
77
|
*
|
|
76
78
|
* @param contractAddress - The contract address of the notes.
|
|
79
|
+
* @param owner - The owner of the notes. If undefined, returns notes for all owners.
|
|
77
80
|
* @param storageSlot - The storage slot of the notes.
|
|
78
81
|
* @param status - The status of notes to fetch.
|
|
79
82
|
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
@@ -81,6 +84,7 @@ export interface ExecutionDataProvider {
|
|
|
81
84
|
*/
|
|
82
85
|
getNotes(
|
|
83
86
|
contractAddress: AztecAddress,
|
|
87
|
+
owner: AztecAddress | undefined,
|
|
84
88
|
storageSlot: Fr,
|
|
85
89
|
status: NoteStatus,
|
|
86
90
|
scopes?: AztecAddress[],
|
|
@@ -106,16 +110,6 @@ export interface ExecutionDataProvider {
|
|
|
106
110
|
*/
|
|
107
111
|
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
|
|
108
112
|
|
|
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
113
|
/**
|
|
120
114
|
* Gets the index of a nullifier in the nullifier tree.
|
|
121
115
|
* @param nullifier - The nullifier.
|
|
@@ -159,7 +153,7 @@ export interface ExecutionDataProvider {
|
|
|
159
153
|
* @param leafValue - The leaf value
|
|
160
154
|
* @returns The index and sibling path concatenated [index, sibling_path]
|
|
161
155
|
*/
|
|
162
|
-
getMembershipWitness(blockNumber:
|
|
156
|
+
getMembershipWitness(blockNumber: BlockNumber, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]>;
|
|
163
157
|
|
|
164
158
|
/**
|
|
165
159
|
* Returns a nullifier membership witness for a given nullifier at a given block.
|
|
@@ -167,7 +161,10 @@ export interface ExecutionDataProvider {
|
|
|
167
161
|
* @param nullifier - Nullifier we try to find witness for.
|
|
168
162
|
* @returns The nullifier membership witness (if found).
|
|
169
163
|
*/
|
|
170
|
-
getNullifierMembershipWitness(
|
|
164
|
+
getNullifierMembershipWitness(
|
|
165
|
+
blockNumber: BlockNumber,
|
|
166
|
+
nullifier: Fr,
|
|
167
|
+
): Promise<NullifierMembershipWitness | undefined>;
|
|
171
168
|
|
|
172
169
|
/**
|
|
173
170
|
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
@@ -178,14 +175,17 @@ export interface ExecutionDataProvider {
|
|
|
178
175
|
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
179
176
|
* we are trying to prove non-inclusion for.
|
|
180
177
|
*/
|
|
181
|
-
getLowNullifierMembershipWitness(
|
|
178
|
+
getLowNullifierMembershipWitness(
|
|
179
|
+
blockNumber: BlockNumber,
|
|
180
|
+
nullifier: Fr,
|
|
181
|
+
): Promise<NullifierMembershipWitness | undefined>;
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
184
|
* Returns a witness for a given slot of the public data tree at a given block.
|
|
185
185
|
* @param blockNumber - The block number at which to get the witness.
|
|
186
186
|
* @param leafSlot - The slot of the public data in the public data tree.
|
|
187
187
|
*/
|
|
188
|
-
getPublicDataWitness(blockNumber:
|
|
188
|
+
getPublicDataWitness(blockNumber: BlockNumber, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
191
|
* Gets the storage value at the given contract storage slot.
|
|
@@ -199,14 +199,14 @@ export interface ExecutionDataProvider {
|
|
|
199
199
|
* @returns Storage value at the given contract slot.
|
|
200
200
|
* @throws If the contract is not deployed.
|
|
201
201
|
*/
|
|
202
|
-
getPublicStorageAt(blockNumber:
|
|
202
|
+
getPublicStorageAt(blockNumber: BlockNumber, contract: AztecAddress, slot: Fr): Promise<Fr>;
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* Fetch a block corresponding to the given block number.
|
|
206
206
|
* @param blockNumber - The block number of a block to fetch.
|
|
207
207
|
* @returns - The block corresponding to the given block number. Undefined if it does not exist.
|
|
208
208
|
*/
|
|
209
|
-
getBlock(blockNumber:
|
|
209
|
+
getBlock(blockNumber: BlockNumber): Promise<L2Block | undefined>;
|
|
210
210
|
|
|
211
211
|
/**
|
|
212
212
|
* Assert that the oracle version is compatible with the expected version.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
4
4
|
|
|
@@ -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,15 @@ 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. If undefined, returns all notes regardless of owner.
|
|
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 | undefined, storageSlot: Fr) {
|
|
172
180
|
const notes = this.noteMap.get(contractAddress.toBigInt()) ?? [];
|
|
173
|
-
return notes
|
|
181
|
+
return notes
|
|
182
|
+
.filter(n => owner === undefined || n.note.owner.equals(owner))
|
|
183
|
+
.filter(n => n.note.storageSlot.equals(storageSlot))
|
|
184
|
+
.map(n => n.note);
|
|
174
185
|
}
|
|
175
186
|
|
|
176
187
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
3
|
import { EventSelector } from '@aztec/stdlib/abi';
|
|
4
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MAX_NOTE_HASHES_PER_TX, PRIVATE_LOG_CIPHERTEXT_LEN } from '@aztec/constants';
|
|
2
2
|
import { range } from '@aztec/foundation/array';
|
|
3
|
-
import { Fr } from '@aztec/foundation/
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import type { TxHash } from '@aztec/stdlib/tx';
|
|
5
5
|
|
|
6
6
|
import { MAX_NOTE_PACKED_LEN } from './note_validation_request.js';
|
|
@@ -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 {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
3
|
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,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import {
|
|
2
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
3
5
|
import type { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
4
6
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
7
|
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
@@ -21,8 +23,12 @@ export interface NoteData {
|
|
|
21
23
|
note: Note;
|
|
22
24
|
/** The address of the contract that owns the note. */
|
|
23
25
|
contractAddress: AztecAddress;
|
|
26
|
+
/** The owner of the note. */
|
|
27
|
+
owner: AztecAddress;
|
|
24
28
|
/** The storage slot of the note. */
|
|
25
29
|
storageSlot: Fr;
|
|
30
|
+
/** The randomness injected to the note */
|
|
31
|
+
randomness: Fr;
|
|
26
32
|
/** The nonce injected into the note hash preimage by kernels. */
|
|
27
33
|
noteNonce: Fr;
|
|
28
34
|
/** A hash of the note as it gets stored in the note hash tree. */
|
|
@@ -60,20 +66,21 @@ export interface IUtilityExecutionOracle {
|
|
|
60
66
|
utilityGetUtilityContext(): Promise<UtilityContext>;
|
|
61
67
|
utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest>;
|
|
62
68
|
utilityGetContractInstance(address: AztecAddress): Promise<ContractInstance>;
|
|
63
|
-
utilityGetMembershipWitness(blockNumber:
|
|
69
|
+
utilityGetMembershipWitness(blockNumber: BlockNumber, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[] | undefined>;
|
|
64
70
|
utilityGetNullifierMembershipWitness(
|
|
65
|
-
blockNumber:
|
|
71
|
+
blockNumber: BlockNumber,
|
|
66
72
|
nullifier: Fr,
|
|
67
73
|
): Promise<NullifierMembershipWitness | undefined>;
|
|
68
|
-
utilityGetPublicDataWitness(blockNumber:
|
|
74
|
+
utilityGetPublicDataWitness(blockNumber: BlockNumber, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
69
75
|
utilityGetLowNullifierMembershipWitness(
|
|
70
|
-
blockNumber:
|
|
76
|
+
blockNumber: BlockNumber,
|
|
71
77
|
nullifier: Fr,
|
|
72
78
|
): Promise<NullifierMembershipWitness | undefined>;
|
|
73
|
-
utilityGetBlockHeader(blockNumber:
|
|
79
|
+
utilityGetBlockHeader(blockNumber: BlockNumber): Promise<BlockHeader | undefined>;
|
|
74
80
|
utilityGetPublicKeysAndPartialAddress(account: AztecAddress): Promise<CompleteAddress>;
|
|
75
81
|
utilityGetAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
|
|
76
82
|
utilityGetNotes(
|
|
83
|
+
owner: AztecAddress | undefined,
|
|
77
84
|
storageSlot: Fr,
|
|
78
85
|
numSelects: number,
|
|
79
86
|
selectByIndexes: number[],
|
|
@@ -98,7 +105,7 @@ export interface IUtilityExecutionOracle {
|
|
|
98
105
|
utilityStorageRead(
|
|
99
106
|
contractAddress: AztecAddress,
|
|
100
107
|
startStorageSlot: Fr,
|
|
101
|
-
blockNumber:
|
|
108
|
+
blockNumber: BlockNumber,
|
|
102
109
|
numberOfElements: number,
|
|
103
110
|
): Promise<Fr[]>;
|
|
104
111
|
utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr): Promise<void>;
|
|
@@ -129,7 +136,15 @@ export interface IPrivateExecutionOracle {
|
|
|
129
136
|
|
|
130
137
|
privateStoreInExecutionCache(values: Fr[], hash: Fr): void;
|
|
131
138
|
privateLoadFromExecutionCache(hash: Fr): Promise<Fr[]>;
|
|
132
|
-
privateNotifyCreatedNote(
|
|
139
|
+
privateNotifyCreatedNote(
|
|
140
|
+
owner: AztecAddress,
|
|
141
|
+
storageSlot: Fr,
|
|
142
|
+
randomness: Fr,
|
|
143
|
+
noteTypeId: NoteSelector,
|
|
144
|
+
note: Fr[],
|
|
145
|
+
noteHash: Fr,
|
|
146
|
+
counter: number,
|
|
147
|
+
): void;
|
|
133
148
|
privateNotifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number): Promise<void>;
|
|
134
149
|
privateNotifyCreatedNullifier(innerNullifier: Fr): Promise<void>;
|
|
135
150
|
privateNotifyCreatedContractClassLog(log: ContractClassLog, counter: number): void;
|
|
@@ -153,6 +168,7 @@ export interface IPrivateExecutionOracle {
|
|
|
153
168
|
isStaticCall: boolean,
|
|
154
169
|
): Promise<void>;
|
|
155
170
|
privateNotifySetMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void>;
|
|
171
|
+
privateIsSideEffectCounterRevertible(sideEffectCounter: number): Promise<boolean>;
|
|
156
172
|
privateGetSenderForTags(): Promise<AztecAddress | undefined>;
|
|
157
173
|
privateSetSenderForTags(senderForTags: AztecAddress): Promise<void>;
|
|
158
174
|
privateGetNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import type { Note } from '@aztec/stdlib/note';
|
|
4
4
|
|
|
@@ -24,6 +24,9 @@ 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 owner - The owner of the note
|
|
28
|
+
* @param randomness - The randomness injected into the note to get the hiding property of commitments
|
|
29
|
+
* @param storageSlot - The storage slot of the note
|
|
27
30
|
* @param noteNonce - The nonce injected into the note hash preimage by kernels.
|
|
28
31
|
* @param index - Optional index in the note hash tree. If undefined, indicates a transient note
|
|
29
32
|
* @param note - The note content containing the actual note data
|
|
@@ -31,22 +34,35 @@ function fromRawData(nonzeroNoteHashCounter: boolean, maybeNoteNonce: Fr): { sta
|
|
|
31
34
|
*/
|
|
32
35
|
export function packAsRetrievedNote({
|
|
33
36
|
contractAddress,
|
|
37
|
+
owner,
|
|
38
|
+
randomness,
|
|
39
|
+
storageSlot,
|
|
34
40
|
noteNonce,
|
|
35
41
|
index,
|
|
36
42
|
note,
|
|
37
43
|
}: {
|
|
38
44
|
contractAddress: AztecAddress;
|
|
45
|
+
owner: AztecAddress;
|
|
46
|
+
randomness: Fr;
|
|
47
|
+
storageSlot: Fr;
|
|
39
48
|
noteNonce: Fr;
|
|
40
49
|
index?: bigint;
|
|
41
50
|
note: Note;
|
|
42
51
|
}) {
|
|
43
52
|
// 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;
|
|
53
|
+
const nonzeroNoteHashCounter = index === undefined;
|
|
46
54
|
|
|
47
55
|
// To pack the note as retrieved note we first need to reconstruct the note metadata.
|
|
48
56
|
const noteMetadata = fromRawData(nonzeroNoteHashCounter, noteNonce);
|
|
49
57
|
|
|
50
|
-
// Pack
|
|
51
|
-
return [
|
|
58
|
+
// Pack in order: note, contract_address, owner, randomness, storage_slot, metadata (stage, maybe_note_nonce)
|
|
59
|
+
return [
|
|
60
|
+
...note.items,
|
|
61
|
+
contractAddress,
|
|
62
|
+
owner,
|
|
63
|
+
randomness,
|
|
64
|
+
storageSlot,
|
|
65
|
+
new Fr(noteMetadata.stage),
|
|
66
|
+
noteMetadata.maybeNoteNonce,
|
|
67
|
+
];
|
|
52
68
|
}
|