Skip to content

Feat/lzconstants#9

Open
dhruvinparikh wants to merge 34 commits into
FraxFinance:masterfrom
dhruvinparikh:feat/lzconstants
Open

Feat/lzconstants#9
dhruvinparikh wants to merge 34 commits into
FraxFinance:masterfrom
dhruvinparikh:feat/lzconstants

Conversation

@dhruvinparikh
Copy link
Copy Markdown
Contributor

No description provided.

@pegahcarter
Copy link
Copy Markdown
Contributor

Good to merge once issues are resolved.

Copilot AI review requested due to automatic review settings February 18, 2026 01:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds LayerZero/OFT-related constants for multiple networks and updates the constants generator + tooling so these constants are emitted into per-chain Solidity libraries (and a combined src/Constants.sol) and labeled in Foundry tests.

Changes:

  • Add new generated chain-constants Solidity files for several additional networks (e.g., Base, Blast, Scroll, Solana, ZkSync, etc.).
  • Extend existing network constant libraries with new OFT + hop-related addresses (e.g., Mainnet/Arbitrum/Optimism/Polygon/BSC/Avalanche).
  • Update scripts/generateConstants.ts to (a) generate a combined src/Constants.sol and (b) classify 0x… strings as either address or bytes32 (via viem’s isAddress).

Reviewed changes

Copilot reviewed 38 out of 41 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/contracts/chain-constants/Abstract.sol New generated constants + labels for Abstract network.
src/contracts/chain-constants/Aptos.sol New generated bytes32 constants for Aptos.
src/contracts/chain-constants/Arbitrum.sol Add OFT + hop constants and labels.
src/contracts/chain-constants/Aurora.sol New generated OFT + hop constants and labels.
src/contracts/chain-constants/Avalanche.sol Add OFT + hop constants and labels.
src/contracts/chain-constants/Base.sol New generated OFT + hop constants and labels.
src/contracts/chain-constants/Bera.sol New generated OFT + hop constants and labels.
src/contracts/chain-constants/Blast.sol New generated OFT + hop constants and labels.
src/contracts/chain-constants/BSC.sol Add OFT + hop constants; label output now uses Constants.undefined_* (likely generator bug).
src/contracts/chain-constants/FraxtalL2.sol Rename FRAX/FXS to FRXUSD/WFRAX (+ proxy names), add OFT + hop constants/labels, plus new FXB/oracle/pair constants.
src/contracts/chain-constants/FraxtalTestnetL1.sol Normalize CHAIN_ID formatting.
src/contracts/chain-constants/Holesky.sol Normalize CHAIN_ID formatting.
src/contracts/chain-constants/Hyperliquid.sol New generated OFT + hop constants/labels; appears inconsistent with TS source constants.
src/contracts/chain-constants/Ink.sol New generated OFT + hop constants and labels.
src/contracts/chain-constants/Katana.sol New generated OFT + hop constants and labels.
src/contracts/chain-constants/Linea.sol New generated OFT + hop constants and labels.
src/contracts/chain-constants/Mainnet.sol Add OFT + hop constants and labels.
src/contracts/chain-constants/Mode.sol New generated OFT + hop constants/labels; label prefix is undefined.
src/contracts/chain-constants/Movement.sol New generated bytes32 constants for Movement.
src/contracts/chain-constants/Optimism.sol Add OFT + hop constants and labels.
src/contracts/chain-constants/Plumephoenix.sol New generated OFT + hop constants and labels.
src/contracts/chain-constants/Polygon.sol Add OFT + hop constants and labels.
src/contracts/chain-constants/PolygonzkEVM.sol Add OFT + hop constants and labels.
src/contracts/chain-constants/Scroll.sol New generated OFT + hop constants and labels.
src/contracts/chain-constants/Solana.sol New generated string + bytes32 constants for Solana.
src/contracts/chain-constants/Sonic.sol New generated OFT + hop constants and labels.
src/contracts/chain-constants/Unichain.sol New generated OFT + hop constants and labels.
src/contracts/chain-constants/Worldchain.sol New generated OFT + hop constants and labels.
src/contracts/chain-constants/XLayer.sol New generated OFT + hop constants and labels.
src/contracts/chain-constants/ZkSync.sol New generated OFT + hop constants/labels; label prefix is undefined.
src/Constants.sol Generate/extend combined constants file; contains the same undefined_* labels + a Hyperliquid inconsistency.
scripts/generateConstants.ts Add viem address detection, write combined src/Constants.sol, adjust per-network helper generation.
scripts/constants/index.ts Export new Movement constants module.
scripts/constants/mainnet.ts Add LayerZero + hop constants for Mainnet.
scripts/constants/solana.ts Formatting-only change.
scripts/constants/TEMPLATE.ts Add new section headers for LayerZero + hop constants.
.github/workflows/main.yml Update actions versions, Node 20, pnpm v10, and install command.
.husky/pre-commit Add pre-commit hook (but missing Husky wrapper).
package.json Add viem dependency.
pnpm-workspace.yaml Add pnpm workspace config / onlyBuiltDependencies list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +15 to +16
address internal constant REMOTEHOP = 0x8EbB34b1880B2EA5e458082590B3A2c9Ea7C41A2;
address internal constant REMOTEMINTREDEEMHOP = 0xb85A8FDa7F5e52E32fa5582847CFfFee9456a5Dc;
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scripts/constants/hyperliquid.ts currently defines REMOTEHOP / REMOTEMINTREDEEMHOP as empty strings, but this generated file hard-codes them as addresses. Re-running the generator is likely to overwrite or otherwise diverge; update the source constants (or adjust generation) so the generated Solidity is deterministic and consistent with its inputs.

Copilot uses AI. Check for mistakes.
Comment thread scripts/generateConstants.ts Outdated
Comment on lines +42 to +44
Linea: "LINEA",
Zksync:"ZKSYNC"
XLayer: "XLAYER",
Zksync: "ZKSYNC"
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ZkSync is exported with that casing, but networkPrefixes uses Zksync. This mismatch causes networkPrefixes[networkName] to be undefined and results in Constants.undefined_* labels in generated Solidity. Rename the key to ZkSync and consider failing generation when a prefix is missing.

Copilot uses AI. Check for mistakes.
Comment thread scripts/generateConstants.ts Outdated
Comment on lines 139 to 140
return ` vm.label(${value}, "Constants.${networkPrefixes[networkName]}_${key}");`;
})
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

labelStrings always emits vm.label(${value}, ...), but vm.label only accepts address. Since the generator now supports bytes32 (and some networks may have non-address strings), this can produce invalid Solidity. Consider filtering constantsToLabel so only isAddress(value) === true entries generate labels, and skip/omit everything else.

Copilot uses AI. Check for mistakes.
Comment thread src/Constants.sol Outdated
Comment on lines +1453 to +1455
address internal constant WFRAXOFT = 0x64445f0aecC51E94aD52d8AC56b7190e764E561a;
string internal constant REMOTEHOP = "";
string internal constant REMOTEMINTREDEEMHOP = "";
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this combined constants file, Hyperliquid.REMOTEHOP / REMOTEMINTREDEEMHOP are generated as empty strings, but the associated AddressHelperHyperliquid labels hard-coded addresses. This inconsistency suggests the generator is labeling non-address constants (or the source constants are out of sync). Make the library constants and labels derive from the same source-of-truth (and only label address constants).

Copilot uses AI. Check for mistakes.
Comment thread src/contracts/chain-constants/BSC.sol Outdated
Comment on lines +67 to +71
vm.label(0x90C97F71E18723b0Cf0dfa30ee176Ab653E89F40, "Constants.undefined_FRAX");
vm.label(0xe48A3d7d0Bc88d552f730B62c006bC925eadB9eE, "Constants.undefined_FXS");
vm.label(0x2Dd1B4D4548aCCeA497050619965f91f78b3b532, "Constants.undefined_FPI");
vm.label(0xD1738eB733A636d1b8665f48bC8a24dA889c2562, "Constants.undefined_FPIS");
vm.label(0x64048A7eEcF3a2F1BA9e144aAc3D7dB6e58F555e, "Constants.undefined_FRXETH");
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated label names use the literal prefix "Constants.undefined_…", which indicates the generator didn’t resolve a network prefix for BSC. This makes address labels much less useful and suggests networkPrefixes["BSC"] was missing/undefined at generation time; the generator should fail fast rather than emitting undefined_* labels.

