Skip to content
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

Update networks.json #817

Merged
merged 12 commits into from
Oct 8, 2024
Merged

Update networks.json #817

merged 12 commits into from
Oct 8, 2024

Conversation

ezynda3
Copy link
Contributor

@ezynda3 ezynda3 commented Oct 3, 2024

Which Jira task belongs to this PR?

Why did I implement it this way?

Checklist before requesting a review

  • I have performed a self-review of my code
  • This pull request is as small as possible and only tackles one problem
  • I have added tests that cover the functionality / test the bug
  • I have updated any required documentation

Checklist for reviewer (DO NOT DEPLOY and contracts BEFORE CHECKING THIS!!!)

  • I have checked that any arbitrary calls to external contracts are validated and or restricted
  • I have checked that any privileged calls (i.e. storage modifications) are validated and or restricted
  • I have ensured that any new contracts have had AT A MINIMUM 1 preliminary audit conducted on by <company/auditor>

Copy link
Contributor

coderabbitai bot commented Oct 3, 2024

Walkthrough

This pull request introduces several modifications across multiple configuration files. The .env.example file has updates to Ethereum node URIs, correcting extraneous .io suffixes. The config/global.json file sees updates to wallet addresses and API URLs, alongside the addition of a new entry. The config/networks.json file expands network configurations with new properties and removes several testnet entries. The config/tokenwrapper.json file has been deleted, impacting token address mappings. Lastly, deployment scripts have been adjusted to reflect these configuration changes.

Changes

File Change Summary
.env.example Updated Ethereum node URIs by removing extraneous .io suffixes for ETH_NODE_URI_SEI, ETH_NODE_URI_SCROLL, ETH_NODE_URI_TAIKO, and ETH_NODE_URI_ZKSYNC.
config/global.json Updated wallet addresses, modified API URL for linea, and added LiFiDEXAggregator to autoWhitelistPeripheryContracts.
config/networks.json Enhanced network entries with new properties, removed several testnet configurations, and added new networks xlayer and taiko.
config/tokenwrapper.json Removed file containing mappings of blockchain network identifiers to token wrapper addresses.
script/deploy/facets/DeployTokenWrapper.s.sol Updated getConstructorArgs function to change the path for configuration and modify how wrapped token addresses are retrieved.
script/deploy/safe/config.ts Updated safeApiUrls for linea to a new endpoint.
script/deploy/zksync/017_deploy_token_wrapper.ts Modified import paths and updated assignment for WRAPPED_NATIVE_ADDRESS to access nested properties.
script/deploy/safe/confirm-safe-tx.ts Added support for reading private keys from environment variables, introduced new transaction signing and execution functions, and expanded user options for transaction actions.

Possibly related PRs

  • Deploy to Kaia #789: The changes in this PR involve modifications to the .env.example file, specifically adding new Ethereum node URIs, which relates to the main PR's updates to Ethereum node URIs in the same file.
  • Deploy diamond to X Layer #806: This PR introduces a new entry for the "xlayer" network in multiple configuration files, including config/networks.json, which aligns with the main PR's focus on Ethereum node URIs that may include similar network configurations.
  • Deploy lifi dex aggregator to remaining networks #819: This PR adds a new entry for LiFiDEXAggregator across various networks, including the xlayer, which is relevant as the main PR also deals with Ethereum node configurations that may impact the integration of such aggregators.

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Outside diff range and nitpick comments (5)
script/deploy/facets/DeployTokenWrapper.s.sol (1)

Line range hint 1-38: Overall assessment: Changes look good, pending verification.

The modifications to use a centralized networks.json file and update the JSON structure for wrapped token addresses are logical and align with the PR objectives. These changes should improve the scalability and organization of network-specific configurations.

However, to ensure a smooth transition:

  1. Verify that all references to the old tokenwrapper.json file have been updated throughout the codebase.
  2. Confirm that the networks.json file exists and has the correct structure.
  3. Test the deployment script with various network configurations to ensure it works as expected.

Consider documenting the new structure of the networks.json file in the project's documentation to help other developers understand and maintain it.

script/deploy/safe/config.ts (1)

Line range hint 3-35: Consider adding a clarifying comment about URL patterns.

The safeApiUrls object contains a mix of URL patterns, with some using the .safe.global domain and others using custom domains. It might be helpful to add a comment explaining the reason for these differences or any plans for future standardization.

Consider adding a comment like this at the beginning of the safeApiUrls object:

export const safeApiUrls: Record<string, string> = {
  // Note: URL patterns may vary due to network-specific requirements.
  // We are gradually migrating to the .safe.global domain where possible.
  mainnet: 'https://safe-transaction-mainnet.safe.global/api',
  // ... (rest of the object)
}

This comment would provide context for future maintainers and contributors.

config/global.json (1)

Line range hint 11-11: Remove duplicate pauserWallet entry

There are two entries for pauserWallet with different addresses:

  1. "0x3b6211981d47Fb6375E0125A6a401830616f7906" (line 11)
  2. "0x29DaCdF7cCaDf4eE67c923b4C22255A4B2494eD7" (line 16)

This duplication can lead to unexpected behavior and potential security risks. Please remove one of these entries, keeping only the correct and up-to-date pauserWallet address.

To resolve this, remove one of the pauserWallet entries:

  "pauserWallet": "0x3b6211981d47Fb6375E0125A6a401830616f7906",
  "lifuelRebalanceWallet": "0xC71284231A726A18ac85c94D75f9fe17A185BeAF",
  "deployerWallet": "0x11F1022cA6AdEF6400e5677528a80d49a069C00c",
- "pauserWallet": "0x29DaCdF7cCaDf4eE67c923b4C22255A4B2494eD7",

Ensure that the remaining address is the correct and most up-to-date one for the pauser wallet.

Also applies to: 16-16

config/networks.json (2)

9-16: New fields added consistently across networks

The addition of rpcUrl, explorerType, explorerUrl, explorerApiUrl, multicallAddress, safeApiUrl, and safeAddress fields to each network entry improves the configuration's completeness. The 'type' field is consistently set to "mainnet" for all networks (except localanvil), which is appropriate.

However, the safeAddress field is empty for all networks.

Consider adding a TODO comment or documentation explaining why this field is currently empty and if/when it will be populated.

Also applies to: 25-32, 41-48, 57-64, 73-80, 89-96, 105-112, 121-128, 137-144, 153-160, 169-176, 185-192, 201-208, 217-224, 233-240, 249-256, 265-272, 281-288, 297-304, 313-320, 329-336, 345-352, 361-368, 377-384, 393-400, 409-416, 425-432, 441-448, 457-464, 473-480, 489-496, 505-512


Line range hint 498-512: 'localanvil' test network entry

The 'localanvil' entry is correctly marked as a "testnet" type. However, several fields are empty:

  • explorerUrl
  • explorerApiUrl
  • multicallAddress
  • safeApiUrl

Consider adding placeholder values or TODO comments for these fields to maintain consistency with other entries, even for test networks. This could help prevent issues if the configuration is used in testing environments that expect these fields to be populated.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 7c78316 and 01b31c1.

📒 Files selected for processing (7)
  • .env.example (1 hunks)
  • config/global.json (2 hunks)
  • config/networks.json (29 hunks)
  • config/tokenwrapper.json (0 hunks)
  • script/deploy/facets/DeployTokenWrapper.s.sol (1 hunks)
  • script/deploy/safe/config.ts (1 hunks)
  • script/deploy/zksync/017_deploy_token_wrapper.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • config/tokenwrapper.json
✅ Files skipped from review due to trivial changes (1)
  • .env.example
🧰 Additional context used
🪛 Biome
config/networks.json

[error] 452-452: Expected an array, an object, or a literal but instead found ','.

Expected an array, an object, or a literal here.

(parse)

🔇 Additional comments (12)
script/deploy/facets/DeployTokenWrapper.s.sol (1)

26-26: LGTM. Verify impact of configuration file change.

The change from tokenwrapper.json to networks.json aligns with the PR objectives. This suggests a move towards a more centralized configuration file for network-specific information.

To ensure this change doesn't break other parts of the codebase, please run the following script:

✅ Verification successful

Configuration file path successfully updated with no residual references.

All references to tokenwrapper.json have been removed, and the new configuration file config/networks.json exists as expected.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to the old configuration file

# Test: Search for references to the old file name
rg --type solidity "tokenwrapper\.json"

# Test: Verify the existence of the new configuration file
if [ -f "config/networks.json" ]; then
    echo "networks.json exists"
else
    echo "Error: networks.json not found"
fi

Length of output: 159


Script:

#!/bin/bash
# Description: Check for any remaining references to the old configuration file without specifying file types

# Test: Search for references to the old file name in all files
rg "tokenwrapper\.json"

# Test: Verify the existence of the new configuration file
if [ -f "config/networks.json" ]; then
    echo "networks.json exists"
else
    echo "Error: networks.json not found"
fi

Length of output: 110

script/deploy/zksync/017_deploy_token_wrapper.ts (3)

Line range hint 1-70: Summary of changes and testing recommendation.

The main changes in this file involve updating import paths and modifying how configuration data is accessed. While these changes don't alter the core functionality of the deployment script, they suggest a broader restructuring of the project.

To ensure these changes don't introduce any unintended consequences:

  1. Thoroughly test the deployment script on a test network to verify it still functions as expected.
  2. Review other deployment scripts or related files to ensure consistent use of the new configuration structure.
  3. If this is part of a larger refactoring, consider updating the PR description to provide context for these changes.

As a final check, run the following script to identify any other files that might need similar updates:

#!/bin/bash
# Description: Find other files that might need similar updates

# Look for other files importing from ../config or ../typechain
rg --type typescript "from '\.\./config/" .
rg --type typescript "from '\.\./typechain" .

echo "Please review the output to identify any other files that might need similar updates."

10-10: Verify the new configuration file and data access.

The changes in the configuration import and data access raise a few points to consider:

  1. The import path has changed from ../config/tokenwrapper.json to ../../../config/networks.json. Ensure this new path is correct and the file exists.
  2. The assignment of WRAPPED_NATIVE_ADDRESS now uses globalConfig.zksync.wrappedNativeAddress instead of globalConfig[network.name]. This change makes the script specific to the zksync network, which aligns with the network check at the beginning of the function.

Please verify:

  • The structure of the new networks.json file is as expected, with a zksync object containing a wrappedNativeAddress property.
  • This change is intentional and doesn't break functionality for other networks (if applicable).
  • The wrappedNativeAddress in the config file is correct for the zksync network.

Run the following script to check the new configuration:

#!/bin/bash
# Description: Verify the structure and content of the new configuration file

# Test 1: Check if the new config file exists
if [ ! -f "../../../config/networks.json" ]; then
  echo "Error: ../../../config/networks.json file does not exist"
  exit 1
fi

# Test 2: Check the structure of the networks.json file
jq '.zksync.wrappedNativeAddress' ../../../config/networks.json

echo "Please review the output to ensure the zksync.wrappedNativeAddress exists and is correct."

Also applies to: 22-22


4-4: Verify the correctness of the new import path.

The import path for PeripheryRegistryFacet has been changed to navigate up three directory levels instead of one. Please ensure that:

  1. This new path is correct and the typechain directory is indeed located three levels up.
  2. This change is consistent with other files in the project that import from typechain.
  3. If this change is due to a project structure modification, similar updates have been made in other relevant files.

Run the following script to check for consistency:

script/deploy/safe/config.ts (1)

21-21: LGTM! Verify the new Linea Safe API URL.

The update to the Linea network's Safe API URL looks good. It now follows the consistent pattern used for other networks in the safeApiUrls object.

To ensure the new URL is functional, please run the following verification script:

This command will perform a HEAD request to the API's about endpoint. Ensure that it returns a successful status code (e.g., 200 OK).

✅ Verification successful

Please run the following verification script to ensure the redirected Linea Safe API URL is accessible and returns a successful response:

This script uses the -L flag to follow any redirects and should return a 200 OK status if the API endpoint is functioning correctly.


Success! The new Linea Safe API URL is accessible and returns a successful response.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the new Linea Safe API URL is accessible and returns a valid response.

curl -I https://safe-transaction-linea.safe.global/api/v1/about

Length of output: 835


Script:

#!/bin/bash
# Description: Follow the redirect and verify that the Linea Safe API URL with trailing slash is accessible.

curl -I https://safe-transaction-linea.safe.global/api/v1/about/ -L

Length of output: 1031

config/global.json (4)

96-96: Approve updated Linea Safe API URL

The Linea network's Safe API URL has been updated to follow the consistent pattern used for other networks:

"linea": "https://safe-transaction-linea.safe.global/api",

This change aligns with the naming convention used for other networks and likely reflects an update in the Safe API infrastructure.

To ensure this change doesn't break any existing functionality:

  1. Verify that the new API endpoint is operational and returns the expected responses.
  2. Update any documentation or client code that may be using the old URL.
  3. Confirm with the Safe team that this is the correct and most up-to-date URL for the Linea network.

Line range hint 134-134: Verify the new Metis native address

The native address for the Metis network has been changed to a distinctive address:

"metis": "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000",

This address (0xDeadDeAd...) is often used to represent special cases like native tokens or burn addresses. Given the potential impact on native token handling for the Metis network, please:

  1. Confirm that this address is correct and intended for use as the native address on Metis.
  2. Provide documentation or references explaining the reason for this change and its implications.
  3. Ensure that all relevant components of the system are updated to handle this new address correctly.

Can you provide more context on why this change was made and confirm its correctness with the Metis team or documentation?


146-149: Provide details on LiFiDEXAggregator whitelisting

A new contract, "LiFiDEXAggregator", has been added to the autoWhitelistPeripheryContracts array:

"autoWhitelistPeripheryContracts": [
  "FeeCollector",
  "LiFuelFeeCollector",
  "TokenWrapper",
  "LiFiDEXAggregator"
]

Before approving this change, please provide the following information:

  1. What is the purpose of the LiFiDEXAggregator contract?
  2. What privileges or permissions does this whitelisting grant to the contract?
  3. Has the LiFiDEXAggregator contract been audited and verified for security?
  4. Are there any potential risks associated with auto-whitelisting this contract?

Can you also provide links to the contract's source code and any relevant documentation or audit reports?


Line range hint 1-150: Summary of config/global.json changes

This review has identified several important changes to the configuration:

  1. Duplicate pauserWallet entries with different addresses.
  2. Updated Safe API URL for the Linea network.
  3. Changed native address for the Metis network to a special address.
  4. Addition of "LiFiDEXAggregator" to the auto-whitelist periphery contracts.

Please address the comments for each of these changes, particularly:

  • Resolve the duplicate pauserWallet issue.
  • Confirm the correctness of the new Metis native address.
  • Provide more information about the LiFiDEXAggregator contract and the implications of whitelisting it.

Once these points are addressed and verified, the changes can be approved.

As a final step, please run a JSON linter on the entire file to ensure there are no syntax errors or formatting issues introduced by these changes.

config/networks.json (3)

Line range hint 1-514: Overall changes look good, with some areas needing attention.

The update to networks.json adds valuable information for each network, including RPC URLs, explorer details, and multicall addresses. This standardization across networks is beneficial for consistency and ease of use. However, there are a few areas that require attention, which I'll detail in the following comments.

🧰 Tools
🪛 Biome

[error] 452-452: Expected an array, an object, or a literal but instead found ','.

Expected an array, an object, or a literal here.

(parse)


482-496: 'zksync' network entry update looks good

The 'zksync' network entry has been successfully updated with all required information. The multicallAddress is different from other networks, but this is likely specific to the zkSync network and not an issue.


Line range hint 1-514: Summary and next steps

The updates to networks.json significantly improve the configuration by adding comprehensive information for each network. The consistency across networks is commendable. However, there are a few areas that need attention:

  1. Complete the missing information for the 'taiko' and 'xlayer' network entries.
  2. Fix the incorrect rpcUrl for the 'mantle' network.
  3. Consider adding placeholder values or TODO comments for empty fields in the 'localanvil' test network entry.
  4. Explain or populate the empty safeAddress fields across all networks.

Addressing these points will ensure that the configuration file is complete, consistent, and ready for use across various blockchain interactions.

To ensure all network entries are complete, you can run the following script:

This script will list any network entries with missing or empty required fields, helping to identify areas that need completion.

🧰 Tools
🪛 Biome

[error] 452-452: Expected an array, an object, or a literal but instead found ','.

Expected an array, an object, or a literal here.

(parse)

script/deploy/facets/DeployTokenWrapper.s.sol Show resolved Hide resolved
config/networks.json Outdated Show resolved Hide resolved
config/networks.json Outdated Show resolved Hide resolved
config/networks.json Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Outside diff range and nitpick comments (4)
config/networks.json (4)

Line range hint 17-32: Minor inconsistency in safeApiUrl for Arbitrum

The safeApiUrl for Arbitrum points to Aurora instead of Arbitrum. This should be corrected.

Please update the safeApiUrl to the correct Arbitrum Safe API URL. The correct URL should be something like "https://safe-transaction-arbitrum.safe.global/api".


Line range hint 273-288: Incorrect rpcUrl for Mantle network

The rpcUrl for the Mantle network is set to a multicall address instead of an actual RPC URL.

Please update the rpcUrl for the Mantle network. The correct URL should be "https://rpc.mantle.xyz".


Line range hint 498-512: Consider adding explanatory comments for empty fields in localanvil

While it's understandable that some fields are empty for a local test network, it might be helpful to add comments explaining why these fields are empty or how they should be populated when using this configuration.

Consider adding comments like "// Not applicable for local network" or "// To be filled based on local setup" for the empty fields in the localanvil entry.


Line range hint 1-514: Overall good update with a few issues to address

The networks.json file has been significantly enhanced with comprehensive information for various blockchain networks. The additions and updates are mostly correct and consistent. However, there are a few issues that need to be addressed:

  1. The safeApiUrl for Arbitrum points to Aurora instead of Arbitrum.
  2. The rpcUrl for the Mantle network is incorrect (set to a multicall address).
  3. The chainId for the Taiko network is missing.
  4. The rpcUrl for the X Layer network is empty.

Please correct these issues to ensure the accuracy and completeness of the network configurations.

Consider implementing a validation script that checks for the presence and format of required fields across all network entries. This could help catch similar issues in future updates.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 01b31c1 and e92f3ed.

📒 Files selected for processing (2)
  • config/networks.json (29 hunks)
  • script/deploy/safe/confirm-safe-tx.ts (8 hunks)
🔇 Additional comments (9)
config/networks.json (3)

Line range hint 1-16: LGTM: Ethereum Mainnet configuration looks good.

The added fields for the Ethereum Mainnet are correct and provide comprehensive information for interacting with the network.


Line range hint 33-448: LGTM: Network configurations look good overall

The network configurations for Aurora, Avalanche, Base, Blast, Boba, BSC, Celo, Fantom, Fraxtal, Fuse, Gnosis, Gravity, Immutable zkEVM, Kaia, Linea, Metis, Mode, Moonbeam, Moonriver, Optimism, Polygon, Polygon zkEVM, Rootstock, Scroll, and Sei have been correctly updated with the new fields and appear to contain accurate information.


482-496: LGTM: zkSync Era Mainnet configuration looks good

The updated zkSync Era Mainnet configuration is comprehensive and appears to contain accurate information for all fields.

script/deploy/safe/confirm-safe-tx.ts (6)

11-13: Addition of dotenv for environment variable management

The inclusion of dotenv to manage environment variables enhances configuration flexibility. Ensure that the .env file is securely stored and excluded from version control to protect sensitive information.


100-102: Added informative logging statements

Logging the chain name and signer address improves transparency and aids in debugging. This enhancement is beneficial for tracking the transaction flow.


134-142: Implementation of executeTransaction function

The executeTransaction function correctly handles the execution and confirmation of transactions. This modular approach improves code readability and maintainability.


211-211: Updated transaction action options

The action options now include 'Sign & Execute Now', 'Sign', and 'Execute Now', providing users with more control over transaction processing.


264-264: Made privateKey argument optional

Changing the privateKey argument to optional enhances flexibility, allowing users to supply it via command-line arguments or environment variables.


270-285: Interactive private key selection from environment variables

The script now prompts the user to select a private key from the .env file if none is provided. This improves usability but ensure robust error handling for missing or invalid keys.

Run the following script to check for all usages of process.env and confirm that sensitive data handling is appropriate:

✅ Verification successful

Private Key Environment Variable Handling Verified

The selections and error handling for private keys in script/deploy/safe/confirm-safe-tx.ts lines 270-285 are properly managed. The script ensures that a private key is either provided or selected from environment variables, with appropriate error handling for missing keys.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify usages of process.env for environment variables.

# Test: Search for all occurrences of 'process.env'. Expect: Proper handling of undefined or empty values.
rg --type js --type ts 'process\.env' -A 2

Length of output: 6859

config/networks.json Outdated Show resolved Hide resolved
config/networks.json Outdated Show resolved Hide resolved
script/deploy/safe/confirm-safe-tx.ts Outdated Show resolved Hide resolved
script/deploy/safe/confirm-safe-tx.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🧹 Outside diff range and nitpick comments (4)
config/networks.json (4)

121-128: LGTM: BNB Smart Chain configuration looks good, but consider RPC choice

The new fields for BNB Smart Chain have been correctly added and populated with appropriate values. However, note that the RPC URL uses an Ankr endpoint instead of the official BSC endpoint. While Ankr is a reputable provider, you might want to consider using the official BSC RPC URL for consistency with other networks.


153-160: LGTM: Fantom configuration looks good, but consider RPC choice

The new fields for Fantom have been correctly added and populated with appropriate values. However, note that the RPC URL uses an Ankr endpoint instead of the official Fantom endpoint. While Ankr is a reputable provider, you might want to consider using the official Fantom RPC URL for consistency with other networks.


329-336: LGTM: Moonbeam configuration looks good, but consider RPC choice

The new fields for Moonbeam have been correctly added and populated with appropriate values. However, note that the RPC URL uses a Blast API endpoint instead of the official Moonbeam RPC. While Blast is a reputable provider, you might want to consider using the official Moonbeam RPC URL for consistency with other networks.


345-352: LGTM: Moonriver configuration looks good, but consider RPC choice

The new fields for Moonriver have been correctly added and populated with appropriate values. However, note that the RPC URL uses a Blast API endpoint instead of the official Moonriver RPC. While Blast is a reputable provider, you might want to consider using the official Moonriver RPC URL for consistency with other networks.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between e92f3ed and abd9185.

📒 Files selected for processing (3)
  • config/global.json (1 hunks)
  • config/networks.json (30 hunks)
  • script/deploy/safe/config.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • config/global.json
  • script/deploy/safe/config.ts
🔇 Additional comments (23)
config/networks.json (23)

9-16: LGTM: Ethereum Mainnet configuration looks good

The new fields for the Ethereum Mainnet have been correctly added and populated with appropriate values. The use of a decentralized RPC provider (drpc.org) is a good choice for reliability.


25-32: LGTM: Arbitrum One configuration looks good

The new fields for Arbitrum One have been correctly added and populated with appropriate values. The official Arbitrum RPC endpoint is used, which is good for reliability.


41-48: LGTM: Aurora configuration looks good

The new fields for Aurora have been correctly added and populated with appropriate values. The official Aurora RPC endpoint is used, which is good for reliability.


57-64: LGTM: Avalanche C-Chain configuration looks good

The new fields for Avalanche C-Chain have been correctly added and populated with appropriate values. The official Avalanche RPC endpoint is used, which is good for reliability.


73-80: LGTM: Base configuration looks good

The new fields for Base have been correctly added and populated with appropriate values. The official Base RPC endpoint is used, which is good for reliability.


89-96: LGTM: Blast configuration looks good

The new fields for Blast have been correctly added and populated with appropriate values. The official Blast RPC endpoint is used, which is good for reliability.


105-112: LGTM: Boba Network configuration looks good

The new fields for Boba Network have been correctly added and populated with appropriate values. The official Boba Network RPC endpoint is used, which is good for reliability.


137-144: LGTM: Celo configuration looks good

The new fields for Celo have been correctly added and populated with appropriate values. The official Celo RPC endpoint is used, which is good for reliability.


169-176: LGTM with a minor concern: Fraxtal configuration

The new fields for Fraxtal have been added and mostly populated with appropriate values. However, there's a potential issue:

  • The safeApiUrl seems to be using an Optimism URL (https://transaction-frax.safe.optimism.io/api) instead of a Fraxtal-specific one. Please verify if this is correct or if it should be updated to a Fraxtal-specific Safe API URL.

185-192: LGTM with a minor concern: Fuse configuration

The new fields for Fuse have been added and mostly populated with appropriate values. However, there's a potential issue:

  • The safeApiUrl is using the same Optimism URL (https://transaction-frax.safe.optimism.io/api) as the Fraxtal network. This seems incorrect and should be updated to a Fuse-specific Safe API URL.

201-208: LGTM: Gnosis Chain configuration looks good

The new fields for Gnosis Chain have been correctly added and populated with appropriate values. The official Gnosis Chain RPC endpoint is used, which is good for reliability.


217-224: LGTM with verification needed: Gravity Bridge configuration

The new fields for Gravity Bridge have been added and populated. However, there are some points that need verification:

  1. The network is marked as "inactive". Please confirm if this is intentional.
  2. The explorer URL and Safe API URL use a different domain (gravity.xyz) than the RPC URL. Please verify if this is correct.
  3. The multicall address is different from the standard one used in most other networks. Please confirm if this is intentional.

233-240: LGTM with verification needed: Immutable zkEVM configuration

The new fields for Immutable zkEVM have been added and populated. However, there are some points that need verification:

  1. The network is marked as "inactive". Please confirm if this is intentional.
  2. The multicall address is different from the standard one used in most other networks. Please confirm if this is correct for Immutable zkEVM.

249-256: LGTM with verification needed: Kaia configuration

The new fields for Kaia have been added and populated. However, there are some points that need verification:

  1. The network is marked as "inactive". Please confirm if this is intentional.
  2. The explorer URL (kaiascope.com) and the explorer API URL (klaytnscope.com) use different domains. Please verify if this is correct.
  3. The Safe API URL uses a different domain (kaia.io) than the explorer. Please confirm if this is intentional.

265-272: LGTM: Linea configuration looks good

The new fields for Linea have been correctly added and populated with appropriate values. The official Linea RPC endpoint is used, which is good for reliability.


297-304: LGTM: Metis Andromeda Mainnet configuration looks good

The new fields for Metis Andromeda Mainnet have been correctly added and populated with appropriate values. The official Metis RPC endpoint is used, which is good for reliability.


313-320: LGTM with a minor concern: Mode configuration

The new fields for Mode have been added and mostly populated with appropriate values. However, there's a potential issue:

  • The safeApiUrl is using an Optimism URL (https://transaction-mode.safe.optimism.io/api). Please verify if this is correct or if it should be updated to a Mode-specific Safe API URL.

361-368: LGTM: Optimism configuration looks good

The new fields for Optimism have been correctly added and populated with appropriate values. The official Optimism RPC endpoint is used, which is good for reliability.


377-384: LGTM: Polygon configuration looks good

The new fields for Polygon have been correctly added and populated with appropriate values. The official Polygon RPC endpoint is used, which is good for reliability.


393-400: LGTM: Polygon zkEVM configuration looks good

The new fields for Polygon zkEVM have been correctly added and populated with appropriate values. The official Polygon zkEVM RPC endpoint is used, which is good for reliability.


409-416: LGTM with a minor concern: Rootstock configuration

The new fields for Rootstock have been added and mostly populated with appropriate values. However, there's an item that needs attention:

  • The safeAddress field is empty. Please verify if this is intentional or if a Safe address should be provided for Rootstock.

Also, note that the explorer type is set to "blockscout" instead of "etherscan", which is correct for Rootstock.


425-432: LGTM: Scroll configuration looks good

The new fields for Scroll have been correctly added and populated with appropriate values. The official Scroll RPC endpoint is used, which is good for reliability.


441-448: LGTM with verification needed: Sei Network configuration

The new fields for Sei Network have been added and populated. However, there are some points that need verification:

  1. The explorer URL and API URL use a different domain (seitrace.com) than the RPC URL. Please verify if this is correct.
  2. The Safe API URL uses a different domain (protofire.io) than the explorer and RPC URLs. Please confirm if this is intentional and correct for Sei Network.

config/networks.json Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (3)
config/networks.json (1)

Inconsistent Address Formatting Detected

Several address fields contain uppercase characters, which should be standardized to lowercase for consistency:

  • Line 7: "wrappedNativeAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
  • Line 39: "wrappedNativeAddress": "0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB"
  • Line 48: "safeAddress": "0xC7291F249424A35b17976F057D2C97B30c92b88C"
  • Line 55: "wrappedNativeAddress": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"
  • Line 215: "wrappedNativeAddress": "0xBB859E225ac8Fb6BE1C7e38D87b767e95Fef0EbD"
  • Line 293: "nativeAddress": "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000"
  • Line 336: "safeAddress": "0xB51E43CeCAB8A42cD6225e16C9C3a3ba1A76871A"
  • Line 455: "wrappedNativeAddress": "0xA51894664A773981C6C112C43ce576f315d5b1B6"
  • Line 494: "multicallAddress": "0xF9cda624FBC7e059355ce98a31693d299FACd963"

Please update these addresses to all lowercase to ensure consistency across the configuration.

🔗 Analysis chain

Line range hint 1-512: Overall improvements and final checks

The updates to this configuration file have significantly improved its comprehensiveness and consistency. Great job on standardizing the structure across all networks!

A few final points to consider:

  1. Verify the 'inactive' status for networks like gravity and immutablezkevm. Ensure this status is up-to-date and intentional.
  2. Double-check if any relevant networks are missing from this configuration.
  3. Consider if any deprecated or unused networks should be removed to keep the file concise.
  4. The consistent use of lowercase for addresses is good practice. Ensure this is maintained in future updates.

Run the following script to check for any inconsistencies in address formatting:

This script will help identify any addresses that contain uppercase characters, which should be avoided for consistency.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for uppercase characters in address fields
grep -nE '"(nativeAddress|wrappedNativeAddress|multicallAddress|safeAddress)": "0x[A-F]' config/networks.json

Length of output: 777

script/utils/viemScriptHelpers.ts (1)

31-33: Enhance the error message for missing networks

The current error message informs the user that the chain does not exist and suggests checking config/networks.json. For a better developer experience, consider listing the available network names or providing more detailed guidance on how to add a new network.

script/deploy/safe/confirm-safe-tx.ts (1)

Line range hint 146-153: Add Error Handling in 'executeTransaction' Function

The executeTransaction function correctly executes the transaction:

async function executeTransaction(
  txToConfirm: SafeMultisigTransactionResponse
) {
  consola.info('Executing transaction', txToConfirm.safeTxHash)
  const exec = await protocolKit.executeTransaction(txToConfirm)
  await exec.transactionResponse?.wait()
  consola.success('Transaction executed', txToConfirm.safeTxHash)
}

However, consider adding error handling to manage cases where transaction execution might fail due to network issues or other errors. This will enhance the robustness of the script.

Apply this diff to add try-catch blocks for better error management:

async function executeTransaction(
  txToConfirm: SafeMultisigTransactionResponse
) {
  consola.info('Executing transaction', txToConfirm.safeTxHash)
+ try {
    const exec = await protocolKit.executeTransaction(txToConfirm)
    await exec.transactionResponse?.wait()
    consola.success('Transaction executed', txToConfirm.safeTxHash)
+ } catch (error) {
+   consola.error('Transaction execution failed', error)
+   throw error
+ }
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between abd9185 and 70dcf7d.

📒 Files selected for processing (3)
  • config/networks.json (31 hunks)
  • script/deploy/safe/confirm-safe-tx.ts (3 hunks)
  • script/utils/viemScriptHelpers.ts (1 hunks)
🔇 Additional comments (6)
config/networks.json (3)

Line range hint 1-512: LGTM: Consistent structure and new fields added across all networks

The update adds several new fields to all network configurations, improving the completeness of the information. The structure is consistent, which is excellent for maintainability.

However, please verify that the 'type' field is correct for all networks. It's set to "mainnet" for all except localanvil, which is set to "testnet". Ensure this accurately reflects the nature of each network, especially for any potential testnet configurations.


450-464: New networks added: Taiko and X Layer

The addition of Taiko and X Layer networks is well-structured and consistent with other network entries. This expands the supported networks, which is great for interoperability.

Please ensure that all the provided information (chainId, addresses, URLs, etc.) for these new networks is accurate and up-to-date. It's especially important to verify this information for newer or less established networks.

Also applies to: 466-480


282-282: Network-specific updates and localanvil configuration

  1. The Mantle network's rpcUrl has been updated to use a DRPC endpoint, which is good for reliability.
  2. The Sei network configuration has been updated with mainnet information, which is appropriate given its recent mainnet launch.
  3. The localanvil network configuration has empty fields for explorer, safe, and multicall information. This is generally appropriate for a local test network, but please confirm if the empty multicallAddress is intentional, as this might be needed for local testing.

Can you confirm if the empty multicallAddress for localanvil is intentional? If a multicall address is typically used in local testing, consider adding a placeholder or default value.

Also applies to: 441-448, 505-512

script/deploy/safe/confirm-safe-tx.ts (3)

Line range hint 224-235: Remove Unreachable Code for 'Sign & Execute Later' Action

The action 'Sign & Execute Later' is no longer presented to the user in the options:

options: ['Sign & Execute Now', 'Sign', 'Execute Now'],

However, the code still includes a block handling this action:

if (action === 'Sign & Execute Later') {
  // ...
}

Since this block is now unreachable, it should be removed to clean up the code and prevent confusion.


Line range hint 277-291: Ensure Secure Handling of Private Keys

The script prompts the user to select a private key from environment variables if none is provided as an argument:

const key = await consola.prompt(
  'Which private key do you want to use from your .env file?',
  {
    type: 'select',
    options: ['PRIVATE_KEY_PRODUCTION', 'SAFE_SIGNER_PRIVATE_KEY'],
  }
)

Ensure that:

  • The environment variables PRIVATE_KEY_PRODUCTION and SAFE_SIGNER_PRIVATE_KEY are securely stored and accessed.
  • The private keys are not exposed in logs, error messages, or any unintended outputs.
  • Adequate error handling is in place if the environment variables are missing or empty.

Consider reviewing the method of handling private keys to align with best security practices, such as using secure credential management systems if applicable.


Line range hint 259-263: Verify Handling of Optional 'privateKey' Argument

The privateKey argument is now marked as optional:

privateKey: {
  type: 'string',
  description: 'Private key of the signer',
  required: false,
},

Ensure that all code paths correctly handle cases when the privateKey is not provided. Specifically, verify that:

  • The script prompts the user appropriately and provides clear instructions.
  • The absence of a private key does not lead to unexpected errors or undefined behavior.
  • All subsequent operations that depend on the privateKey have the necessary checks.

script/utils/viemScriptHelpers.ts Show resolved Hide resolved
script/utils/viemScriptHelpers.ts Show resolved Hide resolved
script/deploy/safe/confirm-safe-tx.ts Outdated Show resolved Hide resolved
@ezynda3 ezynda3 marked this pull request as ready for review October 4, 2024 09:26
@lifi-action-bot
Copy link
Collaborator

Test Coverage Report

Line Coverage: 75.15% (1576 / 2097 lines)
Function Coverage: 83.25% ( 343 / 412 functions)
Branch Coverage: 49.31% ( 253 / 513 branches)
Test coverage (75.15%) is above min threshold (74%). Check passed.

script/deploy/safe/confirm-safe-tx.ts Show resolved Hide resolved
script/utils/viemScriptHelpers.ts Show resolved Hide resolved
config/global.json Show resolved Hide resolved
config/networks.json Show resolved Hide resolved
config/networks.json Outdated Show resolved Hide resolved
@ezynda3 ezynda3 enabled auto-merge (squash) October 7, 2024 08:34
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 (2)
config/networks.json (2)

10-10: Consider documenting the use of DRPC for Ethereum Mainnet RPC URL.

The Ethereum Mainnet RPC URL is set to use DRPC (https://eth.drpc.org). This might be a deliberate choice for improved reliability or performance. Consider adding a comment or documentation to explain this choice, especially if it differs from other networks or previous configurations.


Line range hint 1-512: Consider documenting RPC provider choices and verification types.

There's a variation in RPC providers across networks, with some using DRPC (e.g., Ethereum, Arbitrum, Mantle) while others use network-specific URLs. Additionally, most networks use "etherscan" for verification, but some use "blockscout". Consider adding documentation to explain:

  1. The rationale behind using different RPC providers for certain networks.
  2. The criteria for choosing between "etherscan" and "blockscout" for verification.

This documentation would improve maintainability and help future contributors understand the configuration choices.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6c883b2 and 1f07892.

📒 Files selected for processing (1)
  • config/networks.json (31 hunks)
🧰 Additional context used
🔇 Additional comments (5)
config/networks.json (5)

Line range hint 1-512: Overall structure and consistency look good.

The file has been updated with a consistent structure across all network entries. New fields such as rpcUrl, verificationType, explorerUrl, explorerApiUrl, multicallAddress, safeApiUrl, and safeAddress have been added to each network configuration. This consistency improves the maintainability and usability of the configuration file.


450-464: Taiko network entry is complete and correct.

The Taiko network entry has been added with all required fields, including the correct chainId (167000). This resolves the previous issue of the missing chainId. The entry is consistent with other network configurations and appears to be ready for use.


Line range hint 465-480: X Layer network entry is complete and correct.

The X Layer network entry has been added with all required fields, including the rpcUrl. This resolves the previous issue of the missing RPC URL. The entry is consistent with other network configurations and appears to be ready for use.


282-282: Mantle network RPC URL has been corrected.

The rpcUrl for the Mantle network has been updated to a correct RPC URL (https://mantle.drpc.org), resolving the previous issue where it contained a multicall address. This correction ensures proper connectivity to the Mantle network.


Line range hint 1-512: Overall, the networks.json file is well-structured and complete.

The updated networks.json file demonstrates significant improvements:

  1. Consistent structure across all network entries.
  2. Addition of new fields (rpcUrl, verificationType, etc.) to enhance network configurations.
  3. Successful integration of new networks (Taiko and X Layer) with complete information.
  4. Resolution of previously identified issues (e.g., Mantle RPC URL, Taiko chainId).

The file appears ready for use, with only minor suggestions for additional documentation to improve long-term maintainability.

@ezynda3 ezynda3 merged commit 15cbb91 into main Oct 8, 2024
14 of 16 checks passed
@ezynda3 ezynda3 deleted the contracts-tools-improvements branch October 8, 2024 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants