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

remove unused testnet entries from foundry.toml #957

Merged
merged 2 commits into from
Jan 28, 2025

Conversation

0xDEnYO
Copy link
Contributor

@0xDEnYO 0xDEnYO commented Jan 28, 2025

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!!!)

  • 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 Jan 28, 2025

Walkthrough

The pull request modifies the foundry.toml configuration file by adding numerous new RPC endpoints for various mainnet blockchain networks, including Base, Blast, and Polygon, among others. It also removes several testnet entries, specifically Goerli, BSC Testnet, and Mumbai, indicating a shift in focus towards mainnet support. Additionally, the Etherscan section retains the Base entry while removing testnet configurations, reflecting a broader strategy to streamline the configuration for mainnet interactions.

Changes

File Change Summary
foundry.toml - Added 35+ new mainnet RPC endpoints (e.g., Base, Blast, BSC, Polygon, etc.)
- Removed testnet entries (Goerli, BSC Testnet, Mumbai)
- Retained Base Etherscan configuration while removing testnet entries

Possibly related PRs

  • updated foundry.toml with etherscanV2 links #926: This PR updates the foundry.toml file with etherscanV2 links, which is directly related to the changes made in the main PR that also modifies the foundry.toml file, particularly in the [etherscan] section.
  • use etherscanv2 for avalanche and mainnet #927: This PR also modifies the foundry.toml file to use etherscanV2 for the mainnet, aligning with the main PR's changes that involve updates to the RPC endpoints and the [etherscan] section.

Suggested reviewers

  • mirooon

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

@lifi-action-bot lifi-action-bot marked this pull request as draft January 28, 2025 03:02
@0xDEnYO 0xDEnYO marked this pull request as ready for review January 28, 2025 03:04
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 comments (1)
foundry.toml (1)

Consider using dedicated API keys for each network instead of reusing MAINNET_ETHERSCAN_API_KEY

Reusing the same API key across multiple networks (22 networks currently use MAINNET_ETHERSCAN_API_KEY) poses several risks:

  • Rate limiting could affect multiple networks simultaneously
  • If compromised, attacker gains access to multiple networks
  • Different networks might have different API requirements
🔗 Analysis chain

Line range hint 74-124: Verify Etherscan API key configuration.

Let's ensure all required API keys are properly configured:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if all Etherscan API keys are configured in the CI/CD environment

# Extract all API key environment variables
echo "Checking Etherscan API keys..."
grep -o '[A-Z]*_ETHERSCAN_API_KEY' foundry.toml | sort -u | while read -r var; do
  if [[ -z "${!var}" ]]; then
    echo "❌ Missing: $var"
  else
    echo "✅ Found: $var"
  fi
done

Length of output: 1888

🧹 Nitpick comments (1)
foundry.toml (1)

Line range hint 31-70: Consider sorting RPC endpoints alphabetically.

For better maintainability and easier navigation, consider sorting the RPC endpoints alphabetically.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 663278d and 895bbf1.

📒 Files selected for processing (1)
  • foundry.toml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: enforce-min-test-coverage
  • GitHub Check: run-unit-tests
  • GitHub Check: generate-tag
  • GitHub Check: analyze
🔇 Additional comments (3)
foundry.toml (3)

Line range hint 74-124: Review the reuse of MAINNET_ETHERSCAN_API_KEY across multiple networks.

Several networks are configured to use the mainnet Etherscan API key. While this might work, consider:

  1. Rate limiting implications when sharing the same API key
  2. Security implications if the key has broader permissions than necessary
  3. Potential issues if networks require different API key permissions

Consider using network-specific API keys where appropriate.


71-71: Successfully removed unused testnet entries.

The removal of unused testnet entries (goerli, bsc-testnet, mumbai) while retaining localanvil for local development aligns well with the PR objectives.


Line range hint 31-70: PR scope expanded beyond removing testnets.

While the PR objective was to remove unused testnet entries, it also adds numerous mainnet RPC endpoints. Please clarify if this expansion was intentional.

Let's verify that all the new environment variables are properly configured:

✅ Verification successful

Environment configuration is properly documented and supported

The PR changes are consistent with the .env.example file, which provides default public RPC URLs for all the new mainnet networks. While our initial check showed missing environment variables, this is expected in the sandbox environment. The documentation in Deploy.md and .env.example provides clear guidance for setting up these variables in actual deployment environments.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if all ETH_NODE_URI environment variables are configured in the CI/CD environment
# and verify they are valid URLs

# Extract all environment variable names from foundry.toml
echo "Checking environment variables..."
grep -o 'ETH_NODE_URI_[A-Z]*' foundry.toml | sort -u | while read -r var; do
  # Check if variable exists in environment
  if [[ -z "${!var}" ]]; then
    echo "❌ Missing: $var"
  else
    # Validate URL format (basic check)
    if [[ "${!var}" =~ ^(http|https):// ]]; then
      echo "✅ Valid: $var"
    else
      echo "⚠️ Invalid URL format: $var"
    fi
  fi
done

Length of output: 4424


Script:

#!/bin/bash
# Check for environment variable documentation
echo "Checking for environment setup documentation..."
fd -t f -e md -e env -e example --exec grep -l -i "ETH_NODE_URI" {} \;

# Check for example environment files
echo -e "\nChecking for example environment files..."
fd -g "*.env*" -g "env.*"

Length of output: 430


Script:

#!/bin/bash
echo "=== Contents of docs/Deploy.md ==="
cat docs/Deploy.md

echo -e "\n=== Contents of .env.example ==="
cat .env.example

Length of output: 8543

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 comments (1)
foundry.toml (1)

Environment variables are properly configured but need cleanup

The RPC endpoints in foundry.toml are properly documented in .env.example with default values. However, there's an inconsistency:

  • .env.example still contains removed testnet endpoints (goerli, sepolia, mumbai, bsctest, lineatest, zksync_goerli)
  • Consider removing these testnet entries from .env.example to maintain consistency with foundry.toml
🔗 Analysis chain

Line range hint 31-70: LGTM! New mainnet RPC endpoints follow consistent naming pattern.

The additions expand mainnet support while maintaining consistent environment variable naming convention.

Let's verify that all new environment variables are properly configured:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if all RPC environment variables are defined in the CI environment

# Extract all ETH_NODE_URI environment variables
rg 'ETH_NODE_URI_[A-Z]+' foundry.toml | cut -d'"' -f2 | sort > /tmp/required_vars.txt

# Check if each variable is defined
while IFS= read -r var; do
  if ! printenv "$var" > /dev/null; then
    echo "Warning: $var is not defined"
  fi
done < /tmp/required_vars.txt

Length of output: 11253


Script:

#!/bin/bash
# Look for environment setup documentation or configuration
echo "=== Checking for environment setup files ==="
fd -t f -e yml -e yaml -e env -e md

echo -e "\n=== Checking README for environment setup instructions ==="
if [ -f "README.md" ]; then
  rg -i "environment|env|rpc|node.*uri" README.md
fi

echo -e "\n=== Checking for .env.example or similar files ==="
fd -t f -g "*env*"

Length of output: 2119


Script:

#!/bin/bash
# Check .env.example for RPC endpoint documentation
echo "=== Checking .env.example for RPC endpoints ==="
rg "ETH_NODE_URI_" .env.example

echo -e "\n=== Checking for any comments or instructions ==="
rg "^#.*ETH_NODE_URI" .env.example

Length of output: 3474

🧹 Nitpick comments (1)
foundry.toml (1)

71-71: Remove unnecessary empty line.

The empty line at line 71 creates unnecessary whitespace.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 895bbf1 and ad7b49b.

📒 Files selected for processing (1)
  • foundry.toml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: run-unit-tests
  • GitHub Check: enforce-min-test-coverage
  • GitHub Check: generate-tag
  • GitHub Check: analyze
🔇 Additional comments (1)
foundry.toml (1)

Line range hint 74-127: LGTM! Etherscan configurations are properly structured.

The configurations include appropriate API keys, URLs, chain IDs, and verifier types where needed.

Let's verify that all Etherscan API key environment variables are properly configured:

@lifi-action-bot
Copy link
Collaborator

Test Coverage Report

Line Coverage: 78.66% (2238 / 2845 lines)
Function Coverage: 84.71% ( 388 / 458 functions)
Branch Coverage: 39.60% ( 221 / 558 branches)
Test coverage (78.66%) is above min threshold (76%). Check passed.

@ezynda3 ezynda3 enabled auto-merge (squash) January 28, 2025 13:25
@ezynda3 ezynda3 merged commit 305600c into main Jan 28, 2025
18 of 19 checks passed
@ezynda3 ezynda3 deleted the remove-testnets-from-foundry-toml branch January 28, 2025 13:25
@coderabbitai coderabbitai bot mentioned this pull request Feb 7, 2025
8 tasks
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.

4 participants