@aztec/stdlib 5.0.0-rc.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/dest/abi/buffer.d.ts +6 -2
  2. package/dest/abi/buffer.d.ts.map +1 -1
  3. package/dest/abi/buffer.js +13 -1
  4. package/dest/avm/avm.js +1 -1
  5. package/dest/aztec-address/index.d.ts +35 -5
  6. package/dest/aztec-address/index.d.ts.map +1 -1
  7. package/dest/aztec-address/index.js +32 -8
  8. package/dest/block/attestation_info.d.ts +1 -1
  9. package/dest/block/attestation_info.d.ts.map +1 -1
  10. package/dest/block/attestation_info.js +7 -4
  11. package/dest/block/l2_block_source.d.ts +44 -27
  12. package/dest/block/l2_block_source.d.ts.map +1 -1
  13. package/dest/block/l2_block_source.js +15 -1
  14. package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts +39 -0
  15. package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts.map +1 -0
  16. package/dest/block/l2_block_stream/event_driven_l2_block_stream.js +165 -0
  17. package/dest/block/l2_block_stream/index.d.ts +2 -1
  18. package/dest/block/l2_block_stream/index.d.ts.map +1 -1
  19. package/dest/block/l2_block_stream/index.js +1 -0
  20. package/dest/block/l2_block_stream/interfaces.d.ts +40 -6
  21. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  22. package/dest/block/l2_block_stream/interfaces.js +25 -1
  23. package/dest/block/l2_block_stream/l2_block_stream.d.ts +23 -15
  24. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  25. package/dest/block/l2_block_stream/l2_block_stream.js +140 -152
  26. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +10 -2
  27. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  28. package/dest/block/l2_block_stream/l2_tips_store_base.js +33 -15
  29. package/dest/block/proposal/attestations_and_signers.d.ts +19 -1
  30. package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
  31. package/dest/block/proposal/attestations_and_signers.js +47 -7
  32. package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
  33. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  34. package/dest/block/test/l2_tips_store_test_suite.js +94 -3
  35. package/dest/block/validate_block_result.d.ts +16 -1
  36. package/dest/block/validate_block_result.d.ts.map +1 -1
  37. package/dest/block/validate_block_result.js +18 -3
  38. package/dest/checkpoint/index.d.ts +2 -1
  39. package/dest/checkpoint/index.d.ts.map +1 -1
  40. package/dest/checkpoint/index.js +1 -0
  41. package/dest/checkpoint/simulation_overrides.d.ts +61 -0
  42. package/dest/checkpoint/simulation_overrides.d.ts.map +1 -0
  43. package/dest/checkpoint/simulation_overrides.js +98 -0
  44. package/dest/config/network-consensus-config.d.ts +1 -1
  45. package/dest/config/network-consensus-config.d.ts.map +1 -1
  46. package/dest/config/network-consensus-config.js +2 -10
  47. package/dest/contract/contract_address.d.ts +5 -4
  48. package/dest/contract/contract_address.d.ts.map +1 -1
  49. package/dest/contract/contract_instance.d.ts +16 -2
  50. package/dest/contract/contract_instance.d.ts.map +1 -1
  51. package/dest/contract/contract_instance.js +45 -0
  52. package/dest/contract/interfaces/contract_data_source.d.ts +3 -5
  53. package/dest/contract/interfaces/contract_data_source.d.ts.map +1 -1
  54. package/dest/contract/interfaces/contract_instance.d.ts +71 -10
  55. package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
  56. package/dest/contract/interfaces/contract_instance.js +7 -2
  57. package/dest/contract/partial_address.d.ts +9 -3
  58. package/dest/contract/partial_address.d.ts.map +1 -1
  59. package/dest/contract/partial_address.js +8 -2
  60. package/dest/database-version/version_manager.d.ts +18 -4
  61. package/dest/database-version/version_manager.d.ts.map +1 -1
  62. package/dest/database-version/version_manager.js +76 -6
  63. package/dest/file-store/factory.d.ts +1 -1
  64. package/dest/file-store/factory.d.ts.map +1 -1
  65. package/dest/file-store/factory.js +7 -0
  66. package/dest/file-store/index.d.ts +2 -1
  67. package/dest/file-store/index.d.ts.map +1 -1
  68. package/dest/file-store/index.js +1 -0
  69. package/dest/file-store/memory.d.ts +24 -0
  70. package/dest/file-store/memory.d.ts.map +1 -0
  71. package/dest/file-store/memory.js +80 -0
  72. package/dest/ha-signing/config.d.ts +19 -5
  73. package/dest/ha-signing/config.d.ts.map +1 -1
  74. package/dest/ha-signing/config.js +9 -3
  75. package/dest/ha-signing/local_config.d.ts +10 -2
  76. package/dest/ha-signing/local_config.d.ts.map +1 -1
  77. package/dest/ha-signing/local_config.js +8 -2
  78. package/dest/hash/hash.d.ts +1 -2
  79. package/dest/hash/hash.d.ts.map +1 -1
  80. package/dest/hash/hash.js +0 -7
  81. package/dest/interfaces/archiver.d.ts +8 -1
  82. package/dest/interfaces/archiver.d.ts.map +1 -1
  83. package/dest/interfaces/archiver.js +3 -2
  84. package/dest/interfaces/aztec-node-admin.d.ts +5 -2
  85. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  86. package/dest/interfaces/aztec-node-debug.d.ts +26 -1
  87. package/dest/interfaces/aztec-node-debug.d.ts.map +1 -1
  88. package/dest/interfaces/aztec-node-debug.js +20 -0
  89. package/dest/interfaces/aztec-node.d.ts +20 -20
  90. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  91. package/dest/interfaces/aztec-node.js +8 -15
  92. package/dest/interfaces/chain_tips.d.ts +8 -47
  93. package/dest/interfaces/chain_tips.d.ts.map +1 -1
  94. package/dest/interfaces/chain_tips.js +1 -6
  95. package/dest/interfaces/checkpoint_parameter.d.ts +3 -3
  96. package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -1
  97. package/dest/interfaces/checkpoint_parameter.js +3 -3
  98. package/dest/interfaces/configs.d.ts +4 -1
  99. package/dest/interfaces/configs.d.ts.map +1 -1
  100. package/dest/interfaces/configs.js +1 -0
  101. package/dest/interfaces/private_kernel_prover.d.ts +9 -11
  102. package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
  103. package/dest/interfaces/prover-node.d.ts +6 -7
  104. package/dest/interfaces/prover-node.d.ts.map +1 -1
  105. package/dest/interfaces/prover-node.js +15 -10
  106. package/dest/interfaces/proving-job.d.ts +87 -74
  107. package/dest/interfaces/proving-job.d.ts.map +1 -1
  108. package/dest/interfaces/proving-job.js +13 -4
  109. package/dest/interfaces/server_circuit_prover.d.ts +3 -3
  110. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  111. package/dest/interfaces/validator.d.ts +7 -3
  112. package/dest/interfaces/validator.d.ts.map +1 -1
  113. package/dest/interfaces/world_state.d.ts +14 -1
  114. package/dest/interfaces/world_state.d.ts.map +1 -1
  115. package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts +8 -2
  116. package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts.map +1 -1
  117. package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +12 -74
  118. package/dest/kernel/hints/read_request.js +1 -1
  119. package/dest/kernel/index.d.ts +2 -2
  120. package/dest/kernel/index.d.ts.map +1 -1
  121. package/dest/kernel/index.js +1 -1
  122. package/dest/kernel/log_hash.d.ts +1 -1
  123. package/dest/kernel/log_hash.d.ts.map +1 -1
  124. package/dest/kernel/log_hash.js +2 -2
  125. package/dest/kernel/note_hash.js +1 -1
  126. package/dest/kernel/nullifier.js +1 -1
  127. package/dest/kernel/private_circuit_public_inputs.d.ts +13 -3
  128. package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
  129. package/dest/kernel/private_circuit_public_inputs.js +14 -7
  130. package/dest/kernel/private_context_inputs.d.ts +4 -3
  131. package/dest/kernel/private_context_inputs.d.ts.map +1 -1
  132. package/dest/kernel/private_context_inputs.js +7 -3
  133. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +7 -1
  134. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
  135. package/dest/kernel/private_kernel_circuit_public_inputs.js +7 -0
  136. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts +2 -3
  137. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts.map +1 -1
  138. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.js +3 -5
  139. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts +2 -3
  140. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts.map +1 -1
  141. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.js +3 -5
  142. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +1 -9
  143. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
  144. package/dest/kernel/private_kernel_init_circuit_private_inputs.js +2 -6
  145. package/dest/kernel/private_kernel_reset_dimensions.d.ts +7 -8
  146. package/dest/kernel/private_kernel_reset_dimensions.d.ts.map +1 -1
  147. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts +29 -0
  148. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts.map +1 -0
  149. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.js +36 -0
  150. package/dest/kernel/private_log_data.d.ts +1 -1
  151. package/dest/kernel/private_log_data.d.ts.map +1 -1
  152. package/dest/kernel/private_log_data.js +1 -1
  153. package/dest/keys/derivation.d.ts +41 -6
  154. package/dest/keys/derivation.d.ts.map +1 -1
  155. package/dest/keys/derivation.js +49 -26
  156. package/dest/logs/app_tagging_secret.d.ts +30 -7
  157. package/dest/logs/app_tagging_secret.d.ts.map +1 -1
  158. package/dest/logs/app_tagging_secret.js +46 -39
  159. package/dest/logs/contract_class_log.d.ts +1 -2
  160. package/dest/logs/contract_class_log.d.ts.map +1 -1
  161. package/dest/logs/contract_class_log.js +0 -4
  162. package/dest/logs/index.d.ts +1 -3
  163. package/dest/logs/index.d.ts.map +1 -1
  164. package/dest/logs/index.js +0 -2
  165. package/dest/logs/shared_secret_derivation.d.ts +19 -6
  166. package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
  167. package/dest/logs/shared_secret_derivation.js +26 -11
  168. package/dest/messaging/l1_to_l2_message.d.ts +23 -2
  169. package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
  170. package/dest/messaging/l1_to_l2_message.js +36 -11
  171. package/dest/p2p/attestation_utils.d.ts +1 -1
  172. package/dest/p2p/attestation_utils.d.ts.map +1 -1
  173. package/dest/p2p/attestation_utils.js +8 -1
  174. package/dest/p2p/checkpoint_attestation.d.ts +10 -1
  175. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  176. package/dest/p2p/checkpoint_attestation.js +10 -0
  177. package/dest/p2p/checkpoint_proposal.d.ts +2 -1
  178. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  179. package/dest/p2p/consensus_payload.d.ts +2 -1
  180. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  181. package/dest/p2p/signature_utils.d.ts +10 -1
  182. package/dest/p2p/signature_utils.d.ts.map +1 -1
  183. package/dest/p2p/signature_utils.js +9 -1
  184. package/dest/rollup/avm_proof_data.d.ts +3 -3
  185. package/dest/rollup/avm_proof_data.d.ts.map +1 -1
  186. package/dest/rollup/checkpoint_header.d.ts +8 -3
  187. package/dest/rollup/checkpoint_header.d.ts.map +1 -1
  188. package/dest/rollup/checkpoint_header.js +20 -10
  189. package/dest/stats/stats.d.ts +2 -2
  190. package/dest/stats/stats.d.ts.map +1 -1
  191. package/dest/tests/factories.d.ts +1 -1
  192. package/dest/tests/factories.d.ts.map +1 -1
  193. package/dest/tests/factories.js +7 -15
  194. package/dest/trees/nullifier_membership_witness.d.ts +5 -8
  195. package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
  196. package/dest/trees/nullifier_membership_witness.js +0 -9
  197. package/dest/trees/public_data_witness.d.ts +7 -17
  198. package/dest/trees/public_data_witness.d.ts.map +1 -1
  199. package/dest/trees/public_data_witness.js +0 -27
  200. package/dest/tx/execution_payload.d.ts +1 -1
  201. package/dest/tx/execution_payload.d.ts.map +1 -1
  202. package/dest/tx/execution_payload.js +1 -1
  203. package/dest/tx/global_variable_builder.d.ts +2 -12
  204. package/dest/tx/global_variable_builder.d.ts.map +1 -1
  205. package/dest/tx/global_variables.js +2 -2
  206. package/dest/tx/private_tx_constant_data.d.ts +18 -2
  207. package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
  208. package/dest/tx/private_tx_constant_data.js +13 -4
  209. package/dest/tx/simulated_tx.d.ts +10 -6
  210. package/dest/tx/simulated_tx.d.ts.map +1 -1
  211. package/dest/world-state/genesis_data.d.ts +9 -1
  212. package/dest/world-state/genesis_data.d.ts.map +1 -1
  213. package/dest/world-state/genesis_data.js +1 -0
  214. package/package.json +8 -8
  215. package/src/abi/buffer.ts +13 -1
  216. package/src/avm/avm.ts +1 -1
  217. package/src/aztec-address/index.ts +36 -6
  218. package/src/block/attestation_info.ts +7 -2
  219. package/src/block/l2_block_source.ts +64 -17
  220. package/src/block/l2_block_stream/event_driven_l2_block_stream.ts +207 -0
  221. package/src/block/l2_block_stream/index.ts +1 -0
  222. package/src/block/l2_block_stream/interfaces.ts +60 -6
  223. package/src/block/l2_block_stream/l2_block_stream.ts +201 -178
  224. package/src/block/l2_block_stream/l2_tips_store_base.ts +36 -15
  225. package/src/block/proposal/attestations_and_signers.ts +53 -7
  226. package/src/block/test/l2_tips_store_test_suite.ts +73 -4
  227. package/src/block/validate_block_result.ts +48 -2
  228. package/src/checkpoint/index.ts +1 -0
  229. package/src/checkpoint/simulation_overrides.ts +171 -0
  230. package/src/config/network-consensus-config.ts +2 -13
  231. package/src/contract/contract_address.ts +4 -3
  232. package/src/contract/contract_instance.ts +62 -1
  233. package/src/contract/interfaces/contract_data_source.ts +2 -4
  234. package/src/contract/interfaces/contract_instance.ts +26 -8
  235. package/src/contract/partial_address.ts +8 -2
  236. package/src/database-version/version_manager.ts +96 -6
  237. package/src/file-store/factory.ts +7 -0
  238. package/src/file-store/index.ts +1 -0
  239. package/src/file-store/memory.ts +94 -0
  240. package/src/ha-signing/config.ts +23 -5
  241. package/src/ha-signing/local_config.ts +20 -1
  242. package/src/hash/hash.ts +0 -8
  243. package/src/interfaces/archiver.ts +9 -1
  244. package/src/interfaces/aztec-node-debug.ts +37 -0
  245. package/src/interfaces/aztec-node.ts +30 -33
  246. package/src/interfaces/chain_tips.ts +8 -16
  247. package/src/interfaces/checkpoint_parameter.ts +3 -3
  248. package/src/interfaces/configs.ts +3 -0
  249. package/src/interfaces/private_kernel_prover.ts +10 -12
  250. package/src/interfaces/prover-node.ts +19 -11
  251. package/src/interfaces/proving-job.ts +15 -3
  252. package/src/interfaces/server_circuit_prover.ts +2 -2
  253. package/src/interfaces/world_state.ts +14 -0
  254. package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +22 -112
  255. package/src/kernel/hints/read_request.ts +1 -1
  256. package/src/kernel/index.ts +1 -1
  257. package/src/kernel/log_hash.ts +5 -2
  258. package/src/kernel/note_hash.ts +1 -1
  259. package/src/kernel/nullifier.ts +1 -1
  260. package/src/kernel/private_circuit_public_inputs.ts +12 -1
  261. package/src/kernel/private_context_inputs.ts +10 -3
  262. package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -0
  263. package/src/kernel/private_kernel_init_2_circuit_private_inputs.ts +0 -3
  264. package/src/kernel/private_kernel_init_3_circuit_private_inputs.ts +0 -3
  265. package/src/kernel/private_kernel_init_circuit_private_inputs.ts +0 -6
  266. package/src/kernel/private_kernel_reset_dimensions.ts +15 -5
  267. package/src/kernel/private_kernel_reset_tail_circuit_private_inputs.ts +69 -0
  268. package/src/kernel/private_log_data.ts +4 -1
  269. package/src/keys/derivation.ts +69 -24
  270. package/src/logs/app_tagging_secret.ts +62 -39
  271. package/src/logs/contract_class_log.ts +0 -9
  272. package/src/logs/index.ts +0 -2
  273. package/src/logs/shared_secret_derivation.ts +31 -15
  274. package/src/messaging/l1_to_l2_message.ts +51 -13
  275. package/src/p2p/attestation_utils.ts +8 -1
  276. package/src/p2p/checkpoint_attestation.ts +12 -0
  277. package/src/p2p/signature_utils.ts +9 -0
  278. package/src/rollup/avm_proof_data.ts +2 -2
  279. package/src/rollup/checkpoint_header.ts +16 -2
  280. package/src/stats/stats.ts +2 -2
  281. package/src/tests/factories.ts +6 -12
  282. package/src/trees/nullifier_membership_witness.ts +0 -11
  283. package/src/trees/public_data_witness.ts +0 -31
  284. package/src/tx/execution_payload.ts +2 -1
  285. package/src/tx/global_variable_builder.ts +1 -17
  286. package/src/tx/global_variables.ts +2 -2
  287. package/src/tx/private_tx_constant_data.ts +25 -2
  288. package/src/world-state/genesis_data.ts +10 -0
  289. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +0 -47
  290. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +0 -1
  291. package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +0 -38
  292. package/dest/logs/message_context.d.ts +0 -27
  293. package/dest/logs/message_context.d.ts.map +0 -1
  294. package/dest/logs/message_context.js +0 -74
  295. package/dest/logs/pending_tagged_log.d.ts +0 -13
  296. package/dest/logs/pending_tagged_log.d.ts.map +0 -1
  297. package/dest/logs/pending_tagged_log.js +0 -34
  298. package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +0 -58
  299. package/src/logs/message_context.ts +0 -76
  300. package/src/logs/pending_tagged_log.ts +0 -39
@@ -1,5 +1,6 @@
1
1
  import { CheckpointProposalHash, type SlotNumber } from '@aztec/foundation/branded-types';
2
2
  import { type BaseBuffer32, Buffer32 } from '@aztec/foundation/buffer';
3
+ import { normalizeSignature } from '@aztec/foundation/crypto/secp256k1-signer';
3
4
  import type { Fr } from '@aztec/foundation/curves/bn254';
4
5
  import type { EthAddress } from '@aztec/foundation/eth-address';
5
6
  import { Signature } from '@aztec/foundation/eth-signature';
@@ -97,6 +98,17 @@ export class CheckpointAttestation extends Gossipable {
97
98
  return this.cachedProposer ?? undefined;
98
99
  }
99
100
 
101
+ /**
102
+ * Returns a copy with the attester signature canonicalized to v ∈ {27, 28}. Callers store attestations
103
+ * received from gossip verbatim; normalizing on ingress keeps a signature emitted in yParity form
104
+ * (v = 0/1) — whether by a malicious committee member or a peer mutating the byte in flight — from
105
+ * reaching the L1 bundle in a non-canonical form. Must only be called once the signature has recovered
106
+ * a sender (so it is non-empty and low-s); `normalizeSignature` throws on an all-zero signature.
107
+ */
108
+ withNormalizedSignature(): CheckpointAttestation {
109
+ return new CheckpointAttestation(this.payload, normalizeSignature(this.signature), this.proposerSignature);
110
+ }
111
+
100
112
  getPayload(): Buffer {
101
113
  return this.payload.getPayloadToSign();
102
114
  }