Copilot uses AI. Check for mistakes.
Comment on lines +25 to +29
vm.label(0x580F2ee1476eDF4B1760bd68f6AaBaD57dec420E, "Constants.undefined_FPIOFT");
vm.label(0xc7Ab797019156b543B7a3fBF5A99ECDab9eb4440, "Constants.undefined_FRXETHOFT");
vm.label(0xEa77c590Bb36c43ef7139cE649cFBCFD6163170d, "Constants.undefined_FRXUSDOFT");
vm.label(0xFD78FD3667DeF2F1097Ed221ec503AE477155394, "Constants.undefined_SFRXETHOFT");
vm.label(0x9F87fbb47C33Cd0614E43500b9511018116F79eE, "Constants.undefined_SFRXUSDOFT");
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These labels are generated as Constants.undefined_*, which indicates the generator didn’t resolve a network prefix for ZkSync (likely a ZkSync vs Zksync key mismatch). Fix the generator mapping (and fail fast when missing) so labels become Constants.ZKSYNC_* (or the intended prefix).

Copilot uses AI. Check for mistakes.
version: stable
- run: forge --version
- run: pnpm i
- run: pnpm install --no-frozen-lockfile
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI installs dependencies with --no-frozen-lockfile even though a pnpm-lock.yaml is present. This can make builds non-reproducible (and can pull newer transitive deps than what was reviewed). Prefer pnpm install --frozen-lockfile in CI and ensure the lockfile is kept up to date in PRs.

Suggested change
- run: pnpm install --no-frozen-lockfile
- run: pnpm install --frozen-lockfile

Copilot uses AI. Check for mistakes.
Comment thread src/contracts/chain-constants/Mode.sol Outdated
Comment on lines +25 to +32
vm.label(0x90581eCa9469D8D7F5D3B60f4715027aDFCf7927, "Constants.undefined_FPIOFT");
vm.label(0x43eDD7f3831b08FE70B7555ddD373C8bF65a9050, "Constants.undefined_FRXETHOFT");
vm.label(0x80Eede496655FB9047dd39d9f418d5483ED600df, "Constants.undefined_FRXUSDOFT");
vm.label(0x3Ec3849C33291a9eF4c5dB86De593EB4A37fDe45, "Constants.undefined_SFRXETHOFT");
vm.label(0x5Bff88cA1442c2496f7E475E9e7786383Bc070c0, "Constants.undefined_SFRXUSDOFT");
vm.label(0x64445f0aecC51E94aD52d8AC56b7190e764E561a, "Constants.undefined_WFRAXOFT");
vm.label(0x486CB4788F1bE7cdEf9301a7a637B451df3Cf262, "Constants.undefined_REMOTEHOP");
vm.label(0x7360575f6f8F91b38dD078241b0Df508f5fBfDf9, "Constants.undefined_REMOTEMINTREDEEMHOP");
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These labels are generated as Constants.undefined_*, which indicates the generator didn’t resolve a network prefix for Mode. Add a Mode entry to networkPrefixes (and fail fast when missing) so the label prefix is stable and meaningful.

