@aztec/constants 0.0.1-commit.96bb3f7 → 0.0.1-commit.993d240

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.
@@ -3,12 +3,14 @@ import { dirname, join } from 'path';
3
3
  import { fileURLToPath } from 'url';
4
4
  const NOIR_CONSTANTS_FILE = '../../../../noir-projects/noir-protocol-circuits/crates/types/src/constants.nr';
5
5
  const TS_CONSTANTS_FILE = '../constants.gen.ts';
6
- const CPP_AZTEC_CONSTANTS_FILE = '../../../../barretenberg/cpp/src/barretenberg/vm2/common/aztec_constants.hpp';
6
+ const CPP_AZTEC_CONSTANTS_FILE = '../../../../barretenberg/cpp/src/barretenberg/aztec/aztec_constants.hpp';
7
7
  const PIL_AZTEC_CONSTANTS_FILE = '../../../../barretenberg/cpp/pil/vm2/constants_gen.pil';
8
8
  const SOLIDITY_CONSTANTS_FILE = '../../../../l1-contracts/src/core/libraries/ConstantsGen.sol';
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',
@@ -19,12 +21,10 @@ const CPP_CONSTANTS = [
19
21
  'MEM_TAG_U128',
20
22
  'MEM_TAG_FF',
21
23
  'MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS',
22
- 'CANONICAL_AUTH_REGISTRY_ADDRESS',
23
24
  'CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS',
24
25
  'CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS',
25
- 'MULTI_CALL_ENTRYPOINT_ADDRESS',
26
26
  'FEE_JUICE_ADDRESS',
27
- 'ROUTER_ADDRESS',
27
+ 'TX_DA_GAS_OVERHEAD',
28
28
  'FEE_JUICE_BALANCES_SLOT',
29
29
  'UPDATED_CLASS_IDS_SLOT',
30
30
  'UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN',
@@ -40,6 +40,7 @@ const CPP_CONSTANTS = [
40
40
  'MAX_NOTE_HASHES_PER_TX',
41
41
  'MAX_NULLIFIERS_PER_TX',
42
42
  'MAX_L2_TO_L1_MSGS_PER_TX',
43
+ 'MAX_PROCESSABLE_L2_GAS',
43
44
  'MAX_PUBLIC_LOGS_PER_TX',
44
45
  'MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX',
45
46
  'MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS',
@@ -107,23 +108,34 @@ const CPP_CONSTANTS = [
107
108
  'FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH',
108
109
  'PUBLIC_LOGS_LENGTH',
109
110
  'PUBLIC_LOG_HEADER_LENGTH',
111
+ 'PUBLIC_TX_L2_GAS_OVERHEAD',
110
112
  'MAX_PROTOCOL_CONTRACTS',
111
113
  'DEFAULT_MAX_DEBUG_LOG_MEMORY_READS'
112
114
  ];
113
115
  const CPP_GENERATORS = [
116
+ 'BLOCK_HEADER_HASH',
117
+ 'SALTED_INITIALIZATION_HASH',
114
118
  'PARTIAL_ADDRESS',
115
- 'CONTRACT_ADDRESS_V1',
119
+ 'CONTRACT_ADDRESS_V2',
116
120
  'CONTRACT_CLASS_ID',
117
121
  'PUBLIC_KEYS_HASH',
122
+ 'SINGLE_PUBLIC_KEY_HASH',
118
123
  'NOTE_HASH_NONCE',
119
124
  'UNIQUE_NOTE_HASH',
120
125
  'SILOED_NOTE_HASH',
121
- 'OUTER_NULLIFIER',
122
- 'PUBLIC_LEAF_INDEX',
126
+ 'SILOED_NULLIFIER',
127
+ 'PUBLIC_LEAF_SLOT',
128
+ 'PUBLIC_STORAGE_MAP_SLOT',
123
129
  'PUBLIC_CALLDATA',
124
- 'PUBLIC_BYTECODE'
130
+ 'PUBLIC_BYTECODE',
131
+ 'MERKLE_HASH',
132
+ 'NULLIFIER_MERKLE',
133
+ 'PUBLIC_DATA_MERKLE',
134
+ 'WRITTEN_SLOTS_MERKLE',
135
+ 'RETRIEVED_BYTECODES_MERKLE'
125
136
  ];
126
137
  const PIL_CONSTANTS = [
138
+ 'MAX_ETH_ADDRESS_VALUE',
127
139
  'MEM_TAG_U1',
128
140
  'MEM_TAG_U8',
129
141
  'MEM_TAG_U16',
@@ -154,12 +166,9 @@ const PIL_CONSTANTS = [
154
166
  'L1_TO_L2_MSG_TREE_HEIGHT',
155
167
  'UPDATED_CLASS_IDS_SLOT',
156
168
  'UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN',
157
- 'CANONICAL_AUTH_REGISTRY_ADDRESS',
158
169
  'CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS',
159
170
  'CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS',
160
- 'MULTI_CALL_ENTRYPOINT_ADDRESS',
161
171
  'FEE_JUICE_ADDRESS',
162
- 'ROUTER_ADDRESS',
163
172
  'FEE_JUICE_BALANCES_SLOT',
164
173
  'TIMESTAMP_OF_CHANGE_BIT_SIZE',
165
174
  'UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE',
@@ -243,10 +252,10 @@ const PIL_CONSTANTS = [
243
252
  'AVM_DYN_GAS_ID_RETURNDATACOPY',
244
253
  'AVM_DYN_GAS_ID_TORADIX',
245
254
  'AVM_DYN_GAS_ID_BITWISE',
246
- 'AVM_DYN_GAS_ID_EMITUNENCRYPTEDLOG',
255
+ 'AVM_DYN_GAS_ID_EMITPUBLICLOG',
247
256
  'AVM_DYN_GAS_ID_SSTORE',
248
257
  'AVM_SUBTRACE_ID_GETCONTRACTINSTANCE',
249
- 'AVM_SUBTRACE_ID_EMITUNENCRYPTEDLOG',
258
+ 'AVM_SUBTRACE_ID_EMITPUBLICLOG',
250
259
  'AVM_EXEC_OP_ID_GETENVVAR',
251
260
  'AVM_EXEC_OP_ID_MOV',
252
261
  'AVM_EXEC_OP_ID_JUMP',
@@ -295,21 +304,30 @@ const PIL_CONSTANTS = [
295
304
  'MAX_PROTOCOL_CONTRACTS'
296
305
  ];
297
306
  const PIL_GENERATORS = [
307
+ 'SALTED_INITIALIZATION_HASH',
298
308
  'PARTIAL_ADDRESS',
299
- 'CONTRACT_ADDRESS_V1',
309
+ 'CONTRACT_ADDRESS_V2',
300
310
  'CONTRACT_CLASS_ID',
301
311
  'PUBLIC_KEYS_HASH',
312
+ 'SINGLE_PUBLIC_KEY_HASH',
302
313
  'NOTE_HASH_NONCE',
303
314
  'UNIQUE_NOTE_HASH',
304
315
  'SILOED_NOTE_HASH',
305
- 'OUTER_NULLIFIER',
306
- 'PUBLIC_LEAF_INDEX',
316
+ 'SILOED_NULLIFIER',
317
+ 'PUBLIC_LEAF_SLOT',
318
+ 'PUBLIC_STORAGE_MAP_SLOT',
307
319
  'PUBLIC_CALLDATA',
308
- 'PUBLIC_BYTECODE'
320
+ 'PUBLIC_BYTECODE',
321
+ 'MERKLE_HASH',
322
+ 'NULLIFIER_MERKLE',
323
+ 'PUBLIC_DATA_MERKLE',
324
+ 'WRITTEN_SLOTS_MERKLE',
325
+ 'RETRIEVED_BYTECODES_MERKLE'
309
326
  ];
310
327
  const SOLIDITY_CONSTANTS = [
311
328
  'MAX_FIELD_VALUE',
312
329
  'MAX_L2_TO_L1_MSGS_PER_TX',
330
+ 'EMPTY_EPOCH_OUT_HASH',
313
331
  'L1_TO_L2_MSG_SUBTREE_HEIGHT',
314
332
  'NUM_MSGS_PER_BASE_PARITY',
315
333
  'NUM_BASE_PARITY_PER_ROOT_PARITY',
@@ -318,7 +336,7 @@ const SOLIDITY_CONSTANTS = [
318
336
  'INITIAL_CHECKPOINT_NUMBER',
319
337
  'GENESIS_ARCHIVE_ROOT',
320
338
  'FEE_JUICE_ADDRESS',
321
- 'AZTEC_MAX_EPOCH_DURATION'
339
+ 'MAX_CHECKPOINTS_PER_EPOCH'
322
340
  ];
323
341
  /**
324
342
  * Processes a collection of constants and generates code to export them as TypeScript constants.
@@ -353,7 +371,7 @@ const SOLIDITY_CONSTANTS = [
353
371
  });
354
372
  Object.entries(generatorIndices).forEach(([key, value])=>{
355
373
  if (CPP_GENERATORS.includes(key)) {
356
- code.push(`#define DOM_SEP__${key} ${value}`);
374
+ code.push(`#define DOM_SEP__${key} ${value}UL`);
357
375
  }
358
376
  });
359
377
  return code.join('\n');
@@ -410,30 +428,30 @@ const SOLIDITY_CONSTANTS = [
410
428
  }
411
429
  /**
412
430
  * Generate the constants file in Typescript.
413
- */ function generateTypescriptConstants({ constants, generatorIndexEnum }, targetPath) {
431
+ */ function generateTypescriptConstants({ constants, domainSeparatorEnum }, targetPath) {
414
432
  const result = [
415
433
  '// GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants',
416
434
  processConstantsTS(constants),
417
- processEnumTS('GeneratorIndex', generatorIndexEnum)
435
+ processEnumTS('DomainSeparator', domainSeparatorEnum)
418
436
  ].join('\n');
419
437
  fs.writeFileSync(targetPath, result);
420
438
  }
421
439
  /**
422
440
  * Generate the constants file in C++.
423
- */ function generateCppConstants({ constants, generatorIndexEnum }, targetPath) {
441
+ */ function generateCppConstants({ constants, domainSeparatorEnum }, targetPath) {
424
442
  const resultCpp = `// GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants in yarn-project/constants
425
443
  #pragma once
426
444
 
427
- ${processConstantsCpp(constants, generatorIndexEnum)}
445
+ ${processConstantsCpp(constants, domainSeparatorEnum)}
428
446
  `;
429
447
  fs.writeFileSync(targetPath, resultCpp);
430
448
  }
431
449
  /**
432
450
  * Generate the constants file in PIL.
433
- */ function generatePilConstants({ constants, generatorIndexEnum }, targetPath) {
451
+ */ function generatePilConstants({ constants, domainSeparatorEnum }, targetPath) {
434
452
  const resultPil = `// GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants in yarn-project/constants
435
453
  namespace constants;
436
- ${processConstantsPil(constants, generatorIndexEnum)}
454
+ ${processConstantsPil(constants, domainSeparatorEnum)}
437
455
  \n`;
438
456
  fs.writeFileSync(targetPath, resultPil);
439
457
  }
@@ -463,7 +481,7 @@ ${processConstantsSolidity(constants)}
463
481
  * Parse the content of the constants file in Noir.
464
482
  */ function parseNoirFile(fileContent) {
465
483
  const constantsExpressions = [];
466
- const generatorIndexEnum = {};
484
+ const domainSeparatorEnum = {};
467
485
  const emptyExpression = ()=>({
468
486
  name: '',
469
487
  content: []
@@ -485,7 +503,7 @@ ${processConstantsSolidity(constants)}
485
503
  const [, indexName] = name.match(/DOM_SEP__(\w+)/) || [];
486
504
  if (indexName) {
487
505
  // Generator index.
488
- generatorIndexEnum[indexName] = +value;
506
+ domainSeparatorEnum[indexName] = +value;
489
507
  } else if (end) {
490
508
  // A single line of expression.
491
509
  constantsExpressions.push([
@@ -533,7 +551,7 @@ ${processConstantsSolidity(constants)}
533
551
  const constants = evaluateExpressions(constantsExpressions);
534
552
  return {
535
553
  constants,
536
- generatorIndexEnum
554
+ domainSeparatorEnum
537
555
  };
538
556
  }
539
557
  /**
@@ -560,7 +578,11 @@ ${processConstantsSolidity(constants)}
560
578
  .replace(/\(/g, '( ').replace(/\)/g, ' )')// We also make some space around common operators
561
579
  .replace(/\+/g, ' + ').replace(/(?<!\/)\*(?!\/)/, ' * ')// We split the expression into terms...
562
580
  .split(/\s+/)// ...and then we convert each term to a BigInt if it is a number.
563
- .map((term)=>isNaN(+term) ? term : `BigInt('${term}')`)// .. also, we convert the known bigints to BigInts.
581
+ .map((term)=>{
582
+ // Remove underscores from numeric literals (e.g., 6_000_000 -> 6000000)
583
+ const termWithoutUnderscores = term.replace(/_/g, '');
584
+ return isNaN(+termWithoutUnderscores) ? term : `BigInt('${termWithoutUnderscores}')`;
585
+ })// .. also, we convert the known bigints to BigInts.
564
586
  .map((term)=>knownBigInts.includes(term) ? `BigInt(${term})` : term)// We join the terms back together.
565
587
  .join(' ');
566
588
  return `var ${name} = ${guardedRhs};`;
package/package.json CHANGED
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "name": "@aztec/constants",
3
- "version": "0.0.1-commit.96bb3f7",
3
+ "version": "0.0.1-commit.993d240",
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
  },
@@ -16,14 +23,14 @@
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": {
19
- "@aztec/foundation": "0.0.1-commit.96bb3f7",
26
+ "@aztec/foundation": "0.0.1-commit.993d240",
20
27
  "tslib": "^2.4.0"
21
28
  },
22
29
  "devDependencies": {
23
30
  "@jest/globals": "^30.0.0",
24
31
  "@types/jest": "^30.0.0",
25
32
  "@types/node": "^22.15.17",
26
- "@typescript/native-preview": "7.0.0-dev.20251126.1",
33
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
27
34
  "eslint": "^9.26.0",
28
35
  "jest": "^30.0.0",
29
36
  "prettier": "^3.5.3",