@@ -112,6 +112,15 @@ export function getHashedSignaturePayloadTypedData(signable: Signable): Buffer32
112
112
  return Buffer32.fromString(hashTypedData(getCoordinationSignatureTypedData(signable)));
113
113
  }
114
114
 
115
+ /**
116
+ * Recovers the sender of a gossiped coordination message. Deliberately lenient (allowYParityAsV): a
117
+ * signature whose recovery byte is in yParity form (v ∈ {0, 1}) still resolves to its sender, so the P2P
118
+ * layer can attribute and accept it and then canonicalize on ingress (CheckpointAttestation.
119
+ * withNormalizedSignature, A-1351) before it reaches the L1 bundle. This is intentionally looser than
120
+ * on-chain checkpoint validation (getAttestationInfoFromPayload), which recovers strictly to mirror L1's
121
+ * ECDSA.recover — do not unify the two. These proposal/attestation signatures are P2P-only and never reach
122
+ * L1 verbatim, so leniency here cannot leak a non-canonical byte onto L1.
123
+ */
115
124
  export function recoverCoordinationSigner(signable: Signable, signature: Signature): EthAddress | undefined {
116
125
  const digest = getHashedSignaturePayloadTypedData(signable);
117
126
  return tryRecoverAddress(digest, signature, { allowYParityAsV: true });
@@ -1,6 +1,6 @@
1
- import { AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED } from '@aztec/constants';
1
+ import { AVM_V2_PROOF_LENGTH_IN_FIELDS } from '@aztec/constants';
2
2
 
3
3
  import { AvmCircuitPublicInputs } from '../avm/avm_circuit_public_inputs.js';
4
4
  import type { ProofDataForFixedVk } from '../proofs/proof_data.js';
5
5
 
6
- export type AvmProofData = ProofDataForFixedVk<AvmCircuitPublicInputs, typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>;
6
+ export type AvmProofData = ProofDataForFixedVk<AvmCircuitPublicInputs, typeof AVM_V2_PROOF_LENGTH_IN_FIELDS>;
@@ -52,6 +52,8 @@ export class CheckpointHeader {
52
52
  public gasFees: GasFees,
53
53
  /** Total mana used in the block, computed by the root rollup circuit */
54
54
  public totalManaUsed: Fr,
55
+ /** Total fees accrued across the checkpoint. */
56
+ public accumulatedFees: Fr,
55
57
  ) {}
56
58
 
57
59
  static get schema(): ZodFor<CheckpointHeader> {
@@ -68,6 +70,7 @@ export class CheckpointHeader {
68
70
  feeRecipient: schemas.AztecAddress,
69
71
  gasFees: GasFees.schema,
70
72
  totalManaUsed: schemas.Fr,
73
+ accumulatedFees: schemas.Fr,
71
74
  })
72
75
  .transform(CheckpointHeader.from);
73
76
  }
