@aztec/constants 0.0.1-commit.b655e406 → 0.0.1-commit.b6e433891

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.
@@ -9,6 +9,8 @@ const SOLIDITY_CONSTANTS_FILE = '../../../../l1-contracts/src/core/libraries/Con
9
9
  // Whitelist of constants that will be copied to aztec_constants.hpp.
10
10
  // We don't copy everything as just a handful are needed, and updating them breaks the cache and triggers expensive bb builds.
11
11
  const CPP_CONSTANTS = [
12
+ 'MAX_ETH_ADDRESS_BIT_SIZE',
13
+ 'MAX_ETH_ADDRESS_VALUE',
12
14
  'GENESIS_BLOCK_HEADER_HASH',
13
15
  'GENESIS_ARCHIVE_ROOT',
14
16
  'MEM_TAG_U1',
@@ -24,7 +26,8 @@ const CPP_CONSTANTS = [
24
26
  'CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS',
25
27
  'MULTI_CALL_ENTRYPOINT_ADDRESS',
26
28
  'FEE_JUICE_ADDRESS',
27
- 'ROUTER_ADDRESS',
29
+ 'TX_DA_GAS_OVERHEAD',
30
+ 'PUBLIC_CHECKS_ADDRESS',
28
31
  'FEE_JUICE_BALANCES_SLOT',
29
32
  'UPDATED_CLASS_IDS_SLOT',
30
33
  'UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN',
@@ -40,6 +43,7 @@ const CPP_CONSTANTS = [
40
43
  'MAX_NOTE_HASHES_PER_TX',
41
44
  'MAX_NULLIFIERS_PER_TX',
42
45
  'MAX_L2_TO_L1_MSGS_PER_TX',
46
+ 'MAX_PROCESSABLE_L2_GAS',
43
47
  'MAX_PUBLIC_LOGS_PER_TX',
44
48
  'MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX',
45
49
  'MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS',
@@ -107,23 +111,27 @@ const CPP_CONSTANTS = [
107
111
  'FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH',
108
112
  'PUBLIC_LOGS_LENGTH',
109
113
  'PUBLIC_LOG_HEADER_LENGTH',
114
+ 'PUBLIC_TX_L2_GAS_OVERHEAD',
110
115
  'MAX_PROTOCOL_CONTRACTS',
111
116
  'DEFAULT_MAX_DEBUG_LOG_MEMORY_READS'
112
117
  ];
113
118
  const CPP_GENERATORS = [
119
+ 'BLOCK_HEADER_HASH',
114
120
  'PARTIAL_ADDRESS',
115
121
  'CONTRACT_ADDRESS_V1',
116
- 'CONTRACT_LEAF',
122
+ 'CONTRACT_CLASS_ID',
117
123
  'PUBLIC_KEYS_HASH',
118
124
  'NOTE_HASH_NONCE',
119
125
  'UNIQUE_NOTE_HASH',
120
126
  'SILOED_NOTE_HASH',
121
- 'OUTER_NULLIFIER',
122
- 'PUBLIC_LEAF_INDEX',
127
+ 'SILOED_NULLIFIER',
128
+ 'PUBLIC_LEAF_SLOT',
129
+ 'PUBLIC_STORAGE_MAP_SLOT',
123
130
  'PUBLIC_CALLDATA',
124
131
  'PUBLIC_BYTECODE'
125
132
  ];
126
133
  const PIL_CONSTANTS = [
134
+ 'MAX_ETH_ADDRESS_VALUE',
127
135
  'MEM_TAG_U1',
128
136
  'MEM_TAG_U8',
129
137
  'MEM_TAG_U16',
@@ -136,6 +144,9 @@ const PIL_CONSTANTS = [
136
144
  'AVM_BITWISE_XOR_OP_ID',
137
145
  'AVM_KECCAKF1600_NUM_ROUNDS',
138
146
  'AVM_KECCAKF1600_STATE_SIZE',
147
+ 'AVM_TX_PHASE_VALUE_START',
148
+ 'AVM_TX_PHASE_VALUE_SETUP',
149
+ 'AVM_TX_PHASE_VALUE_LAST',
139
150
  'AVM_HIGHEST_MEM_ADDRESS',
140
151
  'AVM_MEMORY_NUM_BITS',
141
152
  'AVM_MEMORY_SIZE',
@@ -156,7 +167,7 @@ const PIL_CONSTANTS = [
156
167
  'CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS',
157
168
  'MULTI_CALL_ENTRYPOINT_ADDRESS',
158
169
  'FEE_JUICE_ADDRESS',
159
- 'ROUTER_ADDRESS',
170
+ 'PUBLIC_CHECKS_ADDRESS',
160
171
  'FEE_JUICE_BALANCES_SLOT',
161
172
  'TIMESTAMP_OF_CHANGE_BIT_SIZE',
162
173
  'UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE',
@@ -240,10 +251,10 @@ const PIL_CONSTANTS = [
240
251
  'AVM_DYN_GAS_ID_RETURNDATACOPY',
241
252
  'AVM_DYN_GAS_ID_TORADIX',
242
253
  'AVM_DYN_GAS_ID_BITWISE',
243
- 'AVM_DYN_GAS_ID_EMITUNENCRYPTEDLOG',
254
+ 'AVM_DYN_GAS_ID_EMITPUBLICLOG',
244
255
  'AVM_DYN_GAS_ID_SSTORE',
245
256
  'AVM_SUBTRACE_ID_GETCONTRACTINSTANCE',
246
- 'AVM_SUBTRACE_ID_EMITUNENCRYPTEDLOG',
257
+ 'AVM_SUBTRACE_ID_EMITPUBLICLOG',
247
258
  'AVM_EXEC_OP_ID_GETENVVAR',
248
259
  'AVM_EXEC_OP_ID_MOV',
249
260
  'AVM_EXEC_OP_ID_JUMP',
@@ -294,30 +305,30 @@ const PIL_CONSTANTS = [
294
305
  const PIL_GENERATORS = [
295
306
  'PARTIAL_ADDRESS',
296
307
  'CONTRACT_ADDRESS_V1',
297
- 'CONTRACT_LEAF',
308
+ 'CONTRACT_CLASS_ID',
298
309
  'PUBLIC_KEYS_HASH',
299
310
  'NOTE_HASH_NONCE',
300
311
  'UNIQUE_NOTE_HASH',
301
312
  'SILOED_NOTE_HASH',
302
- 'OUTER_NULLIFIER',
303
- 'PUBLIC_LEAF_INDEX',
313
+ 'SILOED_NULLIFIER',
314
+ 'PUBLIC_LEAF_SLOT',
315
+ 'PUBLIC_STORAGE_MAP_SLOT',
304
316
  'PUBLIC_CALLDATA',
305
317
  'PUBLIC_BYTECODE'
306
318
  ];
307
319
  const SOLIDITY_CONSTANTS = [
308
320
  'MAX_FIELD_VALUE',
309
321
  'MAX_L2_TO_L1_MSGS_PER_TX',
322
+ 'EMPTY_EPOCH_OUT_HASH',
310
323
  'L1_TO_L2_MSG_SUBTREE_HEIGHT',
311
324
  'NUM_MSGS_PER_BASE_PARITY',
312
325
  'NUM_BASE_PARITY_PER_ROOT_PARITY',
313
- 'PROPOSED_BLOCK_HEADER_LENGTH_BYTES',
314
326
  'BLS12_POINT_COMPRESSED_BYTES',
315
327
  'ROOT_ROLLUP_PUBLIC_INPUTS_LENGTH',
316
- 'BLOBS_PER_BLOCK',
317
- 'INITIAL_L2_BLOCK_NUM',
328
+ 'INITIAL_CHECKPOINT_NUMBER',
318
329
  'GENESIS_ARCHIVE_ROOT',
319
330
  'FEE_JUICE_ADDRESS',
320
- 'AZTEC_MAX_EPOCH_DURATION'
331
+ 'MAX_CHECKPOINTS_PER_EPOCH'
321
332
  ];
322
333
  /**
323
334
  * Processes a collection of constants and generates code to export them as TypeScript constants.
@@ -340,7 +351,7 @@ const SOLIDITY_CONSTANTS = [
340
351
  */ function processConstantsCpp(constants, generatorIndices) {
341
352
  const code = [];
342
353
  Object.entries(constants).forEach(([key, value])=>{
343
- if (CPP_CONSTANTS.includes(key) || key.startsWith('AVM_') && key !== 'AVM_VK_INDEX') {
354
+ if (CPP_CONSTANTS.includes(key) || key.startsWith('AVM_')) {
344
355
  if (BigInt(value) <= 2n ** 31n - 1n) {
345
356
  code.push(`#define ${key} ${value}`);
346
357
  } else if (BigInt(value) <= 2n ** 64n - 1n) {
@@ -352,7 +363,7 @@ const SOLIDITY_CONSTANTS = [
352
363
  });
353
364
  Object.entries(generatorIndices).forEach(([key, value])=>{
354
365
  if (CPP_GENERATORS.includes(key)) {
355
- code.push(`#define GENERATOR_INDEX__${key} ${value}`);
366
+ code.push(`#define DOM_SEP__${key} ${value}UL`);
356
367
  }
357
368
  });
358
369
  return code.join('\n');
@@ -372,7 +383,7 @@ const SOLIDITY_CONSTANTS = [
372
383
  });
373
384
  Object.entries(generatorIndices).forEach(([key, value])=>{
374
385
  if (PIL_GENERATORS.includes(key)) {
375
- code.push(` pol GENERATOR_INDEX__${key} = ${value};`);
386
+ code.push(` pol DOM_SEP__${key} = ${value};`);
376
387
  }
377
388
  });
378
389
  return code.join('\n');
@@ -409,30 +420,30 @@ const SOLIDITY_CONSTANTS = [
409
420
  }
410
421
  /**
411
422
  * Generate the constants file in Typescript.
412
- */ function generateTypescriptConstants({ constants, generatorIndexEnum }, targetPath) {
423
+ */ function generateTypescriptConstants({ constants, domainSeparatorEnum }, targetPath) {
413
424
  const result = [
414
425
  '// GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants',
415
426
  processConstantsTS(constants),
416
- processEnumTS('GeneratorIndex', generatorIndexEnum)
427
+ processEnumTS('DomainSeparator', domainSeparatorEnum)
417
428
  ].join('\n');
418
429
  fs.writeFileSync(targetPath, result);
419
430
  }
420
431
  /**
421
432
  * Generate the constants file in C++.
422
- */ function generateCppConstants({ constants, generatorIndexEnum }, targetPath) {
433
+ */ function generateCppConstants({ constants, domainSeparatorEnum }, targetPath) {
423
434
  const resultCpp = `// GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants in yarn-project/constants
424
435
  #pragma once
425
436
 
426
- ${processConstantsCpp(constants, generatorIndexEnum)}
437
+ ${processConstantsCpp(constants, domainSeparatorEnum)}
427
438
  `;
428
439
  fs.writeFileSync(targetPath, resultCpp);
429
440
  }
430
441
  /**
431
442
  * Generate the constants file in PIL.
432
- */ function generatePilConstants({ constants, generatorIndexEnum }, targetPath) {
443
+ */ function generatePilConstants({ constants, domainSeparatorEnum }, targetPath) {
433
444
  const resultPil = `// GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants in yarn-project/constants
434
445
  namespace constants;
435
- ${processConstantsPil(constants, generatorIndexEnum)}
446
+ ${processConstantsPil(constants, domainSeparatorEnum)}
436
447
  \n`;
437
448
  fs.writeFileSync(targetPath, resultPil);
438
449
  }
@@ -462,7 +473,7 @@ ${processConstantsSolidity(constants)}
462
473
  * Parse the content of the constants file in Noir.
463
474
  */ function parseNoirFile(fileContent) {
464
475
  const constantsExpressions = [];
465
- const generatorIndexEnum = {};
476
+ const domainSeparatorEnum = {};
466
477
  const emptyExpression = ()=>({
467
478
  name: '',
468
479
  content: []
@@ -481,10 +492,10 @@ ${processConstantsSolidity(constants)}
481
492
  {
482
493
  const [, name, _type, value, end] = line.match(/global\s+(\w+)(\s*:\s*\w+)?\s*=\s*([^;]*)(;)?/) || [];
483
494
  if (name && value) {
484
- const [, indexName] = name.match(/GENERATOR_INDEX__(\w+)/) || [];
495
+ const [, indexName] = name.match(/DOM_SEP__(\w+)/) || [];
485
496
  if (indexName) {
486
497
  // Generator index.
487
- generatorIndexEnum[indexName] = +value;
498
+ domainSeparatorEnum[indexName] = +value;
488
499
  } else if (end) {
489
500
  // A single line of expression.
490
501
  constantsExpressions.push([
@@ -532,7 +543,7 @@ ${processConstantsSolidity(constants)}
532
543
  const constants = evaluateExpressions(constantsExpressions);
533
544
  return {
534
545
  constants,
535
- generatorIndexEnum
546
+ domainSeparatorEnum
536
547
  };
537
548
  }
538
549
  /**
@@ -559,7 +570,11 @@ ${processConstantsSolidity(constants)}
559
570
  .replace(/\(/g, '( ').replace(/\)/g, ' )')// We also make some space around common operators
560
571
  .replace(/\+/g, ' + ').replace(/(?<!\/)\*(?!\/)/, ' * ')// We split the expression into terms...
561
572
  .split(/\s+/)// ...and then we convert each term to a BigInt if it is a number.
562
- .map((term)=>isNaN(+term) ? term : `BigInt('${term}')`)// .. also, we convert the known bigints to BigInts.
573
+ .map((term)=>{
574
+ // Remove underscores from numeric literals (e.g., 6_000_000 -> 6000000)
575
+ const termWithoutUnderscores = term.replace(/_/g, '');
576
+ return isNaN(+termWithoutUnderscores) ? term : `BigInt('${termWithoutUnderscores}')`;
577
+ })// .. also, we convert the known bigints to BigInts.
563
578
  .map((term)=>knownBigInts.includes(term) ? `BigInt(${term})` : term)// We join the terms back together.
564
579
  .join(' ');
565
580
  return `var ${name} = ${guardedRhs};`;
package/package.json CHANGED
@@ -1,27 +1,36 @@
1
1
  {
2
2
  "name": "@aztec/constants",
3
- "version": "0.0.1-commit.b655e406",
3
+ "version": "0.0.1-commit.b6e433891",
4
4
  "type": "module",
5
5
  "inherits": [
6
6
  "../package.common.json"
7
7
  ],
8
+ "typedocOptions": {
9
+ "entryPoints": [
10
+ "./src/constants.gen.ts"
11
+ ],
12
+ "name": "Constants",
13
+ "tsconfig": "./tsconfig.json"
14
+ },
8
15
  "exports": {
9
16
  ".": "./dest/constants.js"
10
17
  },
11
18
  "scripts": {
12
- "build": "yarn clean && tsc -b",
13
- "build:dev": "tsc -b --watch",
19
+ "build": "yarn clean && ../scripts/tsc.sh",
20
+ "build:dev": "../scripts/tsc.sh --watch",
14
21
  "clean": "rm -rf ./dest .tsbuildinfo",
15
22
  "remake-constants": "node --loader @swc-node/register/esm src/scripts/constants.in.ts && cd ../../l1-contracts && forge fmt",
16
23
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
17
24
  },
18
25
  "dependencies": {
26
+ "@aztec/foundation": "0.0.1-commit.b6e433891",
19
27
  "tslib": "^2.4.0"
20
28
  },
21
29
  "devDependencies": {
22
30
  "@jest/globals": "^30.0.0",
23
31
  "@types/jest": "^30.0.0",
24
32
  "@types/node": "^22.15.17",
33
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
25
34
  "eslint": "^9.26.0",
26
35
  "jest": "^30.0.0",
27
36
  "prettier": "^3.5.3",