@aztec/constants 0.0.1-fake-c83136db25 → 0.0.2-commit.217f559981
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.
- package/dest/constants.d.ts +9 -1
- package/dest/constants.d.ts.map +1 -1
- package/dest/constants.gen.d.ts +184 -179
- package/dest/constants.gen.d.ts.map +1 -1
- package/dest/constants.gen.js +184 -179
- package/dest/constants.js +14 -0
- package/dest/scripts/constants.in.d.ts +1 -1
- package/dest/scripts/constants.in.js +35 -27
- package/package.json +12 -3
- package/src/constants.gen.ts +184 -179
- package/src/constants.ts +27 -0
package/dest/constants.js
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
+
import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
// Re-export L2 block number constants with proper BlockNumber type
|
|
4
|
+
// Note: The generated constants are plain numbers, but we provide typed versions here
|
|
5
|
+
import { GENESIS_BLOCK_HEADER_HASH as GENESIS_BLOCK_HEADER_HASH_BIGINT, INITIAL_CHECKPOINT_NUMBER as INITIAL_CHECKPOINT_NUM_RAW, INITIAL_L2_BLOCK_NUM as INITIAL_L2_BLOCK_NUM_RAW } from './constants.gen.js';
|
|
1
6
|
// Typescript-land-only constants
|
|
2
7
|
export const SPONSORED_FPC_SALT = BigInt(0);
|
|
3
8
|
// Autogenerated constants loaded from noir-land
|
|
9
|
+
// eslint-disable-next-line import-x/export
|
|
4
10
|
export * from './constants.gen.js';
|
|
11
|
+
/** The initial L2 block number (typed as BlockNumber). This is the first block number in the Aztec L2 chain. */ // Shadow the export from constants.gen above
|
|
12
|
+
// eslint-disable-next-line import-x/export
|
|
13
|
+
export const INITIAL_L2_BLOCK_NUM = BlockNumber(INITIAL_L2_BLOCK_NUM_RAW);
|
|
14
|
+
/** The initial L2 checkpoint number (typed as CheckpointNumber). This is the first checkpoint number in the Aztec L2 chain. */ // Shadow the export from constants.gen above
|
|
15
|
+
export const INITIAL_L2_CHECKPOINT_NUM = CheckpointNumber(INITIAL_CHECKPOINT_NUM_RAW);
|
|
16
|
+
/** The block header hash for the genesis block 0. */ // Shadow the export from constants.gen above
|
|
17
|
+
// eslint-disable-next-line import-x/export
|
|
18
|
+
export const GENESIS_BLOCK_HEADER_HASH = new Fr(GENESIS_BLOCK_HEADER_HASH_BIGINT);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmluLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc2NyaXB0cy9jb25zdGFudHMuaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
|
@@ -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,7 @@ const CPP_CONSTANTS = [
|
|
|
24
26
|
'CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS',
|
|
25
27
|
'MULTI_CALL_ENTRYPOINT_ADDRESS',
|
|
26
28
|
'FEE_JUICE_ADDRESS',
|
|
27
|
-
'
|
|
29
|
+
'PUBLIC_CHECKS_ADDRESS',
|
|
28
30
|
'FEE_JUICE_BALANCES_SLOT',
|
|
29
31
|
'UPDATED_CLASS_IDS_SLOT',
|
|
30
32
|
'UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN',
|
|
@@ -111,19 +113,22 @@ const CPP_CONSTANTS = [
|
|
|
111
113
|
'DEFAULT_MAX_DEBUG_LOG_MEMORY_READS'
|
|
112
114
|
];
|
|
113
115
|
const CPP_GENERATORS = [
|
|
116
|
+
'BLOCK_HEADER_HASH',
|
|
114
117
|
'PARTIAL_ADDRESS',
|
|
115
118
|
'CONTRACT_ADDRESS_V1',
|
|
116
|
-
'
|
|
119
|
+
'CONTRACT_CLASS_ID',
|
|
117
120
|
'PUBLIC_KEYS_HASH',
|
|
118
121
|
'NOTE_HASH_NONCE',
|
|
119
122
|
'UNIQUE_NOTE_HASH',
|
|
120
123
|
'SILOED_NOTE_HASH',
|
|
121
|
-
'
|
|
122
|
-
'
|
|
124
|
+
'SILOED_NULLIFIER',
|
|
125
|
+
'PUBLIC_LEAF_SLOT',
|
|
126
|
+
'PUBLIC_STORAGE_MAP_SLOT',
|
|
123
127
|
'PUBLIC_CALLDATA',
|
|
124
128
|
'PUBLIC_BYTECODE'
|
|
125
129
|
];
|
|
126
130
|
const PIL_CONSTANTS = [
|
|
131
|
+
'MAX_ETH_ADDRESS_VALUE',
|
|
127
132
|
'MEM_TAG_U1',
|
|
128
133
|
'MEM_TAG_U8',
|
|
129
134
|
'MEM_TAG_U16',
|
|
@@ -136,6 +141,9 @@ const PIL_CONSTANTS = [
|
|
|
136
141
|
'AVM_BITWISE_XOR_OP_ID',
|
|
137
142
|
'AVM_KECCAKF1600_NUM_ROUNDS',
|
|
138
143
|
'AVM_KECCAKF1600_STATE_SIZE',
|
|
144
|
+
'AVM_TX_PHASE_VALUE_START',
|
|
145
|
+
'AVM_TX_PHASE_VALUE_SETUP',
|
|
146
|
+
'AVM_TX_PHASE_VALUE_LAST',
|
|
139
147
|
'AVM_HIGHEST_MEM_ADDRESS',
|
|
140
148
|
'AVM_MEMORY_NUM_BITS',
|
|
141
149
|
'AVM_MEMORY_SIZE',
|
|
@@ -156,7 +164,7 @@ const PIL_CONSTANTS = [
|
|
|
156
164
|
'CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS',
|
|
157
165
|
'MULTI_CALL_ENTRYPOINT_ADDRESS',
|
|
158
166
|
'FEE_JUICE_ADDRESS',
|
|
159
|
-
'
|
|
167
|
+
'PUBLIC_CHECKS_ADDRESS',
|
|
160
168
|
'FEE_JUICE_BALANCES_SLOT',
|
|
161
169
|
'TIMESTAMP_OF_CHANGE_BIT_SIZE',
|
|
162
170
|
'UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE',
|
|
@@ -240,10 +248,10 @@ const PIL_CONSTANTS = [
|
|
|
240
248
|
'AVM_DYN_GAS_ID_RETURNDATACOPY',
|
|
241
249
|
'AVM_DYN_GAS_ID_TORADIX',
|
|
242
250
|
'AVM_DYN_GAS_ID_BITWISE',
|
|
243
|
-
'
|
|
251
|
+
'AVM_DYN_GAS_ID_EMITPUBLICLOG',
|
|
244
252
|
'AVM_DYN_GAS_ID_SSTORE',
|
|
245
253
|
'AVM_SUBTRACE_ID_GETCONTRACTINSTANCE',
|
|
246
|
-
'
|
|
254
|
+
'AVM_SUBTRACE_ID_EMITPUBLICLOG',
|
|
247
255
|
'AVM_EXEC_OP_ID_GETENVVAR',
|
|
248
256
|
'AVM_EXEC_OP_ID_MOV',
|
|
249
257
|
'AVM_EXEC_OP_ID_JUMP',
|
|
@@ -294,30 +302,30 @@ const PIL_CONSTANTS = [
|
|
|
294
302
|
const PIL_GENERATORS = [
|
|
295
303
|
'PARTIAL_ADDRESS',
|
|
296
304
|
'CONTRACT_ADDRESS_V1',
|
|
297
|
-
'
|
|
305
|
+
'CONTRACT_CLASS_ID',
|
|
298
306
|
'PUBLIC_KEYS_HASH',
|
|
299
307
|
'NOTE_HASH_NONCE',
|
|
300
308
|
'UNIQUE_NOTE_HASH',
|
|
301
309
|
'SILOED_NOTE_HASH',
|
|
302
|
-
'
|
|
303
|
-
'
|
|
310
|
+
'SILOED_NULLIFIER',
|
|
311
|
+
'PUBLIC_LEAF_SLOT',
|
|
312
|
+
'PUBLIC_STORAGE_MAP_SLOT',
|
|
304
313
|
'PUBLIC_CALLDATA',
|
|
305
314
|
'PUBLIC_BYTECODE'
|
|
306
315
|
];
|
|
307
316
|
const SOLIDITY_CONSTANTS = [
|
|
308
317
|
'MAX_FIELD_VALUE',
|
|
309
318
|
'MAX_L2_TO_L1_MSGS_PER_TX',
|
|
319
|
+
'EMPTY_EPOCH_OUT_HASH',
|
|
310
320
|
'L1_TO_L2_MSG_SUBTREE_HEIGHT',
|
|
311
321
|
'NUM_MSGS_PER_BASE_PARITY',
|
|
312
322
|
'NUM_BASE_PARITY_PER_ROOT_PARITY',
|
|
313
|
-
'PROPOSED_BLOCK_HEADER_LENGTH_BYTES',
|
|
314
323
|
'BLS12_POINT_COMPRESSED_BYTES',
|
|
315
324
|
'ROOT_ROLLUP_PUBLIC_INPUTS_LENGTH',
|
|
316
|
-
'
|
|
317
|
-
'INITIAL_L2_BLOCK_NUM',
|
|
325
|
+
'INITIAL_CHECKPOINT_NUMBER',
|
|
318
326
|
'GENESIS_ARCHIVE_ROOT',
|
|
319
327
|
'FEE_JUICE_ADDRESS',
|
|
320
|
-
'
|
|
328
|
+
'MAX_CHECKPOINTS_PER_EPOCH'
|
|
321
329
|
];
|
|
322
330
|
/**
|
|
323
331
|
* Processes a collection of constants and generates code to export them as TypeScript constants.
|
|
@@ -340,7 +348,7 @@ const SOLIDITY_CONSTANTS = [
|
|
|
340
348
|
*/ function processConstantsCpp(constants, generatorIndices) {
|
|
341
349
|
const code = [];
|
|
342
350
|
Object.entries(constants).forEach(([key, value])=>{
|
|
343
|
-
if (CPP_CONSTANTS.includes(key) || key.startsWith('AVM_')
|
|
351
|
+
if (CPP_CONSTANTS.includes(key) || key.startsWith('AVM_')) {
|
|
344
352
|
if (BigInt(value) <= 2n ** 31n - 1n) {
|
|
345
353
|
code.push(`#define ${key} ${value}`);
|
|
346
354
|
} else if (BigInt(value) <= 2n ** 64n - 1n) {
|
|
@@ -352,7 +360,7 @@ const SOLIDITY_CONSTANTS = [
|
|
|
352
360
|
});
|
|
353
361
|
Object.entries(generatorIndices).forEach(([key, value])=>{
|
|
354
362
|
if (CPP_GENERATORS.includes(key)) {
|
|
355
|
-
code.push(`#define
|
|
363
|
+
code.push(`#define DOM_SEP__${key} ${value}UL`);
|
|
356
364
|
}
|
|
357
365
|
});
|
|
358
366
|
return code.join('\n');
|
|
@@ -372,7 +380,7 @@ const SOLIDITY_CONSTANTS = [
|
|
|
372
380
|
});
|
|
373
381
|
Object.entries(generatorIndices).forEach(([key, value])=>{
|
|
374
382
|
if (PIL_GENERATORS.includes(key)) {
|
|
375
|
-
code.push(` pol
|
|
383
|
+
code.push(` pol DOM_SEP__${key} = ${value};`);
|
|
376
384
|
}
|
|
377
385
|
});
|
|
378
386
|
return code.join('\n');
|
|
@@ -409,30 +417,30 @@ const SOLIDITY_CONSTANTS = [
|
|
|
409
417
|
}
|
|
410
418
|
/**
|
|
411
419
|
* Generate the constants file in Typescript.
|
|
412
|
-
*/ function generateTypescriptConstants({ constants,
|
|
420
|
+
*/ function generateTypescriptConstants({ constants, domainSeparatorEnum }, targetPath) {
|
|
413
421
|
const result = [
|
|
414
422
|
'// GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants',
|
|
415
423
|
processConstantsTS(constants),
|
|
416
|
-
processEnumTS('
|
|
424
|
+
processEnumTS('DomainSeparator', domainSeparatorEnum)
|
|
417
425
|
].join('\n');
|
|
418
426
|
fs.writeFileSync(targetPath, result);
|
|
419
427
|
}
|
|
420
428
|
/**
|
|
421
429
|
* Generate the constants file in C++.
|
|
422
|
-
*/ function generateCppConstants({ constants,
|
|
430
|
+
*/ function generateCppConstants({ constants, domainSeparatorEnum }, targetPath) {
|
|
423
431
|
const resultCpp = `// GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants in yarn-project/constants
|
|
424
432
|
#pragma once
|
|
425
433
|
|
|
426
|
-
${processConstantsCpp(constants,
|
|
434
|
+
${processConstantsCpp(constants, domainSeparatorEnum)}
|
|
427
435
|
`;
|
|
428
436
|
fs.writeFileSync(targetPath, resultCpp);
|
|
429
437
|
}
|
|
430
438
|
/**
|
|
431
439
|
* Generate the constants file in PIL.
|
|
432
|
-
*/ function generatePilConstants({ constants,
|
|
440
|
+
*/ function generatePilConstants({ constants, domainSeparatorEnum }, targetPath) {
|
|
433
441
|
const resultPil = `// GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants in yarn-project/constants
|
|
434
442
|
namespace constants;
|
|
435
|
-
${processConstantsPil(constants,
|
|
443
|
+
${processConstantsPil(constants, domainSeparatorEnum)}
|
|
436
444
|
\n`;
|
|
437
445
|
fs.writeFileSync(targetPath, resultPil);
|
|
438
446
|
}
|
|
@@ -462,7 +470,7 @@ ${processConstantsSolidity(constants)}
|
|
|
462
470
|
* Parse the content of the constants file in Noir.
|
|
463
471
|
*/ function parseNoirFile(fileContent) {
|
|
464
472
|
const constantsExpressions = [];
|
|
465
|
-
const
|
|
473
|
+
const domainSeparatorEnum = {};
|
|
466
474
|
const emptyExpression = ()=>({
|
|
467
475
|
name: '',
|
|
468
476
|
content: []
|
|
@@ -481,10 +489,10 @@ ${processConstantsSolidity(constants)}
|
|
|
481
489
|
{
|
|
482
490
|
const [, name, _type, value, end] = line.match(/global\s+(\w+)(\s*:\s*\w+)?\s*=\s*([^;]*)(;)?/) || [];
|
|
483
491
|
if (name && value) {
|
|
484
|
-
const [, indexName] = name.match(/
|
|
492
|
+
const [, indexName] = name.match(/DOM_SEP__(\w+)/) || [];
|
|
485
493
|
if (indexName) {
|
|
486
494
|
// Generator index.
|
|
487
|
-
|
|
495
|
+
domainSeparatorEnum[indexName] = +value;
|
|
488
496
|
} else if (end) {
|
|
489
497
|
// A single line of expression.
|
|
490
498
|
constantsExpressions.push([
|
|
@@ -532,7 +540,7 @@ ${processConstantsSolidity(constants)}
|
|
|
532
540
|
const constants = evaluateExpressions(constantsExpressions);
|
|
533
541
|
return {
|
|
534
542
|
constants,
|
|
535
|
-
|
|
543
|
+
domainSeparatorEnum
|
|
536
544
|
};
|
|
537
545
|
}
|
|
538
546
|
/**
|
package/package.json
CHANGED
|
@@ -1,27 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/constants",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-commit.217f559981",
|
|
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
|
|
13
|
-
"build:dev": "tsc
|
|
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.2-commit.217f559981",
|
|
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",
|