@@ -85,6 +88,7 @@ export class CheckpointHeader {
85
88
  fields.feeRecipient,
86
89
  fields.gasFees,
87
90
  fields.totalManaUsed,
91
+ fields.accumulatedFees,
88
92
  ] as const;
89
93
  }
90
94
 
@@ -107,6 +111,7 @@ export class CheckpointHeader {
107
111
  reader.readObject(AztecAddress),
108
112
  reader.readObject(GasFees),
109
113
  reader.readObject(Fr),
114
+ reader.readObject(Fr),
110
115
  );
111
116
  }
112
117
 
@@ -122,7 +127,8 @@ export class CheckpointHeader {
122
127
  this.coinbase.equals(other.coinbase) &&
123
128
  this.feeRecipient.equals(other.feeRecipient) &&
124
129
  this.gasFees.equals(other.gasFees) &&
125
- this.totalManaUsed.equals(other.totalManaUsed)
130
+ this.totalManaUsed.equals(other.totalManaUsed) &&
131
+ this.accumulatedFees.equals(other.accumulatedFees)
126
132
  );
127
133
  }
128
134
 
@@ -151,6 +157,7 @@ export class CheckpointHeader {
151
157
  this.feeRecipient,
152
158
  this.gasFees,
153
159
  this.totalManaUsed,
160
+ this.accumulatedFees,
154
161
  ]);
155
162
  }
156
163
 
@@ -171,6 +178,7 @@ export class CheckpointHeader {
171
178
  feeRecipient: AztecAddress.ZERO,
172
179
  gasFees: GasFees.empty(),
173
180
  totalManaUsed: Fr.ZERO,
181
+ accumulatedFees: Fr.ZERO,
174
182
  ...fields,
175
183
  });
176
184
  }
@@ -188,6 +196,7 @@ export class CheckpointHeader {
188
196
  feeRecipient: new AztecAddress(Fr.random()),
189
197
  gasFees: GasFees.random(),
190
198
  totalManaUsed: new Fr(BigInt(Math.floor(Math.random() * 1000000))),
199
+ accumulatedFees: new Fr(BigInt(Math.floor(Math.random() * 1000000))),
191
200
  ...overrides,
192
201
  });
193
202
  }
@@ -204,7 +213,8 @@ export class CheckpointHeader {
204
213
  this.coinbase.isZero() &&
205
214
  this.feeRecipient.isZero() &&
206
215
  this.gasFees.isEmpty() &&
207
- this.totalManaUsed.isZero()
216
+ this.totalManaUsed.isZero() &&
217
+ this.accumulatedFees.isZero()
208
218
  );
209
219
  }
210
220
 
@@ -233,6 +243,7 @@ export class CheckpointHeader {
233
243
  new AztecAddress(hexToBuffer(header.feeRecipient)),
234
244
  new GasFees(header.gasFees.feePerDaGas, header.gasFees.feePerL2Gas),
235
245
  new Fr(header.totalManaUsed),
246
+ new Fr(header.accumulatedFees),
236
247
  );
237
248
  }
238
249
 
@@ -260,6 +271,7 @@ export class CheckpointHeader {
260
271
  feePerL2Gas: this.gasFees.feePerL2Gas,
261
272
  },
262
273
  totalManaUsed: this.totalManaUsed.toBigInt(),
274
+ accumulatedFees: this.accumulatedFees.toBigInt(),
263
275
  };
264
276
  }
265
277
 
@@ -276,6 +288,7 @@ export class CheckpointHeader {
276
288
  feeRecipient: this.feeRecipient.toString(),
277
289
  gasFees: this.gasFees.toInspect(),
278
290
  totalManaUsed: this.totalManaUsed.toBigInt(),
291
+ accumulatedFees: this.accumulatedFees.toBigInt(),
279
292
  };
280
293
  }
281
294
 
