@aztec/pxe 3.0.0-canary.a9708bd → 3.0.0-devnet.20251212

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 (264) hide show
  1. package/README.md +5 -5
  2. package/dest/bin/check_oracle_version.d.ts +1 -1
  3. package/dest/bin/check_oracle_version.js +110 -10
  4. package/dest/config/index.d.ts +9 -17
  5. package/dest/config/index.d.ts.map +1 -1
  6. package/dest/config/index.js +10 -16
  7. package/dest/config/package_info.d.ts +1 -1
  8. package/dest/config/package_info.js +1 -1
  9. package/dest/contract_function_simulator/contract_function_simulator.d.ts +6 -6
  10. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  11. package/dest/contract_function_simulator/contract_function_simulator.js +97 -42
  12. package/dest/contract_function_simulator/execution_data_provider.d.ts +40 -57
  13. package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -1
  14. package/dest/contract_function_simulator/execution_note_cache.d.ts +11 -9
  15. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  16. package/dest/contract_function_simulator/execution_note_cache.js +28 -17
  17. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
  18. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
  19. package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
  20. package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
  21. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
  22. package/dest/contract_function_simulator/index.d.ts +4 -2
  23. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  24. package/dest/contract_function_simulator/index.js +2 -1
  25. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +2 -2
  26. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  27. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +2 -2
  28. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  29. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +3 -3
  30. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  31. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +8 -4
  32. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +6 -3
  33. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  34. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +12 -3
  35. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
  36. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
  37. package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
  38. package/dest/contract_function_simulator/oracle/index.d.ts +2 -2
  39. package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
  40. package/dest/contract_function_simulator/oracle/index.js +1 -1
  41. package/dest/contract_function_simulator/oracle/interfaces.d.ts +104 -0
  42. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
  43. package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
  44. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +2 -4
  45. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  46. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
  47. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +10 -4
  48. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  49. package/dest/contract_function_simulator/oracle/note_packing_utils.js +10 -5
  50. package/dest/contract_function_simulator/oracle/oracle.d.ts +17 -15
  51. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  52. package/dest/contract_function_simulator/oracle/oracle.js +101 -81
  53. package/dest/contract_function_simulator/oracle/private_execution.d.ts +6 -5
  54. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  55. package/dest/contract_function_simulator/oracle/private_execution.js +7 -16
  56. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +34 -22
  57. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  58. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +89 -25
  59. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +23 -33
  60. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  61. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +38 -42
  62. package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
  63. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  64. package/dest/contract_function_simulator/pick_notes.js +1 -1
  65. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
  66. package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
  67. package/dest/contract_function_simulator/proxied_node.d.ts +1 -1
  68. package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -1
  69. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +34 -68
  70. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
  71. package/dest/contract_function_simulator/pxe_oracle_interface.js +220 -208
  72. package/dest/entrypoints/client/bundle/index.d.ts +4 -2
  73. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  74. package/dest/entrypoints/client/bundle/index.js +2 -1
  75. package/dest/entrypoints/client/bundle/utils.d.ts +9 -9
  76. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  77. package/dest/entrypoints/client/bundle/utils.js +12 -12
  78. package/dest/entrypoints/client/lazy/index.d.ts +4 -2
  79. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  80. package/dest/entrypoints/client/lazy/index.js +2 -1
  81. package/dest/entrypoints/client/lazy/utils.d.ts +8 -8
  82. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  83. package/dest/entrypoints/client/lazy/utils.js +11 -11
  84. package/dest/entrypoints/pxe_creation_options.d.ts +3 -1
  85. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  86. package/dest/entrypoints/server/index.d.ts +4 -2
  87. package/dest/entrypoints/server/index.d.ts.map +1 -1
  88. package/dest/entrypoints/server/index.js +2 -1
  89. package/dest/entrypoints/server/utils.d.ts +5 -24
  90. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  91. package/dest/entrypoints/server/utils.js +9 -41
  92. package/dest/error_enriching.d.ts +11 -0
  93. package/dest/error_enriching.d.ts.map +1 -0
  94. package/dest/{pxe_service/error_enriching.js → error_enriching.js} +3 -0
  95. package/dest/events/index.d.ts +2 -0
  96. package/dest/events/index.d.ts.map +1 -0
  97. package/dest/events/index.js +1 -0
  98. package/dest/events/private_event_filter_validator.d.ts +8 -0
  99. package/dest/events/private_event_filter_validator.d.ts.map +1 -0
  100. package/dest/events/private_event_filter_validator.js +39 -0
  101. package/dest/oracle_version.d.ts +3 -3
  102. package/dest/oracle_version.js +2 -2
  103. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +3 -3
  104. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
  105. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +7 -7
  106. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +1 -1
  107. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +6 -6
  108. package/dest/private_kernel/hints/index.d.ts +1 -1
  109. package/dest/private_kernel/index.d.ts +1 -1
  110. package/dest/private_kernel/private_kernel_execution_prover.d.ts +9 -2
  111. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  112. package/dest/private_kernel/private_kernel_execution_prover.js +38 -32
  113. package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
  114. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  115. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +8 -7
  116. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
  117. package/dest/pxe.d.ts +240 -0
  118. package/dest/pxe.d.ts.map +1 -0
  119. package/dest/{pxe_service/pxe_service.js → pxe.js} +227 -241
  120. package/dest/storage/address_data_provider/address_data_provider.d.ts +2 -4
  121. package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -1
  122. package/dest/storage/address_data_provider/address_data_provider.js +0 -3
  123. package/dest/storage/address_data_provider/index.d.ts +1 -1
  124. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +3 -5
  125. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
  126. package/dest/storage/capsule_data_provider/capsule_data_provider.js +1 -5
  127. package/dest/storage/capsule_data_provider/index.d.ts +1 -1
  128. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +6 -17
  129. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
  130. package/dest/storage/contract_data_provider/contract_data_provider.js +0 -15
  131. package/dest/storage/contract_data_provider/index.d.ts +1 -1
  132. package/dest/storage/contract_data_provider/private_functions_tree.d.ts +1 -1
  133. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
  134. package/dest/storage/contract_data_provider/private_functions_tree.js +1 -1
  135. package/dest/storage/index.d.ts +1 -2
  136. package/dest/storage/index.d.ts.map +1 -1
  137. package/dest/storage/index.js +0 -1
  138. package/dest/storage/metadata.d.ts +1 -1
  139. package/dest/storage/note_data_provider/index.d.ts +2 -2
  140. package/dest/storage/note_data_provider/index.d.ts.map +1 -1
  141. package/dest/storage/note_data_provider/index.js +1 -1
  142. package/dest/storage/note_data_provider/note_data_provider.d.ts +75 -11
  143. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
  144. package/dest/storage/note_data_provider/note_data_provider.js +143 -81
  145. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +31 -17
  146. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -1
  147. package/dest/storage/private_event_data_provider/private_event_data_provider.js +47 -28
  148. package/dest/storage/sync_data_provider/index.d.ts +1 -1
  149. package/dest/storage/sync_data_provider/sync_data_provider.d.ts +4 -5
  150. package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +1 -1
  151. package/dest/storage/sync_data_provider/sync_data_provider.js +0 -3
  152. package/dest/storage/tagging_data_provider/index.d.ts +1 -1
  153. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +29 -7
  154. package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +1 -1
  155. package/dest/storage/tagging_data_provider/tagging_data_provider.js +46 -39
  156. package/dest/synchronizer/index.d.ts +1 -1
  157. package/dest/synchronizer/synchronizer.d.ts +3 -2
  158. package/dest/synchronizer/synchronizer.d.ts.map +1 -1
  159. package/dest/synchronizer/synchronizer.js +4 -4
  160. package/dest/tagging/constants.d.ts +2 -0
  161. package/dest/tagging/constants.d.ts.map +1 -0
  162. package/dest/tagging/constants.js +2 -0
  163. package/dest/tagging/index.d.ts +7 -0
  164. package/dest/tagging/index.d.ts.map +1 -0
  165. package/dest/tagging/index.js +5 -0
  166. package/dest/tagging/siloed_tag.d.ts +14 -0
  167. package/dest/tagging/siloed_tag.d.ts.map +1 -0
  168. package/dest/tagging/siloed_tag.js +20 -0
  169. package/dest/tagging/tag.d.ts +12 -0
  170. package/dest/tagging/tag.d.ts.map +1 -0
  171. package/dest/tagging/tag.js +17 -0
  172. package/dest/tagging/utils.d.ts +18 -0
  173. package/dest/tagging/utils.d.ts.map +1 -0
  174. package/dest/tagging/utils.js +24 -0
  175. package/package.json +22 -24
  176. package/src/bin/check_oracle_version.ts +134 -10
  177. package/src/config/index.ts +18 -32
  178. package/src/config/package_info.ts +1 -1
  179. package/src/contract_function_simulator/contract_function_simulator.ts +151 -62
  180. package/src/contract_function_simulator/execution_data_provider.ts +47 -65
  181. package/src/contract_function_simulator/execution_note_cache.ts +33 -17
  182. package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
  183. package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
  184. package/src/contract_function_simulator/index.ts +3 -1
  185. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  186. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +1 -1
  187. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +10 -5
  188. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +14 -2
  189. package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
  190. package/src/contract_function_simulator/oracle/index.ts +1 -1
  191. package/src/contract_function_simulator/oracle/interfaces.ts +176 -0
  192. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
  193. package/src/contract_function_simulator/oracle/note_packing_utils.ts +21 -5
  194. package/src/contract_function_simulator/oracle/oracle.ts +135 -80
  195. package/src/contract_function_simulator/oracle/private_execution.ts +10 -17
  196. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +123 -49
  197. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +68 -80
  198. package/src/contract_function_simulator/pick_notes.ts +1 -1
  199. package/src/contract_function_simulator/pxe_oracle_interface.ts +291 -271
  200. package/src/entrypoints/client/bundle/index.ts +3 -1
  201. package/src/entrypoints/client/bundle/utils.ts +15 -23
  202. package/src/entrypoints/client/lazy/index.ts +3 -1
  203. package/src/entrypoints/client/lazy/utils.ts +14 -22
  204. package/src/entrypoints/pxe_creation_options.ts +2 -0
  205. package/src/entrypoints/server/index.ts +3 -1
  206. package/src/entrypoints/server/utils.ts +12 -56
  207. package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +5 -1
  208. package/src/events/index.ts +1 -0
  209. package/src/events/private_event_filter_validator.ts +47 -0
  210. package/src/oracle_version.ts +2 -2
  211. package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +5 -9
  212. package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +6 -6
  213. package/src/private_kernel/private_kernel_execution_prover.ts +51 -43
  214. package/src/private_kernel/private_kernel_oracle.ts +2 -1
  215. package/src/private_kernel/private_kernel_oracle_impl.ts +4 -3
  216. package/src/{pxe_service/pxe_service.ts → pxe.ts} +256 -308
  217. package/src/storage/address_data_provider/address_data_provider.ts +1 -7
  218. package/src/storage/capsule_data_provider/capsule_data_provider.ts +2 -12
  219. package/src/storage/contract_data_provider/contract_data_provider.ts +4 -27
  220. package/src/storage/contract_data_provider/private_functions_tree.ts +1 -1
  221. package/src/storage/index.ts +0 -1
  222. package/src/storage/note_data_provider/index.ts +1 -1
  223. package/src/storage/note_data_provider/note_data_provider.ts +171 -109
  224. package/src/storage/private_event_data_provider/private_event_data_provider.ts +69 -41
  225. package/src/storage/sync_data_provider/sync_data_provider.ts +3 -8
  226. package/src/storage/tagging_data_provider/tagging_data_provider.ts +52 -55
  227. package/src/synchronizer/synchronizer.ts +4 -4
  228. package/src/tagging/constants.ts +2 -0
  229. package/src/tagging/index.ts +6 -0
  230. package/src/tagging/siloed_tag.ts +22 -0
  231. package/src/tagging/tag.ts +16 -0
  232. package/src/tagging/utils.ts +31 -0
  233. package/dest/bin/index.d.ts +0 -3
  234. package/dest/bin/index.d.ts.map +0 -1
  235. package/dest/bin/index.js +0 -48
  236. package/dest/contract_function_simulator/oracle/typed_oracle.d.ts +0 -87
  237. package/dest/contract_function_simulator/oracle/typed_oracle.d.ts.map +0 -1
  238. package/dest/contract_function_simulator/oracle/typed_oracle.js +0 -146
  239. package/dest/contract_function_simulator/tagging_utils.d.ts +0 -17
  240. package/dest/contract_function_simulator/tagging_utils.d.ts.map +0 -1
  241. package/dest/contract_function_simulator/tagging_utils.js +0 -23
  242. package/dest/pxe_service/error_enriching.d.ts +0 -11
  243. package/dest/pxe_service/error_enriching.d.ts.map +0 -1
  244. package/dest/pxe_service/index.d.ts +0 -3
  245. package/dest/pxe_service/index.d.ts.map +0 -1
  246. package/dest/pxe_service/index.js +0 -2
  247. package/dest/pxe_service/pxe_service.d.ts +0 -100
  248. package/dest/pxe_service/pxe_service.d.ts.map +0 -1
  249. package/dest/storage/data_provider.d.ts +0 -4
  250. package/dest/storage/data_provider.d.ts.map +0 -1
  251. package/dest/storage/data_provider.js +0 -1
  252. package/dest/storage/note_data_provider/note_dao.d.ts +0 -100
  253. package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
  254. package/dest/storage/note_data_provider/note_dao.js +0 -102
  255. package/dest/test/pxe_test_suite.d.ts +0 -3
  256. package/dest/test/pxe_test_suite.d.ts.map +0 -1
  257. package/dest/test/pxe_test_suite.js +0 -97
  258. package/src/bin/index.ts +0 -62
  259. package/src/contract_function_simulator/oracle/typed_oracle.ts +0 -289
  260. package/src/contract_function_simulator/tagging_utils.ts +0 -32
  261. package/src/pxe_service/index.ts +0 -2
  262. package/src/storage/data_provider.ts +0 -3
  263. package/src/storage/note_data_provider/note_dao.ts +0 -154
  264. package/src/test/pxe_test_suite.ts +0 -113
