@aztec/pxe 4.0.0-nightly.20260113 → 4.0.0-nightly.20260114
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/oracle/interfaces.d.ts +3 -3
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +4 -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 +5 -5
- package/dest/contract_function_simulator/oracle/oracle.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +2 -1
- package/dest/events/event_service.d.ts +1 -1
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +8 -12
- package/dest/notes/note_service.d.ts +2 -2
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +14 -22
- package/dest/private_kernel/private_kernel_oracle.d.ts +23 -28
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +92 -2
- package/dest/pxe.d.ts +7 -36
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +8 -58
- package/dest/storage/note_store/note_store.d.ts +3 -4
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +63 -70
- package/dest/storage/private_event_store/private_event_store.d.ts +10 -5
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +55 -41
- package/package.json +16 -16
- package/src/contract_function_simulator/oracle/interfaces.ts +2 -2
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +6 -6
- package/src/contract_function_simulator/oracle/oracle.ts +1 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +1 -0
- package/src/events/event_service.ts +12 -26
- package/src/notes/note_service.ts +14 -23
- package/src/private_kernel/private_kernel_oracle.ts +119 -37
- package/src/pxe.ts +8 -81
- package/src/storage/note_store/note_store.ts +66 -65
- package/src/storage/private_event_store/private_event_store.ts +72 -45
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -46
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +0 -85
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -127
package/dest/pxe.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { CircuitSimulator } from '@aztec/simulator/client';
|
|
|
7
7
|
import { type ContractArtifact, EventSelector, FunctionCall } from '@aztec/stdlib/abi';
|
|
8
8
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
9
9
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
|
-
import { CompleteAddress, type
|
|
10
|
+
import { CompleteAddress, type ContractInstanceWithAddress, type PartialAddress } from '@aztec/stdlib/contract';
|
|
11
11
|
import type { AztecNode, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
12
12
|
import { type InTx, SimulationOverrides, TxExecutionRequest, TxProfileResult, TxProvingResult, TxSimulationResult, UtilitySimulationResult } from '@aztec/stdlib/tx';
|
|
13
13
|
import type { PXEConfig } from './config/index.js';
|
|
@@ -53,40 +53,11 @@ export declare class PXE {
|
|
|
53
53
|
static create(node: AztecNode, store: AztecAsyncKVStore, proofCreator: PrivateKernelProver, simulator: CircuitSimulator, protocolContractsProvider: ProtocolContractsProvider, config: PXEConfig, loggerOrSuffix?: string | Logger): Promise<PXE>;
|
|
54
54
|
getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
55
55
|
/**
|
|
56
|
-
* Returns the contract
|
|
57
|
-
*
|
|
58
|
-
* @
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
* @returns - It returns the contract class metadata, with the artifact field being optional, and will only be returned if true is passed in
|
|
62
|
-
* for `includeArtifact`
|
|
63
|
-
* TODO(@spalladino): The PXE actually holds artifacts and not classes, what should we return? Also,
|
|
64
|
-
* should the pxe query the node for contract public info, and merge it with its own definitions?
|
|
65
|
-
* TODO(@spalladino): This method is strictly needed to decide whether to publicly register a class or not
|
|
66
|
-
* during a public deployment. We probably want a nicer and more general API for this, but it'll have to
|
|
67
|
-
* do for the time being.
|
|
68
|
-
*/
|
|
69
|
-
getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<{
|
|
70
|
-
contractClass: ContractClassWithId | undefined;
|
|
71
|
-
isContractClassPubliclyRegistered: boolean;
|
|
72
|
-
artifact: ContractArtifact | undefined;
|
|
73
|
-
}>;
|
|
74
|
-
/**
|
|
75
|
-
* Returns the contract metadata given an address.
|
|
76
|
-
* The metadata consists of its contract instance, which includes the contract class identifier,
|
|
77
|
-
* initialization hash, deployment salt, and public keys hash; whether the contract instance has been initialized;
|
|
78
|
-
* and whether the contract instance with the given address has been publicly deployed.
|
|
79
|
-
* @remark - it queries the node to check whether the contract instance has been initialized / publicly deployed through a node.
|
|
80
|
-
* This query is not dependent on the PXE.
|
|
81
|
-
* @param address - The address that the contract instance resides at.
|
|
82
|
-
* @returns - It returns the contract metadata
|
|
83
|
-
* TODO(@spalladino): Should we return the public keys in plain as well here?
|
|
84
|
-
*/
|
|
85
|
-
getContractMetadata(address: AztecAddress): Promise<{
|
|
86
|
-
contractInstance: ContractInstanceWithAddress | undefined;
|
|
87
|
-
isContractInitialized: boolean;
|
|
88
|
-
isContractPublished: boolean;
|
|
89
|
-
}>;
|
|
56
|
+
* Returns the contract artifact for a given contract class id, if it's registered in the PXE.
|
|
57
|
+
* @param id - Identifier of the contract class.
|
|
58
|
+
* @returns The contract artifact if found, undefined otherwise.
|
|
59
|
+
*/
|
|
60
|
+
getContractArtifact(id: Fr): Promise<ContractArtifact | undefined>;
|
|
90
61
|
/**
|
|
91
62
|
* Registers a user account in PXE given its master encryption private key.
|
|
92
63
|
* Once a new account is registered, the PXE will trial-decrypt all published notes on
|
|
@@ -230,4 +201,4 @@ export declare class PXE {
|
|
|
230
201
|
*/
|
|
231
202
|
stop(): Promise<void>;
|
|
232
203
|
}
|
|
233
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
204
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHhlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcHhlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDakUsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUlsRSxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRXpELE9BQU8sRUFBRSxLQUFLLHlCQUF5QixFQUF5QixNQUFNLDJCQUEyQixDQUFDO0FBQ2xHLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDaEUsT0FBTyxFQUNMLEtBQUssZ0JBQWdCLEVBQ3JCLGFBQWEsRUFDYixZQUFZLEVBR2IsTUFBTSxtQkFBbUIsQ0FBQztBQUMzQixPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUM5RCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEVBQ0wsZUFBZSxFQUNmLEtBQUssMkJBQTJCLEVBQ2hDLEtBQUssY0FBYyxFQUdwQixNQUFNLHdCQUF3QixDQUFDO0FBR2hDLE9BQ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AAQ,CAAC,EAAE,WAAW,EAAE,EACxB,MAAM,CAAC,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,uBAAuB,CAAC,CAiDlC;IAED;;;;;;;;;;;;OAYG;IACI,gBAAgB,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAoB/G;IAED;;OAEG;IACI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;CACF"}
|
package/dest/pxe.js
CHANGED
|
@@ -8,7 +8,7 @@ import { protocolContractNames } from '@aztec/protocol-contracts';
|
|
|
8
8
|
import { FunctionType, decodeFunctionSignature } from '@aztec/stdlib/abi';
|
|
9
9
|
import { computeContractAddressFromInstance, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
10
10
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
11
|
-
import { computeProtocolNullifier
|
|
11
|
+
import { computeProtocolNullifier } from '@aztec/stdlib/hash';
|
|
12
12
|
import { PrivateSimulationResult, TxProfileResult, TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
13
13
|
import { inspect } from 'util';
|
|
14
14
|
import { BlockSynchronizer } from './block_synchronizer/index.js';
|
|
@@ -21,7 +21,7 @@ import { enrichPublicSimulationError, enrichSimulationError } from './error_enri
|
|
|
21
21
|
import { PrivateEventFilterValidator } from './events/private_event_filter_validator.js';
|
|
22
22
|
import { JobCoordinator } from './job_coordinator/job_coordinator.js';
|
|
23
23
|
import { PrivateKernelExecutionProver } from './private_kernel/private_kernel_execution_prover.js';
|
|
24
|
-
import {
|
|
24
|
+
import { PrivateKernelOracle } from './private_kernel/private_kernel_oracle.js';
|
|
25
25
|
import { AddressStore } from './storage/address_store/address_store.js';
|
|
26
26
|
import { AnchorBlockStore } from './storage/anchor_block_store/anchor_block_store.js';
|
|
27
27
|
import { CapsuleStore } from './storage/capsule_store/capsule_store.js';
|
|
@@ -165,16 +165,6 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
165
165
|
}
|
|
166
166
|
this.log.verbose(`Registered protocol contracts in pxe`, registered);
|
|
167
167
|
}
|
|
168
|
-
async #isContractClassPubliclyRegistered(id) {
|
|
169
|
-
return !!await this.node.getContractClass(id);
|
|
170
|
-
}
|
|
171
|
-
async #isContractPublished(address) {
|
|
172
|
-
return !!await this.node.getContract(address);
|
|
173
|
-
}
|
|
174
|
-
async #isContractInitialized(address) {
|
|
175
|
-
const initNullifier = await siloNullifier(address, address.toField());
|
|
176
|
-
return !!await this.node.getNullifierMembershipWitness('latest', initNullifier);
|
|
177
|
-
}
|
|
178
168
|
// Executes the entrypoint private function, as well as all nested private
|
|
179
169
|
// functions that might arise.
|
|
180
170
|
async #executePrivate(contractFunctionSimulator, txRequest, scopes, jobId) {
|
|
@@ -250,7 +240,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
250
240
|
* @returns An object that contains the output of the kernel execution, including the ChonkProof if proving is enabled.
|
|
251
241
|
*/ async #prove(txExecutionRequest, proofCreator, privateExecutionResult, config) {
|
|
252
242
|
const simulationAnchorBlock = privateExecutionResult.getSimulationAnchorBlockNumber();
|
|
253
|
-
const kernelOracle = new
|
|
243
|
+
const kernelOracle = new PrivateKernelOracle(this.contractStore, this.keyStore, this.node, simulationAnchorBlock);
|
|
254
244
|
const kernelTraceProver = new PrivateKernelExecutionProver(kernelOracle, proofCreator, !this.proverEnabled);
|
|
255
245
|
this.log.debug(`Executing kernel trace prover (${JSON.stringify(config)})...`);
|
|
256
246
|
return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
|
|
@@ -260,51 +250,11 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
260
250
|
return this.contractStore.getContractInstance(address);
|
|
261
251
|
}
|
|
262
252
|
/**
|
|
263
|
-
* Returns the contract
|
|
264
|
-
*
|
|
265
|
-
* @
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
* @returns - It returns the contract class metadata, with the artifact field being optional, and will only be returned if true is passed in
|
|
269
|
-
* for `includeArtifact`
|
|
270
|
-
* TODO(@spalladino): The PXE actually holds artifacts and not classes, what should we return? Also,
|
|
271
|
-
* should the pxe query the node for contract public info, and merge it with its own definitions?
|
|
272
|
-
* TODO(@spalladino): This method is strictly needed to decide whether to publicly register a class or not
|
|
273
|
-
* during a public deployment. We probably want a nicer and more general API for this, but it'll have to
|
|
274
|
-
* do for the time being.
|
|
275
|
-
*/ async getContractClassMetadata(id, includeArtifact = false) {
|
|
276
|
-
const artifact = await this.contractStore.getContractArtifact(id);
|
|
277
|
-
if (!artifact) {
|
|
278
|
-
this.log.warn(`No artifact found for contract class ${id.toString()} when looking for its metadata`);
|
|
279
|
-
}
|
|
280
|
-
return {
|
|
281
|
-
contractClass: artifact && await getContractClassFromArtifact(artifact),
|
|
282
|
-
isContractClassPubliclyRegistered: await this.#isContractClassPubliclyRegistered(id),
|
|
283
|
-
artifact: includeArtifact ? artifact : undefined
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Returns the contract metadata given an address.
|
|
288
|
-
* The metadata consists of its contract instance, which includes the contract class identifier,
|
|
289
|
-
* initialization hash, deployment salt, and public keys hash; whether the contract instance has been initialized;
|
|
290
|
-
* and whether the contract instance with the given address has been publicly deployed.
|
|
291
|
-
* @remark - it queries the node to check whether the contract instance has been initialized / publicly deployed through a node.
|
|
292
|
-
* This query is not dependent on the PXE.
|
|
293
|
-
* @param address - The address that the contract instance resides at.
|
|
294
|
-
* @returns - It returns the contract metadata
|
|
295
|
-
* TODO(@spalladino): Should we return the public keys in plain as well here?
|
|
296
|
-
*/ async getContractMetadata(address) {
|
|
297
|
-
let instance;
|
|
298
|
-
try {
|
|
299
|
-
instance = await this.contractStore.getContractInstance(address);
|
|
300
|
-
} catch {
|
|
301
|
-
this.log.warn(`No instance found for contract ${address.toString()} when looking for its metadata`);
|
|
302
|
-
}
|
|
303
|
-
return {
|
|
304
|
-
contractInstance: instance,
|
|
305
|
-
isContractInitialized: await this.#isContractInitialized(address),
|
|
306
|
-
isContractPublished: await this.#isContractPublished(address)
|
|
307
|
-
};
|
|
253
|
+
* Returns the contract artifact for a given contract class id, if it's registered in the PXE.
|
|
254
|
+
* @param id - Identifier of the contract class.
|
|
255
|
+
* @returns The contract artifact if found, undefined otherwise.
|
|
256
|
+
*/ async getContractArtifact(id) {
|
|
257
|
+
return await this.contractStore.getContractArtifact(id);
|
|
308
258
|
}
|
|
309
259
|
/**
|
|
310
260
|
* Registers a user account in PXE given its master encryption private key.
|
|
@@ -36,9 +36,8 @@ export declare class NoteStore {
|
|
|
36
36
|
/**
|
|
37
37
|
* Adds multiple notes to the data provider under the specified scope.
|
|
38
38
|
*
|
|
39
|
-
* Notes are stored using their
|
|
40
|
-
*
|
|
41
|
-
* for efficient retrieval.
|
|
39
|
+
* Notes are stored using their siloedNullifier as the key, which provides uniqueness. Each note is indexed
|
|
40
|
+
* by multiple criteria for efficient retrieval.
|
|
42
41
|
*
|
|
43
42
|
* @param notes - Notes to store
|
|
44
43
|
* @param scope - The scope (user/account) under which to store the notes
|
|
@@ -83,4 +82,4 @@ export declare class NoteStore {
|
|
|
83
82
|
*/
|
|
84
83
|
applyNullifiers(nullifiers: DataInBlock<Fr>[]): Promise<NoteDao[]>;
|
|
85
84
|
}
|
|
86
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
85
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZV9zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2Uvbm90ZV9zdG9yZS9ub3RlX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FB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BZSxDQUFDLFVBQVUsRUFBRSxXQUFXLENBQUMsRUFBRSxDQUFDLEVBQUUsR0FBRyxPQUFPLENBQUMsT0FBTyxFQUFFLENBQUMsQ0FvRGpFO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note_store.d.ts","sourceRoot":"","sources":["../../../src/storage/note_store/note_store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"note_store.d.ts","sourceRoot":"","sources":["../../../src/storage/note_store/note_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;;;;IAKI;AACJ,qBAAa,SAAS;;IA4BpB,OAAO,eAcN;IAED;;;;;;;;OAQG;IACH,OAAoB,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,CAOvE;IAED;;;;;;;;OAQG;IACU,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAY3D;IAED;;;;;;;;OAQG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAe7D;IAED;;;;;;;;;;;OAWG;IACU,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGpF;IAiFD;;;;;;;;;;;OAWG;IACG,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAmHtD;IAED;;;;;;;;;;OAUG;IACH,eAAe,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAoDjE;CACF"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { toBufferBE } from '@aztec/foundation/bigint-buffer';
|
|
2
1
|
import { toArray } from '@aztec/foundation/iterable';
|
|
3
2
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
3
|
import { NoteStatus } from '@aztec/stdlib/note';
|
|
@@ -10,28 +9,25 @@ import { NoteDao } from '@aztec/stdlib/note';
|
|
|
10
9
|
* and performs rollback handling in the case of a reorg.
|
|
11
10
|
**/ export class NoteStore {
|
|
12
11
|
#store;
|
|
13
|
-
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#nullifiersByBlockNumber;
|
|
17
|
-
#nullifiedNotesToScope;
|
|
18
|
-
#nullifiedNotesByContract;
|
|
19
|
-
#nullifiedNotesByStorageSlot;
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
#notesByStorageSlotAndScope;
|
|
12
|
+
// Note that we use the siloedNullifier as the note id in the store as it's guaranteed to be unique.
|
|
13
|
+
/** noteId (siloedNullifier) -> NoteDao (serialized) */ #notes;
|
|
14
|
+
/** noteId (siloedNullifier) -> NoteDao (serialized) */ #nullifiedNotes;
|
|
15
|
+
/** blockNumber -> siloedNullifier */ #nullifiersByBlockNumber;
|
|
16
|
+
/** noteId (siloedNullifier) -> scope */ #nullifiedNotesToScope;
|
|
17
|
+
/** contractAddress -> noteId (siloedNullifier) */ #nullifiedNotesByContract;
|
|
18
|
+
/** storageSlot -> noteId (siloedNullifier) */ #nullifiedNotesByStorageSlot;
|
|
19
|
+
/** scope (AztecAddress) -> true */ #scopes;
|
|
20
|
+
/** noteId (siloedNullifier) -> scope */ #notesToScope;
|
|
21
|
+
/** scope -> MultiMap(contractAddress -> noteId) */ #notesByContractAndScope;
|
|
22
|
+
/** scope -> MultiMap(storageSlot -> noteId) */ #notesByStorageSlotAndScope;
|
|
25
23
|
constructor(store){
|
|
26
24
|
this.#store = store;
|
|
27
25
|
this.#notes = store.openMap('notes');
|
|
28
26
|
this.#nullifiedNotes = store.openMap('nullified_notes');
|
|
29
|
-
this.#nullifierToNoteId = store.openMap('nullifier_to_note');
|
|
30
27
|
this.#nullifiersByBlockNumber = store.openMultiMap('nullifier_to_block_number');
|
|
31
28
|
this.#nullifiedNotesToScope = store.openMultiMap('nullified_notes_to_scope');
|
|
32
29
|
this.#nullifiedNotesByContract = store.openMultiMap('nullified_notes_by_contract');
|
|
33
30
|
this.#nullifiedNotesByStorageSlot = store.openMultiMap('nullified_notes_by_storage_slot');
|
|
34
|
-
this.#nullifiedNotesByNullifier = store.openMap('nullified_notes_by_nullifier');
|
|
35
31
|
this.#scopes = store.openMap('scopes');
|
|
36
32
|
this.#notesToScope = store.openMultiMap('notes_to_scope');
|
|
37
33
|
this.#notesByContractAndScope = new Map();
|
|
@@ -74,9 +70,8 @@ import { NoteDao } from '@aztec/stdlib/note';
|
|
|
74
70
|
/**
|
|
75
71
|
* Adds multiple notes to the data provider under the specified scope.
|
|
76
72
|
*
|
|
77
|
-
* Notes are stored using their
|
|
78
|
-
*
|
|
79
|
-
* for efficient retrieval.
|
|
73
|
+
* Notes are stored using their siloedNullifier as the key, which provides uniqueness. Each note is indexed
|
|
74
|
+
* by multiple criteria for efficient retrieval.
|
|
80
75
|
*
|
|
81
76
|
* @param notes - Notes to store
|
|
82
77
|
* @param scope - The scope (user/account) under which to store the notes
|
|
@@ -86,12 +81,11 @@ import { NoteDao } from '@aztec/stdlib/note';
|
|
|
86
81
|
await this.addScope(scope);
|
|
87
82
|
}
|
|
88
83
|
for (const dao of notes){
|
|
89
|
-
const
|
|
90
|
-
await this.#notes.set(
|
|
91
|
-
await this.#notesToScope.set(
|
|
92
|
-
await this.#
|
|
93
|
-
await this.#
|
|
94
|
-
await this.#notesByStorageSlotAndScope.get(scope.toString()).set(dao.storageSlot.toString(), noteIndex);
|
|
84
|
+
const noteId = dao.siloedNullifier.toString();
|
|
85
|
+
await this.#notes.set(noteId, dao.toBuffer());
|
|
86
|
+
await this.#notesToScope.set(noteId, scope.toString());
|
|
87
|
+
await this.#notesByContractAndScope.get(scope.toString()).set(dao.contractAddress.toString(), noteId);
|
|
88
|
+
await this.#notesByStorageSlotAndScope.get(scope.toString()).set(dao.storageSlot.toString(), noteId);
|
|
95
89
|
}
|
|
96
90
|
});
|
|
97
91
|
}
|
|
@@ -122,14 +116,13 @@ import { NoteDao } from '@aztec/stdlib/note';
|
|
|
122
116
|
for (const note of notes){
|
|
123
117
|
const noteDao = NoteDao.fromBuffer(note);
|
|
124
118
|
if (noteDao.l2BlockNumber > blockNumber) {
|
|
125
|
-
const
|
|
126
|
-
await this.#notes.delete(
|
|
127
|
-
await this.#notesToScope.delete(
|
|
128
|
-
await this.#nullifierToNoteId.delete(noteDao.siloedNullifier.toString());
|
|
119
|
+
const noteId = noteDao.siloedNullifier.toString();
|
|
120
|
+
await this.#notes.delete(noteId);
|
|
121
|
+
await this.#notesToScope.delete(noteId);
|
|
129
122
|
const scopes = await toArray(this.#scopes.keysAsync());
|
|
130
123
|
for (const scope of scopes){
|
|
131
|
-
await this.#notesByContractAndScope.get(scope).deleteValue(noteDao.contractAddress.toString(),
|
|
132
|
-
await this.#notesByStorageSlotAndScope.get(scope).deleteValue(noteDao.storageSlot.toString(),
|
|
124
|
+
await this.#notesByContractAndScope.get(scope).deleteValue(noteDao.contractAddress.toString(), noteId);
|
|
125
|
+
await this.#notesByStorageSlotAndScope.get(scope).deleteValue(noteDao.storageSlot.toString(), noteId);
|
|
133
126
|
}
|
|
134
127
|
}
|
|
135
128
|
}
|
|
@@ -144,39 +137,36 @@ import { NoteDao } from '@aztec/stdlib/note';
|
|
|
144
137
|
* @param blockNumber - Revert nullifications that occurred after this block
|
|
145
138
|
* @param synchedBlockNumber - Upper bound for the block range to process
|
|
146
139
|
*/ async #rewindNullifiersAfterBlock(blockNumber, synchedBlockNumber) {
|
|
147
|
-
const
|
|
140
|
+
const noteIdsToReinsert = [];
|
|
148
141
|
const currentBlockNumber = blockNumber + 1;
|
|
149
142
|
for(let i = currentBlockNumber; i <= synchedBlockNumber; i++){
|
|
150
|
-
|
|
143
|
+
// noteId === siloedNullifier.toString(), so we can use nullifiers directly as noteIds
|
|
144
|
+
noteIdsToReinsert.push(...await toArray(this.#nullifiersByBlockNumber.getValuesAsync(i)));
|
|
151
145
|
}
|
|
152
|
-
const
|
|
153
|
-
const notNullNoteIndexes = notesIndexesToReinsert.filter((noteIndex)=>noteIndex != undefined);
|
|
154
|
-
const nullifiedNoteBuffers = await Promise.all(notNullNoteIndexes.map((noteIndex)=>this.#nullifiedNotes.getAsync(noteIndex)));
|
|
146
|
+
const nullifiedNoteBuffers = await Promise.all(noteIdsToReinsert.map((noteId)=>this.#nullifiedNotes.getAsync(noteId)));
|
|
155
147
|
const noteDaos = nullifiedNoteBuffers.filter((buffer)=>buffer != undefined).map((buffer)=>NoteDao.fromBuffer(buffer));
|
|
156
148
|
for (const dao of noteDaos){
|
|
157
|
-
const
|
|
158
|
-
const scopes = await toArray(this.#nullifiedNotesToScope.getValuesAsync(
|
|
149
|
+
const noteId = dao.siloedNullifier.toString();
|
|
150
|
+
const scopes = await toArray(this.#nullifiedNotesToScope.getValuesAsync(noteId));
|
|
159
151
|
if (scopes.length === 0) {
|
|
160
152
|
// We should never run into this error because notes always have a scope assigned to them - either on initial
|
|
161
153
|
// insertion via `addNotes` or when removing their nullifiers.
|
|
162
|
-
throw new Error(`No scopes found for nullified note with
|
|
154
|
+
throw new Error(`No scopes found for nullified note with nullifier ${noteId}`);
|
|
163
155
|
}
|
|
164
156
|
for (const scope of scopes){
|
|
165
157
|
await Promise.all([
|
|
166
|
-
this.#notesByContractAndScope.get(scope.toString()).set(dao.contractAddress.toString(),
|
|
167
|
-
this.#notesByStorageSlotAndScope.get(scope.toString()).set(dao.storageSlot.toString(),
|
|
168
|
-
this.#notesToScope.set(
|
|
158
|
+
this.#notesByContractAndScope.get(scope.toString()).set(dao.contractAddress.toString(), noteId),
|
|
159
|
+
this.#notesByStorageSlotAndScope.get(scope.toString()).set(dao.storageSlot.toString(), noteId),
|
|
160
|
+
this.#notesToScope.set(noteId, scope)
|
|
169
161
|
]);
|
|
170
162
|
}
|
|
171
163
|
await Promise.all([
|
|
172
|
-
this.#notes.set(
|
|
173
|
-
this.#
|
|
174
|
-
this.#
|
|
175
|
-
this.#nullifiedNotesToScope.delete(noteIndex),
|
|
164
|
+
this.#notes.set(noteId, dao.toBuffer()),
|
|
165
|
+
this.#nullifiedNotes.delete(noteId),
|
|
166
|
+
this.#nullifiedNotesToScope.delete(noteId),
|
|
176
167
|
this.#nullifiersByBlockNumber.deleteValue(dao.l2BlockNumber, dao.siloedNullifier.toString()),
|
|
177
|
-
this.#nullifiedNotesByContract.deleteValue(dao.contractAddress.toString(),
|
|
178
|
-
this.#nullifiedNotesByStorageSlot.deleteValue(dao.storageSlot.toString(),
|
|
179
|
-
this.#nullifiedNotesByNullifier.delete(dao.siloedNullifier.toString())
|
|
168
|
+
this.#nullifiedNotesByContract.deleteValue(dao.contractAddress.toString(), noteId),
|
|
169
|
+
this.#nullifiedNotesByStorageSlot.deleteValue(dao.storageSlot.toString(), noteId)
|
|
180
170
|
]);
|
|
181
171
|
}
|
|
182
172
|
}
|
|
@@ -259,6 +249,16 @@ import { NoteDao } from '@aztec/stdlib/note';
|
|
|
259
249
|
deduplicated.push(note);
|
|
260
250
|
}
|
|
261
251
|
}
|
|
252
|
+
// Sort by block number, then by tx index within block, then by note index within tx
|
|
253
|
+
deduplicated.sort((a, b)=>{
|
|
254
|
+
if (a.l2BlockNumber !== b.l2BlockNumber) {
|
|
255
|
+
return a.l2BlockNumber - b.l2BlockNumber;
|
|
256
|
+
}
|
|
257
|
+
if (a.txIndexInBlock !== b.txIndexInBlock) {
|
|
258
|
+
return a.txIndexInBlock - b.txIndexInBlock;
|
|
259
|
+
}
|
|
260
|
+
return a.noteIndexInTx - b.noteIndexInTx;
|
|
261
|
+
});
|
|
262
262
|
return deduplicated;
|
|
263
263
|
}
|
|
264
264
|
/**
|
|
@@ -279,21 +279,16 @@ import { NoteDao } from '@aztec/stdlib/note';
|
|
|
279
279
|
const nullifiedNotes = [];
|
|
280
280
|
for (const blockScopedNullifier of nullifiers){
|
|
281
281
|
const { data: nullifier, l2BlockNumber: blockNumber } = blockScopedNullifier;
|
|
282
|
-
const
|
|
283
|
-
const
|
|
284
|
-
if (!
|
|
285
|
-
// Check if already nullified
|
|
286
|
-
|
|
287
|
-
if (alreadyNullified) {
|
|
282
|
+
const noteId = nullifier.toString();
|
|
283
|
+
const noteBuffer = await this.#notes.getAsync(noteId);
|
|
284
|
+
if (!noteBuffer) {
|
|
285
|
+
// Check if already nullified (noteId === siloedNullifier, so we can check #nullifiedNotes directly)
|
|
286
|
+
if (await this.#nullifiedNotes.hasAsync(noteId)) {
|
|
288
287
|
throw new Error(`Nullifier already applied in applyNullifiers`);
|
|
289
288
|
}
|
|
290
289
|
throw new Error('Nullifier not found in applyNullifiers');
|
|
291
290
|
}
|
|
292
|
-
const
|
|
293
|
-
if (!noteBuffer) {
|
|
294
|
-
throw new Error('Note not found in applyNullifiers');
|
|
295
|
-
}
|
|
296
|
-
const noteScopes = await toArray(this.#notesToScope.getValuesAsync(noteIndex));
|
|
291
|
+
const noteScopes = await toArray(this.#notesToScope.getValuesAsync(noteId));
|
|
297
292
|
if (noteScopes.length === 0) {
|
|
298
293
|
// We should never run into this error because notes always have a scope assigned to them - either on initial
|
|
299
294
|
// insertion via `addNotes` or when removing their nullifiers.
|
|
@@ -301,22 +296,20 @@ import { NoteDao } from '@aztec/stdlib/note';
|
|
|
301
296
|
}
|
|
302
297
|
const note = NoteDao.fromBuffer(noteBuffer);
|
|
303
298
|
nullifiedNotes.push(note);
|
|
304
|
-
await this.#notes.delete(
|
|
305
|
-
await this.#notesToScope.delete(
|
|
299
|
+
await this.#notes.delete(noteId);
|
|
300
|
+
await this.#notesToScope.delete(noteId);
|
|
306
301
|
const scopes = await toArray(this.#scopes.keysAsync());
|
|
307
302
|
for (const scope of scopes){
|
|
308
|
-
await this.#notesByContractAndScope.get(scope).deleteValue(note.contractAddress.toString(),
|
|
309
|
-
await this.#notesByStorageSlotAndScope.get(scope).deleteValue(note.storageSlot.toString(),
|
|
303
|
+
await this.#notesByContractAndScope.get(scope).deleteValue(note.contractAddress.toString(), noteId);
|
|
304
|
+
await this.#notesByStorageSlotAndScope.get(scope).deleteValue(note.storageSlot.toString(), noteId);
|
|
310
305
|
}
|
|
311
306
|
for (const scope of noteScopes){
|
|
312
|
-
await this.#nullifiedNotesToScope.set(
|
|
307
|
+
await this.#nullifiedNotesToScope.set(noteId, scope);
|
|
313
308
|
}
|
|
314
|
-
await this.#nullifiedNotes.set(
|
|
315
|
-
await this.#nullifiersByBlockNumber.set(blockNumber,
|
|
316
|
-
await this.#nullifiedNotesByContract.set(note.contractAddress.toString(),
|
|
317
|
-
await this.#nullifiedNotesByStorageSlot.set(note.storageSlot.toString(),
|
|
318
|
-
await this.#nullifiedNotesByNullifier.set(nullifier.toString(), noteIndex);
|
|
319
|
-
await this.#nullifierToNoteId.delete(nullifier.toString());
|
|
309
|
+
await this.#nullifiedNotes.set(noteId, note.toBuffer());
|
|
310
|
+
await this.#nullifiersByBlockNumber.set(blockNumber, noteId);
|
|
311
|
+
await this.#nullifiedNotesByContract.set(note.contractAddress.toString(), noteId);
|
|
312
|
+
await this.#nullifiedNotesByStorageSlot.set(note.storageSlot.toString(), noteId);
|
|
320
313
|
}
|
|
321
314
|
return nullifiedNotes;
|
|
322
315
|
});
|
|
@@ -14,6 +14,10 @@ export type PrivateEventStoreFilter = {
|
|
|
14
14
|
type PrivateEventMetadata = InTx & {
|
|
15
15
|
contractAddress: AztecAddress;
|
|
16
16
|
scope: AztecAddress;
|
|
17
|
+
/** The index of the tx within the block */
|
|
18
|
+
txIndexInBlock: number;
|
|
19
|
+
/** The index of the event within the tx (based on nullifier position) */
|
|
20
|
+
eventIndexInTx: number;
|
|
17
21
|
};
|
|
18
22
|
/**
|
|
19
23
|
* Stores decrypted private event logs.
|
|
@@ -25,15 +29,16 @@ export declare class PrivateEventStore {
|
|
|
25
29
|
/**
|
|
26
30
|
* Store a private event log.
|
|
27
31
|
* @param eventSelector - The event selector of the event.
|
|
32
|
+
* @param randomness - The randomness used for the event commitment.
|
|
28
33
|
* @param msgContent - The content of the event.
|
|
29
|
-
* @param
|
|
34
|
+
* @param siloedEventCommitment - The siloed event commitment (used as unique identifier).
|
|
30
35
|
* @param metadata
|
|
31
36
|
* contractAddress - The address of the contract that emitted the event.
|
|
32
37
|
* scope - The address to which the event is scoped.
|
|
33
38
|
* txHash - The transaction hash of the event log.
|
|
34
39
|
* blockNumber - The block number in which the event was emitted.
|
|
35
40
|
*/
|
|
36
|
-
storePrivateEventLog(eventSelector: EventSelector, randomness: Fr, msgContent: Fr[],
|
|
41
|
+
storePrivateEventLog(eventSelector: EventSelector, randomness: Fr, msgContent: Fr[], siloedEventCommitment: Fr, metadata: PrivateEventMetadata): Promise<void>;
|
|
37
42
|
/**
|
|
38
43
|
* Returns the private events given search parameters.
|
|
39
44
|
* @param eventSelector - The event selector to filter by.
|
|
@@ -42,8 +47,8 @@ export declare class PrivateEventStore {
|
|
|
42
47
|
* fromBlock: The block number to search from (inclusive).
|
|
43
48
|
* toBlock: The block number to search upto (exclusive).
|
|
44
49
|
* scope: - The addresses that decrypted the logs.
|
|
45
|
-
* @returns - The event log contents, augmented with metadata about
|
|
46
|
-
*
|
|
50
|
+
* @returns - The event log contents, augmented with metadata about the transaction and block in which the event was
|
|
51
|
+
* included.
|
|
47
52
|
*/
|
|
48
53
|
getPrivateEvents(eventSelector: EventSelector, filter: PrivateEventStoreFilter): Promise<PackedPrivateEvent[]>;
|
|
49
54
|
/**
|
|
@@ -55,4 +60,4 @@ export declare class PrivateEventStore {
|
|
|
55
60
|
rollback(blockNumber: number, synchedBlockNumber: number): Promise<void>;
|
|
56
61
|
}
|
|
57
62
|
export {};
|
|
58
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
63
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9ldmVudF9zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvcHJpdmF0ZV9ldmVudF9zdG9yZS9wcml2YXRlX2V2ZW50X3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUdwRCxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBaUIsTUFBTSxpQkFBaUIsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFBRSxhQUFhLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUN2RCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUVoRSxPQUFPLEVBQUUsS0FBSyxJQUFJLEVBQUUsTUFBTSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFckQsT0FBTyxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFFdkQsTUFBTSxNQUFNLHVCQUF1QixHQUFHO0lBQ3BDLGVBQWUsRUFBRSxZQUFZLENBQUM7SUFDOUIsU0FBUyxFQUFFLE1BQU0sQ0FBQztJQUNsQixPQUFPLEVBQUUsTUFBTSxDQUFDO0lBQ2hCLE1BQU0sRUFBRSxZQUFZLEVBQUUsQ0FBQztJQUN2QixNQUFNLENBQUMsRUFBRSxNQUFNLENBQUM7Q0FDakIsQ0FBQztBQWdCRixLQUFLLG9CQUFvQixHQUFHLElBQUksR0FBRztJQUNqQyxlQUFlLEVBQUUsWUFBWSxDQUFDO0lBQzlCLEtBQUssRUFBRSxZQUFZLENBQUM7SUFDcEIsMkNBQTJDO0lBQzNDLGNBQWMsRUFBRSxNQUFNLENBQUM7SUFDdkIseUVBQXlFO0lBQ3pFLGNBQWMsRUFBRSxNQUFNLENBQUM7Q0FDeEIsQ0FBQztBQUVGOztHQUVHO0FBQ0gscUJBQWEsaUJBQWlCOztJQVc1QixNQUFNLHlDQUF1QztJQUU3QyxZQUFZLEtBQUssRUFBRSxpQkFBaUIsRUFNbkM7SUFNRDs7Ozs7Ozs7Ozs7T0FXRztJQUNILG9CQUFvQixDQUNsQixhQUFhLEVBQUUsYUFBYSxFQUM1QixVQUFVLEVBQUUsRUFBRSxFQUNkLFVBQVUsRUFBRSxFQUFFLEVBQUUsRUFDaEIscUJBQXFCLEVBQUUsRUFBRSxFQUN6QixRQUFRLEVBQUUsb0JBQW9CLEdBQzdCLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FzQ2Y7SUFFRDs7Ozs7Ozs7OztPQVVHO0lBQ1UsZ0JBQWdCLENBQzNCLGFBQWEsRUFBRSxhQUFhLEVBQzVCLE1BQU0sRUFBRSx1QkFBdUIsR0FDOUIsT0FBTyxDQUFDLGtCQUFrQixFQUFFLENBQUMsQ0F1RC9CO0lBRUQ7Ozs7O09BS0c7SUFDVSxRQUFRLENBQUMsV0FBVyxFQUFFLE1BQU0sRUFBRSxrQkFBa0IsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQW1DcEY7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_event_store.d.ts","sourceRoot":"","sources":["../../../src/storage/private_event_store/private_event_store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,MAAM,uBAAuB,GAAG;IACpC,eAAe,EAAE,YAAY,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;
|
|
1
|
+
{"version":3,"file":"private_event_store.d.ts","sourceRoot":"","sources":["../../../src/storage/private_event_store/private_event_store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,MAAM,uBAAuB,GAAG;IACpC,eAAe,EAAE,YAAY,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAgBF,KAAK,oBAAoB,GAAG,IAAI,GAAG;IACjC,eAAe,EAAE,YAAY,CAAC;IAC9B,KAAK,EAAE,YAAY,CAAC;IACpB,2CAA2C;IAC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