-
Notifications
You must be signed in to change notification settings - Fork 33
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 #408
fix: export app version #408
Conversation
@rootulp I tried to replace path of |
server/export.go
Outdated
Version: tmproto.VersionParams{ | ||
AppVersion: exported.ConsensusParams.GetVersion().GetAppVersion(), | ||
}, |
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.
[question] I'm curious why upstream Cosmos SDK didn't already have this diff. Without this diff, how do other Cosmos SDK chains stop + export + start a chain?
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.
I have no idea
@najeal sorry I totally missed this. I usually test cosmos-sdk changes via this diff in celestia-app go.mod: - github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.23.0-sdk-v0.46.16
+ github.com/cosmos/cosmos-sdk => ../cosmos-sdk and I can start |
@rootulp no problem ! My issue was the same than celestiaorg/celestia-app#3362 but syncing celestia-app with |
server/export_test.go
Outdated
@@ -152,6 +153,7 @@ func setupApp(t *testing.T, tempDir string) (*simapp.SimApp, context.Context, *t | |||
AppStateBytes: genDoc.AppState, | |||
}, | |||
) | |||
app.SetInitialAppVersionInConsensusParams(app.NewContext(false, tmproto.Header{}), simapp.DefaultConsensusParams.Version.AppVersion) |
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.
For backwards compatibility, app version should only be part of the consensus params from v2 onwards. Because of this we should only set the initial app version if the version is v2 (which the default is not)
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.
I pushed new commit to only init app version when value is equal or higher than 2 and only export app version when equal or higher than 2.
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.
Overall LGTM! Were you able to test celestia-app with this change (using the replace in go.mod
) and try these test cases:
- Start a celestia-appd v1.13.0 binary. Wait a few blocks then export.
- Start a celestia-appd v2.0.0-rc4 binary with a
--v2-upgrade-height 5
and export before block height 5 - Start a celestia-appd v2.0.0-rc4 binary with a
--v2-upgrade-height 5
and export after block height 5
server/export_test.go
Outdated
} | ||
for _, utest := range tests { |
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.
for _, utest := range tests { | |
for _, test := range tests { |
server/export.go
Outdated
@@ -95,6 +95,10 @@ func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Com | |||
PubKeyTypes: exported.ConsensusParams.Validator.PubKeyTypes, | |||
}, | |||
} | |||
const minAppVersionExport = 2 |
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.
[nit] can this be extracted to the top of the file in the const
block? Also a comment would help.
const (
FlagHeight = "height"
FlagForZeroHeight = "for-zero-height"
FlagJailAllowedAddrs = "jail-allowed-addrs"
// minAppVersionExport is the lowest app version where the app version is stored in consensus params and exported via this command.
minAppVersionExport = 2
)
Result looks good to me:
|
The tests you asked for are still valid after the two commits (see the results above) But I may have spotted one issue. It looks like appVersion is upgraded just before the height provided by
If I export, I will already see the It is the same for |
Thanks for your thorough testing. The upgrade from app version 1 -> 2 takes place in EndBlock of the block height immediately before the upgrade height (see these lines). So what you observed is the expected behavior even though it is confusing. |
After this PR gets another approval, we can merge, I'll cut a release of cosmos-sdk and then we can bump to that release in celestia-app. |
0dc27d4
into
celestiaorg:release/v0.46.x-celestia
Description
Related: celestiaorg/celestia-app#3472
This changes the export command, embedding
appVersion
value in the exported struct.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...
!
to 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.
I have...
!
in the type prefix if API or client breaking change