v0.26.0
Ignite CLI v0.26.0
is fully compatible with chains that are compatible with v0.25.1
. Please follow the existing
migration guides if your chain is not upgraded to v0.25.1
support.
Go Version
Chains that are newly scaffolded with Ignite CLI v0.26.0
now require go 1.19
in their go.mod
files. It is
recommended that chains scaffolded with an older version of Ignite CLI also bump their required go
version and update
their tooling to the latest version.
ibc-go v6
Chains that are newly scaffolded with Ignite CLI v0.26.0
now use ibc-go/v6
for ibc functionality. It is not
necessary, but recommended to upgrade to the newest version of ibc-go
. Most migrations can be done by following the
ibc-go
migration guide, but there are some
specific changes that will need to be followed for Ignite scaffolded chains.
Removing cosmosibckeeper
Ignite CLI v0.26.0
has deprecated pkg/cosmosibckeeper.
This package contained interfaces for ibc-related keepers. Newly scaffolded chains now include the interface files in their
./x/{moduleName}/types
directory in a new expected_ibc_keeper.go
file. To migrate, create the following file for
each module:
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
)
// ChannelKeeper defines the expected IBC channel keeper.
type ChannelKeeper interface {
GetChannel(ctx sdk.Context, portID, channelID string) (channeltypes.Channel, bool)
GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
SendPacket(
ctx sdk.Context,
channelCap *capabilitytypes.Capability,
sourcePort string,
sourceChannel string,
timeoutHeight clienttypes.Height,
timeoutTimestamp uint64,
data []byte,
) (uint64, error)
ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error
}
// PortKeeper defines the expected IBC port keeper.
type PortKeeper interface {
BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability
}
// ScopedKeeper defines the expected IBC scoped keeper.
type ScopedKeeper interface {
GetCapability(ctx sdk.Context, name string) (*capabilitytypes.Capability, bool)
AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool
ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error
}
Next, make the following updates to each x/{moduleName}/keeper/keeper.go
file for each ibc-enabled
module in your project:
package keeper
import (
"fmt"
"blogibc/x/testibc/types"
"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/ignite/cli/ignite/pkg/cosmosibckeeper"
"github.com/tendermint/tendermint/libs/log"
"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
host "github.com/cosmos/ibc-go/v6/modules/core/24-host"
"github.com/cosmos/ibc-go/v6/modules/core/exported"
"github.com/tendermint/tendermint/libs/log"
"{appName}/x/{moduleName}/types"
)
type (
Keeper struct {
// remove-line-next
*cosmosibckeeper.Keeper
cdc codec.BinaryCodec
storeKey storetypes.StoreKey
memKey storetypes.StoreKey
paramstore paramtypes.Subspace
channelKeeper types.ChannelKeeper
portKeeper types.PortKeeper
scopedKeeper exported.ScopedKeeper
}
)
func NewKeeper(
cdc codec.BinaryCodec,
storeKey,
memKey storetypes.StoreKey,
ps paramtypes.Subspace,
channelKeeper types.ChannelKeeper,
portKeeper types.PortKeeper,
scopedKeeper types.ScopedKeeper,
) *Keeper {
// set KeyTable if it has not already been set
if !ps.HasKeyTable() {
ps = ps.WithKeyTable(types.ParamKeyTable())
}
return &Keeper{
Keeper: cosmosibckeeper.NewKeeper(
types.PortKey,
storeKey,
channelKeeper,
portKeeper,
scopedKeeper,
),
cdc: cdc,
storeKey: storeKey,
memKey: memKey,
paramstore: ps,
channelKeeper: channelKeeper,
portKeeper: portKeeper,
scopedKeeper: scopedKeeper,
}
}
// ----------------------------------------------------------------------------
// IBC Keeper Logic
// ----------------------------------------------------------------------------
// ChanCloseInit defines a wrapper function for the channel Keeper's function.
func (k Keeper) ChanCloseInit(ctx sdk.Context, portID, channelID string) error {
capName := host.ChannelCapabilityPath(portID, channelID)
chanCap, ok := k.scopedKeeper.GetCapability(ctx, capName)
if !ok {
return errorsmod.Wrapf(channeltypes.ErrChannelCapabilityNotFound, "could not retrieve channel capability at: %s", capName)
}
return k.channelKeeper.ChanCloseInit(ctx, portID, channelID, chanCap)
}
// IsBound checks if the IBC app module is already bound to the desired port
func (k Keeper) IsBound(ctx sdk.Context, portID string) bool {
_, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID))
return ok
}
// BindPort defines a wrapper function for the port Keeper's function in
// order to expose it to module's InitGenesis function
func (k Keeper) BindPort(ctx sdk.Context, portID string) error {
cap := k.portKeeper.BindPort(ctx, portID)
return k.ClaimCapability(ctx, cap, host.PortPath(portID))
}
// GetPort returns the portID for the IBC app module. Used in ExportGenesis
func (k Keeper) GetPort(ctx sdk.Context) string {
store := ctx.KVStore(k.storeKey)
return string(store.Get(types.PortKey))
}
// SetPort sets the portID for the IBC app module. Used in InitGenesis
func (k Keeper) SetPort(ctx sdk.Context, portID string) {
store := ctx.KVStore(k.storeKey)
store.Set(types.PortKey, []byte(portID))
}
// AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function
func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool {
return k.scopedKeeper.AuthenticateCapability(ctx, cap, name)
}
// ClaimCapability allows the IBC app module to claim a capability that core IBC
// passes to it
func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error {
return k.scopedKeeper.ClaimCapability(ctx, cap, name)
}
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
}
Remaining migration
After all uses of cosmosibckeeper
have been removed, you can follow any remaining steps in theibc-go
migration guide.
Scaffolded Release Workflow
The develop branch of the CLI has been deprecated. To continue using the release workflow that uses the CLI to automatically build and release your chain's binaries, replace develop with main in the following lines:
...
jobs:
might_release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Prepare Release Variables
id: vars
uses: ignite/cli/actions/release/vars@main
- name: Issue Release Assets
uses: ignite/cli/actions/cli@main
if: ${{ steps.vars.outputs.should_release == 'true' }}
with:
args: chain build --release --release.prefix ${{ steps.vars.outputs.tarball_prefix }} -t linux:amd64 -t darwin:amd64 -t darwin:arm64
- name: Delete the "latest" Release
uses: dev-drprasad/delete-tag-and-release@v0.2.0
if: ${{ steps.vars.outputs.is_release_type_latest == 'true' }}
with:
tag_name: ${{ steps.vars.outputs.tag_name }}
delete_release: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish the Release
uses: softprops/action-gh-release@v1
if: ${{ steps.vars.outputs.should_release == 'true' }}
with:
tag_name: ${{ steps.vars.outputs.tag_name }}
files: release/*
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}