Skip to content

Add LZ Infra Constants#16

Closed
dhruvinparikh wants to merge 14 commits into
FraxFinance:masterfrom
dhruvinparikh:feat/lz-mesh-constants
Closed

Add LZ Infra Constants#16
dhruvinparikh wants to merge 14 commits into
FraxFinance:masterfrom
dhruvinparikh:feat/lz-mesh-constants

Conversation

@dhruvinparikh
Copy link
Copy Markdown
Contributor

add LZ infra, chain IDs, hops, monad, stable constants for frax-lz-mesh

Copilot AI review requested due to automatic review settings February 10, 2026 02:10
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

This PR expands the scripts/constants/* network constant modules to include LayerZero infra addresses (endpoint + libs + block send lib + proxy admin) and adds LayerZero chain IDs + EVM chain IDs for additional networks in support of the frax-lz-mesh tooling.

Changes:

  • Add LayerZeroInfra constants and LZ_CHAIN_ID / CHAIN_ID entries across many existing network constant files.
  • Add new constants modules for stable and monad, and export them from scripts/constants/index.ts.
  • Update/normalize a few existing constants (e.g., Scroll OFT addresses; Solana semicolons) while adding the new infra constants.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
scripts/constants/abstract.ts Add LayerZero infra constants + chain IDs.
scripts/constants/aptos.ts Add LayerZero infra constants + chain IDs.
scripts/constants/arbitrum.ts Add LayerZero infra constants + chain IDs.
scripts/constants/aurora.ts Add LayerZero infra constants + chain IDs.
scripts/constants/avalanche.ts Add LayerZero infra constants + chain IDs.
scripts/constants/base.ts Add LayerZero infra constants + chain IDs.
scripts/constants/bera.ts Add LayerZero infra constants + chain IDs.
scripts/constants/blast.ts Add LayerZero infra constants + chain IDs.
scripts/constants/bsc.ts Add LayerZero infra constants + chain IDs.
scripts/constants/ethereum.ts Add LayerZero infra constants + chain IDs.
scripts/constants/fraxtal-l2.ts Add LayerZero infra constants + chain IDs.
scripts/constants/hyperliquid.ts Fill in hop addresses; add LayerZero infra constants + chain IDs.
scripts/constants/ink.ts Add LayerZero infra constants + chain IDs.
scripts/constants/katana.ts Add LayerZero infra constants + chain IDs.
scripts/constants/linea.ts Add LayerZero infra constants + chain IDs.
scripts/constants/mode.ts Add LayerZero infra constants + chain IDs.
scripts/constants/monad.ts New network constants module including infra + chain IDs.
scripts/constants/movement.ts Add LayerZero infra constants + chain IDs.
scripts/constants/optimism.ts Add LayerZero infra constants + chain IDs.
scripts/constants/plumephoenix.ts Add LayerZero infra constants + chain IDs.
scripts/constants/polygon.ts Add LayerZero infra constants + chain IDs.
scripts/constants/scroll.ts Update OFT addresses; add LayerZero infra constants + chain IDs.
scripts/constants/sei.ts Add LayerZero infra constants + chain IDs.
scripts/constants/solana.ts Add semicolons; add LayerZero infra constants + chain IDs.
scripts/constants/sonic.ts Add LayerZero infra constants + chain IDs.
scripts/constants/stable.ts New network constants module including infra + chain IDs.
scripts/constants/unichain.ts Add LayerZero infra constants + chain IDs.
scripts/constants/worldchain.ts Add LayerZero infra constants + chain IDs.
scripts/constants/xlayer.ts Add LayerZero infra constants + chain IDs.
scripts/constants/zksync.ts Add LayerZero infra constants + chain IDs.
scripts/constants/index.ts Export new constants modules (Monad/Movement/Stable/Sei) and fix missing semicolons.
Comments suppressed due to low confidence (1)

scripts/constants/fraxtal-l2.ts:1

  • Assignment to variable CHAIN_ID, which is declared constant.
export const CHAIN_ID = 252;

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

export * as Unichain from "./unichain";
export * as Worldchain from "./worldchain";
export * as XLayer from "./xlayer";
export * as ZkSync from "./zksync";
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

scripts/generateConstants.ts relies on networkPrefixes[networkName] to build label strings, but this PR adds new exported networks (e.g., Monad/Movement/Stable) that do not exist in the networkPrefixes map. When npm run generate:constants runs, these will produce labels like Constants.undefined_<KEY>, and some existing entries also appear to differ in casing (e.g., Base vs BASE, ZkSync vs Zksync), which has the same effect. Consider updating networkPrefixes to include the new exports and align key casing with the names exported from this index file, or make the generator fall back to networkName when no prefix exists.

Suggested change
export * as ZkSync from "./zksync";
export * as Zksync from "./zksync";

Copilot uses AI. Check for mistakes.
Comment thread scripts/constants/solana.ts Outdated
Comment on lines +14 to +18
// LayerZeroInfra
export const LZ_ENDPOINT = "76y77prsiCMvXMjuoZ5VRrhG5qYBrUMYTE5WgHqgjEn6";
export const LZ_RECEIVE_LIB_302 = "7a4WjyR8VZ7yZz5XJAKm39BUGn5iT9CKcv2pmG9tdXVH";
export const LZ_SEND_LIB_302 = "7a4WjyR8VZ7yZz5XJAKm39BUGn5iT9CKcv2pmG9tdXVH";
export const LZ_BLOCK_SEND_LIB = "2XrYqmhBMPJgDsb4SVbjV1PnJBprurd5bzRCkHwiFCJB";
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

These new Solana LayerZero infra values are non-0x strings (base58). scripts/generateConstants.ts currently emits vm.label(${value}, ...) without quotes for every non-number constant, which will generate invalid Solidity for these entries (e.g., vm.label(76y77..., ...)). Consider updating the generator to only label EVM address-shaped values (e.g., 0x + 40 hex chars) or skipping labeling for Solana/string constants.

Copilot uses AI. Check for mistakes.
Comment thread scripts/constants/aptos.ts Outdated
Comment on lines +17 to +22
// LayerZeroInfra
export const LZ_ENDPOINT = "0xe60045e20fc2c99e869c1c34a65b9291c020cd12a0d37a00a53ac1348af4f43c";
export const LZ_RECEIVE_LIB_302 = "0xc33752e0220faf79e45385dd73fb28d681dcd9f1569a1480725507c1f3c3aba9";
export const LZ_SEND_LIB_302 = "0xc33752e0220faf79e45385dd73fb28d681dcd9f1569a1480725507c1f3c3aba9";
export const LZ_BLOCK_SEND_LIB = "0x3ca0d187f1938cf9776a0aa821487a650fc7bb2ab1c1d241ba319192aae4afc6";

Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

These newly added LayerZero infra constants are 0x-prefixed 32-byte hex strings (not 20-byte EVM addresses). scripts/generateConstants.ts currently treats any 0x... string as a Solidity address literal and also passes it to vm.label(...), which will cause the generated Solidity to fail to compile for Aptos. Consider tightening the generator’s address detection (e.g., require 20-byte length) and emitting bytes32/string for non-address hex values, or excluding non-EVM networks from Solidity constant generation.

Copilot uses AI. Check for mistakes.
Comment thread scripts/constants/movement.ts Outdated
Comment on lines +17 to +22
// LayerZeroInfra
export const LZ_ENDPOINT = "0xe60045e20fc2c99e869c1c34a65b9291c020cd12a0d37a00a53ac1348af4f43c";
export const LZ_RECEIVE_LIB_302 = "0xc33752e0220faf79e45385dd73fb28d681dcd9f1569a1480725507c1f3c3aba9";
export const LZ_SEND_LIB_302 = "0xc33752e0220faf79e45385dd73fb28d681dcd9f1569a1480725507c1f3c3aba9";
export const LZ_BLOCK_SEND_LIB = "0x3ca0d187f1938cf9776a0aa821487a650fc7bb2ab1c1d241ba319192aae4afc6";

Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

These newly added LayerZero infra constants are 0x-prefixed 32-byte hex strings (not 20-byte EVM addresses). scripts/generateConstants.ts currently treats any 0x... string as a Solidity address literal and also passes it to vm.label(...), which will cause the generated Solidity to fail to compile for Movement. Consider tightening the generator’s address detection (e.g., require 20-byte length) and emitting bytes32/string for non-address hex values, or excluding non-EVM networks from Solidity constant generation.

Copilot uses AI. Check for mistakes.
Comment thread scripts/constants/fraxtal-l2.ts Outdated

// Chain IDs
export const LZ_CHAIN_ID = 30255;
export const CHAIN_ID = 252;
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Assignment to variable CHAIN_ID, which is declared constant.

Suggested change
export const CHAIN_ID = 252;

Copilot uses AI. Check for mistakes.
Remove LZ_ENDPOINT, LZ_SEND_LIB_302, LZ_RECEIVE_LIB_302,
LZ_BLOCK_SEND_LIB, LZ_CHAIN_ID, and CHAIN_ID from all chain
constant files. These values are now sourced at runtime from
the LayerZero metadata API.
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

Copilot reviewed 88 out of 90 changed files in this pull request and generated 4 comments.


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

Comment on lines +66 to +71
Aurora: "AUR",
Avalanche: "AVAX",
BASE: "BASE",
BERA: "BERA",
BLAST: "BLAST",
BSC: "BSC",
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

networkPrefixes keys don't match the actual exported network names from scripts/constants/index (e.g., constants exposes Base, Bera, Blast, ZkSync, but this map uses BASE, BERA, BLAST, Zksync). This causes networkPrefixes[networkName] to be undefined for those networks, producing mislabeled constants in the generated Solidity. Align the keys with the module export names (or normalize networkName before lookup / provide a fallback).

Copilot uses AI. Check for mistakes.
Comment on lines +123 to +134
if (typeof value === "string") {
// Determine whether it is an address or a string
if (value.startsWith("0x")) {
return ` address internal constant ${key} = ${value};`;
}
return ` string internal constant ${key} = "${value}";`;
} else {
// number
// Note the value is a number
numberValues.push(value);
return ` uint256 internal constant ${key} = ${value};`;
}
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

Address detection is currently value.startsWith("0x"), which will misclassify non-address hex strings (e.g., 32-byte IDs in Aptos/Movement constants) as address and generate invalid Solidity literals. Consider validating EVM addresses by length/hex (0x + 40 hex chars) and handling other hex strings as bytes32/bytes/string as appropriate.

Copilot uses AI. Check for mistakes.
Comment on lines +157 to +163
const labelStrings = Object.entries(constantsToLabel)
.map(([key, value]) => {
// Add the value to the seen list
seenValues.push(value);
// Return the string
return ` vm.label(${value}, "Constants.${networkPrefixes[networkName]}_${key}");`;
})
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

vm.label(${value}, ...) assumes value is an address literal. For constants that are plain strings (e.g., Solana base58 IDs) this will emit invalid Solidity (unquoted identifiers) and fail compilation. Restrict labeling to verified EVM address constants (and skip labeling for non-address types).

Copilot uses AI. Check for mistakes.
Comment on lines 1 to 3
// Canonicals
export const FRXUSD = "0xFc00000000000000000000000000000000000001";
export const WFRAX = "0xFc00000000000000000000000000000000000002";
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

CHAIN_ID was removed from this TS constants module, but other network modules (and the existing fraxtal-l2.js) export it. This creates an inconsistent API surface for FraxtalL2 and can break TypeScript consumers expecting CHAIN_ID. Re-add export const CHAIN_ID = 252; (or remove it everywhere consistently) and regenerate any derived JS if applicable.

Copilot uses AI. Check for mistakes.
@dhruvinparikh
Copy link
Copy Markdown
Contributor Author

in favour of #9

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.

2 participants