Suggested change
vm.label(0x90581eCa9469D8D7F5D3B60f4715027aDFCf7927, "Constants.undefined_FPIOFT");
vm.label(0x43eDD7f3831b08FE70B7555ddD373C8bF65a9050, "Constants.undefined_FRXETHOFT");
vm.label(0x80Eede496655FB9047dd39d9f418d5483ED600df, "Constants.undefined_FRXUSDOFT");
vm.label(0x3Ec3849C33291a9eF4c5dB86De593EB4A37fDe45, "Constants.undefined_SFRXETHOFT");
vm.label(0x5Bff88cA1442c2496f7E475E9e7786383Bc070c0, "Constants.undefined_SFRXUSDOFT");
vm.label(0x64445f0aecC51E94aD52d8AC56b7190e764E561a, "Constants.undefined_WFRAXOFT");
vm.label(0x486CB4788F1bE7cdEf9301a7a637B451df3Cf262, "Constants.undefined_REMOTEHOP");
vm.label(0x7360575f6f8F91b38dD078241b0Df508f5fBfDf9, "Constants.undefined_REMOTEMINTREDEEMHOP");
vm.label(0x90581eCa9469D8D7F5D3B60f4715027aDFCf7927, "Constants.mode_FPIOFT");
vm.label(0x43eDD7f3831b08FE70B7555ddD373C8bF65a9050, "Constants.mode_FRXETHOFT");
vm.label(0x80Eede496655FB9047dd39d9f418d5483ED600df, "Constants.mode_FRXUSDOFT");
vm.label(0x3Ec3849C33291a9eF4c5dB86De593EB4A37fDe45, "Constants.mode_SFRXETHOFT");
vm.label(0x5Bff88cA1442c2496f7E475E9e7786383Bc070c0, "Constants.mode_SFRXUSDOFT");
vm.label(0x64445f0aecC51E94aD52d8AC56b7190e764E561a, "Constants.mode_WFRAXOFT");
vm.label(0x486CB4788F1bE7cdEf9301a7a637B451df3Cf262, "Constants.mode_REMOTEHOP");
vm.label(0x7360575f6f8F91b38dD078241b0Df508f5fBfDf9, "Constants.mode_REMOTEMINTREDEEMHOP");

Copilot uses AI. Check for mistakes.
Comment thread scripts/generateConstants.ts Outdated
else if (value.length === 66) {
return ` bytes32 internal constant ${key} = ${value};`;
} else {
throw new Error("Unidentifed constant type")
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in error message: "Unidentifed" → "Unidentified". Also consider including the key/value in the error to make debugging generation failures easier.

Suggested change
throw new Error("Unidentifed constant type")
throw new Error(`Unidentified constant type for key "${key}" with value "${value}"`);

Copilot uses AI. Check for mistakes.
Adopt master's consolidated-only Constants.sol design (Registry FraxFinance#21);
drop per-chain chain-constants/*.sol files.

Preserve branch additions:
- Movement: MOVE prefix entry (bytes32, non-EVM)

Regenerated src/Constants.sol using master's generator with
getAddress EIP-55 checksumming and bytes32 support.
Integrate remote branch tip (b87c023 - older master merge) with local
tip (08751f2 - newer master merge including Registry FraxFinance#21).

Regenerated src/Constants.sol to canonical form.
Kept local pnpm-lock.yaml (aligned with newer master).
Accept master's additive changes to CompilanceTests.t.sol
(imports + bridge/minter/ownership/supportsInterface test suites).
Fix pnpm lint:check failure on CI by running prettier --write
on the generated src/Constants.sol.
- Add Tempo (4217) and Somnia (5031) chain constants (OFTs, FRAX_PROXY_ADMIN, HopV2)
- Add Tempo-specific FRXUSD_POLICY_ADMIN and FRXUSD_TIP20
- Wire Tempo/Somnia into scripts/constants/index.ts
- Resolve conflicts in ethereum.ts and fraxtal-l2.ts (keep branch additions)
- Restore CHAIN_ID = 252 on fraxtal-l2.ts (silently dropped during merge)
- Add CHAIN_ID export to all EVM chain constants files (source: L0Config.json)
- Move FRAX_PROXY_ADMIN under // LayerZero section (it is Frax proxy admin,
  not LZ infra); drop orphan // LayerZeroInfra headers
- Add HopV2 addresses to Aurora and XLayer (per hop-v2/README.md §8)
- Strip compiled .js/.d.ts artifacts to match master (ts-only)
- Regenerate src/Constants.sol (46 libraries); prettier-formatted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants