@aztec/stdlib 0.81.0 → 0.82.0

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.
Files changed (117) hide show
  1. package/dest/abi/abi.d.ts +5 -1
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +2 -1
  4. package/dest/auth_witness/auth_witness.d.ts +21 -0
  5. package/dest/auth_witness/auth_witness.d.ts.map +1 -1
  6. package/dest/auth_witness/auth_witness.js +29 -0
  7. package/dest/block/index.d.ts +0 -1
  8. package/dest/block/index.d.ts.map +1 -1
  9. package/dest/block/index.js +0 -1
  10. package/dest/block/l2_block_downloader/l2_block_stream.d.ts.map +1 -1
  11. package/dest/block/l2_block_downloader/l2_block_stream.js +0 -2
  12. package/dest/block/l2_block_source.d.ts +6 -0
  13. package/dest/block/l2_block_source.d.ts.map +1 -1
  14. package/dest/contract/interfaces/contract_data_source.d.ts +0 -5
  15. package/dest/contract/interfaces/contract_data_source.d.ts.map +1 -1
  16. package/dest/database-version/version_manager.d.ts +5 -0
  17. package/dest/database-version/version_manager.d.ts.map +1 -1
  18. package/dest/database-version/version_manager.js +7 -0
  19. package/dest/interfaces/archiver.d.ts +1 -2
  20. package/dest/interfaces/archiver.d.ts.map +1 -1
  21. package/dest/interfaces/archiver.js +1 -3
  22. package/dest/interfaces/aztec-node-admin.d.ts +20 -0
  23. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -0
  24. package/dest/interfaces/aztec-node-admin.js +16 -0
  25. package/dest/interfaces/aztec-node.d.ts +8 -38
  26. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  27. package/dest/interfaces/aztec-node.js +4 -12
  28. package/dest/interfaces/client.d.ts +1 -0
  29. package/dest/interfaces/client.d.ts.map +1 -1
  30. package/dest/interfaces/client.js +1 -0
  31. package/dest/interfaces/private_kernel_prover.d.ts +2 -3
  32. package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
  33. package/dest/interfaces/prover-node.d.ts +1 -2
  34. package/dest/interfaces/prover-node.d.ts.map +1 -1
  35. package/dest/interfaces/prover-node.js +5 -4
  36. package/dest/interfaces/pxe.d.ts +21 -39
  37. package/dest/interfaces/pxe.d.ts.map +1 -1
  38. package/dest/interfaces/pxe.js +10 -9
  39. package/dest/kernel/index.d.ts +1 -1
  40. package/dest/kernel/index.d.ts.map +1 -1
  41. package/dest/kernel/index.js +1 -1
  42. package/dest/kernel/private_kernel_prover_output.d.ts +49 -0
  43. package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -0
  44. package/dest/kernel/private_kernel_prover_output.js +8 -0
  45. package/dest/kernel/private_kernel_simulated_output.d.ts +3 -7
  46. package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
  47. package/dest/logs/log_with_tx_data.js +2 -2
  48. package/dest/noir/index.d.ts +5 -1
  49. package/dest/noir/index.d.ts.map +1 -1
  50. package/dest/proofs/client_ivc_proof.d.ts +1 -2
  51. package/dest/proofs/client_ivc_proof.d.ts.map +1 -1
  52. package/dest/proofs/client_ivc_proof.js +6 -9
  53. package/dest/rollup/tube_inputs.d.ts +7 -2
  54. package/dest/rollup/tube_inputs.d.ts.map +1 -1
  55. package/dest/rollup/tube_inputs.js +10 -4
  56. package/dest/trees/nullifier_membership_witness.d.ts +4 -0
  57. package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
  58. package/dest/trees/nullifier_membership_witness.js +10 -0
  59. package/dest/trees/public_data_witness.d.ts +5 -5
  60. package/dest/trees/public_data_witness.d.ts.map +1 -1
  61. package/dest/trees/public_data_witness.js +13 -0
  62. package/dest/tx/index.d.ts +2 -0
  63. package/dest/tx/index.d.ts.map +1 -1
  64. package/dest/tx/index.js +2 -0
  65. package/dest/tx/private_execution_result.d.ts +4 -0
  66. package/dest/tx/private_execution_result.d.ts.map +1 -1
  67. package/dest/tx/private_execution_result.js +5 -0
  68. package/dest/tx/profiled_tx.d.ts +9 -0
  69. package/dest/tx/profiled_tx.d.ts.map +1 -0
  70. package/dest/tx/profiled_tx.js +27 -0
  71. package/dest/tx/proven_tx.d.ts +33 -0
  72. package/dest/tx/proven_tx.d.ts.map +1 -0
  73. package/dest/tx/proven_tx.js +35 -0
  74. package/dest/tx/simulated_tx.d.ts +8 -44
  75. package/dest/tx/simulated_tx.d.ts.map +1 -1
  76. package/dest/tx/simulated_tx.js +17 -40
  77. package/dest/tx/tx_receipt.d.ts +1 -30
  78. package/dest/tx/tx_receipt.d.ts.map +1 -1
  79. package/dest/tx/tx_receipt.js +3 -13
  80. package/package.json +6 -7
  81. package/src/abi/abi.ts +7 -2
  82. package/src/auth_witness/auth_witness.ts +29 -0
  83. package/src/block/index.ts +0 -1
  84. package/src/block/l2_block_downloader/l2_block_stream.ts +0 -2
  85. package/src/block/l2_block_source.ts +7 -0
  86. package/src/contract/interfaces/contract_data_source.ts +0 -6
  87. package/src/database-version/version_manager.ts +10 -0
  88. package/src/interfaces/archiver.ts +2 -8
  89. package/src/interfaces/aztec-node-admin.ts +39 -0
  90. package/src/interfaces/aztec-node.ts +9 -71
  91. package/src/interfaces/client.ts +1 -0
  92. package/src/interfaces/private_kernel_prover.ts +2 -3
  93. package/src/interfaces/prover-node.ts +2 -4
  94. package/src/interfaces/pxe.ts +34 -56
  95. package/src/kernel/index.ts +1 -1
  96. package/src/kernel/private_kernel_prover_output.ts +44 -0
  97. package/src/kernel/private_kernel_simulated_output.ts +4 -13
  98. package/src/logs/log_with_tx_data.ts +2 -2
  99. package/src/noir/index.ts +6 -1
  100. package/src/proofs/client_ivc_proof.ts +5 -15
  101. package/src/rollup/tube_inputs.ts +8 -4
  102. package/src/trees/nullifier_membership_witness.ts +12 -0
  103. package/src/trees/public_data_witness.ts +15 -0
  104. package/src/tx/index.ts +2 -0
  105. package/src/tx/private_execution_result.ts +7 -0
  106. package/src/tx/profiled_tx.ts +27 -0
  107. package/src/tx/proven_tx.ts +58 -0
  108. package/src/tx/simulated_tx.ts +11 -63
  109. package/src/tx/tx_receipt.ts +0 -36
  110. package/dest/block/nullifier_with_block_source.d.ts +0 -6
  111. package/dest/block/nullifier_with_block_source.d.ts.map +0 -1
  112. package/dest/block/nullifier_with_block_source.js +0 -1
  113. package/dest/kernel/private_kernel_prover_profile_result.d.ts +0 -25
  114. package/dest/kernel/private_kernel_prover_profile_result.d.ts.map +0 -1
  115. package/dest/kernel/private_kernel_prover_profile_result.js +0 -7
  116. package/src/block/nullifier_with_block_source.ts +0 -7
  117. package/src/kernel/private_kernel_prover_profile_result.ts +0 -7
