@aztec/stdlib 0.81.0 → 0.82.1-alpha-testnet.1
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/abi/abi.d.ts +5 -1
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +2 -1
- package/dest/auth_witness/auth_witness.d.ts +21 -0
- package/dest/auth_witness/auth_witness.d.ts.map +1 -1
- package/dest/auth_witness/auth_witness.js +29 -0
- package/dest/avm/avm.d.ts +24 -48
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.d.ts +18 -36
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_proving_request.d.ts +27 -54
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/block/index.d.ts +0 -1
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +0 -1
- package/dest/block/l2_block_downloader/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_downloader/l2_block_stream.js +0 -2
- package/dest/block/l2_block_source.d.ts +6 -0
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/contract/contract_class.d.ts.map +1 -1
- package/dest/contract/contract_class.js +3 -21
- package/dest/contract/interfaces/contract_class.d.ts +1 -143
- package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_class.js +0 -5
- package/dest/contract/interfaces/contract_data_source.d.ts +3 -8
- package/dest/contract/interfaces/contract_data_source.d.ts.map +1 -1
- package/dest/database-version/version_manager.d.ts +5 -0
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +7 -0
- package/dest/hash/hash.d.ts +8 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +12 -1
- package/dest/interfaces/archiver.d.ts +1 -2
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +2 -4
- package/dest/interfaces/aztec-node-admin.d.ts +20 -0
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -0
- package/dest/interfaces/aztec-node-admin.js +16 -0
- package/dest/interfaces/aztec-node.d.ts +8 -38
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +4 -12
- package/dest/interfaces/client.d.ts +1 -0
- package/dest/interfaces/client.d.ts.map +1 -1
- package/dest/interfaces/client.js +1 -0
- package/dest/interfaces/private_kernel_prover.d.ts +2 -3
- package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +1 -1
- package/dest/interfaces/prover-node.d.ts +1 -2
- package/dest/interfaces/prover-node.d.ts.map +1 -1
- package/dest/interfaces/prover-node.js +5 -4
- package/dest/interfaces/proving-job.d.ts +27 -54
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/pxe.d.ts +21 -39
- package/dest/interfaces/pxe.d.ts.map +1 -1
- package/dest/interfaces/pxe.js +10 -9
- package/dest/kernel/index.d.ts +1 -1
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +1 -1
- package/dest/kernel/private_kernel_prover_output.d.ts +49 -0
- package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -0
- package/dest/kernel/private_kernel_prover_output.js +8 -0
- package/dest/kernel/private_kernel_simulated_output.d.ts +3 -7
- package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
- package/dest/kernel/public_call_request.d.ts +14 -19
- package/dest/kernel/public_call_request.d.ts.map +1 -1
- package/dest/kernel/public_call_request.js +19 -20
- package/dest/logs/log_with_tx_data.js +2 -2
- package/dest/noir/index.d.ts +5 -1
- package/dest/noir/index.d.ts.map +1 -1
- package/dest/proofs/client_ivc_proof.d.ts +1 -2
- package/dest/proofs/client_ivc_proof.d.ts.map +1 -1
- package/dest/proofs/client_ivc_proof.js +6 -9
- package/dest/rollup/tube_inputs.d.ts +7 -2
- package/dest/rollup/tube_inputs.d.ts.map +1 -1
- package/dest/rollup/tube_inputs.js +10 -4
- package/dest/stats/stats.d.ts +1 -1
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +2 -2
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +3 -13
- package/dest/tests/mocks.d.ts +3 -4
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +13 -48
- package/dest/trees/nullifier_membership_witness.d.ts +4 -0
- package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
- package/dest/trees/nullifier_membership_witness.js +10 -0
- package/dest/trees/public_data_witness.d.ts +5 -5
- package/dest/trees/public_data_witness.d.ts.map +1 -1
- package/dest/trees/public_data_witness.js +13 -0
- package/dest/tx/call_context.d.ts +1 -1
- package/dest/tx/hashed_values.d.ts +16 -4
- package/dest/tx/hashed_values.d.ts.map +1 -1
- package/dest/tx/hashed_values.js +26 -9
- package/dest/tx/index.d.ts +3 -1
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +3 -1
- package/dest/tx/private_execution_result.d.ts +10 -26
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +18 -70
- package/dest/tx/profiled_tx.d.ts +9 -0
- package/dest/tx/profiled_tx.d.ts.map +1 -0
- package/dest/tx/profiled_tx.js +27 -0
- package/dest/tx/proven_tx.d.ts +33 -0
- package/dest/tx/proven_tx.d.ts.map +1 -0
- package/dest/tx/proven_tx.js +33 -0
- package/dest/tx/public_call_request_with_calldata.d.ts +41 -0
- package/dest/tx/public_call_request_with_calldata.d.ts.map +1 -0
- package/dest/tx/public_call_request_with_calldata.js +57 -0
- package/dest/tx/simulated_tx.d.ts +8 -44
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +19 -44
- package/dest/tx/tx.d.ts +16 -20
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +56 -42
- package/dest/tx/tx_execution_request.js +1 -1
- package/dest/tx/tx_receipt.d.ts +1 -30
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +3 -13
- package/package.json +6 -7
- package/src/abi/abi.ts +7 -2
- package/src/auth_witness/auth_witness.ts +29 -0
- package/src/block/index.ts +0 -1
- package/src/block/l2_block_downloader/l2_block_stream.ts +0 -2
- package/src/block/l2_block_source.ts +7 -0
- package/src/contract/contract_class.ts +7 -26
- package/src/contract/interfaces/contract_class.ts +2 -18
- package/src/contract/interfaces/contract_data_source.ts +3 -9
- package/src/database-version/version_manager.ts +10 -0
- package/src/hash/hash.ts +15 -1
- package/src/interfaces/archiver.ts +3 -12
- package/src/interfaces/aztec-node-admin.ts +39 -0
- package/src/interfaces/aztec-node.ts +9 -71
- package/src/interfaces/client.ts +1 -0
- package/src/interfaces/private_kernel_prover.ts +2 -3
- package/src/interfaces/prover-client.ts +1 -1
- package/src/interfaces/prover-node.ts +2 -4
- package/src/interfaces/pxe.ts +34 -56
- package/src/kernel/index.ts +1 -1
- package/src/kernel/private_kernel_prover_output.ts +44 -0
- package/src/kernel/private_kernel_simulated_output.ts +4 -13
- package/src/kernel/public_call_request.ts +22 -27
- package/src/logs/log_with_tx_data.ts +2 -2
- package/src/noir/index.ts +6 -1
- package/src/proofs/client_ivc_proof.ts +5 -15
- package/src/rollup/tube_inputs.ts +8 -4
- package/src/stats/stats.ts +1 -1
- package/src/tests/factories.ts +3 -24
- package/src/tests/mocks.ts +28 -80
- package/src/trees/nullifier_membership_witness.ts +12 -0
- package/src/trees/public_data_witness.ts +15 -0
- package/src/tx/hashed_values.ts +29 -9
- package/src/tx/index.ts +3 -1
- package/src/tx/private_execution_result.ts +16 -81
- package/src/tx/profiled_tx.ts +27 -0
- package/src/tx/proven_tx.ts +50 -0
- package/src/tx/public_call_request_with_calldata.ts +72 -0
- package/src/tx/simulated_tx.ts +12 -69
- package/src/tx/tx.ts +57 -70
- package/src/tx/tx_execution_request.ts +1 -1
- package/src/tx/tx_receipt.ts +0 -36
- package/dest/block/nullifier_with_block_source.d.ts +0 -6
- package/dest/block/nullifier_with_block_source.d.ts.map +0 -1
- package/dest/block/nullifier_with_block_source.js +0 -1
- package/dest/kernel/private_kernel_prover_profile_result.d.ts +0 -25
- package/dest/kernel/private_kernel_prover_profile_result.d.ts.map +0 -1
- package/dest/kernel/private_kernel_prover_profile_result.js +0 -7
- package/dest/tx/public_execution_request.d.ts +0 -45
- package/dest/tx/public_execution_request.d.ts.map +0 -1
- package/dest/tx/public_execution_request.js +0 -72
- package/src/block/nullifier_with_block_source.ts +0 -7
- package/src/kernel/private_kernel_prover_profile_result.ts +0 -7
- package/src/tx/public_execution_request.ts +0 -97
|
@@ -5,7 +5,6 @@ import { z } from 'zod';
|
|
|
5
5
|
import { inBlockSchemaFor } from '../block/in_block.js';
|
|
6
6
|
import { L2Block } from '../block/l2_block.js';
|
|
7
7
|
import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
|
|
8
|
-
import type { NullifierWithBlockSource } from '../block/nullifier_with_block_source.js';
|
|
9
8
|
import { PublishedL2BlockSchema } from '../block/published_l2_block.js';
|
|
10
9
|
import {
|
|
11
10
|
ContractClassPublicSchema,
|
|
@@ -26,7 +25,7 @@ import { GetContractClassLogsResponseSchema, GetPublicLogsResponseSchema } from
|
|
|
26
25
|
import type { L2LogsSource } from './l2_logs_source.js';
|
|
27
26
|
|
|
28
27
|
export type ArchiverApi = Omit<
|
|
29
|
-
L2BlockSource & L2LogsSource & ContractDataSource & L1ToL2MessageSource
|
|
28
|
+
L2BlockSource & L2LogsSource & ContractDataSource & L1ToL2MessageSource,
|
|
30
29
|
'start' | 'stop'
|
|
31
30
|
>;
|
|
32
31
|
|
|
@@ -53,6 +52,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
53
52
|
getL2SlotNumber: z.function().args().returns(schemas.BigInt),
|
|
54
53
|
getL2EpochNumber: z.function().args().returns(schemas.BigInt),
|
|
55
54
|
getBlocksForEpoch: z.function().args(schemas.BigInt).returns(z.array(L2Block.schema)),
|
|
55
|
+
getBlockHeadersForEpoch: z.function().args(schemas.BigInt).returns(z.array(BlockHeader.schema)),
|
|
56
56
|
isEpochComplete: z.function().args(schemas.BigInt).returns(z.boolean()),
|
|
57
57
|
getL2Tips: z.function().args().returns(L2TipsSchema),
|
|
58
58
|
getPrivateLogs: z.function().args(z.number(), z.number()).returns(z.array(PrivateLog.schema)),
|
|
@@ -60,10 +60,6 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
60
60
|
.function()
|
|
61
61
|
.args(z.array(schemas.Fr))
|
|
62
62
|
.returns(z.array(z.array(TxScopedL2Log.schema))),
|
|
63
|
-
findNullifiersIndexesWithBlock: z
|
|
64
|
-
.function()
|
|
65
|
-
.args(z.number(), z.array(schemas.Fr))
|
|
66
|
-
.returns(z.array(optional(inBlockSchemaFor(schemas.BigInt)))),
|
|
67
63
|
getPublicLogs: z.function().args(LogFilterSchema).returns(GetPublicLogsResponseSchema),
|
|
68
64
|
getContractClassLogs: z.function().args(LogFilterSchema).returns(GetContractClassLogsResponseSchema),
|
|
69
65
|
getContractClass: z.function().args(schemas.Fr).returns(ContractClassPublicSchema.optional()),
|
|
@@ -76,11 +72,6 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
76
72
|
registerContractFunctionSignatures: z.function().args(schemas.AztecAddress, z.array(z.string())).returns(z.void()),
|
|
77
73
|
getL1ToL2Messages: z.function().args(schemas.BigInt).returns(z.array(schemas.Fr)),
|
|
78
74
|
getL1ToL2MessageIndex: z.function().args(schemas.Fr).returns(schemas.BigInt.optional()),
|
|
79
|
-
|
|
80
|
-
addContractClass: z.function().args(ContractClassPublicSchema).returns(z.void()),
|
|
81
|
-
getContractFunctionName: z
|
|
82
|
-
.function()
|
|
83
|
-
.args(schemas.AztecAddress, schemas.FunctionSelector)
|
|
84
|
-
.returns(optional(z.string())),
|
|
75
|
+
getDebugFunctionName: z.function().args(schemas.AztecAddress, schemas.FunctionSelector).returns(optional(z.string())),
|
|
85
76
|
getL1Constants: z.function().args().returns(L1RollupConstantsSchema),
|
|
86
77
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createSafeJsonRpcClient, defaultFetch } from '@aztec/foundation/json-rpc/client';
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
import type { ApiSchemaFor } from '../schemas/schemas.js';
|
|
6
|
+
import { type ComponentsVersions, getVersioningResponseHandler } from '../versioning/index.js';
|
|
7
|
+
import { type SequencerConfig, SequencerConfigSchema } from './configs.js';
|
|
8
|
+
import { type ProverConfig, ProverConfigSchema } from './prover-client.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Aztec node admin API.
|
|
12
|
+
*/
|
|
13
|
+
export interface AztecNodeAdmin {
|
|
14
|
+
/**
|
|
15
|
+
* Updates the configuration of this node.
|
|
16
|
+
* @param config - Updated configuration to be merged with the current one.
|
|
17
|
+
*/
|
|
18
|
+
setConfig(config: Partial<SequencerConfig & ProverConfig>): Promise<void>;
|
|
19
|
+
|
|
20
|
+
/** Forces the next block to be built bypassing all time and pending checks. Useful for testing. */
|
|
21
|
+
flushTxs(): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const AztecNodeAdminApiSchema: ApiSchemaFor<AztecNodeAdmin> = {
|
|
25
|
+
setConfig: z.function().args(SequencerConfigSchema.merge(ProverConfigSchema).partial()).returns(z.void()),
|
|
26
|
+
flushTxs: z.function().returns(z.void()),
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export function createAztecNodeAdminClient(
|
|
30
|
+
url: string,
|
|
31
|
+
versions: Partial<ComponentsVersions> = {},
|
|
32
|
+
fetch = defaultFetch,
|
|
33
|
+
): AztecNodeAdmin {
|
|
34
|
+
return createSafeJsonRpcClient<AztecNodeAdmin>(url, AztecNodeAdminApiSchema, {
|
|
35
|
+
namespaceMethods: 'nodeAdmin',
|
|
36
|
+
fetch,
|
|
37
|
+
onResponse: getVersioningResponseHandler(versions),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -47,14 +47,12 @@ import {
|
|
|
47
47
|
} from '../tx/index.js';
|
|
48
48
|
import { TxEffect } from '../tx/tx_effect.js';
|
|
49
49
|
import { type ComponentsVersions, getVersioningResponseHandler } from '../versioning/index.js';
|
|
50
|
-
import { type SequencerConfig, SequencerConfigSchema } from './configs.js';
|
|
51
50
|
import {
|
|
52
51
|
type GetContractClassLogsResponse,
|
|
53
52
|
GetContractClassLogsResponseSchema,
|
|
54
53
|
type GetPublicLogsResponse,
|
|
55
54
|
GetPublicLogsResponseSchema,
|
|
56
55
|
} from './get_logs_response.js';
|
|
57
|
-
import { type ProverConfig, ProverConfigSchema } from './prover-client.js';
|
|
58
56
|
import type { ProverCoordination } from './prover-coordination.js';
|
|
59
57
|
import { type WorldStateSyncStatus, WorldStateSyncStatusSchema } from './world_state.js';
|
|
60
58
|
|
|
@@ -76,41 +74,17 @@ export interface AztecNode
|
|
|
76
74
|
getWorldStateSyncStatus(): Promise<WorldStateSyncStatus>;
|
|
77
75
|
|
|
78
76
|
/**
|
|
79
|
-
* Find the indexes of the given leaves in the given tree
|
|
80
|
-
*
|
|
77
|
+
* Find the indexes of the given leaves in the given tree along with a block metadata pointing to the block in which
|
|
78
|
+
* the leaves were inserted.
|
|
79
|
+
* @param blockNumber - The block number at which to get the data or 'latest' for latest data.
|
|
81
80
|
* @param treeId - The tree to search in.
|
|
82
|
-
* @param leafValues - The values to search for
|
|
83
|
-
* @returns The
|
|
81
|
+
* @param leafValues - The values to search for.
|
|
82
|
+
* @returns The indices of leaves and the block metadata of a block in which the leaves were inserted.
|
|
84
83
|
*/
|
|
85
84
|
findLeavesIndexes(
|
|
86
85
|
blockNumber: L2BlockNumber,
|
|
87
86
|
treeId: MerkleTreeId,
|
|
88
87
|
leafValues: Fr[],
|
|
89
|
-
): Promise<(bigint | undefined)[]>;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Find the indexes of the given leaves in the given tree.
|
|
93
|
-
* @param blockNumber - The block number at which to get the data or 'latest' for latest data
|
|
94
|
-
* @param treeId - The tree to search in.
|
|
95
|
-
* @param leafIndices - The values to search for
|
|
96
|
-
* @returns The indexes of the given leaves in the given tree or undefined if not found.
|
|
97
|
-
*/
|
|
98
|
-
findBlockNumbersForIndexes(
|
|
99
|
-
blockNumber: L2BlockNumber,
|
|
100
|
-
treeId: MerkleTreeId,
|
|
101
|
-
leafIndices: bigint[],
|
|
102
|
-
): Promise<(bigint | undefined)[]>;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Returns the indexes of the given nullifiers in the nullifier tree,
|
|
106
|
-
* scoped to the block they were included in.
|
|
107
|
-
* @param blockNumber - The block number at which to get the data.
|
|
108
|
-
* @param nullifiers - The nullifiers to search for.
|
|
109
|
-
* @returns The block scoped indexes of the given nullifiers in the nullifier tree, or undefined if not found.
|
|
110
|
-
*/
|
|
111
|
-
findNullifiersIndexesWithBlock(
|
|
112
|
-
blockNumber: L2BlockNumber,
|
|
113
|
-
nullifiers: Fr[],
|
|
114
88
|
): Promise<(InBlock<bigint> | undefined)[]>;
|
|
115
89
|
|
|
116
90
|
/**
|
|
@@ -221,14 +195,14 @@ export interface AztecNode
|
|
|
221
195
|
* "in range" slot, means that the slot doesn't exist and the value is 0. If the low leaf preimage corresponds to the exact slot, the current value
|
|
222
196
|
* is contained in the leaf preimage.
|
|
223
197
|
*/
|
|
224
|
-
|
|
198
|
+
getPublicDataWitness(blockNumber: L2BlockNumber, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
225
199
|
|
|
226
200
|
/**
|
|
227
201
|
* Get a block specified by its number.
|
|
228
202
|
* @param number - The block number being requested.
|
|
229
203
|
* @returns The requested block.
|
|
230
204
|
*/
|
|
231
|
-
getBlock(number:
|
|
205
|
+
getBlock(number: L2BlockNumber): Promise<L2Block | undefined>;
|
|
232
206
|
|
|
233
207
|
/**
|
|
234
208
|
* Fetches the current block number.
|
|
@@ -422,12 +396,6 @@ export interface AztecNode
|
|
|
422
396
|
*/
|
|
423
397
|
isValidTx(tx: Tx, options?: { isSimulation?: boolean; skipFeeEnforcement?: boolean }): Promise<TxValidationResult>;
|
|
424
398
|
|
|
425
|
-
/**
|
|
426
|
-
* Updates the configuration of this node.
|
|
427
|
-
* @param config - Updated configuration to be merged with the current one.
|
|
428
|
-
*/
|
|
429
|
-
setConfig(config: Partial<SequencerConfig & ProverConfig>): Promise<void>;
|
|
430
|
-
|
|
431
399
|
/**
|
|
432
400
|
* Returns a registered contract class given its id.
|
|
433
401
|
* @param id - Id of the contract class.
|
|
@@ -440,20 +408,10 @@ export interface AztecNode
|
|
|
440
408
|
*/
|
|
441
409
|
getContract(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
442
410
|
|
|
443
|
-
/** Forces the next block to be built bypassing all time and pending checks. Useful for testing. */
|
|
444
|
-
flushTxs(): Promise<void>;
|
|
445
|
-
|
|
446
411
|
/**
|
|
447
412
|
* Returns the ENR of this node for peer discovery, if available.
|
|
448
413
|
*/
|
|
449
414
|
getEncodedEnr(): Promise<string | undefined>;
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Adds a contract class bypassing the registerer.
|
|
453
|
-
* TODO(#10007): Remove this method.
|
|
454
|
-
* @param contractClass - The class to register.
|
|
455
|
-
*/
|
|
456
|
-
addContractClass(contractClass: ContractClassPublic): Promise<void>;
|
|
457
415
|
}
|
|
458
416
|
|
|
459
417
|
export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
@@ -464,16 +422,6 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
464
422
|
findLeavesIndexes: z
|
|
465
423
|
.function()
|
|
466
424
|
.args(L2BlockNumberSchema, z.nativeEnum(MerkleTreeId), z.array(schemas.Fr))
|
|
467
|
-
.returns(z.array(optional(schemas.BigInt))),
|
|
468
|
-
|
|
469
|
-
findBlockNumbersForIndexes: z
|
|
470
|
-
.function()
|
|
471
|
-
.args(L2BlockNumberSchema, z.nativeEnum(MerkleTreeId), z.array(schemas.BigInt))
|
|
472
|
-
.returns(z.array(optional(schemas.BigInt))),
|
|
473
|
-
|
|
474
|
-
findNullifiersIndexesWithBlock: z
|
|
475
|
-
.function()
|
|
476
|
-
.args(L2BlockNumberSchema, z.array(schemas.Fr))
|
|
477
425
|
.returns(z.array(optional(inBlockSchemaFor(schemas.BigInt)))),
|
|
478
426
|
|
|
479
427
|
getNullifierSiblingPath: z
|
|
@@ -518,12 +466,9 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
518
466
|
.args(L2BlockNumberSchema, schemas.Fr)
|
|
519
467
|
.returns(NullifierMembershipWitness.schema.optional()),
|
|
520
468
|
|
|
521
|
-
|
|
522
|
-
.function()
|
|
523
|
-
.args(L2BlockNumberSchema, schemas.Fr)
|
|
524
|
-
.returns(PublicDataWitness.schema.optional()),
|
|
469
|
+
getPublicDataWitness: z.function().args(L2BlockNumberSchema, schemas.Fr).returns(PublicDataWitness.schema.optional()),
|
|
525
470
|
|
|
526
|
-
getBlock: z.function().args(
|
|
471
|
+
getBlock: z.function().args(L2BlockNumberSchema).returns(L2Block.schema.optional()),
|
|
527
472
|
|
|
528
473
|
getBlockNumber: z.function().returns(z.number()),
|
|
529
474
|
|
|
@@ -590,18 +535,11 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
590
535
|
)
|
|
591
536
|
.returns(TxValidationResultSchema),
|
|
592
537
|
|
|
593
|
-
setConfig: z.function().args(SequencerConfigSchema.merge(ProverConfigSchema).partial()).returns(z.void()),
|
|
594
|
-
|
|
595
538
|
getContractClass: z.function().args(schemas.Fr).returns(ContractClassPublicSchema.optional()),
|
|
596
539
|
|
|
597
540
|
getContract: z.function().args(schemas.AztecAddress).returns(ContractInstanceWithAddressSchema.optional()),
|
|
598
541
|
|
|
599
|
-
flushTxs: z.function().returns(z.void()),
|
|
600
|
-
|
|
601
542
|
getEncodedEnr: z.function().returns(z.string().optional()),
|
|
602
|
-
|
|
603
|
-
// TODO(#10007): Remove this method
|
|
604
|
-
addContractClass: z.function().args(ContractClassPublicSchema).returns(z.void()),
|
|
605
543
|
};
|
|
606
544
|
|
|
607
545
|
export function createAztecNodeClient(
|
package/src/interfaces/client.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { WitnessMap } from '@aztec/noir-acvm_js';
|
|
2
|
-
|
|
3
1
|
import type {
|
|
2
|
+
PrivateExecutionStep,
|
|
4
3
|
PrivateKernelCircuitPublicInputs,
|
|
5
4
|
PrivateKernelInitCircuitPrivateInputs,
|
|
6
5
|
PrivateKernelInnerCircuitPrivateInputs,
|
|
@@ -101,7 +100,7 @@ export interface PrivateKernelProver {
|
|
|
101
100
|
* @param acirs The program bytecode.
|
|
102
101
|
* @param witnessStack The witnessses for each program bytecode.
|
|
103
102
|
*/
|
|
104
|
-
createClientIvcProof(
|
|
103
|
+
createClientIvcProof(executionSteps: PrivateExecutionStep[]): Promise<ClientIvcProof>;
|
|
105
104
|
|
|
106
105
|
/**
|
|
107
106
|
* Compute the gate count for a given circuit.
|
|
@@ -51,7 +51,7 @@ export const proverConfigMappings: ConfigMappingsType<ProverConfig> = {
|
|
|
51
51
|
realProofs: {
|
|
52
52
|
env: 'PROVER_REAL_PROOFS',
|
|
53
53
|
description: 'Whether to construct real proofs',
|
|
54
|
-
...booleanConfigHelper(),
|
|
54
|
+
...booleanConfigHelper(true),
|
|
55
55
|
},
|
|
56
56
|
proverId: {
|
|
57
57
|
env: 'PROVER_ID',
|
|
@@ -11,6 +11,7 @@ const EpochProvingJobState = [
|
|
|
11
11
|
'failed',
|
|
12
12
|
'stopped',
|
|
13
13
|
'timed-out',
|
|
14
|
+
'reorg',
|
|
14
15
|
] as const;
|
|
15
16
|
|
|
16
17
|
export type EpochProvingJobState = (typeof EpochProvingJobState)[number];
|
|
@@ -20,6 +21,7 @@ export const EpochProvingJobTerminalState: EpochProvingJobState[] = [
|
|
|
20
21
|
'failed',
|
|
21
22
|
'stopped',
|
|
22
23
|
'timed-out',
|
|
24
|
+
'reorg',
|
|
23
25
|
] as const;
|
|
24
26
|
|
|
25
27
|
export type EpochProvingJobTerminalState = (typeof EpochProvingJobTerminalState)[number];
|
|
@@ -29,8 +31,6 @@ export interface ProverNodeApi {
|
|
|
29
31
|
getJobs(): Promise<{ uuid: string; status: EpochProvingJobState; epochNumber: number }[]>;
|
|
30
32
|
|
|
31
33
|
startProof(epochNumber: number): Promise<void>;
|
|
32
|
-
|
|
33
|
-
prove(epochNumber: number): Promise<void>;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/** Schemas for prover node API functions. */
|
|
@@ -41,6 +41,4 @@ export const ProverNodeApiSchema: ApiSchemaFor<ProverNodeApi> = {
|
|
|
41
41
|
.returns(z.array(z.object({ uuid: z.string(), status: z.enum(EpochProvingJobState), epochNumber: z.number() }))),
|
|
42
42
|
|
|
43
43
|
startProof: z.function().args(schemas.Integer).returns(z.void()),
|
|
44
|
-
|
|
45
|
-
prove: z.function().args(schemas.Integer).returns(z.void()),
|
|
46
44
|
};
|
package/src/interfaces/pxe.ts
CHANGED
|
@@ -29,15 +29,9 @@ import { type LogFilter, LogFilterSchema } from '../logs/log_filter.js';
|
|
|
29
29
|
import { UniqueNote } from '../note/extended_note.js';
|
|
30
30
|
import { type NotesFilter, NotesFilterSchema } from '../note/notes_filter.js';
|
|
31
31
|
import { AbiDecodedSchema, optional, schemas } from '../schemas/schemas.js';
|
|
32
|
-
import {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
TxExecutionRequest,
|
|
36
|
-
TxHash,
|
|
37
|
-
TxProvingResult,
|
|
38
|
-
TxReceipt,
|
|
39
|
-
TxSimulationResult,
|
|
40
|
-
} from '../tx/index.js';
|
|
32
|
+
import { PrivateExecutionResult, Tx, TxExecutionRequest, TxHash, TxReceipt, TxSimulationResult } from '../tx/index.js';
|
|
33
|
+
import { TxProfileResult } from '../tx/profiled_tx.js';
|
|
34
|
+
import { TxProvingResult } from '../tx/proven_tx.js';
|
|
41
35
|
import { TxEffect } from '../tx/tx_effect.js';
|
|
42
36
|
import {
|
|
43
37
|
type GetContractClassLogsResponse,
|
|
@@ -61,38 +55,6 @@ export interface PXE {
|
|
|
61
55
|
*/
|
|
62
56
|
isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean>;
|
|
63
57
|
|
|
64
|
-
/**
|
|
65
|
-
* Insert an auth witness for a given message hash. Auth witnesses are used to authorize actions on
|
|
66
|
-
* behalf of a user. For instance, a token transfer initiated by a different address may request
|
|
67
|
-
* authorization from the user to move their tokens. This authorization is granted by the user
|
|
68
|
-
* account contract by verifying an auth witness requested to the execution oracle. Witnesses are
|
|
69
|
-
* usually a signature over a hash of the action to be authorized, but their actual contents depend
|
|
70
|
-
* on the account contract that consumes them.
|
|
71
|
-
*
|
|
72
|
-
* @param authWitness - The auth witness to insert. Composed of an identifier, which is the hash of
|
|
73
|
-
* the action to be authorized, and the actual witness as an array of fields, which are to be
|
|
74
|
-
* deserialized and processed by the account contract.
|
|
75
|
-
*/
|
|
76
|
-
addAuthWitness(authWitness: AuthWitness): Promise<void>;
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Fetches the serialized auth witness for a given message hash or returns undefined if not found.
|
|
80
|
-
* @param messageHash - The hash of the message for which to get the auth witness.
|
|
81
|
-
* @returns The serialized auth witness for the given message hash.
|
|
82
|
-
*/
|
|
83
|
-
getAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Adds a capsule.
|
|
87
|
-
* @param contract - The address of the contract to add the capsule to.
|
|
88
|
-
* @param storageSlot - The storage slot to add the capsule to.
|
|
89
|
-
* @param capsule - An array of field elements representing the capsule.
|
|
90
|
-
* @remarks A capsule is a "blob" of data that is passed to the contract through an oracle. It works similarly
|
|
91
|
-
* to public contract storage in that it's indexed by the contract address and storage slot but instead of the global
|
|
92
|
-
* network state it's backed by local PXE db.
|
|
93
|
-
*/
|
|
94
|
-
storeCapsule(contract: AztecAddress, storageSlot: Fr, capsule: Fr[]): Promise<void>;
|
|
95
|
-
|
|
96
58
|
/**
|
|
97
59
|
* Registers a user account in PXE given its master encryption private key.
|
|
98
60
|
* Once a new account is registered, the PXE Service will trial-decrypt all published notes on
|
|
@@ -166,14 +128,13 @@ export interface PXE {
|
|
|
166
128
|
getContracts(): Promise<AztecAddress[]>;
|
|
167
129
|
|
|
168
130
|
/**
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
* It returns an object that contains the proof and public inputs of the tail circuit, which can be converted into a Tx ready to be sent to the network
|
|
131
|
+
* Proves the private portion of a simulated transaction, ready to send to the network
|
|
132
|
+
* (where valiators prove the public portion).
|
|
172
133
|
*
|
|
173
134
|
* @param txRequest - An authenticated tx request ready for proving
|
|
174
135
|
* @param privateExecutionResult - The result of the private execution of the transaction
|
|
175
|
-
* @returns A
|
|
176
|
-
* @throws If
|
|
136
|
+
* @returns A result containing the proof and public inputs of the tail circuit.
|
|
137
|
+
* @throws If contract code not found, or public simulation reverts.
|
|
177
138
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
178
139
|
*/
|
|
179
140
|
proveTx(txRequest: TxExecutionRequest, privateExecutionResult: PrivateExecutionResult): Promise<TxProvingResult>;
|
|
@@ -193,10 +154,10 @@ export interface PXE {
|
|
|
193
154
|
* @param simulatePublic - Whether to simulate the public part of the transaction.
|
|
194
155
|
* @param msgSender - (Optional) The message sender to use for the simulation.
|
|
195
156
|
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
196
|
-
* @param
|
|
157
|
+
* @param skipFeeEnforcement - (Optional) If false, fees are enforced.
|
|
197
158
|
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
198
159
|
* @returns A simulated transaction result object that includes public and private return values.
|
|
199
|
-
* @throws If the code for the functions executed in this transaction
|
|
160
|
+
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
200
161
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
201
162
|
*/
|
|
202
163
|
simulateTx(
|
|
@@ -205,10 +166,24 @@ export interface PXE {
|
|
|
205
166
|
msgSender?: AztecAddress,
|
|
206
167
|
skipTxValidation?: boolean,
|
|
207
168
|
skipFeeEnforcement?: boolean,
|
|
208
|
-
profile?: boolean,
|
|
209
169
|
scopes?: AztecAddress[],
|
|
210
170
|
): Promise<TxSimulationResult>;
|
|
211
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
|
|
174
|
+
*
|
|
175
|
+
* @param txRequest - An authenticated tx request ready for simulation
|
|
176
|
+
* @param msgSender - (Optional) The message sender to use for the simulation.
|
|
177
|
+
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
178
|
+
* @returns A trace of the program execution with gate counts.
|
|
179
|
+
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
180
|
+
*/
|
|
181
|
+
profileTx(
|
|
182
|
+
txRequest: TxExecutionRequest,
|
|
183
|
+
profileMode: 'gates' | 'execution-steps' | 'full',
|
|
184
|
+
msgSender?: AztecAddress,
|
|
185
|
+
): Promise<TxProfileResult>;
|
|
186
|
+
|
|
212
187
|
/**
|
|
213
188
|
* Sends a transaction to an Aztec node to be broadcasted to the network and mined.
|
|
214
189
|
* @param tx - The transaction as created via `proveTx`.
|
|
@@ -305,6 +280,7 @@ export interface PXE {
|
|
|
305
280
|
functionName: string,
|
|
306
281
|
args: any[],
|
|
307
282
|
to: AztecAddress,
|
|
283
|
+
authwits?: AuthWitness[],
|
|
308
284
|
from?: AztecAddress,
|
|
309
285
|
scopes?: AztecAddress[],
|
|
310
286
|
): Promise<AbiDecoded>;
|
|
@@ -454,12 +430,6 @@ const PXEInfoSchema = z.object({
|
|
|
454
430
|
|
|
455
431
|
export const PXESchema: ApiSchemaFor<PXE> = {
|
|
456
432
|
isL1ToL2MessageSynced: z.function().args(schemas.Fr).returns(z.boolean()),
|
|
457
|
-
addAuthWitness: z.function().args(AuthWitness.schema).returns(z.void()),
|
|
458
|
-
getAuthWitness: z
|
|
459
|
-
.function()
|
|
460
|
-
.args(schemas.Fr)
|
|
461
|
-
.returns(z.union([z.undefined(), z.array(schemas.Fr)])),
|
|
462
|
-
storeCapsule: z.function().args(schemas.AztecAddress, schemas.Fr, z.array(schemas.Fr)).returns(z.void()),
|
|
463
433
|
registerAccount: z.function().args(schemas.Fr, schemas.Fr).returns(CompleteAddress.schema),
|
|
464
434
|
getRegisteredAccounts: z.function().returns(z.array(CompleteAddress.schema)),
|
|
465
435
|
registerSender: z.function().args(schemas.AztecAddress).returns(schemas.AztecAddress),
|
|
@@ -473,6 +443,14 @@ export const PXESchema: ApiSchemaFor<PXE> = {
|
|
|
473
443
|
updateContract: z.function().args(schemas.AztecAddress, ContractArtifactSchema).returns(z.void()),
|
|
474
444
|
getContracts: z.function().returns(z.array(schemas.AztecAddress)),
|
|
475
445
|
proveTx: z.function().args(TxExecutionRequest.schema, PrivateExecutionResult.schema).returns(TxProvingResult.schema),
|
|
446
|
+
profileTx: z
|
|
447
|
+
.function()
|
|
448
|
+
.args(
|
|
449
|
+
TxExecutionRequest.schema,
|
|
450
|
+
z.union([z.literal('gates'), z.literal('full'), z.literal('execution-steps')]),
|
|
451
|
+
optional(schemas.AztecAddress),
|
|
452
|
+
)
|
|
453
|
+
.returns(TxProfileResult.schema),
|
|
476
454
|
simulateTx: z
|
|
477
455
|
.function()
|
|
478
456
|
.args(
|
|
@@ -481,7 +459,6 @@ export const PXESchema: ApiSchemaFor<PXE> = {
|
|
|
481
459
|
optional(schemas.AztecAddress),
|
|
482
460
|
optional(z.boolean()),
|
|
483
461
|
optional(z.boolean()),
|
|
484
|
-
optional(z.boolean()),
|
|
485
462
|
optional(z.array(schemas.AztecAddress)),
|
|
486
463
|
)
|
|
487
464
|
.returns(TxSimulationResult.schema),
|
|
@@ -513,6 +490,7 @@ export const PXESchema: ApiSchemaFor<PXE> = {
|
|
|
513
490
|
z.string(),
|
|
514
491
|
z.array(z.any()),
|
|
515
492
|
schemas.AztecAddress,
|
|
493
|
+
optional(z.array(AuthWitness.schema)),
|
|
516
494
|
optional(schemas.AztecAddress),
|
|
517
495
|
optional(z.array(schemas.AztecAddress)),
|
|
518
496
|
)
|
package/src/kernel/index.ts
CHANGED
|
@@ -26,5 +26,5 @@ export * from './note_hash.js';
|
|
|
26
26
|
export * from './private_log_data.js';
|
|
27
27
|
export * from './private_call_request.js';
|
|
28
28
|
export * from './private_validation_requests.js';
|
|
29
|
-
export * from './private_kernel_prover_profile_result.js';
|
|
30
29
|
export * from './private_kernel_simulated_output.js';
|
|
30
|
+
export * from './private_kernel_prover_output.js';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { bufferSchema, mapSchema } from '@aztec/foundation/schemas';
|
|
2
|
+
import type { WitnessMap } from '@aztec/noir-acvm_js';
|
|
3
|
+
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
|
|
6
|
+
import type { ClientIvcProof } from '../proofs/client_ivc_proof.js';
|
|
7
|
+
import type { VerificationKeyAsFields } from '../vks/verification_key.js';
|
|
8
|
+
import type { PrivateKernelCircuitPublicInputs } from './private_kernel_circuit_public_inputs.js';
|
|
9
|
+
import type { PrivateKernelTailCircuitPublicInputs } from './private_kernel_tail_circuit_public_inputs.js';
|
|
10
|
+
|
|
11
|
+
export const PrivateExecutionStepSchema = z.object({
|
|
12
|
+
functionName: z.string(),
|
|
13
|
+
gateCount: z.number().optional(),
|
|
14
|
+
bytecode: bufferSchema,
|
|
15
|
+
witness: mapSchema(z.number(), z.string()),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Represents either a simulated private kernel circuit or one of our application function circuits.
|
|
20
|
+
*/
|
|
21
|
+
export interface PrivateExecutionStep {
|
|
22
|
+
functionName: string;
|
|
23
|
+
gateCount?: number;
|
|
24
|
+
bytecode: Buffer;
|
|
25
|
+
witness: WitnessMap;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Represents the output of proven PrivateKernelSimulateOutput.*/
|
|
29
|
+
export interface PrivateKernelExecutionProofOutput<
|
|
30
|
+
PublicInputsType extends PrivateKernelCircuitPublicInputs | PrivateKernelTailCircuitPublicInputs,
|
|
31
|
+
> {
|
|
32
|
+
/** The public inputs used by the proof generation process. */
|
|
33
|
+
publicInputs: PublicInputsType;
|
|
34
|
+
/** The private IVC proof optimized for user devices. It will be consumed by an Aztec prover,
|
|
35
|
+
* which recursively verifies it through the "tube" circuit.*/
|
|
36
|
+
clientIvcProof: ClientIvcProof;
|
|
37
|
+
verificationKey: VerificationKeyAsFields;
|
|
38
|
+
/**
|
|
39
|
+
* The trace the clientIvcProof corresponds to.
|
|
40
|
+
* A trace of app circuits interleaved with private kernel circuits.
|
|
41
|
+
* If simulate is ran with profiling mode, also includes gate counts.
|
|
42
|
+
*/
|
|
43
|
+
executionSteps: PrivateExecutionStep[];
|
|
44
|
+
}
|
|
@@ -1,31 +1,22 @@
|
|
|
1
1
|
import type { WitnessMap } from '@aztec/noir-acvm_js';
|
|
2
2
|
|
|
3
|
-
import type { ClientIvcProof } from '../proofs/client_ivc_proof.js';
|
|
4
3
|
import type { VerificationKeyAsFields } from '../vks/verification_key.js';
|
|
5
4
|
import type { PrivateKernelCircuitPublicInputs } from './private_kernel_circuit_public_inputs.js';
|
|
6
|
-
import type { PrivateKernelProverProfileResult } from './private_kernel_prover_profile_result.js';
|
|
7
5
|
import type { PrivateKernelTailCircuitPublicInputs } from './private_kernel_tail_circuit_public_inputs.js';
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* Represents the output of the proof creation process for init and inner private kernel circuit.
|
|
11
9
|
* Contains the public inputs required for the init and inner private kernel circuit and the generated proof.
|
|
12
10
|
*/
|
|
13
|
-
export
|
|
11
|
+
export interface PrivateKernelSimulateOutput<
|
|
14
12
|
PublicInputsType extends PrivateKernelCircuitPublicInputs | PrivateKernelTailCircuitPublicInputs,
|
|
15
|
-
>
|
|
13
|
+
> {
|
|
16
14
|
/** The public inputs required for the proof generation process. */
|
|
17
15
|
publicInputs: PublicInputsType;
|
|
18
|
-
|
|
19
|
-
clientIvcProof?: ClientIvcProof;
|
|
20
|
-
|
|
21
|
-
verificationKey: VerificationKeyAsFields;
|
|
22
|
-
|
|
23
16
|
outputWitness: WitnessMap;
|
|
24
|
-
|
|
17
|
+
verificationKey: VerificationKeyAsFields;
|
|
25
18
|
bytecode: Buffer;
|
|
26
|
-
|
|
27
|
-
profileResult?: PrivateKernelProverProfileResult;
|
|
28
|
-
};
|
|
19
|
+
}
|
|
29
20
|
|
|
30
21
|
/**
|
|
31
22
|
* Represents the output of the circuit simulation process for init and inner private kernel circuit.
|