@aztec/cli 2.1.0-rc.9 → 2.1.2

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 (40) hide show
  1. package/dest/cmds/l1/deploy_new_rollup.d.ts +1 -1
  2. package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
  3. package/dest/cmds/l1/deploy_new_rollup.js +2 -2
  4. package/dest/cmds/l1/index.d.ts.map +1 -1
  5. package/dest/cmds/l1/index.js +2 -2
  6. package/dest/cmds/validator_keys/add.d.ts +5 -0
  7. package/dest/cmds/validator_keys/add.d.ts.map +1 -0
  8. package/dest/cmds/validator_keys/add.js +70 -0
  9. package/dest/cmds/validator_keys/generate_bls_keypair.d.ts +12 -0
  10. package/dest/cmds/validator_keys/generate_bls_keypair.d.ts.map +1 -0
  11. package/dest/cmds/validator_keys/generate_bls_keypair.js +26 -0
  12. package/dest/cmds/validator_keys/index.d.ts +4 -0
  13. package/dest/cmds/validator_keys/index.d.ts.map +1 -0
  14. package/dest/cmds/validator_keys/index.js +20 -0
  15. package/dest/cmds/validator_keys/new.d.ts +26 -0
  16. package/dest/cmds/validator_keys/new.d.ts.map +1 -0
  17. package/dest/cmds/validator_keys/new.js +60 -0
  18. package/dest/cmds/validator_keys/shared.d.ts +68 -0
  19. package/dest/cmds/validator_keys/shared.d.ts.map +1 -0
  20. package/dest/cmds/validator_keys/shared.js +271 -0
  21. package/dest/config/chain_l2_config.d.ts +6 -4
  22. package/dest/config/chain_l2_config.d.ts.map +1 -1
  23. package/dest/config/chain_l2_config.js +82 -65
  24. package/dest/utils/aztec.d.ts +1 -1
  25. package/dest/utils/aztec.d.ts.map +1 -1
  26. package/dest/utils/aztec.js +2 -2
  27. package/dest/utils/commands.d.ts +10 -1
  28. package/dest/utils/commands.d.ts.map +1 -1
  29. package/dest/utils/commands.js +30 -3
  30. package/package.json +28 -24
  31. package/src/cmds/l1/deploy_new_rollup.ts +2 -0
  32. package/src/cmds/l1/index.ts +2 -0
  33. package/src/cmds/validator_keys/add.ts +113 -0
  34. package/src/cmds/validator_keys/generate_bls_keypair.ts +33 -0
  35. package/src/cmds/validator_keys/index.ts +96 -0
  36. package/src/cmds/validator_keys/new.ts +120 -0
  37. package/src/cmds/validator_keys/shared.ts +321 -0
  38. package/src/config/chain_l2_config.ts +110 -84
  39. package/src/utils/aztec.ts +2 -0
  40. package/src/utils/commands.ts +41 -3
@@ -109,6 +109,7 @@ export async function deployNewRollupContracts(
109
109
  feeJuicePortalInitialBalance: bigint,
110
110
  config: L1ContractsConfig,
111
111
  realVerifier: boolean,
112
+ createVerificationJson: string | false,
112
113
  logger: Logger,
113
114
  ): Promise<{ rollup: RollupContract; slashFactoryAddress: EthAddress }> {
114
115
  const { createEthereumChain, deployRollupForUpgrade, createExtendedL1Client } = await import('@aztec/ethereum');
@@ -152,6 +153,7 @@ export async function deployNewRollupContracts(
152
153
  registryAddress,
153
154
  logger,
154
155
  config,
156
+ createVerificationJson,
155
157
  );
156
158
 
157
159
  return { rollup, slashFactoryAddress };
@@ -114,6 +114,34 @@ export async function getTxSender(pxe: PXE, _from?: string) {
114
114
  return from;
115
115
  }
116
116
 
117
+ /**
118
+ * Parses and validates a hex string. Removes leading 0x if present, checks for hex validity,
119
+ * and enforces an optional minimum length.
120
+ * @param hex - The hex string to validate.
121
+ * @param minLen - Optional minimum length (in hex characters, after stripping '0x').
122
+ * @returns The normalized hex string (without leading 0x).
123
+ * @throws InvalidArgumentError if the string is not valid hex or does not meet the minimum length.
124
+ */
125
+ // minLen is now interpreted as the minimum number of bytes (2 hex characters per byte)
126
+ export function parseHex(hex: string, minLen?: number): `0x${string}` {
127
+ const normalized = hex.startsWith('0x') ? hex.slice(2) : hex;
128
+
129
+ if (!/^[0-9a-fA-F]*$/.test(normalized)) {
130
+ throw new InvalidArgumentError('Invalid hex string');
131
+ }
132
+
133
+ if (minLen !== undefined) {
134
+ const minHexLen = minLen * 2;
135
+ if (normalized.length < minHexLen) {
136
+ throw new InvalidArgumentError(
137
+ `Hex string is too short (length ${normalized.length}), minimum byte length is ${minLen} (hex chars: ${minHexLen})`,
138
+ );
139
+ }
140
+ }
141
+
142
+ return `0x${normalized}`;
143
+ }
144
+
117
145
  /**
118
146
  * Removes the leading 0x from a hex string. If no leading 0x is found the string is returned unchanged.
119
147
  * @param hex - A hex string
@@ -168,7 +196,7 @@ export function parseAztecAddress(address: string): AztecAddress {
168
196
  try {
169
197
  return AztecAddress.fromString(address);
170
198
  } catch {
171
- throw new InvalidArgumentError(`Invalid address: ${address}`);
199
+ throw new InvalidArgumentError(`Invalid Aztec address: ${address}`);
172
200
  }
173
201
  }
174
202
 
@@ -182,7 +210,7 @@ export function parseEthereumAddress(address: string): EthAddress {
182
210
  try {
183
211
  return EthAddress.fromString(address);
184
212
  } catch {
185
- throw new InvalidArgumentError(`Invalid address: ${address}`);
213
+ throw new InvalidArgumentError(`Invalid Ethereumaddress: ${address}`);
186
214
  }
187
215
  }
188
216
 
@@ -236,7 +264,11 @@ export function parseOptionalSelector(selector: string): FunctionSelector | unde
236
264
  * @returns The parsed integer, or undefined if the input string is falsy.
237
265
  * @throws If the input is not a valid integer.
238
266
  */
239
- export function parseOptionalInteger(value: string): number | undefined {
267
+ export function parseOptionalInteger(
268
+ value: string,
269
+ min: number = Number.MIN_SAFE_INTEGER,
270
+ max: number = Number.MAX_SAFE_INTEGER,
271
+ ): number | undefined {
240
272
  if (!value) {
241
273
  return undefined;
242
274
  }
@@ -244,6 +276,12 @@ export function parseOptionalInteger(value: string): number | undefined {
244
276
  if (!Number.isInteger(parsed)) {
245
277
  throw new InvalidArgumentError('Invalid integer.');
246
278
  }
279
+ if (parsed < min) {
280
+ throw new InvalidArgumentError(`Value must be greater than ${min}.`);
281
+ }
282
+ if (parsed > max) {
283
+ throw new InvalidArgumentError(`Value must be less than ${max}.`);
284
+ }
247
285
  return parsed;
248
286
  }
249
287