@aztec/stdlib 0.0.1-commit.3100065 → 0.0.1-commit.330febf

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 (231) hide show
  1. package/dest/abi/abi.d.ts +32 -7
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +11 -2
  4. package/dest/abi/contract_artifact.d.ts +1 -14
  5. package/dest/abi/contract_artifact.d.ts.map +1 -1
  6. package/dest/abi/contract_artifact.js +35 -36
  7. package/dest/abi/decoder.d.ts +12 -5
  8. package/dest/abi/decoder.d.ts.map +1 -1
  9. package/dest/abi/decoder.js +18 -21
  10. package/dest/abi/function_call.d.ts +17 -8
  11. package/dest/abi/function_call.d.ts.map +1 -1
  12. package/dest/abi/function_call.js +28 -9
  13. package/dest/avm/avm.d.ts +212 -211
  14. package/dest/avm/avm.d.ts.map +1 -1
  15. package/dest/avm/avm.js +3 -1
  16. package/dest/avm/index.d.ts +1 -6
  17. package/dest/avm/index.d.ts.map +1 -1
  18. package/dest/avm/index.js +0 -5
  19. package/dest/block/l2_block_source.d.ts +1 -1
  20. package/dest/block/l2_block_source.d.ts.map +1 -1
  21. package/dest/block/l2_block_source.js +6 -2
  22. package/dest/block/l2_block_stream/interfaces.d.ts +7 -5
  23. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  24. package/dest/block/l2_block_stream/l2_block_stream.d.ts +2 -1
  25. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  26. package/dest/block/l2_block_stream/l2_block_stream.js +47 -20
  27. package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
  28. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  29. package/dest/block/test/l2_tips_store_test_suite.js +9 -4
  30. package/dest/config/node-rpc-config.d.ts +1 -1
  31. package/dest/config/node-rpc-config.d.ts.map +1 -1
  32. package/dest/config/node-rpc-config.js +1 -1
  33. package/dest/contract/artifact_hash.d.ts +2 -2
  34. package/dest/contract/artifact_hash.d.ts.map +1 -1
  35. package/dest/contract/artifact_hash.js +10 -2
  36. package/dest/contract/contract_class.d.ts +1 -1
  37. package/dest/contract/contract_class.d.ts.map +1 -1
  38. package/dest/contract/contract_class.js +3 -2
  39. package/dest/contract/index.d.ts +1 -2
  40. package/dest/contract/index.d.ts.map +1 -1
  41. package/dest/contract/index.js +0 -1
  42. package/dest/interfaces/api_limit.d.ts +6 -1
  43. package/dest/interfaces/api_limit.d.ts.map +1 -1
  44. package/dest/interfaces/api_limit.js +3 -0
  45. package/dest/interfaces/aztec-node-admin.d.ts +2 -1
  46. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  47. package/dest/interfaces/block-builder.d.ts +7 -2
  48. package/dest/interfaces/block-builder.d.ts.map +1 -1
  49. package/dest/interfaces/configs.d.ts +7 -1
  50. package/dest/interfaces/configs.d.ts.map +1 -1
  51. package/dest/interfaces/configs.js +1 -0
  52. package/dest/interfaces/merkle_tree_operations.d.ts +8 -3
  53. package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
  54. package/dest/interfaces/private_kernel_prover.d.ts +64 -3
  55. package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
  56. package/dest/interfaces/proving-job.d.ts +1 -1
  57. package/dest/interfaces/server.d.ts +1 -2
  58. package/dest/interfaces/server.d.ts.map +1 -1
  59. package/dest/interfaces/server.js +0 -1
  60. package/dest/interfaces/tx_provider.d.ts +5 -1
  61. package/dest/interfaces/tx_provider.d.ts.map +1 -1
  62. package/dest/kernel/hints/index.d.ts +1 -2
  63. package/dest/kernel/hints/index.d.ts.map +1 -1
  64. package/dest/kernel/hints/index.js +0 -1
  65. package/dest/kernel/index.d.ts +5 -1
  66. package/dest/kernel/index.d.ts.map +1 -1
  67. package/dest/kernel/index.js +4 -0
  68. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +1 -9
  69. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
  70. package/dest/kernel/private_kernel_circuit_public_inputs.js +3 -7
  71. package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts +24 -0
  72. package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts.map +1 -0
  73. package/dest/kernel/private_kernel_init_4_circuit_private_inputs.js +37 -0
  74. package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts +25 -0
  75. package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts.map +1 -0
  76. package/dest/kernel/private_kernel_init_5_circuit_private_inputs.js +39 -0
  77. package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts +18 -0
  78. package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts.map +1 -0
  79. package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.js +27 -0
  80. package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts +19 -0
  81. package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts.map +1 -0
  82. package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.js +29 -0
  83. package/dest/kernel/private_kernel_prover_output.d.ts +4 -1
  84. package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
  85. package/dest/kernel/private_kernel_prover_output.js +4 -1
  86. package/dest/kernel/private_kernel_simulated_output.d.ts +1 -7
  87. package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
  88. package/dest/kernel/private_kernel_simulated_output.js +2 -1
  89. package/dest/kernel/utils/index.d.ts +1 -2
  90. package/dest/kernel/utils/index.d.ts.map +1 -1
  91. package/dest/kernel/utils/index.js +0 -1
  92. package/dest/logs/index.d.ts +3 -1
  93. package/dest/logs/index.d.ts.map +1 -1
  94. package/dest/logs/index.js +2 -0
  95. package/dest/logs/logs_query.d.ts +2 -2
  96. package/dest/logs/message_context.d.ts +17 -0
  97. package/dest/logs/message_context.d.ts.map +1 -0
  98. package/dest/logs/message_context.js +9 -0
  99. package/dest/logs/pending_tagged_log.d.ts +11 -0
  100. package/dest/logs/pending_tagged_log.d.ts.map +1 -0
  101. package/dest/logs/pending_tagged_log.js +4 -0
  102. package/dest/logs/shared_secret_derivation.d.ts +12 -2
  103. package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
  104. package/dest/logs/shared_secret_derivation.js +18 -0
  105. package/dest/noir/index.d.ts +3 -3
  106. package/dest/noir/index.d.ts.map +1 -1
  107. package/dest/p2p/index.d.ts +1 -2
  108. package/dest/p2p/index.d.ts.map +1 -1
  109. package/dest/p2p/index.js +0 -1
  110. package/dest/stats/stats.d.ts +2 -2
  111. package/dest/stats/stats.d.ts.map +1 -1
  112. package/dest/tests/factories.d.ts +1 -27
  113. package/dest/tests/factories.d.ts.map +1 -1
  114. package/dest/tests/factories.js +0 -30
  115. package/dest/tx/hashed_values.d.ts +7 -1
  116. package/dest/tx/hashed_values.d.ts.map +1 -1
  117. package/dest/tx/hashed_values.js +9 -1
  118. package/dest/tx/index.d.ts +1 -2
  119. package/dest/tx/index.d.ts.map +1 -1
  120. package/dest/tx/index.js +0 -1
  121. package/dest/tx/offchain_effect.js +1 -1
  122. package/dest/tx/profiling.d.ts +1 -1
  123. package/dest/tx/profiling.d.ts.map +1 -1
  124. package/dest/tx/profiling.js +2 -0
  125. package/dest/tx/simulated_tx.d.ts +1 -1
  126. package/dest/tx/simulated_tx.d.ts.map +1 -1
  127. package/dest/tx/simulated_tx.js +7 -2
  128. package/dest/tx/tx.d.ts +8 -1
  129. package/dest/tx/tx.d.ts.map +1 -1
  130. package/dest/tx/tx.js +9 -3
  131. package/dest/validators/errors.d.ts +16 -1
  132. package/dest/validators/errors.d.ts.map +1 -1
  133. package/dest/validators/errors.js +12 -0
  134. package/dest/world-state/world_state_revision.d.ts +1 -18
  135. package/dest/world-state/world_state_revision.d.ts.map +1 -1
  136. package/dest/world-state/world_state_revision.js +0 -20
  137. package/package.json +8 -8
  138. package/src/abi/abi.ts +32 -4
  139. package/src/abi/contract_artifact.ts +40 -35
  140. package/src/abi/decoder.ts +20 -24
  141. package/src/abi/function_call.ts +19 -7
  142. package/src/avm/avm.ts +4 -1
  143. package/src/avm/index.ts +0 -5
  144. package/src/block/l2_block_source.ts +14 -2
  145. package/src/block/l2_block_stream/interfaces.ts +6 -4
  146. package/src/block/l2_block_stream/l2_block_stream.ts +58 -21
  147. package/src/block/test/l2_tips_store_test_suite.ts +5 -0
  148. package/src/config/node-rpc-config.ts +2 -1
  149. package/src/contract/artifact_hash.ts +15 -3
  150. package/src/contract/contract_class.ts +3 -2
  151. package/src/contract/index.ts +0 -1
  152. package/src/gas/README.md +108 -36
  153. package/src/interfaces/api_limit.ts +5 -0
  154. package/src/interfaces/block-builder.ts +6 -1
  155. package/src/interfaces/configs.ts +6 -0
  156. package/src/interfaces/merkle_tree_operations.ts +8 -2
  157. package/src/interfaces/private_kernel_prover.ts +94 -1
  158. package/src/interfaces/server.ts +0 -1
  159. package/src/interfaces/tx_provider.ts +4 -0
  160. package/src/kernel/hints/index.ts +0 -1
  161. package/src/kernel/index.ts +4 -0
  162. package/src/kernel/private_kernel_circuit_public_inputs.ts +0 -7
  163. package/src/kernel/private_kernel_init_4_circuit_private_inputs.ts +52 -0
  164. package/src/kernel/private_kernel_init_5_circuit_private_inputs.ts +55 -0
  165. package/src/kernel/private_kernel_inner_4_circuit_private_inputs.ts +39 -0
  166. package/src/kernel/private_kernel_inner_5_circuit_private_inputs.ts +42 -0
  167. package/src/kernel/private_kernel_prover_output.ts +4 -0
  168. package/src/kernel/private_kernel_reset_dimensions.ts +1 -1
  169. package/src/kernel/private_kernel_simulated_output.ts +0 -7
  170. package/src/kernel/utils/index.ts +0 -1
  171. package/src/logs/index.ts +2 -0
  172. package/src/logs/logs_query.ts +2 -2
  173. package/src/logs/message_context.ts +18 -0
  174. package/src/logs/pending_tagged_log.ts +12 -0
  175. package/src/logs/shared_secret_derivation.ts +18 -1
  176. package/src/noir/index.ts +2 -1
  177. package/src/p2p/index.ts +0 -1
  178. package/src/stats/stats.ts +4 -0
  179. package/src/tests/factories.ts +0 -38
  180. package/src/tx/hashed_values.ts +11 -6
  181. package/src/tx/index.ts +0 -1
  182. package/src/tx/offchain_effect.ts +1 -1
  183. package/src/tx/profiling.ts +2 -0
  184. package/src/tx/simulated_tx.ts +13 -2
  185. package/src/tx/tx.ts +19 -3
  186. package/src/validators/errors.ts +17 -0
  187. package/src/world-state/world_state_revision.ts +0 -33
  188. package/dest/avm/contract_storage_read.d.ts +0 -58
  189. package/dest/avm/contract_storage_read.d.ts.map +0 -1
  190. package/dest/avm/contract_storage_read.js +0 -65
  191. package/dest/avm/contract_storage_update_request.d.ts +0 -65
  192. package/dest/avm/contract_storage_update_request.d.ts.map +0 -1
  193. package/dest/avm/contract_storage_update_request.js +0 -80
  194. package/dest/avm/public_call_stack_item_compressed.d.ts +0 -43
  195. package/dest/avm/public_call_stack_item_compressed.d.ts.map +0 -1
  196. package/dest/avm/public_call_stack_item_compressed.js +0 -70
  197. package/dest/avm/public_data_update_request.d.ts +0 -62
  198. package/dest/avm/public_data_update_request.d.ts.map +0 -1
  199. package/dest/avm/public_data_update_request.js +0 -67
  200. package/dest/avm/public_inner_call_request.d.ts +0 -50
  201. package/dest/avm/public_inner_call_request.d.ts.map +0 -1
  202. package/dest/avm/public_inner_call_request.js +0 -74
  203. package/dest/contract/deployment_info.d.ts +0 -24
  204. package/dest/contract/deployment_info.d.ts.map +0 -1
  205. package/dest/contract/deployment_info.js +0 -3
  206. package/dest/interfaces/prover-coordination.d.ts +0 -15
  207. package/dest/interfaces/prover-coordination.d.ts.map +0 -1
  208. package/dest/interfaces/prover-coordination.js +0 -1
  209. package/dest/kernel/hints/tree_leaf_read_request.d.ts +0 -14
  210. package/dest/kernel/hints/tree_leaf_read_request.d.ts.map +0 -1
  211. package/dest/kernel/hints/tree_leaf_read_request.js +0 -33
  212. package/dest/kernel/utils/optional_number.d.ts +0 -31
  213. package/dest/kernel/utils/optional_number.d.ts.map +0 -1
  214. package/dest/kernel/utils/optional_number.js +0 -42
  215. package/dest/p2p/interface.d.ts +0 -5
  216. package/dest/p2p/interface.d.ts.map +0 -1
  217. package/dest/p2p/interface.js +0 -1
  218. package/dest/tx/validator/empty_validator.d.ts +0 -5
  219. package/dest/tx/validator/empty_validator.d.ts.map +0 -1
  220. package/dest/tx/validator/empty_validator.js +0 -7
  221. package/src/avm/contract_storage_read.ts +0 -77
  222. package/src/avm/contract_storage_update_request.ts +0 -93
  223. package/src/avm/public_call_stack_item_compressed.ts +0 -113
  224. package/src/avm/public_data_update_request.ts +0 -106
  225. package/src/avm/public_inner_call_request.ts +0 -85
  226. package/src/contract/deployment_info.ts +0 -25
  227. package/src/interfaces/prover-coordination.ts +0 -17
  228. package/src/kernel/hints/tree_leaf_read_request.ts +0 -35
  229. package/src/kernel/utils/optional_number.ts +0 -50
  230. package/src/p2p/interface.ts +0 -4
  231. package/src/tx/validator/empty_validator.ts +0 -7
