-
Notifications
You must be signed in to change notification settings - Fork 579
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
feat: add AppModuleBasic for solo machine client #2826
Changes from 4 commits
538a9f4
b5cc3eb
b5bf127
ef72b9f
8cf86ea
45e6bb5
6665e6d
b3a5694
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,30 @@ 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. | ||
|
||
#### Solo machine registration | ||
|
||
To register the solo machine client, modify the `app.go` file to include the solo machine `AppModuleBasic`: | ||
|
||
```diff | ||
import ( | ||
... | ||
+ solomachine "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine" | ||
... | ||
) | ||
... | ||
ModuleBasics = module.NewBasicManager( | ||
... | ||
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. Same thing about indentation. :) |
||
ibc.AppModuleBasic{}, | ||
+ solomachine.AppModuleBasic{}, | ||
... | ||
) | ||
``` | ||
|
||
It may be useful to reference the [PR](https://github.com/cosmos/ibc-go/pull/2826) which added the `AppModuleBasic` for the solo machine client. | ||
|
||
## IBC Apps | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,53 @@ | ||
package solomachine | ||
|
||
// Name returns the solo machine client name. | ||
func Name() string { | ||
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 solo machine light client. | ||
type AppModuleBasic struct{} | ||
|
||
// Name returns the solo machine module name. | ||
func (AppModuleBasic) Name() string { | ||
return SubModuleName | ||
} | ||
|
||
// RegisterLegacyAminoCodec does nothing. The solo machine 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) | ||
} | ||
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. is it worth mentioning in the other docstrings, or maybe in the 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. Good suggestion! Checkout this commit 45e6bb5, let me know if there are any improvements I could add |
||
|
||
// 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 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation police! 🚓