-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
refactor: use corestore.StoreUpgrades #21259
Conversation
WalkthroughWalkthroughThe recent changes primarily focus on enhancing the upgrade mechanisms within the Cosmos SDK by modifying the Changes
Sequence Diagram(s)sequenceDiagram
participant CLI
participant UpgradeStoreLoader
participant StoreUpgrades
participant BaseApp
CLI->>UpgradeStoreLoader: Request upgrade with store upgrades
UpgradeStoreLoader->>StoreUpgrades: Process added/deleted stores
UpgradeStoreLoader->>BaseApp: Set new store loader
BaseApp-->>CLI: Upgrade complete
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
8b7f6b7
to
ffd238c
Compare
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: 0
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Commits
Files that changed from the base of the PR and between 431b523 and fd1dcc61e973afe7d72a95aff6e2796e32917d80.
Files selected for processing (2)
- x/upgrade/types/storeloader.go (1 hunks)
- x/upgrade/types/storeloader_test.go (2 hunks)
Additional context used
Path-based instructions (2)
x/upgrade/types/storeloader.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/upgrade/types/storeloader_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"
Additional comments not posted (5)
x/upgrade/types/storeloader.go (2)
4-4
: Conform to Uber Golang style guide for import aliasing.The alias
corestore
is correctly used here to avoid potential conflicts and improve readability.
12-20
: Update function signature and logic forUpgradeStoreLoader
.The function signature change from
*storetypes.StoreUpgrades
to*corestore.StoreUpgrades
reflects the refactoring goal. The logic now only checks for added or deleted stores, which simplifies the upgrade process by excluding renamed stores. This aligns with the PR's objective to streamline store upgrade handling.x/upgrade/types/storeloader_test.go (3)
Line range hint
1-1
: Ensure test package imports align with the Uber Golang style guide.The import statements are well-organized, following the standard practice of grouping and aliasing where necessary.
Line range hint
99-99
: Assess the completeness ofTestSetLoader
.The test case effectively checks the loading and committing of store versions. Ensure that it adequately reflects the changes in
UpgradeStoreLoader
, particularly the handling of added and deleted stores.
Line range hint
48-48
: Verify test coverage for store upgrade logic.The test
TestSetLoader
focuses on loading and committing store versions, which aligns with the core functionality of theUpgradeStoreLoader
. However, ensure that the removal ofuseUpgradeLoader
does not leave any critical paths untested, especially concerning the handling of added and deleted stores.
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.
Lgtm, can we add a deprecation notice in x/upgrade changelog about removing renaming stores when using x/upgrade method?
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.
lgtm
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: 0
Outside diff range, codebase verification and nitpick comments (1)
simapp/upgrades.go (1)
7-7
: Potential Issue withcorestore
Usage: MissingRenamed
FieldThe
corestore
package'sStoreUpgrades
type lacks theRenamed
field found in thestoretypes
version. This might affect functionality if theRenamed
field was previously utilized. Ensure that this change aligns with the project's requirements and that any necessary adjustments are made to accommodate the missing field.
core/store/upgrade.go
definesStoreUpgrades
withAdded
andDeleted
.store/types/store.go
definesStoreUpgrades
withAdded
,Renamed
, andDeleted
.Analysis chain
Verify the functionality of
corestore
.Ensure that
corestore
provides the necessary functionality previously handled bystoretypes
. This change may affect how store upgrades are managed, so verify that it aligns with the project's architectural goals.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if `corestore` provides the necessary functionality for store upgrades. # Test: Search for the `StoreUpgrades` type in `corestore`. ast-grep --lang go --pattern 'type StoreUpgrades struct { $$$ }'Length of output: 528
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Commits
Files that changed from the base of the PR and between fd1dcc61e973afe7d72a95aff6e2796e32917d80 and acf2933fca76a01ad67d1bd0defaf09b4fcd5d72.
Files selected for processing (1)
- simapp/upgrades.go (2 hunks)
Additional context used
Path-based instructions (1)
simapp/upgrades.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (1)
simapp/upgrades.go (1)
Line range hint
45-54
:
Verify the usage ofcorestore.StoreUpgrades
.Ensure that the
corestore.StoreUpgrades
is used correctly within theRegisterUpgradeHandlers
function. This change should align with the intended design and functionality of the store upgrade process.Verification successful
Usage of
corestore.StoreUpgrades
is correct.The
corestore.StoreUpgrades
is used appropriately in theRegisterUpgradeHandlers
function. TheAdded
andDeleted
fields are consistent with the intended design for handling store upgrades, and the comments align with the SDK changes. No issues were found.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `corestore.StoreUpgrades` usage. # Test: Search for the `StoreUpgrades` usage in the codebase to ensure consistent application. rg --type go -A 5 'StoreUpgrades'Length of output: 14295
acf2933
to
2492f6b
Compare
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: 0
Outside diff range, codebase verification and nitpick comments (2)
x/upgrade/CHANGELOG.md (2)
35-35
: Clarify the migration details.The entry "Upgrade has been migrated to cosrestore.StoreUpgrades" could benefit from additional context regarding the impact on existing users. Consider specifying any necessary migration steps or implications for developers.
- * [#21259](https://github.com/cosmos/cosmos-sdk/pull/21259) Upgrade has been migrated to cosrestore.StoreUpgrades. Renaming keys support has been removed from the upgrade module. + * [#21259](https://github.com/cosmos/cosmos-sdk/pull/21259) Upgrade process has been migrated to `cosrestore.StoreUpgrades`. Note that support for renaming keys has been removed, which may require developers to adjust their upgrade strategies accordingly.
37-37
: Ensure clarity on state machine changes.The entry regarding app version storage should provide more context about the implications of this change. Consider elaborating on how this affects the state machine and any necessary adjustments for developers.
- * (x/upgrade) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) Upgrade module no longer stores the app version but gets and sets the app version stored in the `ParamStore` of baseapp. + * (x/upgrade) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) The upgrade module no longer stores the app version internally. Instead, it retrieves and updates the app version using the `ParamStore` of `baseapp`. Developers may need to verify their version management logic to ensure compatibility.
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Commits
Files that changed from the base of the PR and between acf2933fca76a01ad67d1bd0defaf09b4fcd5d72 and 99e38dadf2e6ccd9a5ba1ec6357f643a988a9b82.
Files selected for processing (1)
- x/upgrade/CHANGELOG.md (1 hunks)
Additional context used
Path-based instructions (1)
x/upgrade/CHANGELOG.md (1)
Pattern
**/*.md
: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"
99e38da
to
60703a4
Compare
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: 0
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Commits
Files that changed from the base of the PR and between 99e38dadf2e6ccd9a5ba1ec6357f643a988a9b82 and aca492c.
Files selected for processing (1)
- simapp/upgrades.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- simapp/upgrades.go
(cherry picked from commit 072a29c)
Description
ref #21176
this pr adopts corestore.StoreUpgrades throughout the repository
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
NewKeeper
constructor, simplifying environment configuration.Bug Fixes