Deprecation Notice
This document is deprecated and will be removed in future releases.Synopsis
Authentication modules play the role of theBase Application
as described in ICS-30 IBC Middleware, and enable application developers to perform custom logic when working with the Interchain Accounts controller API.
The controller submodule is used for account registration and packet sending. It executes only logic required of all controllers of interchain accounts. The type of authentication used to manage the interchain accounts remains unspecified. There may exist many different types of authentication which are desirable for different use cases. Thus the purpose of the authentication module is to wrap the controller submodule with custom authentication logic.
In ibc-go, authentication modules are connected to the controller chain via a middleware stack. The controller submodule is implemented as middleware and the authentication module is connected to the controller submodule as the base application of the middleware stack. To implement an authentication module, the IBCModule
interface must be fulfilled. By implementing the controller submodule as middleware, any amount of authentication modules can be created and connected to the controller submodule without writing redundant code.
The authentication module must:
- Authenticate interchain account owners.
- Track the associated interchain account address for an owner.
- Send packets on behalf of an owner (after authentication).
Please note that since ibc-go v6 the channel capability is claimed by the controller submodule and therefore it is not required for authentication modules to claim the capability in theOnChanOpenInit
callback. When the authentication module sends packets on the channel created for the associated interchain account it can pass anil
capability to the legacy functionSendTx
of the controller keeper (see sectionSendTx
below for mode information).
IBCModule
implementation
The following IBCModule
callbacks must be implemented with appropriate custom logic:
IBCModule
interface, but they will never be called by the controller submodule so they may error or panic. That is because in Interchain Accounts, the channel handshake is always initiated on the controller chain and packets are always sent to the host chain and never to the controller chain.
OnAcknowledgementPacket
Controller chains will be able to access the acknowledgement written into the host chain state once a relayer relays the acknowledgement.
The acknowledgement bytes contain either the response of the execution of the message(s) on the host chain or an error. They will be passed to the auth module via the OnAcknowledgementPacket
callback. Auth modules are expected to know how to decode the acknowledgement.
If the controller chain is connected to a host chain using the host module on ibc-go, it may interpret the acknowledgement bytes as follows:
Begin by unmarshaling the acknowledgement into sdk.TxMsgData
:
txMsgData.Data
field is non nil, the host chain is using SDK version <=
v0.45.
The auth module should interpret the txMsgData.Data
as follows:
txMsgData.Data
is empty, the host chain is using SDK version > v0.45.
The auth module should interpret the txMsgData.Responses
as follows:
handler
and handleAny
.
Integration into app.go
file
To integrate the authentication module into your chain, please follow the steps outlined in app.go
integration.