@aztec/constants 0.0.1-fake-ceab37513c → 0.0.6-commit.a2d1860fe9
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 +338 -366
- package/dest/constants.gen.d.ts.map +1 -1
- package/dest/constants.gen.js +338 -366
- package/dest/constants.js +14 -0
- package/dest/scripts/constants.in.d.ts +1 -1
- package/dest/scripts/constants.in.js +60 -33
- package/package.json +12 -3
- package/src/constants.gen.ts +337 -365
- 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,14 +26,16 @@ 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',
|
|
31
33
|
'PUBLIC_DATA_TREE_HEIGHT',
|
|
32
34
|
'NULLIFIER_TREE_HEIGHT',
|
|
35
|
+
'NULLIFIER_SUBTREE_HEIGHT',
|
|
33
36
|
'NOTE_HASH_TREE_HEIGHT',
|
|
34
37
|
'L1_TO_L2_MSG_TREE_HEIGHT',
|
|
38
|
+
'ARCHIVE_HEIGHT',
|
|
35
39
|
'TIMESTAMP_OF_CHANGE_BIT_SIZE',
|
|
36
40
|
'UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE',
|
|
37
41
|
'MAX_ENQUEUED_CALLS_PER_TX',
|
|
@@ -43,7 +47,6 @@ const CPP_CONSTANTS = [
|
|
|
43
47
|
'MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS',
|
|
44
48
|
'MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX',
|
|
45
49
|
'MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX',
|
|
46
|
-
'PUBLIC_LOG_SIZE_IN_FIELDS',
|
|
47
50
|
'AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_ROW_IDX',
|
|
48
51
|
'AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_CHAIN_ID_ROW_IDX',
|
|
49
52
|
'AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_VERSION_ROW_IDX',
|
|
@@ -53,6 +56,7 @@ const CPP_CONSTANTS = [
|
|
|
53
56
|
'AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_COINBASE_ROW_IDX',
|
|
54
57
|
'AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_FEE_RECIPIENT_ROW_IDX',
|
|
55
58
|
'AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_GAS_FEES_ROW_IDX',
|
|
59
|
+
'AVM_PUBLIC_INPUTS_PROTOCOL_CONTRACTS_ROW_IDX',
|
|
56
60
|
'AVM_PUBLIC_INPUTS_START_TREE_SNAPSHOTS_ROW_IDX',
|
|
57
61
|
'AVM_PUBLIC_INPUTS_START_TREE_SNAPSHOTS_L1_TO_L2_MESSAGE_TREE_ROW_IDX',
|
|
58
62
|
'AVM_PUBLIC_INPUTS_START_TREE_SNAPSHOTS_NOTE_HASH_TREE_ROW_IDX',
|
|
@@ -100,22 +104,31 @@ const CPP_CONSTANTS = [
|
|
|
100
104
|
'AVM_WRITTEN_PUBLIC_DATA_SLOTS_TREE_INITIAL_ROOT',
|
|
101
105
|
'AVM_WRITTEN_PUBLIC_DATA_SLOTS_TREE_INITIAL_SIZE',
|
|
102
106
|
'NOTE_HASH_TREE_LEAF_COUNT',
|
|
103
|
-
'L1_TO_L2_MSG_TREE_LEAF_COUNT'
|
|
107
|
+
'L1_TO_L2_MSG_TREE_LEAF_COUNT',
|
|
108
|
+
'FLAT_PUBLIC_LOGS_HEADER_LENGTH',
|
|
109
|
+
'FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH',
|
|
110
|
+
'PUBLIC_LOGS_LENGTH',
|
|
111
|
+
'PUBLIC_LOG_HEADER_LENGTH',
|
|
112
|
+
'MAX_PROTOCOL_CONTRACTS',
|
|
113
|
+
'DEFAULT_MAX_DEBUG_LOG_MEMORY_READS'
|
|
104
114
|
];
|
|
105
115
|
const CPP_GENERATORS = [
|
|
116
|
+
'BLOCK_HEADER_HASH',
|
|
106
117
|
'PARTIAL_ADDRESS',
|
|
107
118
|
'CONTRACT_ADDRESS_V1',
|
|
108
|
-
'
|
|
119
|
+
'CONTRACT_CLASS_ID',
|
|
109
120
|
'PUBLIC_KEYS_HASH',
|
|
110
121
|
'NOTE_HASH_NONCE',
|
|
111
122
|
'UNIQUE_NOTE_HASH',
|
|
112
123
|
'SILOED_NOTE_HASH',
|
|
113
|
-
'
|
|
114
|
-
'
|
|
124
|
+
'SILOED_NULLIFIER',
|
|
125
|
+
'PUBLIC_LEAF_SLOT',
|
|
126
|
+
'PUBLIC_STORAGE_MAP_SLOT',
|
|
115
127
|
'PUBLIC_CALLDATA',
|
|
116
128
|
'PUBLIC_BYTECODE'
|
|
117
129
|
];
|
|
118
130
|
const PIL_CONSTANTS = [
|
|
131
|
+
'MAX_ETH_ADDRESS_VALUE',
|
|
119
132
|
'MEM_TAG_U1',
|
|
120
133
|
'MEM_TAG_U8',
|
|
121
134
|
'MEM_TAG_U16',
|
|
@@ -128,8 +141,12 @@ const PIL_CONSTANTS = [
|
|
|
128
141
|
'AVM_BITWISE_XOR_OP_ID',
|
|
129
142
|
'AVM_KECCAKF1600_NUM_ROUNDS',
|
|
130
143
|
'AVM_KECCAKF1600_STATE_SIZE',
|
|
144
|
+
'AVM_TX_PHASE_VALUE_START',
|
|
145
|
+
'AVM_TX_PHASE_VALUE_SETUP',
|
|
146
|
+
'AVM_TX_PHASE_VALUE_LAST',
|
|
131
147
|
'AVM_HIGHEST_MEM_ADDRESS',
|
|
132
148
|
'AVM_MEMORY_NUM_BITS',
|
|
149
|
+
'AVM_MEMORY_SIZE',
|
|
133
150
|
'MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS',
|
|
134
151
|
'MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX',
|
|
135
152
|
'MAX_NOTE_HASHES_PER_TX',
|
|
@@ -142,8 +159,12 @@ const PIL_CONSTANTS = [
|
|
|
142
159
|
'L1_TO_L2_MSG_TREE_HEIGHT',
|
|
143
160
|
'UPDATED_CLASS_IDS_SLOT',
|
|
144
161
|
'UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN',
|
|
162
|
+
'CANONICAL_AUTH_REGISTRY_ADDRESS',
|
|
145
163
|
'CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS',
|
|
164
|
+
'CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS',
|
|
165
|
+
'MULTI_CALL_ENTRYPOINT_ADDRESS',
|
|
146
166
|
'FEE_JUICE_ADDRESS',
|
|
167
|
+
'PUBLIC_CHECKS_ADDRESS',
|
|
147
168
|
'FEE_JUICE_BALANCES_SLOT',
|
|
148
169
|
'TIMESTAMP_OF_CHANGE_BIT_SIZE',
|
|
149
170
|
'UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE',
|
|
@@ -156,7 +177,6 @@ const PIL_CONSTANTS = [
|
|
|
156
177
|
'MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS',
|
|
157
178
|
'MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX',
|
|
158
179
|
'MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX',
|
|
159
|
-
'PUBLIC_LOG_SIZE_IN_FIELDS',
|
|
160
180
|
'AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_ROW_IDX',
|
|
161
181
|
'AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_CHAIN_ID_ROW_IDX',
|
|
162
182
|
'AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_VERSION_ROW_IDX',
|
|
@@ -166,6 +186,7 @@ const PIL_CONSTANTS = [
|
|
|
166
186
|
'AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_COINBASE_ROW_IDX',
|
|
167
187
|
'AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_FEE_RECIPIENT_ROW_IDX',
|
|
168
188
|
'AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_GAS_FEES_ROW_IDX',
|
|
189
|
+
'AVM_PUBLIC_INPUTS_PROTOCOL_CONTRACTS_ROW_IDX',
|
|
169
190
|
'AVM_PUBLIC_INPUTS_START_TREE_SNAPSHOTS_ROW_IDX',
|
|
170
191
|
'AVM_PUBLIC_INPUTS_START_TREE_SNAPSHOTS_L1_TO_L2_MESSAGE_TREE_ROW_IDX',
|
|
171
192
|
'AVM_PUBLIC_INPUTS_START_TREE_SNAPSHOTS_NOTE_HASH_TREE_ROW_IDX',
|
|
@@ -216,7 +237,7 @@ const PIL_CONSTANTS = [
|
|
|
216
237
|
'AVM_SUBTRACE_ID_CAST',
|
|
217
238
|
'AVM_SUBTRACE_ID_SET',
|
|
218
239
|
'AVM_SUBTRACE_ID_BITWISE',
|
|
219
|
-
'
|
|
240
|
+
'AVM_SUBTRACE_ID_POSEIDON2_PERM',
|
|
220
241
|
'AVM_SUBTRACE_ID_TO_RADIX',
|
|
221
242
|
'AVM_SUBTRACE_ID_ECC',
|
|
222
243
|
'AVM_SUBTRACE_ID_KECCAKF1600',
|
|
@@ -227,10 +248,10 @@ const PIL_CONSTANTS = [
|
|
|
227
248
|
'AVM_DYN_GAS_ID_RETURNDATACOPY',
|
|
228
249
|
'AVM_DYN_GAS_ID_TORADIX',
|
|
229
250
|
'AVM_DYN_GAS_ID_BITWISE',
|
|
230
|
-
'
|
|
251
|
+
'AVM_DYN_GAS_ID_EMITPUBLICLOG',
|
|
231
252
|
'AVM_DYN_GAS_ID_SSTORE',
|
|
232
253
|
'AVM_SUBTRACE_ID_GETCONTRACTINSTANCE',
|
|
233
|
-
'
|
|
254
|
+
'AVM_SUBTRACE_ID_EMITPUBLICLOG',
|
|
234
255
|
'AVM_EXEC_OP_ID_GETENVVAR',
|
|
235
256
|
'AVM_EXEC_OP_ID_MOV',
|
|
236
257
|
'AVM_EXEC_OP_ID_JUMP',
|
|
@@ -271,35 +292,40 @@ const PIL_CONSTANTS = [
|
|
|
271
292
|
'AVM_RETRIEVED_BYTECODES_TREE_INITIAL_ROOT',
|
|
272
293
|
'AVM_RETRIEVED_BYTECODES_TREE_INITIAL_SIZE',
|
|
273
294
|
'NOTE_HASH_TREE_LEAF_COUNT',
|
|
274
|
-
'L1_TO_L2_MSG_TREE_LEAF_COUNT'
|
|
295
|
+
'L1_TO_L2_MSG_TREE_LEAF_COUNT',
|
|
296
|
+
'FLAT_PUBLIC_LOGS_HEADER_LENGTH',
|
|
297
|
+
'FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH',
|
|
298
|
+
'PUBLIC_LOGS_LENGTH',
|
|
299
|
+
'PUBLIC_LOG_HEADER_LENGTH',
|
|
300
|
+
'MAX_PROTOCOL_CONTRACTS'
|
|
275
301
|
];
|
|
276
302
|
const PIL_GENERATORS = [
|
|
277
303
|
'PARTIAL_ADDRESS',
|
|
278
304
|
'CONTRACT_ADDRESS_V1',
|
|
279
|
-
'
|
|
305
|
+
'CONTRACT_CLASS_ID',
|
|
280
306
|
'PUBLIC_KEYS_HASH',
|
|
281
307
|
'NOTE_HASH_NONCE',
|
|
282
308
|
'UNIQUE_NOTE_HASH',
|
|
283
309
|
'SILOED_NOTE_HASH',
|
|
284
|
-
'
|
|
285
|
-
'
|
|
310
|
+
'SILOED_NULLIFIER',
|
|
311
|
+
'PUBLIC_LEAF_SLOT',
|
|
312
|
+
'PUBLIC_STORAGE_MAP_SLOT',
|
|
286
313
|
'PUBLIC_CALLDATA',
|
|
287
314
|
'PUBLIC_BYTECODE'
|
|
288
315
|
];
|
|
289
316
|
const SOLIDITY_CONSTANTS = [
|
|
290
317
|
'MAX_FIELD_VALUE',
|
|
291
318
|
'MAX_L2_TO_L1_MSGS_PER_TX',
|
|
319
|
+
'EMPTY_EPOCH_OUT_HASH',
|
|
292
320
|
'L1_TO_L2_MSG_SUBTREE_HEIGHT',
|
|
293
321
|
'NUM_MSGS_PER_BASE_PARITY',
|
|
294
322
|
'NUM_BASE_PARITY_PER_ROOT_PARITY',
|
|
295
|
-
'PROPOSED_BLOCK_HEADER_LENGTH_BYTES',
|
|
296
323
|
'BLS12_POINT_COMPRESSED_BYTES',
|
|
297
324
|
'ROOT_ROLLUP_PUBLIC_INPUTS_LENGTH',
|
|
298
|
-
'
|
|
299
|
-
'INITIAL_L2_BLOCK_NUM',
|
|
325
|
+
'INITIAL_CHECKPOINT_NUMBER',
|
|
300
326
|
'GENESIS_ARCHIVE_ROOT',
|
|
301
327
|
'FEE_JUICE_ADDRESS',
|
|
302
|
-
'
|
|
328
|
+
'MAX_CHECKPOINTS_PER_EPOCH'
|
|
303
329
|
];
|
|
304
330
|
/**
|
|
305
331
|
* Processes a collection of constants and generates code to export them as TypeScript constants.
|
|
@@ -322,7 +348,7 @@ const SOLIDITY_CONSTANTS = [
|
|
|
322
348
|
*/ function processConstantsCpp(constants, generatorIndices) {
|
|
323
349
|
const code = [];
|
|
324
350
|
Object.entries(constants).forEach(([key, value])=>{
|
|
325
|
-
if (CPP_CONSTANTS.includes(key) || key.startsWith('AVM_')
|
|
351
|
+
if (CPP_CONSTANTS.includes(key) || key.startsWith('AVM_')) {
|
|
326
352
|
if (BigInt(value) <= 2n ** 31n - 1n) {
|
|
327
353
|
code.push(`#define ${key} ${value}`);
|
|
328
354
|
} else if (BigInt(value) <= 2n ** 64n - 1n) {
|
|
@@ -334,7 +360,7 @@ const SOLIDITY_CONSTANTS = [
|
|
|
334
360
|
});
|
|
335
361
|
Object.entries(generatorIndices).forEach(([key, value])=>{
|
|
336
362
|
if (CPP_GENERATORS.includes(key)) {
|
|
337
|
-
code.push(`#define
|
|
363
|
+
code.push(`#define DOM_SEP__${key} ${value}UL`);
|
|
338
364
|
}
|
|
339
365
|
});
|
|
340
366
|
return code.join('\n');
|
|
@@ -354,7 +380,7 @@ const SOLIDITY_CONSTANTS = [
|
|
|
354
380
|
});
|
|
355
381
|
Object.entries(generatorIndices).forEach(([key, value])=>{
|
|
356
382
|
if (PIL_GENERATORS.includes(key)) {
|
|
357
|
-
code.push(` pol
|
|
383
|
+
code.push(` pol DOM_SEP__${key} = ${value};`);
|
|
358
384
|
}
|
|
359
385
|
});
|
|
360
386
|
return code.join('\n');
|
|
@@ -391,30 +417,30 @@ const SOLIDITY_CONSTANTS = [
|
|
|
391
417
|
}
|
|
392
418
|
/**
|
|
393
419
|
* Generate the constants file in Typescript.
|
|
394
|
-
*/ function generateTypescriptConstants({ constants,
|
|
420
|
+
*/ function generateTypescriptConstants({ constants, domainSeparatorEnum }, targetPath) {
|
|
395
421
|
const result = [
|
|
396
422
|
'// GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants',
|
|
397
423
|
processConstantsTS(constants),
|
|
398
|
-
processEnumTS('
|
|
424
|
+
processEnumTS('DomainSeparator', domainSeparatorEnum)
|
|
399
425
|
].join('\n');
|
|
400
426
|
fs.writeFileSync(targetPath, result);
|
|
401
427
|
}
|
|
402
428
|
/**
|
|
403
429
|
* Generate the constants file in C++.
|
|
404
|
-
*/ function generateCppConstants({ constants,
|
|
430
|
+
*/ function generateCppConstants({ constants, domainSeparatorEnum }, targetPath) {
|
|
405
431
|
const resultCpp = `// GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants in yarn-project/constants
|
|
406
432
|
#pragma once
|
|
407
433
|
|
|
408
|
-
${processConstantsCpp(constants,
|
|
434
|
+
${processConstantsCpp(constants, domainSeparatorEnum)}
|
|
409
435
|
`;
|
|
410
436
|
fs.writeFileSync(targetPath, resultCpp);
|
|
411
437
|
}
|
|
412
438
|
/**
|
|
413
439
|
* Generate the constants file in PIL.
|
|
414
|
-
*/ function generatePilConstants({ constants,
|
|
440
|
+
*/ function generatePilConstants({ constants, domainSeparatorEnum }, targetPath) {
|
|
415
441
|
const resultPil = `// GENERATED FILE - DO NOT EDIT, RUN yarn remake-constants in yarn-project/constants
|
|
416
442
|
namespace constants;
|
|
417
|
-
${processConstantsPil(constants,
|
|
443
|
+
${processConstantsPil(constants, domainSeparatorEnum)}
|
|
418
444
|
\n`;
|
|
419
445
|
fs.writeFileSync(targetPath, resultPil);
|
|
420
446
|
}
|
|
@@ -444,7 +470,7 @@ ${processConstantsSolidity(constants)}
|
|
|
444
470
|
* Parse the content of the constants file in Noir.
|
|
445
471
|
*/ function parseNoirFile(fileContent) {
|
|
446
472
|
const constantsExpressions = [];
|
|
447
|
-
const
|
|
473
|
+
const domainSeparatorEnum = {};
|
|
448
474
|
const emptyExpression = ()=>({
|
|
449
475
|
name: '',
|
|
450
476
|
content: []
|
|
@@ -463,10 +489,10 @@ ${processConstantsSolidity(constants)}
|
|
|
463
489
|
{
|
|
464
490
|
const [, name, _type, value, end] = line.match(/global\s+(\w+)(\s*:\s*\w+)?\s*=\s*([^;]*)(;)?/) || [];
|
|
465
491
|
if (name && value) {
|
|
466
|
-
const [, indexName] = name.match(/
|
|
492
|
+
const [, indexName] = name.match(/DOM_SEP__(\w+)/) || [];
|
|
467
493
|
if (indexName) {
|
|
468
494
|
// Generator index.
|
|
469
|
-
|
|
495
|
+
domainSeparatorEnum[indexName] = +value;
|
|
470
496
|
} else if (end) {
|
|
471
497
|
// A single line of expression.
|
|
472
498
|
constantsExpressions.push([
|
|
@@ -514,7 +540,7 @@ ${processConstantsSolidity(constants)}
|
|
|
514
540
|
const constants = evaluateExpressions(constantsExpressions);
|
|
515
541
|
return {
|
|
516
542
|
constants,
|
|
517
|
-
|
|
543
|
+
domainSeparatorEnum
|
|
518
544
|
};
|
|
519
545
|
}
|
|
520
546
|
/**
|
|
@@ -535,8 +561,9 @@ ${processConstantsSolidity(constants)}
|
|
|
535
561
|
// be a bigint, even the actual constant values!
|
|
536
562
|
const prelude = expressions.map(([name, rhs])=>{
|
|
537
563
|
const guardedRhs = rhs// Remove 'as u8', 'as u32' and 'as u64' castings
|
|
538
|
-
.replaceAll(' as u8', '').replaceAll(' as u32', '').replaceAll(' as u64', '')// Remove the 'AztecAddress::from_field(...)' pattern
|
|
539
|
-
|
|
564
|
+
.replaceAll(' as u8', '').replaceAll(' as u32', '').replaceAll(' as u64', '')// Remove the 'AztecAddress::from_field(...)' pattern.
|
|
565
|
+
// Also copes with the noir formatter re-formatting over multiple lines.
|
|
566
|
+
.replace(/AztecAddress::from_field\(\s*(0x[a-fA-F0-9]+|\d+)\s*,?\s*\)/gs, '$1')// We make some space around the parentheses, so that constant numbers are still split.
|
|
540
567
|
.replace(/\(/g, '( ').replace(/\)/g, ' )')// We also make some space around common operators
|
|
541
568
|
.replace(/\+/g, ' + ').replace(/(?<!\/)\*(?!\/)/, ' * ')// We split the expression into terms...
|
|
542
569
|
.split(/\s+/)// ...and then we convert each term to a BigInt if it is a number.
|
package/package.json
CHANGED
|
@@ -1,27 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/constants",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6-commit.a2d1860fe9",
|
|
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.6-commit.a2d1860fe9",
|
|
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",
|