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: remove the v6.2 upgrade handler #2362

Merged
merged 5 commits into from
Jan 10, 2024
Merged

Conversation

gsk967
Copy link
Collaborator

@gsk967 gsk967 commented Dec 19, 2023

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
  • added ! to the type prefix if API or client breaking change
  • added appropriate labels to the PR
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • 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.

I have...

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

Summary by CodeRabbit

  • New Features

    • Enhanced upgrade system with consolidated functions for improved efficiency and handling of parameter migrations and governance adjustments.
  • Refactor

    • Streamlined upgrade logic by integrating functionalities of multiple functions.
  • Chores

    • Updated import statements to align with the new upgrade logic requirements.
  • Bug Fixes

    • Removed unnecessary function calls to ensure smoother upgrade transitions.

@gsk967 gsk967 requested a review from a team as a code owner December 19, 2023 13:46
Copy link
Contributor

coderabbitai bot commented Dec 19, 2023

Walkthrough

The update to app/upgrades.go streamlines the upgrade process by consolidating functions and altering dependencies. Import statements have been pruned and expanded, reflecting a shift in the required packages. The removal of registerUpgrade6_2 and its integration into registerUpgrade6 simplifies the upgrade registration mechanism, while the elimination of the storeUpgrade call indicates a change in how upgrades are stored or managed. These adjustments suggest a refactoring aimed at efficiency and possibly the introduction of new functionalities or the deprecation of old ones.

Changes

File Path Change Summary
app/upgrades.go - Removed imports: ibcexported, baseapp, wasmtypes, authtypes, consensustypes, crisistypes, govtypes, minttypes, paramstypes, slashingtypes, uibc
- Added imports: leveragetypes
- Removed registerUpgrade6_2
- Enhanced registerUpgrade6 with additional logic
- Removed storeUpgrade call

Poem

In the realm of code, where rabbits dwell,
Refactor winds blow, and old functions quell.
🌿 With a hop and a skip, registerUpgrade6 blooms,
🎉 And in the git log, a new chapter looms.

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e3a9892 and d7e6c28.
Files selected for processing (1)
  • app/upgrades.go (2 hunks)
Additional comments: 3
app/upgrades.go (3)
  • 7-22: The import of leveragetypes is added and should be used within the file. Verify that the removed imports are no longer referenced in the code to avoid breaking changes.
Verification successful

The previous script failed to produce the expected output due to an incorrect file type specification for ripgrep. The file app/upgrades.go is a Go file, not a Python file, so the --type flag used with rg was incorrect. Let's correct the script to search for the removed imports in the Go file without specifying an incorrect file type.


The executed script did not produce any output, which suggests that the removed imports are not referenced in the app/upgrades.go file. This implies that the removal of these imports should not cause any immediate issues within this file.

Given this information, it appears that the changes made in the pull request are consistent with the removal of the upgrade handler for version 6.2, and the modifications in the import section do not affect the app/upgrades.go file adversely.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the removed imports are not used in the file.
for import in ibcexported baseapp wasmtypes authtypes consensustypes crisistypes govtypes minttypes paramstypes slashingtypes uibc; do
  rg --type python "\b${import}\b" app/upgrades.go
done

Length of output: 2371



Script:

#!/bin/bash
# Verify that the removed imports are not used in the file.
for import in ibcexported baseapp wasmtypes authtypes consensustypes crisistypes govtypes minttypes paramstypes slashingtypes uibc; do
  rg "\b${import}\b" app/upgrades.go
done

Length of output: 1876

* 51-51: The `storeUpgrade` function call is still present in the `registerUpgrade6` and `registerUpgrade4_3` functions. Confirm that its removal from other parts of the code is intentional and does not negatively impact the upgrade process.
  • 45-48: The registerOutdatedPlaceholderUpgrade function is called with various version strings. Confirm that these versions are correct and that the function is used appropriately for outdated upgrades.
Verification successful

The output from the executed script shows that registerOutdatedPlaceholderUpgrade is called with a sequence of version strings, including "v6.2". Given that the PR's objective is to remove the v6.2 upgrade handler, the presence of "v6.2" in the list of calls to registerOutdatedPlaceholderUpgrade is consistent with the PR's intent to mark "v6.2" as an outdated upgrade. Therefore, the use of "v6.2" in the registerOutdatedPlaceholderUpgrade function is appropriate and aligns with the PR's objective.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the versions used in `registerOutdatedPlaceholderUpgrade` are correct.
rg --type go "registerOutdatedPlaceholderUpgrade" app/upgrades.go

