@aztec/stdlib 3.0.0-nightly.20250917 → 3.0.0-nightly.20250918

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 (184) hide show
  1. package/dest/avm/avm.d.ts +6 -0
  2. package/dest/avm/avm.d.ts.map +1 -1
  3. package/dest/avm/avm_circuit_public_inputs.d.ts +6 -1
  4. package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
  5. package/dest/avm/avm_circuit_public_inputs.js +11 -6
  6. package/dest/avm/avm_proving_request.d.ts +7 -0
  7. package/dest/avm/avm_proving_request.d.ts.map +1 -1
  8. package/dest/block/body.d.ts +4 -1
  9. package/dest/block/body.d.ts.map +1 -1
  10. package/dest/block/body.js +16 -5
  11. package/dest/block/index.d.ts +1 -0
  12. package/dest/block/index.d.ts.map +1 -1
  13. package/dest/block/index.js +1 -0
  14. package/dest/block/l2_block.d.ts +8 -5
  15. package/dest/block/l2_block.d.ts.map +1 -1
  16. package/dest/block/l2_block.js +14 -7
  17. package/dest/block/l2_block_code_to_purge.d.ts +3 -14
  18. package/dest/block/l2_block_code_to_purge.d.ts.map +1 -1
  19. package/dest/block/l2_block_code_to_purge.js +23 -13
  20. package/dest/block/l2_block_header.d.ts +100 -0
  21. package/dest/block/l2_block_header.d.ts.map +1 -0
  22. package/dest/block/l2_block_header.js +146 -0
  23. package/dest/block/l2_block_stream/l2_tips_memory_store.js +1 -1
  24. package/dest/block/published_l2_block.d.ts +2 -2
  25. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  26. package/dest/block/test/l2_tips_store_test_suite.js +1 -3
  27. package/dest/interfaces/block-builder.d.ts +1 -2
  28. package/dest/interfaces/block-builder.d.ts.map +1 -1
  29. package/dest/interfaces/epoch-prover.d.ts +25 -8
  30. package/dest/interfaces/epoch-prover.d.ts.map +1 -1
  31. package/dest/interfaces/proving-job.d.ts +170 -61
  32. package/dest/interfaces/proving-job.d.ts.map +1 -1
  33. package/dest/interfaces/proving-job.js +101 -39
  34. package/dest/interfaces/server_circuit_prover.d.ts +19 -16
  35. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  36. package/dest/interfaces/validator.d.ts +3 -2
  37. package/dest/interfaces/validator.d.ts.map +1 -1
  38. package/dest/kernel/private_circuit_public_inputs.d.ts +4 -4
  39. package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
  40. package/dest/kernel/private_circuit_public_inputs.js +7 -7
  41. package/dest/kernel/private_context_inputs.d.ts +2 -2
  42. package/dest/kernel/private_context_inputs.d.ts.map +1 -1
  43. package/dest/kernel/private_context_inputs.js +4 -4
  44. package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +1 -1
  45. package/dest/p2p/consensus_payload.d.ts +7 -6
  46. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  47. package/dest/p2p/consensus_payload.js +7 -6
  48. package/dest/parity/root_parity_input.d.ts +1 -1
  49. package/dest/proofs/proof_data.d.ts +1 -1
  50. package/dest/proofs/proof_data.d.ts.map +1 -1
  51. package/dest/proofs/proof_data.js +2 -2
  52. package/dest/proofs/proving_request_type.d.ts +13 -8
  53. package/dest/proofs/proving_request_type.d.ts.map +1 -1
  54. package/dest/proofs/proving_request_type.js +13 -8
  55. package/dest/rollup/base_or_merge_rollup_public_inputs.d.ts +1 -1
  56. package/dest/rollup/base_or_merge_rollup_public_inputs.d.ts.map +1 -1
  57. package/dest/rollup/base_or_merge_rollup_public_inputs.js +1 -1
  58. package/dest/rollup/base_rollup_hints.d.ts +12 -3
  59. package/dest/rollup/base_rollup_hints.d.ts.map +1 -1
  60. package/dest/rollup/base_rollup_hints.js +11 -5
  61. package/dest/rollup/block_constant_data.d.ts +20 -6
  62. package/dest/rollup/block_constant_data.d.ts.map +1 -1
  63. package/dest/rollup/block_constant_data.js +15 -7
  64. package/dest/rollup/block_merge_rollup.d.ts +10 -9
  65. package/dest/rollup/block_merge_rollup.d.ts.map +1 -1
  66. package/dest/rollup/block_merge_rollup.js +14 -13
  67. package/dest/rollup/block_rollup_public_inputs.d.ts +124 -0
  68. package/dest/rollup/block_rollup_public_inputs.d.ts.map +1 -0
  69. package/dest/rollup/block_rollup_public_inputs.js +85 -0
  70. package/dest/rollup/block_root_rollup.d.ts +148 -184
  71. package/dest/rollup/block_root_rollup.d.ts.map +1 -1
  72. package/dest/rollup/block_root_rollup.js +211 -260
  73. package/dest/rollup/checkpoint_constant_data.d.ts +54 -0
  74. package/dest/rollup/checkpoint_constant_data.d.ts.map +1 -0
  75. package/dest/rollup/checkpoint_constant_data.js +55 -0
  76. package/dest/{tx/proposed_block_header.d.ts → rollup/checkpoint_header.d.ts} +11 -12
  77. package/dest/rollup/checkpoint_header.d.ts.map +1 -0
  78. package/dest/{tx/proposed_block_header.js → rollup/checkpoint_header.js} +9 -9
  79. package/dest/rollup/checkpoint_merge_rollup.d.ts +30 -0
  80. package/dest/rollup/checkpoint_merge_rollup.d.ts.map +1 -0
  81. package/dest/rollup/checkpoint_merge_rollup.js +37 -0
  82. package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +105 -0
  83. package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -0
  84. package/dest/rollup/checkpoint_rollup_public_inputs.js +105 -0
  85. package/dest/rollup/checkpoint_root_rollup.d.ts +117 -0
  86. package/dest/rollup/checkpoint_root_rollup.d.ts.map +1 -0
  87. package/dest/rollup/checkpoint_root_rollup.js +178 -0
  88. package/dest/rollup/epoch_constant_data.d.ts +19 -2
  89. package/dest/rollup/epoch_constant_data.d.ts.map +1 -1
  90. package/dest/rollup/epoch_constant_data.js +20 -7
  91. package/dest/rollup/index.d.ts +8 -5
  92. package/dest/rollup/index.d.ts.map +1 -1
  93. package/dest/rollup/index.js +8 -5
  94. package/dest/rollup/rollup_proof_data.d.ts +10 -0
  95. package/dest/rollup/rollup_proof_data.d.ts.map +1 -0
  96. package/dest/rollup/rollup_proof_data.js +1 -0
  97. package/dest/rollup/root_rollup.d.ts +26 -23
  98. package/dest/rollup/root_rollup.d.ts.map +1 -1
  99. package/dest/rollup/root_rollup.js +28 -39
  100. package/dest/stats/stats.d.ts +1 -1
  101. package/dest/stats/stats.d.ts.map +1 -1
  102. package/dest/tests/factories.d.ts +15 -40
  103. package/dest/tests/factories.d.ts.map +1 -1
  104. package/dest/tests/factories.js +70 -78
  105. package/dest/tests/mocks.d.ts +3 -2
  106. package/dest/tests/mocks.d.ts.map +1 -1
  107. package/dest/tests/mocks.js +3 -3
  108. package/dest/tx/block_header.d.ts +12 -13
  109. package/dest/tx/block_header.d.ts.map +1 -1
  110. package/dest/tx/block_header.js +16 -21
  111. package/dest/tx/global_variables.d.ts.map +1 -1
  112. package/dest/tx/global_variables.js +0 -1
  113. package/dest/tx/index.d.ts +0 -1
  114. package/dest/tx/index.d.ts.map +1 -1
  115. package/dest/tx/index.js +0 -1
  116. package/dest/tx/private_execution_result.d.ts +2 -2
  117. package/dest/tx/private_execution_result.d.ts.map +1 -1
  118. package/dest/tx/private_execution_result.js +3 -3
  119. package/dest/tx/tx_constant_data.d.ts +4 -4
  120. package/dest/tx/tx_constant_data.d.ts.map +1 -1
  121. package/dest/tx/tx_constant_data.js +6 -6
  122. package/dest/tx/tx_effect.d.ts +0 -3
  123. package/dest/tx/tx_effect.d.ts.map +1 -1
  124. package/dest/tx/tx_effect.js +2 -7
  125. package/package.json +8 -8
  126. package/src/avm/avm_circuit_public_inputs.ts +10 -0
  127. package/src/block/body.ts +23 -6
  128. package/src/block/index.ts +1 -0
  129. package/src/block/l2_block.ts +18 -8
  130. package/src/block/l2_block_code_to_purge.ts +30 -31
  131. package/src/block/l2_block_header.ts +232 -0
  132. package/src/block/l2_block_stream/l2_tips_memory_store.ts +1 -1
  133. package/src/block/test/l2_tips_store_test_suite.ts +1 -2
  134. package/src/interfaces/block-builder.ts +1 -6
  135. package/src/interfaces/epoch-prover.ts +34 -10
  136. package/src/interfaces/proving-job.ts +166 -51
  137. package/src/interfaces/server_circuit_prover.ts +65 -29
  138. package/src/interfaces/validator.ts +3 -2
  139. package/src/kernel/private_circuit_public_inputs.ts +5 -5
  140. package/src/kernel/private_context_inputs.ts +2 -2
  141. package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +1 -1
  142. package/src/p2p/consensus_payload.ts +8 -7
  143. package/src/proofs/proof_data.ts +1 -6
  144. package/src/proofs/proving_request_type.ts +8 -3
  145. package/src/rollup/base_or_merge_rollup_public_inputs.ts +1 -1
  146. package/src/rollup/base_rollup_hints.ts +9 -1
  147. package/src/rollup/block_constant_data.ts +13 -3
  148. package/src/rollup/block_merge_rollup.ts +13 -11
  149. package/src/rollup/block_rollup_public_inputs.ts +123 -0
  150. package/src/rollup/block_root_rollup.ts +209 -264
  151. package/src/rollup/checkpoint_constant_data.ts +84 -0
  152. package/src/{tx/proposed_block_header.ts → rollup/checkpoint_header.ts} +16 -17
  153. package/src/rollup/checkpoint_merge_rollup.ts +50 -0
  154. package/src/rollup/{block_root_or_block_merge_public_inputs.ts → checkpoint_rollup_public_inputs.ts} +26 -52
  155. package/src/rollup/checkpoint_root_rollup.ts +216 -0
  156. package/src/rollup/epoch_constant_data.ts +32 -8
  157. package/src/rollup/index.ts +8 -5
  158. package/src/rollup/rollup_proof_data.ts +12 -0
  159. package/src/rollup/root_rollup.ts +30 -41
  160. package/src/stats/stats.ts +8 -3
  161. package/src/tests/factories.ts +124 -135
  162. package/src/tests/mocks.ts +6 -13
  163. package/src/tx/block_header.ts +17 -32
  164. package/src/tx/global_variables.ts +0 -1
  165. package/src/tx/index.ts +0 -1
  166. package/src/tx/private_execution_result.ts +3 -3
  167. package/src/tx/tx_constant_data.ts +4 -4
  168. package/src/tx/tx_effect.ts +2 -7
  169. package/dest/rollup/block_root_or_block_merge_public_inputs.d.ts +0 -134
  170. package/dest/rollup/block_root_or_block_merge_public_inputs.d.ts.map +0 -1
  171. package/dest/rollup/block_root_or_block_merge_public_inputs.js +0 -125
  172. package/dest/rollup/empty_block_root_rollup_inputs.d.ts +0 -51
  173. package/dest/rollup/empty_block_root_rollup_inputs.d.ts.map +0 -1
  174. package/dest/rollup/empty_block_root_rollup_inputs.js +0 -65
  175. package/dest/rollup/padding_block_root_rollup_inputs.d.ts +0 -20
  176. package/dest/rollup/padding_block_root_rollup_inputs.d.ts.map +0 -1
  177. package/dest/rollup/padding_block_root_rollup_inputs.js +0 -39
  178. package/dest/rollup/previous_rollup_block_data.d.ts +0 -47
  179. package/dest/rollup/previous_rollup_block_data.d.ts.map +0 -1
  180. package/dest/rollup/previous_rollup_block_data.js +0 -37
  181. package/dest/tx/proposed_block_header.d.ts.map +0 -1
  182. package/src/rollup/empty_block_root_rollup_inputs.ts +0 -80
  183. package/src/rollup/padding_block_root_rollup_inputs.ts +0 -47
  184. package/src/rollup/previous_rollup_block_data.ts +0 -48