@@ -1,12 +1,11 @@
1
- import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto/keys';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { pushTestData } from '@aztec/foundation/testing';
5
5
  import { Timer } from '@aztec/foundation/timer';
6
6
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
7
- import { getProtocolContractLeafAndMembershipWitness, protocolContractTreeRoot } from '@aztec/protocol-contracts';
7
+ import { ProtocolContractsList } from '@aztec/protocol-contracts';
8
8
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
9
- import { computeContractAddressFromInstance } from '@aztec/stdlib/contract';
10
9
  import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
11
10
  import {
12
11
  HidingKernelToPublicPrivateInputs,
@@ -24,7 +23,7 @@ import {
24
23
  type PrivateKernelTailCircuitPublicInputs,
25
24
  PrivateVerificationKeyHints,
26
25
  } from '@aztec/stdlib/kernel';
27
- import { ClientIvcProof } from '@aztec/stdlib/proofs';
26
+ import { ChonkProof, ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
28
27
  import {
29
28
  type PrivateCallExecutionResult,
30
29
  type PrivateExecutionResult,
@@ -54,7 +53,7 @@ export interface PrivateKernelExecutionProverConfig {
54
53
  /**
55
54
  * The PrivateKernelExecutionProver class is responsible for taking a transaction request and sequencing the
56
55
  * the execution of the private functions within, sequenced with private kernel "glue" to check protocol rules.
57
- * The result can be a client IVC proof of the private transaction portion, or just a simulation that can e.g.
56
+ * The result can be a chonk proof of the private transaction portion, or just a simulation that can e.g.
58
57
  * inform state tree updates.
59
58
  */
60
59
  export class PrivateKernelExecutionProver {
@@ -104,9 +103,8 @@ export class PrivateKernelExecutionProver {
104
103
 
105
104
  const noteHashLeafIndexMap = collectNoteHashLeafIndexMap(executionResult);
106
105
  const noteHashNullifierCounterMap = collectNoteHashNullifierCounterMap(executionResult);
107
- const validationRequestsSplitCounter = isPrivateOnlyTx
108
- ? 0
109
- : getFinalMinRevertibleSideEffectCounter(executionResult);
106
+ const minRevertibleSideEffectCounter = getFinalMinRevertibleSideEffectCounter(executionResult);
107
+ const splitCounter = isPrivateOnlyTx ? 0 : minRevertibleSideEffectCounter;
110
108
 
111
109
  while (executionStack.length) {
112
110
  if (!firstIteration) {
@@ -114,7 +112,7 @@ export class PrivateKernelExecutionProver {
114
112
  output,
115
113
  executionStack,
116
114
  noteHashNullifierCounterMap,
117
- validationRequestsSplitCounter,
115
+ splitCounter,
118
116
  );
119
117
  while (resetBuilder.needsReset()) {
120
118
  const witgenTimer = new Timer();
@@ -135,7 +133,7 @@ export class PrivateKernelExecutionProver {
135
133
  output,
136
134
  executionStack,
137
135
  noteHashNullifierCounterMap,
138
- validationRequestsSplitCounter,
136
+ splitCounter,
139
137
  );
140
138
  }
141
139
  }
@@ -168,10 +166,11 @@ export class PrivateKernelExecutionProver {
168
166
  const proofInput = new PrivateKernelInitCircuitPrivateInputs(
169
167
  txRequest,
170
168
  getVKTreeRoot(),
171
- protocolContractTreeRoot,
169
+ ProtocolContractsList,
172
170
  privateCallData,
173
171
  isPrivateOnlyTx,
174
172
  executionResult.firstNullifier,
173
+ minRevertibleSideEffectCounter,
175
174
  );
176
175
  this.log.debug(
177
176
  `Calling private kernel init with isPrivateOnly ${isPrivateOnlyTx} and firstNullifierHint ${proofInput.firstNullifierHint}`,
@@ -221,7 +220,7 @@ export class PrivateKernelExecutionProver {
221
220
  output,
222
221
  [],
223
222
  noteHashNullifierCounterMap,
224
- validationRequestsSplitCounter,
223
+ splitCounter,
225
224
  );
226
225
  while (resetBuilder.needsReset()) {
227
226
  const witgenTimer = new Timer();
@@ -240,12 +239,7 @@ export class PrivateKernelExecutionProver {
240
239
  },
241
240
  });
242
241
 
243
- resetBuilder = new PrivateKernelResetPrivateInputsBuilder(
244
- output,
245
- [],
246
- noteHashNullifierCounterMap,
247
- validationRequestsSplitCounter,
248
- );
242
+ resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, [], noteHashNullifierCounterMap, splitCounter);
249
243
  }
250
244
 
251
245
  if (output.publicInputs.feePayer.isZero() && skipFeeEnforcement) {
@@ -268,10 +262,10 @@ export class PrivateKernelExecutionProver {
268
262
  // Use the aggregated includeByTimestamp set throughout the tx execution.
269
263
  // TODO: Call `computeTxIncludeByTimestamp` to round the value down and reduce precision, improving privacy.
270
264
  const includeByTimestampUpperBound = previousKernelData.publicInputs.includeByTimestamp;
271
- const blockTimestamp = previousKernelData.publicInputs.constants.historicalHeader.globalVariables.timestamp;
272
- if (includeByTimestampUpperBound <= blockTimestamp) {
265
+ const anchorBlockTimestamp = previousKernelData.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp;
266
+ if (includeByTimestampUpperBound <= anchorBlockTimestamp) {
273
267
  throw new Error(
274
- `Include-by timestamp must be greater than the historical block timestamp. Block timestamp: ${blockTimestamp}. Include-by timestamp: ${includeByTimestampUpperBound}.`,
268
+ `Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${includeByTimestampUpperBound}.`,
275
269
  );
276
270
  }
277
271
 
@@ -281,8 +275,6 @@ export class PrivateKernelExecutionProver {
281
275
  includeByTimestampUpperBound,
282
276
  );
283
277
 
284
- pushTestData('private-kernel-inputs-ordering', privateInputs);
285
-
286
278
  const witgenTimer = new Timer();
287
279
  const tailOutput = generateWitnesses
288
280
  ? await this.proofCreator.generateTailOutput(privateInputs)
@@ -298,8 +290,8 @@ export class PrivateKernelExecutionProver {
298
290
  },
299
291
  });
300
292
 
301
- // Hiding circuit is only executed if we are generating witnesses.
302
- // For simulation, we can end with the tail, since the hiding circuit will simply return the same tail output.
293
+ // Hiding kernel is only executed if we are generating witnesses.
294
+ // For simulation, we can end with the tail, since the Hiding kernel will simply return the same tail output.
303
295
  if (generateWitnesses) {
304
296
  const previousKernelVkData = await this.getVkData(tailOutput.verificationKey);
305
297
 
@@ -350,25 +342,53 @@ export class PrivateKernelExecutionProver {
350
342
  this.log.info(`Private kernel witness generation took ${timer.ms()}ms`);
351
343
  }
352
344
 
353
- let clientIvcProof: ClientIvcProof;
345
+ let chonkProof: ChonkProof;
354
346
  // TODO(#7368) how do we 'bincode' encode these inputs?
355
347
  let provingTime;
356
348
  if (!skipProofGeneration) {
357
349
  const provingTimer = new Timer();
358
- clientIvcProof = await this.proofCreator.createClientIvcProof(executionSteps);
350
+ const proofWithPublicInputs = await this.proofCreator.createChonkProof(executionSteps);
359
351
  provingTime = provingTimer.ms();
352
+ this.ensurePublicInputsMatch(proofWithPublicInputs, tailOutput.publicInputs);
353
+ chonkProof = proofWithPublicInputs.removePublicInputs();
360
354
  } else {
361
- clientIvcProof = ClientIvcProof.random();
355
+ chonkProof = ChonkProof.random();
362
356
  }
363
357
 
364
358
  return {
365
359
  publicInputs: tailOutput.publicInputs,
366
360
  executionSteps,
367
- clientIvcProof,
361
+ chonkProof,
368
362
  timings: provingTime ? { proving: provingTime } : undefined,
369
363
  };
370
364
  }
371
365
 
366
+ /**
367
+ * Checks that the public inputs of the chonk proof match the public inputs of the tail circuit.
368
+ * This can only mismatch if there is a circuit / noir / bb bug.
369
+ * @param chonkProof - The chonk proof with public inputs.
370
+ * @param tailPublicInputs - The public inputs resulting from witness generation of the tail circuit.
371
+ */
372
+ private ensurePublicInputsMatch(
373
+ chonkProof: ChonkProofWithPublicInputs,
374
+ tailPublicInputs: PrivateKernelTailCircuitPublicInputs,
375
+ ) {
376
+ const serializedChonkProofPublicInputs = chonkProof.getPublicInputs();
377
+ const serializedTailPublicInputs = tailPublicInputs.publicInputs().toFields();
378
+ if (serializedChonkProofPublicInputs.length !== serializedTailPublicInputs.length) {
379
+ throw new Error(
380
+ `Public inputs length mismatch: ${serializedChonkProofPublicInputs.length} !== ${serializedTailPublicInputs.length}`,
381
+ );
382
+ }
383
+ if (
384
+ !serializedChonkProofPublicInputs.every((input: Fr, index: number) =>
385
+ input.equals(serializedTailPublicInputs[index]),
386
+ )
387
+ ) {
388
+ throw new Error(`Public inputs mismatch between kernel and chonk proof`);
389
+ }
390
+ }
391
+
372
392
  private async getVkData(verificationKey: VerificationKeyData) {
373
393
  const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(verificationKey.keyAsFields);
374
394
  return new VkData(
@@ -394,18 +414,8 @@ export class PrivateKernelExecutionProver {
394
414
  const { artifactHash: contractClassArtifactHash, publicBytecodeCommitment: contractClassPublicBytecodeCommitment } =
395
415
  await this.oracle.getContractClassIdPreimage(currentContractClassId);
396
416
 
397
- // This will be the address computed in the kernel by the executed class. We need to provide non membership of it in the protocol contract tree.
398
- // This would only be equal to contractAddress if the currentClassId is equal to the original class id (no update happened).
399
- const computedAddress = await computeContractAddressFromInstance({
400
- originalContractClassId: currentContractClassId,
401
- saltedInitializationHash,
402
- publicKeys,
403
- });
404
-
405
- const { lowLeaf: protocolContractLeaf, witness: protocolContractMembershipWitness } =
406
- await getProtocolContractLeafAndMembershipWitness(contractAddress, computedAddress);
407
-
408
417
  const updatedClassIdHints = await this.oracle.getUpdatedClassIdHints(contractAddress);
418
+
409
419
  return PrivateCallData.from({
410
420
  publicInputs,
411
421
  vk,
@@ -415,8 +425,6 @@ export class PrivateKernelExecutionProver {
415
425
  contractClassPublicBytecodeCommitment,
416
426
  saltedInitializationHash,
417
427
  functionLeafMembershipWitness,
418
- protocolContractMembershipWitness,
419
- protocolContractLeaf,
420
428
  updatedClassIdHints,
421
429
  }),
422
430
  });
@@ -1,5 +1,6 @@
1
1
  import { FUNCTION_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
2
- import type { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
+ import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
3
4
  import { MembershipWitness } from '@aztec/foundation/trees';
4
5
  import type { FunctionSelector } from '@aztec/stdlib/abi';
5
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -1,5 +1,6 @@
1
1
  import { NOTE_HASH_TREE_HEIGHT, PUBLIC_DATA_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
2
- import type { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
+ import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
3
4
  import { createLogger } from '@aztec/foundation/log';
4
5
  import type { Tuple } from '@aztec/foundation/serialize';
5
6
  import { MembershipWitness } from '@aztec/foundation/trees';
@@ -8,7 +9,7 @@ import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-type
8
9
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
9
10
  import type { FunctionSelector } from '@aztec/stdlib/abi';
10
11
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
11
- import type { L2BlockNumber } from '@aztec/stdlib/block';
12
+ import type { BlockParameter } from '@aztec/stdlib/block';
12
13
  import { computeContractClassIdPreimage, computeSaltedInitializationHash } from '@aztec/stdlib/contract';
13
14
  import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
14
15
  import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
@@ -31,7 +32,7 @@ export class PrivateKernelOracleImpl implements PrivateKernelOracle {
31
32
  private contractDataProvider: ContractDataProvider,
32
33
  private keyStore: KeyStore,
33
34
  private node: AztecNode,
34
- private blockNumber: L2BlockNumber = 'latest',
35
+ private blockNumber: BlockParameter = 'latest',
35
36
  private log = createLogger('pxe:kernel_oracle'),
36
37
  ) {}
37
38