@aztec/pxe 0.0.1-commit.f1df4d2 → 0.0.1-commit.f2ce05ee
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/block_synchronizer/block_synchronizer.d.ts +4 -2
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +7 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +5 -3
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +6 -4
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +3 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +4 -2
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +5 -5
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +8 -5
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +33 -7
- package/dest/contract_sync/contract_sync_service.d.ts +41 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +82 -0
- package/dest/contract_sync/helpers.d.ts +28 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/{index.js → helpers.js} +6 -12
- package/dest/debug/pxe_debug_utils.d.ts +12 -9
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +16 -15
- package/dest/entrypoints/server/index.d.ts +2 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +1 -1
- package/dest/pxe.d.ts +13 -2
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +35 -14
- package/dest/storage/contract_store/contract_store.js +5 -5
- package/dest/storage/note_store/note_store.d.ts +1 -1
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +3 -0
- package/package.json +25 -16
- package/src/block_synchronizer/block_synchronizer.ts +6 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +5 -2
- package/src/contract_function_simulator/oracle/interfaces.ts +1 -1
- package/src/contract_function_simulator/oracle/oracle.ts +3 -3
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +4 -5
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +36 -7
- package/src/contract_sync/contract_sync_service.ts +129 -0
- package/src/contract_sync/{index.ts → helpers.ts} +6 -32
- package/src/debug/pxe_debug_utils.ts +45 -17
- package/src/entrypoints/server/index.ts +1 -1
- package/src/pxe.ts +45 -17
- package/src/storage/contract_store/contract_store.ts +4 -4
- package/src/storage/note_store/note_store.ts +4 -0
- package/dest/contract_sync/index.d.ts +0 -24
- package/dest/contract_sync/index.d.ts.map +0 -1
|
@@ -45,7 +45,7 @@ export async function syncState(
|
|
|
45
45
|
utilityExecutor: (privateSyncCall: FunctionCall) => Promise<any>,
|
|
46
46
|
noteStore: NoteStore,
|
|
47
47
|
aztecNode: AztecNode,
|
|
48
|
-
|
|
48
|
+
anchorBlockHeader: BlockHeader,
|
|
49
49
|
jobId: string,
|
|
50
50
|
) {
|
|
51
51
|
// Protocol contracts don't have private state to sync
|
|
@@ -57,7 +57,7 @@ export async function syncState(
|
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
const noteService = new NoteService(noteStore, aztecNode,
|
|
60
|
+
const noteService = new NoteService(noteStore, aztecNode, anchorBlockHeader, jobId);
|
|
61
61
|
|
|
62
62
|
// Both sync_state and syncNoteNullifiers interact with the note store, but running them in parallel is safe
|
|
63
63
|
// because note store is designed to handle concurrent operations.
|
|
@@ -68,9 +68,12 @@ export async function syncState(
|
|
|
68
68
|
/**
|
|
69
69
|
* Verify that the current class id of a contract obtained from AztecNode is the same as the one in contract data
|
|
70
70
|
* provider (i.e. PXE's own storage).
|
|
71
|
+
* @param contractAddress - The address of the contract to verify.
|
|
72
|
+
* @param aztecNode - The Aztec node to query for storage.
|
|
73
|
+
* @param contractStore - The contract store to fetch the local instance from.
|
|
71
74
|
* @param header - The header of the block at which to verify the current class id.
|
|
72
75
|
*/
|
|
73
|
-
async function verifyCurrentClassId(
|
|
76
|
+
export async function verifyCurrentClassId(
|
|
74
77
|
contractAddress: AztecAddress,
|
|
75
78
|
aztecNode: AztecNode,
|
|
76
79
|
contractStore: ContractStore,
|
|
@@ -88,32 +91,3 @@ async function verifyCurrentClassId(
|
|
|
88
91
|
);
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Ensures the contract's private state is synchronized and that the PXE holds the current class artifact for
|
|
94
|
-
* the contract.
|
|
95
|
-
*/
|
|
96
|
-
export async function ensureContractSynced(
|
|
97
|
-
contractAddress: AztecAddress,
|
|
98
|
-
functionToInvokeAfterSync: FunctionSelector | null,
|
|
99
|
-
utilityExecutor: (call: FunctionCall) => Promise<any>,
|
|
100
|
-
aztecNode: AztecNode,
|
|
101
|
-
contractStore: ContractStore,
|
|
102
|
-
noteStore: NoteStore,
|
|
103
|
-
header: BlockHeader,
|
|
104
|
-
jobId: string,
|
|
105
|
-
): Promise<void> {
|
|
106
|
-
await Promise.all([
|
|
107
|
-
syncState(
|
|
108
|
-
contractAddress,
|
|
109
|
-
contractStore,
|
|
110
|
-
functionToInvokeAfterSync,
|
|
111
|
-
utilityExecutor,
|
|
112
|
-
noteStore,
|
|
113
|
-
aztecNode,
|
|
114
|
-
header,
|
|
115
|
-
jobId,
|
|
116
|
-
),
|
|
117
|
-
verifyCurrentClassId(contractAddress, aztecNode, contractStore, header),
|
|
118
|
-
]);
|
|
119
|
-
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FunctionCall } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
4
|
import type { NoteDao, NotesFilter } from '@aztec/stdlib/note';
|
|
3
|
-
import type {
|
|
5
|
+
import type { ContractOverrides } from '@aztec/stdlib/tx';
|
|
4
6
|
|
|
5
7
|
import type { BlockSynchronizer } from '../block_synchronizer/block_synchronizer.js';
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
+
import type { ContractFunctionSimulator } from '../contract_function_simulator/contract_function_simulator.js';
|
|
9
|
+
import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
|
|
8
10
|
import type { AnchorBlockStore } from '../storage/index.js';
|
|
9
11
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
10
12
|
|
|
@@ -13,20 +15,38 @@ import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
|
13
15
|
* No backwards compatibility or API stability should be expected. Use at your own risk.
|
|
14
16
|
*/
|
|
15
17
|
export class PXEDebugUtils {
|
|
16
|
-
#pxe!: PXE;
|
|
17
18
|
#putJobInQueue!: <T>(job: (jobId: string) => Promise<T>) => Promise<T>;
|
|
19
|
+
#getSimulatorForTx!: (overrides?: { contracts?: ContractOverrides }) => ContractFunctionSimulator;
|
|
20
|
+
#simulateUtility!: (
|
|
21
|
+
contractFunctionSimulator: ContractFunctionSimulator,
|
|
22
|
+
call: FunctionCall,
|
|
23
|
+
authWitnesses: AuthWitness[] | undefined,
|
|
24
|
+
scopes: AztecAddress[] | undefined,
|
|
25
|
+
jobId: string,
|
|
26
|
+
) => Promise<any>;
|
|
18
27
|
|
|
19
28
|
constructor(
|
|
20
|
-
private
|
|
29
|
+
private contractSyncService: ContractSyncService,
|
|
21
30
|
private noteStore: NoteStore,
|
|
22
31
|
private blockStateSynchronizer: BlockSynchronizer,
|
|
23
32
|
private anchorBlockStore: AnchorBlockStore,
|
|
24
33
|
) {}
|
|
25
34
|
|
|
26
35
|
/** Not injected through constructor since they're are co-dependant */
|
|
27
|
-
public
|
|
28
|
-
|
|
36
|
+
public setPXEHelpers(
|
|
37
|
+
putJobInQueue: <T>(job: (jobId: string) => Promise<T>) => Promise<T>,
|
|
38
|
+
getSimulatorForTx: (overrides?: { contracts?: ContractOverrides }) => ContractFunctionSimulator,
|
|
39
|
+
simulateUtility: (
|
|
40
|
+
contractFunctionSimulator: ContractFunctionSimulator,
|
|
41
|
+
call: FunctionCall,
|
|
42
|
+
authWitnesses: AuthWitness[] | undefined,
|
|
43
|
+
scopes: AztecAddress[] | undefined,
|
|
44
|
+
jobId: string,
|
|
45
|
+
) => Promise<any>,
|
|
46
|
+
) {
|
|
29
47
|
this.#putJobInQueue = putJobInQueue;
|
|
48
|
+
this.#getSimulatorForTx = getSimulatorForTx;
|
|
49
|
+
this.#simulateUtility = simulateUtility;
|
|
30
50
|
}
|
|
31
51
|
|
|
32
52
|
/**
|
|
@@ -40,17 +60,25 @@ export class PXEDebugUtils {
|
|
|
40
60
|
* @param filter - The filter to apply to the notes.
|
|
41
61
|
* @returns The requested notes.
|
|
42
62
|
*/
|
|
43
|
-
public
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
await this.#pxe.simulateUtility(call);
|
|
63
|
+
public getNotes(filter: NotesFilter): Promise<NoteDao[]> {
|
|
64
|
+
return this.#putJobInQueue(async (jobId: string) => {
|
|
65
|
+
await this.blockStateSynchronizer.sync();
|
|
47
66
|
|
|
48
|
-
|
|
49
|
-
|
|
67
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
68
|
+
|
|
69
|
+
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
70
|
+
|
|
71
|
+
await this.contractSyncService.ensureContractSynced(
|
|
72
|
+
filter.contractAddress,
|
|
73
|
+
null,
|
|
74
|
+
async privateSyncCall =>
|
|
75
|
+
await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId),
|
|
76
|
+
anchorBlockHeader,
|
|
77
|
+
jobId,
|
|
78
|
+
);
|
|
50
79
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return this.anchorBlockStore.getBlockHeader();
|
|
80
|
+
return this.noteStore.getNotes(filter, jobId);
|
|
81
|
+
});
|
|
54
82
|
}
|
|
55
83
|
|
|
56
84
|
/**
|
|
@@ -7,4 +7,4 @@ export { NoteService } from '../../notes/note_service.js';
|
|
|
7
7
|
export { ORACLE_VERSION } from '../../oracle_version.js';
|
|
8
8
|
export { type PXECreationOptions } from '../pxe_creation_options.js';
|
|
9
9
|
export { JobCoordinator } from '../../job_coordinator/job_coordinator.js';
|
|
10
|
-
export {
|
|
10
|
+
export { ContractSyncService } from '../../contract_sync/contract_sync_service.js';
|
package/src/pxe.ts
CHANGED
|
@@ -33,6 +33,7 @@ import type {
|
|
|
33
33
|
PrivateKernelTailCircuitPublicInputs,
|
|
34
34
|
} from '@aztec/stdlib/kernel';
|
|
35
35
|
import {
|
|
36
|
+
BlockHeader,
|
|
36
37
|
type ContractOverrides,
|
|
37
38
|
type InTx,
|
|
38
39
|
PrivateExecutionResult,
|
|
@@ -59,7 +60,8 @@ import {
|
|
|
59
60
|
generateSimulatedProvingResult,
|
|
60
61
|
} from './contract_function_simulator/contract_function_simulator.js';
|
|
61
62
|
import { ProxiedContractStoreFactory } from './contract_function_simulator/proxied_contract_data_source.js';
|
|
62
|
-
import {
|
|
63
|
+
import { ContractSyncService } from './contract_sync/contract_sync_service.js';
|
|
64
|
+
import { readCurrentClassId } from './contract_sync/helpers.js';
|
|
63
65
|
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
64
66
|
import { enrichPublicSimulationError, enrichSimulationError } from './error_enriching.js';
|
|
65
67
|
import { PrivateEventFilterValidator } from './events/private_event_filter_validator.js';
|
|
@@ -102,6 +104,7 @@ export class PXE {
|
|
|
102
104
|
private recipientTaggingStore: RecipientTaggingStore,
|
|
103
105
|
private addressStore: AddressStore,
|
|
104
106
|
private privateEventStore: PrivateEventStore,
|
|
107
|
+
private contractSyncService: ContractSyncService,
|
|
105
108
|
private simulator: CircuitSimulator,
|
|
106
109
|
private proverEnabled: boolean,
|
|
107
110
|
private proofCreator: PrivateKernelProver,
|
|
@@ -149,6 +152,12 @@ export class PXE {
|
|
|
149
152
|
const capsuleStore = new CapsuleStore(store);
|
|
150
153
|
const keyStore = new KeyStore(store);
|
|
151
154
|
const tipsStore = new L2TipsKVStore(store, 'pxe');
|
|
155
|
+
const contractSyncService = new ContractSyncService(
|
|
156
|
+
node,
|
|
157
|
+
contractStore,
|
|
158
|
+
noteStore,
|
|
159
|
+
createLogger('pxe:contract_sync', bindings),
|
|
160
|
+
);
|
|
152
161
|
const synchronizer = new BlockSynchronizer(
|
|
153
162
|
node,
|
|
154
163
|
store,
|
|
@@ -156,6 +165,7 @@ export class PXE {
|
|
|
156
165
|
noteStore,
|
|
157
166
|
privateEventStore,
|
|
158
167
|
tipsStore,
|
|
168
|
+
contractSyncService,
|
|
159
169
|
config,
|
|
160
170
|
bindings,
|
|
161
171
|
);
|
|
@@ -167,9 +177,10 @@ export class PXE {
|
|
|
167
177
|
recipientTaggingStore,
|
|
168
178
|
privateEventStore,
|
|
169
179
|
noteStore,
|
|
180
|
+
contractSyncService,
|
|
170
181
|
]);
|
|
171
182
|
|
|
172
|
-
const debugUtils = new PXEDebugUtils(
|
|
183
|
+
const debugUtils = new PXEDebugUtils(contractSyncService, noteStore, synchronizer, anchorBlockStore);
|
|
173
184
|
|
|
174
185
|
const jobQueue = new SerialQueue();
|
|
175
186
|
|
|
@@ -186,6 +197,7 @@ export class PXE {
|
|
|
186
197
|
recipientTaggingStore,
|
|
187
198
|
addressStore,
|
|
188
199
|
privateEventStore,
|
|
200
|
+
contractSyncService,
|
|
189
201
|
simulator,
|
|
190
202
|
proverEnabled,
|
|
191
203
|
proofCreator,
|
|
@@ -196,7 +208,11 @@ export class PXE {
|
|
|
196
208
|
debugUtils,
|
|
197
209
|
);
|
|
198
210
|
|
|
199
|
-
debugUtils.
|
|
211
|
+
debugUtils.setPXEHelpers(
|
|
212
|
+
pxe.#putInJobQueue.bind(pxe),
|
|
213
|
+
pxe.#getSimulatorForTx.bind(pxe),
|
|
214
|
+
pxe.#simulateUtility.bind(pxe),
|
|
215
|
+
);
|
|
200
216
|
|
|
201
217
|
pxe.jobQueue.start();
|
|
202
218
|
|
|
@@ -223,6 +239,7 @@ export class PXE {
|
|
|
223
239
|
this.capsuleStore,
|
|
224
240
|
this.privateEventStore,
|
|
225
241
|
this.simulator,
|
|
242
|
+
this.contractSyncService,
|
|
226
243
|
);
|
|
227
244
|
}
|
|
228
245
|
|
|
@@ -297,13 +314,10 @@ export class PXE {
|
|
|
297
314
|
try {
|
|
298
315
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
299
316
|
|
|
300
|
-
await ensureContractSynced(
|
|
317
|
+
await this.contractSyncService.ensureContractSynced(
|
|
301
318
|
contractAddress,
|
|
302
319
|
functionSelector,
|
|
303
320
|
privateSyncCall => this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId),
|
|
304
|
-
this.node,
|
|
305
|
-
this.contractStore,
|
|
306
|
-
this.noteStore,
|
|
307
321
|
anchorBlockHeader,
|
|
308
322
|
jobId,
|
|
309
323
|
);
|
|
@@ -417,6 +431,19 @@ export class PXE {
|
|
|
417
431
|
|
|
418
432
|
// Public API
|
|
419
433
|
|
|
434
|
+
/**
|
|
435
|
+
* Returns the block header up to which the PXE has synced.
|
|
436
|
+
* @returns The synced block header
|
|
437
|
+
*/
|
|
438
|
+
public getSyncedBlockHeader(): Promise<BlockHeader> {
|
|
439
|
+
return this.anchorBlockStore.getBlockHeader();
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Returns the contract instance for a given address, if it's registered in the PXE.
|
|
444
|
+
* @param address - The contract address.
|
|
445
|
+
* @returns The contract instance if found, undefined otherwise.
|
|
446
|
+
*/
|
|
420
447
|
public getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined> {
|
|
421
448
|
return this.contractStore.getContractInstance(address);
|
|
422
449
|
}
|
|
@@ -850,7 +877,14 @@ export class PXE {
|
|
|
850
877
|
// Temporary: in case there are overrides, we have to skip the kernels or validations
|
|
851
878
|
// will fail. Consider handing control to the user/wallet on whether they want to run them
|
|
852
879
|
// or not.
|
|
853
|
-
const
|
|
880
|
+
const overriddenContracts = overrides?.contracts ? new Set(Object.keys(overrides.contracts)) : undefined;
|
|
881
|
+
const hasOverriddenContracts = overriddenContracts !== undefined && overriddenContracts.size > 0;
|
|
882
|
+
const skipKernels = hasOverriddenContracts;
|
|
883
|
+
|
|
884
|
+
// Set overridden contracts on the sync service so it knows to skip syncing them
|
|
885
|
+
if (hasOverriddenContracts) {
|
|
886
|
+
this.contractSyncService.setOverriddenContracts(jobId, overriddenContracts);
|
|
887
|
+
}
|
|
854
888
|
|
|
855
889
|
// Execution of private functions only; no proving, and no kernel logic.
|
|
856
890
|
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
|
|
@@ -861,7 +895,7 @@ export class PXE {
|
|
|
861
895
|
if (skipKernels) {
|
|
862
896
|
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(
|
|
863
897
|
privateExecutionResult,
|
|
864
|
-
this.contractStore,
|
|
898
|
+
(addr, sel) => this.contractStore.getDebugFunctionName(addr, sel),
|
|
865
899
|
));
|
|
866
900
|
} else {
|
|
867
901
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
@@ -972,13 +1006,10 @@ export class PXE {
|
|
|
972
1006
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
973
1007
|
|
|
974
1008
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
975
|
-
await ensureContractSynced(
|
|
1009
|
+
await this.contractSyncService.ensureContractSynced(
|
|
976
1010
|
call.to,
|
|
977
1011
|
call.selector,
|
|
978
1012
|
privateSyncCall => this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId),
|
|
979
|
-
this.node,
|
|
980
|
-
this.contractStore,
|
|
981
|
-
this.noteStore,
|
|
982
1013
|
anchorBlockHeader,
|
|
983
1014
|
jobId,
|
|
984
1015
|
);
|
|
@@ -1044,14 +1075,11 @@ export class PXE {
|
|
|
1044
1075
|
|
|
1045
1076
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
1046
1077
|
|
|
1047
|
-
await ensureContractSynced(
|
|
1078
|
+
await this.contractSyncService.ensureContractSynced(
|
|
1048
1079
|
filter.contractAddress,
|
|
1049
1080
|
null,
|
|
1050
1081
|
async privateSyncCall =>
|
|
1051
1082
|
await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId),
|
|
1052
|
-
this.node,
|
|
1053
|
-
this.contractStore,
|
|
1054
|
-
this.noteStore,
|
|
1055
1083
|
anchorBlockHeader,
|
|
1056
1084
|
jobId,
|
|
1057
1085
|
);
|
|
@@ -316,15 +316,15 @@ export class ContractStore {
|
|
|
316
316
|
throw new Error(`Unknown function ${functionName} in contract ${contract.name}.`);
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
return {
|
|
319
|
+
return FunctionCall.from({
|
|
320
320
|
name: functionDao.name,
|
|
321
|
-
|
|
321
|
+
to,
|
|
322
322
|
selector: await FunctionSelector.fromNameAndParameters(functionDao.name, functionDao.parameters),
|
|
323
323
|
type: functionDao.functionType,
|
|
324
|
-
to,
|
|
325
324
|
hideMsgSender: false,
|
|
326
325
|
isStatic: functionDao.isStatic,
|
|
326
|
+
args: encodeArguments(functionDao, args),
|
|
327
327
|
returnTypes: functionDao.returnTypes,
|
|
328
|
-
};
|
|
328
|
+
});
|
|
329
329
|
}
|
|
330
330
|
}
|
|
@@ -220,6 +220,10 @@ export class NoteStore implements StagedStore {
|
|
|
220
220
|
return Promise.resolve([]);
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
if (nullifiers.some(n => n.l2BlockNumber === 0)) {
|
|
224
|
+
return Promise.reject(new Error('applyNullifiers: nullifiers cannot have been emitted at block 0'));
|
|
225
|
+
}
|
|
226
|
+
|
|
223
227
|
return this.#withJobLock(jobId, () =>
|
|
224
228
|
this.#store.transactionAsync(async () => {
|
|
225
229
|
const notesToNullify = await Promise.all(
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { FunctionCall, FunctionSelector } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type { ContractInstance } from '@aztec/stdlib/contract';
|
|
4
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
|
-
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
6
|
-
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
7
|
-
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
8
|
-
/**
|
|
9
|
-
* Read the current class id of a contract from the execution data provider or AztecNode. If not found, class id
|
|
10
|
-
* from the instance is used.
|
|
11
|
-
* @param contractAddress - The address of the contract to read the class id for.
|
|
12
|
-
* @param instance - The instance of the contract.
|
|
13
|
-
* @param aztecNode - The Aztec node to query for storage.
|
|
14
|
-
* @param header - The header of the block at which to load the DelayedPublicMutable storing the class id.
|
|
15
|
-
* @returns The current class id.
|
|
16
|
-
*/
|
|
17
|
-
export declare function readCurrentClassId(contractAddress: AztecAddress, instance: ContractInstance, aztecNode: AztecNode, header: BlockHeader): Promise<import("@aztec/foundation/schemas").Fr>;
|
|
18
|
-
export declare function syncState(contractAddress: AztecAddress, contractStore: ContractStore, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (privateSyncCall: FunctionCall) => Promise<any>, noteStore: NoteStore, aztecNode: AztecNode, header: BlockHeader, jobId: string): Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* Ensures the contract's private state is synchronized and that the PXE holds the current class artifact for
|
|
21
|
-
* the contract.
|
|
22
|
-
*/
|
|
23
|
-
export declare function ensureContractSynced(contractAddress: AztecAddress, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (call: FunctionCall) => Promise<any>, aztecNode: AztecNode, contractStore: ContractStore, noteStore: NoteStore, header: BlockHeader, jobId: string): Promise<void>;
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdF9zeW5jL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3hFLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFL0QsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFHcEQsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sNkNBQTZDLENBQUM7QUFDakYsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0scUNBQXFDLENBQUM7QUFFckU7Ozs7Ozs7O0dBUUc7QUFDSCx3QkFBc0Isa0JBQWtCLENBQ3RDLGVBQWUsRUFBRSxZQUFZLEVBQzdCLFFBQVEsRUFBRSxnQkFBZ0IsRUFDMUIsU0FBUyxFQUFFLFNBQVMsRUFDcEIsTUFBTSxFQUFFLFdBQVcsbURBYXBCO0FBRUQs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