@aztec/stdlib 3.0.0-devnet.2 → 3.0.0-manual.20251030

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 (105) hide show
  1. package/dest/block/l2_block_source.d.ts +5 -5
  2. package/dest/block/l2_block_source.d.ts.map +1 -1
  3. package/dest/interfaces/archiver.js +3 -3
  4. package/dest/interfaces/epoch-prover.d.ts +3 -3
  5. package/dest/interfaces/epoch-prover.d.ts.map +1 -1
  6. package/dest/interfaces/private_kernel_prover.d.ts +2 -2
  7. package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
  8. package/dest/interfaces/proving-job.d.ts +15 -15
  9. package/dest/interfaces/proving-job.d.ts.map +1 -1
  10. package/dest/interfaces/proving-job.js +8 -8
  11. package/dest/interfaces/server_circuit_prover.d.ts +3 -3
  12. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  13. package/dest/kernel/private_kernel_data.js +2 -2
  14. package/dest/kernel/private_kernel_prover_output.d.ts +4 -4
  15. package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
  16. package/dest/keys/derivation.d.ts.map +1 -1
  17. package/dest/keys/derivation.js +2 -3
  18. package/dest/logs/directional_app_tagging_secret.d.ts.map +1 -1
  19. package/dest/logs/directional_app_tagging_secret.js +1 -2
  20. package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
  21. package/dest/logs/shared_secret_derivation.js +2 -4
  22. package/dest/p2p/gossipable.d.ts +4 -12
  23. package/dest/p2p/gossipable.d.ts.map +1 -1
  24. package/dest/p2p/gossipable.js +4 -7
  25. package/dest/p2p/topic_type.d.ts +4 -8
  26. package/dest/p2p/topic_type.d.ts.map +1 -1
  27. package/dest/p2p/topic_type.js +14 -8
  28. package/dest/proofs/chonk_proof.d.ts +28 -0
  29. package/dest/proofs/chonk_proof.d.ts.map +1 -0
  30. package/dest/proofs/{client_ivc_proof.js → chonk_proof.js} +22 -21
  31. package/dest/proofs/index.d.ts +1 -1
  32. package/dest/proofs/index.d.ts.map +1 -1
  33. package/dest/proofs/index.js +1 -1
  34. package/dest/proofs/proof_data.d.ts +2 -2
  35. package/dest/proofs/proof_data.d.ts.map +1 -1
  36. package/dest/proofs/proving_request_type.d.ts +1 -1
  37. package/dest/proofs/proving_request_type.d.ts.map +1 -1
  38. package/dest/proofs/proving_request_type.js +1 -1
  39. package/dest/rollup/index.d.ts +2 -2
  40. package/dest/rollup/index.d.ts.map +1 -1
  41. package/dest/rollup/index.js +2 -2
  42. package/dest/rollup/private_tx_base_rollup_private_inputs.d.ts +4 -4
  43. package/dest/rollup/private_tx_base_rollup_private_inputs.d.ts.map +1 -1
  44. package/dest/rollup/public_chonk_verifier_private_inputs.d.ts +21 -0
  45. package/dest/rollup/public_chonk_verifier_private_inputs.d.ts.map +1 -0
  46. package/dest/rollup/{public_tube_private_inputs.js → public_chonk_verifier_private_inputs.js} +7 -6
  47. package/dest/rollup/{public_tube_public_inputs.d.ts → public_chonk_verifier_public_inputs.d.ts} +7 -7
  48. package/dest/rollup/public_chonk_verifier_public_inputs.d.ts.map +1 -0
  49. package/dest/rollup/{public_tube_public_inputs.js → public_chonk_verifier_public_inputs.js} +7 -6
  50. package/dest/rollup/public_tx_base_rollup_private_inputs.d.ts +4 -4
  51. package/dest/rollup/public_tx_base_rollup_private_inputs.d.ts.map +1 -1
  52. package/dest/rollup/public_tx_base_rollup_private_inputs.js +6 -6
  53. package/dest/stats/stats.d.ts +3 -3
  54. package/dest/stats/stats.d.ts.map +1 -1
  55. package/dest/tests/factories.d.ts +3 -3
  56. package/dest/tests/factories.d.ts.map +1 -1
  57. package/dest/tests/factories.js +13 -12
  58. package/dest/tests/mocks.d.ts +3 -3
  59. package/dest/tests/mocks.d.ts.map +1 -1
  60. package/dest/tests/mocks.js +3 -3
  61. package/dest/tx/processed_tx.d.ts +2 -2
  62. package/dest/tx/processed_tx.d.ts.map +1 -1
  63. package/dest/tx/processed_tx.js +2 -2
  64. package/dest/tx/proven_tx.d.ts +7 -7
  65. package/dest/tx/proven_tx.d.ts.map +1 -1
  66. package/dest/tx/proven_tx.js +8 -8
  67. package/dest/tx/simulated_tx.js +2 -2
  68. package/dest/tx/tx.d.ts +3 -3
  69. package/dest/tx/tx.d.ts.map +1 -1
  70. package/dest/tx/tx.js +13 -13
  71. package/package.json +8 -8
  72. package/src/block/l2_block_source.ts +5 -5
  73. package/src/interfaces/archiver.ts +3 -3
  74. package/src/interfaces/epoch-prover.ts +3 -3
  75. package/src/interfaces/private_kernel_prover.ts +2 -2
  76. package/src/interfaces/proving-job.ts +13 -10
  77. package/src/interfaces/server_circuit_prover.ts +7 -5
  78. package/src/kernel/private_kernel_data.ts +2 -2
  79. package/src/kernel/private_kernel_prover_output.ts +4 -4
  80. package/src/keys/derivation.ts +2 -3
  81. package/src/logs/directional_app_tagging_secret.ts +1 -2
  82. package/src/logs/shared_secret_derivation.ts +2 -4
  83. package/src/p2p/gossipable.ts +4 -12
  84. package/src/p2p/topic_type.ts +15 -8
  85. package/src/proofs/{client_ivc_proof.ts → chonk_proof.ts} +25 -24
  86. package/src/proofs/index.ts +1 -1
  87. package/src/proofs/proof_data.ts +2 -2
  88. package/src/proofs/proving_request_type.ts +1 -1
  89. package/src/rollup/index.ts +2 -2
  90. package/src/rollup/private_tx_base_rollup_private_inputs.ts +2 -2
  91. package/src/rollup/{public_tube_private_inputs.ts → public_chonk_verifier_private_inputs.ts} +11 -10
  92. package/src/rollup/{public_tube_public_inputs.ts → public_chonk_verifier_public_inputs.ts} +9 -8
  93. package/src/rollup/public_tx_base_rollup_private_inputs.ts +4 -4
  94. package/src/stats/stats.ts +3 -3
  95. package/src/tests/factories.ts +18 -17
  96. package/src/tests/mocks.ts +4 -4
  97. package/src/tx/processed_tx.ts +4 -4
  98. package/src/tx/proven_tx.ts +6 -6
  99. package/src/tx/simulated_tx.ts +2 -2
  100. package/src/tx/tx.ts +11 -11
  101. package/dest/proofs/client_ivc_proof.d.ts +0 -28
  102. package/dest/proofs/client_ivc_proof.d.ts.map +0 -1
  103. package/dest/rollup/public_tube_private_inputs.d.ts +0 -21
  104. package/dest/rollup/public_tube_private_inputs.d.ts.map +0 -1
  105. package/dest/rollup/public_tube_public_inputs.d.ts.map +0 -1
@@ -51,10 +51,10 @@ export interface EpochProver extends Omit<IBlockFactory, 'setBlockCompleted' | '
51
51
  startNewBlock(blockNumber: number, timestamp: UInt64, totalNumTxs: number): Promise<void>;
52
52
 
53
53
  /**
54
- * Kickstarts tube circuits for the specified txs. These will be used during epoch proving.
55
- * Note that if the tube circuits are not started this way, they will be started nontheless after processing.
54
+ * Kickstarts chonk verifier circuits for the specified txs. These will be used during epoch proving.
55
+ * Note that if the chonk verifier circuits are not started this way, they will be started nonetheless after processing.
56
56
  */
57
- startTubeCircuits(txs: Tx[]): Promise<void>;
57
+ startChonkVerifierCircuits(txs: Tx[]): Promise<void>;
58
58
 
59
59
  /** Returns the block. */
60
60
  setBlockCompleted(blockNumber: number, expectedBlockHeader?: BlockHeader): Promise<BlockHeader>;
@@ -10,7 +10,7 @@ import type {
10
10
  PrivateKernelTailCircuitPrivateInputs,
11
11
  PrivateKernelTailCircuitPublicInputs,
12
12
  } from '../kernel/index.js';
13
- import type { ClientIvcProofWithPublicInputs } from '../proofs/client_ivc_proof.js';
13
+ import type { ChonkProofWithPublicInputs } from '../proofs/chonk_proof.js';
14
14
 
15
15
  /**
16
16
  * PrivateKernelProver provides functionality to simulate and validate circuits, and retrieve
@@ -110,7 +110,7 @@ export interface PrivateKernelProver {
110
110
  * @param acirs The program bytecode.
111
111
  * @param witnessStack The witnessses for each program bytecode.
112
112
  */
113
- createClientIvcProof(executionSteps: PrivateExecutionStep[]): Promise<ClientIvcProofWithPublicInputs>;
113
+ createChonkProof(executionSteps: PrivateExecutionStep[]): Promise<ChonkProofWithPublicInputs>;
114
114
 
