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: add upgrade handler to simapp for v6 -> v7 #2842

Merged
merged 31 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all 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 Nov 21, 2022
7ad76de
chore: add extra checks into pruning test
colin-axner Nov 21, 2022
5e9f208
chore: add docs and logging for tendermint pruning
colin-axner Nov 21, 2022
5cb1262
Apply suggestions from code review
colin-axner Nov 21, 2022
33c64d6
Apply suggestions from code review
colin-axner Nov 21, 2022
21ab154
Merge branch 'main' into colin/1863-tm-pruning
colin-axner Nov 21, 2022
f6bbe6f
Apply suggestions from code review
colin-axner Nov 21, 2022
f7d8871
Update modules/core/02-client/migrations/store.go
colin-axner Nov 21, 2022
348b21e
chore: move tendermint migrations to 07-tendermint directory
colin-axner Nov 21, 2022
969cc0b
Merge branch 'colin/1863-tm-pruning' of github.com:cosmos/ibc-go into…
colin-axner Nov 21, 2022
4399a42
chore: add changelog entry
colin-axner Nov 21, 2022
78fd0a3
chore: update imports
colin-axner Nov 21, 2022
0f90c1e
refactor: add automatic migrations for 02-client-refactor
colin-axner Nov 23, 2022
9d7c048
review: apply self nits
colin-axner Nov 23, 2022
fa08b63
chore: add changelog entry
colin-axner Nov 23, 2022
ae2b1c2
test: add an additional test for improperly registered codecs
colin-axner Nov 23, 2022
20e4d8d
chore: update migration doc header
colin-axner Nov 23, 2022
bf2a11b
Merge branch 'main' into colin/1863-02-client-migrations
colin-axner Nov 23, 2022
af99600
Merge branch 'main' of github.com:cosmos/ibc-go into colin/1863-02-cl…
colin-axner Nov 23, 2022
b95f5f0
Merge branch 'main' of github.com:cosmos/ibc-go into colin/1863-tm-pr…
colin-axner Nov 23, 2022
6aa58bc
Merge branch 'main' into charly/2437_upgradehandler_6_7
charleenfei Nov 29, 2022
d828218
create upgrade handler and call handler in app.go of simapp
charleenfei Nov 29, 2022
54334ce
Merge branch 'main' into colin/1863-tm-pruning
colin-axner Nov 29, 2022
92b71a4
Merge remote-tracking branch 'upstream/colin/1863-tm-pruning' into ch…
charleenfei Nov 29, 2022
e039aae
Merge branch 'main' into charly/2437_upgradehandler_6_7
charleenfei Nov 30, 2022
fddd991
update to main
charleenfei Nov 30, 2022
d85e8c7
err check for tendermint consensus state pruning
charleenfei Nov 30, 2022
9d732f8
add comments, rm unnecessary moduleName
charleenfei Nov 30, 2022
2b5b10d
fix re: pr comments
charleenfei Nov 30, 2022
3171ca2
Merge branch 'main' into charly/2437_upgradehandler_6_7
charleenfei Nov 30, 2022
e51e87c
Merge branch 'main' into charly/2437_upgradehandler_6_7
charleenfei Nov 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (core/24-host) [\#2820](https://github.com/cosmos/ibc-go/pull/2820) Add `MustParseClientStatePath` which parses the clientID from a client state key path.
* (apps/27-interchain-accounts) [\#2147](https://github.com/cosmos/ibc-go/pull/2147) Adding a `SubmitTx` gRPC endpoint for the ICS27 Controller module which allows owners of interchain accounts to submit transactions. This replaces the previously existing need for authentication modules to implement this standard functionality.
* (testing/simapp) [\#2190](https://github.com/cosmos/ibc-go/pull/2190) Adding the new `x/group` cosmos-sdk module to simapp.
* (testing/simapp) [\#2842](https://github.com/cosmos/ibc-go/pull/2842) Adding the new upgrade handler for v6 -> v7 to simapp which prunes expired Tendermint consensus states.

### Bug Fixes

Expand Down
11 changes: 11 additions & 0 deletions testing/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ import (
simappparams "github.com/cosmos/ibc-go/v6/testing/simapp/params"
simappupgrades "github.com/cosmos/ibc-go/v6/testing/simapp/upgrades"
v6 "github.com/cosmos/ibc-go/v6/testing/simapp/upgrades/v6"
v7 "github.com/cosmos/ibc-go/v6/testing/simapp/upgrades/v7"
ibctestingtypes "github.com/cosmos/ibc-go/v6/testing/types"
)

Expand Down Expand Up @@ -891,4 +892,14 @@ func (app *SimApp) setupUpgradeHandlers() {
ibcmock.ModuleName+icacontrollertypes.SubModuleName,
),
)

app.UpgradeKeeper.SetUpgradeHandler(
Copy link
Contributor

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 in SetUpgradeHandler is kind of confusing, in reality we are adding/appending a new upgrade handler. the name AddUpgradeHandler might makes more sense WDYT? We can create a separate issue if people agree with this.

cc @colin-axner @damiannolan

Copy link
Contributor Author

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!

Copy link
Contributor

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 😄

v7.UpgradeName,
v7.CreateUpgradeHandler(
app.mm,
app.configurator,
app.appCodec,
app.keys[ibchost.StoreKey],
),
)
}
32 changes: 32 additions & 0 deletions testing/simapp/upgrades/v7/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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"

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) {
// 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)
}
}