@aztec/stdlib 0.0.1-commit.dbf9cec → 0.0.1-commit.df81a97b5

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 (258) hide show
  1. package/dest/abi/abi.d.ts +138 -1
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +10 -2
  4. package/dest/abi/buffer.d.ts +14 -4
  5. package/dest/abi/buffer.d.ts.map +1 -1
  6. package/dest/abi/buffer.js +25 -4
  7. package/dest/abi/decoder.d.ts +2 -2
  8. package/dest/abi/decoder.d.ts.map +1 -1
  9. package/dest/abi/decoder.js +6 -1
  10. package/dest/abi/encoder.d.ts +1 -1
  11. package/dest/abi/encoder.d.ts.map +1 -1
  12. package/dest/abi/encoder.js +28 -1
  13. package/dest/abi/event_metadata_definition.d.ts +3 -1
  14. package/dest/abi/event_metadata_definition.d.ts.map +1 -1
  15. package/dest/abi/event_metadata_definition.js +1 -1
  16. package/dest/abi/utils.d.ts +14 -1
  17. package/dest/abi/utils.d.ts.map +1 -1
  18. package/dest/abi/utils.js +15 -0
  19. package/dest/avm/avm.d.ts +300 -300
  20. package/dest/block/l2_block.d.ts +9 -1
  21. package/dest/block/l2_block.d.ts.map +1 -1
  22. package/dest/block/l2_block.js +12 -2
  23. package/dest/block/l2_block_source.d.ts +16 -8
  24. package/dest/block/l2_block_source.d.ts.map +1 -1
  25. package/dest/checkpoint/checkpoint.d.ts +2 -1
  26. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  27. package/dest/checkpoint/checkpoint.js +9 -4
  28. package/dest/checkpoint/index.d.ts +2 -1
  29. package/dest/checkpoint/index.d.ts.map +1 -1
  30. package/dest/checkpoint/index.js +1 -0
  31. package/dest/checkpoint/validate.d.ts +36 -0
  32. package/dest/checkpoint/validate.d.ts.map +1 -0
  33. package/dest/checkpoint/validate.js +120 -0
  34. package/dest/config/index.d.ts +2 -1
  35. package/dest/config/index.d.ts.map +1 -1
  36. package/dest/config/index.js +1 -0
  37. package/dest/config/pipelining-config.d.ts +19 -0
  38. package/dest/config/pipelining-config.d.ts.map +1 -0
  39. package/dest/config/pipelining-config.js +18 -0
  40. package/dest/config/sequencer-config.d.ts +4 -2
  41. package/dest/config/sequencer-config.d.ts.map +1 -1
  42. package/dest/config/sequencer-config.js +6 -0
  43. package/dest/contract/contract_address.d.ts +3 -3
  44. package/dest/contract/contract_address.js +3 -3
  45. package/dest/contract/contract_class_id.d.ts +2 -2
  46. package/dest/contract/contract_class_id.js +2 -2
  47. package/dest/contract/index.d.ts +1 -3
  48. package/dest/contract/index.d.ts.map +1 -1
  49. package/dest/contract/index.js +0 -2
  50. package/dest/contract/interfaces/contract_class.d.ts +3 -156
  51. package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
  52. package/dest/contract/interfaces/contract_class.js +1 -28
  53. package/dest/epoch-helpers/index.d.ts +7 -1
  54. package/dest/epoch-helpers/index.d.ts.map +1 -1
  55. package/dest/epoch-helpers/index.js +10 -2
  56. package/dest/gas/gas_fees.d.ts +1 -1
  57. package/dest/gas/gas_fees.d.ts.map +1 -1
  58. package/dest/gas/gas_fees.js +4 -1
  59. package/dest/ha-signing/config.d.ts +49 -14
  60. package/dest/ha-signing/config.d.ts.map +1 -1
  61. package/dest/ha-signing/config.js +20 -15
  62. package/dest/ha-signing/index.d.ts +3 -2
  63. package/dest/ha-signing/index.d.ts.map +1 -1
  64. package/dest/ha-signing/index.js +2 -1
  65. package/dest/ha-signing/local_config.d.ts +63 -0
  66. package/dest/ha-signing/local_config.d.ts.map +1 -0
  67. package/dest/ha-signing/local_config.js +24 -0
  68. package/dest/hash/hash.d.ts +16 -1
  69. package/dest/hash/hash.d.ts.map +1 -1
  70. package/dest/hash/hash.js +24 -0
  71. package/dest/interfaces/allowed_element.d.ts +26 -20
  72. package/dest/interfaces/allowed_element.d.ts.map +1 -1
  73. package/dest/interfaces/allowed_element.js +8 -8
  74. package/dest/interfaces/archiver.d.ts +1 -1
  75. package/dest/interfaces/archiver.d.ts.map +1 -1
  76. package/dest/interfaces/archiver.js +3 -2
  77. package/dest/interfaces/aztec-node-admin.d.ts +76 -30
  78. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  79. package/dest/interfaces/aztec-node.d.ts +12 -6
  80. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  81. package/dest/interfaces/aztec-node.js +5 -2
  82. package/dest/interfaces/block-builder.d.ts +38 -11
  83. package/dest/interfaces/block-builder.d.ts.map +1 -1
  84. package/dest/interfaces/block-builder.js +13 -6
  85. package/dest/interfaces/configs.d.ts +62 -32
  86. package/dest/interfaces/configs.d.ts.map +1 -1
  87. package/dest/interfaces/configs.js +6 -2
  88. package/dest/interfaces/l2_logs_source.d.ts +5 -3
  89. package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
  90. package/dest/interfaces/merkle_tree_operations.d.ts +9 -19
  91. package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
  92. package/dest/interfaces/prover-client.d.ts +6 -1
  93. package/dest/interfaces/prover-client.d.ts.map +1 -1
  94. package/dest/interfaces/prover-client.js +7 -1
  95. package/dest/interfaces/proving-job.d.ts +200 -200
  96. package/dest/interfaces/validator.d.ts +103 -41
  97. package/dest/interfaces/validator.d.ts.map +1 -1
  98. package/dest/interfaces/validator.js +8 -4
  99. package/dest/interfaces/world_state.d.ts +5 -4
  100. package/dest/interfaces/world_state.d.ts.map +1 -1
  101. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +2 -1
  102. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
  103. package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +4 -0
  104. package/dest/kv-store/config.d.ts +17 -0
  105. package/dest/kv-store/config.d.ts.map +1 -0
  106. package/dest/kv-store/config.js +26 -0
  107. package/dest/kv-store/index.d.ts +2 -0
  108. package/dest/kv-store/index.d.ts.map +1 -0
  109. package/dest/kv-store/index.js +1 -0
  110. package/dest/logs/index.d.ts +2 -1
  111. package/dest/logs/index.d.ts.map +1 -1
  112. package/dest/logs/index.js +1 -0
  113. package/dest/logs/log_filter.d.ts +4 -1
  114. package/dest/logs/log_filter.d.ts.map +1 -1
  115. package/dest/logs/log_filter.js +2 -1
  116. package/dest/logs/public_log.d.ts +4 -3
  117. package/dest/logs/public_log.d.ts.map +1 -1
  118. package/dest/logs/public_log.js +2 -1
  119. package/dest/logs/tagging_index_range.d.ts +40 -0
  120. package/dest/logs/tagging_index_range.d.ts.map +1 -0
  121. package/dest/logs/tagging_index_range.js +8 -0
  122. package/dest/logs/tx_scoped_l2_log.d.ts +3 -1
  123. package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
  124. package/dest/logs/tx_scoped_l2_log.js +7 -0
  125. package/dest/messaging/l1_to_l2_message_source.d.ts +4 -2
  126. package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
  127. package/dest/messaging/l2_to_l1_membership.d.ts +32 -6
  128. package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
  129. package/dest/messaging/l2_to_l1_membership.js +69 -26
  130. package/dest/noir/index.d.ts +3 -3
  131. package/dest/noir/index.d.ts.map +1 -1
  132. package/dest/p2p/checkpoint_proposal.d.ts +1 -6
  133. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  134. package/dest/p2p/checkpoint_proposal.js +13 -23
  135. package/dest/p2p/peer_error.d.ts +3 -1
  136. package/dest/p2p/peer_error.d.ts.map +1 -1
  137. package/dest/p2p/peer_error.js +5 -0
  138. package/dest/slashing/tally.d.ts +7 -2
  139. package/dest/slashing/tally.d.ts.map +1 -1
  140. package/dest/slashing/tally.js +30 -2
  141. package/dest/tests/factories.d.ts +2 -4
  142. package/dest/tests/factories.d.ts.map +1 -1
  143. package/dest/tests/factories.js +0 -27
  144. package/dest/tests/mocks.d.ts +4 -2
  145. package/dest/tests/mocks.d.ts.map +1 -1
  146. package/dest/tests/mocks.js +13 -8
  147. package/dest/tx/block_header.d.ts +3 -1
  148. package/dest/tx/block_header.d.ts.map +1 -1
  149. package/dest/tx/block_header.js +4 -0
  150. package/dest/tx/private_execution_result.d.ts +6 -6
  151. package/dest/tx/private_execution_result.d.ts.map +1 -1
  152. package/dest/tx/private_execution_result.js +6 -6
  153. package/dest/tx/profiling.d.ts +14 -2
  154. package/dest/tx/profiling.d.ts.map +1 -1
  155. package/dest/tx/profiling.js +13 -3
  156. package/dest/tx/simulated_tx.d.ts +113 -2
  157. package/dest/tx/simulated_tx.d.ts.map +1 -1
  158. package/dest/tx/simulated_tx.js +4 -1
  159. package/dest/tx/tx.d.ts +6 -5
  160. package/dest/tx/tx.d.ts.map +1 -1
  161. package/dest/tx/tx.js +18 -6
  162. package/dest/tx/tx_receipt.d.ts +7 -2
  163. package/dest/tx/tx_receipt.d.ts.map +1 -1
  164. package/dest/tx/tx_receipt.js +6 -3
  165. package/dest/tx/validator/error_texts.d.ts +9 -1
  166. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  167. package/dest/tx/validator/error_texts.js +10 -0
  168. package/dest/update-checker/index.d.ts +3 -2
  169. package/dest/update-checker/index.d.ts.map +1 -1
  170. package/dest/update-checker/index.js +2 -1
  171. package/dest/update-checker/package_version.d.ts +3 -0
  172. package/dest/update-checker/package_version.d.ts.map +1 -0
  173. package/dest/update-checker/package_version.js +24 -0
  174. package/dest/update-checker/version_checker.d.ts +25 -0
  175. package/dest/update-checker/version_checker.d.ts.map +1 -0
  176. package/dest/update-checker/version_checker.js +50 -0
  177. package/dest/validators/errors.d.ts +6 -1
  178. package/dest/validators/errors.d.ts.map +1 -1
  179. package/dest/validators/errors.js +7 -0
  180. package/dest/versioning/versioning.d.ts +4 -2
  181. package/dest/versioning/versioning.d.ts.map +1 -1
  182. package/dest/versioning/versioning.js +4 -1
  183. package/package.json +10 -9
  184. package/src/abi/abi.ts +25 -2
  185. package/src/abi/buffer.ts +25 -4
  186. package/src/abi/decoder.ts +14 -2
  187. package/src/abi/encoder.ts +41 -1
  188. package/src/abi/event_metadata_definition.ts +2 -0
  189. package/src/abi/utils.ts +25 -0
  190. package/src/block/l2_block.ts +13 -1
  191. package/src/block/l2_block_source.ts +16 -7
  192. package/src/checkpoint/checkpoint.ts +12 -3
  193. package/src/checkpoint/index.ts +1 -0
  194. package/src/checkpoint/validate.ts +230 -0
  195. package/src/config/index.ts +1 -0
  196. package/src/config/pipelining-config.ts +31 -0
  197. package/src/config/sequencer-config.ts +9 -1
  198. package/src/contract/contract_address.ts +3 -3
  199. package/src/contract/contract_class_id.ts +2 -2
  200. package/src/contract/index.ts +0 -2
  201. package/src/contract/interfaces/contract_class.ts +2 -82
  202. package/src/epoch-helpers/index.ts +14 -0
  203. package/src/gas/README.md +123 -0
  204. package/src/gas/gas_fees.ts +7 -1
  205. package/src/ha-signing/config.ts +45 -38
  206. package/src/ha-signing/index.ts +9 -0
  207. package/src/ha-signing/local_config.ts +46 -0
  208. package/src/hash/hash.ts +29 -0
  209. package/src/interfaces/allowed_element.ts +29 -9
  210. package/src/interfaces/archiver.ts +3 -2
  211. package/src/interfaces/aztec-node.ts +24 -5
  212. package/src/interfaces/block-builder.ts +60 -14
  213. package/src/interfaces/configs.ts +25 -8
  214. package/src/interfaces/l2_logs_source.ts +4 -1
  215. package/src/interfaces/merkle_tree_operations.ts +8 -18
  216. package/src/interfaces/prover-client.ts +8 -0
  217. package/src/interfaces/validator.ts +50 -28
  218. package/src/interfaces/world_state.ts +4 -3
  219. package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +9 -0
  220. package/src/kv-store/config.ts +36 -0
  221. package/src/kv-store/index.ts +1 -0
  222. package/src/logs/index.ts +1 -0
  223. package/src/logs/log_filter.ts +5 -0
  224. package/src/logs/public_log.ts +4 -2
  225. package/src/logs/tagging_index_range.ts +24 -0
  226. package/src/logs/tx_scoped_l2_log.ts +16 -0
  227. package/src/messaging/l1_to_l2_message_source.ts +3 -1
  228. package/src/messaging/l2_to_l1_membership.ts +98 -33
  229. package/src/noir/index.ts +2 -2
  230. package/src/p2p/checkpoint_proposal.ts +23 -37
  231. package/src/p2p/peer_error.ts +7 -0
  232. package/src/slashing/tally.ts +34 -1
  233. package/src/tests/factories.ts +0 -33
  234. package/src/tests/mocks.ts +18 -7
  235. package/src/tx/block_header.ts +6 -0
  236. package/src/tx/private_execution_result.ts +5 -5
  237. package/src/tx/profiling.ts +11 -2
  238. package/src/tx/simulated_tx.ts +8 -1
  239. package/src/tx/tx.ts +20 -11
  240. package/src/tx/tx_receipt.ts +7 -2
  241. package/src/tx/validator/error_texts.ts +12 -0
  242. package/src/update-checker/index.ts +2 -1
  243. package/src/update-checker/package_version.ts +30 -0
  244. package/src/update-checker/version_checker.ts +65 -0
  245. package/src/validators/errors.ts +9 -0
  246. package/src/versioning/versioning.ts +4 -1
  247. package/dest/contract/private_function_membership_proof.d.ts +0 -32
  248. package/dest/contract/private_function_membership_proof.d.ts.map +0 -1
  249. package/dest/contract/private_function_membership_proof.js +0 -124
  250. package/dest/contract/utility_function_membership_proof.d.ts +0 -27
  251. package/dest/contract/utility_function_membership_proof.d.ts.map +0 -1
  252. package/dest/contract/utility_function_membership_proof.js +0 -87
  253. package/dest/update-checker/update-checker.d.ts +0 -49
  254. package/dest/update-checker/update-checker.d.ts.map +0 -1
  255. package/dest/update-checker/update-checker.js +0 -130
  256. package/src/contract/private_function_membership_proof.ts +0 -167
  257. package/src/contract/utility_function_membership_proof.ts +0 -118
  258. package/src/update-checker/update-checker.ts +0 -166
