@aztec/pxe 4.0.0-nightly.20260112 → 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/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 +19 -13
- 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.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -2
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +1 -16
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +4 -31
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +15 -13
- 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/logs/log_service.d.ts +3 -2
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +4 -2
- 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/hints/build_private_kernel_reset_private_inputs.d.ts +2 -2
- 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 +2 -2
- 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 +3 -4
- package/dest/private_kernel/private_kernel_oracle.d.ts +24 -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 +12 -59
- package/dest/storage/capsule_store/capsule_store.d.ts +24 -9
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_store.js +132 -23
- package/dest/storage/note_store/note_store.d.ts +6 -5
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +89 -94
- package/dest/storage/private_event_store/private_event_store.d.ts +13 -6
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +70 -56
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +2 -2
- package/package.json +16 -16
- package/src/block_synchronizer/block_synchronizer.ts +23 -12
- 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.ts +0 -2
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +2 -36
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +15 -10
- package/src/events/event_service.ts +12 -26
- package/src/logs/log_service.ts +2 -1
- package/src/notes/note_service.ts +14 -23
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +1 -2
- package/src/private_kernel/private_kernel_execution_prover.ts +2 -4
- package/src/private_kernel/private_kernel_oracle.ts +119 -36
- package/src/pxe.ts +10 -81
- package/src/storage/capsule_store/capsule_store.ts +159 -23
- package/src/storage/note_store/note_store.ts +98 -95
- package/src/storage/private_event_store/private_event_store.ts +92 -65
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +4 -1
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +6 -2
- 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 -86
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -133
|
@@ -1,4 +1,94 @@
|
|
|
1
|
+
import { PUBLIC_DATA_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
3
|
+
import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
4
|
+
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
5
|
+
import { computeContractClassIdPreimage, computeSaltedInitializationHash } from '@aztec/stdlib/contract';
|
|
6
|
+
import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
|
|
7
|
+
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
8
|
+
import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
|
|
9
|
+
// TODO: Block number should not be "latest".
|
|
10
|
+
// It should be fixed at the time the proof is being simulated. I.e., it should be the same as the value defined in the constant data.
|
|
1
11
|
/**
|
|
2
12
|
* Provides functionality needed by the private kernel for interacting with our state trees.
|
|
3
|
-
|
|
4
|
-
|
|
13
|
+
*/ export class PrivateKernelOracle {
|
|
14
|
+
contractStore;
|
|
15
|
+
keyStore;
|
|
16
|
+
node;
|
|
17
|
+
blockNumber;
|
|
18
|
+
constructor(contractStore, keyStore, node, blockNumber = 'latest'){
|
|
19
|
+
this.contractStore = contractStore;
|
|
20
|
+
this.keyStore = keyStore;
|
|
21
|
+
this.node = node;
|
|
22
|
+
this.blockNumber = blockNumber;
|
|
23
|
+
}
|
|
24
|
+
/** Retrieves the preimage of a contract address from the registered contract instances db. */ async getContractAddressPreimage(address) {
|
|
25
|
+
const instance = await this.contractStore.getContractInstance(address);
|
|
26
|
+
if (!instance) {
|
|
27
|
+
throw new Error(`Contract instance not found when getting address preimage. Contract address: ${address}.`);
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
saltedInitializationHash: await computeSaltedInitializationHash(instance),
|
|
31
|
+
...instance
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** Retrieves the preimage of a contract class id from the contract classes db. */ async getContractClassIdPreimage(contractClassId) {
|
|
35
|
+
const contractClass = await this.contractStore.getContractClass(contractClassId);
|
|
36
|
+
if (!contractClass) {
|
|
37
|
+
throw new Error(`Contract class not found when getting class id preimage. Class id: ${contractClassId}.`);
|
|
38
|
+
}
|
|
39
|
+
return computeContractClassIdPreimage(contractClass);
|
|
40
|
+
}
|
|
41
|
+
/** Returns a membership witness with the sibling path and leaf index in our private functions tree. */ async getFunctionMembershipWitness(contractClassId, selector) {
|
|
42
|
+
const membershipWitness = await this.contractStore.getFunctionMembershipWitness(contractClassId, selector);
|
|
43
|
+
if (!membershipWitness) {
|
|
44
|
+
throw new Error(`Membership witness not found for contract class id ${contractClassId} and selector ${selector}.`);
|
|
45
|
+
}
|
|
46
|
+
return membershipWitness;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns a membership witness with the sibling path and leaf index in our protocol VK indexed merkle tree.
|
|
50
|
+
* Used to validate the previous kernel's verification key.
|
|
51
|
+
*/ getVkMembershipWitness(vk) {
|
|
52
|
+
const leafIndex = getVKIndex(vk);
|
|
53
|
+
return Promise.resolve(new MembershipWitness(VK_TREE_HEIGHT, BigInt(leafIndex), getVKSiblingPath(leafIndex)));
|
|
54
|
+
}
|
|
55
|
+
/** Returns a membership witness with the sibling path and leaf index in our note hash tree. */ getNoteHashMembershipWitness(noteHash) {
|
|
56
|
+
return this.node.getNoteHashMembershipWitness(this.blockNumber, noteHash);
|
|
57
|
+
}
|
|
58
|
+
/** Returns a membership witness with the sibling path and leaf index in our nullifier indexed merkle tree. */ getNullifierMembershipWitness(nullifier) {
|
|
59
|
+
return this.node.getNullifierMembershipWitness(this.blockNumber, nullifier);
|
|
60
|
+
}
|
|
61
|
+
/** Returns the root of our note hash merkle tree. */ async getNoteHashTreeRoot() {
|
|
62
|
+
const header = await this.node.getBlockHeader(this.blockNumber);
|
|
63
|
+
if (!header) {
|
|
64
|
+
throw new Error(`No block header found for block number ${this.blockNumber}`);
|
|
65
|
+
}
|
|
66
|
+
return header.state.partial.noteHashTree.root;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Retrieves the sk_m corresponding to the pk_m.
|
|
70
|
+
* @throws If the provided public key is not associated with any of the registered accounts.
|
|
71
|
+
* @param masterPublicKey - The master public key to get secret key for.
|
|
72
|
+
* @returns A Promise that resolves to sk_m.
|
|
73
|
+
* @dev Used when feeding the sk_m to the kernel circuit for keys verification.
|
|
74
|
+
*/ getMasterSecretKey(masterPublicKey) {
|
|
75
|
+
return this.keyStore.getMasterSecretKey(masterPublicKey);
|
|
76
|
+
}
|
|
77
|
+
/** Use debug data to get the function name corresponding to a selector. */ getDebugFunctionName(contractAddress, selector) {
|
|
78
|
+
return this.contractStore.getDebugFunctionName(contractAddress, selector);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Returns a membership witness and leaf index to our public data indexed merkle tree,
|
|
82
|
+
* along with an associated DelayedPublicMutable containing the class ID to update.
|
|
83
|
+
*/ async getUpdatedClassIdHints(contractAddress) {
|
|
84
|
+
const { delayedPublicMutableSlot, delayedPublicMutableHashSlot } = await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(contractAddress);
|
|
85
|
+
const hashLeafSlot = await computePublicDataTreeLeafSlot(ProtocolContractAddress.ContractInstanceRegistry, delayedPublicMutableHashSlot);
|
|
86
|
+
const updatedClassIdWitness = await this.node.getPublicDataWitness(this.blockNumber, hashLeafSlot);
|
|
87
|
+
if (!updatedClassIdWitness) {
|
|
88
|
+
throw new Error(`No public data tree witness found for ${hashLeafSlot}`);
|
|
89
|
+
}
|
|
90
|
+
const readStorage = (storageSlot)=>this.node.getPublicStorageAt(this.blockNumber, ProtocolContractAddress.ContractInstanceRegistry, storageSlot);
|
|
91
|
+
const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(delayedPublicMutableSlot, readStorage);
|
|
92
|
+
return new UpdatedClassIdHints(new MembershipWitness(PUBLIC_DATA_TREE_HEIGHT, updatedClassIdWitness.index, updatedClassIdWitness.siblingPath.toTuple()), updatedClassIdWitness.leafPreimage, delayedPublicMutableValues);
|
|
93
|
+
}
|
|
94
|
+
}
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHhlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcHhlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDakUsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUlsRSxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRXpELE9BQU8sRUFBRSxLQUFLLHlCQUF5QixFQUF5QixNQUFNLDJCQUEyQixDQUFDO0FBQ2xHLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFF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AAE,MAAM,GAAG,iBAAiB,GAAG,OAAO,EACjD,mBAAmB,GAAE,OAAc,GAClC,OAAO,CAAC,eAAe,CAAC,CAuE1B;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,UAAU,CACf,SAAS,EAAE,kBAAkB,EAC7B,cAAc,EAAE,OAAO,EACvB,gBAAgB,GAAE,OAAe,EACjC,kBAAkB,GAAE,OAAe,EACnC,SAAS,CAAC,EAAE,mBAAmB,EAC/B,MAAM,CAAC,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,kBAAkB,CAAC,CA8H7B;IAED;;;;;;;;OAQG;IACI,eAAe,CACpB,IAAI,EAAE,YAAY,EAClB,QAAQ,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';
|
|
@@ -97,8 +97,11 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
97
97
|
const capsuleStore = new CapsuleStore(store);
|
|
98
98
|
const keyStore = new KeyStore(store);
|
|
99
99
|
const tipsStore = new L2TipsKVStore(store, 'pxe');
|
|
100
|
-
const synchronizer = new BlockSynchronizer(node, anchorBlockStore, noteStore, privateEventStore, tipsStore, config, loggerOrSuffix);
|
|
100
|
+
const synchronizer = new BlockSynchronizer(node, store, anchorBlockStore, noteStore, privateEventStore, tipsStore, config, loggerOrSuffix);
|
|
101
101
|
const jobCoordinator = new JobCoordinator(store);
|
|
102
|
+
jobCoordinator.registerStores([
|
|
103
|
+
capsuleStore
|
|
104
|
+
]);
|
|
102
105
|
const debugUtils = new PXEDebugUtils(contractStore, noteStore);
|
|
103
106
|
const jobQueue = new SerialQueue();
|
|
104
107
|
const pxe = new PXE(node, synchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore, senderAddressBookStore, recipientTaggingStore, addressStore, privateEventStore, simulator, proverEnabled, proofCreator, protocolContractsProvider, log, jobQueue, jobCoordinator, debugUtils);
|
|
@@ -162,16 +165,6 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
162
165
|
}
|
|
163
166
|
this.log.verbose(`Registered protocol contracts in pxe`, registered);
|
|
164
167
|
}
|
|
165
|
-
async #isContractClassPubliclyRegistered(id) {
|
|
166
|
-
return !!await this.node.getContractClass(id);
|
|
167
|
-
}
|
|
168
|
-
async #isContractPublished(address) {
|
|
169
|
-
return !!await this.node.getContract(address);
|
|
170
|
-
}
|
|
171
|
-
async #isContractInitialized(address) {
|
|
172
|
-
const initNullifier = await siloNullifier(address, address.toField());
|
|
173
|
-
return !!await this.node.getNullifierMembershipWitness('latest', initNullifier);
|
|
174
|
-
}
|
|
175
168
|
// Executes the entrypoint private function, as well as all nested private
|
|
176
169
|
// functions that might arise.
|
|
177
170
|
async #executePrivate(contractFunctionSimulator, txRequest, scopes, jobId) {
|
|
@@ -247,7 +240,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
247
240
|
* @returns An object that contains the output of the kernel execution, including the ChonkProof if proving is enabled.
|
|
248
241
|
*/ async #prove(txExecutionRequest, proofCreator, privateExecutionResult, config) {
|
|
249
242
|
const simulationAnchorBlock = privateExecutionResult.getSimulationAnchorBlockNumber();
|
|
250
|
-
const kernelOracle = new
|
|
243
|
+
const kernelOracle = new PrivateKernelOracle(this.contractStore, this.keyStore, this.node, simulationAnchorBlock);
|
|
251
244
|
const kernelTraceProver = new PrivateKernelExecutionProver(kernelOracle, proofCreator, !this.proverEnabled);
|
|
252
245
|
this.log.debug(`Executing kernel trace prover (${JSON.stringify(config)})...`);
|
|
253
246
|
return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
|
|
@@ -257,51 +250,11 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
257
250
|
return this.contractStore.getContractInstance(address);
|
|
258
251
|
}
|
|
259
252
|
/**
|
|
260
|
-
* Returns the contract
|
|
261
|
-
*
|
|
262
|
-
* @
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
* @returns - It returns the contract class metadata, with the artifact field being optional, and will only be returned if true is passed in
|
|
266
|
-
* for `includeArtifact`
|
|
267
|
-
* TODO(@spalladino): The PXE actually holds artifacts and not classes, what should we return? Also,
|
|
268
|
-
* should the pxe query the node for contract public info, and merge it with its own definitions?
|
|
269
|
-
* TODO(@spalladino): This method is strictly needed to decide whether to publicly register a class or not
|
|
270
|
-
* during a public deployment. We probably want a nicer and more general API for this, but it'll have to
|
|
271
|
-
* do for the time being.
|
|
272
|
-
*/ async getContractClassMetadata(id, includeArtifact = false) {
|
|
273
|
-
const artifact = await this.contractStore.getContractArtifact(id);
|
|
274
|
-
if (!artifact) {
|
|
275
|
-
this.log.warn(`No artifact found for contract class ${id.toString()} when looking for its metadata`);
|
|
276
|
-
}
|
|
277
|
-
return {
|
|
278
|
-
contractClass: artifact && await getContractClassFromArtifact(artifact),
|
|
279
|
-
isContractClassPubliclyRegistered: await this.#isContractClassPubliclyRegistered(id),
|
|
280
|
-
artifact: includeArtifact ? artifact : undefined
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Returns the contract metadata given an address.
|
|
285
|
-
* The metadata consists of its contract instance, which includes the contract class identifier,
|
|
286
|
-
* initialization hash, deployment salt, and public keys hash; whether the contract instance has been initialized;
|
|
287
|
-
* and whether the contract instance with the given address has been publicly deployed.
|
|
288
|
-
* @remark - it queries the node to check whether the contract instance has been initialized / publicly deployed through a node.
|
|
289
|
-
* This query is not dependent on the PXE.
|
|
290
|
-
* @param address - The address that the contract instance resides at.
|
|
291
|
-
* @returns - It returns the contract metadata
|
|
292
|
-
* TODO(@spalladino): Should we return the public keys in plain as well here?
|
|
293
|
-
*/ async getContractMetadata(address) {
|
|
294
|
-
let instance;
|
|
295
|
-
try {
|
|
296
|
-
instance = await this.contractStore.getContractInstance(address);
|
|
297
|
-
} catch {
|
|
298
|
-
this.log.warn(`No instance found for contract ${address.toString()} when looking for its metadata`);
|
|
299
|
-
}
|
|
300
|
-
return {
|
|
301
|
-
contractInstance: instance,
|
|
302
|
-
isContractInitialized: await this.#isContractInitialized(address),
|
|
303
|
-
isContractPublished: await this.#isContractPublished(address)
|
|
304
|
-
};
|
|
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);
|
|
305
258
|
}
|
|
306
259
|
/**
|
|
307
260
|
* Registers a user account in PXE given its master encryption private key.
|
|
@@ -2,34 +2,49 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
2
2
|
import { type Logger } from '@aztec/foundation/log';
|
|
3
3
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
|
|
5
|
+
import type { StagedStore } from '../../job_coordinator/job_coordinator.js';
|
|
6
|
+
export declare class CapsuleStore implements StagedStore {
|
|
6
7
|
#private;
|
|
8
|
+
readonly storeName: string;
|
|
7
9
|
logger: Logger;
|
|
8
10
|
constructor(store: AztecAsyncKVStore);
|
|
11
|
+
/**
|
|
12
|
+
* Commits staged data to main storage.
|
|
13
|
+
* Called by JobCoordinator when a job completes successfully.
|
|
14
|
+
* Note: JobCoordinator wraps all commits in a single transaction, so we don't
|
|
15
|
+
* need our own transactionAsync here (and using one would deadlock on IndexedDB).
|
|
16
|
+
* @param jobId - The jobId identifying which staged data to commit
|
|
17
|
+
*/
|
|
18
|
+
commit(jobId: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Discards staged data without committing.
|
|
21
|
+
*/
|
|
22
|
+
discardStaged(jobId: string): Promise<void>;
|
|
9
23
|
/**
|
|
10
24
|
* Stores arbitrary information in a per-contract non-volatile database, which can later be retrieved with `loadCapsule`.
|
|
11
25
|
* * If data was already stored at this slot, it is overwritten.
|
|
12
26
|
* @param contractAddress - The contract address to scope the data under.
|
|
13
27
|
* @param slot - The slot in the database in which to store the value. Slots need not be contiguous.
|
|
14
28
|
* @param capsule - An array of field elements representing the capsule.
|
|
29
|
+
* @param jobId - The context in which this store will be visible until PXE decides to persist it to underlying KV store
|
|
15
30
|
* @remarks A capsule is a "blob" of data that is passed to the contract through an oracle. It works similarly
|
|
16
31
|
* to public contract storage in that it's indexed by the contract address and storage slot but instead of the global
|
|
17
32
|
* network state it's backed by local PXE db.
|
|
18
33
|
*/
|
|
19
|
-
storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]):
|
|
34
|
+
storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[], jobId: string): void;
|
|
20
35
|
/**
|
|
21
36
|
* Returns data previously stored via `storeCapsule` in the per-contract non-volatile database.
|
|
22
37
|
* @param contractAddress - The contract address under which the data is scoped.
|
|
23
38
|
* @param slot - The slot in the database to read.
|
|
24
39
|
* @returns The stored data or `null` if no data is stored under the slot.
|
|
25
40
|
*/
|
|
26
|
-
loadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null>;
|
|
41
|
+
loadCapsule(contractAddress: AztecAddress, slot: Fr, jobId: string): Promise<Fr[] | null>;
|
|
27
42
|
/**
|
|
28
43
|
* Deletes data in the per-contract non-volatile database. Does nothing if no data was present.
|
|
29
44
|
* @param contractAddress - The contract address under which the data is scoped.
|
|
30
45
|
* @param slot - The slot in the database to delete.
|
|
31
46
|
*/
|
|
32
|
-
deleteCapsule(contractAddress: AztecAddress, slot: Fr):
|
|
47
|
+
deleteCapsule(contractAddress: AztecAddress, slot: Fr, jobId: string): void;
|
|
33
48
|
/**
|
|
34
49
|
* Copies a number of contiguous entries in the per-contract non-volatile database. This allows for efficient data
|
|
35
50
|
* structures by avoiding repeated calls to `loadCapsule` and `storeCapsule`.
|
|
@@ -41,7 +56,7 @@ export declare class CapsuleStore {
|
|
|
41
56
|
* @param dstSlot - The first slot to copy to.
|
|
42
57
|
* @param numEntries - The number of entries to copy.
|
|
43
58
|
*/
|
|
44
|
-
copyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number): Promise<void>;
|
|
59
|
+
copyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number, jobId: string): Promise<void>;
|
|
45
60
|
/**
|
|
46
61
|
* Appends multiple capsules to a capsule array stored at the base slot.
|
|
47
62
|
* The array length is stored at the base slot, and elements are stored in consecutive slots after it.
|
|
@@ -50,8 +65,8 @@ export declare class CapsuleStore {
|
|
|
50
65
|
* @param baseSlot - The slot where the array length is stored
|
|
51
66
|
* @param content - Array of capsule data to append
|
|
52
67
|
*/
|
|
53
|
-
appendToCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][]): Promise<void>;
|
|
54
|
-
readCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr): Promise<Fr[][]>;
|
|
55
|
-
setCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][]): Promise<void>;
|
|
68
|
+
appendToCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][], jobId: string): Promise<void>;
|
|
69
|
+
readCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, jobId: string): Promise<Fr[][]>;
|
|
70
|
+
setCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][], jobId: string): Promise<void>;
|
|
56
71
|
}
|
|
57
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
72
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2Fwc3VsZV9zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvY2Fwc3VsZV9zdG9yZS9jYXBzdWxlX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQW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RztJQUNILFdBQVcsQ0FDVCxlQUFlLEVBQUUsWUFBWSxFQUM3QixPQUFPLEVBQUUsRUFBRSxFQUNYLE9BQU8sRUFBRSxFQUFFLEVBQ1gsVUFBVSxFQUFFLE1BQU0sRUFDbEIsS0FBSyxFQUFFLE1BQU0sR0FDWixPQUFPLENBQUMsSUFBSSxDQUFDLENBMkJmO0lBRUQ7Ozs7Ozs7T0FPRztJQUNILG9CQUFvQixDQUFDLGVBQWUsRUFBRSxZQUFZLEVBQUUsUUFBUSxFQUFFLEVBQUUsRUFBRSxPQUFPLEVBQUUsRUFBRSxFQUFFLEVBQUUsRUFBRSxLQUFLLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FxQi9HO0lBRUQsZ0JBQWdCLENBQUMsZUFBZSxFQUFFLFlBQVksRUFBRSxRQUFRLEVBQUUsRUFBRSxFQUFFLEtBQUssRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLEVBQUUsRUFBRSxFQUFFLENBQUMsQ0EyQjVGO0lBRUQsZUFBZSxDQUFDLGVBQWUsRUFBRSxZQUFZLEVBQUUsUUFBUSxFQUFFLEVBQUUsRUFBRSxPQUFPLEVBQUUsRUFBRSxFQUFFLEVBQUUsRUFBRSxLQUFLLEVBQUUsTUFBTSxpQkEyQjFGO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capsule_store.d.ts","sourceRoot":"","sources":["../../../src/storage/capsule_store/capsule_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,qBAAa,
|
|
1
|
+
{"version":3,"file":"capsule_store.d.ts","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