diff --git a/CHANGELOG.md b/CHANGELOG.md index a04a84ec2dd..fa14d36630a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -115,6 +115,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +* (light-clients/06-solomachine) [\#2826](https://github.com/cosmos/ibc-go/pull/2826) Add `AppModuleBasic` for the 06-solomachine client and remove solo machine type registration from core IBC. Chains must register the `AppModuleBasic` of light clients. * (light-clients/07-tendermint) [\#2825](https://github.com/cosmos/ibc-go/pull/2825) Add `AppModuleBasic` for the 07-tendermint client and remove tendermint type registration from core IBC. Chains must register the `AppModuleBasic` of light clients. * (light-clients/07-tendermint) [\#2800](https://github.com/cosmos/ibc-go/pull/2800) Add optional in-place store migration function to prune all expired tendermint consensus states. * (core/24-host) [\#2820](https://github.com/cosmos/ibc-go/pull/2820) Add `MustParseClientStatePath` which parses the clientID from a client state key path. diff --git a/docs/migrations/v6-to-v7.md b/docs/migrations/v6-to-v7.md index 68d04847b00..a92331fd239 100644 --- a/docs/migrations/v6-to-v7.md +++ b/docs/migrations/v6-to-v7.md @@ -49,11 +49,11 @@ To register the tendermint client, modify the `app.go` file to include the tende ```diff import ( - ... + // ... + ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint" - ... ) -... + +// ... ModuleBasics = module.NewBasicManager( ... @@ -65,6 +65,28 @@ ModuleBasics = module.NewBasicManager( It may be useful to reference the [PR](https://github.com/cosmos/ibc-go/pull/2825) which added the `AppModuleBasic` for the tendermint client. +#### 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( + ... + 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 - No relevant changes were made in this release. diff --git a/modules/core/types/codec.go b/modules/core/types/codec.go index 96226e396ae..3b552ed7e71 100644 --- a/modules/core/types/codec.go +++ b/modules/core/types/codec.go @@ -7,7 +7,6 @@ import ( connectiontypes "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types" 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" ) // RegisterInterfaces registers x/ibc interfaces into protobuf Any. @@ -15,6 +14,5 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { clienttypes.RegisterInterfaces(registry) connectiontypes.RegisterInterfaces(registry) channeltypes.RegisterInterfaces(registry) - solomachine.RegisterInterfaces(registry) commitmenttypes.RegisterInterfaces(registry) } diff --git a/modules/light-clients/06-solomachine/module.go b/modules/light-clients/06-solomachine/module.go index d66b482541c..a7272f1faf5 100644 --- a/modules/light-clients/06-solomachine/module.go +++ b/modules/light-clients/06-solomachine/module.go @@ -1,6 +1,56 @@ 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. +// Only the RegisterInterfaces function needs to be implemented. All other function perform +// a no-op. +type AppModuleBasic struct{} + +// Name returns the solo machine module name. +func (AppModuleBasic) Name() string { return SubModuleName } + +// RegisterLegacyAminoCodec performs a no-op. The solo machine client does not support amino. +func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino) {} + +// RegisterInterfaces registers module concrete types into protobuf Any. This allows core IBC +// to unmarshal solo machine types. +func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { + RegisterInterfaces(registry) +} + +// DefaultGenesis performs a no-op. Genesis is not supported for solo machine. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return nil +} + +// ValidateGenesis performs a no-op. Genesis is not supported for solo machine. +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 +} diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 42c6422f640..ac2a0be5fb9 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -109,6 +109,7 @@ import ( porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types" ibchost "github.com/cosmos/ibc-go/v6/modules/core/24-host" ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper" + solomachine "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine" ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint" ibcmock "github.com/cosmos/ibc-go/v6/testing/mock" simappparams "github.com/cosmos/ibc-go/v6/testing/simapp/params" @@ -155,6 +156,7 @@ var ( slashing.AppModuleBasic{}, ibc.AppModuleBasic{}, ibctm.AppModuleBasic{}, + solomachine.AppModuleBasic{}, feegrantmodule.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{},