@@ -13,6 +13,8 @@ export interface SequencerConfig {
13
13
  sequencerPollingIntervalMS?: number;
14
14
  /** The maximum number of txs to include in a block. */
15
15
  maxTxsPerBlock?: number;
16
+ /** The maximum number of txs across all blocks in a checkpoint. */
17
+ maxTxsPerCheckpoint?: number;
16
18
  /** The minimum number of txs to include in a block. */
17
19
  minTxsPerBlock?: number;
18
20
  /** The minimum number of valid txs (after execution) to include in a block. If not set, falls back to minTxsPerBlock. */
@@ -23,6 +25,10 @@ export interface SequencerConfig {
23
25
  maxL2BlockGas?: number;
24
26
  /** The maximum DA block gas. */
25
27
  maxDABlockGas?: number;
28
+ /** Per-block gas budget multiplier for both L2 and DA gas. Budget = (checkpointLimit / maxBlocks) * multiplier. */
29
+ perBlockAllocationMultiplier?: number;
30
+ /** Redistribute remaining checkpoint budget evenly across remaining blocks instead of allowing a single block to consume the entire remaining budget. */
31
+ redistributeCheckpointBudget?: boolean;
26
32
  /** Recipient of block reward. */
27
33
  coinbase?: EthAddress;
28
34
  /** Address to receive fees. */
@@ -31,10 +37,8 @@ export interface SequencerConfig {
31
37
  acvmWorkingDirectory?: string;
32
38
  /** The path to the ACVM binary */
33
39
  acvmBinaryPath?: string;
34
- /** The list of functions calls allowed to run in setup */
35
- txPublicSetupAllowList?: AllowedElement[];
36
- /** Max block size */
37
- maxBlockSizeInBytes?: number;
40
+ /** Additional entries to extend the default setup allow list. */
41
+ txPublicSetupAllowListExtend?: AllowedElement[];
38
42
  /** Payload address to vote for */
39
43
  governanceProposerPayload?: EthAddress;
40
44
  /** Whether to enforce the time table when building blocks */
@@ -59,6 +63,10 @@ export interface SequencerConfig {
59
63
  broadcastInvalidBlockProposal?: boolean;
60
64
  /** Inject a fake attestation (for testing only) */
61
65
  injectFakeAttestation?: boolean;
66
+ /** Inject a malleable attestation with a high-s value (for testing only) */
67
+ injectHighSValueAttestation?: boolean;
68
+ /** Inject an attestation with an unrecoverable signature (for testing only) */
69
+ injectUnrecoverableSignatureAttestation?: boolean;
62
70
  /** Whether to run in fisherman mode: builds blocks on every slot for validation without publishing */
63
71
  fishermanMode?: boolean;
64
72
  /** Shuffle attestation ordering to create invalid ordering (for testing only) */
@@ -81,17 +89,19 @@ export const SequencerConfigSchema = zodFor<SequencerConfig>()(
81
89
  z.object({
82
90
  sequencerPollingIntervalMS: z.number().optional(),
83
91
  maxTxsPerBlock: z.number().optional(),
92
+ maxTxsPerCheckpoint: z.number().optional(),
84
93
  minValidTxsPerBlock: z.number().optional(),
85
94
  minTxsPerBlock: z.number().optional(),
86
95
  maxL2BlockGas: z.number().optional(),
87
96
  publishTxsWithProposals: z.boolean().optional(),
88
97
  maxDABlockGas: z.number().optional(),
98
+ perBlockAllocationMultiplier: z.number().optional(),
99
+ redistributeCheckpointBudget: z.boolean().optional(),
89
100
  coinbase: schemas.EthAddress.optional(),
90
101
  feeRecipient: schemas.AztecAddress.optional(),
91
102
  acvmWorkingDirectory: z.string().optional(),
92
103
  acvmBinaryPath: z.string().optional(),
93
- txPublicSetupAllowList: z.array(AllowedElementSchema).optional(),
94
- maxBlockSizeInBytes: z.number().optional(),
104
+ txPublicSetupAllowListExtend: z.array(AllowedElementSchema).optional(),
95
105
  governanceProposerPayload: schemas.EthAddress.optional(),
96
106
  l1PublishingTime: z.number().optional(),
97
107
  enforceTimeTable: z.boolean().optional(),
@@ -104,6 +114,8 @@ export const SequencerConfigSchema = zodFor<SequencerConfig>()(
104
114
  secondsBeforeInvalidatingBlockAsNonCommitteeMember: z.number(),
105
115
  broadcastInvalidBlockProposal: z.boolean().optional(),
106
116
  injectFakeAttestation: z.boolean().optional(),
117
+ injectHighSValueAttestation: z.boolean().optional(),
118
+ injectUnrecoverableSignatureAttestation: z.boolean().optional(),
107
119
  fishermanMode: z.boolean().optional(),
108
120
  shuffleAttestationOrdering: z.boolean().optional(),
109
121
  blockDurationMs: z.number().positive().optional(),
@@ -126,9 +138,14 @@ type SequencerConfigOptionalKeys =
126
138
  | 'fakeProcessingDelayPerTxMs'
127
139
  | 'fakeThrowAfterProcessingTxCount'
128
140
  | 'l1PublishingTime'
129
- | 'txPublicSetupAllowList'
141
+ | 'txPublicSetupAllowListExtend'
130
142
  | 'minValidTxsPerBlock'
131
- | 'minBlocksForCheckpoint';
143
+ | 'minBlocksForCheckpoint'
144
+ | 'maxTxsPerBlock'
145
+ | 'maxTxsPerCheckpoint'
146
+ | 'maxL2BlockGas'
147
+ | 'maxDABlockGas'
148
+ | 'redistributeCheckpointBudget';
132
149
 
133
150
  export type ResolvedSequencerConfig = Prettify<
134
151
  Required<Omit<SequencerConfig, SequencerConfigOptionalKeys>> & Pick<SequencerConfig, SequencerConfigOptionalKeys>
@@ -16,10 +16,11 @@ export interface L2LogsSource {
16
16
  * array implies no logs match that tag.
17
17
  * @param tags - The tags to search for.
18
18
  * @param page - The page number (0-indexed) for pagination.
19
+ * @param upToBlockNumber - If set, only return logs from blocks up to and including this block number.
19
20
  * @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
20
21
  * for a tag, the caller should fetch the next page to check for more logs.
21
22
  */
22
- getPrivateLogsByTags(tags: SiloedTag[], page?: number): Promise<TxScopedL2Log[][]>;
23
+ getPrivateLogsByTags(tags: SiloedTag[], page?: number, upToBlockNumber?: BlockNumber): Promise<TxScopedL2Log[][]>;
23
24
 
24
25
  /**
25
26
  * Gets public logs that match any of the `tags` from the specified contract. For each tag, an array of matching
@@ -27,6 +28,7 @@ export interface L2LogsSource {
27
28
  * @param contractAddress - The contract address to search logs for.
28
29
  * @param tags - The tags to search for.
29
30
  * @param page - The page number (0-indexed) for pagination.
31
+ * @param upToBlockNumber - If set, only return logs from blocks up to and including this block number.
30
32
  * @returns An array of log arrays, one per tag. Returns at most 10 logs per tag per page. If 10 logs are returned
31
33
  * for a tag, the caller should fetch the next page to check for more logs.
32
34
  */
@@ -34,6 +36,7 @@ export interface L2LogsSource {
34
36
  contractAddress: AztecAddress,
35
37
  tags: Tag[],
36
38
  page?: number,
39
+ upToBlockNumber?: BlockNumber,
37
40
  ): Promise<TxScopedL2Log[][]>;
38
41
 
39
42
  /**
@@ -225,30 +225,20 @@ export interface MerkleTreeReadOperations {
225
225
  }
226
226
 
227
227
  export interface MerkleTreeCheckpointOperations {
228
- /**
229
- * Checkpoints the current fork state
230
- */
231
- createCheckpoint(): Promise<void>;
228
+ /** Checkpoints the current fork state. Returns the depth of the new checkpoint. */
229
+ createCheckpoint(): Promise<number>;
232
230
 
233
- /**
234
- * Commits the current checkpoint
235
- */
231
+ /** Commits the current checkpoint. */
236
232
  commitCheckpoint(): Promise<void>;
237
233
 
238
- /**
239
- * Reverts the current checkpoint
240
- */
234
+ /** Reverts the current checkpoint. */
241
235
  revertCheckpoint(): Promise<void>;
242
236
 
243
- /**
244
- * Commits all checkpoints
245
- */
246
- commitAllCheckpoints(): Promise<void>;
237
+ /** Commits all checkpoints above the given depth, leaving checkpoint depth at the given value. */
238
+ commitAllCheckpointsTo(depth: number): Promise<void>;
247
239
 
248
- /**
249
- * Reverts all checkpoints
250
- */
251
- revertAllCheckpoints(): Promise<void>;
240
+ /** Reverts all checkpoints above the given depth, leaving checkpoint depth at the given value. */
241
+ revertAllCheckpointsTo(depth: number): Promise<void>;
252
242
  }
253
243
 
254
244
  export interface MerkleTreeWriteOperations
@@ -23,6 +23,8 @@ export type ActualProverConfig = {
23
23
  * When true, jobs are explicitly cancelled with the broker, which prevents reuse.
24
24
  */
25
25
  cancelJobsOnStop: boolean;
26
+ /** Max concurrent jobs the orchestrator serializes and enqueues to the broker. */
27
+ enqueueConcurrency: number;
26
28
  };
27
29
 
28
30
  /**
@@ -53,6 +55,7 @@ export const ProverConfigSchema = zodFor<ProverConfig>()(
53
55
  proofStore: z.string().optional(),
54
56
  failedProofStore: z.string().optional(),
55
57
  cancelJobsOnStop: z.boolean(),
58
+ enqueueConcurrency: z.number(),
56
59
  }),
57
60
  );
58
61
 
@@ -107,6 +110,11 @@ export const proverConfigMappings: ConfigMappingsType<ProverConfig> = {
107
110
  'When true, jobs are explicitly cancelled with the broker, which prevents reuse.',
108
111
  ...booleanConfigHelper(false),
109
112
  },
113
+ enqueueConcurrency: {
114
+ env: 'PROVER_ENQUEUE_CONCURRENCY',
115
+ description: 'Max concurrent jobs the orchestrator serializes and enqueues to the broker.',
116
+ ...numberConfigHelper(50),
117
+ },
110
118
  };
111
119
 
112
120
  function parseProverId(str?: string) {
@@ -20,49 +20,67 @@ import type { PeerId } from '@libp2p/interface';
20
20
  import { z } from 'zod';
21
21
 
22
22
  import type { CommitteeAttestationsAndSigners } from '../block/index.js';
23
- import { type ValidatorHASignerConfig, ValidatorHASignerConfigSchema } from '../ha-signing/index.js';
23
+ import {
24
+ type LocalSignerConfig,
25
+ LocalSignerConfigSchema,
26
+ type ValidatorHASignerConfig,
27
+ ValidatorHASignerConfigSchema,
28
+ } from '../ha-signing/index.js';
24
29
  import { AllowedElementSchema } from './allowed_element.js';
25
30
 
26
31
  /**
27
32
  * Validator client configuration
28
33
  */
29
- export type ValidatorClientConfig = ValidatorHASignerConfig & {
30
- /** The private keys of the validators participating in attestation duties */
31
- validatorPrivateKeys?: SecretValue<`0x${string}`[]>;
34
+ export type ValidatorClientConfig = ValidatorHASignerConfig &
35
+ LocalSignerConfig & {
36
+ /** The private keys of the validators participating in attestation duties */
37
+ validatorPrivateKeys?: SecretValue<`0x${string}`[]>;
32
38
 
33
- /** The addresses of the validators to use with remote signers */
34
- validatorAddresses?: EthAddress[];
39
+ /** The addresses of the validators to use with remote signers */
40
+ validatorAddresses?: EthAddress[];
35
41
 
36
- /** Do not run the validator */
37
- disableValidator: boolean;
42
+ /** Do not run the validator */
43
+ disableValidator: boolean;
38
44
 
39
- /** Temporarily disable these specific validator addresses */
40
- disabledValidators: EthAddress[];
45
+ /** Temporarily disable these specific validator addresses */
46
+ disabledValidators: EthAddress[];
41
47
 
42
- /** Interval between polling for new attestations from peers */
43
- attestationPollingIntervalMs: number;
48
+ /** Interval between polling for new attestations from peers */
49
+ attestationPollingIntervalMs: number;
44
50
 
45
- /** Whether to re-execute transactions in a block proposal before attesting */
46
- validatorReexecute: boolean;
51
+ /** Whether to re-execute transactions in a block proposal before attesting */
52
+ validatorReexecute: boolean;
47
53
 
48
- /** Whether to always reexecute block proposals, even for non-validator nodes or when out of the currnet committee */
49
- alwaysReexecuteBlockProposals?: boolean;
54
+ /** Whether to always reexecute block proposals, even for non-validator nodes or when out of the currnet committee */
55
+ alwaysReexecuteBlockProposals?: boolean;
50
56
 
51
- /** Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus */
52
- fishermanMode?: boolean;
57
+ /** Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus */
58
+ fishermanMode?: boolean;
53
59
 
54
- /** Skip checkpoint proposal validation and always attest (default: false) */
55
- skipCheckpointProposalValidation?: boolean;
60
+ /** Skip checkpoint proposal validation and always attest (default: false) */
61
+ skipCheckpointProposalValidation?: boolean;
56
62
 
57
- /** Skip pushing re-executed blocks to archiver (default: false) */
58
- skipPushProposedBlocksToArchiver?: boolean;
63
+ /** Skip pushing re-executed blocks to archiver (default: false) */
64
+ skipPushProposedBlocksToArchiver?: boolean;
59
65
 
60
- /** Agree to attest to equivocated checkpoint proposals (for testing purposes only) */
61
- attestToEquivocatedProposals?: boolean;
62
- };
66
+ /** Agree to attest to equivocated checkpoint proposals (for testing purposes only) */
67
+ attestToEquivocatedProposals?: boolean;
68
+
69
+ /** Maximum L2 gas per block for validation. Proposals exceeding this limit are rejected. */
70
+ validateMaxL2BlockGas?: number;
71
+
72
+ /** Maximum DA gas per block for validation. Proposals exceeding this limit are rejected. */
73
+ validateMaxDABlockGas?: number;
74
+
75
+ /** Maximum transactions per block for validation. Proposals exceeding this limit are rejected. */
76
+ validateMaxTxsPerBlock?: number;
77
+
78
+ /** Maximum transactions per checkpoint for validation. Proposals exceeding this limit are rejected. */
79
+ validateMaxTxsPerCheckpoint?: number;
80
+ };
63
81
 
64
82
  export type ValidatorClientFullConfig = ValidatorClientConfig &
65
- Pick<SequencerConfig, 'txPublicSetupAllowList' | 'broadcastInvalidBlockProposal'> &
83
+ Pick<SequencerConfig, 'txPublicSetupAllowListExtend' | 'broadcastInvalidBlockProposal'> &
66
84
  Pick<
67
85
  SlasherConfig,
68
86
  'slashBroadcastedInvalidBlockPenalty' | 'slashDuplicateProposalPenalty' | 'slashDuplicateAttestationPenalty'
@@ -75,7 +93,7 @@ export type ValidatorClientFullConfig = ValidatorClientConfig &
75
93
  };
76
94
 
77
95
  export const ValidatorClientConfigSchema = zodFor<Omit<ValidatorClientConfig, 'validatorPrivateKeys'>>()(
78
- ValidatorHASignerConfigSchema.extend({
96
+ ValidatorHASignerConfigSchema.merge(LocalSignerConfigSchema).extend({
79
97
  validatorAddresses: z.array(schemas.EthAddress).optional(),
80
98
  disableValidator: z.boolean(),
81
99
  disabledValidators: z.array(schemas.EthAddress),
@@ -86,12 +104,16 @@ export const ValidatorClientConfigSchema = zodFor<Omit<ValidatorClientConfig, 'v
86
104
  skipCheckpointProposalValidation: z.boolean().optional(),
87
105
  skipPushProposedBlocksToArchiver: z.boolean().optional(),
88
106
  attestToEquivocatedProposals: z.boolean().optional(),
107
+ validateMaxL2BlockGas: z.number().optional(),
108
+ validateMaxDABlockGas: z.number().optional(),
109
+ validateMaxTxsPerBlock: z.number().optional(),
110
+ validateMaxTxsPerCheckpoint: z.number().optional(),
89
111
  }),
90
112
  );
91
113
 
92
114
  export const ValidatorClientFullConfigSchema = zodFor<Omit<ValidatorClientFullConfig, 'validatorPrivateKeys'>>()(
93
115
  ValidatorClientConfigSchema.extend({
94
- txPublicSetupAllowList: z.array(AllowedElementSchema).optional(),
116
+ txPublicSetupAllowListExtend: z.array(AllowedElementSchema).optional(),
95
117
  broadcastInvalidBlockProposal: z.boolean().optional(),
96
118
  slashBroadcastedInvalidBlockPenalty: schemas.BigInt,
97
119
  slashDuplicateProposalPenalty: schemas.BigInt,
@@ -3,6 +3,7 @@ import type { PromiseWithResolvers } from '@aztec/foundation/promise';
3
3
 
4
4
  import { z } from 'zod';
5
5
 
6
+ import type { BlockHash } from '../block/block_hash.js';
6
7
  import type { SnapshotDataKeys } from '../snapshots/types.js';
7
8
  import type { MerkleTreeReadOperations, MerkleTreeWriteOperations } from './merkle_tree_operations.js';
8
9
 
@@ -80,12 +81,12 @@ export interface WorldStateSynchronizer extends ReadonlyWorldStateAccess, ForkMe
80
81
  resumeSync(): void;
81
82
 
82
83
  /**
83
- * Forces an immediate sync to an optionally provided minimum block number
84
+ * Forces an immediate sync to an optionally provided minimum block number.
84
85
  * @param targetBlockNumber - The target block number that we must sync to. Will download unproven blocks if needed to reach it.
85
- * @param skipThrowIfTargetNotReached - Whether to skip throwing if the target block number is not reached.
86
+ * @param blockHash - If provided, verifies the block at targetBlockNumber matches this hash. On mismatch, triggers a resync (reorg detection).
86
87
  * @returns A promise that resolves with the block number the world state was synced to
87
88
  */
88
- syncImmediate(minBlockNumber?: BlockNumber, skipThrowIfTargetNotReached?: boolean): Promise<BlockNumber>;
89
+ syncImmediate(minBlockNumber?: BlockNumber, blockHash?: BlockHash): Promise<BlockNumber>;
89
90
 
90
91
  /** Deletes the db */
91
92
  clear(): Promise<void>;
@@ -234,6 +234,15 @@ export class PrivateKernelTailCircuitPublicInputs {
234
234
  return noteHashes.filter(n => !n.isZero());
235
235
  }
236
236
 
237
+ getNonEmptyL2ToL1Msgs() {
238
+ const l2ToL1Msgs = this.forPublic
239
+ ? this.forPublic.nonRevertibleAccumulatedData.l2ToL1Msgs.concat(
240
+ this.forPublic.revertibleAccumulatedData.l2ToL1Msgs,
241
+ )
242
+ : this.forRollup!.end.l2ToL1Msgs;
243
+ return l2ToL1Msgs.filter(m => !m.isEmpty());
244
+ }
245
+
237
246
  getNonEmptyNullifiers() {
238
247
  const nullifiers = this.forPublic
239
248
  ? this.forPublic.nonRevertibleAccumulatedData.nullifiers.concat(
@@ -0,0 +1,36 @@
1
+ import { l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresses';
2
+ import { type ConfigMappingsType, getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config';
3
+ import type { EthAddress } from '@aztec/foundation/eth-address';
4
+
5
+ export type DataStoreConfig = {
6
+ dataDirectory?: string;
7
+ dataStoreMapSizeKb: number;
8
+ l1Contracts?: { rollupAddress: EthAddress };
9
+ };
10
+
11
+ export const dataConfigMappings: ConfigMappingsType<DataStoreConfig> = {
12
+ dataDirectory: {
13
+ env: 'DATA_DIRECTORY',
14
+ description: 'Optional dir to store data. If omitted will store in memory.',
15
+ },
16
+ dataStoreMapSizeKb: {
17
+ env: 'DATA_STORE_MAP_SIZE_KB',
18
+ description: 'The maximum possible size of a data store DB in KB. Can be overridden by component-specific options.',
19
+ ...numberConfigHelper(128 * 1_024 * 1_024), // Defaulted to 128 GB
20
+ },
21
+ l1Contracts: {
22
+ description: 'The deployed L1 contract addresses',
23
+ nested: {
24
+ rollupAddress: l1ContractAddressesMapping.rollupAddress,
25
+ },
26
+ },
27
+ };
28
+
29
+ /**
30
+ * Returns the archiver configuration from the environment variables.
31
+ * Note: If an environment variable is not set, the default value is used.
32
+ * @returns The archiver configuration.
33
+ */
34
+ export function getDataConfigFromEnv(): DataStoreConfig {
35
+ return getConfigFromMappings<DataStoreConfig>(dataConfigMappings);
36
+ }
@@ -0,0 +1 @@
1
+ export * from './config.js';
package/src/logs/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './extended_directional_app_tagging_secret.js';
2
2
  export * from './pre_tag.js';
3
+ export * from './tagging_index_range.js';
3
4
  export * from './contract_class_log.js';
4
5
  export * from './public_log.js';
5
6
  export * from './private_log.js';
@@ -1,3 +1,5 @@
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+
1
3
  import { z } from 'zod';
2
4
 
3
5
  import type { AztecAddress } from '../aztec-address/index.js';
@@ -20,6 +22,8 @@ export type LogFilter = {
20
22
  afterLog?: LogId;
21
23
  /** The contract address to filter logs by. */
22
24
  contractAddress?: AztecAddress;
25
+ /** The tag (first field of the log) to filter logs by. */
26
+ tag?: Fr;
23
27
  };
24
28
 
25
29
  export const LogFilterSchema: ZodFor<LogFilter> = z.object({
@@ -28,4 +32,5 @@ export const LogFilterSchema: ZodFor<LogFilter> = z.object({
28
32
  toBlock: schemas.Integer.optional(),
29
33
  afterLog: LogId.schema.optional(),
30
34
  contractAddress: schemas.AztecAddress.optional(),
35
+ tag: schemas.Fr.optional(),
31
36
  });
@@ -120,8 +120,8 @@ export class FlatPublicLogs {
120
120
 
121
121
  export class PublicLog {
122
122
  constructor(
123
- public contractAddress: AztecAddress,
124
- public fields: Fr[],
123
+ public readonly contractAddress: AztecAddress,
124
+ public readonly fields: Fr[],
125
125
  ) {}
126
126
 
127
127
  static from(fields: FieldsOf<PublicLog>) {
@@ -146,7 +146,9 @@ export class PublicLog {
146
146
  return this.fields.length + PUBLIC_LOG_HEADER_LENGTH;
147
147
  }
148
148
 
149
+ /** Returns the serialized log (field as in noir field and not a struct field). */
149
150
  getEmittedFields() {
151
+ // We slice from 0 to return a shallow copy.
150
152
  return this.fields.slice(0);
151
153
  }
152
154
 
@@ -0,0 +1,24 @@
1
+ import { schemas } from '@aztec/foundation/schemas';
2
+
3
+ import { z } from 'zod';
4
+
5
+ import {
6
+ type ExtendedDirectionalAppTaggingSecret,
7
+ ExtendedDirectionalAppTaggingSecretSchema,
8
+ } from './extended_directional_app_tagging_secret.js';
9
+
10
+ /**
11
+ * Represents a range of tagging indexes for a given extended directional app tagging secret. Used to track the lowest
12
+ * and highest indexes used in a transaction for a given (sender, recipient, app/contract) tuple.
13
+ */
14
+ export type TaggingIndexRange = {
15
+ extendedSecret: ExtendedDirectionalAppTaggingSecret;
16
+ lowestIndex: number;
17
+ highestIndex: number;
18
+ };
19
+
20
+ export const TaggingIndexRangeSchema = z.object({
21
+ extendedSecret: ExtendedDirectionalAppTaggingSecretSchema,
22
+ lowestIndex: schemas.Integer,
23
+ highestIndex: schemas.Integer,
24
+ });
@@ -1,4 +1,5 @@
1
1
  import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types';
2
+ import { times } from '@aztec/foundation/collection';
2
3
  import { Fr } from '@aztec/foundation/curves/bn254';
3
4
  import { schemas as foundationSchemas } from '@aztec/foundation/schemas';
4
5
  import {
@@ -83,6 +84,21 @@ export class TxScopedL2Log {
83
84
  return new TxScopedL2Log(txHash, blockNumber, blockTimestamp, logData, noteHashes, firstNullifier);
84
85
  }
85
86
 
87
+ static getBlockNumberFromBuffer(buffer: Buffer) {
88
+ return BlockNumber(buffer.readUint32BE(Fr.SIZE_IN_BYTES));
89
+ }
90
+
91
+ static random() {
92
+ return new TxScopedL2Log(
93
+ TxHash.fromField(Fr.random()),
94
+ BlockNumber(Math.floor(Math.random() * 100000) + 1),
95
+ BigInt(Math.floor(Date.now() / 1000)),
96
+ times(3, Fr.random),
97
+ times(3, Fr.random),
98
+ Fr.random(),
99
+ );
100
+ }
101
+
86
102
  equals(other: TxScopedL2Log) {
87
103
  return (
88
104
  this.txHash.equals(other.txHash) &&
@@ -10,7 +10,9 @@ export interface L1ToL2MessageSource {
10
10
  /**
11
11
  * Gets new L1 to L2 message (to be) included in a given checkpoint.
12
12
  * @param checkpointNumber - Checkpoint number to get messages for.
13
- * @returns The L1 to L2 messages/leaves of the messages subtree (throws if not found).
13
+ * @returns The L1 to L2 messages/leaves of the messages subtree.
14
+ * @throws If the message tree for the given checkpoint has not yet been sealed on L1
15
+ * (i.e., checkpointNumber >= inbox treeInProgress).
14
16
  */
15
17
  getL1ToL2Messages(checkpointNumber: CheckpointNumber): Promise<Fr[]>;
16
18