@@ -2,4 +2,9 @@ export const MAX_RPC_LEN = 100;
2
2
  export const MAX_RPC_TXS_LEN = 50;
3
3
  export const MAX_RPC_BLOCKS_LEN = 50;
4
4
  export const MAX_RPC_CHECKPOINTS_LEN = 50;
5
+ /** Checkpoint data carries no attestations or block bodies, so a page can be larger than a full checkpoint response. */
6
+ export const MAX_RPC_CHECKPOINTS_DATA_LEN = 200;
5
7
  export const MAX_LOGS_PER_TAG = 20;
8
+ /** Overrides are written into a public data tree fork before simulation, outside the simulated tx's gas budget. */
9
+ export const MAX_RPC_PUBLIC_STORAGE_OVERRIDES_LEN = 200;
10
+ export const MAX_RPC_CONTRACT_OVERRIDES_LEN = 50;
@@ -2,6 +2,7 @@ import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-ty
2
2
  import type { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import type { LoggerBindings } from '@aztec/foundation/log';
4
4
 
5
+ import type { BlockHash } from '../block/block_hash.js';
5
6
  import type { L2Block } from '../block/l2_block.js';
6
7
  import type { ChainConfig, SequencerConfig } from '../config/chain-config.js';
7
8
  import type { L1RollupConstants } from '../epoch-helpers/index.js';
@@ -143,7 +144,11 @@ export interface ICheckpointBlockBuilder {
143
144
 
144
145
  /** Interface for creating checkpoint builders. */
145
146
  export interface ICheckpointsBuilder {
146
- getFork(blockNumber: BlockNumber): Promise<MerkleTreeWriteOperations>;
147
+ /**
148
+ * Syncs world state to `blockNumber` and returns a fork of it at that block. When `blockHash` is
149
+ * provided it is verified against the synced block, triggering a resync on mismatch (reorg detection).
150
+ */
151
+ getFork(blockNumber: BlockNumber, blockHash?: BlockHash): Promise<MerkleTreeWriteOperations>;
147
152
 
148
153
  startCheckpoint(
149
154
  checkpointNumber: CheckpointNumber,
@@ -49,6 +49,11 @@ export interface SequencerConfig {
49
49
  txPublicSetupAllowListExtend?: AllowedElement[];
50
50
  /** Payload address to vote for */
51
51
  governanceProposerPayload?: EthAddress;
52
+ /**
53
+ * Keep signalling the configured governance payload even if a proposal referencing it was already
54
+ * executed within the lookback window. For payloads deliberately designed to be re-executed.
55
+ */
56
+ governanceProposerForcePayloadVote?: boolean;
52
57
  /**
53
58
  * Minimum block-building time (`min_block_duration`) still worth allocating if the proposer starts
54
59
  * late, in seconds.
@@ -150,6 +155,7 @@ export const SequencerConfigSchema = zodFor<SequencerConfig>()(
150
155
  acvmBinaryPath: z.string().optional(),
151
156
  txPublicSetupAllowListExtend: z.array(AllowedElementSchema).optional(),
152
157
  governanceProposerPayload: schemas.EthAddress.optional(),
158
+ governanceProposerForcePayloadVote: z.boolean().optional(),
153
159
  minBlockDuration: z.number().positive().optional(),
154
160
  checkpointProposalPrepareTime: z.number().nonnegative().optional(),
155
161
  l1PublishingTime: z.number().optional(),
@@ -9,7 +9,7 @@ import type { NullifierLeaf } from '../trees/nullifier_leaf.js';
9
9
  import type { PublicDataTreeLeaf } from '../trees/public_data_leaf.js';
10
10
  import type { BlockHeader } from '../tx/block_header.js';
11
11
  import type { StateReference } from '../tx/state_reference.js';
12
- import type { WorldStateRevision, WorldStateRevisionWithHandle } from '../world-state/world_state_revision.js';
12
+ import type { WorldStateRevision } from '../world-state/world_state_revision.js';
13
13
 
14
14
  /**
15
15
  * Type alias for the nullifier tree ID.
@@ -138,7 +138,13 @@ export interface MerkleTreeReadOperations {
138
138
  /**
139
139
  * Gets the current revision.
140
140
  */
141
- getRevision(): WorldStateRevision | WorldStateRevisionWithHandle;
141
+ getRevision(): WorldStateRevision;
142
+
143
+ /**
144
+ * Returns the IPC path of the underlying aztec-wsdb process. External AVM simulators use this to
145
+ * connect to the same world state instance that the TS layer is using.
146
+ */
147
+ getIpcPath(): string;
142
148
 
143
149
  /**
144
150
  * Gets sibling path for a leaf.
@@ -5,9 +5,13 @@ import type {
5
5
  PrivateKernelCircuitPublicInputs,
6
6
  PrivateKernelInit2CircuitPrivateInputs,
7
7
  PrivateKernelInit3CircuitPrivateInputs,
8
+ PrivateKernelInit4CircuitPrivateInputs,
9
+ PrivateKernelInit5CircuitPrivateInputs,
8
10
  PrivateKernelInitCircuitPrivateInputs,
9
11
  PrivateKernelInner2CircuitPrivateInputs,
10
12
  PrivateKernelInner3CircuitPrivateInputs,
13
+ PrivateKernelInner4CircuitPrivateInputs,
14
+ PrivateKernelInner5CircuitPrivateInputs,
11
15
  PrivateKernelInnerCircuitPrivateInputs,
12
16
  PrivateKernelResetCircuitPrivateInputs,
13
17
  PrivateKernelResetTailCircuitPrivateInputs,
@@ -83,6 +87,48 @@ export interface PrivateKernelProver {
83
87
  privateKernelInputsInit3: PrivateKernelInit3CircuitPrivateInputs,
84
88
  ): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
85
89
 
90
+ /**
91
+ * Creates a proof output for a batched first iteration that processes four app calls in a single
92
+ * private kernel circuit.
93
+ *
94
+ * @param privateKernelInputsInit4 - The batched private data structure for the initial iteration.
95
+ * @returns A Promise resolving to a ProofOutput object containing public inputs and the kernel proof.
96
+ */
97
+ generateInit4Output(
98
+ privateKernelInputsInit4: PrivateKernelInit4CircuitPrivateInputs,
99
+ ): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
100
+
101
+ /**
102
+ * Executes the batched first kernel iteration (four app calls) without generating a proof.
103
+ *
104
+ * @param privateKernelInputsInit4 - The batched private data structure for the initial iteration.
105
+ * @returns A Promise resolving to a ProofOutput object containing public inputs and an empty kernel proof.
106
+ */
107
+ simulateInit4(
108
+ privateKernelInputsInit4: PrivateKernelInit4CircuitPrivateInputs,
109
+ ): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
110
+
111
+ /**
112
+ * Creates a proof output for a batched first iteration that processes five app calls in a single
113
+ * private kernel circuit.
114
+ *
115
+ * @param privateKernelInputsInit5 - The batched private data structure for the initial iteration.
116
+ * @returns A Promise resolving to a ProofOutput object containing public inputs and the kernel proof.
117
+ */
118
+ generateInit5Output(
119
+ privateKernelInputsInit5: PrivateKernelInit5CircuitPrivateInputs,
120
+ ): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
121
+
122
+ /**
123
+ * Executes the batched first kernel iteration (five app calls) without generating a proof.
124
+ *
125
+ * @param privateKernelInputsInit5 - The batched private data structure for the initial iteration.
126
+ * @returns A Promise resolving to a ProofOutput object containing public inputs and an empty kernel proof.
127
+ */
128
+ simulateInit5(
129
+ privateKernelInputsInit5: PrivateKernelInit5CircuitPrivateInputs,
130
+ ): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
131
+
86
132
  /**
87
133
  * Creates a proof output for a given previous kernel data and private call data for an inner iteration.
88
134
  *
@@ -145,6 +191,48 @@ export interface PrivateKernelProver {
145
191
  privateKernelInputsInner3: PrivateKernelInner3CircuitPrivateInputs,
146
192
  ): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
147
193
 
194
+ /**
195
+ * Creates a proof output for a batched inner iteration that processes four app calls in a single
196
+ * private kernel circuit.
197
+ *
198
+ * @param privateKernelInputsInner4 - The batched private data structure for the inner iteration.
199
+ * @returns A Promise resolving to a ProofOutput object containing public inputs and the kernel proof.
200
+ */
201
+ generateInner4Output(
202
+ privateKernelInputsInner4: PrivateKernelInner4CircuitPrivateInputs,
203
+ ): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
204
+
205
+ /**
206
+ * Executes the batched inner kernel iteration (four app calls) without generating a proof.
207
+ *
208
+ * @param privateKernelInputsInner4 - The batched private data structure for the inner iteration.
209
+ * @returns A Promise resolving to a ProofOutput object containing public inputs and an empty kernel proof.
210
+ */
211
+ simulateInner4(
212
+ privateKernelInputsInner4: PrivateKernelInner4CircuitPrivateInputs,
213
+ ): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
214
+
215
+ /**
216
+ * Creates a proof output for a batched inner iteration that processes five app calls in a single
217
+ * private kernel circuit.
218
+ *
219
+ * @param privateKernelInputsInner5 - The batched private data structure for the inner iteration.
220
+ * @returns A Promise resolving to a ProofOutput object containing public inputs and the kernel proof.
221
+ */
222
+ generateInner5Output(
223
+ privateKernelInputsInner5: PrivateKernelInner5CircuitPrivateInputs,
224
+ ): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
225
+
226
+ /**
227
+ * Executes the batched inner kernel iteration (five app calls) without generating a proof.
228
+ *
229
+ * @param privateKernelInputsInner5 - The batched private data structure for the inner iteration.
230
+ * @returns A Promise resolving to a ProofOutput object containing public inputs and an empty kernel proof.
231
+ */
232
+ simulateInner5(
233
+ privateKernelInputsInner5: PrivateKernelInner5CircuitPrivateInputs,
234
+ ): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
235
+
148
236
  /**
149
237
  * Creates a proof output by resetting the arrays using the reset circuit.
150
238
  *
@@ -202,7 +290,12 @@ export interface PrivateKernelProver {
202
290
  * Compute the gate count for a given circuit.
203
291
  * @param bytecode - The circuit bytecode in gzipped bincode format
204
292
  * @param circuitName - The name of the circuit
293
+ * @param circuitKind - The circuit kind expected by the Chonk backend
205
294
  * @returns A Promise resolving to the gate count
206
295
  */
207
- computeGateCountForCircuit(bytecode: Buffer, circuitName: string): Promise<number>;
296
+ computeGateCountForCircuit(
297
+ bytecode: Buffer,
298
+ circuitName: string,
299
+ circuitKind: PrivateExecutionStep['kind'],
300
+ ): Promise<number>;
208
301
  }
@@ -17,7 +17,6 @@ export * from './processed-tx-handler.js';
17
17
  export * from './prover-agent.js';
18
18
  export * from './prover-broker.js';
19
19
  export * from './prover-client.js';
20
- export * from './prover-coordination.js';
21
20
  export * from './prover-node.js';
22
21
  export * from './proving-job-source.js';
23
22
  export * from './proving-job.js';
@@ -13,6 +13,10 @@ export interface ITxProvider {
13
13
  */
14
14
  hasTxs(txHashes: TxHash[]): Promise<boolean[]>;
15
15
 
16
+ /**
17
+ * Collects the txs for a block proposal from the tx pool, the proposal body, and the network.
18
+ * @throws InvalidBlockProposalTxsError - If a tx carried in the proposal fails minimum integrity validation.
19
+ */
16
20
  getTxsForBlockProposal(
17
21
  blockProposal: BlockProposal,
18
22
  blockNumber: number,
@@ -12,4 +12,3 @@ export * from './key_validation_request.js';
12
12
  export * from './scoped_key_validation_request_and_separator.js';
13
13
  export * from './transient_data_squashing_hint.js';
14
14
  export * from './private_kernel_reset_hints.js';
15
- export * from './tree_leaf_read_request.js';
@@ -9,9 +9,13 @@ export * from './private_kernel_data.js';
9
9
  export * from './private_kernel_init_circuit_private_inputs.js';
10
10
  export * from './private_kernel_init_2_circuit_private_inputs.js';
11
11
  export * from './private_kernel_init_3_circuit_private_inputs.js';
12
+ export * from './private_kernel_init_4_circuit_private_inputs.js';
13
+ export * from './private_kernel_init_5_circuit_private_inputs.js';
12
14
  export * from './private_kernel_inner_circuit_private_inputs.js';
13
15
  export * from './private_kernel_inner_2_circuit_private_inputs.js';
14
16
  export * from './private_kernel_inner_3_circuit_private_inputs.js';
17
+ export * from './private_kernel_inner_4_circuit_private_inputs.js';
18
+ export * from './private_kernel_inner_5_circuit_private_inputs.js';
15
19
  export * from './private_kernel_reset_circuit_private_inputs.js';
16
20
  export * from './private_kernel_reset_dimensions.js';
17
21
  export * from './private_kernel_reset_tail_circuit_private_inputs.js';
@@ -46,10 +46,6 @@ export class PrivateKernelCircuitPublicInputs {
46
46
  * Wether this is a private only tx or not
47
47
  */
48
48
  public isPrivateOnly: boolean,
49
- /**
50
- * The nullifier that will be used for nonce generation
51
- */
52
- public claimedFirstNullifier: Fr,
53
49
  /**
54
50
  * A claim to the final min revertible side effect counter of a tx.
55
51
  */
@@ -74,7 +70,6 @@ export class PrivateKernelCircuitPublicInputs {
74
70
  this.feePayer,
75
71
  bigintToUInt64BE(this.expirationTimestamp),
76
72
  this.isPrivateOnly,
77
- this.claimedFirstNullifier,
78
73
  this.claimedRevertibleCounter,
79
74
  );
80
75
  }
@@ -95,7 +90,6 @@ export class PrivateKernelCircuitPublicInputs {
95
90
  reader.readObject(AztecAddress),
96
91
  reader.readUInt64(),
97
92
  reader.readBoolean(),
98
- reader.readObject(Fr),
99
93
  reader.readNumber(),
100
94
  );
101
95
  }
@@ -110,7 +104,6 @@ export class PrivateKernelCircuitPublicInputs {
110
104
  AztecAddress.ZERO,
111
105
  0n,
112
106
  false,
113
- Fr.zero(),
114
107
  0,
115
108
  );
116
109
  }
@@ -0,0 +1,52 @@
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
3
+
4
+ import { ProtocolContracts } from '../tx/protocol_contracts.js';
5
+ import { TxRequest } from '../tx/tx_request.js';
6
+ import { PrivateCallData } from './private_call_data.js';
7
+
8
+ /**
9
+ * Input to the batched private kernel init circuit, which processes the first four app calls of a
10
+ * transaction in a single iteration.
11
+ */
12
+ export class PrivateKernelInit4CircuitPrivateInputs {
13
+ constructor(
14
+ public txRequest: TxRequest,
15
+ public vkTreeRoot: Fr,
16
+ public protocolContracts: ProtocolContracts,
17
+ public privateCall0: PrivateCallData,
18
+ public privateCall1: PrivateCallData,
19
+ public privateCall2: PrivateCallData,
20
+ public privateCall3: PrivateCallData,
21
+ public isPrivateOnly: boolean,
22
+ public revertibleCounterHint: number,
23
+ ) {}
24
+
25
+ toBuffer() {
26
+ return serializeToBuffer(
27
+ this.txRequest,
28
+ this.vkTreeRoot,
29
+ this.protocolContracts,
30
+ this.privateCall0,
31
+ this.privateCall1,
32
+ this.privateCall2,
33
+ this.privateCall3,
34
+ this.revertibleCounterHint,
35
+ );
36
+ }
37
+
38
+ static fromBuffer(buffer: Buffer | BufferReader): PrivateKernelInit4CircuitPrivateInputs {
39
+ const reader = BufferReader.asReader(buffer);
40
+ return new PrivateKernelInit4CircuitPrivateInputs(
41
+ reader.readObject(TxRequest),
42
+ Fr.fromBuffer(reader),
43
+ reader.readObject(ProtocolContracts),
44
+ reader.readObject(PrivateCallData),
45
+ reader.readObject(PrivateCallData),
46
+ reader.readObject(PrivateCallData),
47
+ reader.readObject(PrivateCallData),
48
+ reader.readBoolean(),
49
+ reader.readNumber(),
50
+ );
51
+ }
52
+ }
@@ -0,0 +1,55 @@
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
3
+
4
+ import { ProtocolContracts } from '../tx/protocol_contracts.js';
5
+ import { TxRequest } from '../tx/tx_request.js';
6
+ import { PrivateCallData } from './private_call_data.js';
7
+
8
+ /**
9
+ * Input to the batched private kernel init circuit, which processes the first five app calls of a
10
+ * transaction in a single iteration.
11
+ */
12
+ export class PrivateKernelInit5CircuitPrivateInputs {
13
+ constructor(
14
+ public txRequest: TxRequest,
15
+ public vkTreeRoot: Fr,
16
+ public protocolContracts: ProtocolContracts,
17
+ public privateCall0: PrivateCallData,
18
+ public privateCall1: PrivateCallData,
19
+ public privateCall2: PrivateCallData,
20
+ public privateCall3: PrivateCallData,
21
+ public privateCall4: PrivateCallData,
22
+ public isPrivateOnly: boolean,
23
+ public revertibleCounterHint: number,
24
+ ) {}
25
+
26
+ toBuffer() {
27
+ return serializeToBuffer(
28
+ this.txRequest,
29
+ this.vkTreeRoot,
30
+ this.protocolContracts,
31
+ this.privateCall0,
32
+ this.privateCall1,
33
+ this.privateCall2,
34
+ this.privateCall3,
35
+ this.privateCall4,
36
+ this.revertibleCounterHint,
37
+ );
38
+ }
39
+
40
+ static fromBuffer(buffer: Buffer | BufferReader): PrivateKernelInit5CircuitPrivateInputs {
41
+ const reader = BufferReader.asReader(buffer);
42
+ return new PrivateKernelInit5CircuitPrivateInputs(
43
+ reader.readObject(TxRequest),
44
+ Fr.fromBuffer(reader),
45
+ reader.readObject(ProtocolContracts),
46
+ reader.readObject(PrivateCallData),
47
+ reader.readObject(PrivateCallData),
48
+ reader.readObject(PrivateCallData),
49
+ reader.readObject(PrivateCallData),
50
+ reader.readObject(PrivateCallData),
51
+ reader.readBoolean(),
52
+ reader.readNumber(),
53
+ );
54
+ }
55
+ }
@@ -0,0 +1,39 @@
1
+ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
2
+
3
+ import { PrivateCallData } from './private_call_data.js';
4
+ import { PrivateKernelData } from './private_kernel_data.js';
5
+
6
+ /**
7
+ * Input to the batched private kernel inner circuit, which processes four app calls in a single
8
+ * iteration following a previous kernel.
9
+ */
10
+ export class PrivateKernelInner4CircuitPrivateInputs {
11
+ constructor(
12
+ public previousKernel: PrivateKernelData,
13
+ public privateCall0: PrivateCallData,
14
+ public privateCall1: PrivateCallData,
15
+ public privateCall2: PrivateCallData,
16
+ public privateCall3: PrivateCallData,
17
+ ) {}
18
+
19
+ toBuffer() {
20
+ return serializeToBuffer(
21
+ this.previousKernel,
22
+ this.privateCall0,
23
+ this.privateCall1,
24
+ this.privateCall2,
25
+ this.privateCall3,
26
+ );
27
+ }
28
+
29
+ static fromBuffer(buffer: Buffer | BufferReader): PrivateKernelInner4CircuitPrivateInputs {
30
+ const reader = BufferReader.asReader(buffer);
31
+ return new PrivateKernelInner4CircuitPrivateInputs(
32
+ reader.readObject(PrivateKernelData),
33
+ reader.readObject(PrivateCallData),
34
+ reader.readObject(PrivateCallData),
35
+ reader.readObject(PrivateCallData),
36
+ reader.readObject(PrivateCallData),
37
+ );
38
+ }
39
+ }
@@ -0,0 +1,42 @@
1
+ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
2
+
3
+ import { PrivateCallData } from './private_call_data.js';
4
+ import { PrivateKernelData } from './private_kernel_data.js';
5
+
6
+ /**
7
+ * Input to the batched private kernel inner circuit, which processes five app calls in a single
8
+ * iteration following a previous kernel.
9
+ */
10
+ export class PrivateKernelInner5CircuitPrivateInputs {
11
+ constructor(
12
+ public previousKernel: PrivateKernelData,
13
+ public privateCall0: PrivateCallData,
14
+ public privateCall1: PrivateCallData,
15
+ public privateCall2: PrivateCallData,
16
+ public privateCall3: PrivateCallData,
17
+ public privateCall4: PrivateCallData,
18
+ ) {}
19
+
20
+ toBuffer() {
21
+ return serializeToBuffer(
22
+ this.previousKernel,
23
+ this.privateCall0,
24
+ this.privateCall1,
25
+ this.privateCall2,
26
+ this.privateCall3,
27
+ this.privateCall4,
28
+ );
29
+ }
30
+
31
+ static fromBuffer(buffer: Buffer | BufferReader): PrivateKernelInner5CircuitPrivateInputs {
32
+ const reader = BufferReader.asReader(buffer);
33
+ return new PrivateKernelInner5CircuitPrivateInputs(
34
+ reader.readObject(PrivateKernelData),
35
+ reader.readObject(PrivateCallData),
36
+ reader.readObject(PrivateCallData),
37
+ reader.readObject(PrivateCallData),
38
+ reader.readObject(PrivateCallData),
39
+ reader.readObject(PrivateCallData),
40
+ );
41
+ }
42
+ }
@@ -1,3 +1,4 @@
1
+ import { CircuitKind } from '@aztec/bb.js';
1
2
  import { bufferSchema, mapSchema } from '@aztec/foundation/schemas';
2
3
  import type { WitnessMap } from '@aztec/noir-acvm_js';
3
4
  import { serializeWitness } from '@aztec/noir-noirc_abi';
@@ -15,6 +16,7 @@ export const PrivateExecutionStepSchema = z.object({
15
16
  bytecode: bufferSchema,
16
17
  witness: mapSchema(z.number(), z.string()),
17
18
  vk: bufferSchema,
19
+ kind: z.nativeEnum(CircuitKind),
18
20
  timings: z.object({
19
21
  witgen: z.number(),
20
22
  gateCount: z.number().optional(),
@@ -31,6 +33,7 @@ export interface PrivateExecutionStep {
31
33
  witness: WitnessMap;
32
34
  /* TODO(https://github.com/AztecProtocol/barretenberg/issues/1328) this should get its own proper class. */
33
35
  vk: Buffer;
36
+ kind: CircuitKind;
34
37
  timings: {
35
38
  witgen: number;
36
39
  gateCount?: number;
@@ -64,6 +67,7 @@ export function serializePrivateExecutionSteps(steps: PrivateExecutionStep[]) {
64
67
  witness: serializeWitness(step.witness),
65
68
  vk: step.vk,
66
69
  functionName: step.functionName,
70
+ kind: step.kind,
67
71
  };
68
72
  };
69
73
  return new Encoder({ useRecords: false }).pack(steps.map(stepToStruct));
@@ -78,7 +78,7 @@ export interface ResetCatalogEntry {
78
78
  cost: number;
79
79
  }
80
80
 
81
- // Must match the config in noir-projects/noir-protocol-circuits/private_kernel_reset_config.json
81
+ // Must match the shipped private_kernel_reset_config.json, loaded by @aztec/noir-protocol-circuits-types.
82
82
  export interface PrivateKernelResetDimensionsConfig {
83
83
  // Variants used for mid-tx resets that prevent overflow. Never the last kernel in the chain.
84
84
  inner: ResetCatalogEntry[];
@@ -17,10 +17,3 @@ export interface PrivateKernelSimulateOutput<
17
17
  verificationKey: VerificationKeyData;
18
18
  bytecode: Buffer;
19
19
  }
20
-
21
- /**
22
- * Represents the output of the circuit simulation process for init and inner private kernel circuit.
23
- */
24
- export type AppCircuitSimulateOutput = {
25
- verificationKey: VerificationKeyData;
26
- };
@@ -1,3 +1,2 @@
1
1
  export * from './interfaces.js';
2
- export * from './optional_number.js';
3
2
  export * from './order_and_comparison.js';
package/src/logs/index.ts CHANGED
@@ -5,11 +5,13 @@ export * from './tagging_index_range.js';
5
5
  export * from './contract_class_log.js';
6
6
  export * from './public_log.js';
7
7
  export * from './private_log.js';
8
+ export * from './pending_tagged_log.js';
8
9
  export * from './log_result.js';
9
10
  export * from './log_cursor.js';
10
11
  export * from './logs_query.js';
11
12
  export * from './query_all_logs_by_tags.js';
12
13
  export * from './shared_secret_derivation.js';
14
+ export * from './message_context.js';
13
15
  export * from './debug_log.js';
14
16
  export * from './debug_log_store.js';
15
17
  export * from './tag.js';
@@ -33,8 +33,8 @@ export type LogsQueryBase = {
33
33
  */
34
34
  txHash?: TxHash;
35
35
  /**
36
- * Reorg-safety anchor: the latest block hash the caller has synced to. If set and the block is no
37
- * longer present, the call throws. Distinct from `toBlock`, which is a filter, not a safety check.
36
+ * Reorg-safety anchor: the latest block hash the caller has synced to. The call throws if that block is no longer
37
+ * present. Results are capped at that block, and `toBlock` can only narrow the range further, never past it.
38
38
  */
39
39
  referenceBlock?: BlockHash;
40
40
  /** When set, each log also carries `noteHashes` and all `nullifiers` for note-nonce discovery. */
@@ -0,0 +1,18 @@
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+
3
+ import type { TxHash } from '../tx/tx_hash.js';
4
+
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
+ */
14
+ export type MessageContext = {
15
+ txHash: TxHash;
16
+ uniqueNoteHashesInTx: Fr[];
17
+ firstNullifierInTx: Fr;
18
+ };
@@ -0,0 +1,12 @@
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+
3
+ import type { MessageContext } from './message_context.js';
4
+
5
+ /**
6
+ * Represents a pending tagged log as it is stored in the pending tagged log array to which the fetchTaggedLogs oracle
7
+ * inserts found private logs. A TS version of `pending_tagged_log.nr`.
8
+ */
9
+ export type PendingTaggedLog = {
10
+ log: Fr[];
11
+ context: MessageContext;
12
+ };
@@ -2,7 +2,7 @@ import { DomainSeparator } from '@aztec/constants';
2
2
  import { Grumpkin } from '@aztec/foundation/crypto/grumpkin';
3
3
  import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
4
4
  import type { Fr } from '@aztec/foundation/curves/bn254';
5
- import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
5
+ import { GrumpkinScalar, type Point } from '@aztec/foundation/curves/grumpkin';
6
6
 
7
7
  import type { AztecAddress } from '../aztec-address/index.js';
8
8
  import type { PublicKey } from '../keys/public_key.js';
@@ -51,3 +51,20 @@ export async function appSiloEcdhSharedSecret(
51
51
  export function appSiloEcdhSharedSecretPoint(point: Point, app: AztecAddress): Promise<Fr> {
52
52
  return poseidon2HashWithSeparator([point.x, point.y, app], DomainSeparator.APP_SILOED_ECDH_SHARED_SECRET);
53
53
  }
54
+
55
+ /**
56
+ * Protects a handshake's shared secret from being forged by the recipient: `S' = hash(ephPk, recipientPoint) * S`.
57
+ *
58
+ * Mirrors aztec-nr's `protect_from_forgery` and must stay byte-compatible with it.
59
+ *
60
+ * @param secret - The raw shared secret `S` to protect.
61
+ * @param ephPk - The handshake's ephemeral public key.
62
+ * @param recipientPoint - The recipient's address point.
63
+ */
64
+ export async function protectFromForgery(secret: Point, ephPk: Point, recipientPoint: Point): Promise<Point> {
65
+ const scalar = await poseidon2HashWithSeparator(
66
+ [ephPk.x, ephPk.y, recipientPoint.x, recipientPoint.y],
67
+ DomainSeparator.HANDSHAKE_FORGERY_PROTECTION,
68
+ );
69
+ return Grumpkin.mul(secret, new GrumpkinScalar(scalar.toBigInt()));
70
+ }
package/src/noir/index.ts CHANGED
@@ -2,6 +2,7 @@ import type {
2
2
  ABIParameter,
3
3
  ABIParameterVisibility,
4
4
  AbiErrorType,
5
+ AbiNamedValue,
5
6
  AbiType,
6
7
  AbiValue,
7
8
  DebugFileMap,
@@ -73,7 +74,7 @@ export interface NoirCompiledContract {
73
74
  /** The events of the contract */
74
75
  outputs: {
75
76
  structs: Record<string, AbiType[]>;
76
- globals: Record<string, AbiValue[]>;
77
+ globals: Record<string, (AbiNamedValue | AbiValue)[]>;
77
78
  };
78
79
  /** The map of file ID to the source code and path of the file. */
79
80
  file_map: DebugFileMap;
package/src/p2p/index.ts CHANGED
@@ -4,7 +4,6 @@ export * from './checkpoint_attestation.js';
4
4
  export * from './checkpoint_proposal.js';
5
5
  export * from './consensus_payload.js';
6
6
  export * from './gossipable.js';
7
- export * from './interface.js';
8
7
  export * from './signature_utils.js';
9
8
  export * from './signed_txs.js';
10
9
  export * from './topic_type.js';
@@ -86,9 +86,13 @@ export type ClientCircuitName =
86
86
  | 'private-kernel-init'
87
87
  | 'private-kernel-init-2'
88
88
  | 'private-kernel-init-3'
89
+ | 'private-kernel-init-4'
90
+ | 'private-kernel-init-5'
89
91
  | 'private-kernel-inner'
90
92
  | 'private-kernel-inner-2'
91
93
  | 'private-kernel-inner-3'
94
+ | 'private-kernel-inner-4'
95
+ | 'private-kernel-inner-5'
92
96
  | 'private-kernel-reset'
93
97
  | 'private-kernel-reset-tail'
94
98
  | 'private-kernel-reset-tail-to-public'