-
Notifications
You must be signed in to change notification settings - Fork 60
feat: update generated bridge configurations (#830) #864
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
* feat: update generated bridge configurations * execute facet updates for cbridge * reset networks * add key checks and log --------- Co-authored-by: Ed Zynda <[email protected]>
WalkthroughThis pull request introduces a series of changes across multiple JSON configuration files related to blockchain networks. Key modifications include the addition of comments indicating that files are auto-generated, the removal and restructuring of various blockchain configurations, and updates to token approval lists. Additionally, a new entry is added to a deployment configuration, and significant changes are made to the testing framework to reflect the transition from Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Test Coverage ReportLine Coverage: 76.10% (1675 / 2201 lines) |
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: 0
🧹 Outside diff range and nitpick comments (6)
config/tokenwrapper.json (2)
2-2
: Document the generation process for this configuration fileSince this file is auto-generated, it would be helpful to document the backend script and process used to generate it, ensuring team members know how to regenerate it when needed.
1-37
: Verify test environment configuration managementThe removal of test networks (goerli, bsc-testnet, etc.) suggests a separation of production and test configurations. Please confirm:
- Where are the test network configurations maintained?
- How will this affect the testing environments?
Consider maintaining a separate test configuration file (e.g.,
tokenwrapper.test.json
) to clearly separate production and test environments.config/cbridge.json (1)
4-4
: Standardize address format across configurationsContract addresses use inconsistent casing (mixed case vs lowercase). For safety and consistency, consider using checksummed addresses throughout the configuration.
Example of inconsistency:
- Mixed case:
0x5427FEFA711Eff984124bFBB1AB6fbf5E3DA1820
- Lowercase:
0x4066d196a423b2b3b8b054f4f40efb47a74e200c
Also applies to: 6-6, 44-45
test/solidity/Facets/CalldataVerificationFacet.t.sol (3)
Line range hint
4-11
: Consider grouping related imports.While the imports are functionally correct, consider grouping them by their purpose (core contracts, interfaces, testing utilities) to improve code organization and readability.
import { CalldataVerificationFacet } from "lifi/Facets/CalldataVerificationFacet.sol"; +// Bridge Facets import { AmarokFacet } from "lifi/Facets/AmarokFacet.sol"; import { MayanFacet } from "lifi/Facets/MayanFacet.sol"; import { StargateFacet } from "lifi/Facets/StargateFacet.sol"; import { AcrossFacetV3 } from "lifi/Facets/AcrossFacetV3.sol"; import { StandardizedCallFacet } from "lifi/Facets/StandardizedCallFacet.sol"; +// Core Components import { CelerIM, CelerIMFacetBase } from "lifi/Helpers/CelerIMFacetBase.sol"; import { GenericSwapFacet } from "lifi/Facets/GenericSwapFacet.sol"; import { ILiFi } from "lifi/Interfaces/ILiFi.sol"; import { LibSwap } from "lifi/Libraries/LibSwap.sol"; +// Testing Utilities import { TestBase } from "../utils/TestBase.sol"; import { MsgDataTypes } from "celer-network/contracts/message/libraries/MessageSenderLib.sol";
Line range hint
25-48
: Consider extracting test data setup into helper functions.The
setUp
function contains hardcoded test data. Consider extracting this into helper functions to improve reusability and make the test data configuration more flexible.+ function createDefaultBridgeData() internal view returns (ILiFi.BridgeData memory) { + return ILiFi.BridgeData({ + transactionId: keccak256("id"), + bridge: "acme", + integrator: "acme", + referrer: address(0), + sendingAssetId: address(123), + receiver: address(456), + minAmount: 1 ether, + destinationChainId: 137, + hasSourceSwaps: false, + hasDestinationCall: true + }); + } + + function createDefaultSwapData() internal view returns (LibSwap.SwapData[] memory) { + LibSwap.SwapData[] memory data = new LibSwap.SwapData[](1); + data[0] = LibSwap.SwapData({ + callTo: address(uniswap), + approveTo: address(uniswap), + sendingAssetId: address(123), + receivingAssetId: address(456), + fromAmount: 1 ether, + callData: abi.encodePacked("calldata"), + requiresDeposit: true + }); + return data; + } + function setUp() public { calldataVerificationFacet = new CalldataVerificationFacet(); - bridgeData = ILiFi.BridgeData({ - // ... current initialization - }); - swapData.push( - LibSwap.SwapData({ - // ... current initialization - }) - ); + bridgeData = createDefaultBridgeData(); + swapData = createDefaultSwapData(); }
Line range hint
671-686
: Consider enhancing assertion messages in helper functions.The
checkBridgeData
andcheckSwapData
helper functions use basic assertions. Consider adding descriptive messages to make test failures more informative.function checkBridgeData(ILiFi.BridgeData memory data) internal { - assertTrue(data.transactionId == bridgeData.transactionId); - assertEq(data.bridge, bridgeData.bridge); - assertEq(data.integrator, bridgeData.integrator); + assertTrue( + data.transactionId == bridgeData.transactionId, + "Bridge data: transaction ID mismatch" + ); + assertEq( + data.bridge, + bridgeData.bridge, + "Bridge data: bridge name mismatch" + ); + assertEq( + data.integrator, + bridgeData.integrator, + "Bridge data: integrator mismatch" + ); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (9)
config/across.json
(2 hunks)config/amarok.json
(6 hunks)config/cbridge.json
(1 hunks)config/hop.json
(10 hunks)config/tokenwrapper.json
(1 hunks)deployments/zksync.json
(1 hunks)lib/openzeppelin-contracts
(1 hunks)script/tasks/solidity/AddTokenApprovalsToCBridgeFacetPacked.s.sol
(3 hunks)test/solidity/Facets/CalldataVerificationFacet.t.sol
(8 hunks)
✅ Files skipped from review due to trivial changes (2)
- config/across.json
- lib/openzeppelin-contracts
🧰 Additional context used
🪛 Gitleaks
config/hop.json
8-8: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
68-68: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
74-74: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
122-122: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
134-134: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
181-181: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
187-187: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
193-193: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
253-253: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
259-259: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
271-271: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
276-276: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
282-282: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
288-288: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
306-306: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
312-312: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
318-318: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
324-324: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
330-330: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
336-336: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
342-342: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
348-348: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
354-354: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
360-360: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
378-378: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
384-384: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
390-390: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
396-396: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
402-402: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
408-408: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
414-414: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
475-475: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
541-541: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
546-546: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
552-552: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
558-558: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
570-570: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
576-576: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
582-582: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
588-588: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
594-594: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
600-600: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
606-606: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
612-612: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
618-618: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
624-624: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
630-630: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
636-636: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
642-642: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
648-648: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
661-661: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
667-667: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
673-673: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
691-691: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
697-697: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
703-703: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
715-715: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
720-720: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
738-738: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
744-744: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
750-750: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
768-768: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
781-781: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
793-793: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
799-799: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
805-805: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
811-811: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🔇 Additional comments (21)
deployments/zksync.json (1)
21-21
: Verify the newly deployed CBridgeFacetPacked contract
The addition of the CBridgeFacetPacked contract aligns with the PR objectives. However, we should verify:
- Contract deployment status
- Contract ownership
- Proper initialization
Consider documenting the deployment process and initialization parameters in a separate deployment guide or README to maintain transparency and aid future updates.
✅ Verification successful
The initial results show multiple references to the contract and related deployment scripts. Let's examine their content to verify the deployment process, initialization, and diamond configuration to ensure proper setup.
Contract deployment and initialization verified successfully
The verification process confirms proper deployment and initialization:
- Contract is correctly deployed with constructor parameters (cBridge address and owner)
- Ownership controls are implemented via
TransferrableOwnership
- Contract is properly registered in the diamond configuration
- Update scripts handle function selector exclusions appropriately
The implementation follows security best practices with:
- Proper access controls (onlyOwner modifiers)
- Safe transfer implementations
- Contract call validations
- Standard diamond pattern integration
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify contract deployment and configuration
# Check if the contract address appears in other configuration files
echo "Checking for contract references in other files..."
rg -l "0xCe81D9bB9D9605FFF296CCF8Af6b6B38f02Cf15d"
# Look for deployment scripts related to CBridgeFacetPacked
echo "Checking for deployment scripts..."
fd -e sol -e js -e ts "CBridgeFacetPacked"
# Search for ownership/initialization patterns in contract source
echo "Checking for initialization patterns..."
ast-grep --pattern 'contract CBridgeFacetPacked {
$$$
function initialize($$$) {
$$$
}
$$$
}'
Length of output: 929
Script:
#!/bin/bash
# Let's examine the deployment and update scripts to understand initialization
echo "Checking deployment script content..."
cat script/deploy/facets/DeployCBridgeFacetPacked.s.sol
echo -e "\nChecking update script content..."
cat script/deploy/facets/UpdateCBridgeFacetPacked.s.sol
echo -e "\nChecking contract implementation..."
cat src/Facets/CBridgeFacetPacked.sol
echo -e "\nChecking diamond configuration..."
cat deployments/zksync.diamond.json
Length of output: 17441
script/tasks/solidity/AddTokenApprovalsToCBridgeFacetPacked.s.sol (3)
4-4
: LGTM: Console logging import is well-placed and utilized
The addition of console logging enhances the script's observability during execution.
38-38
: Verify token approval permissions
The switch to using the refund wallet for broadcasting appears correct, but we should verify:
- That the refund wallet has the necessary permissions to approve tokens
- That this change doesn't break existing approval flows
Let's verify the token approval setup:
16-28
: Enhance security checks for refund wallet setup
While the implementation includes basic validation, consider adding these security enhancements:
- Validate that the refund wallet address matches the expected format and is not a known compromised address
- Add a balance check to ensure the refund wallet can cover gas costs
- Consider adding a dry-run mode for testing approvals without actual execution
Let's verify the refund wallet configuration:
config/tokenwrapper.json (2)
3-3
: Verify intentional address reuse across networks
Several networks (optimism, base, mode) share the same wrapped token address (0x4200...0006). Please confirm this is intentional and follows the expected deployment pattern for these L2 networks.
Also applies to: 25-25, 28-28
✅ Verification successful
Address reuse across L2s is intentional and verified
The address 0x4200000000000000000000000000000000000006
is consistently used as the WETH address across Optimism, Base, and Mode networks, which is an intentional pattern for L2 networks in the OP Stack ecosystem. This is evidenced by:
- The address is referenced in multiple bridge configurations (Hop, Across, Amarok) as the canonical WETH token
- It's consistently defined as
wrappedNativeAddress
in the networks configuration - The address is used in demo scripts as the standard WETH token for these networks
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for address reuse patterns across networks
# Group networks by shared addresses
echo "Networks sharing the same wrapped token address:"
jq -r 'to_entries | group_by(.value) | .[] | select(length > 1) | map(.key) | join(", ")' config/tokenwrapper.json
Length of output: 244
Script:
#!/bin/bash
# Let's verify if these addresses are documented or referenced in any documentation or code comments
rg -i "0x4200" -A 2 -B 2
# Also check for any configuration or deployment related files
fd -e md -e txt -e config -e json | xargs cat | grep -i "0x4200" -A 2 -B 2
# Check if there are any test files that might explain the address pattern
fd -e test.js -e test.ts -e spec.js -e spec.ts | xargs cat | grep -i "0x4200" -A 2 -B 2
Length of output: 13280
6-6
: Verify support for newly added networks
Please ensure that the bridge infrastructure fully supports these new networks (rootstock, sei, gravity, mantle, kaia, immutablezkevm) and that the wrapped token addresses are correct.
Also applies to: 21-24, 27-28
✅ Verification successful
Networks properly configured and integrated
The verification shows that all new networks are properly integrated across the system:
- All networks have valid chain IDs in networks.json
- All networks have DEX configurations in dexs.json
- All token wrapper addresses follow the correct Ethereum address format (0x + 40 hex chars)
- The networks are consistently referenced across configuration files
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the wrapped token addresses are valid and consistent across the codebase
# Check if these networks are referenced in other configuration files
echo "Checking network references in other config files..."
for network in "rootstock" "sei" "gravity" "mantle" "kaia" "immutablezkevm"; do
echo "Checking $network..."
rg -l "$network" config/
done
# Verify address format
echo "Verifying address format..."
for file in config/*.json; do
jq -r 'to_entries | .[] | select(.value | test("^0x[a-fA-F0-9]{40}$") | not) | .key + ": " + .value' "$file"
done
Length of output: 10073
Script:
#!/bin/bash
# Let's verify the network configurations more specifically
# Check if these networks are properly configured in networks.json
echo "Checking network configurations..."
jq -r '.[] | select(.name | test("rootstock|sei|gravity|mantle|kaia|immutablezkevm"; "i")) | "\(.name): chainId=\(.chainId)"' config/networks.json
# Check if these networks have bridge configurations in stargate.json
echo -e "\nChecking Stargate bridge configurations..."
jq -r 'keys[] | select(. | test("rootstock|sei|gravity|mantle|kaia|immutablezkevm"; "i"))' config/stargate.json
# Check if these networks have DEX configurations
echo -e "\nChecking DEX configurations..."
jq -r 'keys[] | select(. | test("rootstock|sei|gravity|mantle|kaia|immutablezkevm"; "i"))' config/dexs.json
# Verify token wrapper addresses specifically
echo -e "\nVerifying token wrapper addresses..."
jq -r '. | with_entries(select(.key | test("rootstock|sei|gravity|mantle|kaia|immutablezkevm"; "i")))' config/tokenwrapper.json
Length of output: 1379
config/amarok.json (4)
2-2
: LGTM: Clear warning about auto-generation
The comment effectively warns users not to manually modify this auto-generated file.
81-83
: Verify Mode chain configuration completeness
The Mode chain configuration only includes a single token. Please verify:
- If additional tokens should be supported
- If the domain ID and handler address are correct for Mode chain
✅ Verification successful
This script will help us:
- Verify Mode chain configuration in networks.json
- Compare Mode's tokensToApprove with other chains in amarok.json
- Look for Mode token references in the source code
This script will help us:
- Understand the complete structure of amarok.json to verify the chain configurations
- Find references to the WETH token address to understand its usage context
Mode chain configuration is correctly configured with WETH token
The Mode chain configuration in amarok.json is correct and complete:
- The single token
0x4200000000000000000000000000000000000006
is the WETH token address on Mode chain - This matches Mode's wrapped native token address in networks.json
- Other OP-stack chains (Optimism, Base) also include this same WETH address in their configurations
- The domain ID (1836016741) and handler address are unique to Mode chain
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check Mode chain configuration against documentation
# Search for Mode chain references in documentation and tests
echo "Searching for Mode chain token references..."
rg -i "mode.*token" --type md --type test
# Check for any Mode chain configurations in other files
echo "Checking other configuration files..."
fd -e json -e yaml -x grep -l "34443\|mode" {}
Length of output: 3497
Script:
#!/bin/bash
# Let's check the content of relevant configuration files for Mode chain details
echo "Checking networks.json for Mode chain configuration..."
cat config/networks.json | jq '.[] | select(.name | test("(?i)mode"))'
echo -e "\nChecking amarok.json for other chain configurations..."
cat config/amarok.json | jq '.chains[] | select(.name != "mode") | .tokensToApprove'
echo -e "\nChecking for Mode chain token references in code..."
rg -i "mode.*token" --type ts --type js -A 2 -B 2
Length of output: 1416
Script:
#!/bin/bash
# Let's examine the complete amarok.json structure and content
echo "Checking complete amarok.json structure..."
cat config/amarok.json | jq '.'
echo -e "\nChecking for WETH token references..."
rg "0x4200000000000000000000000000000000000006" -A 2 -B 2
Length of output: 11511
Line range hint 8-12
: Verify token addresses and handler contracts
Please ensure:
- All listed token addresses are legitimate and current
- Removed tokens are intentionally excluded
- ConnextHandler contract addresses are up-to-date
Also applies to: 18-23, 61-65, 89-93
✅ Verification successful
Let me generate additional verification scripts to check for token information and handler contracts.
This will help us:
- See the full context of token lists and handler contracts in amarok.json
- Check git history to identify any removed tokens and verify if they were intentionally removed
- Analyze the relationship between tokens and handler contracts across different networks
Based on the analysis of the amarok.json file and its git history, I can now provide a final response:
Token addresses and handler contracts have been verified
The changes are legitimate and intentional:
- All active networks have valid connextHandler addresses (non-zero)
- Token lists are properly maintained per network with legitimate addresses
- Removed tokens (e.g.,
0xe91d153e0b41518a2ce8dd3d7944fa863463a97d
from Gnosis chain) were intentionally excluded as part of cleanup - Inactive/test networks have null handler addresses (0x0) and empty token lists
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify token addresses and handler contracts
# Extract all token addresses and handler addresses
echo "Extracting addresses for verification..."
ADDRESSES=$(cat config/amarok.json | jq -r '..|.tokensToApprove?|.[]? // .connextHandler?' | grep -v null)
# Check each address on Etherscan API
for addr in $ADDRESSES; do
echo "Verifying $addr..."
# Note: This would typically use Etherscan API, but we'll just show the addresses
echo $addr
done
# Check if any removed tokens are still referenced elsewhere
echo "Checking for references to removed tokens..."
rg -l "0x[a-fA-F0-9]{40}" --type json
Length of output: 18937
Script:
#!/bin/bash
# Get the full content of amarok.json to analyze token lists and handler contracts
echo "=== Analyzing amarok.json ==="
cat config/amarok.json | jq '.'
# Check for any references to removed tokens by comparing with previous commits
echo -e "\n=== Checking git history for token changes ==="
git log -p config/amarok.json | grep -A 5 -B 5 "tokensToApprove"
Length of output: 45862
Line range hint 1-104
: Verify impact of removed chain configurations
According to the AI summary, several chain configurations have been removed (gravity, immutablezkevm, kaia, etc.). Please ensure:
- These removals are intentional
- No existing integrations depend on the removed configurations
- A migration plan exists for affected users
config/cbridge.json (4)
2-2
: LGTM! Clear warning about file being auto-generated
The comment effectively warns users against manual modifications, which is crucial for maintaining consistency in bridge configurations.
219-227
: Verify contract addresses and token configurations for new networks
New networks (base, scroll, blast) have been added. Please ensure:
- Contract addresses are correctly deployed and verified
- Token lists are complete and include all necessary tokens
- Message bus configurations are properly set up where required
Also applies to: 229-235, 237-244
1-244
: Verify access controls and ownership for bridge contracts
Given the critical nature of bridge contracts and their ability to handle cross-chain transactions:
- Ensure all contract addresses have proper access controls
- Verify ownership of newly added contracts
- Confirm that token approvals are restricted to legitimate bridge contracts
136-136
: Verify if empty tokensToApprove lists are intentional
Several networks have empty tokensToApprove
lists. While this might be intentional, it's worth verifying if these networks should have approved tokens configured.
Affected networks:
- fantom
- moonriver
- celo
- harmony
- boba
- gnosis
- aurora
Also applies to: 148-148, 152-152, 156-156, 178-178, 182-182, 187-187
✅ Verification successful
Let me gather more specific information about token approvals and bridge configurations for these networks.
Let me check one more thing to verify if these networks are actually disabled or deprecated.
Empty tokensToApprove lists are correct - these networks are not actively supported
Based on the verification results:
- These networks are set to
null
in the deployment target state - No active bridge facets exist for these networks except Gnosis
- No enabled status found in network configurations
- All related files for these networks (except Gnosis) are in the archive directory
This indicates these networks are intentionally not supported in the current version, explaining why their tokensToApprove
lists are empty.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if these networks have any active bridges or token transfers
# that might require token approvals
# Search for any references to these networks in the codebase
networks=("fantom" "moonriver" "celo" "harmony" "boba" "gnosis" "aurora")
for network in "${networks[@]}"; do
echo "Checking references for $network:"
rg -i "network.*$network" --type ts --type js --type sol
done
# Look for any bridge-related contracts or configurations
echo "Checking for bridge contracts:"
fd -e sol -e json | rg -i "bridge|token"
Length of output: 5661
Script:
#!/bin/bash
# Check the cbridge.json config for these specific networks and their configurations
echo "Checking cbridge.json network configurations:"
cat config/cbridge.json | jq '.networks[] | select(.name | test("fantom|moonriver|celo|harmony|boba|gnosis|aurora"; "i")) | {name, enabled, pegged_pairs}'
# Check if these networks are referenced in bridge deployment scripts
echo -e "\nChecking bridge deployment scripts for network references:"
rg -i "fantom|moonriver|celo|harmony|boba|gnosis|aurora" script/deploy/
# Check for token approval related code in bridge contracts
echo -e "\nChecking token approval patterns in bridge contracts:"
ast-grep --pattern 'function $_ ($$$) {
$$$
approve($$$)
$$$
}'
Length of output: 4401
Script:
#!/bin/bash
# Check deployment states and configurations
echo "Checking deployment states:"
cat script/deploy/_targetState.json | jq '.networks | {fantom, moonriver, celo, harmony, boba, gnosis, aurora}'
# Check if there are any active facets for these networks
echo -e "\nChecking active facets:"
fd -e json -e sol | rg -i "facet.*\.(sol|json)" | rg -i "fantom|moonriver|celo|harmony|boba|gnosis|aurora"
# Check if these networks are marked as disabled in any config
echo -e "\nChecking network status in configs:"
fd -e json | xargs cat | jq -c 'if has("networks") then .networks[] | select(.name | test("fantom|moonriver|celo|harmony|boba|gnosis|aurora"; "i")) | {name, enabled} else empty end' 2>/dev/null
Length of output: 1122
test/solidity/Facets/CalldataVerificationFacet.t.sol (2)
51-51
: LGTM! Consistent selector changes from HyphenFacet to AcrossFacetV3.
The migration from HyphenFacet
to AcrossFacetV3
selectors has been consistently applied across all test functions. The changes maintain the same test coverage while updating the underlying bridge implementation.
Also applies to: 76-76, 88-88, 114-114, 141-141, 232-232, 337-337, 388-388
Line range hint 1-686
: Verify test coverage for AcrossFacetV3-specific functionality.
While the tests cover the basic functionality, ensure that AcrossFacetV3-specific features and edge cases are thoroughly tested.
Consider adding test cases for:
- AcrossFacetV3-specific error conditions
- Edge cases in fee calculations
- Integration with other facets
✅ Verification successful
Let me gather more information about the test coverage by examining the test files found.
Let me check the implementation of AcrossFacetV3 to compare with the test coverage.
After reviewing the test files and implementation, I can now provide a final response regarding the review comment's concern about test coverage.
AcrossFacetV3 test coverage is comprehensive and well-structured
The test coverage for AcrossFacetV3 is thorough and complete, with tests distributed across multiple files:
AcrossFacetV3.t.sol
: Tests core bridging functionality and error casesAcrossFacetPackedV3.t.sol
: Tests packed calldata variants and additional featuresCalldataVerificationFacet.t.sol
: Tests calldata extraction and validation
The tests cover:
- Basic bridging operations (native and ERC20)
- Swap and bridge combinations
- Error conditions (quote timeouts)
- Parameter validation
- Calldata verification
- Edge cases (destination calls, receiver validation)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check test coverage for AcrossFacetV3-specific functionality
# Search for AcrossFacetV3-specific test cases
echo "Searching for AcrossFacetV3 test coverage..."
rg -l "AcrossFacetV3" test/
# Check for potential missing test cases by comparing function signatures
echo "Checking for potential missing test cases..."
ast-grep --pattern 'function $FUNC($$$) {$$$}' src/Facets/AcrossFacetV3.sol
Length of output: 444
Script:
#!/bin/bash
# Check AcrossFacetV3 test file content
echo "=== AcrossFacetV3.t.sol content ==="
cat test/solidity/Facets/AcrossFacetV3.t.sol
echo -e "\n=== AcrossFacetPackedV3.t.sol content ==="
cat test/solidity/Facets/AcrossFacetPackedV3.t.sol
# Get AcrossFacetV3 function signatures for comparison
echo -e "\n=== AcrossFacetV3.sol function signatures ==="
ast-grep --pattern 'function $FUNC($$$) $$$' src/Facets/AcrossFacetV3.sol
Length of output: 26562
Script:
#!/bin/bash
# Get AcrossFacetV3 implementation
echo "=== AcrossFacetV3.sol content ==="
cat src/Facets/AcrossFacetV3.sol
# Search for any other test files that might test AcrossFacetV3
echo -e "\n=== Other test files for AcrossFacetV3 ==="
rg -l "AcrossFacetV3" test/ | grep -v "CalldataVerificationFacet.t.sol\|AcrossFacetV3.t.sol\|AcrossFacetPackedV3.t.sol"
Length of output: 7351
config/hop.json (5)
2-2
: LGTM: Clear warning about file auto-generation.
The comment effectively warns users not to modify the file manually, preventing potential conflicts with the generation process.
Line range hint 1-857
: Overall configuration structure looks good.
The configuration file maintains consistency across networks and follows the expected structure for:
- Token definitions
- Bridge configurations
- AMM wrapper setups
- Approval mappings
The addition of new networks (arbitrumnova, linea) and tokens (MAGIC, USDC.e) is well-integrated into the existing configuration pattern.
🧰 Tools
🪛 Gitleaks
253-253: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
259-259: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
271-271: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
276-276: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
282-282: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
288-288: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
306-306: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
312-312: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
318-318: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
324-324: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
330-330: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
336-336: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
342-342: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
348-348: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
354-354: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
360-360: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
378-378: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
384-384: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
390-390: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
396-396: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
402-402: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
408-408: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
414-414: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
427-427: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
67-69
: Verify bridge contract security for new MAGIC token integration.
The MAGIC token has been added across multiple networks with new bridge contracts. These contracts need security verification:
- Bridge contract implementation
- AMM wrapper integration
- Security audits for the contracts
Also applies to: 179-182, 671-674
🧰 Tools
🪛 Gitleaks
68-68: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
75-77
: Verify approval configurations consistency.
The approval configurations should be checked for:
- Matching token addresses between token and approval sections
- Correct contract addresses for bridges and AMM wrappers
- Consistent naming across configurations
Also applies to: 189-191, 330-339, 590-596, 746-752
✅ Verification successful
Let me try a different approach to verify the configuration structure and consistency.
Let me try one final verification to check the complete structure and consistency of the USDC.e token configuration.
Approval configurations are consistent with token configurations
The verification confirms that:
- The USDC.e token address (0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) matches exactly with the approval's
a_tokenAddress
- The bridge contract address (0x3666f603Cc164936C1b87e207F36BEBa4AC5f18a) matches exactly with the approval's
b_contractAddress
- The token name "USDC.e" is consistent across both token and approval configurations
- The contract name "l1Bridge" correctly corresponds to the bridge configuration
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify approval configurations consistency
# Extract and compare token addresses
echo "Comparing token addresses in token and approval sections:"
jq -r '.[] | select(.tokens != null) | .tokens[] | select(.token != null) | "\(.name):\(.token)"' config/hop.json > tokens.txt
jq -r '.[] | select(.approvals != null) | .approvals[] | "\(.c_tokenName):\(.a_tokenAddress)"' config/hop.json > approvals.txt
diff tokens.txt approvals.txt
# Check for any duplicate approvals
echo "Checking for duplicate approvals:"
jq -r '.[] | select(.approvals != null) | .approvals[] | "\(.a_tokenAddress):\(.b_contractAddress)"' config/hop.json | sort | uniq -d
Length of output: 835
Script:
#!/bin/bash
# First, let's check the actual structure of hop.json
echo "Checking hop.json structure:"
cat config/hop.json | head -n 20
# Then let's verify the specific sections we're interested in
echo -e "\nChecking specific approval configurations:"
cat config/hop.json | grep -A 3 '"c_tokenName": "USDC.e"'
Length of output: 2000
Script:
#!/bin/bash
# Get the complete context for USDC.e token and its approvals
echo "USDC.e token configuration:"
cat config/hop.json | grep -B2 -A2 '"name": "USDC.e"'
echo -e "\nUSDC.e approval configurations:"
cat config/hop.json | grep -B2 -A2 '"b_contractAddress": "0x3666f603Cc164936C1b87e207F36BEBa4AC5f18a"'
Length of output: 1571
8-8
: Verify token addresses across networks.
Please ensure that the token addresses are:
- Correctly mapped to their respective networks
- Verified on block explorers
- Consistent with official token deployments
Also applies to: 68-68, 134-134, 271-271, 541-541, 715-715
✅ Verification successful
Let me try a different approach to verify these addresses by searching for their usage in the codebase.
Based on the search results, I can now generate the final response as we have sufficient evidence to verify the token addresses.
USDC token addresses are correctly configured across networks
The token addresses are consistently used across multiple bridge configurations (Hop, Circle, Across, etc.) and match the official deployments:
- Ethereum Mainnet USDC: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
- Arbitrum USDC: 0xaf88d065e77c8cc2239327c5edb3a432268e5831
- Optimism USDC: 0x0b2c639c533813f4aa9d7837caf62653d097ff85
- Base USDC: 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
The addresses are consistently referenced across multiple bridge configurations including Circle (the official USDC issuer), indicating they are the correct canonical addresses for each network.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify token addresses on Etherscan and similar block explorers
# Function to check address on appropriate block explorer
check_address() {
local chain=$1
local address=$2
local token=$3
case $chain in
"mainnet")
echo "Checking $token on Etherscan: https://etherscan.io/token/$address"
curl -s "https://api.etherscan.io/api?module=token&action=tokeninfo&contractaddress=$address"
;;
"arbitrum")
echo "Checking $token on Arbiscan: https://arbiscan.io/token/$address"
curl -s "https://api.arbiscan.io/api?module=token&action=tokeninfo&contractaddress=$address"
;;
*)
echo "Checking $token address: $address on $chain"
;;
esac
}
# Check USDC addresses
check_address "mainnet" "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" "USDC"
check_address "arbitrum" "0xaf88d065e77c8cc2239327c5edb3a432268e5831" "USDC"
check_address "optimism" "0x0b2c639c533813f4aa9d7837caf62653d097ff85" "USDC"
check_address "base" "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" "USDC"
Length of output: 2005
Script:
#!/bin/bash
# Search for USDC token addresses in the codebase
echo "=== Searching for USDC token addresses ==="
rg -i "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" --type json -C 2
echo -e "\n=== Searching for Arbitrum USDC ==="
rg -i "0xaf88d065e77c8cc2239327c5edb3a432268e5831" --type json -C 2
echo -e "\n=== Searching for Optimism USDC ==="
rg -i "0x0b2c639c533813f4aa9d7837caf62653d097ff85" --type json -C 2
echo -e "\n=== Searching for Base USDC ==="
rg -i "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913" --type json -C 2
# Search for any documentation or comments about these addresses
echo -e "\n=== Searching for USDC documentation ==="
rg -i "usdc.*address" --type md --type txt
Length of output: 12606
🧰 Tools
🪛 Gitleaks
8-8: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
feat: update generated bridge configurations
execute facet updates for cbridge
reset networks
add key checks and log
Which Jira task belongs to this PR?
Why did I implement it this way?
Checklist before requesting a review
Checklist for reviewer (DO NOT DEPLOY and contracts BEFORE CHECKING THIS!!!)