cosmos / ibc-go

Inter-Blockchain Communication Protocol (IBC) implementation in Golang.
https://ibc.cosmos.network/
MIT License
548 stars 580 forks source link

Lightclient module structuring and internal keeper usage #6186

Open damiannolan opened 5 months ago

damiannolan commented 5 months ago

Summary

Historically light client modules have had a very open ended code structure with most if not all code existing within package types or since ibc-go/v7 within the root of the lightclient module, e.g. package tendermint. Since https://github.com/cosmos/ibc-go/pull/5806 and decoupling client encoding from routing within ibc-go there is now a more unrestricted opportunity to provide more structure and code organisation to lightclient modules - as we do not rely on all functionality being tightly coupled with the client state type/interface implementation.

See: https://github.com/cosmos/ibc-go/pull/5806#discussion_r1523504060

Problem Definition

Currently, there is little to no code organisation within the majority of lightclient modules. The 08-wasm module contains a similar structure, reminiscent to that of a regular sdk module and has seen much improvements and benefits from the refactor linked above.

With the refactor we introduced an internal/keeper to 07-tendermint with intensions for this to be useful for things such as msg server execution, in particular governance authorised requests such as changing client state parameters.

Proposal

Explore some paths for providing a simple and organised structure for lightclient modules.


For Admin Use

DimitrisJim commented 5 months ago

Nice! In addition, a re-org like this would also be a great op for an internal pkg for all the types that might now need to be exported (if we split each light client into multiple go pkgs)