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

TIP #53 Upgrade IBC from v1.1 to v3.0 #745

Closed
yun-yeo opened this issue Apr 26, 2022 · 0 comments · Fixed by #717
Closed

TIP #53 Upgrade IBC from v1.1 to v3.0 #745

yun-yeo opened this issue Apr 26, 2022 · 0 comments · Fixed by #717
Assignees

Comments

@yun-yeo
Copy link
Contributor

yun-yeo commented Apr 26, 2022

TIP #: 53

Author: TFL
Network: v0.6.x
Date:

Summary

IBC will be upgraded to v3.0, adding the new Interchain Account and IBC modules.

Motivation

Increasing IBC version will allow for greater IBC functionality. For more information about IBC v3.0, visit https://github.com/cosmos/ibc-go/blob/v3.0.0/CHANGELOG.md .

Tech Spec

Modules:

  • IBC
  • Interchain Account Module
  • Pack Forward Middleware

Overview

https://hub.cosmos.network/main/roadmap/cosmos-hub-roadmap-2.0.html

https://github.com/cosmos/ibc-go/blob/v3.0.0/CHANGELOG.md

  • New Module - Interchain Account Module
    • Allows the creation of accounts on a "Host" blockchain which are controlled by an authentication module on a "Controller" blockchain.
    • Arbitrary messages are able to be submitted from the "Controller" blockchain to the "Host" blockchain to be executed on behalf of the Interchain Account.
    • Uses ordered IBC channels, one per account.
  • New Module - IBC packet-forward-middleware

Method

  1. The [migration from ibc-go v1 to v2](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v1-to-v2.md).
  2. The [migration from ibc-go v2 to v3](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v2-to-v3.md).

Code

	app.UpgradeKeeper.SetUpgradeHandler(
		upgradeName,
		func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
			...

			// new modules
			// - router(packet-forward-middleware)
			// - ica(inter-chain-accounts)

			// ICS27 upgrade plan
			// ica module initialized via initModule instead normal migration,
			// so put current version to skip migration
			fromVM[icatypes.ModuleName] = icaModule.ConsensusVersion()

			// create ICS27 Controller submodule params
			controllerParams := icacontrollertypes.Params{}

			// create ICS27 Host submodule params
			hostParams := icahosttypes.Params{
				HostEnabled: true,
				AllowMessages: []string{
					authzMsgExec,
					authzMsgGrant,
					authzMsgRevoke,
					bankMsgSend,
					bankMsgMultiSend,
					distrMsgSetWithdrawAddr,
					distrMsgWithdrawValidatorCommission,
					distrMsgFundCommunityPool,
					distrMsgWithdrawDelegatorReward,
					feegrantMsgGrantAllowance,
					feegrantMsgRevokeAllowance,
					govMsgVoteWeighted,
					govMsgSubmitProposal,
					govMsgDeposit,
					govMsgVote,
					stakingMsgEditValidator,
					stakingMsgDelegate,
					stakingMsgUndelegate,
					stakingMsgBeginRedelegate,
					stakingMsgCreateValidator,
					vestingMsgCreateVestingAccount,
					transferMsgTransfer,
					oracleMsgAggregateExchangeRatePrevote,
					oracleMsgAggregateExchangeRateVote,
					oracleMsgDelegateFeedConsent,
					marketMsgSwapMsg,
					marketMsgSwapSendMsg,
					wasmMsgStoreCode,
					wasmMsgInstantiateContract,
					wasmMsgExecuteContract,
					wasmMsgMigrateContract,
				},
			}

			ctx.Logger().Info("start to init interchainaccount module...")

			// initialize ICS27 module
			icaModule.InitModule(ctx, controllerParams, hostParams)

			ctx.Logger().Info("start to run module migrations...")

			return app.mm.RunMigrations(ctx, app.configurator, fromVM)
		},
	)

	if upgradeInfo.Name == upgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
		storeUpgrades := store.StoreUpgrades{
			Added:   []string{icahosttypes.StoreKey, routertypes.ModuleName},
		}

		// configure store loader that checks if version == upgradeHeight and applies store upgrades
		app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
	}

Considerations

Dependencies:

For more information, visit https://github.com/cosmos/ibc-go/blob/v3.0.0/CHANGELOG.md

Timeline

NA

Test cases

NA

@yun-yeo yun-yeo self-assigned this Apr 26, 2022
@yun-yeo yun-yeo linked a pull request Apr 26, 2022 that will close this issue
10 tasks
@yun-yeo yun-yeo closed this as completed Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant