-
Notifications
You must be signed in to change notification settings - Fork 28
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: add verify-script for checking validator migration proofs #218
Conversation
WalkthroughThis pull request introduces a comprehensive migration proof verification mechanism for blockchain validators. A new GitHub Actions workflow has been added to Changes
Sequence DiagramsequenceDiagram
participant GHA as GitHub Actions
participant Script as verify.py
participant API as Blockchain API
GHA->>Script: Trigger verification
Script->>Script: Load validator configs
Script->>API: Verify Transaction 1
API-->>Script: Return Transaction Details
Script->>API: Verify Transaction 2
API-->>Script: Return Transaction Details
Script->>Script: Compile Verification Results
Script-->>GHA: Return Verification Status
Possibly related PRs
Suggested reviewers
Poem
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
CodeRabbit Configuration File (
|
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: 6
🧹 Nitpick comments (6)
app/upgrades/v2_0/validator-proofs/verify.py (2)
10-10
: Specify timeouts for HTTP requestsWhen making HTTP requests, it's good practice to specify a timeout to prevent the script from hanging indefinitely in case of network issues.
Apply this diff to set a timeout for the requests:
def verify_tx(api_endpoint, tx_hash, expect_from_address, expect_to_address): - x = requests.get(api_endpoint + "/cosmos/tx/v1beta1/txs/" + tx_hash) + x = requests.get(api_endpoint + "/cosmos/tx/v1beta1/txs/" + tx_hash, timeout=10) def verify_proof(api_endpoint, entry): - x = requests.get(api_endpoint + "/cosmos/staking/v1beta1/validators/" + entry["consensus_address"]) + x = requests.get(api_endpoint + "/cosmos/staking/v1beta1/validators/" + entry["consensus_address"], timeout=10) - x = requests.get(api_endpoint + "/kyve/query/v1beta1/staker/" + entry["protocol_address"]) + x = requests.get(api_endpoint + "/kyve/query/v1beta1/staker/" + entry["protocol_address"], timeout=10)Also applies to: 28-28, 32-32
52-55
: Provide more informative error loggingWhen catching exceptions, consider logging more detailed information to assist with debugging. Currently, only the exception is printed. Including the stack trace can be helpful.
Apply this diff to improve error logging:
except Exception as e: print("[{}]".format(name.title()), file, "❌") - print(e) + import traceback + traceback.print_exc() status["error"] += 1.github/workflows/migration.yml (3)
17-17
: Add a newline at the end of the fileThe file is missing a newline character at the end, which can cause issues in some systems or tools that expect a terminating newline.
🧰 Tools
🪛 yamllint (1.35.1)
[error] 17-17: no new line character at the end of file
(new-line-at-end-of-file)
13-14
: Pin dependency versions for reproducibilityTo ensure consistent and reproducible builds, it's recommended to specify exact versions for dependencies.
Apply this diff to pin the dependency versions:
- name: Install dependencies - run: pip3 install bech32 requests + run: pip3 install bech32==1.2.0 requests==2.31.0Alternatively, consider using a
requirements.txt
file to manage dependencies.
7-11
: Specify the Python version for consistencyTo ensure the workflow runs with the expected Python version, consider adding a step to set up Python using
actions/setup-python
.Apply this diff to specify the Python version:
jobs: test: runs-on: ubuntu-latest + steps: + - name: Set up Python 3.8 + uses: actions/setup-python@v4 + with: + python-version: '3.8' steps: # Checkout the repositoryThis ensures that the script runs in a consistent Python environment across different runs.
app/upgrades/v2_0/validator-proofs/Readme.md (1)
21-24
: Enhance security guidance for transactions.Consider adding important security notes:
- Verify transaction amounts and addresses before sending
- Document recovery procedures for failed transactions
- Add a warning about potential scams/phishing attempts
🧰 Tools
🪛 Markdownlint (0.37.0)
24-24: null
Bare URL used(MD034, no-bare-urls)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
.github/workflows/all.yml
(1 hunks).github/workflows/migration.yml
(1 hunks)app/upgrades/v2_0/validator-proofs/Readme.md
(1 hunks)app/upgrades/v2_0/validator-proofs/kaon/example-validator.json
(0 hunks)app/upgrades/v2_0/validator-proofs/mainnet/example-validator.json
(0 hunks)app/upgrades/v2_0/validator-proofs/verify.py
(1 hunks)
💤 Files with no reviewable changes (2)
- app/upgrades/v2_0/validator-proofs/mainnet/example-validator.json
- app/upgrades/v2_0/validator-proofs/kaon/example-validator.json
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/migration.yml
[error] 17-17: no new line character at the end of file
(new-line-at-end-of-file)
🪛 Markdownlint (0.37.0)
app/upgrades/v2_0/validator-proofs/Readme.md
14-14: Column: 4
Hard tabs
(MD010, no-hard-tabs)
24-24: null
Bare URL used
(MD034, no-bare-urls)
🪛 Ruff (0.8.2)
app/upgrades/v2_0/validator-proofs/verify.py
47-47: Use a context manager for opening files
(SIM115)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: test / test
- GitHub Check: Summary
🔇 Additional comments (1)
.github/workflows/all.yml (1)
5-6
: LGTM!The new job
verify-migration-proofs
is correctly added and utilizes themigration.yml
workflow appropriately.
Summary by CodeRabbit
New Features
Documentation
Chores