Length of output: 1043

Copy link

codecov bot commented Dec 19, 2023

Codecov Report

Attention: 124 lines in your changes are missing coverage. Please review.

Comparison is base (7f05ad4) 75.38% compared to head (3722a6c) 70.03%.
Report is 340 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2362      +/-   ##
==========================================
- Coverage   75.38%   70.03%   -5.36%     
==========================================
  Files         100      174      +74     
  Lines        8025    13026    +5001     
==========================================
+ Hits         6050     9123    +3073     
- Misses       1589     3298    +1709     
- Partials      386      605     +219     
Files Coverage Δ
ante/ante.go 66.66% <100.00%> (+18.45%) ⬆️
ante/fee.go 80.00% <100.00%> (+1.64%) ⬆️
ante/spam_prevention.go 75.92% <ø> (ø)
app/inflation/inflation.go 100.00% <100.00%> (ø)
app/upgradev3/migrations.go 84.21% <ø> (+5.94%) ⬆️
util/coin/utoken.go 100.00% <100.00%> (ø)
util/genmap/genmap.go 100.00% <100.00%> (ø)
util/ibc/ibc.go 58.82% <ø> (ø)
util/sdkutil/events.go 0.00% <ø> (ø)
util/store/store.go 52.06% <ø> (+10.65%) ⬆️
... and 40 more

... and 114 files with indirect coverage changes

@gsk967 gsk967 enabled auto-merge December 19, 2023 14:22
@robert-zaremba
Copy link
Member

do we need to remove it now?

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d7e6c28 and 6825fdb.
Files selected for processing (1)
  • app/upgrades.go (1 hunks)
Additional comments: 8
app/upgrades.go (8)
  • 7-22: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [22-36]

The RegisterUpgradeHandlers function has been updated to include calls to register various upgrade handlers, including registerUpgrade6_2 and registerUpgrade6_0. It's important to ensure that the removal of the v6.2 upgrade handler is intentional and that any logic previously contained within it has been properly migrated or is no longer necessary.

  • 7-22: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [97-117]

The registerUpgrade6_0 function includes setting default parameters for the Leverage module and an emergency group for the Governance module. It also deletes the gravity module store. Ensure that these changes are in line with the intended upgrade path and that the deletion of the gravity module store is expected and handled correctly in the broader context of the application.

  • 7-22: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [119-152]

The registerUpgrade4_3 function sets an upgrade handler and initializes the ICS27 module with default parameters. It also adds a new store key for the ICA host. Confirm that the initialization of the ICS27 module and the addition of the new store key are part of the planned upgrade process and that they have been tested thoroughly.

  • 7-22: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [154-163]

The onlyModuleMigrations function is a helper that runs module migrations and logs the upgrade execution. This function appears to be a utility function without specific actions tied to a particular upgrade. Ensure that its usage is consistent with the upgrade strategy and that it is called appropriately within the upgrade handlers.

  • 7-22: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [165-174]

The storeUpgrade function is used to apply store upgrades if the current upgrade plan matches and the upgrade height is not skipped. Verify that the logic for applying store upgrades is correct and that it is being used consistently across all upgrade handlers.

  • 7-22: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [176-185]

The registerUpgrade function sets an upgrade handler that only runs module migrations and adds new stores if provided. This function seems to be a general-purpose upgrade handler. Confirm that the addition of new stores is handled correctly and that the function is used appropriately within the upgrade strategy.

  • 7-22: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [187-194]

The registerOutdatedPlaceholderUpgrade function sets a panic handler for outdated upgrade plans, which is a safeguard to prevent running migrations for versions that are too old. This is a good practice to ensure that the upgrade process is only attempted from supported versions.

  • 7-22: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [196-202]

The printPlanName function is a simple utility for logging the execution of an upgrade plan. It's a straightforward function that aids in debugging and logging, and it seems to be used consistently across the upgrade handlers.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6825fdb and 3722a6c.
Files selected for processing (1)
  • app/upgrades.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/upgrades.go

@gsk967 gsk967 requested a review from robert-zaremba January 9, 2024 09:01
@gsk967 gsk967 added this pull request to the merge queue Jan 10, 2024
Merged via the queue into main with commit fe155f7 Jan 10, 2024
24 of 26 checks passed
@gsk967 gsk967 deleted the sai/rm_6_2_upgrade_handler branch January 10, 2024 11:10
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