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: minor nits - renaming and error msgs #464

Merged
merged 9 commits into from
Oct 11, 2021
6 changes: 3 additions & 3 deletions modules/apps/27-interchain-accounts/keeper/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ func (k Keeper) InitInterchainAccount(ctx sdk.Context, connectionID, counterpart

// RegisterInterchainAccount attempts to create a new account using the provided address and stores it in state keyed by the provided port identifier
// If an account for the provided address already exists this function returns early (no-op)
func (k Keeper) RegisterInterchainAccount(ctx sdk.Context, accAddr sdk.AccAddress, portID string) {
func (k Keeper) RegisterInterchainAccount(ctx sdk.Context, accAddr sdk.AccAddress, counterpartyPortID string) {
damiannolan marked this conversation as resolved.
Show resolved Hide resolved
if acc := k.accountKeeper.GetAccount(ctx, accAddr); acc != nil {
return
}

interchainAccount := types.NewInterchainAccount(
authtypes.NewBaseAccountWithAddress(accAddr),
portID,
counterpartyPortID,
)

k.accountKeeper.NewAccount(ctx, interchainAccount)
k.accountKeeper.SetAccount(ctx, interchainAccount)
k.SetInterchainAccountAddress(ctx, portID, interchainAccount.Address)
k.SetInterchainAccountAddress(ctx, counterpartyPortID, interchainAccount.Address)
}
4 changes: 2 additions & 2 deletions modules/apps/27-interchain-accounts/keeper/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (k Keeper) OnChanOpenInit(

// Claim channel capability passed back by IBC module
if err := k.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil {
return sdkerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, err.Error())
return sdkerrors.Wrap(err, "failed to claim capability")
damiannolan marked this conversation as resolved.
Show resolved Hide resolved
}

return nil
Expand Down Expand Up @@ -118,7 +118,7 @@ func (k Keeper) OnChanOpenTry(
// On the host chain the capability may only be claimed during the OnChanOpenTry
// The capability being claimed in OpenInit is for a controller chain (the port is different)
if err := k.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil {
return err
return sdkerrors.Wrap(err, "failed to claim capability")
}

// Check to ensure that the version string contains the expected address generated from the Counterparty portID
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/27-interchain-accounts/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
var (
ErrUnknownPacketData = sdkerrors.Register(ModuleName, 2, "unknown packet data")
ErrAccountAlreadyExist = sdkerrors.Register(ModuleName, 3, "account already exist")
ErrPortAlreadyBound = sdkerrors.Register(ModuleName, 4, "port is already bound for address")
ErrPortAlreadyBound = sdkerrors.Register(ModuleName, 4, "port is already bound")
ErrUnsupportedChain = sdkerrors.Register(ModuleName, 5, "unsupported chain")
ErrInvalidOutgoingData = sdkerrors.Register(ModuleName, 6, "invalid outgoing data")
ErrInvalidRoute = sdkerrors.Register(ModuleName, 7, "invalid route")
Expand Down