-
Notifications
You must be signed in to change notification settings - Fork 751
feat: add AppModuleBasic for tendermint client #2825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b1dbb68
9b47794
900ee3a
4ab248d
5b86a55
856e289
762b6b5
cbd71e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,29 @@ There are four sections based on the four potential user groups of this document | |
|
|
||
| ## Chains | ||
|
|
||
| - No relevant changes were made in this release. | ||
| ### Light client registration | ||
|
|
||
| Chains must explicitly register the types of any light client modules it wishes to integrate. | ||
|
|
||
| #### Tendermint registration | ||
|
|
||
| To register the tendermint client, modify the `app.go` file to include the tendermint `AppModuleBasic`: | ||
|
|
||
| ```diff | ||
| import ( | ||
| ... | ||
| + ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint" | ||
| ... | ||
| ) | ||
| ... | ||
|
|
||
| ModuleBasics = module.NewBasicManager( | ||
| ... | ||
|
||
| ibc.AppModuleBasic{}, | ||
| + ibctm.AppModuleBasic{}, | ||
| ... | ||
| ) | ||
| ``` | ||
|
|
||
| ## IBC Apps | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,6 @@ import ( | |
| channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" | ||
| commitmenttypes "github.com/cosmos/ibc-go/v6/modules/core/23-commitment/types" | ||
| solomachine "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine" | ||
| ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint" | ||
| ) | ||
|
|
||
| // RegisterInterfaces registers x/ibc interfaces into protobuf Any. | ||
|
|
@@ -17,6 +16,5 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { | |
| connectiontypes.RegisterInterfaces(registry) | ||
| channeltypes.RegisterInterfaces(registry) | ||
| solomachine.RegisterInterfaces(registry) | ||
| ibctm.RegisterInterfaces(registry) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. core IBC will no longer include clients by default. This is a feature in my opinion, as it makes core IBC neutral to which light clients should be registered. This is aligned with the IBC app registration approach which requires chain developers to add code to register an application. Luckily adding a client is extremely trivial |
||
| commitmenttypes.RegisterInterfaces(registry) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,53 @@ | ||
| package tendermint | ||
crodriguezvega marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // Name returns the IBC client name | ||
| func Name() string { | ||
crodriguezvega marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import ( | ||
| "encoding/json" | ||
|
|
||
| "github.com/cosmos/cosmos-sdk/client" | ||
| "github.com/cosmos/cosmos-sdk/codec" | ||
| codectypes "github.com/cosmos/cosmos-sdk/codec/types" | ||
| "github.com/cosmos/cosmos-sdk/types/module" | ||
| "github.com/grpc-ecosystem/grpc-gateway/runtime" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| var _ module.AppModuleBasic = AppModuleBasic{} | ||
|
|
||
| // AppModuleBasic defines the basic application module used by the tendermint light client. | ||
| type AppModuleBasic struct{} | ||
|
|
||
| // Name returns the tendermint module name. | ||
| func (AppModuleBasic) Name() string { | ||
| return SubModuleName | ||
crodriguezvega marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| // RegisterLegacyAminoCodec does nothing. The Tendermint client does not support amino. | ||
| func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino) {} | ||
|
|
||
| // RegisterInterfaces registers module concrete types into protobuf Any. | ||
| func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { | ||
| RegisterInterfaces(registry) | ||
| } | ||
|
||
|
|
||
| // DefaultGenesis returns nil | ||
| func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { | ||
| return nil | ||
| } | ||
|
|
||
| // ValidateGenesis return nil | ||
| func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { | ||
| return nil | ||
| } | ||
|
|
||
| // RegisterGRPCGatewayRoutes performs a no-op. | ||
| func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {} | ||
|
|
||
| // GetTxCmd returns nil. | ||
| func (AppModuleBasic) GetTxCmd() *cobra.Command { | ||
| return nil | ||
| } | ||
|
|
||
| // GetQueryCmd returns nil. | ||
| func (AppModuleBasic) GetQueryCmd() *cobra.Command { | ||
| return nil | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.