@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { Aes128 } from '@aztec/foundation/crypto';
|
|
2
3
|
import { Fr, Point } from '@aztec/foundation/fields';
|
|
3
4
|
import { LogLevels, applyStringFormatting, createLogger } from '@aztec/foundation/log';
|
|
@@ -70,7 +71,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
70
71
|
* @param leafValue - The leaf value
|
|
71
72
|
* @returns The index and sibling path concatenated [index, sibling_path]
|
|
72
73
|
*/
|
|
73
|
-
public utilityGetMembershipWitness(blockNumber:
|
|
74
|
+
public utilityGetMembershipWitness(blockNumber: BlockNumber, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]> {
|
|
74
75
|
return this.executionDataProvider.getMembershipWitness(blockNumber, treeId, leafValue);
|
|
75
76
|
}
|
|
76
77
|
|
|
@@ -81,7 +82,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
81
82
|
* @returns The nullifier membership witness (if found).
|
|
82
83
|
*/
|
|
83
84
|
public async utilityGetNullifierMembershipWitness(
|
|
84
|
-
blockNumber:
|
|
85
|
+
blockNumber: BlockNumber,
|
|
85
86
|
nullifier: Fr,
|
|
86
87
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
87
88
|
return await this.executionDataProvider.getNullifierMembershipWitness(blockNumber, nullifier);
|
|
@@ -97,7 +98,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
97
98
|
* we are trying to prove non-inclusion for.
|
|
98
99
|
*/
|
|
99
100
|
public async utilityGetLowNullifierMembershipWitness(
|
|
100
|
-
blockNumber:
|
|
101
|
+
blockNumber: BlockNumber,
|
|
101
102
|
nullifier: Fr,
|
|
102
103
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
103
104
|
return await this.executionDataProvider.getLowNullifierMembershipWitness(blockNumber, nullifier);
|
|
@@ -109,7 +110,10 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
109
110
|
* @param leafSlot - The slot of the public data tree to get the witness for.
|
|
110
111
|
* @returns - The witness
|
|
111
112
|
*/
|
|
112
|
-
public async utilityGetPublicDataWitness(
|
|
113
|
+
public async utilityGetPublicDataWitness(
|
|
114
|
+
blockNumber: BlockNumber,
|
|
115
|
+
leafSlot: Fr,
|
|
116
|
+
): Promise<PublicDataWitness | undefined> {
|
|
113
117
|
return await this.executionDataProvider.getPublicDataWitness(blockNumber, leafSlot);
|
|
114
118
|
}
|
|
115
119
|
|
|
@@ -118,7 +122,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
118
122
|
* @param blockNumber - The number of a block of which to get the block header.
|
|
119
123
|
* @returns Block extracted from a block with block number `blockNumber`.
|
|
120
124
|
*/
|
|
121
|
-
public async utilityGetBlockHeader(blockNumber:
|
|
125
|
+
public async utilityGetBlockHeader(blockNumber: BlockNumber): Promise<BlockHeader | undefined> {
|
|
122
126
|
const block = await this.executionDataProvider.getBlock(blockNumber);
|
|
123
127
|
if (!block) {
|
|
124
128
|
return undefined;
|
|
@@ -164,6 +168,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
164
168
|
* Real notes coming from DB will have a leafIndex which
|
|
165
169
|
* represents their index in the note hash tree.
|
|
166
170
|
*
|
|
171
|
+
* @param owner - The owner of the notes.
|
|
167
172
|
* @param storageSlot - The storage slot.
|
|
168
173
|
* @param numSelects - The number of valid selects in selectBy and selectValues.
|
|
169
174
|
* @param selectBy - An array of indices of the fields to selects.
|
|
@@ -177,6 +182,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
177
182
|
* @returns Array of note data.
|
|
178
183
|
*/
|
|
179
184
|
public async utilityGetNotes(
|
|
185
|
+
owner: AztecAddress,
|
|
180
186
|
storageSlot: Fr,
|
|
181
187
|
numSelects: number,
|
|
182
188
|
selectByIndexes: number[],
|
|
@@ -192,7 +198,13 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
192
198
|
offset: number,
|
|
193
199
|
status: NoteStatus,
|
|
194
200
|
): Promise<NoteData[]> {
|
|
195
|
-
const dbNotes = await this.executionDataProvider.getNotes(
|
|
201
|
+
const dbNotes = await this.executionDataProvider.getNotes(
|
|
202
|
+
this.contractAddress,
|
|
203
|
+
owner,
|
|
204
|
+
storageSlot,
|
|
205
|
+
status,
|
|
206
|
+
this.scopes,
|
|
207
|
+
);
|
|
196
208
|
return pickNotes<NoteData>(dbNotes, {
|
|
197
209
|
selects: selectByIndexes.slice(0, numSelects).map((index, i) => ({
|
|
198
210
|
selector: { index, offset: selectByOffsets[i], length: selectByLengths[i] },
|
|
@@ -241,7 +253,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
241
253
|
public async utilityStorageRead(
|
|
242
254
|
contractAddress: AztecAddress,
|
|
243
255
|
startStorageSlot: Fr,
|
|
244
|
-
blockNumber:
|
|
256
|
+
blockNumber: BlockNumber,
|
|
245
257
|
numberOfElements: number,
|
|
246
258
|
) {
|
|
247
259
|
const values = [];
|
|
@@ -3,14 +3,9 @@ import { timesParallel } from '@aztec/foundation/collection';
|
|
|
3
3
|
import { Fr, Point } from '@aztec/foundation/fields';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
5
|
import type { KeyStore } from '@aztec/key-store';
|
|
6
|
-
import {
|
|
7
|
-
EventSelector,
|
|
8
|
-
type FunctionArtifactWithContractName,
|
|
9
|
-
FunctionSelector,
|
|
10
|
-
getFunctionArtifact,
|
|
11
|
-
} from '@aztec/stdlib/abi';
|
|
6
|
+
import { EventSelector, type FunctionArtifactWithContractName, FunctionSelector } from '@aztec/stdlib/abi';
|
|
12
7
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
|
-
import type {
|
|
8
|
+
import type { BlockParameter, DataInBlock, L2Block } from '@aztec/stdlib/block';
|
|
14
9
|
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
15
10
|
import { computeUniqueNoteHash, siloNoteHash, siloNullifier, siloPrivateLog } from '@aztec/stdlib/hash';
|
|
16
11
|
import { type AztecNode, MAX_RPC_LEN } from '@aztec/stdlib/interfaces/client';
|
|
@@ -26,6 +21,7 @@ import {
|
|
|
26
21
|
} from '@aztec/stdlib/logs';
|
|
27
22
|
import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
28
23
|
import { Note, type NoteStatus } from '@aztec/stdlib/note';
|
|
24
|
+
import { NoteDao } from '@aztec/stdlib/note';
|
|
29
25
|
import { MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
30
26
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
31
27
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
@@ -36,7 +32,6 @@ import { ORACLE_VERSION } from '../oracle_version.js';
|
|
|
36
32
|
import type { AddressDataProvider } from '../storage/address_data_provider/address_data_provider.js';
|
|
37
33
|
import type { CapsuleDataProvider } from '../storage/capsule_data_provider/capsule_data_provider.js';
|
|
38
34
|
import type { ContractDataProvider } from '../storage/contract_data_provider/contract_data_provider.js';
|
|
39
|
-
import { NoteDao } from '../storage/note_data_provider/note_dao.js';
|
|
40
35
|
import type { NoteDataProvider } from '../storage/note_data_provider/note_data_provider.js';
|
|
41
36
|
import type { PrivateEventDataProvider } from '../storage/private_event_data_provider/private_event_data_provider.js';
|
|
42
37
|
import type { SyncDataProvider } from '../storage/sync_data_provider/sync_data_provider.js';
|
|
@@ -95,23 +90,34 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
95
90
|
return instance;
|
|
96
91
|
}
|
|
97
92
|
|
|
98
|
-
async getNotes(
|
|
93
|
+
async getNotes(
|
|
94
|
+
contractAddress: AztecAddress,
|
|
95
|
+
owner: AztecAddress,
|
|
96
|
+
storageSlot: Fr,
|
|
97
|
+
status: NoteStatus,
|
|
98
|
+
scopes?: AztecAddress[],
|
|
99
|
+
) {
|
|
99
100
|
const noteDaos = await this.noteDataProvider.getNotes({
|
|
100
101
|
contractAddress,
|
|
102
|
+
owner,
|
|
101
103
|
storageSlot,
|
|
102
104
|
status,
|
|
103
105
|
scopes,
|
|
104
106
|
});
|
|
105
|
-
return noteDaos.map(
|
|
106
|
-
contractAddress,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
return noteDaos.map(
|
|
108
|
+
({ contractAddress, owner, storageSlot, randomness, noteNonce, note, noteHash, siloedNullifier, index }) => ({
|
|
109
|
+
contractAddress,
|
|
110
|
+
owner,
|
|
111
|
+
storageSlot,
|
|
112
|
+
randomness,
|
|
113
|
+
noteNonce,
|
|
114
|
+
note,
|
|
115
|
+
noteHash,
|
|
116
|
+
siloedNullifier,
|
|
117
|
+
// PXE can use this index to get full MembershipWitness
|
|
118
|
+
index,
|
|
119
|
+
}),
|
|
120
|
+
);
|
|
115
121
|
}
|
|
116
122
|
|
|
117
123
|
async getFunctionArtifact(
|
|
@@ -129,18 +135,6 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
129
135
|
};
|
|
130
136
|
}
|
|
131
137
|
|
|
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
138
|
/**
|
|
145
139
|
* Fetches a message from the db, given its key.
|
|
146
140
|
* @param contractAddress - Address of a contract by which the message was emitted.
|
|
@@ -169,12 +163,12 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
169
163
|
return await this.#findLeafIndex('latest', MerkleTreeId.NULLIFIER_TREE, nullifier);
|
|
170
164
|
}
|
|
171
165
|
|
|
172
|
-
async #findLeafIndex(blockNumber:
|
|
166
|
+
async #findLeafIndex(blockNumber: BlockParameter, treeId: MerkleTreeId, leafValue: Fr): Promise<bigint | undefined> {
|
|
173
167
|
const [leafIndex] = await this.aztecNode.findLeavesIndexes(blockNumber, treeId, [leafValue]);
|
|
174
168
|
return leafIndex?.data;
|
|
175
169
|
}
|
|
176
170
|
|
|
177
|
-
public async getMembershipWitness(blockNumber:
|
|
171
|
+
public async getMembershipWitness(blockNumber: BlockParameter, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]> {
|
|
178
172
|
const witness = await this.#tryGetMembershipWitness(blockNumber, treeId, leafValue);
|
|
179
173
|
if (!witness) {
|
|
180
174
|
throw new Error(`Leaf value ${leafValue} not found in tree ${MerkleTreeId[treeId]} at block ${blockNumber}`);
|
|
@@ -182,7 +176,11 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
182
176
|
return witness;
|
|
183
177
|
}
|
|
184
178
|
|
|
185
|
-
async #tryGetMembershipWitness(
|
|
179
|
+
async #tryGetMembershipWitness(
|
|
180
|
+
blockNumber: BlockParameter,
|
|
181
|
+
treeId: MerkleTreeId,
|
|
182
|
+
value: Fr,
|
|
183
|
+
): Promise<Fr[] | undefined> {
|
|
186
184
|
switch (treeId) {
|
|
187
185
|
case MerkleTreeId.NULLIFIER_TREE:
|
|
188
186
|
return (await this.aztecNode.getNullifierMembershipWitness(blockNumber, value))?.withoutPreimage().toFields();
|
|
@@ -203,42 +201,42 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
203
201
|
}
|
|
204
202
|
|
|
205
203
|
public getNullifierMembershipWitness(
|
|
206
|
-
blockNumber:
|
|
204
|
+
blockNumber: BlockParameter,
|
|
207
205
|
nullifier: Fr,
|
|
208
206
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
209
207
|
return this.aztecNode.getNullifierMembershipWitness(blockNumber, nullifier);
|
|
210
208
|
}
|
|
211
209
|
|
|
212
210
|
public async getLowNullifierMembershipWitness(
|
|
213
|
-
blockNumber:
|
|
211
|
+
blockNumber: BlockParameter,
|
|
214
212
|
nullifier: Fr,
|
|
215
213
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
216
214
|
const header = await this.getAnchorBlockHeader();
|
|
217
|
-
if (blockNumber > header.globalVariables.blockNumber) {
|
|
215
|
+
if (blockNumber !== 'latest' && blockNumber > header.globalVariables.blockNumber) {
|
|
218
216
|
throw new Error(`Block number ${blockNumber} is higher than current block ${header.globalVariables.blockNumber}`);
|
|
219
217
|
}
|
|
220
218
|
return this.aztecNode.getLowNullifierMembershipWitness(blockNumber, nullifier);
|
|
221
219
|
}
|
|
222
220
|
|
|
223
|
-
public async getBlock(blockNumber:
|
|
221
|
+
public async getBlock(blockNumber: BlockParameter): Promise<L2Block | undefined> {
|
|
224
222
|
const header = await this.getAnchorBlockHeader();
|
|
225
|
-
if (blockNumber > header.globalVariables.blockNumber) {
|
|
223
|
+
if (blockNumber !== 'latest' && blockNumber > header.globalVariables.blockNumber) {
|
|
226
224
|
throw new Error(`Block number ${blockNumber} is higher than current block ${header.globalVariables.blockNumber}`);
|
|
227
225
|
}
|
|
228
226
|
return await this.aztecNode.getBlock(blockNumber);
|
|
229
227
|
}
|
|
230
228
|
|
|
231
|
-
public async getPublicDataWitness(blockNumber:
|
|
229
|
+
public async getPublicDataWitness(blockNumber: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined> {
|
|
232
230
|
const header = await this.getAnchorBlockHeader();
|
|
233
|
-
if (blockNumber > header.globalVariables.blockNumber) {
|
|
231
|
+
if (blockNumber !== 'latest' && blockNumber > header.globalVariables.blockNumber) {
|
|
234
232
|
throw new Error(`Block number ${blockNumber} is higher than current block ${header.globalVariables.blockNumber}`);
|
|
235
233
|
}
|
|
236
234
|
return await this.aztecNode.getPublicDataWitness(blockNumber, leafSlot);
|
|
237
235
|
}
|
|
238
236
|
|
|
239
|
-
public async getPublicStorageAt(blockNumber:
|
|
237
|
+
public async getPublicStorageAt(blockNumber: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr> {
|
|
240
238
|
const header = await this.getAnchorBlockHeader();
|
|
241
|
-
if (blockNumber > header.globalVariables.blockNumber) {
|
|
239
|
+
if (blockNumber !== 'latest' && blockNumber > header.globalVariables.blockNumber) {
|
|
242
240
|
throw new Error(`Block number ${blockNumber} is higher than current block ${header.globalVariables.blockNumber}`);
|
|
243
241
|
}
|
|
244
242
|
return await this.aztecNode.getPublicStorageAt(blockNumber, contract, slot);
|
|
@@ -613,7 +611,9 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
613
611
|
const noteDeliveries = noteValidationRequests.map(request =>
|
|
614
612
|
this.deliverNote(
|
|
615
613
|
request.contractAddress,
|
|
614
|
+
request.owner,
|
|
616
615
|
request.storageSlot,
|
|
616
|
+
request.randomness,
|
|
617
617
|
request.noteNonce,
|
|
618
618
|
request.content,
|
|
619
619
|
request.noteHash,
|
|
@@ -643,7 +643,9 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
643
643
|
|
|
644
644
|
async deliverNote(
|
|
645
645
|
contractAddress: AztecAddress,
|
|
646
|
+
owner: AztecAddress,
|
|
646
647
|
storageSlot: Fr,
|
|
648
|
+
randomness: Fr,
|
|
647
649
|
noteNonce: Fr,
|
|
648
650
|
content: Fr[],
|
|
649
651
|
noteHash: Fr,
|
|
@@ -694,17 +696,19 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
694
696
|
const noteDao = new NoteDao(
|
|
695
697
|
new Note(content),
|
|
696
698
|
contractAddress,
|
|
699
|
+
owner,
|
|
697
700
|
storageSlot,
|
|
701
|
+
randomness,
|
|
698
702
|
noteNonce,
|
|
699
703
|
noteHash,
|
|
700
704
|
siloedNullifier,
|
|
701
705
|
txHash,
|
|
702
|
-
uniqueNoteHashTreeIndexInBlock
|
|
703
|
-
uniqueNoteHashTreeIndexInBlock
|
|
704
|
-
uniqueNoteHashTreeIndexInBlock
|
|
705
|
-
recipient,
|
|
706
|
+
uniqueNoteHashTreeIndexInBlock.l2BlockNumber,
|
|
707
|
+
uniqueNoteHashTreeIndexInBlock.l2BlockHash.toString(),
|
|
708
|
+
uniqueNoteHashTreeIndexInBlock.data,
|
|
706
709
|
);
|
|
707
710
|
|
|
711
|
+
// The note was found by `recipient`, so we use that as the scope when storing the note.
|
|
708
712
|
await this.noteDataProvider.addNotes([noteDao], recipient);
|
|
709
713
|
this.log.verbose('Added note', {
|
|
710
714
|
index: noteDao.index,
|
|
@@ -767,7 +771,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
767
771
|
privateLog.firstNullifierInTx,
|
|
768
772
|
);
|
|
769
773
|
} else {
|
|
770
|
-
null;
|
|
774
|
+
return null;
|
|
771
775
|
}
|
|
772
776
|
}),
|
|
773
777
|
);
|
|
@@ -952,10 +956,10 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
952
956
|
const foundNullifiers = nullifiersToCheck
|
|
953
957
|
.map((nullifier, i) => {
|
|
954
958
|
if (nullifierIndexes[i] !== undefined) {
|
|
955
|
-
return { ...nullifierIndexes[i], ...{ data: nullifier } } as
|
|
959
|
+
return { ...nullifierIndexes[i], ...{ data: nullifier } } as DataInBlock<Fr>;
|
|
956
960
|
}
|
|
957
961
|
})
|
|
958
|
-
.filter(nullifier => nullifier !== undefined) as
|
|
962
|
+
.filter(nullifier => nullifier !== undefined) as DataInBlock<Fr>[];
|
|
959
963
|
|
|
960
964
|
const nullifiedNotes = await this.noteDataProvider.applyNullifiers(foundNullifiers);
|
|
961
965
|
nullifiedNotes.forEach(noteDao => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
|
|
2
2
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { createStore } from '@aztec/kv-store/indexeddb';
|
|
@@ -49,7 +49,7 @@ export async function createPXE(
|
|
|
49
49
|
? loggers.prover
|
|
50
50
|
: createLogger('pxe:bb:wasm:bundle' + (logSuffix ? `:${logSuffix}` : ''));
|
|
51
51
|
|
|
52
|
-
const prover = options.prover ?? new
|
|
52
|
+
const prover = options.prover ?? new BBBundlePrivateKernelProver(simulator, proverLogger);
|
|
53
53
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
54
54
|
|
|
55
55
|
const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BBLazyPrivateKernelProver } from '@aztec/bb-prover/client/lazy';
|
|
2
2
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { createStore } from '@aztec/kv-store/indexeddb';
|
|
@@ -48,7 +48,7 @@ export async function createPXE(
|
|
|
48
48
|
? loggers.prover
|
|
49
49
|
: createLogger('pxe:bb:wasm:bundle' + (logSuffix ? `:${logSuffix}` : ''));
|
|
50
50
|
|
|
51
|
-
const prover = options.prover ?? new
|
|
51
|
+
const prover = options.prover ?? new BBLazyPrivateKernelProver(simulator, proverLogger);
|
|
52
52
|
|
|
53
53
|
const protocolContractsProvider = new LazyProtocolContractsProvider();
|
|
54
54
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bundle';
|
|
1
|
+
import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
|
|
3
2
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
4
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
5
4
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
@@ -59,7 +58,7 @@ export async function createPXE(
|
|
|
59
58
|
? loggers.prover
|
|
60
59
|
: createLogger('pxe:bb:native' + (logSuffix ? `:${logSuffix}` : ''));
|
|
61
60
|
|
|
62
|
-
const prover = options.prover ??
|
|
61
|
+
const prover = options.prover ?? createProver(simulator, proverLogger);
|
|
63
62
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
64
63
|
|
|
65
64
|
const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
|
|
@@ -75,19 +74,6 @@ export async function createPXE(
|
|
|
75
74
|
return pxe;
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
function createProver(
|
|
79
|
-
|
|
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
|
-
}
|
|
77
|
+
function createProver(simulator: CircuitSimulator, logger?: Logger) {
|
|
78
|
+
return new BBBundlePrivateKernelProver(simulator, logger);
|
|
93
79
|
}
|
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 = 4;
|
|
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 = 'd1496df59c0b51a481d5ef93f218b5c35ddfce6242da28d60bb5c66386940eac';
|
|
@@ -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) {
|
|
@@ -103,9 +103,8 @@ export class PrivateKernelExecutionProver {
|
|
|
103
103
|
|
|
104
104
|
const noteHashLeafIndexMap = collectNoteHashLeafIndexMap(executionResult);
|
|
105
105
|
const noteHashNullifierCounterMap = collectNoteHashNullifierCounterMap(executionResult);
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
: getFinalMinRevertibleSideEffectCounter(executionResult);
|
|
106
|
+
const minRevertibleSideEffectCounter = getFinalMinRevertibleSideEffectCounter(executionResult);
|
|
107
|
+
const splitCounter = isPrivateOnlyTx ? 0 : minRevertibleSideEffectCounter;
|
|
109
108
|
|
|
110
109
|
while (executionStack.length) {
|
|
111
110
|
if (!firstIteration) {
|
|
@@ -113,7 +112,7 @@ export class PrivateKernelExecutionProver {
|
|
|
113
112
|
output,
|
|
114
113
|
executionStack,
|
|
115
114
|
noteHashNullifierCounterMap,
|
|
116
|
-
|
|
115
|
+
splitCounter,
|
|
117
116
|
);
|
|
118
117
|
while (resetBuilder.needsReset()) {
|
|
119
118
|
const witgenTimer = new Timer();
|
|
@@ -134,7 +133,7 @@ export class PrivateKernelExecutionProver {
|
|
|
134
133
|
output,
|
|
135
134
|
executionStack,
|
|
136
135
|
noteHashNullifierCounterMap,
|
|
137
|
-
|
|
136
|
+
splitCounter,
|
|
138
137
|
);
|
|
139
138
|
}
|
|
140
139
|
}
|
|
@@ -171,6 +170,7 @@ export class PrivateKernelExecutionProver {
|
|
|
171
170
|
privateCallData,
|
|
172
171
|
isPrivateOnlyTx,
|
|
173
172
|
executionResult.firstNullifier,
|
|
173
|
+
minRevertibleSideEffectCounter,
|
|
174
174
|
);
|
|
175
175
|
this.log.debug(
|
|
176
176
|
`Calling private kernel init with isPrivateOnly ${isPrivateOnlyTx} and firstNullifierHint ${proofInput.firstNullifierHint}`,
|
|
@@ -220,7 +220,7 @@ export class PrivateKernelExecutionProver {
|
|
|
220
220
|
output,
|
|
221
221
|
[],
|
|
222
222
|
noteHashNullifierCounterMap,
|
|
223
|
-
|
|
223
|
+
splitCounter,
|
|
224
224
|
);
|
|
225
225
|
while (resetBuilder.needsReset()) {
|
|
226
226
|
const witgenTimer = new Timer();
|
|
@@ -239,12 +239,7 @@ export class PrivateKernelExecutionProver {
|
|
|
239
239
|
},
|
|
240
240
|
});
|
|
241
241
|
|
|
242
|
-
resetBuilder = new PrivateKernelResetPrivateInputsBuilder(
|
|
243
|
-
output,
|
|
244
|
-
[],
|
|
245
|
-
noteHashNullifierCounterMap,
|
|
246
|
-
validationRequestsSplitCounter,
|
|
247
|
-
);
|
|
242
|
+
resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, [], noteHashNullifierCounterMap, splitCounter);
|
|
248
243
|
}
|
|
249
244
|
|
|
250
245
|
if (output.publicInputs.feePayer.isZero() && skipFeeEnforcement) {
|
|
@@ -420,6 +415,7 @@ export class PrivateKernelExecutionProver {
|
|
|
420
415
|
await this.oracle.getContractClassIdPreimage(currentContractClassId);
|
|
421
416
|
|
|
422
417
|
const updatedClassIdHints = await this.oracle.getUpdatedClassIdHints(contractAddress);
|
|
418
|
+
|
|
423
419
|
return PrivateCallData.from({
|
|
424
420
|
publicInputs,
|
|
425
421
|
vk,
|
|
@@ -8,7 +8,7 @@ import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-type
|
|
|
8
8
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
9
9
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
10
10
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
|
-
import type {
|
|
11
|
+
import type { BlockParameter } from '@aztec/stdlib/block';
|
|
12
12
|
import { computeContractClassIdPreimage, computeSaltedInitializationHash } from '@aztec/stdlib/contract';
|
|
13
13
|
import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
|
|
14
14
|
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
@@ -31,7 +31,7 @@ export class PrivateKernelOracleImpl implements PrivateKernelOracle {
|
|
|
31
31
|
private contractDataProvider: ContractDataProvider,
|
|
32
32
|
private keyStore: KeyStore,
|
|
33
33
|
private node: AztecNode,
|
|
34
|
-
private blockNumber:
|
|
34
|
+
private blockNumber: BlockParameter = 'latest',
|
|
35
35
|
private log = createLogger('pxe:kernel_oracle'),
|
|
36
36
|
) {}
|
|
37
37
|
|