Skip to content

Commit

Permalink
chore: rename RegisterAccount rpc and msgs to `RegisterInterchainAc…
Browse files Browse the repository at this point in the history
…count` (cosmos#2253)

* adding msgServer struct to ics27 controller

* updating the RegisterAccount rpc and msgs to RegisterInterchainAccount, reodering fields
  • Loading branch information
damiannolan authored Sep 9, 2022
1 parent bf51287 commit f8f226d
Show file tree
Hide file tree
Showing 12 changed files with 163 additions and 163 deletions.
24 changes: 12 additions & 12 deletions docs/ibc/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@
- [Type](#ibc.applications.interchain_accounts.v1.Type)

- [ibc/applications/interchain_accounts/controller/v1/tx.proto](#ibc/applications/interchain_accounts/controller/v1/tx.proto)
- [MsgRegisterAccount](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccount)
- [MsgRegisterAccountResponse](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccountResponse)
- [MsgRegisterInterchainAccount](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount)
- [MsgRegisterInterchainAccountResponse](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse)
- [MsgSubmitTx](#ibc.applications.interchain_accounts.controller.v1.MsgSubmitTx)
- [MsgSubmitTxResponse](#ibc.applications.interchain_accounts.controller.v1.MsgSubmitTxResponse)

Expand Down Expand Up @@ -1621,27 +1621,27 @@ host



<a name="ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccount"></a>
<a name="ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount"></a>

### MsgRegisterAccount
MsgRegisterAccount defines the payload for Msg/RegisterAccount
### MsgRegisterInterchainAccount
MsgRegisterInterchainAccount defines the payload for Msg/RegisterAccount


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `connection_id` | [string](#string) | | |
| `owner` | [string](#string) | | |
| `connection_id` | [string](#string) | | |
| `version` | [string](#string) | | |






<a name="ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccountResponse"></a>
<a name="ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse"></a>

### MsgRegisterAccountResponse
MsgRegisterAccountResponse defines the response for Msg/RegisterAccount
### MsgRegisterInterchainAccountResponse
MsgRegisterInterchainAccountResponse defines the response for Msg/RegisterAccount


| Field | Type | Label | Description |
Expand Down Expand Up @@ -1700,7 +1700,7 @@ Msg defines the 27-interchain-accounts/controller Msg service.

| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `RegisterAccount` | [MsgRegisterAccount](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccount) | [MsgRegisterAccountResponse](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccountResponse) | RegisterAccount defines a rpc handler for MsgRegisterAccount. | |
| `RegisterInterchainAccount` | [MsgRegisterInterchainAccount](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount) | [MsgRegisterInterchainAccountResponse](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse) | RegisterInterchainAccount defines a rpc handler for MsgRegisterInterchainAccount. | |
| `SubmitTx` | [MsgSubmitTx](#ibc.applications.interchain_accounts.controller.v1.MsgSubmitTx) | [MsgSubmitTxResponse](#ibc.applications.interchain_accounts.controller.v1.MsgSubmitTxResponse) | SubmitTx defines a rpc handler for MsgSubmitTx. | |

<!-- end services -->
Expand Down Expand Up @@ -1750,8 +1750,8 @@ The following parameters may be used to disable the host submodule.
<a name="ibc.applications.interchain_accounts.genesis.v1.ActiveChannel"></a>

### ActiveChannel
ActiveChannel contains a connection ID, port ID and associated active channel ID, as well as boolean flag to indicate
if the channel is middleware enabled
ActiveChannel contains a connection ID, port ID and associated active channel ID, as well as a boolean flag to
indicate if the channel is middleware enabled


| Field | Type | Label | Description |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewTxCmd() *cobra.Command {
}

cmd.AddCommand(
newRegisterAccountCmd(),
newRegisterInterchainAccountCmd(),
newSubmitTxCmd(),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (
flagPacketTimeoutTimestamp = "packet-timeout-timestamp"
)

func newRegisterAccountCmd() *cobra.Command {
func newRegisterInterchainAccountCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "register [connection-id]",
Short: "Register an interchain account on the provided connection.",
Expand All @@ -47,7 +47,7 @@ the associated capability.`),
return err
}

msg := types.NewMsgRegisterAccount(connectionID, owner, version)
msg := types.NewMsgRegisterInterchainAccount(connectionID, owner, version)

return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func NewMsgServerImpl(keeper *Keeper) types.MsgServer {
return &msgServer{Keeper: keeper}
}

// RegisterAccount defines a rpc handler for MsgRegisterAccount
func (k msgServer) RegisterAccount(goCtx context.Context, msg *types.MsgRegisterAccount) (*types.MsgRegisterAccountResponse, error) {
// RegisterInterchainAccount defines a rpc handler for MsgRegisterInterchainAccount
func (k msgServer) RegisterInterchainAccount(goCtx context.Context, msg *types.MsgRegisterInterchainAccount) (*types.MsgRegisterInterchainAccountResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

portID, err := icatypes.NewControllerPortID(msg.Owner)
Expand All @@ -38,7 +38,7 @@ func (k msgServer) RegisterAccount(goCtx context.Context, msg *types.MsgRegister
return nil, err
}

return &types.MsgRegisterAccountResponse{
return &types.MsgRegisterInterchainAccountResponse{
ChannelId: channelID,
}, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
ibctesting "github.com/cosmos/ibc-go/v5/testing"
)

func (suite *KeeperTestSuite) TestRegisterAccount() {
func (suite *KeeperTestSuite) TestRegisterInterchainAccount_MsgServer() {
var (
msg *types.MsgRegisterAccount
msg *types.MsgRegisterInterchainAccount
expectedChannelID = "channel-0"
)

Expand Down Expand Up @@ -69,13 +69,13 @@ func (suite *KeeperTestSuite) TestRegisterAccount() {
path := NewICAPath(suite.chainA, suite.chainB)
suite.coordinator.SetupConnections(path)

msg = types.NewMsgRegisterAccount(ibctesting.FirstConnectionID, ibctesting.TestAccAddress, "")
msg = types.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, ibctesting.TestAccAddress, "")

tc.malleate()

ctx := suite.chainA.GetContext()
msgServer := keeper.NewMsgServerImpl(&suite.chainA.GetSimApp().ICAControllerKeeper)
res, err := msgServer.RegisterAccount(ctx, msg)
res, err := msgServer.RegisterInterchainAccount(ctx, msg)

if tc.expPass {
suite.Require().NoError(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgRegisterAccount{},
&MsgRegisterInterchainAccount{},
&MsgSubmitTx{},
)
}
12 changes: 6 additions & 6 deletions modules/apps/27-interchain-accounts/controller/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ import (
host "github.com/cosmos/ibc-go/v5/modules/core/24-host"
)

var _ sdk.Msg = &MsgRegisterAccount{}
var _ sdk.Msg = &MsgRegisterInterchainAccount{}

// NewMsgRegisterAccount creates a new instance of MsgRegisterAccount
func NewMsgRegisterAccount(connectionID, owner, version string) *MsgRegisterAccount {
return &MsgRegisterAccount{
// NewMsgRegisterInterchainAccount creates a new instance of MsgRegisterInterchainAccount
func NewMsgRegisterInterchainAccount(connectionID, owner, version string) *MsgRegisterInterchainAccount {
return &MsgRegisterInterchainAccount{
ConnectionId: connectionID,
Owner: owner,
Version: version,
}
}

// ValidateBasic implements sdk.Msg
func (msg MsgRegisterAccount) ValidateBasic() error {
func (msg MsgRegisterInterchainAccount) ValidateBasic() error {
if err := host.ConnectionIdentifierValidator(msg.ConnectionId); err != nil {
return sdkerrors.Wrap(err, "invalid connection ID")
}
Expand All @@ -41,7 +41,7 @@ func (msg MsgRegisterAccount) ValidateBasic() error {
}

// GetSigners implements sdk.Msg
func (msg MsgRegisterAccount) GetSigners() []sdk.AccAddress {
func (msg MsgRegisterInterchainAccount) GetSigners() []sdk.AccAddress {
accAddr, err := sdk.AccAddressFromBech32(msg.Owner)
if err != nil {
panic(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"github.com/cosmos/ibc-go/v5/testing/simapp"
)

func TestMsgRegisterAccountValidateBasic(t *testing.T) {
var msg *types.MsgRegisterAccount
func TestMsgRegisterInterchainAccountValidateBasic(t *testing.T) {
var msg *types.MsgRegisterInterchainAccount

testCases := []struct {
name string
Expand Down Expand Up @@ -73,7 +73,7 @@ func TestMsgRegisterAccountValidateBasic(t *testing.T) {

for i, tc := range testCases {

msg = types.NewMsgRegisterAccount(
msg = types.NewMsgRegisterInterchainAccount(
ibctesting.FirstConnectionID,
ibctesting.TestAccAddress,
icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID),
Expand All @@ -90,11 +90,11 @@ func TestMsgRegisterAccountValidateBasic(t *testing.T) {
}
}

func TestMsgRegisterAccountGetSigners(t *testing.T) {
func TestMsgRegisterInterchainAccountGetSigners(t *testing.T) {
expSigner, err := sdk.AccAddressFromBech32(ibctesting.TestAccAddress)
require.NoError(t, err)

msg := types.NewMsgRegisterAccount(ibctesting.FirstConnectionID, ibctesting.TestAccAddress, "")
msg := types.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, ibctesting.TestAccAddress, "")
require.Equal(t, []sdk.AccAddress{expSigner}, msg.GetSigners())
}

Expand Down
Loading

0 comments on commit f8f226d

Please sign in to comment.