-
Notifications
You must be signed in to change notification settings - Fork 326
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
fix: export app-version #3650
base: main
Are you sure you want to change the base?
fix: export app-version #3650
Conversation
WalkthroughWalkthroughThe application's version initialization process has been updated. The Changes
Sequence DiagramssequenceDiagram
participant User
participant App
participant ParameterStore
User->>App: Call ExportAppStateAndValidators()
App->>ParameterStore: Check block height & upgrade version
ParameterStore-->>App: Return block height & upgrade version
alt Block height and upgrade version check
App->>App: SetInitialAppVersionInConsensusParams()
App->>App: SetAppVersion()
end
App-->>User: Return exported app state and validators
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 (
|
d3b3c42
to
e353ac7
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.
This looks good to me, thanks! I plan on manually testing this PR by stop + starting a node before and after the upgrade height b/c persisting the app version has a lot of edge cases.
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.
Not sure how to explain this b/c the unit test seems to pass but when I manually tried this:
./scrips/single-node.sh
# wait until after block height 3 then stop the node
celestia-appd export
the resulting JSON does not populate the app version in consensus params:
"version": {
}
@rootulp yes I need to open a PR an cosmos-sdk side to close the issue. |
In addition to my previous anwer. This is where Version is not populated: |
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
app/export.go
Outdated
versionToInit := v1 | ||
if app.LastBlockHeight() >= app.upgradeHeightV2 { | ||
versionToInit = v2 | ||
} | ||
app.SetInitialAppVersionInConsensusParams(ctx, versionToInit) | ||
app.SetAppVersion(ctx, versionToInit) |
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.
Tip
Codebase Verification
The new logic for app version initialization is not handled in cmd/celestia-appd/cmd/root.go
.
- Ensure that the logic for initializing the app version based on block height and upgrade version is correctly integrated where
ExportAppStateAndValidators
is called. - Specifically, update the
cmd/celestia-appd/cmd/root.go
file to include the necessary logic before callingExportAppStateAndValidators
.
Analysis chain
LGTM! But verify the function usage in the codebase.
The code changes are approved.
However, ensure that all function calls to ExportAppStateAndValidators
correctly handle the new logic.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify all function calls to `ExportAppStateAndValidators` correctly handle the new logic.
# Test: Search for the function usage. Expect: Correct handling of the new logic.
rg --type go $'ExportAppStateAndValidators'
Length of output: 679
Script:
#!/bin/bash
# Extract the relevant portion of cmd/celestia-appd/cmd/root.go to verify the correct handling of the new logic.
rg -A 10 -B 10 'ExportAppStateAndValidators' cmd/celestia-appd/cmd/root.go
Length of output: 779
Thanks! I think we'll have to make a PR to https://github.com/celestiaorg/cosmos-sdk first, get it merged, cut a release, bump to that version in celestia-app and then proceed with this PR so will mark as draft for now. |
app/export.go
Outdated
if app.LastBlockHeight() >= app.upgradeHeightV2 { | ||
versionToInit = v2 | ||
} |
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.
This won't work if the user hasn't set the appropriate flag. I would prefer trying to read the consensus params to know what the version is
@najeal celestia-app bumped to the version of cosmos-sdk with your fix on all 3 supported branches ( |
@rootulp normally, the PR just needs to uncomment the test right now, so my first commit can be deleted. |
e353ac7
to
7dfbbb1
Compare
There is some weird stuff. Checking version from param store after the upgrade: Either I don't initialise the context the way I should or the store is reset during the commit of the upgrade (see: cosmos-sdk/store/rootmulti.store.go |
Related to #3472
Overview
ParamStoreKeyVersionParams key was never set in paramStore.
The changes forces storage of app-version and fix test for exporting version 2.