@aztec/stdlib 3.0.0-nightly.20250916 → 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 (202) hide show
  1. package/dest/avm/avm.d.ts +78 -1
  2. package/dest/avm/avm.d.ts.map +1 -1
  3. package/dest/avm/avm.js +20 -2
  4. package/dest/avm/avm_circuit_public_inputs.d.ts +6 -1
  5. package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
  6. package/dest/avm/avm_circuit_public_inputs.js +11 -6
  7. package/dest/avm/avm_proving_request.d.ts +41 -0
  8. package/dest/avm/avm_proving_request.d.ts.map +1 -1
  9. package/dest/block/body.d.ts +4 -1
  10. package/dest/block/body.d.ts.map +1 -1
  11. package/dest/block/body.js +16 -5
  12. package/dest/block/index.d.ts +1 -0
  13. package/dest/block/index.d.ts.map +1 -1
  14. package/dest/block/index.js +1 -0
  15. package/dest/block/l2_block.d.ts +8 -5
  16. package/dest/block/l2_block.d.ts.map +1 -1
  17. package/dest/block/l2_block.js +14 -7
  18. package/dest/block/l2_block_code_to_purge.d.ts +3 -14
  19. package/dest/block/l2_block_code_to_purge.d.ts.map +1 -1
  20. package/dest/block/l2_block_code_to_purge.js +23 -13
  21. package/dest/block/l2_block_header.d.ts +100 -0
  22. package/dest/block/l2_block_header.d.ts.map +1 -0
  23. package/dest/block/l2_block_header.js +146 -0
  24. package/dest/block/l2_block_stream/l2_tips_memory_store.js +1 -1
  25. package/dest/block/published_l2_block.d.ts +2 -2
  26. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  27. package/dest/block/test/l2_tips_store_test_suite.js +1 -3
  28. package/dest/interfaces/aztec-node.d.ts +5 -2
  29. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  30. package/dest/interfaces/aztec-node.js +1 -0
  31. package/dest/interfaces/block-builder.d.ts +1 -2
  32. package/dest/interfaces/block-builder.d.ts.map +1 -1
  33. package/dest/interfaces/epoch-prover.d.ts +25 -8
  34. package/dest/interfaces/epoch-prover.d.ts.map +1 -1
  35. package/dest/interfaces/proving-job.d.ts +204 -61
  36. package/dest/interfaces/proving-job.d.ts.map +1 -1
  37. package/dest/interfaces/proving-job.js +101 -39
  38. package/dest/interfaces/pxe.d.ts +8 -1
  39. package/dest/interfaces/pxe.d.ts.map +1 -1
  40. package/dest/interfaces/pxe.js +1 -0
  41. package/dest/interfaces/server_circuit_prover.d.ts +19 -16
  42. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  43. package/dest/interfaces/validator.d.ts +3 -2
  44. package/dest/interfaces/validator.d.ts.map +1 -1
  45. package/dest/kernel/private_circuit_public_inputs.d.ts +4 -4
  46. package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
  47. package/dest/kernel/private_circuit_public_inputs.js +7 -7
  48. package/dest/kernel/private_context_inputs.d.ts +2 -2
  49. package/dest/kernel/private_context_inputs.d.ts.map +1 -1
  50. package/dest/kernel/private_context_inputs.js +4 -4
  51. package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +1 -1
  52. package/dest/messaging/inbox_leaf.d.ts +2 -0
  53. package/dest/messaging/inbox_leaf.d.ts.map +1 -1
  54. package/dest/messaging/inbox_leaf.js +3 -0
  55. package/dest/p2p/consensus_payload.d.ts +7 -6
  56. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  57. package/dest/p2p/consensus_payload.js +7 -6
  58. package/dest/parity/root_parity_input.d.ts +1 -1
  59. package/dest/proofs/proof_data.d.ts +1 -1
  60. package/dest/proofs/proof_data.d.ts.map +1 -1
  61. package/dest/proofs/proof_data.js +2 -2
  62. package/dest/proofs/proving_request_type.d.ts +13 -8
  63. package/dest/proofs/proving_request_type.d.ts.map +1 -1
  64. package/dest/proofs/proving_request_type.js +13 -8
  65. package/dest/rollup/base_or_merge_rollup_public_inputs.d.ts +1 -1
  66. package/dest/rollup/base_or_merge_rollup_public_inputs.d.ts.map +1 -1
  67. package/dest/rollup/base_or_merge_rollup_public_inputs.js +1 -1
  68. package/dest/rollup/base_rollup_hints.d.ts +12 -3
  69. package/dest/rollup/base_rollup_hints.d.ts.map +1 -1
  70. package/dest/rollup/base_rollup_hints.js +11 -5
  71. package/dest/rollup/block_constant_data.d.ts +20 -6
  72. package/dest/rollup/block_constant_data.d.ts.map +1 -1
  73. package/dest/rollup/block_constant_data.js +15 -7
  74. package/dest/rollup/block_merge_rollup.d.ts +10 -9
  75. package/dest/rollup/block_merge_rollup.d.ts.map +1 -1
  76. package/dest/rollup/block_merge_rollup.js +14 -13
  77. package/dest/rollup/block_rollup_public_inputs.d.ts +124 -0
  78. package/dest/rollup/block_rollup_public_inputs.d.ts.map +1 -0
  79. package/dest/rollup/block_rollup_public_inputs.js +85 -0
  80. package/dest/rollup/block_root_rollup.d.ts +148 -184
  81. package/dest/rollup/block_root_rollup.d.ts.map +1 -1
  82. package/dest/rollup/block_root_rollup.js +211 -260
  83. package/dest/rollup/checkpoint_constant_data.d.ts +54 -0
  84. package/dest/rollup/checkpoint_constant_data.d.ts.map +1 -0
  85. package/dest/rollup/checkpoint_constant_data.js +55 -0
  86. package/dest/{tx/proposed_block_header.d.ts → rollup/checkpoint_header.d.ts} +11 -12
  87. package/dest/rollup/checkpoint_header.d.ts.map +1 -0
  88. package/dest/{tx/proposed_block_header.js → rollup/checkpoint_header.js} +9 -9
  89. package/dest/rollup/checkpoint_merge_rollup.d.ts +30 -0
  90. package/dest/rollup/checkpoint_merge_rollup.d.ts.map +1 -0
  91. package/dest/rollup/checkpoint_merge_rollup.js +37 -0
  92. package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +105 -0
  93. package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -0
  94. package/dest/rollup/checkpoint_rollup_public_inputs.js +105 -0
  95. package/dest/rollup/checkpoint_root_rollup.d.ts +117 -0
  96. package/dest/rollup/checkpoint_root_rollup.d.ts.map +1 -0
  97. package/dest/rollup/checkpoint_root_rollup.js +178 -0
  98. package/dest/rollup/epoch_constant_data.d.ts +19 -2
  99. package/dest/rollup/epoch_constant_data.d.ts.map +1 -1
  100. package/dest/rollup/epoch_constant_data.js +20 -7
  101. package/dest/rollup/index.d.ts +8 -5
  102. package/dest/rollup/index.d.ts.map +1 -1
  103. package/dest/rollup/index.js +8 -5
  104. package/dest/rollup/rollup_proof_data.d.ts +10 -0
  105. package/dest/rollup/rollup_proof_data.d.ts.map +1 -0
  106. package/dest/rollup/rollup_proof_data.js +1 -0
  107. package/dest/rollup/root_rollup.d.ts +26 -23
  108. package/dest/rollup/root_rollup.d.ts.map +1 -1
  109. package/dest/rollup/root_rollup.js +28 -39
  110. package/dest/stats/stats.d.ts +1 -1
  111. package/dest/stats/stats.d.ts.map +1 -1
  112. package/dest/tests/factories.d.ts +17 -41
  113. package/dest/tests/factories.d.ts.map +1 -1
  114. package/dest/tests/factories.js +76 -80
  115. package/dest/tests/mocks.d.ts +3 -2
  116. package/dest/tests/mocks.d.ts.map +1 -1
  117. package/dest/tests/mocks.js +3 -3
  118. package/dest/tx/block_header.d.ts +12 -13
  119. package/dest/tx/block_header.d.ts.map +1 -1
  120. package/dest/tx/block_header.js +16 -21
  121. package/dest/tx/global_variables.d.ts.map +1 -1
  122. package/dest/tx/global_variables.js +0 -1
  123. package/dest/tx/index.d.ts +0 -1
  124. package/dest/tx/index.d.ts.map +1 -1
  125. package/dest/tx/index.js +0 -1
  126. package/dest/tx/private_execution_result.d.ts +2 -2
  127. package/dest/tx/private_execution_result.d.ts.map +1 -1
  128. package/dest/tx/private_execution_result.js +3 -3
  129. package/dest/tx/tx_constant_data.d.ts +4 -4
  130. package/dest/tx/tx_constant_data.d.ts.map +1 -1
  131. package/dest/tx/tx_constant_data.js +6 -6
  132. package/dest/tx/tx_effect.d.ts +0 -3
  133. package/dest/tx/tx_effect.d.ts.map +1 -1
  134. package/dest/tx/tx_effect.js +2 -7
  135. package/dest/zkpassport/index.d.ts +3 -3
  136. package/dest/zkpassport/index.d.ts.map +1 -1
  137. package/dest/zkpassport/index.js +7 -7
  138. package/package.json +8 -8
  139. package/src/avm/avm.ts +22 -0
  140. package/src/avm/avm_circuit_public_inputs.ts +10 -0
  141. package/src/block/body.ts +23 -6
  142. package/src/block/index.ts +1 -0
  143. package/src/block/l2_block.ts +18 -8
  144. package/src/block/l2_block_code_to_purge.ts +30 -31
  145. package/src/block/l2_block_header.ts +232 -0
  146. package/src/block/l2_block_stream/l2_tips_memory_store.ts +1 -1
  147. package/src/block/test/l2_tips_store_test_suite.ts +1 -2
  148. package/src/interfaces/aztec-node.ts +8 -2
  149. package/src/interfaces/block-builder.ts +1 -6
  150. package/src/interfaces/epoch-prover.ts +34 -10
  151. package/src/interfaces/proving-job.ts +166 -51
  152. package/src/interfaces/pxe.ts +10 -1
  153. package/src/interfaces/server_circuit_prover.ts +65 -29
  154. package/src/interfaces/validator.ts +3 -2
  155. package/src/kernel/private_circuit_public_inputs.ts +5 -5
  156. package/src/kernel/private_context_inputs.ts +2 -2
  157. package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +1 -1
  158. package/src/messaging/inbox_leaf.ts +5 -0
  159. package/src/p2p/consensus_payload.ts +8 -7
  160. package/src/proofs/proof_data.ts +1 -6
  161. package/src/proofs/proving_request_type.ts +8 -3
  162. package/src/rollup/base_or_merge_rollup_public_inputs.ts +1 -1
  163. package/src/rollup/base_rollup_hints.ts +9 -1
  164. package/src/rollup/block_constant_data.ts +13 -3
  165. package/src/rollup/block_merge_rollup.ts +13 -11
  166. package/src/rollup/block_rollup_public_inputs.ts +123 -0
  167. package/src/rollup/block_root_rollup.ts +209 -264
  168. package/src/rollup/checkpoint_constant_data.ts +84 -0
  169. package/src/{tx/proposed_block_header.ts → rollup/checkpoint_header.ts} +16 -17
  170. package/src/rollup/checkpoint_merge_rollup.ts +50 -0
  171. package/src/rollup/{block_root_or_block_merge_public_inputs.ts → checkpoint_rollup_public_inputs.ts} +26 -52
  172. package/src/rollup/checkpoint_root_rollup.ts +216 -0
  173. package/src/rollup/epoch_constant_data.ts +32 -8
  174. package/src/rollup/index.ts +8 -5
  175. package/src/rollup/rollup_proof_data.ts +12 -0
  176. package/src/rollup/root_rollup.ts +30 -41
  177. package/src/stats/stats.ts +8 -3
  178. package/src/tests/factories.ts +139 -135
  179. package/src/tests/mocks.ts +6 -13
  180. package/src/tx/block_header.ts +17 -32
  181. package/src/tx/global_variables.ts +0 -1
  182. package/src/tx/index.ts +0 -1
  183. package/src/tx/private_execution_result.ts +3 -3
  184. package/src/tx/tx_constant_data.ts +4 -4
  185. package/src/tx/tx_effect.ts +2 -7
  186. package/src/zkpassport/index.ts +6 -6
  187. package/dest/rollup/block_root_or_block_merge_public_inputs.d.ts +0 -134
  188. package/dest/rollup/block_root_or_block_merge_public_inputs.d.ts.map +0 -1
  189. package/dest/rollup/block_root_or_block_merge_public_inputs.js +0 -125
  190. package/dest/rollup/empty_block_root_rollup_inputs.d.ts +0 -51
  191. package/dest/rollup/empty_block_root_rollup_inputs.d.ts.map +0 -1
  192. package/dest/rollup/empty_block_root_rollup_inputs.js +0 -65
  193. package/dest/rollup/padding_block_root_rollup_inputs.d.ts +0 -20
  194. package/dest/rollup/padding_block_root_rollup_inputs.d.ts.map +0 -1
  195. package/dest/rollup/padding_block_root_rollup_inputs.js +0 -39
  196. package/dest/rollup/previous_rollup_block_data.d.ts +0 -47
  197. package/dest/rollup/previous_rollup_block_data.d.ts.map +0 -1
  198. package/dest/rollup/previous_rollup_block_data.js +0 -37
  199. package/dest/tx/proposed_block_header.d.ts.map +0 -1
  200. package/src/rollup/empty_block_root_rollup_inputs.ts +0 -80
  201. package/src/rollup/padding_block_root_rollup_inputs.ts +0 -47
  202. package/src/rollup/previous_rollup_block_data.ts +0 -48
