From 394a0e06928946c1c9eea1bdfec39269cb2d601a Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 12 Mar 2024 20:16:52 +0000 Subject: [PATCH] fix: constant gen (#5172) Not sure if this will fix the breakage. --- l1-contracts/slither_output.md | 8 ++++---- l1-contracts/src/core/libraries/ConstantsGen.sol | 1 + yarn-project/circuits.js/src/constants.gen.ts | 1 + yarn-project/circuits.js/src/scripts/constants.in.ts | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/l1-contracts/slither_output.md b/l1-contracts/slither_output.md index 1d5dc10c830..3fb86f9058f 100644 --- a/l1-contracts/slither_output.md +++ b/l1-contracts/slither_output.md @@ -321,15 +321,15 @@ src/core/messagebridge/Inbox.sol#L148-L153 Impact: Informational Confidence: Medium - [ ] ID-35 -Variable [Constants.LOGS_HASHES_NUM_BYTES_PER_BASE_ROLLUP](src/core/libraries/ConstantsGen.sol#L131) is too similar to [Constants.NOTE_HASHES_NUM_BYTES_PER_BASE_ROLLUP](src/core/libraries/ConstantsGen.sol#L124) +Variable [Constants.LOGS_HASHES_NUM_BYTES_PER_BASE_ROLLUP](src/core/libraries/ConstantsGen.sol#L132) is too similar to [Constants.NOTE_HASHES_NUM_BYTES_PER_BASE_ROLLUP](src/core/libraries/ConstantsGen.sol#L125) -src/core/libraries/ConstantsGen.sol#L131 +src/core/libraries/ConstantsGen.sol#L132 - [ ] ID-36 -Variable [Constants.L1_TO_L2_MESSAGE_LENGTH](src/core/libraries/ConstantsGen.sol#L111) is too similar to [Constants.L2_TO_L1_MESSAGE_LENGTH](src/core/libraries/ConstantsGen.sol#L112) +Variable [Constants.L1_TO_L2_MESSAGE_LENGTH](src/core/libraries/ConstantsGen.sol#L112) is too similar to [Constants.L2_TO_L1_MESSAGE_LENGTH](src/core/libraries/ConstantsGen.sol#L113) -src/core/libraries/ConstantsGen.sol#L111 +src/core/libraries/ConstantsGen.sol#L112 - [ ] ID-37 diff --git a/l1-contracts/src/core/libraries/ConstantsGen.sol b/l1-contracts/src/core/libraries/ConstantsGen.sol index c953f7d54ea..67c6755e781 100644 --- a/l1-contracts/src/core/libraries/ConstantsGen.sol +++ b/l1-contracts/src/core/libraries/ConstantsGen.sol @@ -77,6 +77,7 @@ library Constants { uint256 internal constant NUM_FIELDS_PER_SHA256 = 2; uint256 internal constant ARGS_HASH_CHUNK_LENGTH = 32; uint256 internal constant ARGS_HASH_CHUNK_COUNT = 32; + uint256 internal constant INITIALIZATION_SLOT_SEPARATOR = 1000_000_000; uint256 internal constant INITIAL_L2_BLOCK_NUM = 1; uint256 internal constant BLOB_SIZE_IN_BYTES = 126976; uint256 internal constant MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS = 15000; diff --git a/yarn-project/circuits.js/src/constants.gen.ts b/yarn-project/circuits.js/src/constants.gen.ts index a0af43b2763..0747f1bb5f9 100644 --- a/yarn-project/circuits.js/src/constants.gen.ts +++ b/yarn-project/circuits.js/src/constants.gen.ts @@ -63,6 +63,7 @@ export const FUNCTION_SELECTOR_NUM_BYTES = 4; export const NUM_FIELDS_PER_SHA256 = 2; export const ARGS_HASH_CHUNK_LENGTH = 32; export const ARGS_HASH_CHUNK_COUNT = 32; +export const INITIALIZATION_SLOT_SEPARATOR = 1000_000_000; export const INITIAL_L2_BLOCK_NUM = 1; export const BLOB_SIZE_IN_BYTES = 126976; export const MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS = 15000; diff --git a/yarn-project/circuits.js/src/scripts/constants.in.ts b/yarn-project/circuits.js/src/scripts/constants.in.ts index 24adac53595..6a5f0f94e2c 100644 --- a/yarn-project/circuits.js/src/scripts/constants.in.ts +++ b/yarn-project/circuits.js/src/scripts/constants.in.ts @@ -122,7 +122,7 @@ function parseNoirFile(fileContent: string): ParsedContent { return; } - const [, name, _type, value] = line.match(/global\s+(\w+)(\s*:\s*\w+)?\s*=\s*(0x[a-fA-F0-9]+|\d+);/) || []; + const [, name, _type, value] = line.match(/global\s+(\w+)(\s*:\s*\w+)?\s*=\s*(0x[a-fA-F0-9]+|[\d_]+);/) || []; if (!name || !value) { // eslint-disable-next-line no-console console.warn(`Unknown content: ${line}`);