diff --git a/e2e/go.mod b/e2e/go.mod index 994f00ace1e..edba0a074d6 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -66,6 +66,7 @@ require ( github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.0.0-rc.1 // indirect + github.com/cosmos/ibc-go/api v0.0.0 // indirect github.com/cosmos/ibc-go/modules/capability v1.0.0-rc5 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.0 // indirect @@ -230,6 +231,10 @@ replace ( // uncomment to use the local version of ibc-go, you will need to run `go mod tidy` in e2e directory. replace github.com/cosmos/ibc-go/v8 => ../ +replace github.com/cosmos/ibc-go/api => ../api + replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + +replace cosmossdk.io/api/cosmos/capability => github.com/cosmos/ibc-go/modules/capability v1.0.0-rc1 diff --git a/go.mod b/go.mod index 0345687656f..a4015a4a3c1 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( cosmossdk.io/api v0.7.1 cosmossdk.io/client/v2 v2.0.0-20230818115413-c402c51a1508 cosmossdk.io/core v0.11.0 + cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.1 cosmossdk.io/math v1.1.2 @@ -21,6 +22,7 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/cosmos/cosmos-sdk v0.50.0-rc.0.0.20230915171831-2196edacb99d github.com/cosmos/gogoproto v1.4.11 + github.com/cosmos/ibc-go/api v0.0.0 github.com/cosmos/ibc-go/modules/capability v1.0.0-rc5 github.com/cosmos/ics23/go v0.10.0 github.com/golang/protobuf v1.5.3 @@ -43,7 +45,6 @@ require ( cloud.google.com/go/iam v1.1.1 // indirect cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/depinject v1.0.0-alpha.4 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect @@ -191,3 +192,5 @@ require ( ) replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 + +replace github.com/cosmos/ibc-go/api => ./api diff --git a/modules/core/module.go b/modules/core/module.go index 27edd09a143..9d6bdbcec43 100644 --- a/modules/core/module.go +++ b/modules/core/module.go @@ -9,14 +9,21 @@ import ( "github.com/spf13/cobra" "cosmossdk.io/core/appmodule" + "cosmossdk.io/depinject" + store "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + modulev1 "github.com/cosmos/ibc-go/api/ibc/core/module/v1" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" ibcclient "github.com/cosmos/ibc-go/v8/modules/core/02-client" clientkeeper "github.com/cosmos/ibc-go/v8/modules/core/02-client/keeper" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" @@ -206,3 +213,54 @@ func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { return nil } + +// App Wiring Setup + +func init() { + appmodule.Register(&modulev1.Module{}, + appmodule.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + Config *modulev1.Module + Cdc codec.Codec + Key *store.KVStoreKey + + StakingKeeper clienttypes.StakingKeeper + UpgradeKeeper clienttypes.UpgradeKeeper + ScopedKeeper capabilitykeeper.ScopedKeeper + + // LegacySubspace is used solely for migration of x/params managed parameters + LegacySubspace paramtypes.Subspace `optional:"true"` +} + +type ModuleOutputs struct { + depinject.Out + + IbcKeeper *keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + + keeper := keeper.NewKeeper( + in.Cdc, + in.Key, + in.LegacySubspace, + in.StakingKeeper, + in.UpgradeKeeper, + in.ScopedKeeper, + authority.String(), + ) + m := NewAppModule(keeper) + + return ModuleOutputs{IbcKeeper: keeper, Module: m} +} diff --git a/proto/buf.gen.gogo.yaml b/proto/buf.gen.gogo.yaml index 9c8ba0a4b1f..5bcc1f9086f 100644 --- a/proto/buf.gen.gogo.yaml +++ b/proto/buf.gen.gogo.yaml @@ -2,7 +2,7 @@ version: v1 plugins: - name: gocosmos out: .. - opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types + opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types,Mcosmos/app/v1alpha1/module.proto=cosmossdk.io/api/cosmos/app/v1alpha1 - name: grpc-gateway out: .. opt: logtostderr=true,allow_colon_final_segments=true