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

chore(tools/cosmovisor): update download checksums #21933

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

troian
Copy link
Contributor

@troian troian commented Sep 26, 2024

fixes incorrect checksums introduced in #21911

Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • New Features

    • Updated checksum values for binaries in the configuration for better integrity verification across platforms (linux/amd64, linux/arm64, darwin/amd64, darwin/arm64).
  • Bug Fixes

    • Ensured that the correct versions of binaries are linked for the blockchain configuration, enhancing reliability.

fixes incorrect checksums introduced in cosmos#21911

Signed-off-by: Artur Troian <[email protected]>
@troian troian requested review from julienrbrt, facundomedica and a team as code owners September 26, 2024 14:47
@github-actions github-actions bot added the C:Cosmovisor Issues and PR related to Cosmovisor label Sep 26, 2024
Copy link
Contributor

coderabbitai bot commented Sep 26, 2024

📝 Walkthrough

Walkthrough

The changes involve updates to the JSON structures related to the autod binaries for two blockchain configurations, chain2 and chain3. Specifically, the checksum values for binaries across various platforms (linux/amd64, linux/arm64, darwin/amd64, darwin/arm64) have been modified to reflect new binary versions, while the URLs for the binaries remain unchanged.

Changes

File Path Change Summary
tools/cosmovisor/testdata/download/cosmovisor/genesis/bin/autod Updated checksum values in the info field for binaries targeting various platforms.
tools/cosmovisor/testdata/repo/chain2-zip_bin/autod Modified checksum values in the JSON structure for binaries across different operating systems.

Possibly related PRs

Suggested reviewers

  • facundomedica
  • julienrbrt
  • tac0turtle

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.

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

🧹 Outside diff range and nitpick comments (1)
tools/cosmovisor/testdata/download/cosmovisor/genesis/bin/autod (1)

Line range hint 17-17: Consider removing unreachable code

The last echo statement in the script is never executed because the script exits after creating the JSON file. To improve code clarity and prevent confusion for future maintainers, consider removing this line:

- echo Never should be printed!!!
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between dbf6cdb and 04608d7.

