Synopsis
Learn how to configure light client modules and create clients using core IBC and the02-client submodule.
A last step to finish the development of the light client, is to implement the AppModuleBasic interface to allow it to be added to the chain’s app.go alongside other light client types the chain enables.
Finally, a succinct rundown is given of the remaining steps to make the light client operational, getting the light client type passed through governance and creating the clients.
Configuring a light client module
An IBC light client module must implement theAppModuleBasic interface in order to register its concrete types against the core IBC interfaces defined in modules/core/exported. This is accomplished via the RegisterInterfaces method which provides the light client module with the opportunity to register codec types using the chain’s InterfaceRegistry. Please refer to the 07-tendermint codec registration.
The AppModuleBasic interface may also be leveraged to install custom CLI handlers for light client module users. Light client modules can safely no-op for interface methods which it does not wish to implement.
Please refer to the core IBC documentation for how to configure additional light client modules alongside 07-tendermint in app.go.
See below for an example of the 07-tendermint implementation of AppModuleBasic.
Creating clients
A client is created by executing a newMsgCreateClient transaction composed with a valid ClientState and initial ConsensusState encoded as protobuf Anys.
Generally, this is performed by an off-chain process known as an IBC relayer however, this is not a strict requirement.
See below for a list of IBC relayer implementations:
Stateless checks are performed within the ValidateBasic method of MsgCreateClient.
Any encoding allows core IBC to unpack the ClientState into its respective interface type registered previously using the light client module’s RegisterInterfaces method.
Within the 02-client submodule, the ClientState is then initialized with its own isolated key-value store, namespaced using a unique client identifier.
In order to successfully create an IBC client using a new client type, it must be supported. Light client support in IBC is gated by on-chain governance. The allow list may be updated by submitting a new governance proposal to update the 02-client parameter AllowedClients.
See below for example:
proposal.json contains:
AllowedClients list contains a single element that is equal to the wildcard "*", then all client types are allowed and it is thus not necessary to submit a governance proposal to update the parameter.