@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
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
|
|
2
2
|
import { timesParallel } from '@aztec/foundation/collection';
|
|
3
|
-
import { Fr
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
4
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
6
|
import type { KeyStore } from '@aztec/key-store';
|
|
6
|
-
import {
|
|
7
|
-
EventSelector,
|
|
8
|
-
type FunctionArtifactWithContractName,
|
|
9
|
-
FunctionSelector,
|
|
10
|
-
getFunctionArtifact,
|
|
11
|
-
} from '@aztec/stdlib/abi';
|
|
7
|
+
import { EventSelector, type FunctionArtifactWithContractName, FunctionSelector } from '@aztec/stdlib/abi';
|
|
12
8
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
|
-
import type {
|
|
9
|
+
import type { BlockParameter, DataInBlock, L2Block } from '@aztec/stdlib/block';
|
|
14
10
|
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
15
11
|
import { computeUniqueNoteHash, siloNoteHash, siloNullifier, siloPrivateLog } from '@aztec/stdlib/hash';
|
|
16
12
|
import { type AztecNode, MAX_RPC_LEN } from '@aztec/stdlib/interfaces/client';
|
|
@@ -26,6 +22,7 @@ import {
|
|
|
26
22
|
} from '@aztec/stdlib/logs';
|
|
27
23
|
import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
28
24
|
import { Note, type NoteStatus } from '@aztec/stdlib/note';
|
|
25
|
+
import { NoteDao } from '@aztec/stdlib/note';
|
|
29
26
|
import { MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
30
27
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
31
28
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
@@ -36,7 +33,6 @@ import { ORACLE_VERSION } from '../oracle_version.js';
|
|
|
36
33
|
import type { AddressDataProvider } from '../storage/address_data_provider/address_data_provider.js';
|
|
37
34
|
import type { CapsuleDataProvider } from '../storage/capsule_data_provider/capsule_data_provider.js';
|
|
38
35
|
import type { ContractDataProvider } from '../storage/contract_data_provider/contract_data_provider.js';
|
|
39
|
-
import { NoteDao } from '../storage/note_data_provider/note_dao.js';
|
|
40
36
|
import type { NoteDataProvider } from '../storage/note_data_provider/note_data_provider.js';
|
|
41
37
|
import type { PrivateEventDataProvider } from '../storage/private_event_data_provider/private_event_data_provider.js';
|
|
42
38
|
import type { SyncDataProvider } from '../storage/sync_data_provider/sync_data_provider.js';
|
|
@@ -81,7 +77,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
81
77
|
if (!completeAddress) {
|
|
82
78
|
throw new Error(
|
|
83
79
|
`No public key registered for address ${account}.
|
|
84
|
-
Register it by calling pxe.addAccount(...).\nSee docs for context: https://docs.aztec.network/developers/
|
|
80
|
+
Register it by calling pxe.addAccount(...).\nSee docs for context: https://docs.aztec.network/developers/resources/debugging/aztecnr-errors#simulation-error-no-public-key-registered-for-address-0x0-register-it-by-calling-pxeregisterrecipient-or-pxeregisteraccount`,
|
|
85
81
|
);
|
|
86
82
|
}
|
|
87
83
|
return completeAddress;
|
|
@@ -95,23 +91,34 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
95
91
|
return instance;
|
|
96
92
|
}
|
|
97
93
|
|
|
98
|
-
async getNotes(
|
|
94
|
+
async getNotes(
|
|
95
|
+
contractAddress: AztecAddress,
|
|
96
|
+
owner: AztecAddress | undefined,
|
|
97
|
+
storageSlot: Fr,
|
|
98
|
+
status: NoteStatus,
|
|
99
|
+
scopes?: AztecAddress[],
|
|
100
|
+
) {
|
|
99
101
|
const noteDaos = await this.noteDataProvider.getNotes({
|
|
100
102
|
contractAddress,
|
|
103
|
+
owner,
|
|
101
104
|
storageSlot,
|
|
102
105
|
status,
|
|
103
106
|
scopes,
|
|
104
107
|
});
|
|
105
|
-
return noteDaos.map(
|
|
106
|
-
contractAddress,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
108
|
+
return noteDaos.map(
|
|
109
|
+
({ contractAddress, owner, storageSlot, randomness, noteNonce, note, noteHash, siloedNullifier, index }) => ({
|
|
110
|
+
contractAddress,
|
|
111
|
+
owner,
|
|
112
|
+
storageSlot,
|
|
113
|
+
randomness,
|
|
114
|
+
noteNonce,
|
|
115
|
+
note,
|
|
116
|
+
noteHash,
|
|
117
|
+
siloedNullifier,
|
|
118
|
+
// PXE can use this index to get full MembershipWitness
|
|
119
|
+
index,
|
|
120
|
+
}),
|
|
121
|
+
);
|
|
115
122
|
}
|
|
116
123
|
|
|
117
124
|
async getFunctionArtifact(
|
|
@@ -129,18 +136,6 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
129
136
|
};
|
|
130
137
|
}
|
|
131
138
|
|
|
132
|
-
async getFunctionArtifactByName(
|
|
133
|
-
contractAddress: AztecAddress,
|
|
134
|
-
functionName: string,
|
|
135
|
-
): Promise<FunctionArtifactWithContractName | undefined> {
|
|
136
|
-
const instance = await this.contractDataProvider.getContractInstance(contractAddress);
|
|
137
|
-
if (!instance) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
const artifact = await this.contractDataProvider.getContractArtifact(instance.currentContractClassId);
|
|
141
|
-
return artifact && getFunctionArtifact(artifact, functionName);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
139
|
/**
|
|
145
140
|
* Fetches a message from the db, given its key.
|
|
146
141
|
* @param contractAddress - Address of a contract by which the message was emitted.
|
|
@@ -169,12 +164,12 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
169
164
|
return await this.#findLeafIndex('latest', MerkleTreeId.NULLIFIER_TREE, nullifier);
|
|
170
165
|
}
|
|
171
166
|
|
|
172
|
-
async #findLeafIndex(blockNumber:
|
|
167
|
+
async #findLeafIndex(blockNumber: BlockParameter, treeId: MerkleTreeId, leafValue: Fr): Promise<bigint | undefined> {
|
|
173
168
|
const [leafIndex] = await this.aztecNode.findLeavesIndexes(blockNumber, treeId, [leafValue]);
|
|
174
169
|
return leafIndex?.data;
|
|
175
170
|
}
|
|
176
171
|
|
|
177
|
-
public async getMembershipWitness(blockNumber:
|
|
172
|
+
public async getMembershipWitness(blockNumber: BlockParameter, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]> {
|
|
178
173
|
const witness = await this.#tryGetMembershipWitness(blockNumber, treeId, leafValue);
|
|
179
174
|
if (!witness) {
|
|
180
175
|
throw new Error(`Leaf value ${leafValue} not found in tree ${MerkleTreeId[treeId]} at block ${blockNumber}`);
|
|
@@ -182,7 +177,11 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
182
177
|
return witness;
|
|
183
178
|
}
|
|
184
179
|
|
|
185
|
-
async #tryGetMembershipWitness(
|
|
180
|
+
async #tryGetMembershipWitness(
|
|
181
|
+
blockNumber: BlockParameter,
|
|
182
|
+
treeId: MerkleTreeId,
|
|
183
|
+
value: Fr,
|
|
184
|
+
): Promise<Fr[] | undefined> {
|
|
186
185
|
switch (treeId) {
|
|
187
186
|
case MerkleTreeId.NULLIFIER_TREE:
|
|
188
187
|
return (await this.aztecNode.getNullifierMembershipWitness(blockNumber, value))?.withoutPreimage().toFields();
|
|
@@ -203,42 +202,42 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
203
202
|
}
|
|
204
203
|
|
|
205
204
|
public getNullifierMembershipWitness(
|
|
206
|
-
blockNumber:
|
|
205
|
+
blockNumber: BlockParameter,
|
|
207
206
|
nullifier: Fr,
|
|
208
207
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
209
208
|
return this.aztecNode.getNullifierMembershipWitness(blockNumber, nullifier);
|
|
210
209
|
}
|
|
211
210
|
|
|
212
211
|
public async getLowNullifierMembershipWitness(
|
|
213
|
-
blockNumber:
|
|
212
|
+
blockNumber: BlockParameter,
|
|
214
213
|
nullifier: Fr,
|
|
215
214
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
216
215
|
const header = await this.getAnchorBlockHeader();
|
|
217
|
-
if (blockNumber > header.globalVariables.blockNumber) {
|
|
216
|
+
if (blockNumber !== 'latest' && blockNumber > header.globalVariables.blockNumber) {
|
|
218
217
|
throw new Error(`Block number ${blockNumber} is higher than current block ${header.globalVariables.blockNumber}`);
|
|
219
218
|
}
|
|
220
219
|
return this.aztecNode.getLowNullifierMembershipWitness(blockNumber, nullifier);
|
|
221
220
|
}
|
|
222
221
|
|
|
223
|
-
public async getBlock(blockNumber:
|
|
222
|
+
public async getBlock(blockNumber: BlockParameter): Promise<L2Block | undefined> {
|
|
224
223
|
const header = await this.getAnchorBlockHeader();
|
|
225
|
-
if (blockNumber > header.globalVariables.blockNumber) {
|
|
224
|
+
if (blockNumber !== 'latest' && blockNumber > header.globalVariables.blockNumber) {
|
|
226
225
|
throw new Error(`Block number ${blockNumber} is higher than current block ${header.globalVariables.blockNumber}`);
|
|
227
226
|
}
|
|
228
227
|
return await this.aztecNode.getBlock(blockNumber);
|
|
229
228
|
}
|
|
230
229
|
|
|
231
|
-
public async getPublicDataWitness(blockNumber:
|
|
230
|
+
public async getPublicDataWitness(blockNumber: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined> {
|
|
232
231
|
const header = await this.getAnchorBlockHeader();
|
|
233
|
-
if (blockNumber > header.globalVariables.blockNumber) {
|
|
232
|
+
if (blockNumber !== 'latest' && blockNumber > header.globalVariables.blockNumber) {
|
|
234
233
|
throw new Error(`Block number ${blockNumber} is higher than current block ${header.globalVariables.blockNumber}`);
|
|
235
234
|
}
|
|
236
235
|
return await this.aztecNode.getPublicDataWitness(blockNumber, leafSlot);
|
|
237
236
|
}
|
|
238
237
|
|
|
239
|
-
public async getPublicStorageAt(blockNumber:
|
|
238
|
+
public async getPublicStorageAt(blockNumber: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr> {
|
|
240
239
|
const header = await this.getAnchorBlockHeader();
|
|
241
|
-
if (blockNumber > header.globalVariables.blockNumber) {
|
|
240
|
+
if (blockNumber !== 'latest' && blockNumber > header.globalVariables.blockNumber) {
|
|
242
241
|
throw new Error(`Block number ${blockNumber} is higher than current block ${header.globalVariables.blockNumber}`);
|
|
243
242
|
}
|
|
244
243
|
return await this.aztecNode.getPublicStorageAt(blockNumber, contract, slot);
|
|
@@ -613,7 +612,9 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
613
612
|
const noteDeliveries = noteValidationRequests.map(request =>
|
|
614
613
|
this.deliverNote(
|
|
615
614
|
request.contractAddress,
|
|
615
|
+
request.owner,
|
|
616
616
|
request.storageSlot,
|
|
617
|
+
request.randomness,
|
|
617
618
|
request.noteNonce,
|
|
618
619
|
request.content,
|
|
619
620
|
request.noteHash,
|
|
@@ -643,7 +644,9 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
643
644
|
|
|
644
645
|
async deliverNote(
|
|
645
646
|
contractAddress: AztecAddress,
|
|
647
|
+
owner: AztecAddress,
|
|
646
648
|
storageSlot: Fr,
|
|
649
|
+
randomness: Fr,
|
|
647
650
|
noteNonce: Fr,
|
|
648
651
|
content: Fr[],
|
|
649
652
|
noteHash: Fr,
|
|
@@ -677,6 +680,20 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
677
680
|
const uniqueNoteHash = await computeUniqueNoteHash(noteNonce, await siloNoteHash(contractAddress, noteHash));
|
|
678
681
|
const siloedNullifier = await siloNullifier(contractAddress, nullifier);
|
|
679
682
|
|
|
683
|
+
const txEffect = await this.aztecNode.getTxEffect(txHash);
|
|
684
|
+
if (!txEffect) {
|
|
685
|
+
throw new Error(`Could not find tx effect for tx hash ${txHash}`);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
if (txEffect.l2BlockNumber > syncedBlockNumber) {
|
|
689
|
+
throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${syncedBlockNumber}`);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
const noteInTx = txEffect.data.noteHashes.some(nh => nh.equals(uniqueNoteHash));
|
|
693
|
+
if (!noteInTx) {
|
|
694
|
+
throw new Error(`Note hash ${noteHash} (uniqued as ${uniqueNoteHash}) is not present in tx ${txHash}`);
|
|
695
|
+
}
|
|
696
|
+
|
|
680
697
|
// We store notes by their index in the global note hash tree, which has the convenient side effect of validating
|
|
681
698
|
// note existence in said tree. We concurrently also check if the note's nullifier exists, performing all node
|
|
682
699
|
// queries in a single round-trip.
|
|
@@ -694,17 +711,19 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
694
711
|
const noteDao = new NoteDao(
|
|
695
712
|
new Note(content),
|
|
696
713
|
contractAddress,
|
|
714
|
+
owner,
|
|
697
715
|
storageSlot,
|
|
716
|
+
randomness,
|
|
698
717
|
noteNonce,
|
|
699
718
|
noteHash,
|
|
700
719
|
siloedNullifier,
|
|
701
720
|
txHash,
|
|
702
|
-
uniqueNoteHashTreeIndexInBlock
|
|
703
|
-
uniqueNoteHashTreeIndexInBlock
|
|
704
|
-
uniqueNoteHashTreeIndexInBlock
|
|
705
|
-
recipient,
|
|
721
|
+
uniqueNoteHashTreeIndexInBlock.l2BlockNumber,
|
|
722
|
+
uniqueNoteHashTreeIndexInBlock.l2BlockHash.toString(),
|
|
723
|
+
uniqueNoteHashTreeIndexInBlock.data,
|
|
706
724
|
);
|
|
707
725
|
|
|
726
|
+
// The note was found by `recipient`, so we use that as the scope when storing the note.
|
|
708
727
|
await this.noteDataProvider.addNotes([noteDao], recipient);
|
|
709
728
|
this.log.verbose('Added note', {
|
|
710
729
|
index: noteDao.index,
|
|
@@ -767,7 +786,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
767
786
|
privateLog.firstNullifierInTx,
|
|
768
787
|
);
|
|
769
788
|
} else {
|
|
770
|
-
null;
|
|
789
|
+
return null;
|
|
771
790
|
}
|
|
772
791
|
}),
|
|
773
792
|
);
|
|
@@ -789,15 +808,32 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
789
808
|
content: Fr[],
|
|
790
809
|
eventCommitment: Fr,
|
|
791
810
|
txHash: TxHash,
|
|
792
|
-
|
|
811
|
+
scope: AztecAddress,
|
|
793
812
|
): Promise<void> {
|
|
794
813
|
// While using 'latest' block number would be fine for private events since they cannot be accessed from Aztec.nr
|
|
795
814
|
// (and thus we're less concerned about being ahead of the synced block), we use the synced block number to
|
|
796
815
|
// maintain consistent behavior in the PXE. Additionally, events should never be ahead of the synced block here
|
|
797
816
|
// since `fetchTaggedLogs` only processes logs up to the synced block.
|
|
798
|
-
const syncedBlockNumber = await
|
|
817
|
+
const [syncedBlockNumber, siloedEventCommitment, txEffect] = await Promise.all([
|
|
818
|
+
this.syncDataProvider.getBlockNumber(),
|
|
819
|
+
siloNullifier(contractAddress, eventCommitment),
|
|
820
|
+
this.aztecNode.getTxEffect(txHash),
|
|
821
|
+
]);
|
|
799
822
|
|
|
800
|
-
|
|
823
|
+
if (!txEffect) {
|
|
824
|
+
throw new Error(`Could not find tx effect for tx hash ${txHash}`);
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
if (txEffect.l2BlockNumber > syncedBlockNumber) {
|
|
828
|
+
throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${syncedBlockNumber}`);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
const eventInTx = txEffect.data.nullifiers.some(n => n.equals(siloedEventCommitment));
|
|
832
|
+
if (!eventInTx) {
|
|
833
|
+
throw new Error(
|
|
834
|
+
`Event commitment ${eventCommitment} (siloed as ${siloedEventCommitment}) is not present in tx ${txHash}`,
|
|
835
|
+
);
|
|
836
|
+
}
|
|
801
837
|
|
|
802
838
|
const [nullifierIndex] = await this.aztecNode.findLeavesIndexes(syncedBlockNumber, MerkleTreeId.NULLIFIER_TREE, [
|
|
803
839
|
siloedEventCommitment,
|
|
@@ -810,13 +846,16 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
810
846
|
}
|
|
811
847
|
|
|
812
848
|
return this.privateEventDataProvider.storePrivateEventLog(
|
|
813
|
-
contractAddress,
|
|
814
|
-
recipient,
|
|
815
849
|
selector,
|
|
816
850
|
content,
|
|
817
|
-
txHash,
|
|
818
851
|
Number(nullifierIndex.data), // Index of the event commitment in the nullifier tree
|
|
819
|
-
|
|
852
|
+
{
|
|
853
|
+
contractAddress,
|
|
854
|
+
scope,
|
|
855
|
+
txHash,
|
|
856
|
+
l2BlockNumber: nullifierIndex.l2BlockNumber, // Block number in which the event was emitted
|
|
857
|
+
l2BlockHash: nullifierIndex.l2BlockHash, // Block hash in which the event was emitted
|
|
858
|
+
},
|
|
820
859
|
);
|
|
821
860
|
}
|
|
822
861
|
|
|
@@ -934,10 +973,10 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
934
973
|
const foundNullifiers = nullifiersToCheck
|
|
935
974
|
.map((nullifier, i) => {
|
|
936
975
|
if (nullifierIndexes[i] !== undefined) {
|
|
937
|
-
return { ...nullifierIndexes[i], ...{ data: nullifier } } as
|
|
976
|
+
return { ...nullifierIndexes[i], ...{ data: nullifier } } as DataInBlock<Fr>;
|
|
938
977
|
}
|
|
939
978
|
})
|
|
940
|
-
.filter(nullifier => nullifier !== undefined) as
|
|
979
|
+
.filter(nullifier => nullifier !== undefined) as DataInBlock<Fr>[];
|
|
941
980
|
|
|
942
981
|
const nullifiedNotes = await this.noteDataProvider.applyNullifiers(foundNullifiers);
|
|
943
982
|
nullifiedNotes.forEach(noteDao => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BBPrivateKernelProver } from '@aztec/bb-prover/client';
|
|
2
|
+
import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
|
|
3
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
3
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
5
|
import { createStore } from '@aztec/kv-store/indexeddb';
|
|
5
6
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
@@ -44,12 +45,17 @@ export async function createPXE(
|
|
|
44
45
|
|
|
45
46
|
const store = options.store ?? (await createStore('pxe_data', configWithContracts, storeLogger));
|
|
46
47
|
|
|
47
|
-
const simulator = new WASMSimulator();
|
|
48
|
+
const simulator = options.simulator ?? new WASMSimulator();
|
|
48
49
|
const proverLogger = loggers.prover
|
|
49
50
|
? loggers.prover
|
|
50
51
|
: createLogger('pxe:bb:wasm:bundle' + (logSuffix ? `:${logSuffix}` : ''));
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
let prover;
|
|
54
|
+
if (options.proverOrOptions instanceof BBPrivateKernelProver) {
|
|
55
|
+
prover = options.proverOrOptions;
|
|
56
|
+
} else {
|
|
57
|
+
prover = new BBBundlePrivateKernelProver(simulator, { ...options.proverOrOptions, logger: proverLogger });
|
|
58
|
+
}
|
|
53
59
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
54
60
|
|
|
55
61
|
const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BBPrivateKernelProver } from '@aztec/bb-prover/client';
|
|
2
|
+
import { BBLazyPrivateKernelProver } from '@aztec/bb-prover/client/lazy';
|
|
3
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
3
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
5
|
import { createStore } from '@aztec/kv-store/indexeddb';
|
|
5
6
|
import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/providers/lazy';
|
|
@@ -43,13 +44,17 @@ export async function createPXE(
|
|
|
43
44
|
|
|
44
45
|
const store = options.store ?? (await createStore('pxe_data', configWithContracts, storeLogger));
|
|
45
46
|
|
|
46
|
-
const simulator = new WASMSimulator();
|
|
47
|
+
const simulator = options.simulator ?? new WASMSimulator();
|
|
47
48
|
const proverLogger = loggers.prover
|
|
48
49
|
? loggers.prover
|
|
49
50
|
: createLogger('pxe:bb:wasm:bundle' + (logSuffix ? `:${logSuffix}` : ''));
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
let prover;
|
|
53
|
+
if (options.proverOrOptions instanceof BBPrivateKernelProver) {
|
|
54
|
+
prover = options.proverOrOptions;
|
|
55
|
+
} else {
|
|
56
|
+
prover = new BBLazyPrivateKernelProver(simulator, { ...options.proverOrOptions, logger: proverLogger });
|
|
57
|
+
}
|
|
53
58
|
const protocolContractsProvider = new LazyProtocolContractsProvider();
|
|
54
59
|
|
|
55
60
|
const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { BBPrivateKernelProverOptions } from '@aztec/bb-prover/client';
|
|
1
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
2
3
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
|
+
import type { CircuitSimulator } from '@aztec/simulator/client';
|
|
3
5
|
import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
4
6
|
|
|
5
7
|
export type PXECreationOptions = {
|
|
6
8
|
loggers?: { store?: Logger; pxe?: Logger; prover?: Logger };
|
|
7
9
|
useLogSuffix?: boolean | string;
|
|
8
|
-
|
|
10
|
+
proverOrOptions?: PrivateKernelProver | BBPrivateKernelProverOptions;
|
|
9
11
|
store?: AztecAsyncKVStore;
|
|
12
|
+
simulator?: CircuitSimulator;
|
|
10
13
|
};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
4
|
-
import {
|
|
1
|
+
import { BBPrivateKernelProver } from '@aztec/bb-prover/client';
|
|
2
|
+
import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
|
|
3
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
4
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
+
import { createStore } from '@aztec/kv-store/lmdb-v2';
|
|
5
6
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
6
|
-
import {
|
|
7
|
-
type CircuitSimulator,
|
|
8
|
-
MemoryCircuitRecorder,
|
|
9
|
-
SimulatorRecorderWrapper,
|
|
10
|
-
WASMSimulator,
|
|
11
|
-
} from '@aztec/simulator/client';
|
|
7
|
+
import { MemoryCircuitRecorder, SimulatorRecorderWrapper, WASMSimulator } from '@aztec/simulator/client';
|
|
12
8
|
import { FileCircuitRecorder } from '@aztec/simulator/testing';
|
|
13
9
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
14
10
|
|
|
@@ -47,9 +43,6 @@ export async function createPXE(
|
|
|
47
43
|
};
|
|
48
44
|
|
|
49
45
|
if (!options.store) {
|
|
50
|
-
// TODO once https://github.com/AztecProtocol/aztec-packages/issues/13656 is fixed, we can remove this and always
|
|
51
|
-
// import the lmdb-v2 version
|
|
52
|
-
const { createStore } = await import('@aztec/kv-store/lmdb-v2');
|
|
53
46
|
const storeLogger = loggers.store
|
|
54
47
|
? loggers.store
|
|
55
48
|
: createLogger('pxe:data:lmdb' + (logSuffix ? `:${logSuffix}` : ''));
|
|
@@ -59,7 +52,13 @@ export async function createPXE(
|
|
|
59
52
|
? loggers.prover
|
|
60
53
|
: createLogger('pxe:bb:native' + (logSuffix ? `:${logSuffix}` : ''));
|
|
61
54
|
|
|
62
|
-
|
|
55
|
+
let prover;
|
|
56
|
+
if (options.proverOrOptions instanceof BBPrivateKernelProver) {
|
|
57
|
+
prover = options.proverOrOptions;
|
|
58
|
+
} else {
|
|
59
|
+
prover = new BBBundlePrivateKernelProver(simulator, { ...options.proverOrOptions, logger: proverLogger });
|
|
60
|
+
}
|
|
61
|
+
|
|
63
62
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
64
63
|
|
|
65
64
|
const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
|
|
@@ -74,20 +73,3 @@ export async function createPXE(
|
|
|
74
73
|
);
|
|
75
74
|
return pxe;
|
|
76
75
|
}
|
|
77
|
-
|
|
78
|
-
function createProver(
|
|
79
|
-
config: Pick<PXEConfig, 'bbBinaryPath' | 'bbWorkingDirectory'>,
|
|
80
|
-
simulator: CircuitSimulator,
|
|
81
|
-
logger?: Logger,
|
|
82
|
-
) {
|
|
83
|
-
if (!config.bbBinaryPath || !config.bbWorkingDirectory) {
|
|
84
|
-
return new BBWASMBundlePrivateKernelProver(simulator, 16, logger);
|
|
85
|
-
} else {
|
|
86
|
-
const bbConfig = config as Required<Pick<PXEConfig, 'bbBinaryPath' | 'bbWorkingDirectory'>> & PXEConfig;
|
|
87
|
-
return BBNativePrivateKernelProver.new(
|
|
88
|
-
{ bbSkipCleanup: false, numConcurrentIVCVerifiers: 1, bbIVCConcurrency: 1, ...bbConfig },
|
|
89
|
-
simulator,
|
|
90
|
-
logger,
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './private_event_filter_validator.js';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { PrivateEventFilter } from '@aztec/aztec.js/wallet';
|
|
2
|
+
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
3
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
4
|
+
|
|
5
|
+
import type { PrivateEventDataProviderFilter, SyncDataProvider } from '../storage/index.js';
|
|
6
|
+
|
|
7
|
+
export class PrivateEventFilterValidator {
|
|
8
|
+
constructor(private syncDataProvider: SyncDataProvider) {}
|
|
9
|
+
|
|
10
|
+
async validate(filter: PrivateEventFilter): Promise<PrivateEventDataProviderFilter> {
|
|
11
|
+
let { fromBlock, toBlock } = filter;
|
|
12
|
+
|
|
13
|
+
// Block range filters in Aztec Node are defined as closed-open intervals [fromBlock, toBlock), so
|
|
14
|
+
// we respect that convention here for consistency.
|
|
15
|
+
// We then default to [INITIAL_L2_BLOCK_NUM, latestKnownBlock + 1), ie: by default return events from
|
|
16
|
+
// the first block to the latest known block.
|
|
17
|
+
if (!fromBlock || !toBlock) {
|
|
18
|
+
const lastKnownBlock = await this.syncDataProvider.getBlockNumber();
|
|
19
|
+
fromBlock = fromBlock ?? BlockNumber(INITIAL_L2_BLOCK_NUM);
|
|
20
|
+
toBlock = toBlock ?? BlockNumber(lastKnownBlock + 1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (filter.scopes.length === 0) {
|
|
24
|
+
throw new Error('At least one scope is required to get private events');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (fromBlock < 1) {
|
|
28
|
+
throw new Error('fromBlock must be greater than or equal to 1');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (toBlock < 1) {
|
|
32
|
+
throw new Error('toBlock must be greater than or equal to 1');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (fromBlock >= toBlock) {
|
|
36
|
+
throw new Error('toBlock must be strictly greater than fromBlock');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
contractAddress: filter.contractAddress,
|
|
41
|
+
scopes: filter.scopes,
|
|
42
|
+
txHash: filter.txHash,
|
|
43
|
+
toBlock,
|
|
44
|
+
fromBlock,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/oracle_version.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
///
|
|
5
5
|
/// @dev Whenever a contract function or Noir test is run, the `utilityAssertCompatibleOracleVersion` oracle is called
|
|
6
6
|
/// and if the oracle version is incompatible an error is thrown.
|
|
7
|
-
export const ORACLE_VERSION =
|
|
7
|
+
export const ORACLE_VERSION = 5;
|
|
8
8
|
|
|
9
9
|
/// This hash is computed as by hashing the Oracle interface and it is used to detect when the Oracle interface changes,
|
|
10
10
|
/// which in turn implies that you need to update the ORACLE_VERSION constant.
|
|
11
|
-
export const ORACLE_INTERFACE_HASH = '
|
|
11
|
+
export const ORACLE_INTERFACE_HASH = 'd603c17a97034d978ca453d2bce3aacae139539dee28bbc46e8f8c7177a348ec';
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '@aztec/constants';
|
|
10
10
|
import { makeTuple } from '@aztec/foundation/array';
|
|
11
11
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
12
|
-
import type { Fr } from '@aztec/foundation/
|
|
12
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
13
13
|
import { type Tuple, assertLength } from '@aztec/foundation/serialize';
|
|
14
14
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
15
15
|
import { privateKernelResetDimensionsConfig } from '@aztec/noir-protocol-circuits-types/client';
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
PrivateKernelResetDimensions,
|
|
25
25
|
PrivateKernelResetHints,
|
|
26
26
|
type PrivateKernelSimulateOutput,
|
|
27
|
-
type ReadRequest,
|
|
28
27
|
ReadRequestActionEnum,
|
|
29
28
|
ReadRequestResetActions,
|
|
30
29
|
type ScopedKeyValidationRequestAndGenerator,
|
|
@@ -47,12 +46,10 @@ import type { PrivateKernelOracle } from '../private_kernel_oracle.js';
|
|
|
47
46
|
|
|
48
47
|
function collectNestedReadRequests<N extends number>(
|
|
49
48
|
executionStack: PrivateCallExecutionResult[],
|
|
50
|
-
extractReadRequests: (execution: PrivateCallExecutionResult) => ClaimedLengthArray<
|
|
49
|
+
extractReadRequests: (execution: PrivateCallExecutionResult) => ClaimedLengthArray<ScopedReadRequest, N>,
|
|
51
50
|
): ScopedReadRequest[] {
|
|
52
51
|
return collectNested(executionStack, executionResult => {
|
|
53
|
-
return extractReadRequests(executionResult)
|
|
54
|
-
.getActiveItems()
|
|
55
|
-
.map(readRequest => new ScopedReadRequest(readRequest, executionResult.publicInputs.callContext.contractAddress));
|
|
52
|
+
return extractReadRequests(executionResult).getActiveItems();
|
|
56
53
|
});
|
|
57
54
|
}
|
|
58
55
|
|
|
@@ -104,7 +101,7 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
104
101
|
private previousKernelOutput: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>,
|
|
105
102
|
private executionStack: PrivateCallExecutionResult[],
|
|
106
103
|
private noteHashNullifierCounterMap: Map<number, number>,
|
|
107
|
-
private
|
|
104
|
+
private splitCounter: number,
|
|
108
105
|
) {
|
|
109
106
|
this.previousKernel = previousKernelOutput.publicInputs;
|
|
110
107
|
this.requestedDimensions = PrivateKernelResetDimensions.empty();
|
|
@@ -206,7 +203,6 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
206
203
|
oracle,
|
|
207
204
|
),
|
|
208
205
|
this.transientDataSquashingHints,
|
|
209
|
-
this.validationRequestsSplitCounter,
|
|
210
206
|
),
|
|
211
207
|
dimensions,
|
|
212
208
|
);
|
|
@@ -403,7 +399,7 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
403
399
|
futureNoteHashReads,
|
|
404
400
|
futureNullifierReads,
|
|
405
401
|
this.noteHashNullifierCounterMap,
|
|
406
|
-
this.
|
|
402
|
+
this.splitCounter,
|
|
407
403
|
);
|
|
408
404
|
|
|
409
405
|
if (this.nextIteration && !numTransientData) {
|