115
115
  /**
116
116
  * Compute the gate count for a given circuit.
@@ -32,8 +32,8 @@ import {
32
32
  CheckpointRootSingleBlockRollupPrivateInputs,
33
33
  } from '../rollup/checkpoint_root_rollup_private_inputs.js';
34
34
  import { PrivateTxBaseRollupPrivateInputs } from '../rollup/private_tx_base_rollup_private_inputs.js';
35
- import { PublicTubePrivateInputs } from '../rollup/public_tube_private_inputs.js';
36
- import { PublicTubePublicInputs } from '../rollup/public_tube_public_inputs.js';
35
+ import { PublicChonkVerifierPrivateInputs } from '../rollup/public_chonk_verifier_private_inputs.js';
36
+ import { PublicChonkVerifierPublicInputs } from '../rollup/public_chonk_verifier_public_inputs.js';
37
37
  import { PublicTxBaseRollupPrivateInputs } from '../rollup/public_tx_base_rollup_private_inputs.js';
38
38
  import { RootRollupPrivateInputs } from '../rollup/root_rollup_private_inputs.js';
39
39
  import { RootRollupPublicInputs } from '../rollup/root_rollup_public_inputs.js';
@@ -91,7 +91,10 @@ export const ProvingJobInputs = z.discriminatedUnion('type', [
91
91
  AvmProvingRequestSchema,
92
92
  z.object({ type: z.literal(ProvingRequestType.PARITY_BASE), inputs: ParityBasePrivateInputs.schema }),
93
93
  z.object({ type: z.literal(ProvingRequestType.PARITY_ROOT), inputs: ParityRootPrivateInputs.schema }),
94
- z.object({ type: z.literal(ProvingRequestType.PUBLIC_TUBE), inputs: PublicTubePrivateInputs.schema }),
94
+ z.object({
95
+ type: z.literal(ProvingRequestType.PUBLIC_CHONK_VERIFIER),
96
+ inputs: PublicChonkVerifierPrivateInputs.schema,
97
+ }),
95
98
  z.object({
96
99
  type: z.literal(ProvingRequestType.PRIVATE_TX_BASE_ROLLUP),
97
100
  inputs: PrivateTxBaseRollupPrivateInputs.schema,
@@ -142,8 +145,8 @@ export function getProvingJobInputClassFor(type: ProvingRequestType) {
142
145
  switch (type) {
143
146
  case ProvingRequestType.PUBLIC_VM:
144
147
  return AvmCircuitInputs;
145
- case ProvingRequestType.PUBLIC_TUBE:
146
- return PublicTubePrivateInputs;
148
+ case ProvingRequestType.PUBLIC_CHONK_VERIFIER:
149
+ return PublicChonkVerifierPrivateInputs;
147
150
  case ProvingRequestType.PRIVATE_TX_BASE_ROLLUP:
148
151
  return PrivateTxBaseRollupPrivateInputs;
149
152
  case ProvingRequestType.PUBLIC_TX_BASE_ROLLUP:
@@ -187,7 +190,7 @@ export type ProvingJobInputs = z.infer<typeof ProvingJobInputs>;
187
190
 
188
191
  export type ProvingJobInputsMap = {
189
192
  [ProvingRequestType.PUBLIC_VM]: AvmCircuitInputs;
190
- [ProvingRequestType.PUBLIC_TUBE]: PublicTubePrivateInputs;
193
+ [ProvingRequestType.PUBLIC_CHONK_VERIFIER]: PublicChonkVerifierPrivateInputs;
191
194
  [ProvingRequestType.PRIVATE_TX_BASE_ROLLUP]: PrivateTxBaseRollupPrivateInputs;
192
195
  [ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: PublicTxBaseRollupPrivateInputs;
193
196
  [ProvingRequestType.TX_MERGE_ROLLUP]: TxMergeRollupPrivateInputs;
@@ -212,9 +215,9 @@ export const ProvingJobResult = z.discriminatedUnion('type', [
212
215
  result: schemaForRecursiveProofAndVerificationKey(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED),
213
216
  }),
214
217
  z.object({
215
- type: z.literal(ProvingRequestType.PUBLIC_TUBE),
218
+ type: z.literal(ProvingRequestType.PUBLIC_CHONK_VERIFIER),
216
219
  result: schemaForPublicInputsAndRecursiveProof(
217
- PublicTubePublicInputs.schema,
220
+ PublicChonkVerifierPublicInputs.schema,
218
221
  NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
219
222
  ),
220
223
  }),
@@ -325,8 +328,8 @@ export const ProvingJobResult = z.discriminatedUnion('type', [
325
328
  export type ProvingJobResult = z.infer<typeof ProvingJobResult>;
326
329
  export type ProvingJobResultsMap = {
327
330
  [ProvingRequestType.PUBLIC_VM]: ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>;
328
- [ProvingRequestType.PUBLIC_TUBE]: PublicInputsAndRecursiveProof<
329
- PublicTubePublicInputs,
331
+ [ProvingRequestType.PUBLIC_CHONK_VERIFIER]: PublicInputsAndRecursiveProof<
332
+ PublicChonkVerifierPublicInputs,
330
333
  typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
331
334
  >;
332
335
  [ProvingRequestType.PRIVATE_TX_BASE_ROLLUP]: PublicInputsAndRecursiveProof<
@@ -26,8 +26,8 @@ import type {
26
26
  CheckpointRootSingleBlockRollupPrivateInputs,
27
27
  } from '../rollup/checkpoint_root_rollup_private_inputs.js';
28
28
  import type { PrivateTxBaseRollupPrivateInputs } from '../rollup/private_tx_base_rollup_private_inputs.js';
29
- import type { PublicTubePrivateInputs } from '../rollup/public_tube_private_inputs.js';
30
- import type { PublicTubePublicInputs } from '../rollup/public_tube_public_inputs.js';
29
+ import type { PublicChonkVerifierPrivateInputs } from '../rollup/public_chonk_verifier_private_inputs.js';
30
+ import type { PublicChonkVerifierPublicInputs } from '../rollup/public_chonk_verifier_public_inputs.js';
31
31
  import type { PublicTxBaseRollupPrivateInputs } from '../rollup/public_tx_base_rollup_private_inputs.js';
32
32
  import type { RootRollupPrivateInputs } from '../rollup/root_rollup_private_inputs.js';
33
33
  import type { RootRollupPublicInputs } from '../rollup/root_rollup_public_inputs.js';
@@ -60,11 +60,13 @@ export interface ServerCircuitProver {
60
60
  epochNumber?: number,
61
61
  ): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>>;
62
62
 
63
- getPublicTubeProof(
64
- inputs: PublicTubePrivateInputs,
63
+ getPublicChonkVerifierProof(
64
+ inputs: PublicChonkVerifierPrivateInputs,
65
65
  signal?: AbortSignal,
66
66
  epochNumber?: number,
67
- ): Promise<PublicInputsAndRecursiveProof<PublicTubePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
67
+ ): Promise<
68
+ PublicInputsAndRecursiveProof<PublicChonkVerifierPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
69
+ >;
68
70
 
69
71
  /**
70
72
  * Creates a proof for the given input.
@@ -7,8 +7,8 @@ import { PrivateKernelCircuitPublicInputs } from './private_kernel_circuit_publi
7
7
  * Data of the previous kernel iteration in the chain of kernels.
8
8
  */
