diff --git a/Dockerfile b/Dockerfile index 3c6d2bd6094..40d2d03d9a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ COPY go.sum . RUN go mod download +ADD internal internal ADD testing testing ADD modules modules ADD LICENSE LICENSE diff --git a/docs/ibc/integration.md b/docs/ibc/integration.md index 904fcdb303a..61c2510588f 100644 --- a/docs/ibc/integration.md +++ b/docs/ibc/integration.md @@ -104,14 +104,14 @@ func NewApp(...args) *App { app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) // grant capabilities for the ibc and ibc-transfer modules - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName) + scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) // ... other modules keepers // Create IBC Keeper app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, + appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, ) // Create Transfer Keepers @@ -202,7 +202,7 @@ func NewApp(...args) *App { // add staking and ibc modules to BeginBlockers app.mm.SetOrderBeginBlockers( // other modules ... - stakingtypes.ModuleName, ibchost.ModuleName, + stakingtypes.ModuleName, ibcexported.ModuleName, ) // ... @@ -213,7 +213,7 @@ func NewApp(...args) *App { app.mm.SetOrderInitGenesis( capabilitytypes.ModuleName, // other modules ... - ibchost.ModuleName, ibctransfertypes.ModuleName, + ibcexported.ModuleName, ibctransfertypes.ModuleName, ) // .. continues diff --git a/docs/migrations/v6-to-v7.md b/docs/migrations/v6-to-v7.md index 6c31626f66a..34a0328e79f 100644 --- a/docs/migrations/v6-to-v7.md +++ b/docs/migrations/v6-to-v7.md @@ -263,3 +263,27 @@ message SignatureAndData { For more information, please refer to [ADR-007](https://github.com/cosmos/ibc-go/blob/02-client-refactor-beta1/docs/architecture/adr-007-solomachine-signbytes.md). +### IBC module constants + +IBC module constants have been moved from the `host` package to the `exported` package. Any usages will need to be updated. + +```diff +import ( + // ... +- host "github.com/cosmos/ibc-go/v6/modules/core/24-host" ++ ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" + // ... +) + +- host.ModuleName ++ ibcexported.ModuleName + +- host.StoreKey ++ ibcexported.StoreKey + +- host.QuerierRoute ++ ibcexported.QuerierRoute + +- host.RouterKey ++ ibcexported.RouterKey +``` diff --git a/e2e/tests/core/03-connection/connection_test.go b/e2e/tests/core/03-connection/connection_test.go index 3cefdcb51a5..ad432fee9cc 100644 --- a/e2e/tests/core/03-connection/connection_test.go +++ b/e2e/tests/core/03-connection/connection_test.go @@ -17,7 +17,7 @@ import ( "github.com/cosmos/ibc-go/e2e/testvalues" transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" connectiontypes "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" ibctesting "github.com/cosmos/ibc-go/v6/testing" ) @@ -33,7 +33,7 @@ type ConnectionTestSuite struct { func (s *ConnectionTestSuite) QueryMaxExpectedTimePerBlockParam(ctx context.Context, chain ibc.Chain) uint64 { queryClient := s.GetChainGRCPClients(chain).ParamsQueryClient res, err := queryClient.Params(ctx, ¶msproposaltypes.QueryParamsRequest{ - Subspace: host.ModuleName, + Subspace: ibcexported.ModuleName, Key: string(connectiontypes.KeyMaxExpectedTimePerBlock), }) s.Require().NoError(err) @@ -74,7 +74,7 @@ func (s *ConnectionTestSuite) TestMaxExpectedTimePerBlockParam() { t.Run("change the delay to 60 seconds", func(t *testing.T) { delay := fmt.Sprintf(`"%d"`, 1*time.Minute) changes := []paramsproposaltypes.ParamChange{ - paramsproposaltypes.NewParamChange(host.ModuleName, string(connectiontypes.KeyMaxExpectedTimePerBlock), delay), + paramsproposaltypes.NewParamChange(ibcexported.ModuleName, string(connectiontypes.KeyMaxExpectedTimePerBlock), delay), } proposal := paramsproposaltypes.NewParameterChangeProposal(ibctesting.Title, ibctesting.Description, changes) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index 261b2bef87a..0e58a6b0b07 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -62,7 +62,7 @@ func NewKeeper( // Logger returns the application logger, scoped to the associated module func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", host.ModuleName, icatypes.ModuleName)) + return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", exported.ModuleName, icatypes.ModuleName)) } // GetConnectionID returns the connection id for the given port and channelIDs. diff --git a/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations.go b/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations.go index a64647ac332..bf2701e34f9 100644 --- a/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations.go +++ b/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations.go @@ -9,7 +9,7 @@ import ( capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" controllertypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/types" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" ) // MigrateICS27ChannelCapability performs a search on a prefix store using the provided store key and module name. @@ -68,7 +68,7 @@ func hasIBCOwner(owners []capabilitytypes.Owner) bool { } for _, owner := range owners { - if owner.Module == host.ModuleName { + if owner.Module == ibcexported.ModuleName { return true } } diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper.go b/modules/apps/27-interchain-accounts/host/keeper/keeper.go index 8019d91aba4..49aed16585e 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper.go @@ -67,7 +67,7 @@ func NewKeeper( // Logger returns the application logger, scoped to the associated module func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", host.ModuleName, icatypes.ModuleName)) + return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", exported.ModuleName, icatypes.ModuleName)) } // BindPort stores the provided portID and binds to it, returning the associated capability diff --git a/modules/apps/29-fee/keeper/keeper.go b/modules/apps/29-fee/keeper/keeper.go index e506ef8118f..c067ee76679 100644 --- a/modules/apps/29-fee/keeper/keeper.go +++ b/modules/apps/29-fee/keeper/keeper.go @@ -10,7 +10,7 @@ import ( "github.com/cosmos/ibc-go/v6/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" ) // Middleware must implement types.ChannelKeeper and types.PortKeeper expected interfaces @@ -51,7 +51,7 @@ func NewKeeper( // Logger returns a module-specific logger. func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+host.ModuleName+"-"+types.ModuleName) + return ctx.Logger().With("module", "x/"+ibcexported.ModuleName+"-"+types.ModuleName) } // BindPort defines a wrapper function for the port Keeper's function in diff --git a/modules/apps/transfer/keeper/keeper.go b/modules/apps/transfer/keeper/keeper.go index 9688d57aff2..0e8da7bca51 100644 --- a/modules/apps/transfer/keeper/keeper.go +++ b/modules/apps/transfer/keeper/keeper.go @@ -61,7 +61,7 @@ func NewKeeper( // Logger returns a module-specific logger. func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+host.ModuleName+"-"+types.ModuleName) + return ctx.Logger().With("module", "x/"+exported.ModuleName+"-"+types.ModuleName) } // IsBound checks if the transfer module is already bound to the desired port diff --git a/modules/core/02-client/client/cli/query.go b/modules/core/02-client/client/cli/query.go index a2dd859bc43..77682a54de2 100644 --- a/modules/core/02-client/client/cli/query.go +++ b/modules/core/02-client/client/cli/query.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/ibc-go/v6/modules/core/02-client/client/utils" "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" ) const ( @@ -25,7 +25,7 @@ func GetCmdQueryClientStates() *cobra.Command { Use: "states", Short: "Query all available light clients", Long: "Query all available light clients", - Example: fmt.Sprintf("%s query %s %s states", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s states", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -64,7 +64,7 @@ func GetCmdQueryClientState() *cobra.Command { Use: "state [client-id]", Short: "Query a client state", Long: "Query stored client state", - Example: fmt.Sprintf("%s query %s %s state [client-id]", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s state [client-id]", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -95,7 +95,7 @@ func GetCmdQueryClientStatus() *cobra.Command { Use: "status [client-id]", Short: "Query client status", Long: "Query client activity status. Any client without an 'Active' status is considered inactive", - Example: fmt.Sprintf("%s query %s %s status [client-id]", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s status [client-id]", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -131,7 +131,7 @@ func GetCmdQueryConsensusStates() *cobra.Command { Use: "consensus-states [client-id]", Short: "Query all the consensus states of a client.", Long: "Query all the consensus states from a given client state.", - Example: fmt.Sprintf("%s query %s %s consensus-states [client-id]", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s consensus-states [client-id]", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -173,7 +173,7 @@ func GetCmdQueryConsensusStateHeights() *cobra.Command { Use: "consensus-state-heights [client-id]", Short: "Query the heights of all consensus states of a client.", Long: "Query the heights of all consensus states associated with the provided client ID.", - Example: fmt.Sprintf("%s query %s %s consensus-state-heights [client-id]", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s consensus-state-heights [client-id]", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -217,7 +217,7 @@ func GetCmdQueryConsensusState() *cobra.Command { Short: "Query the consensus state of a client at a given height", Long: `Query the consensus state for a particular light client at a given height. If the '--latest' flag is included, the query returns the latest consensus state, overriding the height argument.`, - Example: fmt.Sprintf("%s query %s %s consensus-state [client-id] [height]", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s consensus-state [client-id] [height]", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.RangeArgs(1, 2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -263,7 +263,7 @@ func GetCmdQueryHeader() *cobra.Command { Use: "header", Short: "Query the latest header of the running chain", Long: "Query the latest Tendermint header of the running chain", - Example: fmt.Sprintf("%s query %s %s header", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s header", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -290,7 +290,7 @@ func GetCmdSelfConsensusState() *cobra.Command { Use: "self-consensus-state", Short: "Query the self consensus state for this chain", Long: "Query the self consensus state for this chain. This result may be used for verifying IBC clients representing this chain which are hosted on counterparty chains.", - Example: fmt.Sprintf("%s query %s %s self-consensus-state", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s self-consensus-state", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -318,7 +318,7 @@ func GetCmdClientParams() *cobra.Command { Short: "Query the current ibc client parameters", Long: "Query the current ibc client parameters", Args: cobra.NoArgs, - Example: fmt.Sprintf("%s query %s %s params", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s params", version.AppName, ibcexported.ModuleName, types.SubModuleName), RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index 7e62bdcef27..c20dad5383d 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -50,7 +50,7 @@ func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramt // Logger returns a module-specific logger. func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+host.ModuleName+"/"+types.SubModuleName) + return ctx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } // GenerateClientIdentifier returns the next client identifier. diff --git a/modules/core/02-client/migrations/v7/genesis_test.go b/modules/core/02-client/migrations/v7/genesis_test.go index f758ed94aa9..2d196145c95 100644 --- a/modules/core/02-client/migrations/v7/genesis_test.go +++ b/modules/core/02-client/migrations/v7/genesis_test.go @@ -10,6 +10,7 @@ import ( "github.com/cosmos/ibc-go/v6/modules/core/02-client/migrations/v7" "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" ibctesting "github.com/cosmos/ibc-go/v6/testing" ) @@ -101,7 +102,7 @@ func (suite *MigrationsV7TestSuite) TestMigrateGenesisSolomachine() { // migrate store get expected genesis // store migration and genesis migration should produce identical results // NOTE: tendermint clients are not pruned in genesis so the test should not have expired tendermint clients - err := v7.MigrateStore(suite.chainA.GetContext(), suite.chainA.GetSimApp().GetKey(host.StoreKey), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) + err := v7.MigrateStore(suite.chainA.GetContext(), suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) suite.Require().NoError(err) expectedClientGenState := ibcclient.ExportGenesis(suite.chainA.GetContext(), suite.chainA.App.GetIBCKeeper().ClientKeeper) diff --git a/modules/core/02-client/migrations/v7/store_test.go b/modules/core/02-client/migrations/v7/store_test.go index e0c2ad35d17..1d2e06fe8aa 100644 --- a/modules/core/02-client/migrations/v7/store_test.go +++ b/modules/core/02-client/migrations/v7/store_test.go @@ -9,6 +9,7 @@ import ( v7 "github.com/cosmos/ibc-go/v6/modules/core/02-client/migrations/v7" "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" ibctesting "github.com/cosmos/ibc-go/v6/testing" ) @@ -58,7 +59,7 @@ func (suite *MigrationsV7TestSuite) TestMigrateStore() { suite.createSolomachineClients(solomachines) suite.createLocalhostClients() - err := v7.MigrateStore(suite.chainA.GetContext(), suite.chainA.GetSimApp().GetKey(host.StoreKey), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) + err := v7.MigrateStore(suite.chainA.GetContext(), suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) suite.Require().NoError(err) suite.assertSolomachineClients(solomachines) @@ -74,7 +75,7 @@ func (suite *MigrationsV7TestSuite) TestMigrateStoreNoTendermintClients() { suite.createSolomachineClients(solomachines) suite.createLocalhostClients() - err := v7.MigrateStore(suite.chainA.GetContext(), suite.chainA.GetSimApp().GetKey(host.StoreKey), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) + err := v7.MigrateStore(suite.chainA.GetContext(), suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) suite.Require().NoError(err) suite.assertSolomachineClients(solomachines) diff --git a/modules/core/02-client/types/events.go b/modules/core/02-client/types/events.go index 5610766ebeb..44df56f0ee9 100644 --- a/modules/core/02-client/types/events.go +++ b/modules/core/02-client/types/events.go @@ -3,7 +3,7 @@ package types import ( "fmt" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" ) // IBC client events @@ -29,5 +29,5 @@ var ( EventTypeUpgradeChain = "upgrade_chain" EventTypeUpgradeClientProposal = "upgrade_client_proposal" - AttributeValueCategory = fmt.Sprintf("%s_%s", host.ModuleName, SubModuleName) + AttributeValueCategory = fmt.Sprintf("%s_%s", ibcexported.ModuleName, SubModuleName) ) diff --git a/modules/core/03-connection/client/cli/query.go b/modules/core/03-connection/client/cli/query.go index db2d5c0ecf6..e7ce71c9f2f 100644 --- a/modules/core/03-connection/client/cli/query.go +++ b/modules/core/03-connection/client/cli/query.go @@ -10,7 +10,7 @@ import ( "github.com/cosmos/ibc-go/v6/modules/core/03-connection/client/utils" "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" ) // GetCmdQueryConnections defines the command to query all the connection ends @@ -20,7 +20,7 @@ func GetCmdQueryConnections() *cobra.Command { Use: "connections", Short: "Query all connections", Long: "Query all connections ends from a chain", - Example: fmt.Sprintf("%s query %s %s connections", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s connections", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -59,7 +59,7 @@ func GetCmdQueryConnection() *cobra.Command { Use: "end [connection-id]", Short: "Query stored connection end", Long: "Query stored connection end", - Example: fmt.Sprintf("%s query %s %s end [connection-id]", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s end [connection-id]", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -91,7 +91,7 @@ func GetCmdQueryClientConnections() *cobra.Command { Use: "path [client-id]", Short: "Query stored client connection paths", Long: "Query stored client connection paths", - Example: fmt.Sprintf("%s query %s %s path [client-id]", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s path [client-id]", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -124,7 +124,7 @@ func GetCmdConnectionParams() *cobra.Command { Short: "Query the current ibc connection parameters", Long: "Query the current ibc connection parameters", Args: cobra.NoArgs, - Example: fmt.Sprintf("%s query %s %s params", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s params", version.AppName, ibcexported.ModuleName, types.SubModuleName), RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { diff --git a/modules/core/03-connection/keeper/keeper.go b/modules/core/03-connection/keeper/keeper.go index 0a02f2b904a..05ec016a119 100644 --- a/modules/core/03-connection/keeper/keeper.go +++ b/modules/core/03-connection/keeper/keeper.go @@ -43,7 +43,7 @@ func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramt // Logger returns a module-specific logger. func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+host.ModuleName+"/"+types.SubModuleName) + return ctx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } // GetCommitmentPrefix returns the IBC connection store prefix as a commitment diff --git a/modules/core/03-connection/types/events.go b/modules/core/03-connection/types/events.go index 0a487caffab..3d2ff70685a 100644 --- a/modules/core/03-connection/types/events.go +++ b/modules/core/03-connection/types/events.go @@ -3,7 +3,7 @@ package types import ( "fmt" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" ) // IBC connection events @@ -21,5 +21,5 @@ var ( EventTypeConnectionOpenAck = "connection_open_ack" EventTypeConnectionOpenConfirm = "connection_open_confirm" - AttributeValueCategory = fmt.Sprintf("%s_%s", host.ModuleName, SubModuleName) + AttributeValueCategory = fmt.Sprintf("%s_%s", ibcexported.ModuleName, SubModuleName) ) diff --git a/modules/core/04-channel/client/cli/query.go b/modules/core/04-channel/client/cli/query.go index 0ab256b163d..3138c69d727 100644 --- a/modules/core/04-channel/client/cli/query.go +++ b/modules/core/04-channel/client/cli/query.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/ibc-go/v6/modules/core/04-channel/client/utils" "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" ) const ( @@ -25,7 +25,7 @@ func GetCmdQueryChannels() *cobra.Command { Use: "channels", Short: "Query all channels", Long: "Query all channels from a chain", - Example: fmt.Sprintf("%s query %s %s channels", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s channels", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -65,7 +65,7 @@ func GetCmdQueryChannel() *cobra.Command { Short: "Query a channel end", Long: "Query an IBC channel end from a port and channel identifiers", Example: fmt.Sprintf( - "%s query %s %s end [port-id] [channel-id]", version.AppName, host.ModuleName, types.SubModuleName, + "%s query %s %s end [port-id] [channel-id]", version.AppName, ibcexported.ModuleName, types.SubModuleName, ), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -99,7 +99,7 @@ func GetCmdQueryConnectionChannels() *cobra.Command { Use: "connections [connection-id]", Short: "Query all channels associated with a connection", Long: "Query all channels associated with a connection", - Example: fmt.Sprintf("%s query %s %s connections [connection-id]", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s connections [connection-id]", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -169,7 +169,7 @@ func GetCmdQueryPacketCommitments() *cobra.Command { Use: "packet-commitments [port-id] [channel-id]", Short: "Query all packet commitments associated with a channel", Long: "Query all packet commitments associated with a channel", - Example: fmt.Sprintf("%s query %s %s packet-commitments [port-id] [channel-id]", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s packet-commitments [port-id] [channel-id]", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -210,7 +210,7 @@ func GetCmdQueryPacketCommitment() *cobra.Command { Short: "Query a packet commitment", Long: "Query a packet commitment", Example: fmt.Sprintf( - "%s query %s %s packet-commitment [port-id] [channel-id] [sequence]", version.AppName, host.ModuleName, types.SubModuleName, + "%s query %s %s packet-commitment [port-id] [channel-id] [sequence]", version.AppName, ibcexported.ModuleName, types.SubModuleName, ), Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { @@ -249,7 +249,7 @@ func GetCmdQueryPacketReceipt() *cobra.Command { Short: "Query a packet receipt", Long: "Query a packet receipt", Example: fmt.Sprintf( - "%s query %s %s packet-receipt [port-id] [channel-id] [sequence]", version.AppName, host.ModuleName, types.SubModuleName, + "%s query %s %s packet-receipt [port-id] [channel-id] [sequence]", version.AppName, ibcexported.ModuleName, types.SubModuleName, ), Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { @@ -288,7 +288,7 @@ func GetCmdQueryPacketAcknowledgement() *cobra.Command { Short: "Query a packet acknowledgement", Long: "Query a packet acknowledgement", Example: fmt.Sprintf( - "%s query %s %s packet-ack [port-id] [channel-id] [sequence]", version.AppName, host.ModuleName, types.SubModuleName, + "%s query %s %s packet-ack [port-id] [channel-id] [sequence]", version.AppName, ibcexported.ModuleName, types.SubModuleName, ), Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { @@ -331,7 +331,7 @@ func GetCmdQueryUnreceivedPackets() *cobra.Command { The return value represents: - Unreceived packet commitments: no acknowledgement exists on receiving chain for the given packet commitment sequence on sending chain. `, - Example: fmt.Sprintf("%s query %s %s unreceived-packets [port-id] [channel-id] --sequences=1,2,3", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s unreceived-packets [port-id] [channel-id] --sequences=1,2,3", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -381,7 +381,7 @@ func GetCmdQueryUnreceivedAcks() *cobra.Command { The return value represents: - Unreceived packet acknowledgement: packet commitment exists on original sending (executing) chain and ack exists on receiving chain. `, - Example: fmt.Sprintf("%s query %s %s unreceived-acks [port-id] [channel-id] --sequences=1,2,3", version.AppName, host.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s unreceived-acks [port-id] [channel-id] --sequences=1,2,3", version.AppName, ibcexported.ModuleName, types.SubModuleName), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -428,7 +428,7 @@ func GetCmdQueryNextSequenceReceive() *cobra.Command { Short: "Query a next receive sequence", Long: "Query the next receive sequence for a given channel", Example: fmt.Sprintf( - "%s query %s %s next-sequence-receive [port-id] [channel-id]", version.AppName, host.ModuleName, types.SubModuleName, + "%s query %s %s next-sequence-receive [port-id] [channel-id]", version.AppName, ibcexported.ModuleName, types.SubModuleName, ), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/modules/core/04-channel/keeper/keeper.go b/modules/core/04-channel/keeper/keeper.go index db05a8457a5..736e6b37dd1 100644 --- a/modules/core/04-channel/keeper/keeper.go +++ b/modules/core/04-channel/keeper/keeper.go @@ -53,7 +53,7 @@ func NewKeeper( // Logger returns a module-specific logger. func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+host.ModuleName+"/"+types.SubModuleName) + return ctx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } // GenerateChannelIdentifier returns the next channel identifier. diff --git a/modules/core/04-channel/types/events.go b/modules/core/04-channel/types/events.go index 555cddc1c67..e897a0ab30d 100644 --- a/modules/core/04-channel/types/events.go +++ b/modules/core/04-channel/types/events.go @@ -3,7 +3,7 @@ package types import ( "fmt" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" ) // IBC channel events @@ -50,5 +50,5 @@ var ( EventTypeChannelCloseConfirm = "channel_close_confirm" EventTypeChannelClosed = "channel_close" - AttributeValueCategory = fmt.Sprintf("%s_%s", host.ModuleName, SubModuleName) + AttributeValueCategory = fmt.Sprintf("%s_%s", ibcexported.ModuleName, SubModuleName) ) diff --git a/modules/core/05-port/keeper/keeper.go b/modules/core/05-port/keeper/keeper.go index d21dc455b62..51a310e7652 100644 --- a/modules/core/05-port/keeper/keeper.go +++ b/modules/core/05-port/keeper/keeper.go @@ -28,7 +28,7 @@ func NewKeeper(sck exported.ScopedKeeper) Keeper { // Logger returns a module-specific logger. func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+host.ModuleName+"/"+types.SubModuleName) + return ctx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } // IsBound checks a given port ID is already bounded. diff --git a/modules/core/24-host/keys.go b/modules/core/24-host/keys.go index 720bf6bb5f1..7db5683946a 100644 --- a/modules/core/24-host/keys.go +++ b/modules/core/24-host/keys.go @@ -6,20 +6,6 @@ import ( "github.com/cosmos/ibc-go/v6/modules/core/exported" ) -const ( - // ModuleName is the name of the IBC module - ModuleName = "ibc" - - // StoreKey is the string store representation - StoreKey string = ModuleName - - // QuerierRoute is the querier route for the IBC module - QuerierRoute string = ModuleName - - // RouterKey is the msg router key for the IBC module - RouterKey string = ModuleName -) - // KVStore key prefixes for IBC var ( KeyClientStorePrefix = []byte("clients") diff --git a/modules/core/client/cli/cli.go b/modules/core/client/cli/cli.go index 4c93974d7c3..423583eb5cf 100644 --- a/modules/core/client/cli/cli.go +++ b/modules/core/client/cli/cli.go @@ -7,13 +7,13 @@ import ( ibcclient "github.com/cosmos/ibc-go/v6/modules/core/02-client" connection "github.com/cosmos/ibc-go/v6/modules/core/03-connection" channel "github.com/cosmos/ibc-go/v6/modules/core/04-channel" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" ) // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { ibcTxCmd := &cobra.Command{ - Use: host.ModuleName, + Use: ibcexported.ModuleName, Short: "IBC transaction subcommands", DisableFlagParsing: true, SuggestionsMinimumDistance: 2, @@ -32,7 +32,7 @@ func GetTxCmd() *cobra.Command { func GetQueryCmd() *cobra.Command { // Group ibc queries under a subcommand ibcQueryCmd := &cobra.Command{ - Use: host.ModuleName, + Use: ibcexported.ModuleName, Short: "Querying commands for the IBC module", DisableFlagParsing: true, SuggestionsMinimumDistance: 2, diff --git a/modules/core/client/query.go b/modules/core/client/query.go index c14813b2160..cf4424d8ab4 100644 --- a/modules/core/client/query.go +++ b/modules/core/client/query.go @@ -9,7 +9,7 @@ import ( clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v6/modules/core/23-commitment/types" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" ) // QueryTendermintProof performs an ABCI query with the given key and returns @@ -39,7 +39,7 @@ func QueryTendermintProof(clientCtx client.Context, key []byte) ([]byte, []byte, } req := abci.RequestQuery{ - Path: fmt.Sprintf("store/%s/key", host.StoreKey), + Path: fmt.Sprintf("store/%s/key", ibcexported.StoreKey), Height: height, Data: key, Prove: true, diff --git a/modules/core/exported/module.go b/modules/core/exported/module.go new file mode 100644 index 00000000000..5af7d78b7a9 --- /dev/null +++ b/modules/core/exported/module.go @@ -0,0 +1,12 @@ +package exported + +const ( + // ModuleName is the name of the IBC module + ModuleName = "ibc" + // StoreKey is the string store representation + StoreKey = ModuleName + // QuerierRoute is the querier route for the IBC module + QuerierRoute = ModuleName + // RouterKey is the msg router key for the IBC module + RouterKey = ModuleName +) diff --git a/modules/core/keeper/keeper_test.go b/modules/core/keeper/keeper_test.go index c8114875b47..a14a2c897af 100644 --- a/modules/core/keeper/keeper_test.go +++ b/modules/core/keeper/keeper_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/suite" clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" - ibchost "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper" ibctesting "github.com/cosmos/ibc-go/v6/testing" ) @@ -65,8 +65,8 @@ func (suite *KeeperTestSuite) TestNewKeeper() { newIBCKeeper = func() { ibckeeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - suite.chainA.GetSimApp().GetKey(ibchost.StoreKey), - suite.chainA.GetSimApp().GetSubspace(ibchost.ModuleName), + suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey), + suite.chainA.GetSimApp().GetSubspace(ibcexported.ModuleName), stakingKeeper, upgradeKeeper, scopedKeeper, diff --git a/modules/core/migrations/v7/genesis.go b/modules/core/migrations/v7/genesis.go index 356589fd3d3..9af02fb0dfc 100644 --- a/modules/core/migrations/v7/genesis.go +++ b/modules/core/migrations/v7/genesis.go @@ -5,7 +5,7 @@ import ( genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" clientv7 "github.com/cosmos/ibc-go/v6/modules/core/02-client/migrations/v7" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" "github.com/cosmos/ibc-go/v6/modules/core/types" ) @@ -15,7 +15,7 @@ import ( // - Remove all solo machine consensus states // - Remove any localhost clients func MigrateGenesis(appState genutiltypes.AppMap, cdc codec.ProtoCodecMarshaler) (genutiltypes.AppMap, error) { - if appState[host.ModuleName] == nil { + if appState[ibcexported.ModuleName] == nil { return appState, nil } @@ -24,7 +24,7 @@ func MigrateGenesis(appState genutiltypes.AppMap, cdc codec.ProtoCodecMarshaler) // unmarshal old ibc genesis state ibcGenState := &types.GenesisState{} - cdc.MustUnmarshalJSON(appState[host.ModuleName], ibcGenState) + cdc.MustUnmarshalJSON(appState[ibcexported.ModuleName], ibcGenState) clientGenState, err := clientv7.MigrateGenesis(&ibcGenState.ClientGenesis, cdc) if err != nil { @@ -34,9 +34,9 @@ func MigrateGenesis(appState genutiltypes.AppMap, cdc codec.ProtoCodecMarshaler) ibcGenState.ClientGenesis = *clientGenState // delete old genesis state - delete(appState, host.ModuleName) + delete(appState, ibcexported.ModuleName) // set new ibc genesis state - appState[host.ModuleName] = cdc.MustMarshalJSON(ibcGenState) + appState[ibcexported.ModuleName] = cdc.MustMarshalJSON(ibcGenState) return appState, nil } diff --git a/modules/core/migrations/v7/genesis_test.go b/modules/core/migrations/v7/genesis_test.go index 82297d53cdf..7af4a955e0e 100644 --- a/modules/core/migrations/v7/genesis_test.go +++ b/modules/core/migrations/v7/genesis_test.go @@ -12,6 +12,7 @@ import ( clientv7 "github.com/cosmos/ibc-go/v6/modules/core/02-client/migrations/v7" clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" v7 "github.com/cosmos/ibc-go/v6/modules/core/migrations/v7" "github.com/cosmos/ibc-go/v6/modules/core/types" ibctesting "github.com/cosmos/ibc-go/v6/testing" @@ -128,7 +129,7 @@ func (suite *MigrationsV7TestSuite) TestMigrateGenesisSolomachine() { // migrate store get expected genesis // store migration and genesis migration should produce identical results // NOTE: tendermint clients are not pruned in genesis so the test should not have expired tendermint clients - err := clientv7.MigrateStore(suite.chainA.GetContext(), suite.chainA.GetSimApp().GetKey(host.StoreKey), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) + err := clientv7.MigrateStore(suite.chainA.GetContext(), suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) suite.Require().NoError(err) expectedClientGenState := ibcclient.ExportGenesis(suite.chainA.GetContext(), suite.chainA.App.GetIBCKeeper().ClientKeeper) @@ -142,7 +143,7 @@ func (suite *MigrationsV7TestSuite) TestMigrateGenesisSolomachine() { // ensure tests pass even if the legacy solo machine is already registered clientv7.RegisterInterfaces(cdc.InterfaceRegistry()) - appState[host.ModuleName] = cdc.MustMarshalJSON(ibcGenState) + appState[ibcexported.ModuleName] = cdc.MustMarshalJSON(ibcGenState) // NOTE: genesis time isn't updated since we aren't testing for tendermint consensus state pruning migrated, err := v7.MigrateGenesis(appState, cdc) @@ -154,7 +155,7 @@ func (suite *MigrationsV7TestSuite) TestMigrateGenesisSolomachine() { bz, err := cdc.MarshalJSON(expectedIBCGenState) suite.Require().NoError(err) - expectedAppState[host.ModuleName] = bz + expectedAppState[ibcexported.ModuleName] = bz suite.Require().Equal(expectedAppState, migrated) } diff --git a/modules/core/module.go b/modules/core/module.go index dceef4270e0..d9fc3ac6cea 100644 --- a/modules/core/module.go +++ b/modules/core/module.go @@ -21,8 +21,8 @@ import ( clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" "github.com/cosmos/ibc-go/v6/modules/core/client/cli" + "github.com/cosmos/ibc-go/v6/modules/core/exported" "github.com/cosmos/ibc-go/v6/modules/core/keeper" "github.com/cosmos/ibc-go/v6/modules/core/simulation" "github.com/cosmos/ibc-go/v6/modules/core/types" @@ -41,7 +41,7 @@ var _ module.AppModuleBasic = AppModuleBasic{} // Name returns the ibc module's name. func (AppModuleBasic) Name() string { - return host.ModuleName + return exported.ModuleName } // RegisterLegacyAminoCodec does nothing. IBC does not support amino. @@ -57,7 +57,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { var gs types.GenesisState if err := cdc.UnmarshalJSON(bz, &gs); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", host.ModuleName, err) + return fmt.Errorf("failed to unmarshal %s genesis state: %w", exported.ModuleName, err) } return gs.Validate() @@ -109,7 +109,7 @@ func NewAppModule(k *keeper.Keeper) AppModule { // Name returns the ibc module's name. func (AppModule) Name() string { - return host.ModuleName + return exported.ModuleName } // RegisterInvariants registers the ibc module invariants. @@ -124,7 +124,7 @@ func (am AppModule) Route() sdk.Route { // QuerierRoute returns the ibc module's querier route name. func (AppModule) QuerierRoute() string { - return host.QuerierRoute + return exported.QuerierRoute } // LegacyQuerierHandler returns nil. IBC does not support the legacy querier. @@ -140,7 +140,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryService(cfg.QueryServer(), am.keeper) m := clientkeeper.NewMigrator(am.keeper.ClientKeeper) - err := cfg.RegisterMigration(host.ModuleName, 2, m.Migrate2to3) + err := cfg.RegisterMigration(exported.ModuleName, 2, m.Migrate2to3) if err != nil { panic(err) } @@ -152,7 +152,7 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.Ra var gs types.GenesisState err := cdc.UnmarshalJSON(bz, &gs) if err != nil { - panic(fmt.Sprintf("failed to unmarshal %s genesis state: %s", host.ModuleName, err)) + panic(fmt.Sprintf("failed to unmarshal %s genesis state: %s", exported.ModuleName, err)) } InitGenesis(ctx, *am.keeper, &gs) return []abci.ValidatorUpdate{} @@ -197,7 +197,7 @@ func (AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { // RegisterStoreDecoder registers a decoder for ibc module's types func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { - sdr[host.StoreKey] = simulation.NewDecodeStore(*am.keeper) + sdr[exported.StoreKey] = simulation.NewDecodeStore(*am.keeper) } // WeightedOperations returns the all the ibc module operations with their respective weights. diff --git a/modules/core/simulation/decoder.go b/modules/core/simulation/decoder.go index 07e634991cd..5b03608e7dd 100644 --- a/modules/core/simulation/decoder.go +++ b/modules/core/simulation/decoder.go @@ -8,7 +8,7 @@ import ( clientsim "github.com/cosmos/ibc-go/v6/modules/core/02-client/simulation" connectionsim "github.com/cosmos/ibc-go/v6/modules/core/03-connection/simulation" channelsim "github.com/cosmos/ibc-go/v6/modules/core/04-channel/simulation" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" "github.com/cosmos/ibc-go/v6/modules/core/keeper" ) @@ -28,6 +28,6 @@ func NewDecodeStore(k keeper.Keeper) func(kvA, kvB kv.Pair) string { return res } - panic(fmt.Sprintf("invalid %s key prefix: %s", host.ModuleName, string(kvA.Key))) + panic(fmt.Sprintf("invalid %s key prefix: %s", ibcexported.ModuleName, string(kvA.Key))) } } diff --git a/modules/core/simulation/genesis.go b/modules/core/simulation/genesis.go index c914d70e19b..b8abd1a6f60 100644 --- a/modules/core/simulation/genesis.go +++ b/modules/core/simulation/genesis.go @@ -15,7 +15,7 @@ import ( connectiontypes "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types" channelsims "github.com/cosmos/ibc-go/v6/modules/core/04-channel/simulation" channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" "github.com/cosmos/ibc-go/v6/modules/core/types" ) @@ -59,6 +59,6 @@ func RandomizedGenState(simState *module.SimulationState) { if err != nil { panic(err) } - fmt.Printf("Selected randomly generated %s parameters:\n%s\n", host.ModuleName, bz) - simState.GenState[host.ModuleName] = simState.Cdc.MustMarshalJSON(&ibcGenesis) + fmt.Printf("Selected randomly generated %s parameters:\n%s\n", ibcexported.ModuleName, bz) + simState.GenState[ibcexported.ModuleName] = simState.Cdc.MustMarshalJSON(&ibcGenesis) } diff --git a/modules/core/simulation/genesis_test.go b/modules/core/simulation/genesis_test.go index aac5a163342..b8a931f1f31 100644 --- a/modules/core/simulation/genesis_test.go +++ b/modules/core/simulation/genesis_test.go @@ -13,7 +13,7 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/stretchr/testify/require" - host "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" "github.com/cosmos/ibc-go/v6/modules/core/simulation" "github.com/cosmos/ibc-go/v6/modules/core/types" ) @@ -44,7 +44,7 @@ func TestRandomizedGenState(t *testing.T) { simulation.RandomizedGenState(&simState) var ibcGenesis types.GenesisState - simState.Cdc.MustUnmarshalJSON(simState.GenState[host.ModuleName], &ibcGenesis) + simState.Cdc.MustUnmarshalJSON(simState.GenState[ibcexported.ModuleName], &ibcGenesis) require.NotNil(t, ibcGenesis.ClientGenesis) require.NotNil(t, ibcGenesis.ConnectionGenesis) diff --git a/testing/chain.go b/testing/chain.go index 46b430968f2..1e9b9585331 100644 --- a/testing/chain.go +++ b/testing/chain.go @@ -205,7 +205,7 @@ func (chain *TestChain) QueryProof(key []byte) ([]byte, clienttypes.Height) { // for the query and the height at which the proof will succeed on a tendermint verifier. Only the IBC // store is supported func (chain *TestChain) QueryProofAtHeight(key []byte, height int64) ([]byte, clienttypes.Height) { - return chain.QueryProofForStore(host.StoreKey, key, height) + return chain.QueryProofForStore(exported.StoreKey, key, height) } // QueryProofForStore performs an abci query with the given key and returns the proto encoded merkle proof diff --git a/testing/simapp/app.go b/testing/simapp/app.go index b1f5379a02f..944e920e3de 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -107,7 +107,7 @@ import ( ibcclientclient "github.com/cosmos/ibc-go/v6/modules/core/02-client/client" ibcclienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types" - ibchost "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" 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" @@ -278,7 +278,7 @@ func NewSimApp( keys := sdk.NewKVStoreKeys( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, - govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, + govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, authzkeeper.StoreKey, ibcfeetypes.StoreKey, ) @@ -303,7 +303,7 @@ func NewSimApp( // add capability keeper and ScopeToModule for ibc module app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName) + scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) @@ -358,7 +358,7 @@ func NewSimApp( // IBC Keepers app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, + appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, ) // register the proposal types @@ -559,12 +559,12 @@ func NewSimApp( // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) app.mm.SetOrderBeginBlockers( upgradetypes.ModuleName, capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, - evidencetypes.ModuleName, stakingtypes.ModuleName, ibchost.ModuleName, ibctransfertypes.ModuleName, authtypes.ModuleName, + evidencetypes.ModuleName, stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, govtypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, authz.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, vestingtypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, group.ModuleName, ) app.mm.SetOrderEndBlockers( - crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, ibchost.ModuleName, ibctransfertypes.ModuleName, + crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, minttypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, group.ModuleName, @@ -578,7 +578,7 @@ func NewSimApp( app.mm.SetOrderInitGenesis( capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, - ibchost.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, ibctransfertypes.ModuleName, + ibcexported.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, ibctransfertypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, group.ModuleName, ) @@ -863,7 +863,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) paramsKeeper.Subspace(crisistypes.ModuleName) paramsKeeper.Subspace(ibctransfertypes.ModuleName) - paramsKeeper.Subspace(ibchost.ModuleName) + paramsKeeper.Subspace(ibcexported.ModuleName) paramsKeeper.Subspace(icacontrollertypes.SubModuleName) paramsKeeper.Subspace(icahosttypes.SubModuleName) diff --git a/testing/simapp/sim_test.go b/testing/simapp/sim_test.go index b65324dabb9..c9e05b174ea 100644 --- a/testing/simapp/sim_test.go +++ b/testing/simapp/sim_test.go @@ -31,7 +31,7 @@ import ( dbm "github.com/tendermint/tm-db" ibctransfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" - ibchost "github.com/cosmos/ibc-go/v6/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" "github.com/cosmos/ibc-go/v6/testing/simapp/helpers" ) @@ -179,7 +179,7 @@ func TestAppImportExport(t *testing.T) { {app.keys[govtypes.StoreKey], newApp.keys[govtypes.StoreKey], [][]byte{}}, {app.keys[evidencetypes.StoreKey], newApp.keys[evidencetypes.StoreKey], [][]byte{}}, {app.keys[capabilitytypes.StoreKey], newApp.keys[capabilitytypes.StoreKey], [][]byte{}}, - {app.keys[ibchost.StoreKey], newApp.keys[ibchost.StoreKey], [][]byte{}}, + {app.keys[ibcexported.StoreKey], newApp.keys[ibcexported.StoreKey], [][]byte{}}, {app.keys[ibctransfertypes.StoreKey], newApp.keys[ibctransfertypes.StoreKey], [][]byte{}}, {app.keys[authzkeeper.StoreKey], newApp.keys[authzkeeper.StoreKey], [][]byte{}}, }