Skip to content

Commit

Permalink
Rename Order to Ordering for MsgRegisterInterchainAccount. (backport #…
Browse files Browse the repository at this point in the history
…5674) (#5681)

* Rename Order to Ordering for MsgRegisterInterchainAccount. (#5674)

* nit: Rename Order to Ordering for MsgRegisterInterchainAccount.

To align with name used in channel proto types w.r.t order.

* update docs

---------

Co-authored-by: Carlos Rodriguez <[email protected]>
(cherry picked from commit 61e3eb5)

# Conflicts:
#	docs/docs/02-apps/02-interchain-accounts/05-messages.md
#	modules/apps/27-interchain-accounts/controller/types/msgs.go

* nit: rm docs/docs/

* nit: Fix conflicts.

Fix conflict in msgs.go for controller.
Rename order -> ordering in any new places introduced for backwards compatible API.

---------

Co-authored-by: DimitrisJim <[email protected]>
  • Loading branch information
mergify[bot] and DimitrisJim authored Jan 22, 2024
1 parent 1752c99 commit 2e3f92e
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ the associated capability.`),
return err
}

order, err := parseOrder(cmd)
ordering, err := parseOrdering(cmd)
if err != nil {
return err
}

msg := types.NewMsgRegisterInterchainAccountWithOrder(connectionID, owner, version, order)
msg := types.NewMsgRegisterInterchainAccountWithOrdering(connectionID, owner, version, ordering)

return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
Expand Down Expand Up @@ -118,8 +118,8 @@ appropriate relative timeoutTimestamp must be provided with flag {relative-packe
return cmd
}

// parseOrder gets the channel ordering from the flags.
func parseOrder(cmd *cobra.Command) (channeltypes.Order, error) {
// parseOrdering gets the channel ordering from the flags.
func parseOrdering(cmd *cobra.Command) (channeltypes.Order, error) {
orderString, err := cmd.Flags().GetString(flagOrdering)
if err != nil {
return channeltypes.NONE, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (k Keeper) RegisterInterchainAccount(ctx sdk.Context, connectionID, owner,

// registerInterchainAccount registers an interchain account, returning the channel id of the MsgChannelOpenInitResponse
// and an error if one occurred.
func (k Keeper) registerInterchainAccount(ctx sdk.Context, connectionID, portID, version string, order channeltypes.Order) (string, error) {
func (k Keeper) registerInterchainAccount(ctx sdk.Context, connectionID, portID, version string, ordering channeltypes.Order) (string, error) {
// if there is an active channel for this portID / connectionID return an error
activeChannelID, found := k.GetOpenActiveChannel(ctx, connectionID, portID)
if found {
Expand All @@ -69,7 +69,7 @@ func (k Keeper) registerInterchainAccount(ctx sdk.Context, connectionID, portID,
}
}

msg := channeltypes.NewMsgChannelOpenInit(portID, version, order, []string{connectionID}, icatypes.HostPortID, authtypes.NewModuleAddress(icatypes.ModuleName).String())
msg := channeltypes.NewMsgChannelOpenInit(portID, version, ordering, []string{connectionID}, icatypes.HostPortID, authtypes.NewModuleAddress(icatypes.ModuleName).String())
handler := k.msgRouter.Handler(msg)
res, err := handler(ctx, msg)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (s msgServer) RegisterInterchainAccount(goCtx context.Context, msg *types.M

s.SetMiddlewareDisabled(ctx, portID, msg.ConnectionId)

channelID, err := s.registerInterchainAccount(ctx, msg.ConnectionId, portID, msg.Version, msg.Order)
channelID, err := s.registerInterchainAccount(ctx, msg.ConnectionId, portID, msg.Version, msg.Ordering)
if err != nil {
s.Logger(ctx).Error("error registering interchain account", "error", err.Error())
return nil, err
Expand Down
10 changes: 5 additions & 5 deletions modules/apps/27-interchain-accounts/controller/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ var (
_ sdk.HasValidateBasic = (*MsgUpdateParams)(nil)
)

// NewMsgRegisterInterchainAccountWithOrder creates a new instance of MsgRegisterInterchainAccount.
func NewMsgRegisterInterchainAccountWithOrder(connectionID, owner, version string, order channeltypes.Order) *MsgRegisterInterchainAccount {
// NewMsgRegisterInterchainAccountWithOrdering creates a new instance of MsgRegisterInterchainAccount.
func NewMsgRegisterInterchainAccountWithOrdering(connectionID, owner, version string, ordering channeltypes.Order) *MsgRegisterInterchainAccount {
return &MsgRegisterInterchainAccount{
ConnectionId: connectionID,
Owner: owner,
Version: version,
Order: order,
Ordering: ordering,
}
}

// NewMsgRegisterInterchainAccount creates a new instance of MsgRegisterInterchainAccount.
// It uses channeltypes.ORDERED as the default order. Breakage in v9.0.0 will allow the ordering to be provided
// It uses channeltypes.ORDERED as the default ordering. Breakage in v9.0.0 will allow the ordering to be provided
// directly. Use NewMsgRegisterInterchainAccountWithOrder to provide the ordering in previous versions.
func NewMsgRegisterInterchainAccount(connectionID, owner, version string) *MsgRegisterInterchainAccount {
return &MsgRegisterInterchainAccount{
ConnectionId: connectionID,
Owner: owner,
Version: version,
Order: channeltypes.ORDERED,
Ordering: channeltypes.ORDERED,
}
}

Expand Down
102 changes: 51 additions & 51 deletions modules/apps/27-interchain-accounts/controller/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ message MsgRegisterInterchainAccount {
string owner = 1;
string connection_id = 2;
string version = 3;
ibc.core.channel.v1.Order order = 4;
ibc.core.channel.v1.Order ordering = 4;
}

// MsgRegisterInterchainAccountResponse defines the response for Msg/RegisterAccount
Expand Down

0 comments on commit 2e3f92e

Please sign in to comment.