9
9
  export class PrivateKernelData {
10
- // NOTE: as of move to honk and client IVC, previous private kernels no longer come with their proof
11
- // as we do client IVC not recursive verification. We need to ensure the public inputs here is properly constrained, TODO(https://github.com/AztecProtocol/barretenberg/issues/1048)
10
+ // NOTE: as of move to honk and chonk, previous private kernels no longer come with their proof
11
+ // as we do chonk not recursive verification. We need to ensure the public inputs here is properly constrained, TODO(https://github.com/AztecProtocol/barretenberg/issues/1048)
12
12
  constructor(
13
13
  /**
14
14
  * Public inputs of the previous kernel.
@@ -5,7 +5,7 @@ import { serializeWitness } from '@aztec/noir-noirc_abi';
5
5
  import { Encoder } from 'msgpackr';
6
6
  import { z } from 'zod';
7
7
 
8
- import type { ClientIvcProof } from '../proofs/client_ivc_proof.js';
8
+ import type { ChonkProof } from '../proofs/chonk_proof.js';
9
9
  import type { PrivateKernelCircuitPublicInputs } from './private_kernel_circuit_public_inputs.js';
10
10
  import type { PrivateKernelTailCircuitPublicInputs } from './private_kernel_tail_circuit_public_inputs.js';
11
11
 
@@ -45,10 +45,10 @@ export interface PrivateKernelExecutionProofOutput<
45
45
  /** The public inputs used by the proof generation process. */
46
46
  publicInputs: PublicInputsType;
47
47
  /** The private IVC proof optimized for user devices. It will be consumed by an Aztec prover,
48
- * which recursively verifies it through the "private tx base" or the "public tube" circuit.*/
49
- clientIvcProof: ClientIvcProof;
48
+ * which recursively verifies it through the "private tx base" or the "public chonk verifier" circuit.*/
49
+ chonkProof: ChonkProof;
50
50
  /**
51
- * The trace the clientIvcProof corresponds to.
51
+ * The trace the chonkProof corresponds to.
52
52
  * A trace of app circuits interleaved with private kernel circuits.
53
53
  * If simulate is ran with profiling mode, also includes gate counts.
54
54
  */
@@ -50,7 +50,7 @@ export async function computeAddress(publicKeys: PublicKeys, partialAddress: Fr)
50
50
  // 2. addressPoint = (preaddress * G) + ivpk_m
51
51
  // 3. address = addressPoint.x
52
52
  const preaddress = await computePreaddress(await publicKeys.hash(), partialAddress);
53
- const address = await new Grumpkin().add(
53
+ const address = await Grumpkin.add(
54
54
  await derivePublicKeyFromSecretKey(new Fq(preaddress.toBigInt())),
55
55
  publicKeys.masterIncomingViewingPublicKey,
56
56
  );
@@ -81,8 +81,7 @@ export async function computeAddressSecret(preaddress: Fr, ivsk: Fq) {
81
81
  }
82
82
 
83
83
  export function derivePublicKeyFromSecretKey(secretKey: Fq) {
84
- const curve = new Grumpkin();
85
- return curve.mul(curve.generator(), secretKey);
84
+ return Grumpkin.mul(Grumpkin.generator, secretKey);
86
85
  }
87
86
 
88
87
  /**
@@ -63,14 +63,13 @@ async function computeSharedTaggingSecret(
63
63
  const knownPreaddress = await computePreaddress(await localAddress.publicKeys.hash(), localAddress.partialAddress);
64
64
  // TODO: #8970 - Computation of address point from x coordinate might fail
65
65
  const externalAddressPoint = await externalAddress.toAddressPoint();
66
- const curve = new Grumpkin();
67
66
  // Given A (local complete address) -> B (external address) and h == preaddress
68
67
  // Compute shared secret as S = (h_A + local_ivsk_A) * Addr_Point_B
69
68
 
70
69
  // Beware! h_a + local_ivsk_a (also known as the address secret) can lead to an address point with a negative
71
70
  // y-coordinate, since there's two possible candidates computeAddressSecret takes care of selecting the one that
72
71
  // leads to a positive y-coordinate, which is the only valid address point
73
- return curve.mul(externalAddressPoint, await computeAddressSecret(knownPreaddress, localIvsk));
72
+ return Grumpkin.mul(externalAddressPoint, await computeAddressSecret(knownPreaddress, localIvsk));
74
73
  }
75
74
 
76
75
  export const DirectionalAppTaggingSecretSchema = z.object({
@@ -16,13 +16,11 @@ import type { PublicKey } from '../keys/public_key.js';
16
16
  * TODO(#12656): This function is kept around because of the utilityGetSharedSecret oracle. Nuke this once returning
17
17
  * the app-siloed secret.
18
18
  */
19
- export async function deriveEcdhSharedSecret(secretKey: GrumpkinScalar, publicKey: PublicKey): Promise<Point> {
19
+ export function deriveEcdhSharedSecret(secretKey: GrumpkinScalar, publicKey: PublicKey): Promise<Point> {
20
20
  if (publicKey.isZero()) {
21
21
  throw new Error(
22
22
  `Attempting to derive a shared secret with a zero public key. You have probably passed a zero public key in your Noir code somewhere thinking that the note won't be broadcast... but it was.`,
23
23
  );
24
24
  }
25
- const curve = new Grumpkin();
26
- const sharedSecret = await curve.mul(publicKey, secretKey);
27
- return sharedSecret;
25
+ return Grumpkin.mul(publicKey, secretKey);
28
26
  }
@@ -28,15 +28,12 @@ export class P2PMessage {
28
28
  */
29
29
  export abstract class Gossipable {
30
30
  private cachedId: Buffer32 | undefined;
31
- /** p2p Topic
32
- *
33
- * - The p2p topic identifier, this determines how the message is handled
34
- */
31
+ /** The p2p topic identifier, this determines how the message is handled */
35
32
  static p2pTopic: TopicType;
36
33
 
37
- /** p2p Message Identifier
38
- *
39
- * - A digest of the message information, this key is used for deduplication
34
+ /**
35
+ * A digest of the message information **used for logging only**.
36
+ * The identifier used for deduplication is `getMsgIdFn` as defined in `encoding.ts` which is a hash over topic and data.
40
37
  */
41
38
  async p2pMessageIdentifier(): Promise<Buffer32> {
42
39
  if (this.cachedId) {
@@ -48,10 +45,6 @@ export abstract class Gossipable {
48
45
 
49
46
  abstract generateP2PMessageIdentifier(): Promise<Buffer32>;
50
47
 
51
- /** To Buffer
52
- *
53
- * - Serialization method
54
- */
55
48
  abstract toBuffer(): Buffer;
56
49
 
57
50
  toMessage(): Buffer {
@@ -60,7 +53,6 @@ export abstract class Gossipable {
60
53
 
61
54
  /**
62
55
  * Get the size of the gossipable object.
63
- *
64
56
  * This is used for metrics recording.
65
57
  */
66
58
  abstract getSize(): number;
@@ -1,18 +1,25 @@
1
1
  import { P2PClientType } from './client_type.js';
2
2
 
3
- /** Create Topic String
4
- *
5
- * The topic channel identifier
6
- * @param topicType
7
- * @returns
3
+ /**
4
+ * Creates the topic channel identifier string from a given topic type
8
5
  */
9
6
  export function createTopicString(topicType: TopicType, protocolVersion: string) {
10
7
  return `/aztec/${TopicType[topicType]}/${protocolVersion}`;
11
8
  }
12
9
 
13
- /**
14
- *
15
- */
10
+ /** Extracts the topic type from a topic string */
11
+ export function getTopicFromString(topicStr: string): TopicType | undefined {
12
+ const parts = topicStr.split('/');
13
+ if (parts.length < 4 || parts[1] !== 'aztec') {
14
+ return undefined;
15
+ }
16
+ const topic = parts[2];
17
+ if (Object.values(TopicType).includes(topic as TopicType)) {
18
+ return topic as TopicType;
19
+ }
20
+ return undefined;
21
+ }
22
+
16
23
  export enum TopicType {
17
24
  tx = 'tx',
18
25
  block_proposal = 'block_proposal',
@@ -1,23 +1,24 @@
1
- import { CIVC_PROOF_LENGTH } from '@aztec/constants';
1
+ import { CHONK_PROOF_LENGTH } from '@aztec/constants';
2
2
  import { randomBytes } from '@aztec/foundation/crypto';
3
3
  import { Fr } from '@aztec/foundation/fields';
4
4
  import { bufferSchemaFor } from '@aztec/foundation/schemas';
5
5
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
6
6
 
7
- export class ClientIvcProof {
7
+ // CHONK: "Client Honk" - An UltraHonk variant with incremental folding and delayed non-native arithmetic.
8
+ export class ChonkProof {
8
9
  constructor(
9
10
  // The proof fields.
10
11
  // For native verification, attach public inputs via `attachPublicInputs(publicInputs)`.
11
12
  // Not using Tuple here due to the length being too high.
12
13
  public fields: Fr[],
13
14
  ) {
14
- if (fields.length !== CIVC_PROOF_LENGTH) {
15
- throw new Error(`Invalid ClientIvcProof length: ${fields.length}`);
15
+ if (fields.length !== CHONK_PROOF_LENGTH) {
16
+ throw new Error(`Invalid ChonkProof length: ${fields.length}`);
16
17
  }
17
18
  }
18
19
 
19
20
  public attachPublicInputs(publicInputs: Fr[]) {
20
- return new ClientIvcProofWithPublicInputs([...publicInputs, ...this.fields]);
21
+ return new ChonkProofWithPublicInputs([...publicInputs, ...this.fields]);
21
22
  }
22
23
 
23
24
  public isEmpty() {
@@ -25,22 +26,22 @@ export class ClientIvcProof {
25
26
  }
26
27
 
27
28
  static empty() {
28
- return new ClientIvcProof(new Array(CIVC_PROOF_LENGTH).fill(Fr.ZERO));
29
+ return new ChonkProof(new Array(CHONK_PROOF_LENGTH).fill(Fr.ZERO));
29
30
  }
30
31
 
31
32
  static random() {
32
33
  // NB: Not using Fr.random here because it slows down some tests that require a large number of txs significantly.
33
34
  const reducedFrSize = Fr.SIZE_IN_BYTES - 1;
34
- const randomFields = randomBytes(CIVC_PROOF_LENGTH * reducedFrSize);
35
+ const randomFields = randomBytes(CHONK_PROOF_LENGTH * reducedFrSize);
35
36
  const proof = Array.from(
36
- { length: CIVC_PROOF_LENGTH },
37
+ { length: CHONK_PROOF_LENGTH },
37
38
  (_, i) => new Fr(randomFields.subarray(i * reducedFrSize, (i + 1) * reducedFrSize)),
38
39
  );
39
- return new ClientIvcProof(proof);
40
+ return new ChonkProof(proof);
40
41
  }
41
42
 
42
43
  static get schema() {
43
- return bufferSchemaFor(ClientIvcProof);
44
+ return bufferSchemaFor(ChonkProof);
44
45
  }
45
46
 
46
47
  // We use this in tandem with the bufferSchemaFor to serialize to base64 strings.
@@ -48,11 +49,11 @@ export class ClientIvcProof {
48
49
  return this.toBuffer();
49
50
  }
50
51
 
51
- static fromBuffer(buffer: Buffer | BufferReader): ClientIvcProof {
52
+ static fromBuffer(buffer: Buffer | BufferReader): ChonkProof {
52
53
  const reader = BufferReader.asReader(buffer);
53
54
  const proofLength = reader.readNumber();
54
55
  const proof = reader.readArray(proofLength, Fr);
55
- return new ClientIvcProof(proof);
56
+ return new ChonkProof(proof);
56
57
  }
57
58
 
58
59
  public toBuffer() {
@@ -60,25 +61,25 @@ export class ClientIvcProof {
60
61
  }
61
62
  }
62
63
 
63
- export class ClientIvcProofWithPublicInputs {
64
+ export class ChonkProofWithPublicInputs {
64
65
  constructor(
65
66
  // The proof fields with public inputs.
66
67
  // For recursive verification, use without public inputs via `removePublicInputs()`.
67
68
  public fieldsWithPublicInputs: Fr[],
68
69
  ) {
69
- if (fieldsWithPublicInputs.length < CIVC_PROOF_LENGTH) {
70
- throw new Error(`Invalid ClientIvcProofWithPublicInputs length: ${fieldsWithPublicInputs.length}`);
70
+ if (fieldsWithPublicInputs.length < CHONK_PROOF_LENGTH) {
71
+ throw new Error(`Invalid ChonkProofWithPublicInputs length: ${fieldsWithPublicInputs.length}`);
71
72
  }
72
73
  }
73
74
 
74
75
  public getPublicInputs() {
75
- const numPublicInputs = this.fieldsWithPublicInputs.length - CIVC_PROOF_LENGTH;
76
+ const numPublicInputs = this.fieldsWithPublicInputs.length - CHONK_PROOF_LENGTH;
76
77
  return this.fieldsWithPublicInputs.slice(0, numPublicInputs);
77
78
  }
78
79
 
79
80
  public removePublicInputs() {
80
- const numPublicInputs = this.fieldsWithPublicInputs.length - CIVC_PROOF_LENGTH;
81
- return new ClientIvcProof(this.fieldsWithPublicInputs.slice(numPublicInputs));
81
+ const numPublicInputs = this.fieldsWithPublicInputs.length - CHONK_PROOF_LENGTH;
82
+ return new ChonkProof(this.fieldsWithPublicInputs.slice(numPublicInputs));
82
83
  }
83
84
 
84
85
  public isEmpty() {
@@ -86,11 +87,11 @@ export class ClientIvcProofWithPublicInputs {
86
87
  }
87
88
 
88
89
  static empty() {
89
- return ClientIvcProof.empty().attachPublicInputs([]);
90
+ return ChonkProof.empty().attachPublicInputs([]);
90
91
  }
91
92
 
92
93
  static get schema() {
93
- return bufferSchemaFor(ClientIvcProofWithPublicInputs);
94
+ return bufferSchemaFor(ChonkProofWithPublicInputs);
94
95
  }
95
96
 
96
97
  // We use this in tandem with the bufferSchemaFor to serialize to base64 strings.
@@ -98,11 +99,11 @@ export class ClientIvcProofWithPublicInputs {
98
99
  return this.toBuffer();
99
100
  }
100
101
 
101
- static fromBuffer(buffer: Buffer | BufferReader): ClientIvcProofWithPublicInputs {
102
+ static fromBuffer(buffer: Buffer | BufferReader): ChonkProofWithPublicInputs {
102
103
  const reader = BufferReader.asReader(buffer);
103
104
  const proofLength = reader.readNumber();
104
105
  const proof = reader.readArray(proofLength, Fr);
105
- return new ClientIvcProofWithPublicInputs(proof);
106
+ return new ChonkProofWithPublicInputs(proof);
106
107
  }
107
108
 
108
109
  public toBuffer() {
@@ -110,8 +111,8 @@ export class ClientIvcProofWithPublicInputs {
110
111
  }
111
112
 
112
113
  // Called when constructing from bb proving results.
113
- static fromBufferArray(fields: Uint8Array[]): ClientIvcProofWithPublicInputs {
114
+ static fromBufferArray(fields: Uint8Array[]): ChonkProofWithPublicInputs {
114
115
  const proof = fields.map(field => Fr.fromBuffer(Buffer.from(field)));
115
- return new ClientIvcProofWithPublicInputs(proof);
116
+ return new ChonkProofWithPublicInputs(proof);
116
117
  }
117
118
  }
@@ -1,5 +1,5 @@
1
1
  export * from './recursive_proof.js';
2
- export * from './client_ivc_proof.js';
2
+ export * from './chonk_proof.js';
3
3
  export * from './proof.js';
4
4
  export * from './proof_data.js';
5
5
  export * from './proving_request_type.js';
@@ -1,4 +1,4 @@
1
- import type { CIVC_PROOF_LENGTH, RECURSIVE_PROOF_LENGTH, RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
1
+ import type { CHONK_PROOF_LENGTH, RECURSIVE_PROOF_LENGTH, RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
2
2
  import { BufferReader, type Bufferable, serializeToBuffer } from '@aztec/foundation/serialize';
3
3
 
4
4
  import { RecursiveProof } from '../proofs/recursive_proof.js';
@@ -29,7 +29,7 @@ export class ProofData<T extends Bufferable, PROOF_LENGTH extends number> {
29
29
  }
30
30
  }
31
31
 
32
- export type CivcProofData<T extends Bufferable> = ProofData<T, typeof CIVC_PROOF_LENGTH>;
32
+ export type ChonkProofData<T extends Bufferable> = ProofData<T, typeof CHONK_PROOF_LENGTH>;
33
33
 
34
34
  export type UltraHonkProofData<T extends Bufferable> = ProofData<T, typeof RECURSIVE_PROOF_LENGTH>;
35
35
 
@@ -1,6 +1,6 @@
1
1
  export enum ProvingRequestType {
2
2
  PUBLIC_VM,
3
- PUBLIC_TUBE,
3
+ PUBLIC_CHONK_VERIFIER,
4
4
 
5
5
  PRIVATE_TX_BASE_ROLLUP,
6
6
  PUBLIC_TX_BASE_ROLLUP,
@@ -12,8 +12,8 @@ export * from './checkpoint_root_rollup_private_inputs.js';
12
12
  export * from './epoch_constant_data.js';
13
13
  export * from './private_tx_base_rollup_private_inputs.js';
14
14
  export * from './public_tx_base_rollup_private_inputs.js';
15
- export * from './public_tube_private_inputs.js';
16
- export * from './public_tube_public_inputs.js';
15
+ export * from './public_chonk_verifier_private_inputs.js';
16
+ export * from './public_chonk_verifier_public_inputs.js';
17
17
  export * from './root_rollup_private_inputs.js';
18
18
  export * from './root_rollup_public_inputs.js';
19
19
  export * from './tree_snapshot_diff_hints.js';
@@ -4,12 +4,12 @@ import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
4
4
  import type { FieldsOf } from '@aztec/foundation/types';
5
5
 
6
6
  import { PrivateToRollupKernelCircuitPublicInputs } from '../kernel/private_to_rollup_kernel_circuit_public_inputs.js';
7
- import { type CivcProofData, ProofData } from '../proofs/proof_data.js';
7
+ import { type ChonkProofData, ProofData } from '../proofs/proof_data.js';
8
8
  import { PrivateBaseRollupHints } from './base_rollup_hints.js';
9
9
 
10
10
  export class PrivateTxBaseRollupPrivateInputs {
11
11
  constructor(
12
- public hidingKernelProofData: CivcProofData<PrivateToRollupKernelCircuitPublicInputs>,
12
+ public hidingKernelProofData: ChonkProofData<PrivateToRollupKernelCircuitPublicInputs>,
13
13
  public hints: PrivateBaseRollupHints,
14
14
  ) {}
15
15
 
@@ -5,36 +5,37 @@ import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
5
5
  import type { FieldsOf } from '@aztec/foundation/types';
6
6
 
7
7
  import { PrivateToPublicKernelCircuitPublicInputs } from '../kernel/private_to_public_kernel_circuit_public_inputs.js';
8
- import { type CivcProofData, ProofData } from '../proofs/proof_data.js';
8
+ import { type ChonkProofData, ProofData } from '../proofs/proof_data.js';
9
9
 
10
- export class PublicTubePrivateInputs {
10
+ // CHONK_VERIFIER: Recursively verifies Chonk (Client Honk) proofs in circuits
11
+ export class PublicChonkVerifierPrivateInputs {
11
12
  constructor(
12
- public hidingKernelProofData: CivcProofData<PrivateToPublicKernelCircuitPublicInputs>,
13
+ public hidingKernelProofData: ChonkProofData<PrivateToPublicKernelCircuitPublicInputs>,
13
14
  public proverId: Fr,
14
15
  ) {}
15
16
 
16
- static from(fields: FieldsOf<PublicTubePrivateInputs>) {
17
- return new PublicTubePrivateInputs(...PublicTubePrivateInputs.getFields(fields));
17
+ static from(fields: FieldsOf<PublicChonkVerifierPrivateInputs>) {
18
+ return new PublicChonkVerifierPrivateInputs(...PublicChonkVerifierPrivateInputs.getFields(fields));
18
19
  }
19
20
 
20
- static getFields(fields: FieldsOf<PublicTubePrivateInputs>) {
21
+ static getFields(fields: FieldsOf<PublicChonkVerifierPrivateInputs>) {
21
22
  return [fields.hidingKernelProofData, fields.proverId] as const;
22
23
  }
23
24
 
24
25
  static fromBuffer(buffer: Buffer | BufferReader) {
25
26
  const reader = BufferReader.asReader(buffer);
26
- return new PublicTubePrivateInputs(
27
+ return new PublicChonkVerifierPrivateInputs(
27
28
  ProofData.fromBuffer(reader, PrivateToPublicKernelCircuitPublicInputs),
28
29
  Fr.fromBuffer(reader),
29
30
  );
30
31
  }
31
32
 
32
33
  toBuffer() {
33
- return serializeToBuffer(...PublicTubePrivateInputs.getFields(this));
34
+ return serializeToBuffer(...PublicChonkVerifierPrivateInputs.getFields(this));
34
35
  }
35
36
 
36
37
  static fromString(str: string) {
37
- return PublicTubePrivateInputs.fromBuffer(hexToBuffer(str));
38
+ return PublicChonkVerifierPrivateInputs.fromBuffer(hexToBuffer(str));
38
39
  }
39
40
 
40
41
  toString() {
@@ -48,6 +49,6 @@ export class PublicTubePrivateInputs {
48
49
 
49
50
  /** Creates an instance from a string. */
50
51
  static get schema() {
51
- return bufferSchemaFor(PublicTubePrivateInputs);
52
+ return bufferSchemaFor(PublicChonkVerifierPrivateInputs);
52
53
  }
53
54
  }
@@ -6,34 +6,35 @@ import type { FieldsOf } from '@aztec/foundation/types';
6
6
 
7
7
  import { PrivateToPublicKernelCircuitPublicInputs } from '../kernel/private_to_public_kernel_circuit_public_inputs.js';
8
8
 
9
- export class PublicTubePublicInputs {
9
+ // CHONK_VERIFIER: Recursively verifies Chonk (Client Honk) proofs in circuits
10
+ export class PublicChonkVerifierPublicInputs {
10
11
  constructor(
11
12
  public privateTail: PrivateToPublicKernelCircuitPublicInputs,
12
13
  public proverId: Fr,
13
14
  ) {}
14
15
 
15
- static from(fields: FieldsOf<PublicTubePublicInputs>) {
16
- return new PublicTubePublicInputs(...PublicTubePublicInputs.getFields(fields));
16
+ static from(fields: FieldsOf<PublicChonkVerifierPublicInputs>) {
17
+ return new PublicChonkVerifierPublicInputs(...PublicChonkVerifierPublicInputs.getFields(fields));
17
18
  }
18
19
 
19
- static getFields(fields: FieldsOf<PublicTubePublicInputs>) {
20
+ static getFields(fields: FieldsOf<PublicChonkVerifierPublicInputs>) {
20
21
  return [fields.privateTail, fields.proverId] as const;
21
22
  }
22
23
 
23
24
  static fromBuffer(buffer: Buffer | BufferReader) {
24
25
  const reader = BufferReader.asReader(buffer);
25
- return new PublicTubePublicInputs(
26
+ return new PublicChonkVerifierPublicInputs(
26
27
  reader.readObject(PrivateToPublicKernelCircuitPublicInputs),
27
28
  reader.readObject(Fr),
28
29
  );
29
30
  }
30
31
 
31
32
  toBuffer() {
32
- return serializeToBuffer(...PublicTubePublicInputs.getFields(this));
33
+ return serializeToBuffer(...PublicChonkVerifierPublicInputs.getFields(this));
33
34
  }
34
35
 
35
36
  static fromString(str: string) {
36
- return PublicTubePublicInputs.fromBuffer(hexToBuffer(str));
37
+ return PublicChonkVerifierPublicInputs.fromBuffer(hexToBuffer(str));
37
38
  }
38
39
 
39
40
  toString() {
@@ -47,6 +48,6 @@ export class PublicTubePublicInputs {
47
48
 
48
49
  /** Creates an instance from a string. */
49
50
  static get schema() {
50
- return bufferSchemaFor(PublicTubePublicInputs);
51
+ return bufferSchemaFor(PublicChonkVerifierPublicInputs);
51
52
  }
52
53
  }
@@ -7,11 +7,11 @@ import { AvmCircuitPublicInputs } from '../avm/avm_circuit_public_inputs.js';
7
7
  import { ProofData, type RollupHonkProofData } from '../proofs/proof_data.js';
8
8
  import type { AvmProofData } from './avm_proof_data.js';
9
9
  import { PublicBaseRollupHints } from './base_rollup_hints.js';
10
- import { PublicTubePublicInputs } from './public_tube_public_inputs.js';
10
+ import { PublicChonkVerifierPublicInputs } from './public_chonk_verifier_public_inputs.js';
11
11
 
12
12
  export class PublicTxBaseRollupPrivateInputs {
13
13
  constructor(
14
- public publicTubeProofData: RollupHonkProofData<PublicTubePublicInputs>,
14
+ public publicChonkVerifierProofData: RollupHonkProofData<PublicChonkVerifierPublicInputs>,
15
15
  public avmProofData: AvmProofData,
16
16
  public hints: PublicBaseRollupHints,
17
17
  ) {}
@@ -21,13 +21,13 @@ export class PublicTxBaseRollupPrivateInputs {
21
21
  }
22
22
 
23
23
  static getFields(fields: FieldsOf<PublicTxBaseRollupPrivateInputs>) {
24
- return [fields.publicTubeProofData, fields.avmProofData, fields.hints] as const;
24
+ return [fields.publicChonkVerifierProofData, fields.avmProofData, fields.hints] as const;
25
25
  }
26
26
 
27
27
  static fromBuffer(buffer: Buffer | BufferReader): PublicTxBaseRollupPrivateInputs {
28
28
  const reader = BufferReader.asReader(buffer);
29
29
  return new PublicTxBaseRollupPrivateInputs(
30
- ProofData.fromBuffer(reader, PublicTubePublicInputs),
30
+ ProofData.fromBuffer(reader, PublicChonkVerifierPublicInputs),
31
31
  ProofData.fromBuffer(reader, AvmCircuitPublicInputs),
32
32
  reader.readObject(PublicBaseRollupHints),
33
33
  );