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

Problem: submit-legacy-proposal doesn't work for rc5 #1699

Merged
merged 3 commits into from
Nov 19, 2024

Conversation

mmsqe
Copy link
Collaborator

@mmsqe mmsqe commented Nov 19, 2024

no upgrade-height related flags

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

Summary by CodeRabbit

  • New Features

    • Introduced a new method for submitting software upgrade proposals via the CLI.
    • Added support for a new release version, enhancing the upgrade configuration.
  • Bug Fixes

    • Improved transaction handling and gas limit logic in tests to ensure accurate inclusion in blocks.
  • Documentation

    • Updated comments and organization in test files for better clarity.
  • Refactor

    • Streamlined upgrade testing logic and simplified control flow for upgrade proposals.

@mmsqe mmsqe requested a review from a team as a code owner November 19, 2024 01:33
@mmsqe mmsqe requested review from yihuang and calvinaco and removed request for a team November 19, 2024 01:33
Copy link
Contributor

coderabbitai bot commented Nov 19, 2024

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • testground/benchmark/poetry.lock is excluded by !**/*.lock

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes in this pull request introduce a new release version v1.4.x in the upgrade-test-package.nix configuration, defining a new variable released1_4 to link to the crypto-org-chain/cronos repository. The CosmosCLI class is enhanced with a new method software_upgrade for submitting software upgrade proposals, while existing methods are updated to accommodate this functionality. The upgrade testing logic in test_upgrade.py is refined to streamline the upgrade process and improve clarity, alongside modifications to the test_basic.py file for transaction handling.

Changes

File Change Summary
integration_tests/configs/... - Added variable released1_4 for v1.4.x release.
- Updated pkgs.linkFarm to include { name = "v1.4"; path = released1_4; }.
- Added { name = "v1.4.0-rc5-testnet"; path = current; }.
integration_tests/cosmoscli.py - Added method software_upgrade(self, proposer, proposal, **kwargs) to submit software upgrade proposals.
- Modified gov_propose_legacy for handling software upgrade proposals.
integration_tests/test_basic.py - Modified test_tx_inclusion to include new variable cli and refined transaction handling logic.
- Updated assertions for transaction inclusion based on gas limits.
integration_tests/test_upgrade.py - Replaced gov_propose_legacy with software_upgrade for upgrade proposals.
- Updated do_upgrade function to streamline upgrade height calculations.
- Adjusted assertions for upgrade proposals.

Possibly related PRs

Suggested reviewers

  • calvinaco
  • devashishdxt
  • yihuang

🐇 In the garden, upgrades bloom,
With v1.4 dispelling gloom.
Proposals now take flight,
Through CLI's guiding light.
Hop along, let changes flow,
In the code, our progress show! 🌼


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

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 16.88%. Comparing base (a3c2f70) to head (b7b4434).
Report is 5 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1699   +/-   ##
=======================================
  Coverage   16.87%   16.88%           
=======================================
  Files          72       72           
  Lines        6163     6167    +4     
=======================================
+ Hits         1040     1041    +1     
- Misses       5000     5002    +2     
- Partials      123      124    +1     
---- 🚨 Try these New Features:

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 (5)
integration_tests/test_upgrade.py (2)

165-194: Simplify the do_upgrade function to reduce code duplication

The do_upgrade function contains duplicated code in the upgrade proposal logic for different plan_name values. Refactoring can enhance maintainability by abstracting common elements.

Consider the following refactor:

  • Create a common proposal data dictionary with shared parameters.
  • Modify only the necessary fields based on the plan_name.
  • Use a single method call for proposal submission if possible.

290-290: Add validation steps after upgrading to "v1.4"

Currently, there are no checks following the upgrade to "v1.4". Including validation steps similar to previous upgrades can help verify that all functionalities operate as expected.

Consider adding tests to:

  • Validate basic transaction capabilities.
  • Ensure smart contract interactions function correctly.
  • Confirm that upgraded parameters are in effect.
integration_tests/cosmoscli.py (3)

731-732: Consider removing --no-validate to ensure transaction validation

Using the --no-validate flag skips client-side validation of the transaction, which could result in invalid or malformed transactions being submitted. It is generally advisable to allow the client to perform validation checks before broadcasting the transaction. Consider removing this flag to ensure transaction integrity.


722-722: Add a docstring to software_upgrade method for better documentation

Consider adding a docstring to the software_upgrade method to describe its functionality, parameters, and return value. This will enhance code readability and assist future maintainers in understanding its purpose.


722-749: Evaluate overlap between software_upgrade and gov_propose_legacy methods

The new software_upgrade method appears to have similar functionality to the existing gov_propose_legacy method when handling software upgrade proposals. To avoid code duplication and improve maintainability, consider refactoring these methods by consolidating common logic or extending the existing method to support the new requirements.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d578a16 and de6b464.

📒 Files selected for processing (4)
  • integration_tests/configs/upgrade-test-package.nix (2 hunks)
  • integration_tests/cosmoscli.py (1 hunks)
  • integration_tests/test_basic.py (1 hunks)
  • integration_tests/test_upgrade.py (3 hunks)
🔇 Additional comments (6)
integration_tests/configs/upgrade-test-package.nix (2)

48-52: Verify version consistency in upgrade path

The new entries in linkFarm establish an upgrade path from v1.4 to v1.4.0-rc5-testnet. This aligns with the PR objective to fix the submit-legacy-proposal for rc5.

#!/bin/bash
# Description: Verify version consistency across the codebase

# Check for any other references to these versions
rg "v1\.4\.0-rc5-testnet" --type nix --type python

# Look for upgrade height configurations
rg "upgrade.*height" --type python

24-26: Verify the commit hash for v1.4.x release

The addition of v1.4.x release configuration follows the established pattern, but let's verify the referenced commit.

✅ Verification successful

Based on the search results, I can verify that the commit hash ce797fa995000530ee53cd1fbeb3c67180648002 is correctly used in the upgrade-test-package.nix file and follows the established pattern for release configurations. The file shows:

  1. The commit is used for v1.4.x release configuration
  2. It's properly referenced in the linkFarm entries
  3. The pattern matches other release configurations in the file

Additionally, the search results show this is the only occurrence of this commit hash in the Nix files, which is expected.

The v1.4.x release configuration is properly set up

The upgrade test package configuration follows the established pattern and correctly maps the versions in the linkFarm entries:

  • v1.4 points to released1_4 (using the verified commit)
  • v1.4.0-rc5-testnet points to current package
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the commit hash exists and is from the correct branch

# Check if the commit exists and get its details
gh api \
  -H "Accept: application/vnd.github+json" \
  repos/crypto-org-chain/cronos/commits/ce797fa995000530ee53cd1fbeb3c67180648002 \
  --jq '.commit.message' 

# Verify it's from the v1.4.x branch
gh api \
  -H "Accept: application/vnd.github+json" \
  repos/crypto-org-chain/cronos/branches \
  --jq '.[] | select(.name | contains("v1.4")) | .name'

Length of output: 423


Script:

#!/bin/bash
# Let's try a different approach to verify the commit and branch information

# 1. Search for v1.4 related configurations in Nix files
rg "v1\.4" --type nix -A 3 -B 3

# 2. Search for the specific commit hash pattern
rg "ce797fa995000530ee53cd1fbeb3c67180648002" --type nix

# 3. Check other version patterns to understand the structure
rg "fetchFlake.*cronos" --type nix

# 4. Look for any documentation about version configurations
fd "README|CHANGELOG" --type f --exec cat {}

Length of output: 72638

integration_tests/test_basic.py (1)

875-875: LGTM: CLI instance correctly initialized after configuration changes.

The placement of obtaining the Cosmos CLI instance is correct, ensuring it reflects any configuration changes made through the supervisor.

integration_tests/test_upgrade.py (3)

165-194: Verify the need for the mode parameter in do_upgrade

The mode parameter is only used in the cli.gov_propose_legacy call and defaults to None. If it's not required, consider removing it from the function signature to simplify the code.

If mode is necessary in specific scenarios, ensure that it's appropriately passed when calling do_upgrade.


286-287: Confirm transaction history remains consistent after the upgrade

The assertion assert txs == get_txs(base_port, height) checks that transaction results are unchanged post-upgrade. Ensure that the upgrade doesn't inadvertently alter transaction history or blockchain state.


301-303: Basic transaction check after upgrading to "v1.4.0-rc5-testnet"

The check_basic_tx(c) function confirms that basic transactions work post-upgrade. This is a good practice to ensure the network's core functionalities remain intact.

integration_tests/cosmoscli.py Show resolved Hide resolved
Copy link

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
pypi/[email protected] environment, eval, filesystem, network, shell, unsafe +475 2.51 GB Andrew.Svetlov, fafhrd, webknjaz

🚮 Removed packages: pypi/[email protected], pypi/[email protected], pypi/[email protected]

View full report↗︎

@mmsqe mmsqe enabled auto-merge November 19, 2024 02:01
@mmsqe mmsqe added this pull request to the merge queue Nov 19, 2024
Merged via the queue into crypto-org-chain:main with commit b0b6a47 Nov 19, 2024
43 checks passed
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