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 celestia-node.sh to use curl instead of wget #1816

Merged
merged 4 commits into from
Nov 28, 2024

Conversation

lukecd
Copy link
Contributor

@lukecd lukecd commented Nov 28, 2024

This update modifies celestia-node.sh to use curl instead of wget as curl is installed by default on new macs

Summary by CodeRabbit

  • New Features
    • Enhanced download mechanism using curl for improved reliability.
  • Bug Fixes
    • Improved error handling during the download process to ensure failures are logged and handled appropriately.

Copy link
Contributor

coderabbitai bot commented Nov 28, 2024

Walkthrough

The changes in the public/celestia-node.sh script involve updating the file download method from wget to curl, enhancing the error handling for download failures, and maintaining the existing control flow and validation processes. The script continues to check the operating system and architecture, validate version formats, and perform checksum verification after downloads. Overall, the modifications streamline the download process while preserving the script's core functionality.

Changes

File Change Summary
public/celestia-node.sh Replaced wget commands with curl -L for downloading files; improved error handling for downloads.

Possibly related issues

Poem

🐇 In the meadow where the bunnies play,
A script was changed in a clever way.
With curl now leading the download race,
Error handling's here, keeping up the pace.
Hops of joy for a smoother ride,
Celestia's node, now with pride! 🌼


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: 0

🧹 Outside diff range and nitpick comments (2)
public/celestia-node.sh (2)

114-117: LGTM with a minor suggestion for error messaging.

The curl command is correctly implemented with proper redirect handling and error checking. However, consider enhancing the error message to be more specific.

-    echo "Download failed. Exiting." | tee -a "$LOGFILE"
+    echo "Failed to download celestia-node binary. Please check your internet connection and try again." | tee -a "$LOGFILE"

127-130: Consider enhancing security by verifying checksums.txt authenticity.

While the download mechanism is correct, consider adding GPG signature verification for the checksums.txt file to prevent potential tampering.

This would involve:

  1. Downloading the GPG signature file
  2. Importing the Celestia release public key
  3. Verifying the signature before using the checksums

Example implementation:

# Download signature
curl -L "https://github.com/celestiaorg/celestia-node/releases/download/$VERSION/checksums.txt.sig" -o "checksums.txt.sig"

# Import Celestia's public key (this should be done once and key fingerprint should be verified)
gpg --keyserver keyserver.ubuntu.com --recv-keys <CELESTIA_PUBLIC_KEY>

# Verify signature
gpg --verify checksums.txt.sig checksums.txt || {
    echo "Checksums signature verification failed. Possible tampering detected. Exiting." | tee -a "$LOGFILE"
    exit 1
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 10ce530 and df6b6ac.

📒 Files selected for processing (1)
  • public/celestia-node.sh (3 hunks)
🔇 Additional comments (1)
public/celestia-node.sh (1)

Line range hint 114-130: Verify curl availability and behavior across platforms.

The implementation successfully replaces wget with curl, improving Mac compatibility. Let's verify the curl behavior across different platforms.

✅ Verification successful

Curl implementation verified and secure across platforms

The verification confirms:

  • HTTPS protocol support is available
  • Proper handling of redirects
  • Correct file output handling, including spaces in filenames
  • SSL/TLS support for secure downloads
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify curl behavior and version across different platforms

# Test curl availability and SSL support
curl --version | grep -i "protocols.*https"

# Test redirect following behavior
curl -sI -L "https://github.com/celestiaorg/celestia-node/releases/latest" | grep -i "location"

# Test output to file with spaces (edge case)
touch "test file.txt"
if curl -L "https://github.com/celestiaorg/celestia-node/releases/latest" -o "test file.txt" 2>/dev/null; then
    echo "Curl handles filenames with spaces correctly"
    rm "test file.txt"
fi

Length of output: 595

Copy link
Member

@jcstein jcstein left a comment

Choose a reason for hiding this comment

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

Resolves #1816

@jcstein jcstein merged commit 5707d8f into celestiaorg:main Nov 28, 2024
3 of 4 checks passed
Copy link

gitpoap-bot bot commented Nov 28, 2024

Congrats, your important contribution to this open-source project has earned you a GitPOAP!

GitPOAP: 2024 Celestia Contributor:

GitPOAP: 2024 Celestia Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants