@aztec/stdlib 0.0.1-commit.ff7989d6c → 0.0.1-commit.ffe5b04ea

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 (219) hide show
  1. package/dest/abi/decoder.d.ts +2 -2
  2. package/dest/abi/decoder.d.ts.map +1 -1
  3. package/dest/abi/decoder.js +7 -5
  4. package/dest/abi/encoder.d.ts +1 -1
  5. package/dest/abi/encoder.d.ts.map +1 -1
  6. package/dest/abi/encoder.js +37 -6
  7. package/dest/abi/event_metadata_definition.d.ts +3 -1
  8. package/dest/abi/event_metadata_definition.d.ts.map +1 -1
  9. package/dest/abi/event_metadata_definition.js +1 -1
  10. package/dest/abi/utils.d.ts +14 -1
  11. package/dest/abi/utils.d.ts.map +1 -1
  12. package/dest/abi/utils.js +15 -0
  13. package/dest/avm/avm.d.ts +300 -300
  14. package/dest/avm/avm_proving_request.d.ts +166 -166
  15. package/dest/avm/revert_code.d.ts +16 -1
  16. package/dest/avm/revert_code.d.ts.map +1 -1
  17. package/dest/avm/revert_code.js +15 -5
  18. package/dest/block/l2_block.d.ts +9 -1
  19. package/dest/block/l2_block.d.ts.map +1 -1
  20. package/dest/block/l2_block.js +12 -2
  21. package/dest/block/l2_block_source.d.ts +6 -1
  22. package/dest/block/l2_block_source.d.ts.map +1 -1
  23. package/dest/block/l2_block_stream/l2_block_stream.d.ts +1 -1
  24. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  25. package/dest/block/l2_block_stream/l2_block_stream.js +10 -0
  26. package/dest/checkpoint/checkpoint.d.ts +2 -1
  27. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  28. package/dest/checkpoint/checkpoint.js +9 -4
  29. package/dest/checkpoint/index.d.ts +2 -1
  30. package/dest/checkpoint/index.d.ts.map +1 -1
  31. package/dest/checkpoint/index.js +1 -0
  32. package/dest/checkpoint/validate.d.ts +36 -0
  33. package/dest/checkpoint/validate.d.ts.map +1 -0
  34. package/dest/checkpoint/validate.js +120 -0
  35. package/dest/config/sequencer-config.d.ts +4 -2
  36. package/dest/config/sequencer-config.d.ts.map +1 -1
  37. package/dest/config/sequencer-config.js +6 -0
  38. package/dest/gas/gas_fees.d.ts +1 -1
  39. package/dest/gas/gas_fees.d.ts.map +1 -1
  40. package/dest/gas/gas_fees.js +4 -1
  41. package/dest/ha-signing/config.d.ts +49 -14
  42. package/dest/ha-signing/config.d.ts.map +1 -1
  43. package/dest/ha-signing/config.js +20 -15
  44. package/dest/ha-signing/index.d.ts +3 -2
  45. package/dest/ha-signing/index.d.ts.map +1 -1
  46. package/dest/ha-signing/index.js +2 -1
  47. package/dest/ha-signing/local_config.d.ts +63 -0
  48. package/dest/ha-signing/local_config.d.ts.map +1 -0
  49. package/dest/ha-signing/local_config.js +24 -0
  50. package/dest/interfaces/allowed_element.d.ts +26 -20
  51. package/dest/interfaces/allowed_element.d.ts.map +1 -1
  52. package/dest/interfaces/allowed_element.js +8 -8
  53. package/dest/interfaces/archiver.d.ts +1 -1
  54. package/dest/interfaces/archiver.d.ts.map +1 -1
  55. package/dest/interfaces/archiver.js +1 -0
  56. package/dest/interfaces/aztec-node-admin.d.ts +70 -30
  57. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  58. package/dest/interfaces/aztec-node.d.ts +10 -5
  59. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  60. package/dest/interfaces/aztec-node.js +3 -2
  61. package/dest/interfaces/block-builder.d.ts +11 -5
  62. package/dest/interfaces/block-builder.d.ts.map +1 -1
  63. package/dest/interfaces/block-builder.js +7 -2
  64. package/dest/interfaces/configs.d.ts +57 -32
  65. package/dest/interfaces/configs.d.ts.map +1 -1
  66. package/dest/interfaces/configs.js +5 -2
  67. package/dest/interfaces/p2p.d.ts +3 -8
  68. package/dest/interfaces/p2p.d.ts.map +1 -1
  69. package/dest/interfaces/validator.d.ts +103 -41
  70. package/dest/interfaces/validator.d.ts.map +1 -1
  71. package/dest/interfaces/validator.js +8 -4
  72. package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +3 -3
  73. package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
  74. package/dest/kernel/hints/build_note_hash_read_request_hints.js +13 -10
  75. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
  76. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
  77. package/dest/kernel/hints/build_nullifier_read_request_hints.js +13 -10
  78. package/dest/kernel/hints/build_transient_data_hints.d.ts +5 -2
  79. package/dest/kernel/hints/build_transient_data_hints.d.ts.map +1 -1
  80. package/dest/kernel/hints/build_transient_data_hints.js +9 -3
  81. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +2 -1
  82. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
  83. package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +4 -0
  84. package/dest/kv-store/config.d.ts +17 -0
  85. package/dest/kv-store/config.d.ts.map +1 -0
  86. package/dest/kv-store/config.js +26 -0
  87. package/dest/kv-store/index.d.ts +2 -0
  88. package/dest/kv-store/index.d.ts.map +1 -0
  89. package/dest/kv-store/index.js +1 -0
  90. package/dest/logs/debug_log_store.d.ts +30 -0
  91. package/dest/logs/debug_log_store.d.ts.map +1 -0
  92. package/dest/logs/debug_log_store.js +30 -0
  93. package/dest/logs/extended_directional_app_tagging_secret.d.ts +47 -0
  94. package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -0
  95. package/dest/logs/{directional_app_tagging_secret.js → extended_directional_app_tagging_secret.js} +23 -15
  96. package/dest/logs/index.d.ts +3 -2
  97. package/dest/logs/index.d.ts.map +1 -1
  98. package/dest/logs/index.js +2 -1
  99. package/dest/logs/pre_tag.d.ts +16 -11
  100. package/dest/logs/pre_tag.d.ts.map +1 -1
  101. package/dest/logs/pre_tag.js +2 -2
  102. package/dest/logs/public_log.d.ts +4 -3
  103. package/dest/logs/public_log.d.ts.map +1 -1
  104. package/dest/logs/public_log.js +2 -1
  105. package/dest/logs/siloed_tag.d.ts +5 -3
  106. package/dest/logs/siloed_tag.d.ts.map +1 -1
  107. package/dest/logs/siloed_tag.js +6 -1
  108. package/dest/logs/tag.js +1 -1
  109. package/dest/p2p/attestation_utils.d.ts +11 -1
  110. package/dest/p2p/attestation_utils.d.ts.map +1 -1
  111. package/dest/p2p/attestation_utils.js +45 -0
  112. package/dest/p2p/checkpoint_proposal.d.ts +1 -6
  113. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  114. package/dest/p2p/checkpoint_proposal.js +0 -12
  115. package/dest/p2p/client_type.d.ts +2 -5
  116. package/dest/p2p/client_type.d.ts.map +1 -1
  117. package/dest/p2p/client_type.js +0 -7
  118. package/dest/p2p/index.d.ts +1 -2
  119. package/dest/p2p/index.d.ts.map +1 -1
  120. package/dest/p2p/index.js +0 -1
  121. package/dest/p2p/peer_error.d.ts +3 -1
  122. package/dest/p2p/peer_error.d.ts.map +1 -1
  123. package/dest/p2p/peer_error.js +5 -0
  124. package/dest/p2p/topic_type.d.ts +3 -4
  125. package/dest/p2p/topic_type.d.ts.map +1 -1
  126. package/dest/p2p/topic_type.js +7 -24
  127. package/dest/slashing/tally.d.ts +7 -2
  128. package/dest/slashing/tally.d.ts.map +1 -1
  129. package/dest/slashing/tally.js +30 -2
  130. package/dest/tests/factories.d.ts +3 -1
  131. package/dest/tests/factories.d.ts.map +1 -1
  132. package/dest/tests/factories.js +8 -0
  133. package/dest/tests/mocks.d.ts +5 -3
  134. package/dest/tests/mocks.d.ts.map +1 -1
  135. package/dest/tests/mocks.js +18 -13
  136. package/dest/tx/block_header.d.ts +3 -1
  137. package/dest/tx/block_header.d.ts.map +1 -1
  138. package/dest/tx/block_header.js +4 -0
  139. package/dest/tx/simulated_tx.d.ts +5 -2
  140. package/dest/tx/simulated_tx.d.ts.map +1 -1
  141. package/dest/tx/simulated_tx.js +4 -1
  142. package/dest/tx/tx.d.ts +6 -5
  143. package/dest/tx/tx.d.ts.map +1 -1
  144. package/dest/tx/tx.js +18 -6
  145. package/dest/tx/tx_receipt.d.ts +16 -2
  146. package/dest/tx/tx_receipt.d.ts.map +1 -1
  147. package/dest/tx/tx_receipt.js +11 -3
  148. package/dest/tx/validator/error_texts.d.ts +5 -1
  149. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  150. package/dest/tx/validator/error_texts.js +4 -0
  151. package/dest/update-checker/index.d.ts +3 -2
  152. package/dest/update-checker/index.d.ts.map +1 -1
  153. package/dest/update-checker/index.js +2 -1
  154. package/dest/update-checker/package_version.d.ts +3 -0
  155. package/dest/update-checker/package_version.d.ts.map +1 -0
  156. package/dest/update-checker/package_version.js +11 -0
  157. package/dest/update-checker/version_checker.d.ts +25 -0
  158. package/dest/update-checker/version_checker.d.ts.map +1 -0
  159. package/dest/update-checker/version_checker.js +50 -0
  160. package/package.json +11 -10
  161. package/src/abi/decoder.ts +15 -6
  162. package/src/abi/encoder.ts +49 -6
  163. package/src/abi/event_metadata_definition.ts +2 -0
  164. package/src/abi/utils.ts +25 -0
  165. package/src/avm/revert_code.ts +15 -0
  166. package/src/block/l2_block.ts +13 -1
  167. package/src/block/l2_block_source.ts +6 -0
  168. package/src/block/l2_block_stream/l2_block_stream.ts +21 -0
  169. package/src/checkpoint/checkpoint.ts +12 -3
  170. package/src/checkpoint/index.ts +1 -0
  171. package/src/checkpoint/validate.ts +230 -0
  172. package/src/config/sequencer-config.ts +9 -1
  173. package/src/gas/gas_fees.ts +7 -1
  174. package/src/ha-signing/config.ts +45 -38
  175. package/src/ha-signing/index.ts +9 -0
  176. package/src/ha-signing/local_config.ts +46 -0
  177. package/src/interfaces/allowed_element.ts +29 -9
  178. package/src/interfaces/archiver.ts +1 -0
  179. package/src/interfaces/aztec-node.ts +14 -4
  180. package/src/interfaces/block-builder.ts +25 -5
  181. package/src/interfaces/configs.ts +22 -8
  182. package/src/interfaces/p2p.ts +2 -13
  183. package/src/interfaces/validator.ts +50 -28
  184. package/src/kernel/hints/build_note_hash_read_request_hints.ts +14 -18
  185. package/src/kernel/hints/build_nullifier_read_request_hints.ts +15 -18
  186. package/src/kernel/hints/build_transient_data_hints.ts +17 -2
  187. package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +9 -0
  188. package/src/kv-store/config.ts +36 -0
  189. package/src/kv-store/index.ts +1 -0
  190. package/src/logs/debug_log_store.ts +54 -0
  191. package/src/logs/{directional_app_tagging_secret.ts → extended_directional_app_tagging_secret.ts} +24 -16
  192. package/src/logs/index.ts +2 -1
  193. package/src/logs/pre_tag.ts +5 -5
  194. package/src/logs/public_log.ts +4 -2
  195. package/src/logs/siloed_tag.ts +8 -2
  196. package/src/logs/tag.ts +1 -1
  197. package/src/p2p/attestation_utils.ts +56 -0
  198. package/src/p2p/checkpoint_proposal.ts +0 -17
  199. package/src/p2p/client_type.ts +0 -6
  200. package/src/p2p/index.ts +0 -1
  201. package/src/p2p/peer_error.ts +7 -0
  202. package/src/p2p/topic_type.ts +8 -15
  203. package/src/slashing/tally.ts +34 -1
  204. package/src/tests/factories.ts +9 -0
  205. package/src/tests/mocks.ts +25 -10
  206. package/src/tx/block_header.ts +6 -0
  207. package/src/tx/simulated_tx.ts +8 -1
  208. package/src/tx/tx.ts +20 -11
  209. package/src/tx/tx_receipt.ts +10 -0
  210. package/src/tx/validator/error_texts.ts +4 -0
  211. package/src/update-checker/index.ts +2 -1
  212. package/src/update-checker/package_version.ts +17 -0
  213. package/src/update-checker/version_checker.ts +65 -0
  214. package/dest/logs/directional_app_tagging_secret.d.ts +0 -40
  215. package/dest/logs/directional_app_tagging_secret.d.ts.map +0 -1
  216. package/dest/update-checker/update-checker.d.ts +0 -49
  217. package/dest/update-checker/update-checker.d.ts.map +0 -1
  218. package/dest/update-checker/update-checker.js +0 -130
  219. package/src/update-checker/update-checker.ts +0 -166
@@ -56,8 +56,14 @@ export class GasFees {
56
56
  return this.clone();
57
57
  } else if (typeof scalar === 'bigint') {
58
58
  return new GasFees(this.feePerDaGas * scalar, this.feePerL2Gas * scalar);
59
+ } else if (Number.isInteger(scalar)) {
60
+ const s = BigInt(scalar);
61
+ return new GasFees(this.feePerDaGas * s, this.feePerL2Gas * s);
59
62
  } else {
60
- return new GasFees(Number(this.feePerDaGas) * scalar, Number(this.feePerL2Gas) * scalar);
63
+ return new GasFees(
64
+ BigInt(Math.ceil(Number(this.feePerDaGas) * scalar)),
65
+ BigInt(Math.ceil(Number(this.feePerL2Gas) * scalar)),
66
+ );
61
67
  }
62
68
  }
63
69
 
@@ -13,14 +13,9 @@ import type { ZodFor } from '@aztec/foundation/schemas';
13
13
  import { z } from 'zod';
14
14
 
15
15
  /**
16
- * Configuration for the Validator HA Signer
17
- *
18
- * This config is used for distributed locking and slashing protection
19
- * when running multiple validator nodes in a high-availability setup.
16
+ * Base signing protection configuration shared by both HA (Postgres) and local (LMDB) signers.
20
17
  */
21
- export interface ValidatorHASignerConfig {
22
- /** Whether HA signing / slashing protection is enabled */
23
- haSigningEnabled: boolean;
18
+ export interface BaseSignerConfig {
24
19
  /** L1 contract addresses (rollup address required) */
25
20
  l1Contracts: Pick<L1ContractAddresses, 'rollupAddress'>;
26
21
  /** Unique identifier for this node */
@@ -33,30 +28,9 @@ export interface ValidatorHASignerConfig {
33
28
  maxStuckDutiesAgeMs?: number;
34
29
  /** Optional: clean up old duties after this many hours (disabled if not set) */
35
30
  cleanupOldDutiesAfterHours?: number;
36
- /**
37
- * PostgreSQL connection string
38
- * Format: postgresql://user:password@host:port/database
39
- */
40
- databaseUrl?: string;
41
- /**
42
- * PostgreSQL connection pool configuration
43
- */
44
- /** Maximum number of clients in the pool (default: 10) */
45
- poolMaxCount?: number;
46
- /** Minimum number of clients in the pool (default: 0) */
47
- poolMinCount?: number;
48
- /** Idle timeout in milliseconds (default: 10000) */
49
- poolIdleTimeoutMs?: number;
50
- /** Connection timeout in milliseconds (default: 0, no timeout) */
51
- poolConnectionTimeoutMs?: number;
52
31
  }
53
32
 
54
- export const validatorHASignerConfigMappings: ConfigMappingsType<ValidatorHASignerConfig> = {
55
- haSigningEnabled: {
56
- env: 'VALIDATOR_HA_SIGNING_ENABLED',
57
- description: 'Whether HA signing / slashing protection is enabled',
58
- ...booleanConfigHelper(false),
59
- },
33
+ export const baseSignerConfigMappings: ConfigMappingsType<BaseSignerConfig> = {
60
34
  l1Contracts: {
61
35
  description: 'L1 contract addresses (rollup address required)',
62
36
  nested: {
@@ -91,6 +65,47 @@ export const validatorHASignerConfigMappings: ConfigMappingsType<ValidatorHASign
91
65
  description: 'Optional: clean up old duties after this many hours (disabled if not set)',
92
66
  ...optionalNumberConfigHelper(),
93
67
  },
68
+ };
69
+
70
+ export const BaseSignerConfigSchema = z.object({
71
+ l1Contracts: z.object({ rollupAddress: z.instanceof(EthAddress) }),
72
+ nodeId: z.string(),
73
+ pollingIntervalMs: z.number().min(0),
74
+ signingTimeoutMs: z.number().min(0),
75
+ maxStuckDutiesAgeMs: z.number().min(0).optional(),
76
+ cleanupOldDutiesAfterHours: z.number().min(0).optional(),
77
+ }) satisfies ZodFor<BaseSignerConfig>;
78
+
79
+ /**
80
+ * Configuration for the Validator HA Signer.
81
+ *
82
+ * Extends BaseSignerConfig with a flag to enable HA mode and Postgres connection settings.
83
+ */
84
+ export interface ValidatorHASignerConfig extends BaseSignerConfig {
85
+ /** Whether HA signing / slashing protection is enabled */
86
+ haSigningEnabled: boolean;
87
+ /**
88
+ * PostgreSQL connection string
89
+ * Format: postgresql://user:password@host:port/database
90
+ */
91
+ databaseUrl?: string;
92
+ /** Maximum number of clients in the pool (default: 10) */
93
+ poolMaxCount?: number;
94
+ /** Minimum number of clients in the pool (default: 0) */
95
+ poolMinCount?: number;
96
+ /** Idle timeout in milliseconds (default: 10000) */
97
+ poolIdleTimeoutMs?: number;
98
+ /** Connection timeout in milliseconds (default: 0, no timeout) */
99
+ poolConnectionTimeoutMs?: number;
100
+ }
101
+
102
+ export const validatorHASignerConfigMappings: ConfigMappingsType<ValidatorHASignerConfig> = {
103
+ ...baseSignerConfigMappings,
104
+ haSigningEnabled: {
105
+ env: 'VALIDATOR_HA_SIGNING_ENABLED',
106
+ description: 'Whether HA signing / slashing protection is enabled',
107
+ ...booleanConfigHelper(false),
108
+ },
94
109
  databaseUrl: {
95
110
  env: 'VALIDATOR_HA_DATABASE_URL',
96
111
  description:
@@ -131,16 +146,8 @@ export function getConfigEnvVars(): ValidatorHASignerConfig {
131
146
  return getConfigFromMappings<ValidatorHASignerConfig>(validatorHASignerConfigMappings);
132
147
  }
133
148
 
134
- export const ValidatorHASignerConfigSchema = z.object({
149
+ export const ValidatorHASignerConfigSchema = BaseSignerConfigSchema.extend({
135
150
  haSigningEnabled: z.boolean(),
136
- l1Contracts: z.object({
137
- rollupAddress: z.instanceof(EthAddress),
138
- }),
139
- nodeId: z.string(),
140
- pollingIntervalMs: z.number().min(0),
141
- signingTimeoutMs: z.number().min(0),
142
- maxStuckDutiesAgeMs: z.number().min(0).optional(),
143
- cleanupOldDutiesAfterHours: z.number().min(0).optional(),
144
151
  databaseUrl: z.string().optional(),
145
152
  poolMaxCount: z.number().min(0).optional(),
146
153
  poolMinCount: z.number().min(0).optional(),
@@ -1,10 +1,19 @@
1
1
  export {
2
+ type BaseSignerConfig,
3
+ BaseSignerConfigSchema,
4
+ baseSignerConfigMappings,
2
5
  type ValidatorHASignerConfig,
3
6
  ValidatorHASignerConfigSchema,
4
7
  defaultValidatorHASignerConfig,
5
8
  getConfigEnvVars,
6
9
  validatorHASignerConfigMappings,
7
10
  } from './config.js';
11
+ export {
12
+ type LocalSignerConfig,
13
+ LocalSignerConfigSchema,
14
+ getLocalSignerConfigEnvVars,
15
+ localSignerConfigMappings,
16
+ } from './local_config.js';
8
17
  export {
9
18
  DutyType,
10
19
  type BlockProposalSigningContext,
@@ -0,0 +1,46 @@
1
+ import { type ConfigMappingsType, getConfigFromMappings } from '@aztec/foundation/config';
2
+ import { zodFor } from '@aztec/foundation/schemas';
3
+ import { type DataStoreConfig, dataConfigMappings } from '@aztec/stdlib/kv-store';
4
+
5
+ import { z } from 'zod';
6
+
7
+ import { type BaseSignerConfig, BaseSignerConfigSchema, baseSignerConfigMappings } from './config.js';
8
+
9
+ /**
10
+ * Configuration for local (single-node) slashing protection.
11
+ *
12
+ * Combines the base signing protection fields (shared with HA mode) with
13
+ * DataStoreConfig for the local LMDB backing store, plus a per-store map-size
14
+ * override. Used when HA signing is disabled.
15
+ */
16
+ export type LocalSignerConfig = BaseSignerConfig &
17
+ DataStoreConfig & {
18
+ /** Maximum size of the local signing-protection LMDB store in KB. Overwrites the general dataStoreMapSizeKb. */
19
+ signingProtectionMapSizeKb?: number;
20
+ };
21
+
22
+ export const localSignerConfigMappings: ConfigMappingsType<LocalSignerConfig> = {
23
+ ...baseSignerConfigMappings,
24
+ ...dataConfigMappings,
25
+ signingProtectionMapSizeKb: {
26
+ env: 'SIGNING_PROTECTION_MAP_SIZE_KB',
27
+ description:
28
+ 'Maximum size of the local signing-protection LMDB store in KB. Overwrites the general dataStoreMapSizeKb.',
29
+ parseEnv: (val: string | undefined) => (val ? +val : undefined),
30
+ },
31
+ };
32
+
33
+ export const LocalSignerConfigSchema = zodFor<LocalSignerConfig>()(
34
+ BaseSignerConfigSchema.extend({
35
+ dataDirectory: z.string().optional(),
36
+ dataStoreMapSizeKb: z.number(),
37
+ signingProtectionMapSizeKb: z.number().optional(),
38
+ }),
39
+ );
40
+
41
+ /**
42
+ * Returns the local signer configuration from environment variables.
43
+ */
44
+ export function getLocalSignerConfigEnvVars(): LocalSignerConfig {
45
+ return getConfigFromMappings<LocalSignerConfig>(localSignerConfigMappings);
46
+ }
@@ -6,18 +6,38 @@ import type { FunctionSelector } from '../abi/function_selector.js';
6
6
  import type { AztecAddress } from '../aztec-address/index.js';
7
7
  import { schemas, zodFor } from '../schemas/index.js';
8
8
 
9
- type AllowedInstance = { address: AztecAddress };
10
- type AllowedInstanceFunction = { address: AztecAddress; selector: FunctionSelector };
11
- type AllowedClass = { classId: Fr };
12
- type AllowedClassFunction = { classId: Fr; selector: FunctionSelector };
9
+ type AllowedInstanceFunction = {
10
+ address: AztecAddress;
11
+ selector: FunctionSelector;
12
+ onlySelf?: boolean;
13
+ rejectNullMsgSender?: boolean;
14
+ calldataLength?: number;
15
+ };
16
+ type AllowedClassFunction = {
17
+ classId: Fr;
18
+ selector: FunctionSelector;
19
+ onlySelf?: boolean;
20
+ rejectNullMsgSender?: boolean;
21
+ calldataLength?: number;
22
+ };
13
23
 
14
- export type AllowedElement = AllowedInstance | AllowedInstanceFunction | AllowedClass | AllowedClassFunction;
24
+ export type AllowedElement = AllowedInstanceFunction | AllowedClassFunction;
15
25
 
16
26
  export const AllowedElementSchema = zodFor<AllowedElement>()(
17
27
  z.union([
18
- z.object({ address: schemas.AztecAddress, selector: schemas.FunctionSelector }),
19
- z.object({ address: schemas.AztecAddress }),
20
- z.object({ classId: schemas.Fr, selector: schemas.FunctionSelector }),
21
- z.object({ classId: schemas.Fr }),
28
+ z.object({
29
+ address: schemas.AztecAddress,
30
+ selector: schemas.FunctionSelector,
31
+ onlySelf: z.boolean().optional(),
32
+ rejectNullMsgSender: z.boolean().optional(),
33
+ calldataLength: z.number().optional(),
34
+ }),
35
+ z.object({
36
+ classId: schemas.Fr,
37
+ selector: schemas.FunctionSelector,
38
+ onlySelf: z.boolean().optional(),
39
+ rejectNullMsgSender: z.boolean().optional(),
40
+ calldataLength: z.number().optional(),
41
+ }),
22
42
  ]),
23
43
  );
@@ -86,6 +86,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
86
86
  getBlockNumber: z.function().args().returns(BlockNumberSchema),
87
87
  getProvenBlockNumber: z.function().args().returns(BlockNumberSchema),
88
88
  getCheckpointedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
89
+ getCheckpointNumber: z.function().args().returns(CheckpointNumberSchema),
89
90
  getFinalizedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
90
91
  getBlock: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
91
92
  getBlockHeader: z
@@ -4,7 +4,9 @@ import {
4
4
  BlockNumber,
5
5
  BlockNumberPositiveSchema,
6
6
  BlockNumberSchema,
7
+ CheckpointNumber,
7
8
  CheckpointNumberPositiveSchema,
9
+ CheckpointNumberSchema,
8
10
  EpochNumber,
9
11
  EpochNumberSchema,
10
12
  type SlotNumber,
@@ -172,14 +174,14 @@ export interface AztecNode
172
174
  l1ToL2Message: Fr,
173
175
  ): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>] | undefined>;
174
176
 
175
- /** Returns the L2 block number in which this L1 to L2 message becomes available, or undefined if not found. */
176
- getL1ToL2MessageBlock(l1ToL2Message: Fr): Promise<BlockNumber | undefined>;
177
+ /** Returns the L2 checkpoint number in which this L1 to L2 message becomes available, or undefined if not found. */
178
+ getL1ToL2MessageCheckpoint(l1ToL2Message: Fr): Promise<CheckpointNumber | undefined>;
177
179
 
178
180
  /**
179
181
  * Returns whether an L1 to L2 message is synced by archiver.
180
182
  * @param l1ToL2Message - The L1 to L2 message to check.
181
183
  * @returns Whether the message is synced.
182
- * @deprecated Use `getL1ToL2MessageBlock` instead. This method may return true even if the message is not ready to use.
184
+ * @deprecated Use `getL1ToL2MessageCheckpoint` instead. This method may return true even if the message is not ready to use.
183
185
  */
184
186
  isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean>;
185
187
 
@@ -230,6 +232,12 @@ export interface AztecNode
230
232
  */
231
233
  getCheckpointedBlockNumber(): Promise<BlockNumber>;
232
234
 
235
+ /**
236
+ * Method to fetch the latest checkpoint number synchronized by the node.
237
+ * @returns The checkpoint number.
238
+ */
239
+ getCheckpointNumber(): Promise<CheckpointNumber>;
240
+
233
241
  /**
234
242
  * Method to determine if the node is ready to accept transactions.
235
243
  * @returns - Flag indicating the readiness for tx submission.
@@ -517,7 +525,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
517
525
  .args(BlockParameterSchema, schemas.Fr)
518
526
  .returns(z.tuple([schemas.BigInt, SiblingPath.schemaFor(L1_TO_L2_MSG_TREE_HEIGHT)]).optional()),
519
527
 
520
- getL1ToL2MessageBlock: z.function().args(schemas.Fr).returns(BlockNumberSchema.optional()),
528
+ getL1ToL2MessageCheckpoint: z.function().args(schemas.Fr).returns(CheckpointNumberSchema.optional()),
521
529
 
522
530
  isL1ToL2MessageSynced: z.function().args(schemas.Fr).returns(z.boolean()),
523
531
 
@@ -534,6 +542,8 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
534
542
 
535
543
  getBlockNumber: z.function().returns(BlockNumberSchema),
536
544
 
545
+ getCheckpointNumber: z.function().returns(CheckpointNumberSchema),
546
+
537
547
  getProvenBlockNumber: z.function().returns(BlockNumberSchema),
538
548
 
539
549
  getCheckpointedBlockNumber: z.function().returns(BlockNumberSchema),
@@ -36,11 +36,16 @@ export interface IBlockFactory extends ProcessedTxHandler {
36
36
  }
37
37
 
38
38
  export interface PublicProcessorLimits {
39
+ /** Maximum number of txs to process. */
39
40
  maxTransactions?: number;
40
- maxBlockSize?: number;
41
+ /** L2 and DA gas limits. */
41
42
  maxBlockGas?: Gas;
43
+ /** Maximum number of blob fields allowed. */
42
44
  maxBlobFields?: number;
45
+ /** Deadline for processing the txs. Processor will stop as soon as it hits this time. */
43
46
  deadline?: Date;
47
+ /** Whether this processor is building a proposal (as opposed to re-executing one). Skipping txs due to gas or blob limits is only done during proposal building. */
48
+ isBuildingProposal?: boolean;
44
49
  }
45
50
 
46
51
  export interface PublicProcessorValidator {
@@ -50,16 +55,33 @@ export interface PublicProcessorValidator {
50
55
 
51
56
  export type FullNodeBlockBuilderConfig = Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration'> &
52
57
  Pick<ChainConfig, 'l1ChainId' | 'rollupVersion'> &
53
- Pick<SequencerConfig, 'txPublicSetupAllowList' | 'fakeProcessingDelayPerTxMs' | 'fakeThrowAfterProcessingTxCount'>;
58
+ Pick<
59
+ SequencerConfig,
60
+ | 'txPublicSetupAllowListExtend'
61
+ | 'fakeProcessingDelayPerTxMs'
62
+ | 'fakeThrowAfterProcessingTxCount'
63
+ | 'maxTxsPerBlock'
64
+ | 'maxTxsPerCheckpoint'
65
+ | 'maxL2BlockGas'
66
+ | 'maxDABlockGas'
67
+ > & {
68
+ /** Total L2 gas (mana) allowed per checkpoint. Fetched from L1 getManaLimit(). */
69
+ rollupManaLimit: number;
70
+ };
54
71
 
55
72
  export const FullNodeBlockBuilderConfigKeys: (keyof FullNodeBlockBuilderConfig)[] = [
56
73
  'l1GenesisTime',
57
74
  'slotDuration',
58
75
  'l1ChainId',
59
76
  'rollupVersion',
60
- 'txPublicSetupAllowList',
77
+ 'txPublicSetupAllowListExtend',
61
78
  'fakeProcessingDelayPerTxMs',
62
79
  'fakeThrowAfterProcessingTxCount',
80
+ 'maxTxsPerBlock',
81
+ 'maxTxsPerCheckpoint',
82
+ 'maxL2BlockGas',
83
+ 'maxDABlockGas',
84
+ 'rollupManaLimit',
63
85
  ] as const;
64
86
 
65
87
  /** Thrown when no valid transactions are available to include in a block after processing, and this is not the first block in a checkpoint. */
@@ -73,12 +95,10 @@ export class NoValidTxsError extends Error {
73
95
  /** Result of building a block within a checkpoint. */
74
96
  export type BuildBlockInCheckpointResult = {
75
97
  block: L2Block;
76
- publicGas: Gas;
77
98
  publicProcessorDuration: number;
78
99
  numTxs: number;
79
100
  failedTxs: FailedTx[];
80
101
  usedTxs: Tx[];
81
- usedTxBlobFields: number;
82
102
  };
83
103
 
84
104
  /** Interface for building blocks within a checkpoint context. */
@@ -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,8 @@ 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;
26
30
  /** Recipient of block reward. */
27
31
  coinbase?: EthAddress;
28
32
  /** Address to receive fees. */
@@ -31,10 +35,8 @@ export interface SequencerConfig {
31
35
  acvmWorkingDirectory?: string;
32
36
  /** The path to the ACVM binary */
33
37
  acvmBinaryPath?: string;
34
- /** The list of functions calls allowed to run in setup */
35
- txPublicSetupAllowList?: AllowedElement[];
36
- /** Max block size */
37
- maxBlockSizeInBytes?: number;
38
+ /** Additional entries to extend the default setup allow list. */
39
+ txPublicSetupAllowListExtend?: AllowedElement[];
38
40
  /** Payload address to vote for */
39
41
  governanceProposerPayload?: EthAddress;
40
42
  /** Whether to enforce the time table when building blocks */
@@ -59,6 +61,10 @@ export interface SequencerConfig {
59
61
  broadcastInvalidBlockProposal?: boolean;
60
62
  /** Inject a fake attestation (for testing only) */
61
63
  injectFakeAttestation?: boolean;
64
+ /** Inject a malleable attestation with a high-s value (for testing only) */
65
+ injectHighSValueAttestation?: boolean;
66
+ /** Inject an attestation with an unrecoverable signature (for testing only) */
67
+ injectUnrecoverableSignatureAttestation?: boolean;
62
68
  /** Whether to run in fisherman mode: builds blocks on every slot for validation without publishing */
63
69
  fishermanMode?: boolean;
64
70
  /** Shuffle attestation ordering to create invalid ordering (for testing only) */
@@ -81,17 +87,18 @@ export const SequencerConfigSchema = zodFor<SequencerConfig>()(
81
87
  z.object({
82
88
  sequencerPollingIntervalMS: z.number().optional(),
83
89
  maxTxsPerBlock: z.number().optional(),
90
+ maxTxsPerCheckpoint: z.number().optional(),
84
91
  minValidTxsPerBlock: z.number().optional(),
85
92
  minTxsPerBlock: z.number().optional(),
86
93
  maxL2BlockGas: z.number().optional(),
87
94
  publishTxsWithProposals: z.boolean().optional(),
88
95
  maxDABlockGas: z.number().optional(),
96
+ perBlockAllocationMultiplier: z.number().optional(),
89
97
  coinbase: schemas.EthAddress.optional(),
90
98
  feeRecipient: schemas.AztecAddress.optional(),
91
99
  acvmWorkingDirectory: z.string().optional(),
92
100
  acvmBinaryPath: z.string().optional(),
93
- txPublicSetupAllowList: z.array(AllowedElementSchema).optional(),
94
- maxBlockSizeInBytes: z.number().optional(),
101
+ txPublicSetupAllowListExtend: z.array(AllowedElementSchema).optional(),
95
102
  governanceProposerPayload: schemas.EthAddress.optional(),
96
103
  l1PublishingTime: z.number().optional(),
97
104
  enforceTimeTable: z.boolean().optional(),
@@ -104,6 +111,8 @@ export const SequencerConfigSchema = zodFor<SequencerConfig>()(
104
111
  secondsBeforeInvalidatingBlockAsNonCommitteeMember: z.number(),
105
112
  broadcastInvalidBlockProposal: z.boolean().optional(),
106
113
  injectFakeAttestation: z.boolean().optional(),
114
+ injectHighSValueAttestation: z.boolean().optional(),
115
+ injectUnrecoverableSignatureAttestation: z.boolean().optional(),
107
116
  fishermanMode: z.boolean().optional(),
108
117
  shuffleAttestationOrdering: z.boolean().optional(),
109
118
  blockDurationMs: z.number().positive().optional(),
@@ -126,9 +135,14 @@ type SequencerConfigOptionalKeys =
126
135
  | 'fakeProcessingDelayPerTxMs'
127
136
  | 'fakeThrowAfterProcessingTxCount'
128
137
  | 'l1PublishingTime'
129
- | 'txPublicSetupAllowList'
138
+ | 'txPublicSetupAllowListExtend'
130
139
  | 'minValidTxsPerBlock'
131
- | 'minBlocksForCheckpoint';
140
+ | 'minBlocksForCheckpoint'
141
+ | 'maxTxsPerBlock'
142
+ | 'maxTxsPerCheckpoint'
143
+ | 'maxL2BlockGas'
144
+ | 'maxDABlockGas'
145
+ | 'perBlockAllocationMultiplier';
132
146
 
133
147
  export type ResolvedSequencerConfig = Prettify<
134
148
  Required<Omit<SequencerConfig, SequencerConfigOptionalKeys>> & Pick<SequencerConfig, SequencerConfigOptionalKeys>
@@ -3,7 +3,6 @@ import type { SlotNumber } from '@aztec/foundation/branded-types';
3
3
  import { z } from 'zod';
4
4
 
5
5
  import { CheckpointAttestation } from '../p2p/checkpoint_attestation.js';
6
- import type { P2PClientType } from '../p2p/client_type.js';
7
6
  import { type ApiSchemaFor, optional, schemas } from '../schemas/index.js';
8
7
  import { Tx } from '../tx/tx.js';
9
8
  import { TxHash } from '../tx/tx_hash.js';
@@ -27,7 +26,7 @@ const PeerInfoSchema = z.discriminatedUnion('status', [
27
26
  ]);
28
27
 
29
28
  /** Exposed API to the P2P module. */
30
- export interface P2PApiWithoutAttestations {
29
+ export interface P2PApi {
31
30
  /**
32
31
  * Returns all pending transactions in the transaction pool.
33
32
  * @param limit - The number of items to returns
@@ -48,9 +47,7 @@ export interface P2PApiWithoutAttestations {
48
47
  * Returns info for all connected, dialing, and cached peers.
49
48
  */
50
49
  getPeers(includePending?: boolean): Promise<PeerInfo[]>;
51
- }
52
50
 
53
- export interface P2PApiWithAttestations extends P2PApiWithoutAttestations {
54
51
  /**
55
52
  * Queries the Attestation pool for checkpoint attestations for the given slot
56
53
  *
@@ -61,19 +58,11 @@ export interface P2PApiWithAttestations extends P2PApiWithoutAttestations {
61
58
  getCheckpointAttestationsForSlot(slot: SlotNumber, proposalId?: string): Promise<CheckpointAttestation[]>;
62
59
  }
63
60
 
64
- export interface P2PClient extends P2PApiWithAttestations {
61
+ export interface P2PClient extends P2PApi {
65
62
  /** Manually adds checkpoint attestations to the p2p client attestation pool. */
66
63
  addOwnCheckpointAttestations(attestations: CheckpointAttestation[]): Promise<void>;
67
64
  }
68
65
 
69
- export type P2PApi<T extends P2PClientType = P2PClientType.Full> = T extends P2PClientType.Full
70
- ? P2PApiWithAttestations
71
- : P2PApiWithoutAttestations;
72
-
73
- export type P2PApiFull<T extends P2PClientType = P2PClientType.Full> = T extends P2PClientType.Full
74
- ? P2PApiWithAttestations & P2PClient
75
- : P2PApiWithoutAttestations;
76
-
77
66
  export const P2PApiSchema: ApiSchemaFor<P2PApi> = {
78
67
  getCheckpointAttestationsForSlot: z
79
68
  .function()
@@ -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,