@aztec/pxe 0.0.1-commit.6d63667d → 0.0.1-commit.7cf39cb55
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/contract_function_simulator/contract_function_simulator.d.ts +51 -28
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +168 -64
- 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 +2 -2
- 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 +34 -36
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +71 -18
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +30 -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 +53 -32
- package/dest/contract_sync/contract_sync_service.d.ts +3 -2
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +32 -17
- package/dest/debug/pxe_debug_utils.d.ts +2 -4
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +1 -4
- 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 +9 -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 +9 -1
- package/dest/entrypoints/server/utils.js +9 -1
- package/dest/logs/log_service.d.ts +1 -1
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +4 -9
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/pxe.d.ts +67 -23
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +49 -34
- package/dest/storage/contract_store/contract_store.js +5 -5
- package/dest/storage/note_store/note_store.d.ts +1 -2
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +4 -2
- package/package.json +16 -16
- package/src/contract_function_simulator/contract_function_simulator.ts +314 -121
- 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 +91 -93
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +94 -31
- package/src/contract_sync/contract_sync_service.ts +41 -25
- package/src/debug/pxe_debug_utils.ts +4 -8
- package/src/entrypoints/client/bundle/utils.ts +9 -1
- package/src/entrypoints/client/lazy/utils.ts +9 -1
- package/src/entrypoints/server/utils.ts +7 -7
- package/src/logs/log_service.ts +4 -13
- package/src/oracle_version.ts +2 -2
- package/src/pxe.ts +114 -71
- package/src/storage/contract_store/contract_store.ts +4 -4
- package/src/storage/note_store/note_store.ts +5 -2
package/dest/pxe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pxe.d.ts","sourceRoot":"","sources":["../src/pxe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,KAAK,MAAM,EAAqC,MAAM,uBAAuB,CAAC;AAIvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,KAAK,yBAAyB,EAAyB,MAAM,2BAA2B,CAAC;AAClG,OAAO,KAAK,EAAE,gBAAg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c,EAAE,gBAAwB,EAAE,kBAA0B,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,cAAc,GAC1G,OAAO,CAAC,kBAAkB,CAAC,CAgI7B;IAED;;;OAGG;IACI,eAAe,CACpB,IAAI,EAAE,YAAY,EAClB,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAE,mBAAwB,GAC7C,OAAO,CAAC,uBAAuB,CAAC,CAwDlC;IAED;;;;;;;;;;;;OAYG;IACU,gBAAgB,CAC3B,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,EAAE,CAAC,CA8B/B;IAED;;OAEG;IACI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;CACF"}
|
package/dest/pxe.js
CHANGED
|
@@ -84,11 +84,12 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
84
84
|
* can be contacted.
|
|
85
85
|
*
|
|
86
86
|
* @returns A promise that resolves PXE is ready to be used.
|
|
87
|
-
*/ static async create(node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix) {
|
|
87
|
+
*/ static async create({ node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix }) {
|
|
88
88
|
// Extract bindings from the logger, or use empty bindings if a string suffix is provided.
|
|
89
89
|
const bindings = loggerOrSuffix && typeof loggerOrSuffix !== 'string' ? loggerOrSuffix.getBindings() : undefined;
|
|
90
90
|
const log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:service:${loggerOrSuffix}` : `pxe:service`) : loggerOrSuffix;
|
|
91
|
-
const
|
|
91
|
+
const info = await node.getNodeInfo();
|
|
92
|
+
const proverEnabled = config.proverEnabled !== undefined ? config.proverEnabled : info.realProofs;
|
|
92
93
|
const addressStore = new AddressStore(store);
|
|
93
94
|
const privateEventStore = new PrivateEventStore(store);
|
|
94
95
|
const contractStore = new ContractStore(store);
|
|
@@ -117,14 +118,26 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
117
118
|
debugUtils.setPXEHelpers(pxe.#putInJobQueue.bind(pxe), pxe.#getSimulatorForTx.bind(pxe), pxe.#simulateUtility.bind(pxe));
|
|
118
119
|
pxe.jobQueue.start();
|
|
119
120
|
await pxe.#registerProtocolContracts();
|
|
120
|
-
const info = await node.getNodeInfo();
|
|
121
121
|
log.info(`Started PXE connected to chain ${info.l1ChainId} version ${info.rollupVersion}`);
|
|
122
122
|
return pxe;
|
|
123
123
|
}
|
|
124
124
|
// Internal methods
|
|
125
125
|
#getSimulatorForTx(overrides) {
|
|
126
126
|
const proxyContractStore = ProxiedContractStoreFactory.create(this.contractStore, overrides?.contracts);
|
|
127
|
-
return new ContractFunctionSimulator(
|
|
127
|
+
return new ContractFunctionSimulator({
|
|
128
|
+
contractStore: proxyContractStore,
|
|
129
|
+
noteStore: this.noteStore,
|
|
130
|
+
keyStore: this.keyStore,
|
|
131
|
+
addressStore: this.addressStore,
|
|
132
|
+
aztecNode: BenchmarkedNodeFactory.create(this.node),
|
|
133
|
+
senderTaggingStore: this.senderTaggingStore,
|
|
134
|
+
recipientTaggingStore: this.recipientTaggingStore,
|
|
135
|
+
senderAddressBookStore: this.senderAddressBookStore,
|
|
136
|
+
capsuleStore: this.capsuleStore,
|
|
137
|
+
privateEventStore: this.privateEventStore,
|
|
138
|
+
simulator: this.simulator,
|
|
139
|
+
contractSyncService: this.contractSyncService
|
|
140
|
+
});
|
|
128
141
|
}
|
|
129
142
|
#contextualizeError(err, ...context) {
|
|
130
143
|
let contextStr = '';
|
|
@@ -180,10 +193,14 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
180
193
|
const { origin: contractAddress, functionSelector } = txRequest;
|
|
181
194
|
try {
|
|
182
195
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
183
|
-
await this.contractSyncService.ensureContractSynced(contractAddress, functionSelector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [],
|
|
184
|
-
const result = await contractFunctionSimulator.run(txRequest,
|
|
185
|
-
|
|
186
|
-
|
|
196
|
+
await this.contractSyncService.ensureContractSynced(contractAddress, functionSelector, (privateSyncCall, execScopes)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, scopes);
|
|
197
|
+
const result = await contractFunctionSimulator.run(txRequest, {
|
|
198
|
+
contractAddress,
|
|
199
|
+
selector: functionSelector,
|
|
200
|
+
anchorBlockHeader,
|
|
201
|
+
scopes,
|
|
202
|
+
jobId
|
|
203
|
+
});
|
|
187
204
|
this.log.debug(`Private simulation completed for ${contractAddress.toString()}:${functionSelector}`);
|
|
188
205
|
return result;
|
|
189
206
|
} catch (err) {
|
|
@@ -257,7 +274,17 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
257
274
|
return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
|
|
258
275
|
}
|
|
259
276
|
// Public API
|
|
260
|
-
|
|
277
|
+
/**
|
|
278
|
+
* Returns the block header up to which the PXE has synced.
|
|
279
|
+
* @returns The synced block header
|
|
280
|
+
*/ getSyncedBlockHeader() {
|
|
281
|
+
return this.anchorBlockStore.getBlockHeader();
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Returns the contract instance for a given address, if it's registered in the PXE.
|
|
285
|
+
* @param address - The contract address.
|
|
286
|
+
* @returns The contract instance if found, undefined otherwise.
|
|
287
|
+
*/ getContractInstance(address) {
|
|
261
288
|
return this.contractStore.getContractInstance(address);
|
|
262
289
|
}
|
|
263
290
|
/**
|
|
@@ -424,10 +451,11 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
424
451
|
* (where validators prove the public portion).
|
|
425
452
|
*
|
|
426
453
|
* @param txRequest - An authenticated tx request ready for proving
|
|
454
|
+
* @param scopes - Addresses whose private state and keys are accessible during private execution.
|
|
427
455
|
* @returns A result containing the proof and public inputs of the tail circuit.
|
|
428
456
|
* @throws If contract code not found, or public simulation reverts.
|
|
429
457
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
430
|
-
*/ proveTx(txRequest) {
|
|
458
|
+
*/ proveTx(txRequest, scopes) {
|
|
431
459
|
let privateExecutionResult;
|
|
432
460
|
// We disable proving concurrently mostly out of caution, since it accesses some of our stores. Proving is so
|
|
433
461
|
// computationally demanding that it'd be rare for someone to try to do it concurrently regardless.
|
|
@@ -438,7 +466,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
438
466
|
await this.blockStateSynchronizer.sync();
|
|
439
467
|
const syncTime = syncTimer.ms();
|
|
440
468
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
441
|
-
privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest,
|
|
469
|
+
privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
|
|
442
470
|
const { publicInputs, chonkProof, executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
443
471
|
simulate: false,
|
|
444
472
|
skipFeeEnforcement: false,
|
|
@@ -488,13 +516,10 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
488
516
|
}
|
|
489
517
|
/**
|
|
490
518
|
* Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
|
|
491
|
-
*
|
|
492
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
493
|
-
* @param msgSender - (Optional) The message sender to use for the simulation.
|
|
494
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
519
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
495
520
|
* @returns A trace of the program execution with gate counts.
|
|
496
521
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
497
|
-
*/ profileTx(txRequest, profileMode, skipProofGeneration = true) {
|
|
522
|
+
*/ profileTx(txRequest, { profileMode, skipProofGeneration = true, scopes }) {
|
|
498
523
|
// We disable concurrent profiles for consistency with simulateTx.
|
|
499
524
|
return this.#putInJobQueue(async (jobId)=>{
|
|
500
525
|
const totalTimer = new Timer();
|
|
@@ -512,7 +537,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
512
537
|
await this.blockStateSynchronizer.sync();
|
|
513
538
|
const syncTime = syncTimer.ms();
|
|
514
539
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
515
|
-
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest,
|
|
540
|
+
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
|
|
516
541
|
const { executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
517
542
|
simulate: skipProofGeneration,
|
|
518
543
|
skipFeeEnforcement: false,
|
|
@@ -557,18 +582,13 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
557
582
|
* In that case, the transaction returned is only potentially ready to be sent to the network for execution.
|
|
558
583
|
*
|
|
559
584
|
*
|
|
560
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
561
|
-
* @param simulatePublic - Whether to simulate the public part of the transaction.
|
|
562
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
563
|
-
* @param skipFeeEnforcement - (Optional) If false, fees are enforced.
|
|
564
|
-
* @param overrides - (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts.
|
|
565
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
585
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
566
586
|
* @returns A simulated transaction result object that includes public and private return values.
|
|
567
587
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
568
588
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
569
589
|
*
|
|
570
590
|
* TODO(#7456) Prevent msgSender being defined here for the first call
|
|
571
|
-
*/ simulateTx(txRequest, simulatePublic, skipTxValidation = false, skipFeeEnforcement = false, overrides, scopes) {
|
|
591
|
+
*/ simulateTx(txRequest, { simulatePublic, skipTxValidation = false, skipFeeEnforcement = false, overrides, scopes }) {
|
|
572
592
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
573
593
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
574
594
|
// delete the same read value, or reading values that another simulation is currently modifying).
|
|
@@ -603,7 +623,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
603
623
|
let publicInputs;
|
|
604
624
|
let executionSteps = [];
|
|
605
625
|
if (skipKernels) {
|
|
606
|
-
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, this.contractStore));
|
|
626
|
+
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, (addr, sel)=>this.contractStore.getDebugFunctionName(addr, sel), this.node));
|
|
607
627
|
} else {
|
|
608
628
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
609
629
|
({ publicInputs, executionSteps } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
@@ -668,14 +688,9 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
668
688
|
});
|
|
669
689
|
}
|
|
670
690
|
/**
|
|
671
|
-
*
|
|
672
|
-
*
|
|
691
|
+
* Simulates the execution of a contract utility function.
|
|
673
692
|
* @param call - The function call containing the function details, arguments, and target contract address.
|
|
674
|
-
|
|
675
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will
|
|
676
|
-
* default to all.
|
|
677
|
-
* @returns The result of the utility function call, structured based on the function ABI.
|
|
678
|
-
*/ simulateUtility(call, authwits, scopes) {
|
|
693
|
+
*/ simulateUtility(call, { authwits, scopes } = {}) {
|
|
679
694
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
680
695
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
681
696
|
// delete the same read value, or reading values that another simulation is currently modifying).
|
|
@@ -688,7 +703,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
688
703
|
const functionTimer = new Timer();
|
|
689
704
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
690
705
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
691
|
-
await this.contractSyncService.ensureContractSynced(call.to, call.selector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [],
|
|
706
|
+
await this.contractSyncService.ensureContractSynced(call.to, call.selector, (privateSyncCall, execScopes)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, scopes);
|
|
692
707
|
const executionResult = await this.#simulateUtility(contractFunctionSimulator, call, authwits ?? [], scopes, jobId);
|
|
693
708
|
const functionTime = functionTimer.ms();
|
|
694
709
|
const totalTime = totalTimer.ms();
|
|
@@ -738,7 +753,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
738
753
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
739
754
|
anchorBlockNumber = anchorBlockHeader.getBlockNumber();
|
|
740
755
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
741
|
-
await this.contractSyncService.ensureContractSynced(filter.contractAddress, null, async (privateSyncCall)=>await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [],
|
|
756
|
+
await this.contractSyncService.ensureContractSynced(filter.contractAddress, null, async (privateSyncCall, execScopes)=>await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, filter.scopes);
|
|
742
757
|
});
|
|
743
758
|
// anchorBlockNumber is set during the job and fixed to whatever it is after a block sync
|
|
744
759
|
const sanitizedFilter = new PrivateEventFilterValidator(anchorBlockNumber).validate(filter);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toArray } from '@aztec/foundation/iterable';
|
|
2
|
-
import { FunctionSelector, FunctionType, contractArtifactFromBuffer, contractArtifactToBuffer, encodeArguments, getFunctionDebugMetadata } from '@aztec/stdlib/abi';
|
|
2
|
+
import { FunctionCall, FunctionSelector, FunctionType, contractArtifactFromBuffer, contractArtifactToBuffer, encodeArguments, getFunctionDebugMetadata } from '@aztec/stdlib/abi';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import { SerializableContractInstance, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
5
5
|
import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
@@ -219,15 +219,15 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
219
219
|
if (!functionDao) {
|
|
220
220
|
throw new Error(`Unknown function ${functionName} in contract ${contract.name}.`);
|
|
221
221
|
}
|
|
222
|
-
return {
|
|
222
|
+
return FunctionCall.from({
|
|
223
223
|
name: functionDao.name,
|
|
224
|
-
|
|
224
|
+
to,
|
|
225
225
|
selector: await FunctionSelector.fromNameAndParameters(functionDao.name, functionDao.parameters),
|
|
226
226
|
type: functionDao.functionType,
|
|
227
|
-
to,
|
|
228
227
|
hideMsgSender: false,
|
|
229
228
|
isStatic: functionDao.isStatic,
|
|
229
|
+
args: encodeArguments(functionDao, args),
|
|
230
230
|
returnTypes: functionDao.returnTypes
|
|
231
|
-
};
|
|
231
|
+
});
|
|
232
232
|
}
|
|
233
233
|
}
|
|
@@ -35,7 +35,6 @@ export declare class NoteStore implements StagedStore {
|
|
|
35
35
|
* @params jobId - the job context to read from.
|
|
36
36
|
* @returns Filtered and deduplicated notes (a note might be present in multiple scopes - we ensure it is only
|
|
37
37
|
* returned once if this is the case)
|
|
38
|
-
* @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
|
|
39
38
|
*/
|
|
40
39
|
getNotes(filter: NotesFilter, jobId: string): Promise<NoteDao[]>;
|
|
41
40
|
/**
|
|
@@ -80,4 +79,4 @@ export declare class NoteStore implements StagedStore {
|
|
|
80
79
|
commit(jobId: string): Promise<void>;
|
|
81
80
|
discardStaged(jobId: string): Promise<void>;
|
|
82
81
|
}
|
|
83
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
82
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZV9zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2Uvbm90ZV9zdG9yZS9ub3RlX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFxQyxNQUFNLGlCQUFpQixDQUFDO0FBQzVGLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3ZELE9BQU8sRUFBRSxPQUFPLEVBQWMsS0FBSyxXQUFXLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUUzRSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSwwQ0FBMEMsQ0FBQztBQUc1RTs7Ozs7SUFLSTtBQUNKLHFCQUFhLFNBQVUsWUFBVyxXQUFXOztJQUMzQyxRQUFRLENBQUMsU0FBUyxFQUFFLE1BQU0sQ0FBVTtJQStCcEMsWUFBWSxLQUFLLEVBQUUsaUJBQWlCLEVBUW5DO0lBRUQ7Ozs7Ozs7OztPQVNHO0lBQ0ksUUFBUSxDQUFDLEtBQUssRUFBRSxPQUFPLEVBQUUsRUFBRSxLQUFLLEVBQ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AG,OAAO,CAAC,OAAO,EAAE,CAAC,CA6F/D;IAED;;;;;;;;;;;;;;OAcG;IACH,eAAe,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAyChF;IAED;;;;;;;;;;;OAWG;IACU,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMpF;IA6ED;;;;;;;;;OASG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUzC;IAED,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1C;CAkCF"}
|
|
@@ -74,10 +74,9 @@ import { StoredNote } from './stored_note.js';
|
|
|
74
74
|
* @params jobId - the job context to read from.
|
|
75
75
|
* @returns Filtered and deduplicated notes (a note might be present in multiple scopes - we ensure it is only
|
|
76
76
|
* returned once if this is the case)
|
|
77
|
-
* @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
|
|
78
77
|
*/ getNotes(filter, jobId) {
|
|
79
78
|
if (filter.scopes !== undefined && filter.scopes.length === 0) {
|
|
80
|
-
return Promise.
|
|
79
|
+
return Promise.resolve([]);
|
|
81
80
|
}
|
|
82
81
|
return this.#store.transactionAsync(async ()=>{
|
|
83
82
|
const targetStatus = filter.status ?? NoteStatus.ACTIVE;
|
|
@@ -173,6 +172,9 @@ import { StoredNote } from './stored_note.js';
|
|
|
173
172
|
if (nullifiers.length === 0) {
|
|
174
173
|
return Promise.resolve([]);
|
|
175
174
|
}
|
|
175
|
+
if (nullifiers.some((n)=>n.l2BlockNumber === 0)) {
|
|
176
|
+
return Promise.reject(new Error('applyNullifiers: nullifiers cannot have been emitted at block 0'));
|
|
177
|
+
}
|
|
176
178
|
return this.#withJobLock(jobId, ()=>this.#store.transactionAsync(async ()=>{
|
|
177
179
|
const notesToNullify = await Promise.all(nullifiers.map(async (nullifierInBlock)=>{
|
|
178
180
|
const nullifier = nullifierInBlock.data.toString();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/pxe",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.7cf39cb55",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"typedocOptions": {
|
|
6
6
|
"entryPoints": [
|
|
@@ -70,19 +70,19 @@
|
|
|
70
70
|
]
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
74
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
75
|
-
"@aztec/builder": "0.0.1-commit.
|
|
76
|
-
"@aztec/constants": "0.0.1-commit.
|
|
77
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
78
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
79
|
-
"@aztec/key-store": "0.0.1-commit.
|
|
80
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
81
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
82
|
-
"@aztec/noir-types": "0.0.1-commit.
|
|
83
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
84
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
85
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
73
|
+
"@aztec/bb-prover": "0.0.1-commit.7cf39cb55",
|
|
74
|
+
"@aztec/bb.js": "0.0.1-commit.7cf39cb55",
|
|
75
|
+
"@aztec/builder": "0.0.1-commit.7cf39cb55",
|
|
76
|
+
"@aztec/constants": "0.0.1-commit.7cf39cb55",
|
|
77
|
+
"@aztec/ethereum": "0.0.1-commit.7cf39cb55",
|
|
78
|
+
"@aztec/foundation": "0.0.1-commit.7cf39cb55",
|
|
79
|
+
"@aztec/key-store": "0.0.1-commit.7cf39cb55",
|
|
80
|
+
"@aztec/kv-store": "0.0.1-commit.7cf39cb55",
|
|
81
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.7cf39cb55",
|
|
82
|
+
"@aztec/noir-types": "0.0.1-commit.7cf39cb55",
|
|
83
|
+
"@aztec/protocol-contracts": "0.0.1-commit.7cf39cb55",
|
|
84
|
+
"@aztec/simulator": "0.0.1-commit.7cf39cb55",
|
|
85
|
+
"@aztec/stdlib": "0.0.1-commit.7cf39cb55",
|
|
86
86
|
"koa": "^2.16.1",
|
|
87
87
|
"koa-router": "^13.1.1",
|
|
88
88
|
"lodash.omit": "^4.5.0",
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@aztec/merkle-tree": "0.0.1-commit.
|
|
95
|
-
"@aztec/noir-test-contracts.js": "0.0.1-commit.
|
|
94
|
+
"@aztec/merkle-tree": "0.0.1-commit.7cf39cb55",
|
|
95
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.7cf39cb55",
|
|
96
96
|
"@jest/globals": "^30.0.0",
|
|
97
97
|
"@types/jest": "^30.0.0",
|
|
98
98
|
"@types/lodash.omit": "^4.5.7",
|