@aztec/pxe 0.0.1-commit.6d63667d → 0.0.1-commit.7ac86ea28
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/access_scopes.d.ts +9 -0
- package/dest/access_scopes.d.ts.map +1 -0
- package/dest/access_scopes.js +6 -0
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +53 -29
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +171 -67
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- 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 +35 -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 +63 -18
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +31 -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 -35
- package/dest/contract_logging.d.ts +22 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +23 -0
- package/dest/contract_sync/contract_sync_service.d.ts +4 -2
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +34 -19
- package/dest/contract_sync/helpers.d.ts +3 -2
- package/dest/contract_sync/helpers.d.ts.map +1 -1
- package/dest/contract_sync/helpers.js +3 -3
- package/dest/debug/pxe_debug_utils.d.ts +6 -7
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +4 -7
- package/dest/entrypoints/client/bundle/index.d.ts +4 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +3 -0
- 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/index.d.ts +4 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +3 -0
- 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/index.d.ts +3 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +2 -0
- package/dest/entrypoints/server/utils.js +9 -1
- 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 +5 -10
- package/dest/notes/note_service.d.ts +4 -3
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +3 -2
- package/dest/notes_filter.d.ts +25 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/hints/index.js +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +4 -4
- package/dest/private_kernel/private_kernel_execution_prover.js +6 -6
- package/dest/private_kernel/private_kernel_oracle.d.ts +6 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +7 -3
- package/dest/pxe.d.ts +68 -23
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +74 -53
- package/dest/storage/contract_store/contract_store.d.ts +42 -15
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +145 -69
- package/dest/storage/note_store/note_store.d.ts +3 -3
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +6 -4
- package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +17 -3
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +4 -4
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
- package/package.json +16 -16
- package/src/access_scopes.ts +9 -0
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +320 -127
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- 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 +83 -93
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +98 -33
- package/src/contract_logging.ts +39 -0
- package/src/contract_sync/contract_sync_service.ts +49 -26
- package/src/contract_sync/helpers.ts +7 -2
- package/src/debug/pxe_debug_utils.ts +12 -15
- package/src/entrypoints/client/bundle/index.ts +3 -0
- package/src/entrypoints/client/bundle/utils.ts +9 -1
- package/src/entrypoints/client/lazy/index.ts +3 -0
- package/src/entrypoints/client/lazy/utils.ts +9 -1
- package/src/entrypoints/server/index.ts +2 -0
- package/src/entrypoints/server/utils.ts +7 -7
- package/src/logs/log_service.ts +7 -19
- package/src/notes/note_service.ts +4 -3
- package/src/notes_filter.ts +26 -0
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +1 -1
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +7 -7
- package/src/private_kernel/private_kernel_execution_prover.ts +6 -6
- package/src/private_kernel/private_kernel_oracle.ts +7 -7
- package/src/pxe.ts +145 -98
- package/src/storage/contract_store/contract_store.ts +174 -75
- package/src/storage/note_store/note_store.ts +12 -5
- package/src/tagging/get_all_logs_by_tags.ts +28 -4
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +4 -4
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
package/dest/pxe.d.ts
CHANGED
|
@@ -9,13 +9,60 @@ import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
|
9
9
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
10
|
import { CompleteAddress, type ContractInstanceWithAddress, type PartialAddress } from '@aztec/stdlib/contract';
|
|
11
11
|
import type { AztecNode, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
12
|
-
import { type InTx, SimulationOverrides, TxExecutionRequest, TxProfileResult, TxProvingResult, TxSimulationResult,
|
|
12
|
+
import { BlockHeader, type InTx, SimulationOverrides, TxExecutionRequest, TxProfileResult, TxProvingResult, TxSimulationResult, UtilityExecutionResult } from '@aztec/stdlib/tx';
|
|
13
|
+
import type { AccessScopes } from './access_scopes.js';
|
|
13
14
|
import type { PXEConfig } from './config/index.js';
|
|
14
15
|
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
15
16
|
export type PackedPrivateEvent = InTx & {
|
|
16
17
|
packedEvent: Fr[];
|
|
17
18
|
eventSelector: EventSelector;
|
|
18
19
|
};
|
|
20
|
+
/** Options for PXE.profileTx. */
|
|
21
|
+
export type ProfileTxOpts = {
|
|
22
|
+
/** The profiling mode to use. */
|
|
23
|
+
profileMode: 'full' | 'execution-steps' | 'gates';
|
|
24
|
+
/** If true, proof generation is skipped during profiling. Defaults to true. */
|
|
25
|
+
skipProofGeneration?: boolean;
|
|
26
|
+
/** Addresses whose private state and keys are accessible during private execution. */
|
|
27
|
+
scopes: AccessScopes;
|
|
28
|
+
};
|
|
29
|
+
/** Options for PXE.simulateTx. */
|
|
30
|
+
export type SimulateTxOpts = {
|
|
31
|
+
/** Whether to simulate the public part of the transaction. */
|
|
32
|
+
simulatePublic: boolean;
|
|
33
|
+
/** If false, this function throws if the transaction is unable to be included in a block at the current state. */
|
|
34
|
+
skipTxValidation?: boolean;
|
|
35
|
+
/** If false, fees are enforced. */
|
|
36
|
+
skipFeeEnforcement?: boolean;
|
|
37
|
+
/** State overrides for the simulation, such as contract instances and artifacts. */
|
|
38
|
+
overrides?: SimulationOverrides;
|
|
39
|
+
/** Addresses whose private state and keys are accessible during private execution */
|
|
40
|
+
scopes: AccessScopes;
|
|
41
|
+
};
|
|
42
|
+
/** Options for PXE.executeUtility. */
|
|
43
|
+
export type ExecuteUtilityOpts = {
|
|
44
|
+
/** The authentication witnesses required for the function call. */
|
|
45
|
+
authwits?: AuthWitness[];
|
|
46
|
+
/** The accounts whose notes we can access in this call */
|
|
47
|
+
scopes: AccessScopes;
|
|
48
|
+
};
|
|
49
|
+
/** Args for PXE.create. */
|
|
50
|
+
export type PXECreateArgs = {
|
|
51
|
+
/** The Aztec node to connect to. */
|
|
52
|
+
node: AztecNode;
|
|
53
|
+
/** The key-value store for persisting PXE state. */
|
|
54
|
+
store: AztecAsyncKVStore;
|
|
55
|
+
/** The prover for generating private kernel proofs. */
|
|
56
|
+
proofCreator: PrivateKernelProver;
|
|
57
|
+
/** The circuit simulator for executing ACIR circuits. */
|
|
58
|
+
simulator: CircuitSimulator;
|
|
59
|
+
/** Provider for protocol contract artifacts and instances. */
|
|
60
|
+
protocolContractsProvider: ProtocolContractsProvider;
|
|
61
|
+
/** PXE configuration options. */
|
|
62
|
+
config: PXEConfig;
|
|
63
|
+
/** Optional logger instance or string suffix for the logger name. */
|
|
64
|
+
loggerOrSuffix?: string | Logger;
|
|
65
|
+
};
|
|
19
66
|
/**
|
|
20
67
|
* Private eXecution Environment (PXE) is a library used by wallets to simulate private phase of transactions and to
|
|
21
68
|
* manage private state of users.
|
|
@@ -51,7 +98,17 @@ export declare class PXE {
|
|
|
51
98
|
*
|
|
52
99
|
* @returns A promise that resolves PXE is ready to be used.
|
|
53
100
|
*/
|
|
54
|
-
static create(node
|
|
101
|
+
static create({ node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix }: PXECreateArgs): Promise<PXE>;
|
|
102
|
+
/**
|
|
103
|
+
* Returns the block header up to which the PXE has synced.
|
|
104
|
+
* @returns The synced block header
|
|
105
|
+
*/
|
|
106
|
+
getSyncedBlockHeader(): Promise<BlockHeader>;
|
|
107
|
+
/**
|
|
108
|
+
* Returns the contract instance for a given address, if it's registered in the PXE.
|
|
109
|
+
* @param address - The contract address.
|
|
110
|
+
* @returns The contract instance if found, undefined otherwise.
|
|
111
|
+
*/
|
|
55
112
|
getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
56
113
|
/**
|
|
57
114
|
* Returns the contract artifact for a given contract class id, if it's registered in the PXE.
|
|
@@ -134,21 +191,19 @@ export declare class PXE {
|
|
|
134
191
|
* (where validators prove the public portion).
|
|
135
192
|
*
|
|
136
193
|
* @param txRequest - An authenticated tx request ready for proving
|
|
194
|
+
* @param scopes - Addresses whose private state and keys are accessible during private execution.
|
|
137
195
|
* @returns A result containing the proof and public inputs of the tail circuit.
|
|
138
196
|
* @throws If contract code not found, or public simulation reverts.
|
|
139
197
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
140
198
|
*/
|
|
141
|
-
proveTx(txRequest: TxExecutionRequest): Promise<TxProvingResult>;
|
|
199
|
+
proveTx(txRequest: TxExecutionRequest, scopes: AztecAddress[]): Promise<TxProvingResult>;
|
|
142
200
|
/**
|
|
143
201
|
* Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
|
|
144
|
-
*
|
|
145
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
146
|
-
* @param msgSender - (Optional) The message sender to use for the simulation.
|
|
147
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
202
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
148
203
|
* @returns A trace of the program execution with gate counts.
|
|
149
204
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
150
205
|
*/
|
|
151
|
-
profileTx(txRequest: TxExecutionRequest, profileMode
|
|
206
|
+
profileTx(txRequest: TxExecutionRequest, { profileMode, skipProofGeneration, scopes }: ProfileTxOpts): Promise<TxProfileResult>;
|
|
152
207
|
/**
|
|
153
208
|
* Simulates a transaction based on the provided preauthenticated execution request.
|
|
154
209
|
* This will run a local simulation of private execution (and optionally of public as well), run the
|
|
@@ -160,29 +215,19 @@ export declare class PXE {
|
|
|
160
215
|
* In that case, the transaction returned is only potentially ready to be sent to the network for execution.
|
|
161
216
|
*
|
|
162
217
|
*
|
|
163
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
164
|
-
* @param simulatePublic - Whether to simulate the public part of the transaction.
|
|
165
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
166
|
-
* @param skipFeeEnforcement - (Optional) If false, fees are enforced.
|
|
167
|
-
* @param overrides - (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts.
|
|
168
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
218
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
169
219
|
* @returns A simulated transaction result object that includes public and private return values.
|
|
170
220
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
171
221
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
172
222
|
*
|
|
173
223
|
* TODO(#7456) Prevent msgSender being defined here for the first call
|
|
174
224
|
*/
|
|
175
|
-
simulateTx(txRequest: TxExecutionRequest, simulatePublic
|
|
225
|
+
simulateTx(txRequest: TxExecutionRequest, { simulatePublic, skipTxValidation, skipFeeEnforcement, overrides, scopes }: SimulateTxOpts): Promise<TxSimulationResult>;
|
|
176
226
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
227
|
+
* Executes a contract utility function.
|
|
179
228
|
* @param call - The function call containing the function details, arguments, and target contract address.
|
|
180
|
-
* @param authwits - (Optional) The authentication witnesses required for the function call.
|
|
181
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will
|
|
182
|
-
* default to all.
|
|
183
|
-
* @returns The result of the utility function call, structured based on the function ABI.
|
|
184
229
|
*/
|
|
185
|
-
|
|
230
|
+
executeUtility(call: FunctionCall, { authwits, scopes }?: ExecuteUtilityOpts): Promise<UtilityExecutionResult>;
|
|
186
231
|
/**
|
|
187
232
|
* Returns the private events given search parameters.
|
|
188
233
|
* @param eventSelector - Event selector to search for.
|
|
@@ -202,4 +247,4 @@ export declare class PXE {
|
|
|
202
247
|
*/
|
|
203
248
|
stop(): Promise<void>;
|
|
204
249
|
}
|
|
205
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
250
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHhlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcHhlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FB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;;;;;;;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
|
@@ -13,6 +13,7 @@ import { BlockSynchronizer } from './block_synchronizer/index.js';
|
|
|
13
13
|
import { BenchmarkedNodeFactory } from './contract_function_simulator/benchmarked_node.js';
|
|
14
14
|
import { ContractFunctionSimulator, generateSimulatedProvingResult } from './contract_function_simulator/contract_function_simulator.js';
|
|
15
15
|
import { ProxiedContractStoreFactory } from './contract_function_simulator/proxied_contract_data_source.js';
|
|
16
|
+
import { displayDebugLogs } from './contract_logging.js';
|
|
16
17
|
import { ContractSyncService } from './contract_sync/contract_sync_service.js';
|
|
17
18
|
import { readCurrentClassId } from './contract_sync/helpers.js';
|
|
18
19
|
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
@@ -84,11 +85,12 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
84
85
|
* can be contacted.
|
|
85
86
|
*
|
|
86
87
|
* @returns A promise that resolves PXE is ready to be used.
|
|
87
|
-
*/ static async create(node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix) {
|
|
88
|
+
*/ static async create({ node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix }) {
|
|
88
89
|
// Extract bindings from the logger, or use empty bindings if a string suffix is provided.
|
|
89
90
|
const bindings = loggerOrSuffix && typeof loggerOrSuffix !== 'string' ? loggerOrSuffix.getBindings() : undefined;
|
|
90
91
|
const log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:service:${loggerOrSuffix}` : `pxe:service`) : loggerOrSuffix;
|
|
91
|
-
const
|
|
92
|
+
const info = await node.getNodeInfo();
|
|
93
|
+
const proverEnabled = config.proverEnabled !== undefined ? config.proverEnabled : info.realProofs;
|
|
92
94
|
const addressStore = new AddressStore(store);
|
|
93
95
|
const privateEventStore = new PrivateEventStore(store);
|
|
94
96
|
const contractStore = new ContractStore(store);
|
|
@@ -114,17 +116,29 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
114
116
|
const debugUtils = new PXEDebugUtils(contractSyncService, noteStore, synchronizer, anchorBlockStore);
|
|
115
117
|
const jobQueue = new SerialQueue();
|
|
116
118
|
const pxe = new PXE(node, synchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore, senderAddressBookStore, recipientTaggingStore, addressStore, privateEventStore, contractSyncService, simulator, proverEnabled, proofCreator, protocolContractsProvider, log, jobQueue, jobCoordinator, debugUtils);
|
|
117
|
-
debugUtils.setPXEHelpers(pxe.#putInJobQueue.bind(pxe), pxe.#getSimulatorForTx.bind(pxe), pxe.#
|
|
119
|
+
debugUtils.setPXEHelpers(pxe.#putInJobQueue.bind(pxe), pxe.#getSimulatorForTx.bind(pxe), pxe.#executeUtility.bind(pxe));
|
|
118
120
|
pxe.jobQueue.start();
|
|
119
121
|
await pxe.#registerProtocolContracts();
|
|
120
|
-
const info = await node.getNodeInfo();
|
|
121
122
|
log.info(`Started PXE connected to chain ${info.l1ChainId} version ${info.rollupVersion}`);
|
|
122
123
|
return pxe;
|
|
123
124
|
}
|
|
124
125
|
// Internal methods
|
|
125
126
|
#getSimulatorForTx(overrides) {
|
|
126
127
|
const proxyContractStore = ProxiedContractStoreFactory.create(this.contractStore, overrides?.contracts);
|
|
127
|
-
return new ContractFunctionSimulator(
|
|
128
|
+
return new ContractFunctionSimulator({
|
|
129
|
+
contractStore: proxyContractStore,
|
|
130
|
+
noteStore: this.noteStore,
|
|
131
|
+
keyStore: this.keyStore,
|
|
132
|
+
addressStore: this.addressStore,
|
|
133
|
+
aztecNode: BenchmarkedNodeFactory.create(this.node),
|
|
134
|
+
senderTaggingStore: this.senderTaggingStore,
|
|
135
|
+
recipientTaggingStore: this.recipientTaggingStore,
|
|
136
|
+
senderAddressBookStore: this.senderAddressBookStore,
|
|
137
|
+
capsuleStore: this.capsuleStore,
|
|
138
|
+
privateEventStore: this.privateEventStore,
|
|
139
|
+
simulator: this.simulator,
|
|
140
|
+
contractSyncService: this.contractSyncService
|
|
141
|
+
});
|
|
128
142
|
}
|
|
129
143
|
#contextualizeError(err, ...context) {
|
|
130
144
|
let contextStr = '';
|
|
@@ -167,8 +181,8 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
167
181
|
async #registerProtocolContracts() {
|
|
168
182
|
const registered = {};
|
|
169
183
|
for (const name of protocolContractNames){
|
|
170
|
-
const { address,
|
|
171
|
-
await this.contractStore.addContractArtifact(
|
|
184
|
+
const { address, instance, artifact } = await this.protocolContractsProvider.getProtocolContractArtifact(name);
|
|
185
|
+
await this.contractStore.addContractArtifact(artifact);
|
|
172
186
|
await this.contractStore.addContractInstance(instance);
|
|
173
187
|
registered[name] = address.toString();
|
|
174
188
|
}
|
|
@@ -180,10 +194,14 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
180
194
|
const { origin: contractAddress, functionSelector } = txRequest;
|
|
181
195
|
try {
|
|
182
196
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
183
|
-
await this.contractSyncService.ensureContractSynced(contractAddress, functionSelector, (privateSyncCall)=>this.#
|
|
184
|
-
const result = await contractFunctionSimulator.run(txRequest,
|
|
185
|
-
|
|
186
|
-
|
|
197
|
+
await this.contractSyncService.ensureContractSynced(contractAddress, functionSelector, (privateSyncCall, execScopes)=>this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, scopes);
|
|
198
|
+
const result = await contractFunctionSimulator.run(txRequest, {
|
|
199
|
+
contractAddress,
|
|
200
|
+
selector: functionSelector,
|
|
201
|
+
anchorBlockHeader,
|
|
202
|
+
scopes,
|
|
203
|
+
jobId
|
|
204
|
+
});
|
|
187
205
|
this.log.debug(`Private simulation completed for ${contractAddress.toString()}:${functionSelector}`);
|
|
188
206
|
return result;
|
|
189
207
|
} catch (err) {
|
|
@@ -194,15 +212,15 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
194
212
|
}
|
|
195
213
|
}
|
|
196
214
|
/**
|
|
197
|
-
*
|
|
215
|
+
* Execute a utility function call on the given contract.
|
|
198
216
|
* @param contractFunctionSimulator - The simulator to use for the function call.
|
|
199
217
|
* @param call - The function call to execute.
|
|
200
218
|
* @param authWitnesses - Authentication witnesses required for the function call.
|
|
201
219
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
202
220
|
* accounts if not specified.
|
|
203
221
|
* @param jobId - The job ID for staged writes.
|
|
204
|
-
* @returns The
|
|
205
|
-
*/ async #
|
|
222
|
+
* @returns The execution result containing the outputs of the utility function.
|
|
223
|
+
*/ async #executeUtility(contractFunctionSimulator, call, authWitnesses, scopes, jobId) {
|
|
206
224
|
try {
|
|
207
225
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
208
226
|
return contractFunctionSimulator.runUtility(call, authWitnesses ?? [], anchorBlockHeader, scopes, jobId);
|
|
@@ -257,7 +275,17 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
257
275
|
return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
|
|
258
276
|
}
|
|
259
277
|
// Public API
|
|
260
|
-
|
|
278
|
+
/**
|
|
279
|
+
* Returns the block header up to which the PXE has synced.
|
|
280
|
+
* @returns The synced block header
|
|
281
|
+
*/ getSyncedBlockHeader() {
|
|
282
|
+
return this.anchorBlockStore.getBlockHeader();
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Returns the contract instance for a given address, if it's registered in the PXE.
|
|
286
|
+
* @param address - The contract address.
|
|
287
|
+
* @returns The contract instance if found, undefined otherwise.
|
|
288
|
+
*/ getContractInstance(address) {
|
|
261
289
|
return this.contractStore.getContractInstance(address);
|
|
262
290
|
}
|
|
263
291
|
/**
|
|
@@ -344,8 +372,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
344
372
|
*
|
|
345
373
|
* @param artifact - The build artifact for the contract class.
|
|
346
374
|
*/ async registerContractClass(artifact) {
|
|
347
|
-
const
|
|
348
|
-
await this.contractStore.addContractArtifact(contractClassId, artifact);
|
|
375
|
+
const contractClassId = await this.contractStore.addContractArtifact(artifact);
|
|
349
376
|
this.log.info(`Added contract class ${artifact.name} with id ${contractClassId}`);
|
|
350
377
|
}
|
|
351
378
|
/**
|
|
@@ -361,15 +388,14 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
361
388
|
if (artifact) {
|
|
362
389
|
// If the user provides an artifact, validate it against the expected class id and register it
|
|
363
390
|
const contractClass = await getContractClassFromArtifact(artifact);
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
throw new Error(`Artifact does not match expected class id (computed ${contractClassId} but instance refers to ${instance.currentContractClassId})`);
|
|
391
|
+
if (!contractClass.id.equals(instance.currentContractClassId)) {
|
|
392
|
+
throw new Error(`Artifact does not match expected class id (computed ${contractClass.id} but instance refers to ${instance.currentContractClassId})`);
|
|
367
393
|
}
|
|
368
394
|
const computedAddress = await computeContractAddressFromInstance(instance);
|
|
369
395
|
if (!computedAddress.equals(instance.address)) {
|
|
370
396
|
throw new Error('Added a contract in which the address does not match the contract instance.');
|
|
371
397
|
}
|
|
372
|
-
await this.contractStore.addContractArtifact(
|
|
398
|
+
await this.contractStore.addContractArtifact(artifact, contractClass);
|
|
373
399
|
const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
374
400
|
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
375
401
|
} else {
|
|
@@ -405,11 +431,13 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
405
431
|
if (!contractClass.id.equals(currentClassId)) {
|
|
406
432
|
throw new Error('Could not update contract to a class different from the current one.');
|
|
407
433
|
}
|
|
408
|
-
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
409
434
|
const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
410
435
|
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
411
436
|
currentInstance.currentContractClassId = contractClass.id;
|
|
412
|
-
await
|
|
437
|
+
await Promise.all([
|
|
438
|
+
this.contractStore.addContractArtifact(artifact, contractClass),
|
|
439
|
+
this.contractStore.addContractInstance(currentInstance)
|
|
440
|
+
]);
|
|
413
441
|
this.log.info(`Updated contract ${artifact.name} at ${contractAddress.toString()} to class ${contractClass.id}`);
|
|
414
442
|
});
|
|
415
443
|
}
|
|
@@ -424,10 +452,11 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
424
452
|
* (where validators prove the public portion).
|
|
425
453
|
*
|
|
426
454
|
* @param txRequest - An authenticated tx request ready for proving
|
|
455
|
+
* @param scopes - Addresses whose private state and keys are accessible during private execution.
|
|
427
456
|
* @returns A result containing the proof and public inputs of the tail circuit.
|
|
428
457
|
* @throws If contract code not found, or public simulation reverts.
|
|
429
458
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
430
|
-
*/ proveTx(txRequest) {
|
|
459
|
+
*/ proveTx(txRequest, scopes) {
|
|
431
460
|
let privateExecutionResult;
|
|
432
461
|
// We disable proving concurrently mostly out of caution, since it accesses some of our stores. Proving is so
|
|
433
462
|
// computationally demanding that it'd be rare for someone to try to do it concurrently regardless.
|
|
@@ -438,7 +467,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
438
467
|
await this.blockStateSynchronizer.sync();
|
|
439
468
|
const syncTime = syncTimer.ms();
|
|
440
469
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
441
|
-
privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest,
|
|
470
|
+
privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
|
|
442
471
|
const { publicInputs, chonkProof, executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
443
472
|
simulate: false,
|
|
444
473
|
skipFeeEnforcement: false,
|
|
@@ -488,13 +517,10 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
488
517
|
}
|
|
489
518
|
/**
|
|
490
519
|
* 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.
|
|
520
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
495
521
|
* @returns A trace of the program execution with gate counts.
|
|
496
522
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
497
|
-
*/ profileTx(txRequest, profileMode, skipProofGeneration = true) {
|
|
523
|
+
*/ profileTx(txRequest, { profileMode, skipProofGeneration = true, scopes }) {
|
|
498
524
|
// We disable concurrent profiles for consistency with simulateTx.
|
|
499
525
|
return this.#putInJobQueue(async (jobId)=>{
|
|
500
526
|
const totalTimer = new Timer();
|
|
@@ -512,7 +538,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
512
538
|
await this.blockStateSynchronizer.sync();
|
|
513
539
|
const syncTime = syncTimer.ms();
|
|
514
540
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
515
|
-
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest,
|
|
541
|
+
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
|
|
516
542
|
const { executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
517
543
|
simulate: skipProofGeneration,
|
|
518
544
|
skipFeeEnforcement: false,
|
|
@@ -557,18 +583,13 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
557
583
|
* In that case, the transaction returned is only potentially ready to be sent to the network for execution.
|
|
558
584
|
*
|
|
559
585
|
*
|
|
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.
|
|
586
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
566
587
|
* @returns A simulated transaction result object that includes public and private return values.
|
|
567
588
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
568
589
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
569
590
|
*
|
|
570
591
|
* TODO(#7456) Prevent msgSender being defined here for the first call
|
|
571
|
-
*/ simulateTx(txRequest, simulatePublic, skipTxValidation = false, skipFeeEnforcement = false, overrides, scopes) {
|
|
592
|
+
*/ simulateTx(txRequest, { simulatePublic, skipTxValidation = false, skipFeeEnforcement = false, overrides, scopes }) {
|
|
572
593
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
573
594
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
574
595
|
// delete the same read value, or reading values that another simulation is currently modifying).
|
|
@@ -603,7 +624,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
603
624
|
let publicInputs;
|
|
604
625
|
let executionSteps = [];
|
|
605
626
|
if (skipKernels) {
|
|
606
|
-
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, this.contractStore));
|
|
627
|
+
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, (addr, sel)=>this.contractStore.getDebugFunctionName(addr, sel), this.node));
|
|
607
628
|
} else {
|
|
608
629
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
609
630
|
({ publicInputs, executionSteps } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
@@ -620,6 +641,9 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
620
641
|
const publicSimulationTimer = new Timer();
|
|
621
642
|
publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement);
|
|
622
643
|
publicSimulationTime = publicSimulationTimer.ms();
|
|
644
|
+
if (publicOutput?.debugLogs?.length) {
|
|
645
|
+
await displayDebugLogs(publicOutput.debugLogs, (addr)=>this.contractStore.getDebugContractName(addr));
|
|
646
|
+
}
|
|
623
647
|
}
|
|
624
648
|
let validationTime;
|
|
625
649
|
if (!skipTxValidation) {
|
|
@@ -663,22 +687,19 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
663
687
|
nodeRPCCalls: simulatorStats.nodeRPCCalls
|
|
664
688
|
});
|
|
665
689
|
} catch (err) {
|
|
666
|
-
throw this.#contextualizeError(err, inspect(txRequest), `simulatePublic=${simulatePublic}`, `skipTxValidation=${skipTxValidation}`, `scopes=${scopes
|
|
690
|
+
throw this.#contextualizeError(err, inspect(txRequest), `simulatePublic=${simulatePublic}`, `skipTxValidation=${skipTxValidation}`, `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map((s)=>s.toString()).join(', ')}`);
|
|
667
691
|
}
|
|
668
692
|
});
|
|
669
693
|
}
|
|
670
694
|
/**
|
|
671
|
-
*
|
|
672
|
-
*
|
|
695
|
+
* Executes a contract utility function.
|
|
673
696
|
* @param call - The function call containing the function details, arguments, and target contract address.
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
*/ simulateUtility(call, authwits, scopes) {
|
|
679
|
-
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
697
|
+
*/ executeUtility(call, { authwits, scopes } = {
|
|
698
|
+
scopes: 'ALL_SCOPES'
|
|
699
|
+
}) {
|
|
700
|
+
// We disable concurrent executions since those might execute oracles which read and write to the PXE stores (e.g.
|
|
680
701
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
681
|
-
// delete the same read value, or reading values that another
|
|
702
|
+
// delete the same read value, or reading values that another execution is currently modifying).
|
|
682
703
|
return this.#putInJobQueue(async (jobId)=>{
|
|
683
704
|
try {
|
|
684
705
|
const totalTimer = new Timer();
|
|
@@ -688,8 +709,8 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
688
709
|
const functionTimer = new Timer();
|
|
689
710
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
690
711
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
691
|
-
await this.contractSyncService.ensureContractSynced(call.to, call.selector, (privateSyncCall)=>this.#
|
|
692
|
-
const executionResult = await this.#
|
|
712
|
+
await this.contractSyncService.ensureContractSynced(call.to, call.selector, (privateSyncCall, execScopes)=>this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, scopes);
|
|
713
|
+
const executionResult = await this.#executeUtility(contractFunctionSimulator, call, authwits ?? [], scopes, jobId);
|
|
693
714
|
const functionTime = functionTimer.ms();
|
|
694
715
|
const totalTime = totalTimer.ms();
|
|
695
716
|
const perFunction = [
|
|
@@ -715,7 +736,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
715
736
|
} catch (err) {
|
|
716
737
|
const { to, name, args } = call;
|
|
717
738
|
const stringifiedArgs = args.map((arg)=>arg.toString()).join(', ');
|
|
718
|
-
throw this.#contextualizeError(err, `
|
|
739
|
+
throw this.#contextualizeError(err, `executeUtility ${to}:${name}(${stringifiedArgs})`, `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map((s)=>s.toString()).join(', ')}`);
|
|
719
740
|
}
|
|
720
741
|
});
|
|
721
742
|
}
|
|
@@ -738,7 +759,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
738
759
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
739
760
|
anchorBlockNumber = anchorBlockHeader.getBlockNumber();
|
|
740
761
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
741
|
-
await this.contractSyncService.ensureContractSynced(filter.contractAddress, null, async (privateSyncCall)=>await this.#
|
|
762
|
+
await this.contractSyncService.ensureContractSynced(filter.contractAddress, null, async (privateSyncCall, execScopes)=>await this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, filter.scopes);
|
|
742
763
|
});
|
|
743
764
|
// anchorBlockNumber is set during the job and fixed to whatever it is after a block sync
|
|
744
765
|
const sanitizedFilter = new PrivateEventFilterValidator(anchorBlockNumber).validate(filter);
|
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
import type { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { BufferReader } from '@aztec/foundation/serialize';
|
|
3
4
|
import type { MembershipWitness } from '@aztec/foundation/trees';
|
|
4
5
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
5
6
|
import { type ContractArtifact, type FunctionAbi, type FunctionArtifactWithContractName, FunctionCall, type FunctionDebugMetadata, FunctionSelector } from '@aztec/stdlib/abi';
|
|
6
7
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
-
import { type
|
|
8
|
+
import { type ContractClassIdPreimage, type ContractClassWithId, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
9
|
+
/**
|
|
10
|
+
* All contract class data except the large packedBytecode.
|
|
11
|
+
* The expensive data from the ContractClass is precomputed and stored in this format to avoid redundant hashing.
|
|
12
|
+
* Since we have to store the artifacts anyway, the final ContractClass is reconstructed by combining this data
|
|
13
|
+
* with the packedBytecode obtained from the former. That way we can have quick class lookups without wasted storage.
|
|
14
|
+
*/
|
|
15
|
+
export declare class SerializableContractClassData {
|
|
16
|
+
readonly version: 1;
|
|
17
|
+
readonly id: Fr;
|
|
18
|
+
readonly artifactHash: Fr;
|
|
19
|
+
readonly privateFunctionsRoot: Fr;
|
|
20
|
+
readonly publicBytecodeCommitment: Fr;
|
|
21
|
+
readonly privateFunctions: {
|
|
22
|
+
selector: FunctionSelector;
|
|
23
|
+
vkHash: Fr;
|
|
24
|
+
}[];
|
|
25
|
+
constructor(data: ContractClassIdPreimage & {
|
|
26
|
+
id: Fr;
|
|
27
|
+
privateFunctions: {
|
|
28
|
+
selector: FunctionSelector;
|
|
29
|
+
vkHash: Fr;
|
|
30
|
+
}[];
|
|
31
|
+
});
|
|
32
|
+
toBuffer(): Buffer;
|
|
33
|
+
static fromBuffer(bufferOrReader: Buffer | BufferReader): SerializableContractClassData;
|
|
34
|
+
}
|
|
8
35
|
/**
|
|
9
36
|
* ContractStore serves as a data manager and retriever for Aztec.nr contracts.
|
|
10
37
|
* It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
|
|
@@ -15,19 +42,24 @@ import { type ContractClass, type ContractInstanceWithAddress } from '@aztec/std
|
|
|
15
42
|
export declare class ContractStore {
|
|
16
43
|
#private;
|
|
17
44
|
constructor(store: AztecAsyncKVStore);
|
|
18
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Registers a new contract artifact and its corresponding class data.
|
|
47
|
+
* IMPORTANT: This method does not verify that the provided artifact matches the class data or that the class id matches the artifact.
|
|
48
|
+
* It is the caller's responsibility to ensure the consistency and correctness of the provided data.
|
|
49
|
+
* This is done to avoid redundant, expensive contract class computations
|
|
50
|
+
*/
|
|
51
|
+
addContractArtifact(contract: ContractArtifact, contractClassWithIdAndPreimage?: ContractClassWithId & ContractClassIdPreimage): Promise<Fr>;
|
|
19
52
|
addContractInstance(contract: ContractInstanceWithAddress): Promise<void>;
|
|
20
53
|
getContractsAddresses(): Promise<AztecAddress[]>;
|
|
21
|
-
/** Returns a contract instance for a given address.
|
|
54
|
+
/** Returns a contract instance for a given address. */
|
|
22
55
|
getContractInstance(contractAddress: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
56
|
+
/** Returns the raw contract artifact for a given class id. */
|
|
23
57
|
getContractArtifact(contractClassId: Fr): Promise<ContractArtifact | undefined>;
|
|
24
|
-
/** Returns a contract class for a given class id.
|
|
25
|
-
|
|
58
|
+
/** Returns a contract class for a given class id. */
|
|
59
|
+
getContractClassWithPreimage(contractClassId: Fr): Promise<(ContractClassWithId & ContractClassIdPreimage) | undefined>;
|
|
26
60
|
getContract(address: AztecAddress): Promise<(ContractInstanceWithAddress & ContractArtifact) | undefined>;
|
|
27
61
|
/**
|
|
28
62
|
* Retrieves the artifact of a specified function within a given contract.
|
|
29
|
-
* The function is identified by its selector, which is a unique code generated from the function's signature.
|
|
30
|
-
* Throws an error if the contract address or function selector are invalid or not found.
|
|
31
63
|
*
|
|
32
64
|
* @param contractAddress - The AztecAddress representing the contract containing the function.
|
|
33
65
|
* @param selector - The function selector.
|
|
@@ -39,20 +71,15 @@ export declare class ContractStore {
|
|
|
39
71
|
getFunctionAbi(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionAbi | undefined>;
|
|
40
72
|
/**
|
|
41
73
|
* Retrieves the debug metadata of a specified function within a given contract.
|
|
42
|
-
* The function is identified by its selector, which is a unique code generated from the function's signature.
|
|
43
|
-
* Returns undefined if the debug metadata for the given function is not found.
|
|
44
|
-
* Throws if the contract has not been added to the database.
|
|
45
74
|
*
|
|
46
75
|
* @param contractAddress - The AztecAddress representing the contract containing the function.
|
|
47
76
|
* @param selector - The function selector.
|
|
48
|
-
* @returns The corresponding function's
|
|
77
|
+
* @returns The corresponding function's debug metadata, or undefined.
|
|
49
78
|
*/
|
|
50
79
|
getFunctionDebugMetadata(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionDebugMetadata | undefined>;
|
|
51
80
|
getPublicFunctionDebugMetadata(contractAddress: AztecAddress): Promise<FunctionDebugMetadata | undefined>;
|
|
52
81
|
/**
|
|
53
82
|
* Retrieve the function membership witness for the given contract class and function selector.
|
|
54
|
-
* The function membership witness represents a proof that the function belongs to the specified contract.
|
|
55
|
-
* Throws an error if the contract address or function selector is unknown.
|
|
56
83
|
*
|
|
57
84
|
* @param contractClassId - The id of the class.
|
|
58
85
|
* @param selector - The function selector.
|
|
@@ -63,4 +90,4 @@ export declare class ContractStore {
|
|
|
63
90
|
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
|
|
64
91
|
getFunctionCall(functionName: string, args: any[], to: AztecAddress): Promise<FunctionCall>;
|
|
65
92
|
}
|
|
66
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
93
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3Rfc3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2NvbnRyYWN0X3N0b3JlL2NvbnRyYWN0X3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDN0QsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBRXBELE9BQU8sRUFBRSxZQUFZLEVBQWlDLE1BQU0sNkJBQTZCLENBQUM7QUFDMUYsT0FBTyxLQUFLLEVBQUUsa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