@@ -20,12 +20,6 @@ export interface ContractDataSource {
20
20
 
21
21
  getBytecodeCommitment(id: Fr): Promise<Fr | undefined>;
22
22
 
23
- /**
24
- * Adds a contract class to the database.
25
- * TODO(#10007): Remove this method
26
- */
27
- addContractClass(contractClass: ContractClassPublic): Promise<void>;
28
-
29
23
  /**
30
24
  * Returns a publicly deployed contract instance given its address.
31
25
  * @param address - Address of the deployed contract.
@@ -3,6 +3,7 @@ import { jsonParseWithSchemaSync, jsonStringify } from '@aztec/foundation/json-r
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
 
5
5
  import fs from 'fs/promises';
6
+ import { inspect } from 'node:util';
6
7
  import { join } from 'path';
7
8
  import { z } from 'zod';
8
9
 
@@ -59,6 +60,15 @@ export class DatabaseVersion {
59
60
  .transform(({ schemaVersion, rollupAddress }) => new DatabaseVersion(schemaVersion, rollupAddress));
60
61
  }
61
62
 
63
+ /** Allows for better introspection. */
64
+ public [inspect.custom](): string {
65
+ return this.toString();
66
+ }
67
+
68
+ public toString(): string {
69
+ return this.schemaVersion.toString();
70
+ }
71
+
62
72
  /**
63
73
  * Returns an empty instance
64
74
  */
@@ -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 & NullifierWithBlockSource,
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,8 +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
- // TODO(#10007): Remove this method
80
- addContractClass: z.function().args(ContractClassPublicSchema).returns(z.void()),
81
75
  getContractFunctionName: z
82
76
  .function()
83
77
  .args(schemas.AztecAddress, schemas.FunctionSelector)
@@ -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
- * @param blockNumber - The block number at which to get the data or 'latest' for latest data
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 indexes of the given leaves in the given tree or undefined if not found.
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
- getPublicDataTreeWitness(blockNumber: L2BlockNumber, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
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: number): Promise<L2Block | undefined>;
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
- getPublicDataTreeWitness: z
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(z.number()).returns(L2Block.schema.optional()),
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(
@@ -1,4 +1,5 @@
1
1
  export * from './pxe.js';
2
2
  export * from './aztec-node.js';
3
+ export * from './aztec-node-admin.js';
3
4
  export * from './private_kernel_prover.js';
4
5
  export * from './get_logs_response.js';
@@ -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(acirs: Buffer[], witnessStack: WitnessMap[]): Promise<ClientIvcProof>;
103
+ createClientIvcProof(executionSteps: PrivateExecutionStep[]): Promise<ClientIvcProof>;
105
104
 
106
105
  /**
107
106
  * Compute the gate count for a given circuit.
@@ -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
  };
@@ -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
- PrivateExecutionResult,
34
- Tx,
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
- * Creates a proving result based on the provided preauthenticated execution request and the results
170
- * of executing the private part of the transaction. This will assemble the zero-knowledge proof for the private execution.
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 transaction ready to be sent to the network for execution.
176
- * @throws If the code for the functions executed in this transaction has not been made available via `addContracts`.
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 profile - (Optional) If true, will run the private kernel prover with profiling enabled and include the result (gate count) in TxSimulationResult.
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 has not been made available via `addContracts`.
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
  )
@@ -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 type PrivateKernelSimulateOutput<
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.
@@ -1,8 +1,8 @@
1
1
  import { MAX_NOTE_HASHES_PER_TX, PUBLIC_LOG_DATA_SIZE_IN_FIELDS } from '@aztec/constants';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
 
4
- // TypeScript representation of the Noir aztec::oracle::note_discovery::LogWithTxData struct. This is used as a response
5
- // for PXE's custom getLogByTag oracle.
4
+ // TypeScript representation of the Noir aztec::oracle::message_discovery::LogWithTxData struct. This is used as a
5
+ // response for PXE's custom getLogByTag oracle.
6
6
  export class LogWithTxData {
7
7
  constructor(
8
8
  public logContent: Fr[],
package/src/noir/index.ts CHANGED
@@ -75,7 +75,7 @@ export interface NoirCompiledContract {
75
75
  }
76
76
 
77
77
  /**
78
- * The compilation result of an Aztec.nr contract.
78
+ * The compilation result of a protocol (non-contract) circuit.
79
79
  */
80
80
  export interface NoirCompiledCircuit {
81
81
  /** The hash of the circuit. */
@@ -92,6 +92,11 @@ export interface NoirCompiledCircuit {
92
92
  file_map: DebugFileMap;
93
93
  }
94
94
 
95
+ export interface NoirCompiledCircuitWithName extends NoirCompiledCircuit {
96
+ /** The name of the circuit. */
97
+ name: string;
98
+ }
99
+
95
100
  /**
96
101
  * The debug metadata of an Aztec.nr contract.
97
102
  */