Skip to content

Add MsgServer to interchain accounts controller #2026

@damiannolan

Description

@damiannolan

Summary

Add a new MsgServer to 27-interchain-accounts which exposes two distinct rpc endpoints:

  • RegisterAccount
  • SubmitTx

Problem Definition

The current design implemented in 27-interchain-accounts mandates that a base application referred to as an authentication module is developed in order to provide custom authentication as an entrypoint to interchain accounts. In this approach an application developer is expected to compose their base application (authentication module) with the ICS27 controllerKeeper and leverage the exported APIs exposed for account registration and sending of interchain accounts transactions.

Since the release of cosmos-sdk v0.46.x, the new design of x/gov and x/group allow for arbitrary message passing via the cosmos-sdk's MsgServiceRouter. When a proposal is accepted it allows the state machine to execute an arbitrary number of sdk.Msgs. Since this functionality has been introduced it has become clear that x/gov and x/group act as authentication modules with respect to interchain accounts integration.

Proposal

Introduce a new MsgServer to 27-interchain-accounts/controller and incrementally move towards deprecation of public APIs.
This allows for existing app developers to simply change their code from a public API (RegisterInterchainAccount / SendTx) call to message passing, whereby one would compose their app with the cosmos-sdk MsgServiceRouter and retrieve the handler appropriately based on the message typeURL, as is done in many existing modules such as x/gov, x/group as well as 27-interchain-accounts/host. This provides a more standardised approach to integrating with interchain accounts.

RegisterAccount

Introduce a new rpc endpoint RegisterAccount. This rpc should provide the existing functionality of the exported RegisterInterchainAccount function in 27-interchain-accounts/controller.

service Msg {
  rpc RegisterAccount(MsgRegisterAccount) returns (MsgRegisterAccountResponse);
  ...
}

message MsgRegisterAccount {
  option (gogoproto.equal)           = false;
  option (gogoproto.goproto_getters) = false;

  string owner                      = 1;
  string connection_id              = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""];
  string version                    = 3;
}

message MsgRegisterAccountResponse {
  string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""];
}

SubmitTx

Introduce a new rpc endpoint SubmitTx. This rpc should provide the existing functionality of the exported SendTx function in 27-interchain-accounts/controller.

service Msg {
  ...
  rpc SubmitTx(MsgSubmitTx) returns (MsgSubmitTxResponse);
}

message MsgSubmitTx {
  option (gogoproto.equal)           = false;
  option (gogoproto.goproto_getters) = false;

  string owner                            = 1;
  string connection_id                    = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""];
  InterchainAccountPacketData packet_data =  3 [(gogoproto.moretags) = "yaml:\"packet_data\""];
  ibc.core.client.v1.Height timeout_height = 4 [(gogoproto.moretags) = "yaml:\"timeout_height\""];
  uint64 timeout_timestamp = 5 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];
}

message MsgSubmitTxResponse {
  uint64 sequence = 1;
}

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned

Metadata

Metadata

Assignees

No one assigned

    Labels

    27-interchain-accountstype: featureNew features, sub-features or integrationstype: refactorArchitecture, code or CI improvements that may or may not tackle technical debt.

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions