@aztec/stdlib 3.0.0-nightly.20250908 → 3.0.0-nightly.20250911

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 (157) hide show
  1. package/dest/block/index.d.ts +2 -0
  2. package/dest/block/index.d.ts.map +1 -1
  3. package/dest/block/index.js +2 -0
  4. package/dest/block/l2_block.d.ts +2 -8
  5. package/dest/block/l2_block.d.ts.map +1 -1
  6. package/dest/block/l2_block.js +5 -3
  7. package/dest/block/l2_block_info.d.ts +41 -0
  8. package/dest/block/l2_block_info.d.ts.map +1 -0
  9. package/dest/block/l2_block_info.js +40 -0
  10. package/dest/block/l2_block_source.d.ts +1 -428
  11. package/dest/block/l2_block_source.d.ts.map +1 -1
  12. package/dest/block/l2_block_source.js +0 -28
  13. package/dest/block/proposal/attestations_and_signers.d.ts +48 -0
  14. package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -0
  15. package/dest/block/proposal/attestations_and_signers.js +99 -0
  16. package/dest/block/proposal/index.d.ts +1 -0
  17. package/dest/block/proposal/index.d.ts.map +1 -1
  18. package/dest/block/proposal/index.js +1 -0
  19. package/dest/block/published_l2_block.d.ts +25 -1
  20. package/dest/block/published_l2_block.d.ts.map +1 -1
  21. package/dest/block/published_l2_block.js +20 -1
  22. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  23. package/dest/block/test/l2_tips_store_test_suite.js +2 -1
  24. package/dest/block/validate_block_result.d.ts +222 -0
  25. package/dest/block/validate_block_result.d.ts.map +1 -0
  26. package/dest/block/validate_block_result.js +83 -0
  27. package/dest/interfaces/archiver.d.ts.map +1 -1
  28. package/dest/interfaces/archiver.js +2 -1
  29. package/dest/interfaces/block-builder.d.ts +5 -6
  30. package/dest/interfaces/block-builder.d.ts.map +1 -1
  31. package/dest/interfaces/proving-job.d.ts +24 -24
  32. package/dest/interfaces/proving-job.d.ts.map +1 -1
  33. package/dest/interfaces/proving-job.js +15 -15
  34. package/dest/interfaces/server_circuit_prover.d.ts +4 -8
  35. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  36. package/dest/interfaces/validator.d.ts +3 -0
  37. package/dest/interfaces/validator.d.ts.map +1 -1
  38. package/dest/kernel/private_kernel_prover_output.d.ts +1 -1
  39. package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
  40. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts +2 -0
  41. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts.map +1 -1
  42. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.js +7 -0
  43. package/dest/noir/index.d.ts +9 -0
  44. package/dest/noir/index.d.ts.map +1 -1
  45. package/dest/p2p/block_attestation.d.ts +1 -0
  46. package/dest/p2p/block_attestation.d.ts.map +1 -1
  47. package/dest/p2p/block_attestation.js +3 -0
  48. package/dest/p2p/block_proposal.d.ts +2 -2
  49. package/dest/p2p/block_proposal.d.ts.map +1 -1
  50. package/dest/p2p/block_proposal.js +3 -1
  51. package/dest/p2p/consensus_payload.d.ts +1 -0
  52. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  53. package/dest/p2p/consensus_payload.js +6 -4
  54. package/dest/p2p/signature_utils.d.ts +2 -1
  55. package/dest/p2p/signature_utils.d.ts.map +1 -1
  56. package/dest/p2p/signature_utils.js +1 -0
  57. package/dest/proofs/client_ivc_proof.d.ts +5 -8
  58. package/dest/proofs/client_ivc_proof.d.ts.map +1 -1
  59. package/dest/proofs/client_ivc_proof.js +27 -20
  60. package/dest/proofs/index.d.ts +1 -0
  61. package/dest/proofs/index.d.ts.map +1 -1
  62. package/dest/proofs/index.js +1 -0
  63. package/dest/proofs/proof_data.d.ts +20 -0
  64. package/dest/proofs/proof_data.d.ts.map +1 -0
  65. package/dest/proofs/proof_data.js +22 -0
  66. package/dest/proofs/proving_request_type.d.ts +12 -13
  67. package/dest/proofs/proving_request_type.d.ts.map +1 -1
  68. package/dest/proofs/proving_request_type.js +12 -12
  69. package/dest/rollup/index.d.ts +1 -3
  70. package/dest/rollup/index.d.ts.map +1 -1
  71. package/dest/rollup/index.js +1 -3
  72. package/dest/rollup/private_base_rollup_inputs.d.ts +5 -5
  73. package/dest/rollup/private_base_rollup_inputs.d.ts.map +1 -1
  74. package/dest/rollup/private_base_rollup_inputs.js +7 -9
  75. package/dest/rollup/public_base_rollup_inputs.d.ts +5 -5
  76. package/dest/rollup/public_base_rollup_inputs.d.ts.map +1 -1
  77. package/dest/rollup/public_base_rollup_inputs.js +7 -9
  78. package/dest/rollup/public_tube_private_inputs.d.ts +19 -0
  79. package/dest/rollup/public_tube_private_inputs.d.ts.map +1 -0
  80. package/dest/rollup/public_tube_private_inputs.js +38 -0
  81. package/dest/stats/stats.d.ts +1 -1
  82. package/dest/stats/stats.d.ts.map +1 -1
  83. package/dest/tests/factories.d.ts +4 -1
  84. package/dest/tests/factories.d.ts.map +1 -1
  85. package/dest/tests/factories.js +9 -15
  86. package/dest/tests/mocks.d.ts +3 -1
  87. package/dest/tests/mocks.d.ts.map +1 -1
  88. package/dest/tests/mocks.js +10 -9
  89. package/dest/tx/content_commitment.d.ts +1 -0
  90. package/dest/tx/content_commitment.d.ts.map +1 -1
  91. package/dest/tx/content_commitment.js +3 -0
  92. package/dest/tx/partial_state_reference.d.ts +1 -0
  93. package/dest/tx/partial_state_reference.d.ts.map +1 -1
  94. package/dest/tx/partial_state_reference.js +3 -0
  95. package/dest/tx/proposed_block_header.d.ts +1 -0
  96. package/dest/tx/proposed_block_header.d.ts.map +1 -1
  97. package/dest/tx/proposed_block_header.js +3 -0
  98. package/dest/tx/state_reference.d.ts +1 -0
  99. package/dest/tx/state_reference.d.ts.map +1 -1
  100. package/dest/tx/state_reference.js +3 -0
  101. package/dest/tx/tx.d.ts +0 -2
  102. package/dest/tx/tx.d.ts.map +1 -1
  103. package/dest/tx/tx.js +2 -3
  104. package/dest/update-checker/update-checker.d.ts +1 -1
  105. package/dest/update-checker/update-checker.d.ts.map +1 -1
  106. package/dest/update-checker/update-checker.js +1 -1
  107. package/package.json +8 -8
  108. package/src/block/index.ts +2 -0
  109. package/src/block/l2_block.ts +6 -11
  110. package/src/block/l2_block_info.ts +63 -0
  111. package/src/block/l2_block_source.ts +1 -51
  112. package/src/block/proposal/attestations_and_signers.ts +121 -0
  113. package/src/block/proposal/index.ts +1 -0
  114. package/src/block/published_l2_block.ts +38 -5
  115. package/src/block/test/l2_tips_store_test_suite.ts +7 -6
  116. package/src/block/validate_block_result.ts +122 -0
  117. package/src/interfaces/archiver.ts +2 -1
  118. package/src/interfaces/block-builder.ts +9 -6
  119. package/src/interfaces/proving-job.ts +19 -14
  120. package/src/interfaces/server_circuit_prover.ts +13 -13
  121. package/src/interfaces/validator.ts +7 -0
  122. package/src/kernel/private_kernel_prover_output.ts +1 -1
  123. package/src/kernel/private_to_public_kernel_circuit_public_inputs.ts +9 -0
  124. package/src/noir/index.ts +9 -0
  125. package/src/p2p/block_attestation.ts +4 -0
  126. package/src/p2p/block_proposal.ts +5 -3
  127. package/src/p2p/consensus_payload.ts +7 -4
  128. package/src/p2p/signature_utils.ts +1 -0
  129. package/src/proofs/client_ivc_proof.ts +26 -20
  130. package/src/proofs/index.ts +1 -0
  131. package/src/proofs/proof_data.ts +39 -0
  132. package/src/proofs/proving_request_type.ts +1 -3
  133. package/src/rollup/index.ts +1 -3
  134. package/src/rollup/private_base_rollup_inputs.ts +8 -8
  135. package/src/rollup/public_base_rollup_inputs.ts +5 -8
  136. package/src/rollup/public_tube_private_inputs.ts +46 -0
  137. package/src/stats/stats.ts +2 -2
  138. package/src/tests/factories.ts +20 -23
  139. package/src/tests/mocks.ts +18 -6
  140. package/src/tx/content_commitment.ts +4 -0
  141. package/src/tx/partial_state_reference.ts +8 -0
  142. package/src/tx/proposed_block_header.ts +13 -0
  143. package/src/tx/state_reference.ts +4 -0
  144. package/src/tx/tx.ts +2 -3
  145. package/src/update-checker/update-checker.ts +1 -1
  146. package/dest/rollup/private_tube_data.d.ts +0 -15
  147. package/dest/rollup/private_tube_data.d.ts.map +0 -1
  148. package/dest/rollup/private_tube_data.js +0 -25
  149. package/dest/rollup/public_tube_data.d.ts +0 -15
  150. package/dest/rollup/public_tube_data.d.ts.map +0 -1
  151. package/dest/rollup/public_tube_data.js +0 -25
  152. package/dest/rollup/tube_inputs.d.ts +0 -43
  153. package/dest/rollup/tube_inputs.d.ts.map +0 -1
  154. package/dest/rollup/tube_inputs.js +0 -63
  155. package/src/rollup/private_tube_data.ts +0 -35
  156. package/src/rollup/public_tube_data.ts +0 -35
  157. package/src/rollup/tube_inputs.ts +0 -77
@@ -45,7 +45,7 @@ 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 "tube" circuit.*/
48
+ * which recursively verifies it through the "private tx base" or the "public tube" circuit.*/
49
49
  clientIvcProof: ClientIvcProof;
50
50
  /**
51
51
  * The trace the clientIvcProof corresponds to.
@@ -1,6 +1,7 @@
1
1
  import { GeneratorIndex, PRIVATE_TO_PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH } from '@aztec/constants';
2
2
  import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto';
3
3
  import type { Fr } from '@aztec/foundation/fields';
4
+ import { bufferSchemaFor } from '@aztec/foundation/schemas';
4
5
  import { BufferReader, bigintToUInt64BE, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
5
6
  import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
6
7
  import type { FieldsOf } from '@aztec/foundation/types';
@@ -93,4 +94,12 @@ export class PrivateToPublicKernelCircuitPublicInputs {
93
94
  hash() {
94
95
  return poseidon2HashWithSeparator(this.toFields(), GeneratorIndex.PUBLIC_TX_HASH);
95
96
  }
97
+
98
+ toJSON() {
99
+ return this.toBuffer();
100
+ }
101
+
102
+ static get schema() {
103
+ return bufferSchemaFor(PrivateToPublicKernelCircuitPublicInputs);
104
+ }
96
105
  }
package/src/noir/index.ts CHANGED
@@ -87,6 +87,15 @@ export interface NoirCompiledCircuit {
87
87
  abi: NoirFunctionAbi;
88
88
  /** The bytecode of the circuit in base64. */
89
89
  bytecode: string;
90
+ /** The verification key of the circuit. */
91
+ verificationKey: {
92
+ /** hex-encoded binary */
93
+ bytes: string;
94
+ /** list of hex-encoded fields */
95
+ fields: string[];
96
+ /** The hex-encoded hash. */
97
+ hash: string;
98
+ };
90
99
  /** The debug information, compressed and base64 encoded. */
91
100
  debug_symbols: string;
92
101
  /** The map of file ID to the source code and path of the file. */
@@ -98,6 +98,10 @@ export class BlockAttestation extends Gossipable {
98
98
  return new BlockAttestation(0, ConsensusPayload.empty(), Signature.empty());
99
99
  }
100
100
 
101
+ static random(): BlockAttestation {
102
+ return new BlockAttestation(Math.floor(Math.random() * 1000) + 1, ConsensusPayload.random(), Signature.random());
103
+ }
104
+
101
105
  getSize(): number {
102
106
  return 4 /* blockNumber */ + this.payload.getSize() + this.signature.getSize();
103
107
  }
@@ -5,7 +5,7 @@ import { Signature } from '@aztec/foundation/eth-signature';
5
5
  import { Fr } from '@aztec/foundation/fields';
6
6
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
7
7
 
8
- import type { BlockInfo } from '../block/l2_block.js';
8
+ import type { L2BlockInfo } from '../block/l2_block_info.js';
9
9
  import { TxHash } from '../tx/index.js';
10
10
  import { Tx } from '../tx/tx.js';
11
11
  import type { UInt32 } from '../types/index.js';
@@ -71,11 +71,13 @@ export class BlockProposal extends Gossipable {
71
71
  return this.payload.header.slotNumber;
72
72
  }
73
73
 
74
- toBlockInfo(): BlockInfo {
74
+ toBlockInfo(): L2BlockInfo {
75
75
  return {
76
76
  blockNumber: this.blockNumber,
77
77
  slotNumber: this.slotNumber.toNumber(),
78
- archive: this.archive.toString(),
78
+ lastArchive: this.payload.header.lastArchiveRoot,
79
+ timestamp: this.payload.header.timestamp,
80
+ archive: this.archive,
79
81
  txCount: this.txHashes.length,
80
82
  };
81
83
  }
@@ -60,18 +60,17 @@ export class ConsensusPayload implements Signable {
60
60
  }
61
61
 
62
62
  toBuffer(): Buffer {
63
- const buffer = serializeToBuffer([this.header, this.archive, this.stateReference]);
64
- this.size = buffer.length;
65
- return buffer;
63
+ return serializeToBuffer([this.header, this.archive, this.stateReference]);
66
64
  }
67
65
 
68
66
  static fromBuffer(buf: Buffer | BufferReader): ConsensusPayload {
69
67
  const reader = BufferReader.asReader(buf);
70
- return new ConsensusPayload(
68
+ const payload = new ConsensusPayload(
71
69
  reader.readObject(ProposedBlockHeader),
72
70
  reader.readObject(Fr),
73
71
  reader.readObject(StateReference),
74
72
  );
73
+ return payload;
75
74
  }
76
75
 
77
76
  static fromFields(fields: FieldsOf<ConsensusPayload>): ConsensusPayload {
@@ -86,6 +85,10 @@ export class ConsensusPayload implements Signable {
86
85
  return new ConsensusPayload(ProposedBlockHeader.empty(), Fr.ZERO, StateReference.empty());
87
86
  }
88
87
 
88
+ static random(): ConsensusPayload {
89
+ return new ConsensusPayload(ProposedBlockHeader.random(), Fr.random(), StateReference.random());
90
+ }
91
+
89
92
  /**
90
93
  * Get the size of the consensus payload in bytes.
91
94
  * @returns The size of the consensus payload.
@@ -4,6 +4,7 @@ import { keccak256, makeEthSignDigest } from '@aztec/foundation/crypto';
4
4
  export enum SignatureDomainSeparator {
5
5
  blockProposal = 0,
6
6
  blockAttestation = 1,
7
+ attestationsAndSigners = 2,
7
8
  }
8
9
 
9
10
  export interface Signable {
@@ -1,35 +1,33 @@
1
+ import { CIVC_PROOF_LENGTH } from '@aztec/constants';
1
2
  import { randomBytes } from '@aztec/foundation/crypto';
3
+ import { Fr } from '@aztec/foundation/fields';
2
4
  import { bufferSchemaFor } from '@aztec/foundation/schemas';
3
5
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
4
6
 
5
- const CLIENT_IVC_PROOF_LENGTH = 172052;
6
-
7
- /**
8
- * TODO(https://github.com/AztecProtocol/aztec-packages/issues/7370) refactor this to
9
- * eventually we read all these VKs from the data tree instead of passing them
10
- */
11
7
  export class ClientIvcProof {
12
8
  constructor(
13
- // produced by the sequencer when making the tube proof
14
- // TODO(https://github.com/AztecProtocol/aztec-packages/issues/7370): Need to precompute private kernel tail VK so we can verify this immediately in the tx pool
15
- // which parts of these are needed to quickly verify that we have a correct IVC proof
16
- public clientIvcProofBuffer: Buffer,
9
+ // The proof fields with public inputs.
10
+ // For recursive verification, the public inputs (at the front of the array) must be removed.
11
+ public proof: Fr[],
17
12
  ) {}
18
13
 
19
14
  public isEmpty() {
20
- return this.clientIvcProofBuffer.length === 0;
15
+ return this.proof.length === 0;
21
16
  }
22
17
 
23
18
  static empty() {
24
- return new ClientIvcProof(Buffer.from(''));
25
- }
26
-
27
- static fake(fill = Math.floor(Math.random() * 255)) {
28
- return new ClientIvcProof(Buffer.alloc(1, fill));
19
+ return new ClientIvcProof([]);
29
20
  }
30
21
 
31
- static random() {
32
- return new ClientIvcProof(Buffer.from(randomBytes(CLIENT_IVC_PROOF_LENGTH)));
22
+ static random(proofSize = CIVC_PROOF_LENGTH) {
23
+ // NB: Not using Fr.random here because it slows down some tests that require a large number of txs significantly.
24
+ const reducedFrSize = Fr.SIZE_IN_BYTES - 1;
25
+ const randomFields = randomBytes(proofSize * reducedFrSize);
26
+ const proof = Array.from(
27
+ { length: proofSize },
28
+ (_, i) => new Fr(randomFields.subarray(i * reducedFrSize, (i + 1) * reducedFrSize)),
29
+ );
30
+ return new ClientIvcProof(proof);
33
31
  }
34
32
 
35
33
  static get schema() {
@@ -42,10 +40,18 @@ export class ClientIvcProof {
42
40
 
43
41
  static fromBuffer(buffer: Buffer | BufferReader): ClientIvcProof {
44
42
  const reader = BufferReader.asReader(buffer);
45
- return new ClientIvcProof(reader.readBuffer());
43
+ const proofLength = reader.readNumber();
44
+ const proof = reader.readArray(proofLength, Fr);
45
+ return new ClientIvcProof(proof);
46
46
  }
47
47
 
48
48
  public toBuffer() {
49
- return serializeToBuffer(this.clientIvcProofBuffer.length, this.clientIvcProofBuffer);
49
+ return serializeToBuffer(this.proof.length, this.proof);
50
+ }
51
+
52
+ // Called when constructing a ClientIvcProof from proving results.
53
+ static fromBufferArray(fields: Uint8Array[]): ClientIvcProof {
54
+ const proof = fields.map(field => Fr.fromBuffer(Buffer.from(field)));
55
+ return new ClientIvcProof(proof);
50
56
  }
51
57
  }
@@ -1,4 +1,5 @@
1
1
  export * from './recursive_proof.js';
2
2
  export * from './client_ivc_proof.js';
3
3
  export * from './proof.js';
4
+ export * from './proof_data.js';
4
5
  export * from './proving_request_type.js';
@@ -0,0 +1,39 @@
1
+ import type { CIVC_PROOF_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
2
+ import { BufferReader, type Bufferable, serializeToBuffer } from '@aztec/foundation/serialize';
3
+
4
+ import { RecursiveProof } from '../proofs/recursive_proof.js';
5
+ import { VkData } from '../vks/index.js';
6
+
7
+ /**
8
+ * Represents the data of a recursive proof.
9
+ */
10
+ export class ProofData<T extends Bufferable, PROOF_LENGTH extends number> {
11
+ constructor(
12
+ public publicInputs: T,
13
+ public proof: RecursiveProof<PROOF_LENGTH>,
14
+ public vkData: VkData,
15
+ ) {}
16
+
17
+ public toBuffer(): Buffer {
18
+ return serializeToBuffer(this.publicInputs, this.proof, this.vkData);
19
+ }
20
+
21
+ public static fromBuffer<T extends Bufferable, PROOF_LENGTH extends number>(
22
+ buffer: Buffer | BufferReader,
23
+ publicInputs: {
24
+ fromBuffer: (reader: BufferReader) => T;
25
+ },
26
+ proofLength?: PROOF_LENGTH,
27
+ ): ProofData<T, PROOF_LENGTH> {
28
+ const reader = BufferReader.asReader(buffer);
29
+ return new ProofData(
30
+ reader.readObject(publicInputs),
31
+ RecursiveProof.fromBuffer(reader, proofLength),
32
+ reader.readObject(VkData),
33
+ );
34
+ }
35
+ }
36
+
37
+ export type CivcProofData<T extends Bufferable> = ProofData<T, typeof CIVC_PROOF_LENGTH>;
38
+
39
+ export type RollupHonkProofData<T extends Bufferable> = ProofData<T, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>;
@@ -1,6 +1,6 @@
1
1
  export enum ProvingRequestType {
2
2
  PUBLIC_VM,
3
-
3
+ PUBLIC_TUBE,
4
4
  PRIVATE_BASE_ROLLUP,
5
5
  PUBLIC_BASE_ROLLUP,
6
6
  MERGE_ROLLUP,
@@ -13,6 +13,4 @@ export enum ProvingRequestType {
13
13
 
14
14
  BASE_PARITY,
15
15
  ROOT_PARITY,
16
- /** Recursive Client IVC verification to connect private to public or rollup */
17
- TUBE_PROOF,
18
16
  }
@@ -12,9 +12,7 @@ export * from './padding_block_root_rollup_inputs.js';
12
12
  export * from './previous_rollup_block_data.js';
13
13
  export * from './previous_rollup_data.js';
14
14
  export * from './private_base_rollup_inputs.js';
15
- export * from './private_tube_data.js';
16
15
  export * from './public_base_rollup_inputs.js';
17
- export * from './public_tube_data.js';
16
+ export * from './public_tube_private_inputs.js';
18
17
  export * from './root_rollup.js';
19
18
  export * from './state_diff_hints.js';
20
- export * from './tube_inputs.js';
@@ -3,12 +3,13 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
3
3
  import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
4
4
  import type { FieldsOf } from '@aztec/foundation/types';
5
5
 
6
+ import { PrivateToRollupKernelCircuitPublicInputs } from '../kernel/private_to_rollup_kernel_circuit_public_inputs.js';
7
+ import { type CivcProofData, ProofData } from '../proofs/proof_data.js';
6
8
  import { PrivateBaseRollupHints } from './base_rollup_hints.js';
7
- import { PrivateTubeData } from './private_tube_data.js';
8
9
 
9
10
  export class PrivateBaseRollupInputs {
10
11
  constructor(
11
- public tubeData: PrivateTubeData,
12
+ public hidingKernelProofData: CivcProofData<PrivateToRollupKernelCircuitPublicInputs>,
12
13
  public hints: PrivateBaseRollupHints,
13
14
  ) {}
14
15
 
@@ -17,12 +18,15 @@ export class PrivateBaseRollupInputs {
17
18
  }
18
19
 
19
20
  static getFields(fields: FieldsOf<PrivateBaseRollupInputs>) {
20
- return [fields.tubeData, fields.hints] as const;
21
+ return [fields.hidingKernelProofData, fields.hints] as const;
21
22
  }
22
23
 
23
24
  static fromBuffer(buffer: Buffer | BufferReader): PrivateBaseRollupInputs {
24
25
  const reader = BufferReader.asReader(buffer);
25
- return new PrivateBaseRollupInputs(reader.readObject(PrivateTubeData), reader.readObject(PrivateBaseRollupHints));
26
+ return new PrivateBaseRollupInputs(
27
+ ProofData.fromBuffer(reader, PrivateToRollupKernelCircuitPublicInputs),
28
+ reader.readObject(PrivateBaseRollupHints),
29
+ );
26
30
  }
27
31
 
28
32
  toBuffer() {
@@ -37,10 +41,6 @@ export class PrivateBaseRollupInputs {
37
41
  return bufferToHex(this.toBuffer());
38
42
  }
39
43
 
40
- static empty() {
41
- return new PrivateBaseRollupInputs(PrivateTubeData.empty(), PrivateBaseRollupHints.empty());
42
- }
43
-
44
44
  /** Returns a buffer representation for JSON serialization. */
45
45
  toJSON() {
46
46
  return this.toBuffer();
@@ -3,13 +3,14 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
3
3
  import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
4
4
  import type { FieldsOf } from '@aztec/foundation/types';
5
5
 
6
+ import { PrivateToPublicKernelCircuitPublicInputs } from '../kernel/private_to_public_kernel_circuit_public_inputs.js';
7
+ import { ProofData, type RollupHonkProofData } from '../proofs/proof_data.js';
6
8
  import { AvmProofData } from './avm_proof_data.js';
7
9
  import { PublicBaseRollupHints } from './base_rollup_hints.js';
8
- import { PublicTubeData } from './public_tube_data.js';
9
10
 
10
11
  export class PublicBaseRollupInputs {
11
12
  constructor(
12
- public tubeData: PublicTubeData,
13
+ public publicTubeProofData: RollupHonkProofData<PrivateToPublicKernelCircuitPublicInputs>,
13
14
  public avmProofData: AvmProofData,
14
15
  public hints: PublicBaseRollupHints,
15
16
  ) {}
@@ -19,13 +20,13 @@ export class PublicBaseRollupInputs {
19
20
  }
20
21
 
21
22
  static getFields(fields: FieldsOf<PublicBaseRollupInputs>) {
22
- return [fields.tubeData, fields.avmProofData, fields.hints] as const;
23
+ return [fields.publicTubeProofData, fields.avmProofData, fields.hints] as const;
23
24
  }
24
25
 
25
26
  static fromBuffer(buffer: Buffer | BufferReader): PublicBaseRollupInputs {
26
27
  const reader = BufferReader.asReader(buffer);
27
28
  return new PublicBaseRollupInputs(
28
- reader.readObject(PublicTubeData),
29
+ ProofData.fromBuffer(reader, PrivateToPublicKernelCircuitPublicInputs),
29
30
  reader.readObject(AvmProofData),
30
31
  reader.readObject(PublicBaseRollupHints),
31
32
  );
@@ -43,10 +44,6 @@ export class PublicBaseRollupInputs {
43
44
  return bufferToHex(this.toBuffer());
44
45
  }
45
46
 
46
- static empty() {
47
- return new PublicBaseRollupInputs(PublicTubeData.empty(), AvmProofData.empty(), PublicBaseRollupHints.empty());
48
- }
49
-
50
47
  /** Returns a representation for JSON serialization. */
51
48
  toJSON() {
52
49
  return this.toBuffer();
@@ -0,0 +1,46 @@
1
+ import { bufferSchemaFor } from '@aztec/foundation/schemas';
2
+ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
3
+ import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
4
+ import type { FieldsOf } from '@aztec/foundation/types';
5
+
6
+ import { PrivateToPublicKernelCircuitPublicInputs } from '../kernel/private_to_public_kernel_circuit_public_inputs.js';
7
+ import { type CivcProofData, ProofData } from '../proofs/proof_data.js';
8
+
9
+ export class PublicTubePrivateInputs {
10
+ constructor(public hidingKernelProofData: CivcProofData<PrivateToPublicKernelCircuitPublicInputs>) {}
11
+
12
+ static from(fields: FieldsOf<PublicTubePrivateInputs>) {
13
+ return new PublicTubePrivateInputs(...PublicTubePrivateInputs.getFields(fields));
14
+ }
15
+
16
+ static getFields(fields: FieldsOf<PublicTubePrivateInputs>) {
17
+ return [fields.hidingKernelProofData] as const;
18
+ }
19
+
20
+ static fromBuffer(buffer: Buffer | BufferReader) {
21
+ const reader = BufferReader.asReader(buffer);
22
+ return new PublicTubePrivateInputs(ProofData.fromBuffer(reader, PrivateToPublicKernelCircuitPublicInputs));
23
+ }
24
+
25
+ toBuffer() {
26
+ return serializeToBuffer(...PublicTubePrivateInputs.getFields(this));
27
+ }
28
+
29
+ static fromString(str: string) {
30
+ return PublicTubePrivateInputs.fromBuffer(hexToBuffer(str));
31
+ }
32
+
33
+ toString() {
34
+ return bufferToHex(this.toBuffer());
35
+ }
36
+
37
+ /** Returns a representation for JSON serialization. */
38
+ toJSON() {
39
+ return this.toBuffer();
40
+ }
41
+
42
+ /** Creates an instance from a string. */
43
+ static get schema() {
44
+ return bufferSchemaFor(PublicTubePrivateInputs);
45
+ }
46
+ }
@@ -88,6 +88,7 @@ export type ClientCircuitName =
88
88
  export type ServerCircuitName =
89
89
  | 'base-parity'
90
90
  | 'root-parity'
91
+ | 'public-tube'
91
92
  | 'private-base-rollup'
92
93
  | 'public-base-rollup'
93
94
  | 'merge-rollup'
@@ -97,8 +98,7 @@ export type ServerCircuitName =
97
98
  | 'padding-block-root-rollup'
98
99
  | 'block-merge-rollup'
99
100
  | 'root-rollup'
100
- | 'avm-circuit'
101
- | 'tube-circuit';
101
+ | 'avm-circuit';
102
102
 
103
103
  export type CircuitName = ClientCircuitName | ServerCircuitName;
104
104
 
@@ -5,6 +5,7 @@ import {
5
5
  AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
6
6
  AZTEC_MAX_EPOCH_DURATION,
7
7
  BLOBS_PER_BLOCK,
8
+ CIVC_PROOF_LENGTH,
8
9
  CONTRACT_CLASS_LOG_SIZE_IN_FIELDS,
9
10
  FIELDS_PER_BLOB,
10
11
  FIXED_DA_GAS,
@@ -41,7 +42,7 @@ import {
41
42
  PUBLIC_DATA_TREE_HEIGHT,
42
43
  PUBLIC_LOG_SIZE_IN_FIELDS,
43
44
  RECURSIVE_PROOF_LENGTH,
44
- TUBE_PROOF_LENGTH,
45
+ RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
45
46
  VK_TREE_HEIGHT,
46
47
  } from '@aztec/constants';
47
48
  import { type FieldsOf, makeHalfFullTuple, makeTuple } from '@aztec/foundation/array';
@@ -131,6 +132,7 @@ import { ParityPublicInputs } from '../parity/parity_public_inputs.js';
131
132
  import { RootParityInput } from '../parity/root_parity_input.js';
132
133
  import { RootParityInputs } from '../parity/root_parity_inputs.js';
133
134
  import { Proof } from '../proofs/proof.js';
135
+ import { ProofData } from '../proofs/proof_data.js';
134
136
  import { ProvingRequestType } from '../proofs/proving_request_type.js';
135
137
  import { makeRecursiveProof } from '../proofs/recursive_proof.js';
136
138
  import { AvmProofData } from '../rollup/avm_proof_data.js';
@@ -151,9 +153,7 @@ import { MergeRollupInputs } from '../rollup/merge_rollup.js';
151
153
  import { PreviousRollupBlockData } from '../rollup/previous_rollup_block_data.js';
152
154
  import { PreviousRollupData } from '../rollup/previous_rollup_data.js';
153
155
  import { PrivateBaseRollupInputs } from '../rollup/private_base_rollup_inputs.js';
154
- import { PrivateTubeData } from '../rollup/private_tube_data.js';
155
156
  import { PublicBaseRollupInputs } from '../rollup/public_base_rollup_inputs.js';
156
- import { PublicTubeData } from '../rollup/public_tube_data.js';
157
157
  import { RootRollupInputs, RootRollupPublicInputs } from '../rollup/root_rollup.js';
158
158
  import { PrivateBaseStateDiffHints } from '../rollup/state_diff_hints.js';
159
159
  import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
@@ -412,7 +412,7 @@ export function makePrivateKernelTailCircuitPublicInputs(
412
412
  );
413
413
  }
414
414
 
415
- function makePrivateToPublicKernelCircuitPublicInputs(seed = 1) {
415
+ export function makePrivateToPublicKernelCircuitPublicInputs(seed = 1) {
416
416
  return new PrivateToPublicKernelCircuitPublicInputs(
417
417
  makeTxConstantData(seed),
418
418
  makePrivateToPublicAccumulatedData(seed + 0x200),
@@ -1083,10 +1083,14 @@ function makeVkData(seed = 1) {
1083
1083
  return new VkData(VerificationKeyData.makeFakeHonk(), seed, makeTuple(VK_TREE_HEIGHT, fr, seed + 0x100));
1084
1084
  }
1085
1085
 
1086
- function makePrivateTubeData(seed = 1, kernelPublicInputs?: PrivateToRollupKernelCircuitPublicInputs) {
1087
- return new PrivateTubeData(
1088
- kernelPublicInputs ?? makePrivateToRollupKernelCircuitPublicInputs(seed, true),
1089
- makeRecursiveProof<typeof TUBE_PROOF_LENGTH>(TUBE_PROOF_LENGTH, seed + 0x100),
1086
+ export function makeProofData<T extends Bufferable, PROOF_LENGTH extends number>(
1087
+ seed = 0,
1088
+ makePublicInputs: (seed: number) => T,
1089
+ proofSize: PROOF_LENGTH = NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH as PROOF_LENGTH,
1090
+ ) {
1091
+ return new ProofData(
1092
+ makePublicInputs(seed),
1093
+ makeRecursiveProof<PROOF_LENGTH>(proofSize, seed + 0x100),
1090
1094
  makeVkData(seed + 0x200),
1091
1095
  );
1092
1096
  }
@@ -1131,23 +1135,12 @@ function makePublicBaseRollupHints(seed = 1) {
1131
1135
  }
1132
1136
 
1133
1137
  export function makePrivateBaseRollupInputs(seed = 0) {
1134
- const tubeData = makePrivateTubeData(seed);
1135
- const hints = makePrivateBaseRollupHints(seed + 0x100);
1136
-
1137
1138
  return PrivateBaseRollupInputs.from({
1138
- tubeData,
1139
- hints,
1139
+ hidingKernelProofData: makeProofData(seed, makePrivateToRollupKernelCircuitPublicInputs, CIVC_PROOF_LENGTH),
1140
+ hints: makePrivateBaseRollupHints(seed + 0x100),
1140
1141
  });
1141
1142
  }
1142
1143
 
1143
- function makePublicTubeData(seed = 1) {
1144
- return new PublicTubeData(
1145
- makePrivateToPublicKernelCircuitPublicInputs(seed),
1146
- makeRecursiveProof<typeof TUBE_PROOF_LENGTH>(TUBE_PROOF_LENGTH, seed + 0x100),
1147
- makeVkData(seed + 0x200),
1148
- );
1149
- }
1150
-
1151
1144
  function makeAvmProofData(seed = 1) {
1152
1145
  return new AvmProofData(
1153
1146
  makeAvmCircuitPublicInputs(seed),
@@ -1157,12 +1150,16 @@ function makeAvmProofData(seed = 1) {
1157
1150
  }
1158
1151
 
1159
1152
  export function makePublicBaseRollupInputs(seed = 0) {
1160
- const tubeData = makePublicTubeData(seed);
1153
+ const publicTubeProofData = makeProofData(
1154
+ seed,
1155
+ makePrivateToPublicKernelCircuitPublicInputs,
1156
+ RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
1157
+ );
1161
1158
  const avmProofData = makeAvmProofData(seed + 0x100);
1162
1159
  const hints = makePublicBaseRollupHints(seed + 0x200);
1163
1160
 
1164
1161
  return PublicBaseRollupInputs.from({
1165
- tubeData,
1162
+ publicTubeProofData,
1166
1163
  avmProofData,
1167
1164
  hints,
1168
1165
  });
@@ -6,9 +6,10 @@ import { Fr } from '@aztec/foundation/fields';
6
6
 
7
7
  import type { ContractArtifact } from '../abi/abi.js';
8
8
  import { AztecAddress } from '../aztec-address/index.js';
9
- import { CommitteeAttestation } from '../block/index.js';
9
+ import { CommitteeAttestation, L1PublishedData } from '../block/index.js';
10
10
  import { L2Block } from '../block/l2_block.js';
11
- import type { PublishedL2Block } from '../block/published_l2_block.js';
11
+ import type { CommitteeAttestationsAndSigners } from '../block/proposal/attestations_and_signers.js';
12
+ import { PublishedL2Block } from '../block/published_l2_block.js';
12
13
  import { computeContractAddressFromInstance } from '../contract/contract_address.js';
13
14
  import { getContractClassFromArtifact } from '../contract/contract_class.js';
14
15
  import { SerializableContractInstance } from '../contract/contract_instance.js';
@@ -88,7 +89,7 @@ export const mockTx = async (
88
89
  hasPublicTeardownCallRequest = false,
89
90
  publicCalldataSize = 2,
90
91
  feePayer,
91
- clientIvcProof = ClientIvcProof.empty(),
92
+ clientIvcProof = ClientIvcProof.random(),
92
93
  maxPriorityFeesPerGas,
93
94
  chainId = Fr.ZERO,
94
95
  version = Fr.ZERO,
@@ -273,6 +274,17 @@ const makeAndSignConsensusPayload = (
273
274
  return { blockNumber: header.globalVariables.blockNumber, payload, signature };
274
275
  };
275
276
 
277
+ export const makeAndSignCommitteeAttestationsAndSigners = (
278
+ attestationsAndSigners: CommitteeAttestationsAndSigners,
279
+ signer: Secp256k1Signer = Secp256k1Signer.random(),
280
+ ) => {
281
+ const hash = getHashedSignaturePayloadEthSignedMessage(
282
+ attestationsAndSigners,
283
+ SignatureDomainSeparator.attestationsAndSigners,
284
+ );
285
+ return signer.sign(hash);
286
+ };
287
+
276
288
  export const makeBlockProposal = (options?: MakeConsensusPayloadOptions): BlockProposal => {
277
289
  const { blockNumber, payload, signature } = makeAndSignConsensusPayload(
278
290
  SignatureDomainSeparator.blockProposal,
@@ -306,16 +318,16 @@ export async function randomPublishedL2Block(
306
318
  opts: { signers?: Secp256k1Signer[] } = {},
307
319
  ): Promise<PublishedL2Block> {
308
320
  const block = await L2Block.random(l2BlockNumber);
309
- const l1 = {
321
+ const l1 = L1PublishedData.fromFields({
310
322
  blockNumber: BigInt(block.number),
311
323
  timestamp: block.header.globalVariables.timestamp,
312
324
  blockHash: Buffer32.random().toString(),
313
- };
325
+ });
314
326
 
315
327
  const signers = opts.signers ?? times(3, () => Secp256k1Signer.random());
316
328
  const atts = await Promise.all(signers.map(signer => makeBlockAttestationFromBlock(block, signer)));
317
329
  const attestations = atts.map(
318
330
  (attestation, i) => new CommitteeAttestation(signers[i].address, attestation.signature),
319
331
  );
320
- return { block, l1, attestations };
332
+ return new PublishedL2Block(block, l1, attestations);
321
333
  }
@@ -75,6 +75,10 @@ export class ContentCommitment {
75
75
  return new ContentCommitment(reader.readField(), reader.readField(), reader.readField());
76
76
  }
77
77
 
78
+ static random(): ContentCommitment {
79
+ return new ContentCommitment(Fr.random(), Fr.random(), Fr.random());
80
+ }
81
+
78
82
  static empty(): ContentCommitment {
79
83
  return new ContentCommitment(Fr.zero(), Fr.zero(), Fr.zero());
80
84
  }
@@ -64,6 +64,14 @@ export class PartialStateReference {
64
64
  );
65
65
  }
66
66
 
67
+ static random(): PartialStateReference {
68
+ return new PartialStateReference(
69
+ AppendOnlyTreeSnapshot.random(),
70
+ AppendOnlyTreeSnapshot.random(),
71
+ AppendOnlyTreeSnapshot.random(),
72
+ );
73
+ }
74
+
67
75
  toViem(): ViemPartialStateReference {
68
76
  return {
69
77
  noteHashTree: this.noteHashTree.toViem(),
@@ -116,6 +116,19 @@ export class ProposedBlockHeader {
116
116
  });
117
117
  }
118
118
 
119
+ static random(): ProposedBlockHeader {
120
+ return new ProposedBlockHeader(
121
+ Fr.random(),
122
+ ContentCommitment.random(),
123
+ new Fr(BigInt(Math.floor(Math.random() * 1000) + 1)),
124
+ BigInt(Math.floor(Date.now() / 1000)),
125
+ EthAddress.random(),
126
+ new AztecAddress(Fr.random()),
127
+ GasFees.random(),
128
+ new Fr(BigInt(Math.floor(Math.random() * 1000000))),
129
+ );
130
+ }
131
+
119
132
  isEmpty(): boolean {
120
133
  return (
121
134
  this.lastArchiveRoot.isZero() &&
@@ -78,6 +78,10 @@ export class StateReference {
78
78
  return new StateReference(AppendOnlyTreeSnapshot.empty(), PartialStateReference.empty());
79
79
  }
80
80
 
81
+ static random(): StateReference {
82
+ return new StateReference(AppendOnlyTreeSnapshot.random(), PartialStateReference.random());
83
+ }
84
+
81
85
  toViem(): ViemStateReference {
82
86
  return {
83
87
  l1ToL2MessageTree: this.l1ToL2MessageTree.toViem(),