@@ -10,9 +10,7 @@ import { inspect } from 'util';
10
10
  import { z } from 'zod';
11
11
 
12
12
  import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
13
- import { ContentCommitment } from './content_commitment.js';
14
13
  import { GlobalVariables } from './global_variables.js';
15
- import { ProposedBlockHeader } from './proposed_block_header.js';
16
14
  import { StateReference } from './state_reference.js';
17
15
 
18
16
  /** A header of an L2 block. */
@@ -20,10 +18,13 @@ export class BlockHeader {
20
18
  constructor(
21
19
  /** Snapshot of archive before the block is applied. */
22
20
  public lastArchive: AppendOnlyTreeSnapshot,
23
- /** Hash of the body of an L2 block. */
24
- public contentCommitment: ContentCommitment,
25
21
  /** State reference. */
26
22
  public state: StateReference,
23
+ /**
24
+ * Hash of the sponge blob after the tx effects of this block has been applied.
25
+ * May contain tx effects from the previous blocks in the same checkpoint.
26
+ */
27
+ public spongeBlobHash: Fr,
27
28
  /** Global variables of an L2 block. */
28
29
  public globalVariables: GlobalVariables,
29
30
  /** Total fees in the block, computed by the root rollup circuit */
@@ -36,8 +37,8 @@ export class BlockHeader {
36
37
  return z
37
38
  .object({
38
39
  lastArchive: AppendOnlyTreeSnapshot.schema,
39
- contentCommitment: ContentCommitment.schema,
40
40
  state: StateReference.schema,
41
+ spongeBlobHash: schemas.Fr,
41
42
  globalVariables: GlobalVariables.schema,
42
43
  totalFees: schemas.Fr,
43
44
  totalManaUsed: schemas.Fr,
@@ -46,11 +47,10 @@ export class BlockHeader {
46
47
  }
47
48
 
48
49
  static getFields(fields: FieldsOf<BlockHeader>) {
49
- // Note: The order here must match the order in the ProposedHeaderLib solidity library.
50
50
  return [
51
51
  fields.lastArchive,
52
- fields.contentCommitment,
53
52
  fields.state,
53
+ fields.spongeBlobHash,
54
54
  fields.globalVariables,
55
55
  fields.totalFees,
56
56
  fields.totalManaUsed,
@@ -72,8 +72,8 @@ export class BlockHeader {
72
72
  getSize() {
73
73
  return (
74
74
  this.lastArchive.getSize() +
75
- this.contentCommitment.getSize() +
76
75
  this.state.getSize() +
76
+ this.spongeBlobHash.size +
77
77
  this.globalVariables.getSize() +
78
78
  this.totalFees.size +
79
79
  this.totalManaUsed.size
@@ -101,8 +101,8 @@ export class BlockHeader {
101
101
 
102
102
  return new BlockHeader(
103
103
  reader.readObject(AppendOnlyTreeSnapshot),
104
- reader.readObject(ContentCommitment),
105
104
  reader.readObject(StateReference),
105
+ reader.readObject(Fr),
106
106
  reader.readObject(GlobalVariables),
107
107
  reader.readObject(Fr),
108
108
  reader.readObject(Fr),
@@ -114,8 +114,8 @@ export class BlockHeader {
114
114
 
115
115
  return new BlockHeader(
116
116
  AppendOnlyTreeSnapshot.fromFields(reader),
117
- ContentCommitment.fromFields(reader),
118
117
  StateReference.fromFields(reader),
118
+ reader.readField(),
119
119
  GlobalVariables.fromFields(reader),
120
120
  reader.readField(),
121
121
  reader.readField(),
@@ -125,8 +125,8 @@ export class BlockHeader {
125
125
  static empty(fields: Partial<FieldsOf<BlockHeader>> = {}): BlockHeader {
126
126
  return BlockHeader.from({
127
127
  lastArchive: AppendOnlyTreeSnapshot.empty(),
128
- contentCommitment: ContentCommitment.empty(),
129
128
  state: StateReference.empty(),
129
+ spongeBlobHash: Fr.ZERO,
130
130
  globalVariables: GlobalVariables.empty(),
131
131
  totalFees: Fr.ZERO,
132
132
  totalManaUsed: Fr.ZERO,
@@ -137,8 +137,8 @@ export class BlockHeader {
137
137
  isEmpty(): boolean {
138
138
  return (
139
139
  this.lastArchive.isEmpty() &&
140
- this.contentCommitment.isEmpty() &&
141
140
  this.state.isEmpty() &&
141
+ this.spongeBlobHash.isZero() &&
142
142
  this.globalVariables.isEmpty() &&
143
143
  this.totalFees.isZero() &&
144
144
  this.totalManaUsed.isZero()
@@ -161,24 +161,11 @@ export class BlockHeader {
161
161
  return poseidon2HashWithSeparator(this.toFields(), GeneratorIndex.BLOCK_HASH);
162
162
  }
163
163
 
164
- toPropose(): ProposedBlockHeader {
165
- return new ProposedBlockHeader(
166
- this.lastArchive.root,
167
- this.contentCommitment,
168
- this.globalVariables.slotNumber,
169
- this.globalVariables.timestamp,
170
- this.globalVariables.coinbase,
171
- this.globalVariables.feeRecipient,
172
- this.globalVariables.gasFees,
173
- this.totalManaUsed,
174
- );
175
- }
176
-
177
164
  toInspect() {
178
165
  return {
179
166
  lastArchive: this.lastArchive.root.toString(),
180
- contentCommitment: this.contentCommitment.toInspect(),
181
167
  state: this.state.toInspect(),
168
+ spongeBlobHash: this.spongeBlobHash.toBigInt(),
182
169
  globalVariables: this.globalVariables.toInspect(),
183
170
  totalFees: this.totalFees.toBigInt(),
184
171
  totalManaUsed: this.totalManaUsed.toBigInt(),
@@ -188,13 +175,11 @@ export class BlockHeader {
188
175
  [inspect.custom]() {
189
176
  return `Header {
190
177
  lastArchive: ${inspect(this.lastArchive)},
191
- contentCommitment.blobsHash: ${inspect(this.contentCommitment.blobsHash)},
192
- contentCommitment.inHash: ${inspect(this.contentCommitment.inHash)},
193
- contentCommitment.outHash: ${inspect(this.contentCommitment.outHash)},
194
178
  state.l1ToL2MessageTree: ${inspect(this.state.l1ToL2MessageTree)},
195
179
  state.noteHashTree: ${inspect(this.state.partial.noteHashTree)},
196
180
  state.nullifierTree: ${inspect(this.state.partial.nullifierTree)},
197
181
  state.publicDataTree: ${inspect(this.state.partial.publicDataTree)},
182
+ spongeBlobHash: ${this.spongeBlobHash},
198
183
  globalVariables: ${inspect(this.globalVariables)},
199
184
  totalFees: ${this.totalFees},
200
185
  totalManaUsed: ${this.totalManaUsed},
@@ -203,12 +188,12 @@ export class BlockHeader {
203
188
 
204
189
  public equals(other: this): boolean {
205
190
  return (
206
- this.contentCommitment.equals(other.contentCommitment) &&
191
+ this.lastArchive.equals(other.lastArchive) &&
207
192
  this.state.equals(other.state) &&
193
+ this.spongeBlobHash.equals(other.spongeBlobHash) &&
208
194
  this.globalVariables.equals(other.globalVariables) &&
209
195
  this.totalFees.equals(other.totalFees) &&
210
- this.totalManaUsed.equals(other.totalManaUsed) &&
211
- this.lastArchive.equals(other.lastArchive)
196
+ this.totalManaUsed.equals(other.totalManaUsed)
212
197
  );
213
198
  }
214
199
  }
@@ -109,7 +109,6 @@ export class GlobalVariables {
109
109
  }
110
110
 
111
111
  static getFields(fields: FieldsOf<GlobalVariables>) {
112
- // Note: The order here must match the order in the ProposedHeaderLib solidity library.
113
112
  return [
114
113
  fields.chainId,
115
114
  fields.version,
package/src/tx/index.ts CHANGED
@@ -10,7 +10,6 @@ export * from './tx_constant_data.js';
10
10
  export * from './tx_context.js';
11
11
  export * from './tx_request.js';
12
12
  export * from './private_execution_result.js';
13
- export * from './proposed_block_header.js';
14
13
  export * from './public_call_request_with_calldata.js';
15
14
  export * from './tx_hash.js';
16
15
  export * from './tx_receipt.js';
@@ -103,10 +103,10 @@ export class PrivateExecutionResult {
103
103
  }
104
104
 
105
105
  /**
106
- * The block number that this execution was simulated with.
106
+ * The anchor block number that this execution was simulated with.
107
107
  */
108
- getSimulationBlockNumber(): UInt32 {
109
- return this.entrypoint.publicInputs.historicalHeader.globalVariables.blockNumber;
108
+ getSimulationAnchorBlockNumber(): UInt32 {
109
+ return this.entrypoint.publicInputs.anchorBlockHeader.globalVariables.blockNumber;
110
110
  }
111
111
  }
112
112
 
@@ -12,12 +12,12 @@ import { TxContext } from './tx_context.js';
12
12
  export class TxConstantData {
13
13
  constructor(
14
14
  /** Header of a block whose state is used during execution (not the block the transaction is included in). */
15
- public historicalHeader: BlockHeader,
15
+ public anchorBlockHeader: BlockHeader,
16
16
  /**
17
17
  * Context of the transaction.
18
18
  *
19
19
  * Note: `chainId` and `version` in txContext are not redundant to the values in
20
- * self.historical_header.global_variables because they can be different in case of a protocol upgrade. In such
20
+ * self.anchor_block_header.global_variables because they can be different in case of a protocol upgrade. In such
21
21
  * a situation we could be using header from a block before the upgrade took place but be using the updated
22
22
  * protocol to execute and prove the transaction.
23
23
  */
@@ -37,7 +37,7 @@ export class TxConstantData {
37
37
  }
38
38
 
39
39
  static getFields(fields: FieldsOf<TxConstantData>) {
40
- return [fields.historicalHeader, fields.txContext, fields.vkTreeRoot, fields.protocolContractTreeRoot] as const;
40
+ return [fields.anchorBlockHeader, fields.txContext, fields.vkTreeRoot, fields.protocolContractTreeRoot] as const;
41
41
  }
42
42
 
43
43
  static fromFields(fields: Fr[] | FieldReader): TxConstantData {
@@ -80,7 +80,7 @@ export class TxConstantData {
80
80
 
81
81
  getSize() {
82
82
  return (
83
- this.historicalHeader.getSize() +
83
+ this.anchorBlockHeader.getSize() +
84
84
  this.txContext.getSize() +
85
85
  this.vkTreeRoot.size +
86
86
  this.protocolContractTreeRoot.size
@@ -1,3 +1,4 @@
1
+ import { TX_EFFECT_PREFIX_BYTE_LENGTH, TX_START_PREFIX_BYTES_LENGTH } from '@aztec/blob-lib/encoding';
1
2
  import {
2
3
  CONTRACT_CLASS_LOGS_PREFIX,
3
4
  L2_L1_MSGS_PREFIX,
@@ -14,6 +15,7 @@ import {
14
15
  PUBLIC_LOGS_PREFIX,
15
16
  REVERT_CODE_PREFIX,
16
17
  TX_FEE_PREFIX,
18
+ TX_START_PREFIX,
17
19
  } from '@aztec/constants';
18
20
  import { type FieldsOf, makeTuple, makeTupleAsync } from '@aztec/foundation/array';
19
21
  import { toBufferBE } from '@aztec/foundation/bigint-buffer';
@@ -38,13 +40,6 @@ import { PrivateLog } from '../logs/private_log.js';
38
40
  import { PublicLog } from '../logs/public_log.js';
39
41
  import { TxHash } from './tx_hash.js';
40
42
 
41
- // This will appear as 0x74785f7374617274 in logs
42
- export const TX_START_PREFIX = 8392562855083340404n;
43
- // These are helper constants to decode tx effects from blob encoded fields
44
- export const TX_START_PREFIX_BYTES_LENGTH = TX_START_PREFIX.toString(16).length / 2;
45
- // 7 bytes for: | 0 | txlen[0] | txlen[1] | 0 | REVERT_CODE_PREFIX | 0 | revertCode |
46
- export const TX_EFFECT_PREFIX_BYTE_LENGTH = TX_START_PREFIX_BYTES_LENGTH + 7;
47
-
48
43
  export class TxEffect {
49
44
  constructor(
50
45
  /**
@@ -10,7 +10,7 @@ export type ViemZkPassportProofParams = {
10
10
  publicInputs: `0x${string}`[];
11
11
  committedInputs: `0x${string}`;
12
12
  committedInputCounts: bigint[];
13
- validityPeriodInDays: bigint;
13
+ validityPeriodInSeconds: bigint;
14
14
  domain: string;
15
15
  scope: string;
16
16
  devMode: boolean;
@@ -26,7 +26,7 @@ export class ZkPassportProofParams {
26
26
  public publicInputs: Fr[],
27
27
  public committedInputs: Buffer,
28
28
  public committedInputCounts: bigint[],
29
- public validityPeriodInDays: bigint,
29
+ public validityPeriodInSeconds: bigint,
30
30
  public domain: string,
31
31
  public scope: string,
32
32
  ) {}
@@ -43,7 +43,7 @@ export class ZkPassportProofParams {
43
43
  this.committedInputs,
44
44
  this.committedInputCounts.length,
45
45
  this.committedInputCounts,
46
- this.validityPeriodInDays,
46
+ this.validityPeriodInSeconds,
47
47
  this.domain,
48
48
  this.scope,
49
49
  ]);
@@ -64,7 +64,7 @@ export class ZkPassportProofParams {
64
64
  publicInputs,
65
65
  committedInputs,
66
66
  committedInputCounts,
67
- BigInt(100),
67
+ BigInt(100 * 60 * 60 * 24),
68
68
  'sequencer.alpha-testnet.aztec.network',
69
69
  'personhood',
70
70
  );
@@ -93,7 +93,7 @@ export class ZkPassportProofParams {
93
93
  params.publicInputs.map(input => Fr.fromString(input)),
94
94
  Buffer.from(withoutHexPrefix(params.committedInputs), 'hex'),
95
95
  params.committedInputCounts,
96
- params.validityPeriodInDays,
96
+ params.validityPeriodInSeconds,
97
97
  params.domain,
98
98
  params.scope,
99
99
  );
@@ -107,7 +107,7 @@ export class ZkPassportProofParams {
107
107
  publicInputs: this.publicInputs.map(input => input.toString()),
108
108
  committedInputs: `0x${this.committedInputs.toString('hex')}`,
109
109
  committedInputCounts: this.committedInputCounts,
110
- validityPeriodInDays: this.validityPeriodInDays,
110
+ validityPeriodInSeconds: this.validityPeriodInSeconds,
111
111
  domain: this.domain,
112
112
  scope: this.scope,
113
113
  };
@@ -1,134 +0,0 @@
1
- import { BlockBlobPublicInputs } from '@aztec/blob-lib';
2
- import { AZTEC_MAX_EPOCH_DURATION } from '@aztec/constants';
3
- import { EthAddress } from '@aztec/foundation/eth-address';
4
- import { Fr } from '@aztec/foundation/fields';
5
- import { BufferReader, type Tuple } from '@aztec/foundation/serialize';
6
- import type { FieldsOf } from '@aztec/foundation/types';
7
- import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
8
- import { GlobalVariables } from '../tx/global_variables.js';
9
- import { EpochConstantData } from './epoch_constant_data.js';
10
- /**
11
- * Output of the block root and block merge rollup circuits.
12
- */
13
- export declare class BlockRootOrBlockMergePublicInputs {
14
- /**
15
- * Constants for the entire epoch.
16
- */
17
- constants: EpochConstantData;
18
- /**
19
- * Archive tree immediately before this block range.
20
- */
21
- previousArchive: AppendOnlyTreeSnapshot;
22
- /**
23
- * Archive tree after adding this block range.
24
- */
25
- newArchive: AppendOnlyTreeSnapshot;
26
- /**
27
- * Global variables for the first block in the range.
28
- */
29
- startGlobalVariables: GlobalVariables;
30
- /**
31
- * Global variables for the last block in the range.
32
- */
33
- endGlobalVariables: GlobalVariables;
34
- /**
35
- * SHA256 hash of L2 to L1 messages. Used to make public inputs constant-sized (to then be opened onchain).
36
- * Note: Truncated to 31 bytes to fit in Fr.
37
- */
38
- outHash: Fr;
39
- /**
40
- * The hashes of the proposed block headers of the constituent blocks.
41
- */
42
- proposedBlockHeaderHashes: Tuple<Fr, typeof AZTEC_MAX_EPOCH_DURATION>;
43
- /**
44
- * The summed `transaction_fee`s and recipients of the constituent blocks.
45
- */
46
- fees: Tuple<FeeRecipient, typeof AZTEC_MAX_EPOCH_DURATION>;
47
- /**
48
- * Public inputs required to verify a batch of blobs.
49
- */
50
- blobPublicInputs: BlockBlobPublicInputs;
51
- constructor(
52
- /**
53
- * Constants for the entire epoch.
54
- */
55
- constants: EpochConstantData,
56
- /**
57
- * Archive tree immediately before this block range.
58
- */
59
- previousArchive: AppendOnlyTreeSnapshot,
60
- /**
61
- * Archive tree after adding this block range.
62
- */
63
- newArchive: AppendOnlyTreeSnapshot,
64
- /**
65
- * Global variables for the first block in the range.
66
- */
67
- startGlobalVariables: GlobalVariables,
68
- /**
69
- * Global variables for the last block in the range.
70
- */
71
- endGlobalVariables: GlobalVariables,
72
- /**
73
- * SHA256 hash of L2 to L1 messages. Used to make public inputs constant-sized (to then be opened onchain).
74
- * Note: Truncated to 31 bytes to fit in Fr.
75
- */
76
- outHash: Fr,
77
- /**
78
- * The hashes of the proposed block headers of the constituent blocks.
79
- */
80
- proposedBlockHeaderHashes: Tuple<Fr, typeof AZTEC_MAX_EPOCH_DURATION>,
81
- /**
82
- * The summed `transaction_fee`s and recipients of the constituent blocks.
83
- */
84
- fees: Tuple<FeeRecipient, typeof AZTEC_MAX_EPOCH_DURATION>,
85
- /**
86
- * Public inputs required to verify a batch of blobs.
87
- */
88
- blobPublicInputs: BlockBlobPublicInputs);
89
- /**
90
- * Deserializes from a buffer or reader.
91
- * @param buffer - Buffer or reader to read from.
92
- * @returns The deserialized public inputs.
93
- */
94
- static fromBuffer(buffer: Buffer | BufferReader): BlockRootOrBlockMergePublicInputs;
95
- /**
96
- * Serialize this as a buffer.
97
- * @returns The buffer.
98
- */
99
- toBuffer(): Buffer<ArrayBufferLike>;
100
- /**
101
- * Serialize this as a hex string.
102
- * @returns - The hex string.
103
- */
104
- toString(): `0x${string}`;
105
- /**
106
- * Deserializes from a hex string.
107
- * @param str - A hex string to deserialize from.
108
- * @returns A new BaseOrMergeRollupPublicInputs instance.
109
- */
110
- static fromString(str: string): BlockRootOrBlockMergePublicInputs;
111
- /** Returns a buffer representation for JSON serialization. */
112
- toJSON(): Buffer<ArrayBufferLike>;
113
- /** Creates an instance from a hex string. */
114
- static get schema(): import("zod").ZodType<BlockRootOrBlockMergePublicInputs, any, string>;
115
- }
116
- export declare class FeeRecipient {
117
- recipient: EthAddress;
118
- value: Fr;
119
- constructor(recipient: EthAddress, value: Fr);
120
- static fromBuffer(buffer: Buffer | BufferReader): FeeRecipient;
121
- toBuffer(): Buffer<ArrayBufferLike>;
122
- static getFields(fields: FieldsOf<FeeRecipient>): readonly [EthAddress, Fr];
123
- toFields(): Fr[];
124
- isEmpty(): boolean;
125
- toFriendlyJSON(): {
126
- recipient?: undefined;
127
- value?: undefined;
128
- } | {
129
- recipient: `0x${string}`;
130
- value: `0x${string}`;
131
- };
132
- static random(): FeeRecipient;
133
- }
134
- //# sourceMappingURL=block_root_or_block_merge_public_inputs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"block_root_or_block_merge_public_inputs.d.ts","sourceRoot":"","sources":["../../src/rollup/block_root_or_block_merge_public_inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,KAAK,KAAK,EAAwC,MAAM,6BAA6B,CAAC;AAE7G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;GAEG;AACH,qBAAa,iCAAiC;IAE1C;;OAEG;IACI,SAAS,EAAE,iBAAiB;IACnC;;OAEG;IACI,eAAe,EAAE,sBAAsB;IAC9C;;OAEG;IACI,UAAU,EAAE,sBAAsB;IACzC;;OAEG;IACI,oBAAoB,EAAE,eAAe;IAC5C;;OAEG;IACI,kBAAkB,EAAE,eAAe;IAC1C;;;OAGG;IACI,OAAO,EAAE,EAAE;IAClB;;OAEG;IACI,yBAAyB,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,wBAAwB,CAAC;IAC5E;;OAEG;IACI,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE,OAAO,wBAAwB,CAAC;IACjE;;OAEG;IACI,gBAAgB,EAAE,qBAAqB;;IApC9C;;OAEG;IACI,SAAS,EAAE,iBAAiB;IACnC;;OAEG;IACI,eAAe,EAAE,sBAAsB;IAC9C;;OAEG;IACI,UAAU,EAAE,sBAAsB;IACzC;;OAEG;IACI,oBAAoB,EAAE,eAAe;IAC5C;;OAEG;IACI,kBAAkB,EAAE,eAAe;IAC1C;;;OAGG;IACI,OAAO,EAAE,EAAE;IAClB;;OAEG;IACI,yBAAyB,EAAE,KAAK,CAAC,EAAE,EAAE,OAAO,wBAAwB,CAAC;IAC5E;;OAEG;IACI,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE,OAAO,wBAAwB,CAAC;IACjE;;OAEG;IACI,gBAAgB,EAAE,qBAAqB;IAGhD;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,iCAAiC;IAenF;;;OAGG;IACH,QAAQ;IAcR;;;OAGG;IACH,QAAQ;IAIR;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAI7B,8DAA8D;IAC9D,MAAM;IAIN,6CAA6C;IAC7C,MAAM,KAAK,MAAM,0EAEhB;CACF;AAED,qBAAa,YAAY;IAEd,SAAS,EAAE,UAAU;IACrB,KAAK,EAAE,EAAE;gBADT,SAAS,EAAE,UAAU,EACrB,KAAK,EAAE,EAAE;IAGlB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,YAAY;IAK9D,QAAQ;IAIR,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC;IAI/C,QAAQ;IAIR,OAAO;IAIP,cAAc;;;;;;;IAOd,MAAM,CAAC,MAAM;CAGd"}
@@ -1,125 +0,0 @@
1
- import { BlockBlobPublicInputs } from '@aztec/blob-lib';
2
- import { AZTEC_MAX_EPOCH_DURATION } from '@aztec/constants';
3
- import { EthAddress } from '@aztec/foundation/eth-address';
4
- import { Fr } from '@aztec/foundation/fields';
5
- import { bufferSchemaFor } from '@aztec/foundation/schemas';
6
- import { BufferReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
7
- import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
8
- import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
9
- import { GlobalVariables } from '../tx/global_variables.js';
10
- import { EpochConstantData } from './epoch_constant_data.js';
11
- /**
12
- * Output of the block root and block merge rollup circuits.
13
- */ export class BlockRootOrBlockMergePublicInputs {
14
- constants;
15
- previousArchive;
16
- newArchive;
17
- startGlobalVariables;
18
- endGlobalVariables;
19
- outHash;
20
- proposedBlockHeaderHashes;
21
- fees;
22
- blobPublicInputs;
23
- constructor(/**
24
- * Constants for the entire epoch.
25
- */ constants, /**
26
- * Archive tree immediately before this block range.
27
- */ previousArchive, /**
28
- * Archive tree after adding this block range.
29
- */ newArchive, /**
30
- * Global variables for the first block in the range.
31
- */ startGlobalVariables, /**
32
- * Global variables for the last block in the range.
33
- */ endGlobalVariables, /**
34
- * SHA256 hash of L2 to L1 messages. Used to make public inputs constant-sized (to then be opened onchain).
35
- * Note: Truncated to 31 bytes to fit in Fr.
36
- */ outHash, /**
37
- * The hashes of the proposed block headers of the constituent blocks.
38
- */ proposedBlockHeaderHashes, /**
39
- * The summed `transaction_fee`s and recipients of the constituent blocks.
40
- */ fees, /**
41
- * Public inputs required to verify a batch of blobs.
42
- */ blobPublicInputs){
43
- this.constants = constants;
44
- this.previousArchive = previousArchive;
45
- this.newArchive = newArchive;
46
- this.startGlobalVariables = startGlobalVariables;
47
- this.endGlobalVariables = endGlobalVariables;
48
- this.outHash = outHash;
49
- this.proposedBlockHeaderHashes = proposedBlockHeaderHashes;
50
- this.fees = fees;
51
- this.blobPublicInputs = blobPublicInputs;
52
- }
53
- /**
54
- * Deserializes from a buffer or reader.
55
- * @param buffer - Buffer or reader to read from.
56
- * @returns The deserialized public inputs.
57
- */ static fromBuffer(buffer) {
58
- const reader = BufferReader.asReader(buffer);
59
- return new BlockRootOrBlockMergePublicInputs(reader.readObject(EpochConstantData), reader.readObject(AppendOnlyTreeSnapshot), reader.readObject(AppendOnlyTreeSnapshot), reader.readObject(GlobalVariables), reader.readObject(GlobalVariables), Fr.fromBuffer(reader), reader.readArray(AZTEC_MAX_EPOCH_DURATION, Fr), reader.readArray(AZTEC_MAX_EPOCH_DURATION, FeeRecipient), reader.readObject(BlockBlobPublicInputs));
60
- }
61
- /**
62
- * Serialize this as a buffer.
63
- * @returns The buffer.
64
- */ toBuffer() {
65
- return serializeToBuffer(this.constants, this.previousArchive, this.newArchive, this.startGlobalVariables, this.endGlobalVariables, this.outHash, this.proposedBlockHeaderHashes, this.fees, this.blobPublicInputs);
66
- }
67
- /**
68
- * Serialize this as a hex string.
69
- * @returns - The hex string.
70
- */ toString() {
71
- return bufferToHex(this.toBuffer());
72
- }
73
- /**
74
- * Deserializes from a hex string.
75
- * @param str - A hex string to deserialize from.
76
- * @returns A new BaseOrMergeRollupPublicInputs instance.
77
- */ static fromString(str) {
78
- return BlockRootOrBlockMergePublicInputs.fromBuffer(hexToBuffer(str));
79
- }
80
- /** Returns a buffer representation for JSON serialization. */ toJSON() {
81
- return this.toBuffer();
82
- }
83
- /** Creates an instance from a hex string. */ static get schema() {
84
- return bufferSchemaFor(BlockRootOrBlockMergePublicInputs);
85
- }
86
- }
87
- export class FeeRecipient {
88
- recipient;
89
- value;
90
- constructor(recipient, value){
91
- this.recipient = recipient;
92
- this.value = value;
93
- }
94
- static fromBuffer(buffer) {
95
- const reader = BufferReader.asReader(buffer);
96
- return new FeeRecipient(reader.readObject(EthAddress), Fr.fromBuffer(reader));
97
- }
98
- toBuffer() {
99
- return serializeToBuffer(this.recipient, this.value);
100
- }
101
- static getFields(fields) {
102
- return [
103
- fields.recipient,
104
- fields.value
105
- ];
106
- }
107
- toFields() {
108
- return serializeToFields(...FeeRecipient.getFields(this));
109
- }
110
- isEmpty() {
111
- return this.value.isZero() && this.recipient.isZero();
112
- }
113
- toFriendlyJSON() {
114
- if (this.isEmpty()) {
115
- return {};
116
- }
117
- return {
118
- recipient: this.recipient.toString(),
119
- value: this.value.toString()
120
- };
121
- }
122
- static random() {
123
- return new FeeRecipient(EthAddress.random(), Fr.random());
124
- }
125
- }
@@ -1,51 +0,0 @@
1
- import { BufferReader } from '@aztec/foundation/serialize';
2
- import type { FieldsOf } from '@aztec/foundation/types';
3
- import { BlockConstantData } from './block_constant_data.js';
4
- import { BlockRootRollupData } from './block_root_rollup.js';
5
- /**
6
- * Represents inputs of the empty block root rollup circuit.
7
- */
8
- export declare class EmptyBlockRootRollupInputs {
9
- readonly data: BlockRootRollupData;
10
- readonly constants: BlockConstantData;
11
- constructor(data: BlockRootRollupData, constants: BlockConstantData);
12
- /**
13
- * Serializes the inputs to a buffer.
14
- * @returns - The inputs serialized to a buffer.
15
- */
16
- toBuffer(): Buffer<ArrayBufferLike>;
17
- /**
18
- * Serializes the inputs to a hex string.
19
- * @returns The instance serialized to a hex string.
20
- */
21
- toString(): `0x${string}`;
22
- /**
23
- * Creates a new instance from fields.
24
- * @param fields - Fields to create the instance from.
25
- * @returns A new instance.
26
- */
27
- static from(fields: FieldsOf<EmptyBlockRootRollupInputs>): EmptyBlockRootRollupInputs;
28
- /**
29
- * Extracts fields from an instance.
30
- * @param fields - Fields to create the instance from.
31
- * @returns An array of fields.
32
- */
33
- static getFields(fields: FieldsOf<EmptyBlockRootRollupInputs>): readonly [BlockRootRollupData, BlockConstantData];
34
- /**
35
- * Deserializes the inputs from a buffer.
36
- * @param buffer - A buffer to deserialize from.
37
- * @returns A new RootRollupInputs instance.
38
- */
39
- static fromBuffer(buffer: Buffer | BufferReader): EmptyBlockRootRollupInputs;
40
- /**
41
- * Deserializes the inputs from a hex string.
42
- * @param str - A hex string to deserialize from.
43
- * @returns A new RootRollupInputs instance.
44
- */
45
- static fromString(str: string): EmptyBlockRootRollupInputs;
46
- /** Returns a buffer representation for JSON serialization. */
47
- toJSON(): Buffer<ArrayBufferLike>;
48
- /** Creates an instance from a buffer string. */
49
- static get schema(): import("zod").ZodType<EmptyBlockRootRollupInputs, any, string>;
50
- }
51
- //# sourceMappingURL=empty_block_root_rollup_inputs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"empty_block_root_rollup_inputs.d.ts","sourceRoot":"","sources":["../../src/rollup/empty_block_root_rollup_inputs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;GAEG;AACH,qBAAa,0BAA0B;aAEnB,IAAI,EAAE,mBAAmB;aACzB,SAAS,EAAE,iBAAiB;gBAD5B,IAAI,EAAE,mBAAmB,EACzB,SAAS,EAAE,iBAAiB;IAG9C;;;OAGG;IACH,QAAQ;IAIR;;;OAGG;IACH,QAAQ;IAIR;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,0BAA0B,CAAC,GAAG,0BAA0B;IAIrF;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,0BAA0B,CAAC;IAI7D;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,0BAA0B;IAK5E;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAI7B,8DAA8D;IAC9D,MAAM;IAIN,gDAAgD;IAChD,MAAM,KAAK,MAAM,mEAEhB;CACF"}