@@ -292,6 +305,7 @@ export class CheckpointHeader {
292
305
  feeRecipient: ${this.feeRecipient.toString()},
293
306
  gasFees: { da:${this.gasFees.feePerDaGas}, l2:${this.gasFees.feePerL2Gas} },
294
307
  totalManaUsed: ${this.totalManaUsed.toBigInt()},
308
+ accumulatedFees: ${this.accumulatedFees.toBigInt()},
295
309
  }`;
296
310
  }
297
311
  }
@@ -90,8 +90,8 @@ export type ClientCircuitName =
90
90
  | 'private-kernel-inner-2'
91
91
  | 'private-kernel-inner-3'
92
92
  | 'private-kernel-reset'
93
- | 'private-kernel-tail'
94
- | 'private-kernel-tail-to-public'
93
+ | 'private-kernel-reset-tail'
94
+ | 'private-kernel-reset-tail-to-public'
95
95
  | 'hiding-kernel-to-rollup'
96
96
  | 'hiding-kernel-to-public'
97
97
  | 'app-circuit';
@@ -6,7 +6,7 @@ import {
6
6
  } from '@aztec/blob-lib/testing';
7
7
  import {
8
8
  ARCHIVE_HEIGHT,
9
- AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
9
+ AVM_V2_PROOF_LENGTH_IN_FIELDS,
10
10
  CHONK_PROOF_LENGTH,
11
11
  CONTRACT_CLASS_LOG_SIZE_IN_FIELDS,
12
12
  L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
@@ -692,6 +692,7 @@ export function makePrivateCircuitPublicInputs(seed = 0): PrivateCircuitPublicIn
692
692
  anchorBlockHeader: makeBlockHeader(seed + 0xd00),
693
693
  txContext: makeTxContext(seed + 0x1400),
694
694
  isFeePayer: false,
695
+ txRequestSalt: fr(seed + 0x1500),
695
696
  });
696
697
  }
697
698
 
@@ -703,7 +704,7 @@ export function makeGlobalVariables(seed = 1, overrides: Partial<FieldsOf<Global
703
704
  slotNumber: SlotNumber(seed + 3),
704
705
  timestamp: BigInt(seed + 4),
705
706
  coinbase: EthAddress.fromField(new Fr(seed + 5)),
706
- feeRecipient: AztecAddress.fromField(new Fr(seed + 6)),
707
+ feeRecipient: AztecAddress.fromFieldUnsafe(new Fr(seed + 6)),
707
708
  gasFees: new GasFees(seed + 7, seed + 8),
708
709
  ...compact(overrides),
709
710
  });
@@ -753,7 +754,7 @@ export function makeBytes(size = 32, fill = 1): Buffer {
753
754
  * @returns An aztec address.
754
755
  */
755
756
  export function makeAztecAddress(seed = 1): AztecAddress {
756
- return AztecAddress.fromField(fr(seed));
757
+ return AztecAddress.fromFieldUnsafe(fr(seed));
757
758
  }
758
759
 
759
760
  function makeBlockConstantData(seed = 1, globalVariables?: GlobalVariables) {
@@ -916,6 +917,7 @@ export function makeCheckpointHeader(seed = 0, overrides: Partial<FieldsOf<Check
916
917
  feeRecipient: makeAztecAddress(seed + 0x600),
917
918
  gasFees: makeGasFees(seed + 0x700),
918
919
  totalManaUsed: fr(seed + 0x800),
920
+ accumulatedFees: fr(seed + 0x850),
919
921
  ...overrides,
920
922
  });
921
923
  }
@@ -1161,11 +1163,7 @@ export function makePublicTxBaseRollupPrivateInputs(seed = 0) {
1161
1163
  makePublicChonkVerifierPublicInputs,
1162
1164
  RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
1163
1165
  );
1164
- const avmProofData = makeProofDataForFixedVk(
1165
- seed + 0x100,
1166
- makeAvmCircuitPublicInputs,
1167
- AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
1168
- );
1166
+ const avmProofData = makeProofDataForFixedVk(seed + 0x100, makeAvmCircuitPublicInputs, AVM_V2_PROOF_LENGTH_IN_FIELDS);
1169
1167
  const hints = makePublicBaseRollupHints(seed + 0x200);
1170
1168
 
1171
1169
  return PublicTxBaseRollupPrivateInputs.from({
@@ -1745,10 +1743,6 @@ export function makeL2Tips(
1745
1743
  block: { number: bn, hash },
1746
1744
  checkpoint: { number: cpn, hash: cph },
1747
1745
  },
1748
- proposedCheckpoint: {
1749
- block: { number: bn, hash },
1750
- checkpoint: { number: cpn, hash: cph },
1751
- },
1752
1746
  proven: {
1753
1747
  block: { number: bn, hash },
1754
1748
  checkpoint: { number: cpn, hash: cph },
@@ -1,5 +1,4 @@
1
1
  import { NULLIFIER_TREE_HEIGHT } from '@aztec/constants';
2
- import { Fr } from '@aztec/foundation/curves/bn254';
3
2
  import { MembershipWitness, SiblingPath } from '@aztec/foundation/trees';
4
3
 
5
4
  import { z } from 'zod';
@@ -52,14 +51,4 @@ export class NullifierMembershipWitness {
52
51
  public withoutPreimage(): MembershipWitness<typeof NULLIFIER_TREE_HEIGHT> {
53
52
  return new MembershipWitness(NULLIFIER_TREE_HEIGHT, this.index, this.siblingPath.toTuple());
54
53
  }
55
-
56
- /** Serializes as `(NullifierLeafPreimage, MembershipWitness)` to match the Noir oracle return type. */
57
- public toNoirRepresentation(): (string | string[])[] {
58
- // TODO(#12874): remove the stupid as string conversion by modifying ForeignCallOutput type in acvm.js
59
- return [
60
- ...(this.leafPreimage.toFields().map(fr => fr.toString()) as string[]),
61
- new Fr(this.index).toString() as string,
62
- this.siblingPath.toFields().map(fr => fr.toString()) as string[],
63
- ];
64
- }
65
54
  }
@@ -1,6 +1,5 @@
1
1
  import { PUBLIC_DATA_TREE_HEIGHT } from '@aztec/constants';
2
2
  import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
3
- import { Fr } from '@aztec/foundation/curves/bn254';
4
3
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
5
4
  import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
6
5
  import { MembershipWitness, SiblingPath } from '@aztec/foundation/trees';
@@ -43,36 +42,6 @@ export class PublicDataWitness {
43
42
  .transform(({ index, leafPreimage, siblingPath }) => new PublicDataWitness(index, leafPreimage, siblingPath));
44
43
  }
45
44
 
46
- /**
47
- * Returns a field array representation of a public data witness.
48
- * @returns A field array representation of a public data witness.
49
- */
50
- public toFields(): Fr[] {
51
- return [
52
- new Fr(this.index),
53
- new Fr(this.leafPreimage.leaf.slot),
54
- new Fr(this.leafPreimage.leaf.value),
55
- new Fr(this.leafPreimage.nextIndex),
56
- new Fr(this.leafPreimage.nextKey),
57
- ...this.siblingPath.toFields(),
58
- ];
59
- }
60
-
61
- /**
62
- * Returns a representation of the public data witness as expected by intrinsic Noir deserialization.
63
- */
64
- public toNoirRepresentation(): (string | string[])[] {
65
- // TODO(#12874): remove the stupid as string conversion by modifying ForeignCallOutput type in acvm.js
66
- return [
67
- new Fr(this.index).toString() as string,
68
- new Fr(this.leafPreimage.leaf.slot).toString() as string,
69
- new Fr(this.leafPreimage.leaf.value).toString() as string,
70
- new Fr(this.leafPreimage.nextKey).toString() as string,
71
- new Fr(this.leafPreimage.nextIndex).toString() as string,
72
- this.siblingPath.toFields().map(fr => fr.toString()) as string[],
73
- ];
74
- }
75
-
76
45
  toBuffer(): Buffer {
77
46
  return serializeToBuffer([this.index, this.leafPreimage, this.siblingPath]);
78
47
  }
@@ -54,7 +54,8 @@ export function mergeExecutionPayloads(requests: ExecutionPayload[]): ExecutionP
54
54
  );
55
55
  }
56
56
 
57
- const feePayer = uniqueFeePayers.size === 1 ? AztecAddress.fromString(Array.from(uniqueFeePayers)[0]) : undefined;
57
+ const feePayer =
58
+ uniqueFeePayers.size === 1 ? AztecAddress.fromStringUnsafe(Array.from(uniqueFeePayers)[0]) : undefined;
58
59
 
59
60
  return new ExecutionPayload(calls, combinedAuthWitnesses, combinedCapsules, combinedExtraHashedArgs, feePayer);
60
61
  }
@@ -3,28 +3,12 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
3
3
  import type { SlotNumber } from '@aztec/foundation/schemas';
4
4
 
5
5
  import type { AztecAddress } from '../aztec-address/index.js';
6
- import type { UInt32 } from '../types/index.js';
7
- import type { CheckpointGlobalVariables, GlobalVariables } from './global_variables.js';
6
+ import type { CheckpointGlobalVariables } from './global_variables.js';
8
7
 
9
8
  /**
10
9
  * Interface for building global variables for Aztec blocks.
11
10
  */
12
11
  export interface GlobalVariableBuilder {
13
- /**
14
- * Builds global variables for a given block.
15
- * @param blockNumber - The block number to build global variables for.
16
- * @param coinbase - The address to receive block reward.
17
- * @param feeRecipient - The address to receive fees.
18
- * @param slotNumber - Optional. The slot number to use for the global variables. If undefined, it will be calculated.
19
- * @returns A promise that resolves to the GlobalVariables for the given block number.
20
- */
21
- buildGlobalVariables(
22
- blockNumber: UInt32,
23
- coinbase: EthAddress,
24
- feeRecipient: AztecAddress,
25
- slotNumber?: SlotNumber,
26
- ): Promise<GlobalVariables>;
27
-
28
12
  /** Builds global variables that are constant throughout a checkpoint. */
29
13
  buildCheckpointGlobalVariables(
30
14
  coinbase: EthAddress,
@@ -125,7 +125,7 @@ export class GlobalVariables {
125
125
  SlotNumber(reader.readU32()),
126
126
  reader.readField().toBigInt(),
127
127
  EthAddress.fromField(reader.readField()),
128
- AztecAddress.fromField(reader.readField()),
128
+ AztecAddress.fromFieldUnsafe(reader.readField()),
129
129
  GasFees.fromFields(reader),
130
130
  );
131
131
  }
@@ -220,7 +220,7 @@ export class GlobalVariables {
220
220
  blockNumber: BlockNumber(randomInt(100_000)),
221
221
  slotNumber: SlotNumber(randomInt(100_000)),
222
222
  coinbase: EthAddress.random(),
223
- feeRecipient: AztecAddress.fromField(Fr.random()),
223
+ feeRecipient: AztecAddress.fromFieldUnsafe(Fr.random()),
224
224
  gasFees: GasFees.random(),
225
225
  timestamp: BigInt(randomInt(100_000_000)),
226
226
  ...overrides,
@@ -23,6 +23,14 @@ export class PrivateTxConstantData {
23
23
  * protocol to execute and prove the transaction.
24
24
  */
25
25
  public txContext: TxContext,
26
+ /**
27
+ * Salt of the transaction request (`TxRequest.salt`).
28
+ *
29
+ * Bound to the user's `tx_request` by the Init circuit and kept constant by every subsequent kernel so that each
30
+ * app circuit's `txRequestSalt` public input can be checked against it. It is intentionally not carried into
31
+ * `TxConstantData`: it is dropped by the Tail circuits rather than being exposed by the final (hiding) kernel.
32
+ */
33
+ public txRequestSalt: Fr,
26
34
  /**
27
35
  * Root of the vk tree for the protocol circuits.
28
36
  */
@@ -38,7 +46,13 @@ export class PrivateTxConstantData {
38
46
  }
39
47
 
40
48
  static getFields(fields: FieldsOf<PrivateTxConstantData>) {
41
- return [fields.anchorBlockHeader, fields.txContext, fields.vkTreeRoot, fields.protocolContracts] as const;
49
+ return [
50
+ fields.anchorBlockHeader,
51
+ fields.txContext,
52
+ fields.txRequestSalt,
53
+ fields.vkTreeRoot,
54
+ fields.protocolContracts,
55
+ ] as const;
42
56
  }
43
57
 
44
58
  static fromFields(fields: Fr[] | FieldReader): PrivateTxConstantData {
@@ -47,6 +61,7 @@ export class PrivateTxConstantData {
47
61
  reader.readObject(BlockHeader),
48
62
  reader.readObject(TxContext),
49
63
  reader.readField(),
64
+ reader.readField(),
50
65
  reader.readObject(ProtocolContracts),
51
66
  );
52
67
  }
@@ -67,6 +82,7 @@ export class PrivateTxConstantData {
67
82
  reader.readObject(BlockHeader),
68
83
  reader.readObject(TxContext),
69
84
  Fr.fromBuffer(reader),
85
+ Fr.fromBuffer(reader),
70
86
  reader.readObject(ProtocolContracts),
71
87
  );
72
88
  }
@@ -76,13 +92,20 @@ export class PrivateTxConstantData {
76
92
  }
77
93
 
78
94
  static empty() {
79
- return new PrivateTxConstantData(BlockHeader.empty(), TxContext.empty(), Fr.ZERO, ProtocolContracts.empty());
95
+ return new PrivateTxConstantData(
96
+ BlockHeader.empty(),
97
+ TxContext.empty(),
98
+ Fr.ZERO,
99
+ Fr.ZERO,
100
+ ProtocolContracts.empty(),
101
+ );
80
102
  }
81
103
 
82
104
  getSize() {
83
105
  return (
84
106
  this.anchorBlockHeader.getSize() +
85
107
  this.txContext.getSize() +
108
+ this.txRequestSalt.size +
86
109
  this.vkTreeRoot.size +
87
110
  this.protocolContracts.getSize()
88
111
  );
@@ -1,9 +1,18 @@
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+
1
3
  import type { PublicDataTreeLeaf } from '../trees/index.js';
2
4
 
3
5
  /** Data used to initialize the genesis block, including prefilled public state and an optional timestamp. */
4
6
  export type GenesisData = {
5
7
  /** Public data tree leaves to pre-populate in the genesis state (e.g. fee juice balances). */
6
8
  prefilledPublicData: PublicDataTreeLeaf[];
9
+ /**
10
+ * Nullifiers to pre-insert into the genesis nullifier tree. Optional; defaults to an empty list, which leaves the
11
+ * nullifier tree at its canonical empty-genesis state so that production genesis roots are unchanged. When non-empty,
12
+ * the leaves must be unique and strictly increasing in field value (the native world state enforces this before
13
+ * construction). Test networks pass a non-empty list to seed e.g. standard-contract registration nullifiers.
14
+ */
15
+ prefilledNullifiers?: Fr[];
7
16
  /** Timestamp for the genesis block header. Defaults to 0 (canonical empty genesis) in production. */
8
17
  genesisTimestamp: bigint;
9
18
  };
@@ -11,6 +20,7 @@ export type GenesisData = {
11
20
  /** An empty genesis data with no prefilled state and a zero timestamp. */
12
21
  export const EMPTY_GENESIS_DATA: GenesisData = {
13
22
  prefilledPublicData: [],
23
+ prefilledNullifiers: [],
14
24
  genesisTimestamp: 0n,
15
25
  };
16
26
 
@@ -1,47 +0,0 @@
1
- import { BufferReader } from '@aztec/foundation/serialize';
2
- import type { UInt64 } from '../types/shared.js';
3
- import { PaddedSideEffectAmounts } from './padded_side_effects.js';
4
- import { PrivateKernelData } from './private_kernel_data.js';
5
- /**
6
- * Input to the private kernel circuit - tail call.
7
- */
8
- export declare class PrivateKernelTailCircuitPrivateInputs {
9
- /**
10
- * The previous kernel data
11
- */
12
- previousKernel: PrivateKernelData;
13
- /**
14
- * The number of the padded side effects.
15
- */
16
- paddedSideEffectAmounts: PaddedSideEffectAmounts;
17
- /**
18
- * The timestamp by which the transaction must be included in a block.
19
- */
20
- expirationTimestampUpperBound: UInt64;
21
- constructor(
22
- /**
23
- * The previous kernel data
24
- */
25
- previousKernel: PrivateKernelData,
26
- /**
27
- * The number of the padded side effects.
28
- */
29
- paddedSideEffectAmounts: PaddedSideEffectAmounts,
30
- /**
31
- * The timestamp by which the transaction must be included in a block.
32
- */
33
- expirationTimestampUpperBound: UInt64);
34
- isForPublic(): boolean;
35
- /**
36
- * Serialize this as a buffer.
37
- * @returns The buffer.
38
- */
39
- toBuffer(): Buffer<ArrayBufferLike>;
40
- /**
41
- * Deserializes from a buffer or reader.
42
- * @param buffer - Buffer or reader to read from.
43
- * @returns The deserialized instance.
44
- */
45
- static fromBuffer(buffer: Buffer | BufferReader): PrivateKernelTailCircuitPrivateInputs;
46
- }
47
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfdGFpbF9jaXJjdWl0X3ByaXZhdGVfaW5wdXRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMva2VybmVsL3ByaXZhdGVfa2VybmVsX3RhaWxfY2lyY3VpdF9wcml2YXRlX2lucHV0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsWUFBWSxFQUF1QyxNQUFNLDZCQUE2QixDQUFDO0FBRWhHLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQ2pELE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQ25FLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBRTdEOztHQUVHO0FBQ0gscUJBQWEscUNBQXFDO0lBRTlDOztPQUVHO0lBQ0ksY0FBYyxFQUFFLGlCQUFpQjtJQUN4Qzs7T0FFRztJQUNJLHVCQUF1QixFQUFFLHVCQUF1QjtJQUN2RDs7T0FFRztJQUNJLDZCQUE2QixFQUFFLE1BQU07SUFaOUM7SUFDRTs7T0FFRztJQUNJLGNBQWMsRUFBRSxpQkFBaUI7SUFDeEM7O09BRUc7SUFDSSx1QkFBdUIsRUFBRSx1QkFBdUI7SUFDdkQ7O09BRUc7SUFDSSw2QkFBNkIsRUFBRSxNQUFNLEVBQzFDO0lBRUosV0FBVyxZQUtWO0lBRUQ7OztPQUdHO0lBQ0gsUUFBUSw0QkFNUDtJQUVEOzs7O09BSUc7SUFDSCxNQUFNLENBQUMsVUFBVSxDQUFDLE1BQU0sRUFBRSxNQUFNLEdBQUcsWUFBWSxHQUFHLHFDQUFxQyxDQU90RjtDQUNGIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"private_kernel_tail_circuit_private_inputs.d.ts","sourceRoot":"","sources":["../../src/kernel/private_kernel_tail_circuit_private_inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuC,MAAM,6BAA6B,CAAC;AAEhG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;GAEG;AACH,qBAAa,qCAAqC;IAE9C;;OAEG;IACI,cAAc,EAAE,iBAAiB;IACxC;;OAEG;IACI,uBAAuB,EAAE,uBAAuB;IACvD;;OAEG;IACI,6BAA6B,EAAE,MAAM;IAZ9C;IACE;;OAEG;IACI,cAAc,EAAE,iBAAiB;IACxC;;OAEG;IACI,uBAAuB,EAAE,uBAAuB;IACvD;;OAEG;IACI,6BAA6B,EAAE,MAAM,EAC1C;IAEJ,WAAW,YAKV;IAED;;;OAGG;IACH,QAAQ,4BAMP;IAED;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,qCAAqC,CAOtF;CACF"}
@@ -1,38 +0,0 @@
1
- import { BufferReader, bigintToUInt64BE, serializeToBuffer } from '@aztec/foundation/serialize';
2
- import { PaddedSideEffectAmounts } from './padded_side_effects.js';
3
- import { PrivateKernelData } from './private_kernel_data.js';
4
- /**
5
- * Input to the private kernel circuit - tail call.
6
- */ export class PrivateKernelTailCircuitPrivateInputs {
7
- previousKernel;
8
- paddedSideEffectAmounts;
9
- expirationTimestampUpperBound;
10
- constructor(/**
11
- * The previous kernel data
12
- */ previousKernel, /**
13
- * The number of the padded side effects.
14
- */ paddedSideEffectAmounts, /**
15
- * The timestamp by which the transaction must be included in a block.
16
- */ expirationTimestampUpperBound){
17
- this.previousKernel = previousKernel;
18
- this.paddedSideEffectAmounts = paddedSideEffectAmounts;
19
- this.expirationTimestampUpperBound = expirationTimestampUpperBound;
20
- }
21
- isForPublic() {
22
- return this.previousKernel.publicInputs.end.publicCallRequests.claimedLength > 0 || !this.previousKernel.publicInputs.publicTeardownCallRequest.isEmpty();
23
- }
24
- /**
25
- * Serialize this as a buffer.
26
- * @returns The buffer.
27
- */ toBuffer() {
28
- return serializeToBuffer(this.previousKernel, this.paddedSideEffectAmounts, bigintToUInt64BE(this.expirationTimestampUpperBound));
29
- }
30
- /**
31
- * Deserializes from a buffer or reader.
32
- * @param buffer - Buffer or reader to read from.
33
- * @returns The deserialized instance.
34
- */ static fromBuffer(buffer) {
35
- const reader = BufferReader.asReader(buffer);
36
- return new PrivateKernelTailCircuitPrivateInputs(reader.readObject(PrivateKernelData), reader.readObject(PaddedSideEffectAmounts), reader.readUInt64());
37
- }
38
- }
@@ -1,27 +0,0 @@
1
- import { Fr } from '@aztec/foundation/curves/bn254';
2
- import { TxHash } from '../tx/tx_hash.js';
3
- /**
4
- * Additional information needed to process a message.
5
- *
6
- * All messages exist in the context of a transaction, and information about that transaction is typically required
7
- * in order to perform validation, store results, etc. For example, messages containing notes require knowledge of note
8
- * hashes and the first nullifier in order to find the note's nonce.
9
- *
10
- * A TS version of `message_context.nr`.
11
- */
12
- export declare class MessageContext {
13
- txHash: TxHash;
14
- uniqueNoteHashesInTx: Fr[];
15
- firstNullifierInTx: Fr;
16
- constructor(txHash: TxHash, uniqueNoteHashesInTx: Fr[], firstNullifierInTx: Fr);
17
- toFields(): Fr[];
18
- toNoirStruct(): {
19
- tx_hash: Fr;
20
- unique_note_hashes_in_tx: Fr[];
21
- first_nullifier_in_tx: Fr;
22
- };
23
- static empty(): MessageContext;
24
- static toEmptyFields(): Fr[];
25
- static toSerializedOption(response: MessageContext | null): Fr[];
26
- }
27
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZV9jb250ZXh0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbG9ncy9tZXNzYWdlX2NvbnRleHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBRXBELE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUUxQzs7Ozs7Ozs7R0FRRztBQUNILHFCQUFhLGNBQWM7SUFFaEIsTUFBTSxFQUFFLE1BQU07SUFDZCxvQkFBb0IsRUFBRSxFQUFFLEVBQUU7SUFDMUIsa0JBQWtCLEVBQUUsRUFBRTtJQUgvQixZQUNTLE1BQU0sRUFBRSxNQUFNLEVBQ2Qsb0JBQW9CLEVBQUUsRUFBRSxFQUFFLEVBQzFCLGtCQUFrQixFQUFFLEVBQUUsRUFDM0I7SUFFSixRQUFRLElBQUksRUFBRSxFQUFFLENBTWY7SUFFRCxZQUFZOzs7O01BUVg7SUFFRCxNQUFNLENBQUMsS0FBSyxJQUFJLGNBQWMsQ0FFN0I7SUFFRCxNQUFNLENBQUMsYUFBYSxJQUFJLEVBQUUsRUFBRSxDQUkzQjtJQUVELE1BQU0sQ0FBQyxrQkFBa0IsQ0FBQyxRQUFRLEVBQUUsY0FBYyxHQUFHLElBQUksR0FBRyxFQUFFLEVBQUUsQ0FNL0Q7Q0FDRiJ9
@@ -1 +0,0 @@
1
- {"version":3,"file":"message_context.d.ts","sourceRoot":"","sources":["../../src/logs/message_context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;;;;;;;GAQG;AACH,qBAAa,cAAc;IAEhB,MAAM,EAAE,MAAM;IACd,oBAAoB,EAAE,EAAE,EAAE;IAC1B,kBAAkB,EAAE,EAAE;IAH/B,YACS,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,EAAE,EAAE,EAC1B,kBAAkB,EAAE,EAAE,EAC3B;IAEJ,QAAQ,IAAI,EAAE,EAAE,CAMf;IAED,YAAY;;;;MAQX;IAED,MAAM,CAAC,KAAK,IAAI,cAAc,CAE7B;IAED,MAAM,CAAC,aAAa,IAAI,EAAE,EAAE,CAI3B;IAED,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,GAAG,EAAE,EAAE,CAM/D;CACF"}
@@ -1,74 +0,0 @@
1
- import { MAX_NOTE_HASHES_PER_TX } from '@aztec/constants';
2
- import { range } from '@aztec/foundation/array';
3
- import { Fr } from '@aztec/foundation/curves/bn254';
4
- import { TxHash } from '../tx/tx_hash.js';
5
- /**
6
- * Additional information needed to process a message.
7
- *
8
- * All messages exist in the context of a transaction, and information about that transaction is typically required
9
- * in order to perform validation, store results, etc. For example, messages containing notes require knowledge of note
10
- * hashes and the first nullifier in order to find the note's nonce.
11
- *
12
- * A TS version of `message_context.nr`.
13
- */ export class MessageContext {
14
- txHash;
15
- uniqueNoteHashesInTx;
16
- firstNullifierInTx;
17
- constructor(txHash, uniqueNoteHashesInTx, firstNullifierInTx){
18
- this.txHash = txHash;
19
- this.uniqueNoteHashesInTx = uniqueNoteHashesInTx;
20
- this.firstNullifierInTx = firstNullifierInTx;
21
- }
22
- toFields() {
23
- return [
24
- this.txHash.hash,
25
- ...serializeBoundedVec(this.uniqueNoteHashesInTx, MAX_NOTE_HASHES_PER_TX),
26
- this.firstNullifierInTx
27
- ];
28
- }
29
- toNoirStruct() {
30
- /* eslint-disable camelcase */ return {
31
- tx_hash: this.txHash.hash,
32
- unique_note_hashes_in_tx: this.uniqueNoteHashesInTx,
33
- first_nullifier_in_tx: this.firstNullifierInTx
34
- };
35
- /* eslint-enable camelcase */ }
36
- static empty() {
37
- return new MessageContext(TxHash.zero(), [], Fr.ZERO);
38
- }
39
- static toEmptyFields() {
40
- const serializationLen = 1 /* txHash */ + MAX_NOTE_HASHES_PER_TX + 1 /* uniqueNoteHashesInTx BVec */ + 1; /* firstNullifierInTx */
41
- return range(serializationLen).map((_)=>Fr.zero());
42
- }
43
- static toSerializedOption(response) {
44
- if (response) {
45
- return [
46
- new Fr(1),
47
- ...response.toFields()
48
- ];
49
- } else {
50
- return [
51
- new Fr(0),
52
- ...MessageContext.toEmptyFields()
53
- ];
54
- }
55
- }
56
- }
57
- /**
58
- * Helper function to serialize a bounded vector according to Noir's BoundedVec format
59
- * @param values - The values to serialize
60
- * @param maxLength - The maximum length of the bounded vector
61
- * @returns The serialized bounded vector as Fr[]
62
- * @dev Copied over from pending_tagged_log.ts.
63
- */ function serializeBoundedVec(values, maxLength) {
64
- if (values.length > maxLength) {
65
- throw new Error(`Attempted to serialize ${values} values into a BoundedVec with max length ${maxLength}`);
66
- }
67
- const lengthDiff = maxLength - values.length;
68
- const zeroPaddingArray = Array(lengthDiff).fill(Fr.ZERO);
69
- const storage = values.concat(zeroPaddingArray);
70
- return [
71
- ...storage,
72
- new Fr(values.length)
73
- ];
74
- }