-
Notifications
You must be signed in to change notification settings - Fork 29
Add Linea to suppored chains #636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughA new chain identifier Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/config/src/chains/types.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: alfetopito
PR: cowprotocol/cow-sdk#391
File: src/trading/getEthFlowTransaction.ts:80-85
Timestamp: 2025-08-12T09:15:28.459Z
Learning: In the CoW SDK codebase, ETH_FLOW_ADDRESSES and BARN_ETH_FLOW_ADDRESSES are typed as Record<SupportedChainId, string>, which requires all SupportedChainId enum values to have corresponding string entries. TypeScript compilation will fail if any chainId is missing from these mappings, making runtime guards for missing addresses unnecessary in these specific cases.
📚 Learning: 2025-03-21T15:14:59.767Z
Learnt from: anxolin
PR: cowprotocol/cow-sdk#251
File: src/bridging/providers/across/AcrossApi.ts:5-10
Timestamp: 2025-03-21T15:14:59.767Z
Learning: In AcrossApi.ts, interfaces like AvailableRoutesRequest and Route use string types for chain IDs (originChainId, destinationChainId) because they're mapping to an external API contract from Across, which expects chain IDs as strings, rather than using internal enum types like TargetChainId.
Applied to files:
packages/config/src/chains/types.ts
📚 Learning: 2025-08-12T09:15:28.459Z
Learnt from: alfetopito
PR: cowprotocol/cow-sdk#391
File: src/trading/getEthFlowTransaction.ts:80-85
Timestamp: 2025-08-12T09:15:28.459Z
Learning: In the CoW SDK codebase, ETH_FLOW_ADDRESSES and BARN_ETH_FLOW_ADDRESSES are typed as Record<SupportedChainId, string>, which requires all SupportedChainId enum values to have corresponding string entries. TypeScript compilation will fail if any chainId is missing from these mappings, making runtime guards for missing addresses unnecessary in these specific cases.
Applied to files:
packages/config/src/chains/types.ts
| BASE = 8453, | ||
| ARBITRUM_ONE = 42161, | ||
| AVALANCHE = 43114, | ||
| LINEA = 59144, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify all chain-specific mappings include LINEA.
The addition of LINEA with chain ID 59144 is correct. However, based on learnings, adding a new member to SupportedChainId requires corresponding entries in all Record<SupportedChainId, ...> typed objects throughout the codebase (e.g., ETH_FLOW_ADDRESSES, BARN_ETH_FLOW_ADDRESSES). TypeScript compilation will fail if these mappings are incomplete.
Based on learnings.
Run the following script to identify all chain-specific mappings that may need updates:
🏁 Script executed:
#!/bin/bash
# Description: Find all Record<SupportedChainId, ...> mappings and verify LINEA is included
# Search for Record<SupportedChainId type definitions
echo "=== Record<SupportedChainId mappings ==="
rg -nP "Record<SupportedChainId" -A 10
# Search for common chain mapping objects that might need LINEA
echo -e "\n=== ETH_FLOW_ADDRESSES ==="
rg -nP "ETH_FLOW_ADDRESSES\s*[=:]" -A 15
echo -e "\n=== BARN_ETH_FLOW_ADDRESSES ==="
rg -nP "BARN_ETH_FLOW_ADDRESSES\s*[=:]" -A 15
# Search for other potential chain configuration objects
echo -e "\n=== Other potential chain mappings ==="
rg -nP "SupportedChainId\.\w+\s*:" -C 2Length of output: 12503
🏁 Script executed:
#!/bin/bash
# Verify if LINEA is in ALL_SUPPORTED_CHAIN_IDS and ALL_SUPPORTED_CHAINS_MAP
echo "=== ALL_SUPPORTED_CHAIN_IDS constant ==="
rg -nP "ALL_SUPPORTED_CHAIN_IDS\s*[=:]" -A 15
echo -e "\n=== LINEA in chainIds.ts ==="
rg -n "LINEA" packages/config/src/chains/const/chainIds.ts
echo -e "\n=== Full ALL_SUPPORTED_CHAINS_MAP ==="
rg -n "ALL_SUPPORTED_CHAINS_MAP" -A 20 packages/config/src/chains/const/chainIds.tsLength of output: 2711
🏁 Script executed:
#!/bin/bash
# Check where chain imports come from and if linea exists
echo "=== Imports at top of chainIds.ts ==="
head -20 packages/config/src/chains/const/chainIds.ts
echo -e "\n=== Search for any linea references in config ==="
rg -n "linea" -i packages/config/src/
echo -e "\n=== Check contracts.ts for chain-specific constants ==="
head -40 packages/config/src/chains/const/contracts.tsLength of output: 2939
Add Linea chain configuration to complete the integration.
The LINEA enum was added to types.ts, but the chain registry is incomplete. TypeScript compilation will fail because ETH_FLOW_ADDRESSES and BARN_ETH_FLOW_ADDRESSES (typed as Record<SupportedChainId, string>) require all enum values.
Required changes:
- Create
packages/config/src/chains/details/linea.tswith ChainInfo for Linea (chain ID 59144) - Import linea in
packages/config/src/chains/const/chainIds.ts - Add
[SupportedChainId.LINEA]: lineaentry toALL_SUPPORTED_CHAINS_MAPin the same file
Without these, mapAddressToSupportedNetworks() won't generate LINEA entries for the chain-specific address mappings.
Based on learnings.
🤖 Prompt for AI Agents
In packages/config/src/chains/types.ts around line 19 the SupportedChainId enum
added LINEA = 59144 but the chain registry is missing; create
packages/config/src/chains/details/linea.ts exporting a ChainInfo object for
Linea (chainId 59144) following the structure of other chain files, then open
packages/config/src/chains/const/chainIds.ts, import the new linea export and
add the entry [SupportedChainId.LINEA]: linea to ALL_SUPPORTED_CHAINS_MAP; after
that verify any Records typed over SupportedChainId (e.g., ETH_FLOW_ADDRESSES,
BARN_ETH_FLOW_ADDRESSES) compile and update mapAddressToSupportedNetworks() will
include LINEA.
|
Covered by #606 |
Summary by CodeRabbit