@@ -1,306 +1,257 @@
1
- import { BlobAccumulatorPublicInputs, FinalBlobBatchingChallenges } from '@aztec/blob-lib';
2
- import { ARCHIVE_HEIGHT, BLOBS_PER_BLOCK, FIELDS_PER_BLOB, L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH, NESTED_RECURSIVE_PROOF_LENGTH } from '@aztec/constants';
3
- import { BLS12Point, Fr } from '@aztec/foundation/fields';
1
+ import { SpongeBlob } from '@aztec/blob-lib/types';
2
+ import { ARCHIVE_HEIGHT, L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH } from '@aztec/constants';
3
+ import { Fr } from '@aztec/foundation/fields';
4
4
  import { bufferSchemaFor } from '@aztec/foundation/schemas';
5
- import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
6
- import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
7
- import { RootParityInput } from '../parity/root_parity_input.js';
8
- import { BlockHeader } from '../tx/block_header.js';
9
- import { PreviousRollupData } from './previous_rollup_data.js';
10
- export class BlockRootRollupData {
5
+ import { BufferReader, bigintToUInt64BE, serializeToBuffer } from '@aztec/foundation/serialize';
6
+ import { ParityPublicInputs } from '../parity/parity_public_inputs.js';
7
+ import { ProofData } from '../proofs/proof_data.js';
8
+ import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
9
+ import { StateReference } from '../tx/state_reference.js';
10
+ import { BaseOrMergeRollupPublicInputs } from './base_or_merge_rollup_public_inputs.js';
11
+ import { CheckpointConstantData } from './checkpoint_constant_data.js';
12
+ export class BlockRootFirstRollupPrivateInputs {
11
13
  l1ToL2Roots;
12
- l1ToL2MessageSubtreeSiblingPath;
13
- previousArchiveSiblingPath;
14
+ previousRollups;
15
+ previousL1ToL2;
16
+ newL1ToL2MessageSubtreeSiblingPath;
14
17
  newArchiveSiblingPath;
15
- previousBlockHeader;
16
- startBlobAccumulator;
17
- finalBlobChallenges;
18
- proverId;
19
18
  constructor(/**
20
19
  * The original and converted roots of the L1 to L2 messages subtrees.
21
20
  */ l1ToL2Roots, /**
22
- * Hint for inserting the new l1 to l2 message subtree.
23
- */ l1ToL2MessageSubtreeSiblingPath, /**
24
- * Hint for checking the hash of previous_block_header is the last leaf of the previous archive.
25
- */ previousArchiveSiblingPath, /**
21
+ * The previous rollup proof data from base or merge rollup circuits.
22
+ */ previousRollups, /**
23
+ * The l1 to l2 message tree snapshot immediately before this block.
24
+ */ previousL1ToL2, /**
25
+ * Hint for inserting the new l1 to l2 message subtree into `previousL1ToL2`.
26
+ */ newL1ToL2MessageSubtreeSiblingPath, /**
26
27
  * Hint for inserting the new block hash to the last archive.
27
- */ newArchiveSiblingPath, /**
28
- * The header of the previous block.
29
- */ previousBlockHeader, /**
30
- * The current blob accumulation state across the epoch.
31
- */ startBlobAccumulator, /**
32
- * Finalized challenges z and gamma for performing blob batching. Shared value across the epoch.
33
- */ finalBlobChallenges, /**
34
- * Identifier of the prover.
35
- */ proverId){
28
+ */ newArchiveSiblingPath){
36
29
  this.l1ToL2Roots = l1ToL2Roots;
37
- this.l1ToL2MessageSubtreeSiblingPath = l1ToL2MessageSubtreeSiblingPath;
38
- this.previousArchiveSiblingPath = previousArchiveSiblingPath;
30
+ this.previousRollups = previousRollups;
31
+ this.previousL1ToL2 = previousL1ToL2;
32
+ this.newL1ToL2MessageSubtreeSiblingPath = newL1ToL2MessageSubtreeSiblingPath;
39
33
  this.newArchiveSiblingPath = newArchiveSiblingPath;
40
- this.previousBlockHeader = previousBlockHeader;
41
- this.startBlobAccumulator = startBlobAccumulator;
42
- this.finalBlobChallenges = finalBlobChallenges;
43
- this.proverId = proverId;
44
- }
45
- /**
46
- * Serializes the inputs to a buffer.
47
- * @returns - The inputs serialized to a buffer.
48
- */ toBuffer() {
49
- return serializeToBuffer(...BlockRootRollupData.getFields(this));
50
- }
51
- /**
52
- * Serializes the inputs to a hex string.
53
- * @returns The instance serialized to a hex string.
54
- */ toString() {
55
- return bufferToHex(this.toBuffer());
56
- }
57
- /**
58
- * Creates a new instance from fields.
59
- * @param fields - Fields to create the instance from.
60
- * @returns A new RootRollupInputs instance.
61
- */ static from(fields) {
62
- return new BlockRootRollupData(...BlockRootRollupData.getFields(fields));
63
- }
64
- /**
65
- * Extracts fields from an instance.
66
- * @param fields - Fields to create the instance from.
67
- * @returns An array of fields.
68
- */ static getFields(fields) {
34
+ }
35
+ static from(fields) {
36
+ return new BlockRootFirstRollupPrivateInputs(...BlockRootFirstRollupPrivateInputs.getFields(fields));
37
+ }
38
+ static getFields(fields) {
69
39
  return [
70
40
  fields.l1ToL2Roots,
71
- fields.l1ToL2MessageSubtreeSiblingPath,
72
- fields.previousArchiveSiblingPath,
73
- fields.newArchiveSiblingPath,
74
- fields.previousBlockHeader,
75
- fields.startBlobAccumulator,
76
- fields.finalBlobChallenges,
77
- fields.proverId
41
+ fields.previousRollups,
42
+ fields.previousL1ToL2,
43
+ fields.newL1ToL2MessageSubtreeSiblingPath,
44
+ fields.newArchiveSiblingPath
78
45
  ];
79
46
  }
80
- /**
81
- * Deserializes the inputs from a buffer.
82
- * @param buffer - A buffer to deserialize from.
83
- * @returns A new RootRollupInputs instance.
84
- */ static fromBuffer(buffer) {
47
+ toBuffer() {
48
+ return serializeToBuffer(...BlockRootFirstRollupPrivateInputs.getFields(this));
49
+ }
50
+ static fromBuffer(buffer) {
85
51
  const reader = BufferReader.asReader(buffer);
86
- return new BlockRootRollupData(RootParityInput.fromBuffer(reader, NESTED_RECURSIVE_PROOF_LENGTH), reader.readArray(L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH, Fr), reader.readArray(ARCHIVE_HEIGHT, Fr), reader.readArray(ARCHIVE_HEIGHT, Fr), BlockHeader.fromBuffer(reader), reader.readObject(BlobAccumulatorPublicInputs), reader.readObject(FinalBlobBatchingChallenges), Fr.fromBuffer(reader));
52
+ return new BlockRootFirstRollupPrivateInputs(ProofData.fromBuffer(reader, ParityPublicInputs), [
53
+ ProofData.fromBuffer(reader, BaseOrMergeRollupPublicInputs),
54
+ ProofData.fromBuffer(reader, BaseOrMergeRollupPublicInputs)
55
+ ], AppendOnlyTreeSnapshot.fromBuffer(reader), reader.readArray(L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH, Fr), reader.readArray(ARCHIVE_HEIGHT, Fr));
56
+ }
57
+ toJSON() {
58
+ return this.toBuffer();
59
+ }
60
+ static get schema() {
61
+ return bufferSchemaFor(BlockRootFirstRollupPrivateInputs);
62
+ }
63
+ }
64
+ export class BlockRootSingleTxFirstRollupPrivateInputs {
65
+ l1ToL2Roots;
66
+ previousRollup;
67
+ previousL1ToL2;
68
+ newL1ToL2MessageSubtreeSiblingPath;
69
+ newArchiveSiblingPath;
70
+ constructor(/**
71
+ * The original and converted roots of the L1 to L2 messages subtrees.
72
+ */ l1ToL2Roots, /**
73
+ * The previous rollup proof data from base or merge rollup circuits.
74
+ */ previousRollup, /**
75
+ * The l1 to l2 message tree snapshot immediately before this block.
76
+ */ previousL1ToL2, /**
77
+ * Hint for inserting the new l1 to l2 message subtree.
78
+ */ newL1ToL2MessageSubtreeSiblingPath, /**
79
+ * Hint for inserting the new block hash to the last archive.
80
+ */ newArchiveSiblingPath){
81
+ this.l1ToL2Roots = l1ToL2Roots;
82
+ this.previousRollup = previousRollup;
83
+ this.previousL1ToL2 = previousL1ToL2;
84
+ this.newL1ToL2MessageSubtreeSiblingPath = newL1ToL2MessageSubtreeSiblingPath;
85
+ this.newArchiveSiblingPath = newArchiveSiblingPath;
87
86
  }
88
- /**
89
- * Deserializes the inputs from a hex string.
90
- * @param str - A hex string to deserialize from.
91
- * @returns A new RootRollupInputs instance.
92
- */ static fromString(str) {
93
- return BlockRootRollupData.fromBuffer(hexToBuffer(str));
87
+ static from(fields) {
88
+ return new BlockRootSingleTxFirstRollupPrivateInputs(...BlockRootSingleTxFirstRollupPrivateInputs.getFields(fields));
94
89
  }
95
- /** Returns a buffer representation for JSON serialization. */ toJSON() {
90
+ static getFields(fields) {
91
+ return [
92
+ fields.l1ToL2Roots,
93
+ fields.previousRollup,
94
+ fields.previousL1ToL2,
95
+ fields.newL1ToL2MessageSubtreeSiblingPath,
96
+ fields.newArchiveSiblingPath
97
+ ];
98
+ }
99
+ toBuffer() {
100
+ return serializeToBuffer(...BlockRootSingleTxFirstRollupPrivateInputs.getFields(this));
101
+ }
102
+ static fromBuffer(buffer) {
103
+ const reader = BufferReader.asReader(buffer);
104
+ return new BlockRootSingleTxFirstRollupPrivateInputs(ProofData.fromBuffer(reader, ParityPublicInputs), ProofData.fromBuffer(reader, BaseOrMergeRollupPublicInputs), AppendOnlyTreeSnapshot.fromBuffer(reader), reader.readArray(L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH, Fr), reader.readArray(ARCHIVE_HEIGHT, Fr));
105
+ }
106
+ toJSON() {
96
107
  return this.toBuffer();
97
108
  }
98
- /** Creates an instance from a hex string. */ static get schema() {
99
- return bufferSchemaFor(BlockRootRollupData);
109
+ static get schema() {
110
+ return bufferSchemaFor(BlockRootSingleTxFirstRollupPrivateInputs);
100
111
  }
101
112
  }
102
- export class BlockRootRollupBlobData {
103
- blobFields;
104
- blobCommitments;
105
- blobsHash;
113
+ export class BlockRootEmptyTxFirstRollupPrivateInputs {
114
+ l1ToL2Roots;
115
+ previousArchive;
116
+ previousState;
117
+ constants;
118
+ startSpongeBlob;
119
+ timestamp;
120
+ newL1ToL2MessageSubtreeSiblingPath;
121
+ newArchiveSiblingPath;
106
122
  constructor(/**
107
- * Flat list of all tx effects which will be added to the blob.
108
- * Below line gives error 'Type instantiation is excessively deep and possibly infinite. ts(2589)'
109
- * Tuple<Fr, FIELDS_PER_BLOB * BLOBS_PER_BLOCK>
110
- */ blobFields, /**
111
- * KZG commitments representing the blob (precomputed in ts, injected to use inside circuit).
112
- */ blobCommitments, /**
113
- * The hash of eth blob hashes for this block
114
- * See yarn-project/foundation/src/blob/index.ts or body.ts for calculation
115
- */ blobsHash){
116
- this.blobFields = blobFields;
117
- this.blobCommitments = blobCommitments;
118
- this.blobsHash = blobsHash;
119
- }
120
- /**
121
- * Serializes the inputs to a buffer.
122
- * @returns - The inputs serialized to a buffer.
123
- */ toBuffer() {
124
- return serializeToBuffer(...BlockRootRollupBlobData.getFields(this));
125
- }
126
- /**
127
- * Serializes the inputs to a hex string.
128
- * @returns The instance serialized to a hex string.
129
- */ toString() {
130
- return bufferToHex(this.toBuffer());
131
- }
132
- /**
133
- * Creates a new instance from fields.
134
- * @param fields - Fields to create the instance from.
135
- * @returns A new RootRollupInputs instance.
136
- */ static from(fields) {
137
- return new BlockRootRollupBlobData(...BlockRootRollupBlobData.getFields(fields));
138
- }
139
- /**
140
- * Extracts fields from an instance.
141
- * @param fields - Fields to create the instance from.
142
- * @returns An array of fields.
143
- */ static getFields(fields) {
123
+ * The original and converted roots of the L1 to L2 messages subtrees.
124
+ */ l1ToL2Roots, /**
125
+ * The archive after applying the previous block.
126
+ */ previousArchive, /**
127
+ * The state reference of the previous block.
128
+ */ previousState, /**
129
+ * The constants of the checkpoint.
130
+ */ constants, /**
131
+ * The start sponge blob of this block. No data has been absorbed into it yet, since it's the first block. But the
132
+ * number of expected fields must be set to the total number of fields in the entire checkpoint.
133
+ */ startSpongeBlob, /**
134
+ * The timestamp of this block.
135
+ */ timestamp, /**
136
+ * Hint for inserting the new l1 to l2 message subtree.
137
+ */ newL1ToL2MessageSubtreeSiblingPath, /**
138
+ * Hint for inserting the new block hash to the last archive.
139
+ */ newArchiveSiblingPath){
140
+ this.l1ToL2Roots = l1ToL2Roots;
141
+ this.previousArchive = previousArchive;
142
+ this.previousState = previousState;
143
+ this.constants = constants;
144
+ this.startSpongeBlob = startSpongeBlob;
145
+ this.timestamp = timestamp;
146
+ this.newL1ToL2MessageSubtreeSiblingPath = newL1ToL2MessageSubtreeSiblingPath;
147
+ this.newArchiveSiblingPath = newArchiveSiblingPath;
148
+ }
149
+ static from(fields) {
150
+ return new BlockRootEmptyTxFirstRollupPrivateInputs(...BlockRootEmptyTxFirstRollupPrivateInputs.getFields(fields));
151
+ }
152
+ static getFields(fields) {
144
153
  return [
145
- fields.blobFields,
146
- fields.blobCommitments,
147
- fields.blobsHash
154
+ fields.l1ToL2Roots,
155
+ fields.previousArchive,
156
+ fields.previousState,
157
+ fields.constants,
158
+ fields.startSpongeBlob,
159
+ fields.timestamp,
160
+ fields.newL1ToL2MessageSubtreeSiblingPath,
161
+ fields.newArchiveSiblingPath
148
162
  ];
149
163
  }
150
- /**
151
- * Deserializes the inputs from a buffer.
152
- * @param buffer - A buffer to deserialize from.
153
- * @returns A new RootRollupInputs instance.
154
- */ static fromBuffer(buffer) {
164
+ toBuffer() {
165
+ return serializeToBuffer([
166
+ this.l1ToL2Roots,
167
+ this.previousArchive,
168
+ this.previousState,
169
+ this.constants,
170
+ this.startSpongeBlob,
171
+ bigintToUInt64BE(this.timestamp),
172
+ this.newL1ToL2MessageSubtreeSiblingPath,
173
+ this.newArchiveSiblingPath
174
+ ]);
175
+ }
176
+ static fromBuffer(buffer) {
155
177
  const reader = BufferReader.asReader(buffer);
156
- return new BlockRootRollupBlobData(// Below line gives error 'Type instantiation is excessively deep and possibly infinite. ts(2589)'
157
- // reader.readArray(FIELDS_PER_BLOB, Fr),
158
- Array.from({
159
- length: FIELDS_PER_BLOB * BLOBS_PER_BLOCK
160
- }, ()=>Fr.fromBuffer(reader)), reader.readArray(BLOBS_PER_BLOCK, BLS12Point), Fr.fromBuffer(reader));
161
- }
162
- /**
163
- * Deserializes the inputs from a hex string.
164
- * @param str - A hex string to deserialize from.
165
- * @returns A new RootRollupInputs instance.
166
- */ static fromString(str) {
167
- return BlockRootRollupBlobData.fromBuffer(hexToBuffer(str));
168
- }
169
- /** Returns a buffer representation for JSON serialization. */ toJSON() {
178
+ return new BlockRootEmptyTxFirstRollupPrivateInputs(ProofData.fromBuffer(reader, ParityPublicInputs), AppendOnlyTreeSnapshot.fromBuffer(reader), StateReference.fromBuffer(reader), CheckpointConstantData.fromBuffer(reader), SpongeBlob.fromBuffer(reader), reader.readUInt64(), reader.readArray(L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH, Fr), reader.readArray(ARCHIVE_HEIGHT, Fr));
179
+ }
180
+ toJSON() {
170
181
  return this.toBuffer();
171
182
  }
172
- /** Creates an instance from a hex string. */ static get schema() {
173
- return bufferSchemaFor(BlockRootRollupBlobData);
183
+ static get schema() {
184
+ return bufferSchemaFor(BlockRootEmptyTxFirstRollupPrivateInputs);
174
185
  }
175
186
  }
176
- /**
177
- * Represents inputs of the block root rollup circuit.
178
- */ export class BlockRootRollupInputs {
179
- previousRollupData;
180
- data;
181
- blobData;
187
+ export class BlockRootRollupPrivateInputs {
188
+ previousRollups;
189
+ newArchiveSiblingPath;
182
190
  constructor(/**
183
- * The previous rollup data from 2 merge or base rollup circuits.
184
- */ previousRollupData, data, blobData){
185
- this.previousRollupData = previousRollupData;
186
- this.data = data;
187
- this.blobData = blobData;
188
- }
189
- /**
190
- * Serializes the inputs to a buffer.
191
- * @returns - The inputs serialized to a buffer.
192
- */ toBuffer() {
193
- return serializeToBuffer(...BlockRootRollupInputs.getFields(this));
194
- }
195
- /**
196
- * Serializes the inputs to a hex string.
197
- * @returns The instance serialized to a hex string.
198
- */ toString() {
199
- return bufferToHex(this.toBuffer());
200
- }
201
- /**
202
- * Creates a new instance from fields.
203
- * @param fields - Fields to create the instance from.
204
- * @returns A new RootRollupInputs instance.
205
- */ static from(fields) {
206
- return new BlockRootRollupInputs(...BlockRootRollupInputs.getFields(fields));
207
- }
208
- /**
209
- * Extracts fields from an instance.
210
- * @param fields - Fields to create the instance from.
211
- * @returns An array of fields.
212
- */ static getFields(fields) {
191
+ * The previous rollup proof data from base or merge rollup circuits.
192
+ */ previousRollups, /**
193
+ * Hint for inserting the new block hash to the last archive.
194
+ */ newArchiveSiblingPath){
195
+ this.previousRollups = previousRollups;
196
+ this.newArchiveSiblingPath = newArchiveSiblingPath;
197
+ }
198
+ static from(fields) {
199
+ return new BlockRootRollupPrivateInputs(...BlockRootRollupPrivateInputs.getFields(fields));
200
+ }
201
+ static getFields(fields) {
213
202
  return [
214
- fields.previousRollupData,
215
- fields.data,
216
- fields.blobData
203
+ fields.previousRollups,
204
+ fields.newArchiveSiblingPath
217
205
  ];
218
206
  }
219
- /**
220
- * Deserializes the inputs from a buffer.
221
- * @param buffer - A buffer to deserialize from.
222
- * @returns A new RootRollupInputs instance.
223
- */ static fromBuffer(buffer) {
207
+ toBuffer() {
208
+ return serializeToBuffer(...BlockRootRollupPrivateInputs.getFields(this));
209
+ }
210
+ static fromBuffer(buffer) {
224
211
  const reader = BufferReader.asReader(buffer);
225
- return new BlockRootRollupInputs([
226
- reader.readObject(PreviousRollupData),
227
- reader.readObject(PreviousRollupData)
228
- ], reader.readObject(BlockRootRollupData), reader.readObject(BlockRootRollupBlobData));
229
- }
230
- /**
231
- * Deserializes the inputs from a hex string.
232
- * @param str - A hex string to deserialize from.
233
- * @returns A new RootRollupInputs instance.
234
- */ static fromString(str) {
235
- return BlockRootRollupInputs.fromBuffer(hexToBuffer(str));
236
- }
237
- /** Returns a buffer representation for JSON serialization. */ toJSON() {
212
+ return new BlockRootRollupPrivateInputs([
213
+ ProofData.fromBuffer(reader, BaseOrMergeRollupPublicInputs),
214
+ ProofData.fromBuffer(reader, BaseOrMergeRollupPublicInputs)
215
+ ], reader.readArray(ARCHIVE_HEIGHT, Fr));
216
+ }
217
+ toJSON() {
238
218
  return this.toBuffer();
239
219
  }
240
- /** Creates an instance from a hex string. */ static get schema() {
241
- return bufferSchemaFor(BlockRootRollupInputs);
220
+ static get schema() {
221
+ return bufferSchemaFor(BlockRootRollupPrivateInputs);
242
222
  }
243
223
  }
244
- export class SingleTxBlockRootRollupInputs {
245
- previousRollupData;
246
- data;
247
- blobData;
248
- constructor(previousRollupData, data, blobData){
249
- this.previousRollupData = previousRollupData;
250
- this.data = data;
251
- this.blobData = blobData;
252
- }
253
- /**
254
- * Serializes the inputs to a buffer.
255
- * @returns - The inputs serialized to a buffer.
256
- */ toBuffer() {
257
- return serializeToBuffer(...SingleTxBlockRootRollupInputs.getFields(this));
258
- }
259
- /**
260
- * Serializes the inputs to a hex string.
261
- * @returns The instance serialized to a hex string.
262
- */ toString() {
263
- return bufferToHex(this.toBuffer());
264
- }
265
- /**
266
- * Creates a new instance from fields.
267
- * @param fields - Fields to create the instance from.
268
- * @returns A new RootRollupInputs instance.
269
- */ static from(fields) {
270
- return new SingleTxBlockRootRollupInputs(...SingleTxBlockRootRollupInputs.getFields(fields));
271
- }
272
- /**
273
- * Extracts fields from an instance.
274
- * @param fields - Fields to create the instance from.
275
- * @returns An array of fields.
276
- */ static getFields(fields) {
224
+ export class BlockRootSingleTxRollupPrivateInputs {
225
+ previousRollup;
226
+ newArchiveSiblingPath;
227
+ constructor(/**
228
+ * The previous rollup proof data from base or merge rollup circuits.
229
+ */ previousRollup, /**
230
+ * Hint for inserting the new block hash to the last archive.
231
+ */ newArchiveSiblingPath){
232
+ this.previousRollup = previousRollup;
233
+ this.newArchiveSiblingPath = newArchiveSiblingPath;
234
+ }
235
+ static from(fields) {
236
+ return new BlockRootSingleTxRollupPrivateInputs(...BlockRootSingleTxRollupPrivateInputs.getFields(fields));
237
+ }
238
+ static getFields(fields) {
277
239
  return [
278
- fields.previousRollupData,
279
- fields.data,
280
- fields.blobData
240
+ fields.previousRollup,
241
+ fields.newArchiveSiblingPath
281
242
  ];
282
243
  }
283
- /**
284
- * Deserializes the inputs from a buffer.
285
- * @param buffer - A buffer to deserialize from.
286
- * @returns A new RootRollupInputs instance.
287
- */ static fromBuffer(buffer) {
244
+ toBuffer() {
245
+ return serializeToBuffer(...BlockRootSingleTxRollupPrivateInputs.getFields(this));
246
+ }
247
+ static fromBuffer(buffer) {
288
248
  const reader = BufferReader.asReader(buffer);
289
- return new SingleTxBlockRootRollupInputs([
290
- reader.readObject(PreviousRollupData)
291
- ], reader.readObject(BlockRootRollupData), reader.readObject(BlockRootRollupBlobData));
292
- }
293
- /**
294
- * Deserializes the inputs from a hex string.
295
- * @param str - A hex string to deserialize from.
296
- * @returns A new RootRollupInputs instance.
297
- */ static fromString(str) {
298
- return SingleTxBlockRootRollupInputs.fromBuffer(hexToBuffer(str));
299
- }
300
- /** Returns a buffer representation for JSON serialization. */ toJSON() {
249
+ return new BlockRootSingleTxRollupPrivateInputs(ProofData.fromBuffer(reader, BaseOrMergeRollupPublicInputs), reader.readArray(ARCHIVE_HEIGHT, Fr));
250
+ }
251
+ toJSON() {
301
252
  return this.toBuffer();
302
253
  }
303
- /** Creates an instance from a hex string. */ static get schema() {
304
- return bufferSchemaFor(SingleTxBlockRootRollupInputs);
254
+ static get schema() {
255
+ return bufferSchemaFor(BlockRootSingleTxRollupPrivateInputs);
305
256
  }
306
257
  }
@@ -0,0 +1,54 @@
1
+ import { EthAddress } from '@aztec/foundation/eth-address';
2
+ import { Fr } from '@aztec/foundation/fields';
3
+ import { BufferReader } from '@aztec/foundation/serialize';
4
+ import type { FieldsOf } from '@aztec/foundation/types';
5
+ import { AztecAddress } from '../aztec-address/index.js';
6
+ import { GasFees } from '../gas/gas_fees.js';
7
+ /**
8
+ * Constants that are the same for the entire checkpoint.
9
+ */
10
+ export declare class CheckpointConstantData {
11
+ /** ChainId of the rollup. */
12
+ chainId: Fr;
13
+ /** Version of the rollup. */
14
+ version: Fr;
15
+ /** Root of the verification key tree. */
16
+ vkTreeRoot: Fr;
17
+ /** Root of the protocol contract tree. */
18
+ protocolContractTreeRoot: Fr;
19
+ /** Identifier of the prover. */
20
+ proverId: Fr;
21
+ /** Slot number of the checkpoint. */
22
+ slotNumber: Fr;
23
+ /** Coinbase address of the rollup. */
24
+ coinbase: EthAddress;
25
+ /** Address to receive fees. */
26
+ feeRecipient: AztecAddress;
27
+ /** Global gas fees for this checkpoint. */
28
+ gasFees: GasFees;
29
+ constructor(
30
+ /** ChainId of the rollup. */
31
+ chainId: Fr,
32
+ /** Version of the rollup. */
33
+ version: Fr,
34
+ /** Root of the verification key tree. */
35
+ vkTreeRoot: Fr,
36
+ /** Root of the protocol contract tree. */
37
+ protocolContractTreeRoot: Fr,
38
+ /** Identifier of the prover. */
39
+ proverId: Fr,
40
+ /** Slot number of the checkpoint. */
41
+ slotNumber: Fr,
42
+ /** Coinbase address of the rollup. */
43
+ coinbase: EthAddress,
44
+ /** Address to receive fees. */
45
+ feeRecipient: AztecAddress,
46
+ /** Global gas fees for this checkpoint. */
47
+ gasFees: GasFees);
48
+ static from(fields: FieldsOf<CheckpointConstantData>): CheckpointConstantData;
49
+ static getFields(fields: FieldsOf<CheckpointConstantData>): readonly [Fr, Fr, Fr, Fr, Fr, Fr, EthAddress, AztecAddress, GasFees];
50
+ static empty(): CheckpointConstantData;
51
+ toBuffer(): Buffer<ArrayBufferLike>;
52
+ static fromBuffer(buffer: Buffer | BufferReader): CheckpointConstantData;
53
+ }
54
+ //# sourceMappingURL=checkpoint_constant_data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint_constant_data.d.ts","sourceRoot":"","sources":["../../src/rollup/checkpoint_constant_data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;GAEG;AACH,qBAAa,sBAAsB;IAE/B,6BAA6B;IACtB,OAAO,EAAE,EAAE;IAClB,6BAA6B;IACtB,OAAO,EAAE,EAAE;IAClB,yCAAyC;IAClC,UAAU,EAAE,EAAE;IACrB,0CAA0C;IACnC,wBAAwB,EAAE,EAAE;IACnC,gCAAgC;IACzB,QAAQ,EAAE,EAAE;IACnB,qCAAqC;IAC9B,UAAU,EAAE,EAAE;IACrB,sCAAsC;IAC/B,QAAQ,EAAE,UAAU;IAC3B,+BAA+B;IACxB,YAAY,EAAE,YAAY;IACjC,2CAA2C;IACpC,OAAO,EAAE,OAAO;;IAjBvB,6BAA6B;IACtB,OAAO,EAAE,EAAE;IAClB,6BAA6B;IACtB,OAAO,EAAE,EAAE;IAClB,yCAAyC;IAClC,UAAU,EAAE,EAAE;IACrB,0CAA0C;IACnC,wBAAwB,EAAE,EAAE;IACnC,gCAAgC;IACzB,QAAQ,EAAE,EAAE;IACnB,qCAAqC;IAC9B,UAAU,EAAE,EAAE;IACrB,sCAAsC;IAC/B,QAAQ,EAAE,UAAU;IAC3B,+BAA+B;IACxB,YAAY,EAAE,YAAY;IACjC,2CAA2C;IACpC,OAAO,EAAE,OAAO;IAGzB,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC;IAIpD,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC;IAczD,MAAM,CAAC,KAAK;IAcZ,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;CAchD"}
@@ -0,0 +1,55 @@
1
+ import { EthAddress } from '@aztec/foundation/eth-address';
2
+ import { Fr } from '@aztec/foundation/fields';
3
+ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
4
+ import { AztecAddress } from '../aztec-address/index.js';
5
+ import { GasFees } from '../gas/gas_fees.js';
6
+ /**
7
+ * Constants that are the same for the entire checkpoint.
8
+ */ export class CheckpointConstantData {
9
+ chainId;
10
+ version;
11
+ vkTreeRoot;
12
+ protocolContractTreeRoot;
13
+ proverId;
14
+ slotNumber;
15
+ coinbase;
16
+ feeRecipient;
17
+ gasFees;
18
+ constructor(/** ChainId of the rollup. */ chainId, /** Version of the rollup. */ version, /** Root of the verification key tree. */ vkTreeRoot, /** Root of the protocol contract tree. */ protocolContractTreeRoot, /** Identifier of the prover. */ proverId, /** Slot number of the checkpoint. */ slotNumber, /** Coinbase address of the rollup. */ coinbase, /** Address to receive fees. */ feeRecipient, /** Global gas fees for this checkpoint. */ gasFees){
19
+ this.chainId = chainId;
20
+ this.version = version;
21
+ this.vkTreeRoot = vkTreeRoot;
22
+ this.protocolContractTreeRoot = protocolContractTreeRoot;
23
+ this.proverId = proverId;
24
+ this.slotNumber = slotNumber;
25
+ this.coinbase = coinbase;
26
+ this.feeRecipient = feeRecipient;
27
+ this.gasFees = gasFees;
28
+ }
29
+ static from(fields) {
30
+ return new CheckpointConstantData(...CheckpointConstantData.getFields(fields));
31
+ }
32
+ static getFields(fields) {
33
+ return [
34
+ fields.chainId,
35
+ fields.version,
36
+ fields.vkTreeRoot,
37
+ fields.protocolContractTreeRoot,
38
+ fields.proverId,
39
+ fields.slotNumber,
40
+ fields.coinbase,
41
+ fields.feeRecipient,
42
+ fields.gasFees
43
+ ];
44
+ }
45
+ static empty() {
46
+ return new CheckpointConstantData(Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO, EthAddress.ZERO, AztecAddress.ZERO, GasFees.empty());
47
+ }
48
+ toBuffer() {
49
+ return serializeToBuffer(...CheckpointConstantData.getFields(this));
50
+ }
51
+ static fromBuffer(buffer) {
52
+ const reader = BufferReader.asReader(buffer);
53
+ return new CheckpointConstantData(Fr.fromBuffer(reader), Fr.fromBuffer(reader), Fr.fromBuffer(reader), Fr.fromBuffer(reader), Fr.fromBuffer(reader), Fr.fromBuffer(reader), reader.readObject(EthAddress), reader.readObject(AztecAddress), reader.readObject(GasFees));
54
+ }
55
+ }