-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Conversation
fixes incorrect checksums introduced in cosmos#21911 Signed-off-by: Artur Troian <[email protected]>
📝 WalkthroughWalkthroughThe changes involve updates to the JSON structures related to the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 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 codeThe 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
⛔ 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:
Verify that the new checksum value
sha256:339911508de5e20b573ce902c500ee670589073485216bee8b045e853f24bce8
is correct for theautod.zip
file.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\"}}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 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:
-
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.
-
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
@julienrbrt I completely forgot to update checksums in #21911 and there was no way to know it until it was merged to 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. |
fixes cosmos#21911 cosmos#21933 Signed-off-by: Artur Troian <[email protected]>
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...
!
in the type prefix if API or client breaking changeCHANGELOG.md
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...
Summary by CodeRabbit
New Features
Bug Fixes