⛔ Files ignored due to path filters (1)
  • tools/cosmovisor/testdata/repo/chain2-zip_bin/autod.zip is excluded by !**/*.zip
📒 Files selected for processing (2)
  • tools/cosmovisor/testdata/download/cosmovisor/genesis/bin/autod (1 hunks)
  • tools/cosmovisor/testdata/repo/chain2-zip_bin/autod (1 hunks)
🔇 Additional comments (1)
tools/cosmovisor/testdata/download/cosmovisor/genesis/bin/autod (1)

13-13: Checksum update looks good, but needs verification.

The update to the checksum values aligns with the PR objective of fixing incorrect checksums. However, please ensure the following:

  1. Verify that the new checksum value sha256:339911508de5e20b573ce902c500ee670589073485216bee8b045e853f24bce8 is correct for the autod.zip file.

  2. Confirm if it's intentional that all platforms (linux/amd64, linux/arm64, darwin/amd64, darwin/arm64) have the same checksum. Typically, binaries for different platforms would have different checksums unless they're pointing to a platform-agnostic file.

To verify the checksum, you can use the following command:

Compare the output with the checksum in the script to ensure they match.

@@ -10,7 +10,7 @@ cat > "$3" <<EOL
{
"name": "chain3",
"height": 936,
"info": "{\"binaries\":{\"linux/amd64\": \"https://github.com/cosmos/cosmos-sdk/raw/main/tools/cosmovisor/testdata/repo/ref_to_chain3-zip_dir.json?checksum=sha256:a95075f4dd83bc9f0f556ef73e64ce000f9bf3a6beeb9d4ae32f594b1417ef7a\",\"linux/arm64\": \"https://github.com/cosmos/cosmos-sdk/raw/main/tools/cosmovisor/testdata/repo/ref_to_chain3-zip_dir.json?checksum=sha256:a95075f4dd83bc9f0f556ef73e64ce000f9bf3a6beeb9d4ae32f594b1417ef7a\",\"darwin/amd64\": \"https://github.com/cosmos/cosmos-sdk/raw/main/tools/cosmovisor/testdata/repo/ref_to_chain3-zip_dir.json?checksum=sha256:a95075f4dd83bc9f0f556ef73e64ce000f9bf3a6beeb9d4ae32f594b1417ef7a\",\"darwin/arm64\": \"https://github.com/cosmos/cosmos-sdk/raw/main/tools/cosmovisor/testdata/repo/ref_to_chain3-zip_dir.json?checksum=sha256:a95075f4dd83bc9f0f556ef73e64ce000f9bf3a6beeb9d4ae32f594b1417ef7a\"}}"
"info": "{\"binaries\":{\"linux/amd64\": \"https://github.com/cosmos/cosmos-sdk/raw/main/tools/cosmovisor/testdata/repo/ref_to_chain3-zip_dir.json?checksum=sha256:6758973f7404f6d34381029931b85826fc7a6315584ede03bad4c19e9b787f6c\",\"linux/arm64\": \"https://github.com/cosmos/cosmos-sdk/raw/main/tools/cosmovisor/testdata/repo/ref_to_chain3-zip_dir.json?checksum=sha256:6758973f7404f6d34381029931b85826fc7a6315584ede03bad4c19e9b787f6c\",\"darwin/amd64\": \"https://github.com/cosmos/cosmos-sdk/raw/main/tools/cosmovisor/testdata/repo/ref_to_chain3-zip_dir.json?checksum=sha256:6758973f7404f6d34381029931b85826fc7a6315584ede03bad4c19e9b787f6c\",\"darwin/arm64\": \"https://github.com/cosmos/cosmos-sdk/raw/main/tools/cosmovisor/testdata/repo/ref_to_chain3-zip_dir.json?checksum=sha256:6758973f7404f6d34381029931b85826fc7a6315584ede03bad4c19e9b787f6c\"}}"
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Issue Detected: Referenced JSON File is Empty

The JSON file ref_to_chain3-zip_dir.json was successfully downloaded; however, it is empty. This will prevent proper configuration and checksum validation.

  • Ensure that ref_to_chain3-zip_dir.json contains the necessary data.
  • Verify the generation process of the JSON file to prevent it from being empty.
  • Confirm the URL is correct and points to a valid JSON file with the expected content.
🔗 Analysis chain

Checksum update approved, but please verify platform-specific checksums and URL structure.

The update to the checksums aligns with the PR objectives of fixing incorrect checksums. However, there are a couple of points that require attention:

  1. The same checksum is used for all platforms (linux/amd64, linux/arm64, darwin/amd64, darwin/arm64). This is unusual as typically different platforms would have different binary files and thus different checksums. Please verify if this is intentional and correct.

  2. The URL in the "info" field points to a JSON file (ref_to_chain3-zip_dir.json) rather than directly to binary files. While this might be intentional for the test data, it's worth confirming that this structure is correct for the intended use case.

To verify the checksums and URL structure, you can run the following script:

This script will help confirm if the use of identical checksums for all platforms is intentional and if the URL structure is correct for your use case.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the checksums and URL structure in the configuration

# Test: Check if the checksum is the same for all platforms
echo "Checking if checksums are identical for all platforms:"
grep -o 'checksum=sha256:[a-f0-9]*' tools/cosmovisor/testdata/repo/chain2-zip_bin/autod | sort | uniq -c

# Test: Verify the structure of the URL (should point to a JSON file)
echo "Verifying URL structure:"
grep -o 'https://.*\.json' tools/cosmovisor/testdata/repo/chain2-zip_bin/autod

# Test: If possible, download and check the content of the referenced JSON file
echo "Attempting to download and display the content of the referenced JSON file:"
curl -s "https://github.com/cosmos/cosmos-sdk/raw/main/tools/cosmovisor/testdata/repo/ref_to_chain3-zip_dir.json" | jq .

Length of output: 1460


Script:

#!/bin/bash
# Description: Verify the existence, size, and JSON validity of the referenced JSON file.

# Test: Check if the JSON file exists and download it
echo "Checking if the referenced JSON file exists and downloading it:"
curl -s -f "https://github.com/cosmos/cosmos-sdk/raw/main/tools/cosmovisor/testdata/repo/ref_to_chain3-zip_dir.json" -o ref_to_chain3-zip_dir.json
if [ $? -eq 0 ]; then
    echo "JSON file downloaded successfully."
else
    echo "Failed to download the JSON file. It may not exist or the URL is incorrect."
    exit 1
fi

# Test: Check the size of the JSON file
echo "Checking the size of the JSON file:"
FILE_SIZE=$(stat -c%s "ref_to_chain3-zip_dir.json")
if [ $FILE_SIZE -gt 0 ]; then
    echo "JSON file size: $FILE_SIZE bytes."
else
    echo "JSON file is empty."
    exit 1
fi

# Test: Validate the JSON structure
echo "Validating the JSON structure:"
jq empty ref_to_chain3-zip_dir.json
if [ $? -eq 0 ]; then
    echo "JSON structure is valid."
else
    echo "JSON structure is invalid or malformed."
    exit 1
fi

Length of output: 742


Script:

#!/bin/bash
# Description: Verify the existence, size, and JSON validity of the referenced JSON file.

# Test: Check if the JSON file exists and download it
echo "Checking if the referenced JSON file exists and downloading it:"
curl -s -f "https://github.com/cosmos/cosmos-sdk/raw/main/tools/cosmovisor/testdata/repo/ref_to_chain3-zip_dir.json" -o ref_to_chain3-zip_dir.json
if [ $? -eq 0 ]; then
    echo "JSON file downloaded successfully."
else
    echo "Failed to download the JSON file. It may not exist or the URL is incorrect."
    exit 1
fi

# Test: Check the size of the JSON file using wc -c
echo "Checking the size of the JSON file:"
FILE_SIZE=$(wc -c < "ref_to_chain3-zip_dir.json")
if [ "$FILE_SIZE" -gt 0 ]; then
    echo "JSON file size: $FILE_SIZE bytes."
else
    echo "JSON file is empty."
    exit 1
fi

# Test: Validate the JSON structure
echo "Validating the JSON structure:"
jq empty ref_to_chain3-zip_dir.json
if [ $? -eq 0 ]; then
    echo "JSON structure is valid."
else
    echo "JSON structure is invalid or malformed."
    exit 1
fi

Length of output: 560

@troian
Copy link
Contributor Author

troian commented Sep 26, 2024

@julienrbrt I completely forgot to update checksums in #21911 and there was no way to know it until it was merged to main

imo it's better option to keep such testdata in a separate repo

@julienrbrt julienrbrt changed the title fix(tools/cosmovisor): update download checksums chore(tools/cosmovisor): update download checksums Sep 26, 2024
@julienrbrt julienrbrt disabled auto-merge September 26, 2024 18:01
@julienrbrt julienrbrt added this pull request to the merge queue Sep 26, 2024
@julienrbrt
Copy link
Member

@julienrbrt I completely forgot to update checksums in #21911 and there was no way to know it until it was merged to main

imo it's better option to keep such testdata in a separate repo

Same repo is fine. We don't touch them that often. I get bitten by it too sometimes, but that's a minor issue.

Merged via the queue into cosmos:main with commit 89d96e8 Sep 26, 2024
78 checks passed
troian added a commit to akash-network/cosmos-sdk that referenced this pull request Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Cosmovisor Issues and PR related to Cosmovisor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants