-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add AppModuleBasic for tendermint client (#2825)
feat: add `AppModuleBasic` for the 07-tendermint client and remove tendermint type registration from core IBC. Chains must register the `AppModuleBasic` of light clients.
- Loading branch information
1 parent
9720607
commit 83f1cd1
Showing
5 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,56 @@ | ||
package tendermint | ||
|
||
// Name returns the IBC 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 tendermint light client. | ||
// Only the RegisterInterfaces function needs to be implemented. All other function perform | ||
// a no-op. | ||
type AppModuleBasic struct{} | ||
|
||
// Name returns the tendermint module name. | ||
func (AppModuleBasic) Name() string { | ||
return SubModuleName | ||
} | ||
|
||
// RegisterLegacyAminoCodec performs a no-op. The Tendermint client does not support amino. | ||
func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino) {} | ||
|
||
// RegisterInterfaces registers module concrete types into protobuf Any. This allows core IBC | ||
// to unmarshal tendermint light client types. | ||
func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { | ||
RegisterInterfaces(registry) | ||
} | ||
|
||
// DefaultGenesis performs a no-op. Genesis is not supported for the tendermint light client. | ||
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { | ||
return nil | ||
} | ||
|
||
// ValidateGenesis performs a no-op. Genesis is not supported for the tendermint light cilent. | ||
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 performs a no-op. Please see the 02-client cli commands. | ||
func (AppModuleBasic) GetTxCmd() *cobra.Command { | ||
return nil | ||
} | ||
|
||
// GetQueryCmd performs a no-op. Please see the 02-client cli commands. | ||
func (AppModuleBasic) GetQueryCmd() *cobra.Command { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters