-
Notifications
You must be signed in to change notification settings - Fork 625
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: add upgrade handler to simapp for v6 -> v7 #2842
Merged
Merged
Changes from 28 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
bd37d18
refactor: add tendermint manual pruning function
colin-axner 7ad76de
chore: add extra checks into pruning test
colin-axner 5e9f208
chore: add docs and logging for tendermint pruning
colin-axner 5cb1262
Apply suggestions from code review
colin-axner 33c64d6
Apply suggestions from code review
colin-axner 21ab154
Merge branch 'main' into colin/1863-tm-pruning
colin-axner f6bbe6f
Apply suggestions from code review
colin-axner f7d8871
Update modules/core/02-client/migrations/store.go
colin-axner 348b21e
chore: move tendermint migrations to 07-tendermint directory
colin-axner 969cc0b
Merge branch 'colin/1863-tm-pruning' of github.com:cosmos/ibc-go into…
colin-axner 4399a42
chore: add changelog entry
colin-axner 78fd0a3
chore: update imports
colin-axner 0f90c1e
refactor: add automatic migrations for 02-client-refactor
colin-axner 9d7c048
review: apply self nits
colin-axner fa08b63
chore: add changelog entry
colin-axner ae2b1c2
test: add an additional test for improperly registered codecs
colin-axner 20e4d8d
chore: update migration doc header
colin-axner bf2a11b
Merge branch 'main' into colin/1863-02-client-migrations
colin-axner af99600
Merge branch 'main' of github.com:cosmos/ibc-go into colin/1863-02-cl…
colin-axner b95f5f0
Merge branch 'main' of github.com:cosmos/ibc-go into colin/1863-tm-pr…
colin-axner 6aa58bc
Merge branch 'main' into charly/2437_upgradehandler_6_7
charleenfei d828218
create upgrade handler and call handler in app.go of simapp
charleenfei 54334ce
Merge branch 'main' into colin/1863-tm-pruning
colin-axner 92b71a4
Merge remote-tracking branch 'upstream/colin/1863-tm-pruning' into ch…
charleenfei e039aae
Merge branch 'main' into charly/2437_upgradehandler_6_7
charleenfei fddd991
update to main
charleenfei d85e8c7
err check for tendermint consensus state pruning
charleenfei 9d732f8
add comments, rm unnecessary moduleName
charleenfei 2b5b10d
fix re: pr comments
charleenfei 3171ca2
Merge branch 'main' into charly/2437_upgradehandler_6_7
charleenfei e51e87c
Merge branch 'main' into charly/2437_upgradehandler_6_7
charleenfei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package v7 | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
storetypes "github.com/cosmos/cosmos-sdk/store/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
|
||
v7 "github.com/cosmos/ibc-go/v6/modules/core/02-client/migrations/v7" | ||
ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint" | ||
) | ||
|
||
const ( | ||
// UpgradeName defines the on-chain upgrade name for the SimApp v7 upgrade. | ||
UpgradeName = "v7" | ||
) | ||
|
||
// CreateUpgradeHandler creates an upgrade handler for the v7 SimApp upgrade. | ||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
cdc codec.BinaryCodec, | ||
hostStoreKey *storetypes.KVStoreKey, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
// Perform in-place store migrations for the v7 upgrade | ||
// The migration includes: | ||
// | ||
// - Migrating solo machine client states from v2 to v3 protobuf definition | ||
// - Pruning all solo machine consensus states | ||
// - Removing the localhost client | ||
// - Asserting existing tendermint clients are properly registered on the chain codec | ||
if err := v7.MigrateStore(ctx, hostStoreKey, cdc); err != nil { | ||
return nil, err | ||
} | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// OPTIONAL: prune expired tendermint consensus states to save storage space | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if err := ibctm.PruneTendermintConsensusStates(ctx, cdc, hostStoreKey); err != nil { | ||
return nil, err | ||
} | ||
return mm.RunMigrations(ctx, configurator, vm) | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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] not necessarily related to this PR, but the terminology of
Set
inSetUpgradeHandler
is kind of confusing, in reality we are adding/appending a new upgrade handler. the nameAddUpgradeHandler
might makes more sense WDYT? We can create a separate issue if people agree with this.cc @colin-axner @damiannolan
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 makes sense to me wrt re-naming!
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.
You'd have to change the function on the SDK 😄