From e00e645760546d126863f29e97901a6e8081f17f Mon Sep 17 00:00:00 2001 From: Riccardo Montagnin Date: Thu, 15 Jul 2021 12:27:22 +0200 Subject: [PATCH 1/2] Version 0.17.3 Signed-off-by: Riccardo Montagnin --- CHANGELOG.md | 3 ++ testutil/ibctesting/chain.go | 39 +++++-------------- testutil/ibctesting/coordinator.go | 6 ++- x/profiles/client/cli/cli_relationships.go | 4 +- x/profiles/keeper/relay_app_links_test.go | 10 ++++- x/profiles/module.go | 4 +- x/profiles/module_ibc.go | 10 ----- .../simulation/operations_user_blocks.go | 6 +-- x/profiles/types/keys.go | 16 +------- 9 files changed, 32 insertions(+), 66 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41e4a6da90..7d43cf957d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). --> # Changelog +## Version 0.17.3 +* Removed the version check when creating an IBC channel + ## Version 0.17.2 - Renamed x/profiles messages response Proto definitions to match others diff --git a/testutil/ibctesting/chain.go b/testutil/ibctesting/chain.go index f38e0e946f..0c858854a2 100644 --- a/testutil/ibctesting/chain.go +++ b/testutil/ibctesting/chain.go @@ -42,39 +42,18 @@ import ( ) const ( - // Default params constants used to create a TM client - TrustingPeriod time.Duration = time.Hour * 24 * 7 * 2 - UnbondingPeriod time.Duration = time.Hour * 24 * 7 * 3 - MaxClockDrift time.Duration = time.Second * 10 - DefaultDelayPeriod uint64 = 0 + TrustingPeriod = time.Hour * 24 * 7 * 2 + UnbondingPeriod = time.Hour * 24 * 7 * 3 + MaxClockDrift = time.Second * 10 - DefaultChannelVersion = profilestypes.IBCVersion - InvalidID = "IDisInvalid" - - ConnectionIDPrefix = "conn" - ChannelIDPrefix = "chan" - - IBCProfilesPort = profilestypes.IBCPortID - MockPort = "mock" - - // used for testing UpdateClientProposal - Title = "title" - Description = "description" + DefaultDelayPeriod uint64 = 0 ) var ( DefaultOpenInitVersion *connectiontypes.Version - - // Default params variables used to create a TM client - DefaultTrustLevel ibctmtypes.Fraction = ibctmtypes.DefaultTrustLevel - TestHash = tmhash.Sum([]byte("TESTING HASH")) - - UpgradePath = []string{"upgrade", "upgradedIBCState"} - - ConnectionVersion = connectiontypes.ExportedVersionsToProto(connectiontypes.GetCompatibleVersions())[0] - - MockAcknowledgement = mock.MockAcknowledgement - MockCommitment = mock.MockCommitment + DefaultTrustLevel = ibctmtypes.DefaultTrustLevel + UpgradePath = []string{"upgrade", "upgradedIBCState"} + ConnectionVersion = connectiontypes.ExportedVersionsToProto(connectiontypes.GetCompatibleVersions())[0] ) // TestChain is a testing struct that wraps a simapp with the last TM Header, the current ABCI @@ -390,7 +369,7 @@ func (chain *TestChain) ConstructNextTestConnection(clientID, counterpartyClient return &TestConnection{ ID: connectionID, ClientID: clientID, - NextChannelVersion: DefaultChannelVersion, + NextChannelVersion: "ics-20", CounterpartyClientID: counterpartyClientID, } } @@ -717,7 +696,7 @@ func (chain *TestChain) CreatePortCapability(portID string) { require.NoError(chain.t, err) switch portID { - case IBCProfilesPort: + case profilestypes.IBCPortID: // claim capability using the ibcporfiles capability keeper err = chain.App.ScopedProfilesKeeper.ClaimCapability(chain.GetContext(), cap, host.PortPath(portID)) require.NoError(chain.t, err) diff --git a/testutil/ibctesting/coordinator.go b/testutil/ibctesting/coordinator.go index 5ccf733531..84c3065316 100644 --- a/testutil/ibctesting/coordinator.go +++ b/testutil/ibctesting/coordinator.go @@ -6,6 +6,8 @@ import ( "testing" "time" + profilestypes "github.com/desmos-labs/desmos/x/profiles/types" + "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" @@ -148,7 +150,7 @@ func (coord *Coordinator) CreateConnection( return connA, connB } -// CreateTransferChannels constructs and executes channel handshake messages to create OPEN +// CreateIBCProfilesChannels constructs and executes channel handshake messages to create OPEN // ibc-profiles channel to profiles channel on chainA and chainB. The function expects the channels to be // successfully opened otherwise testing will fail. func (coord *Coordinator) CreateIBCProfilesChannels( @@ -156,7 +158,7 @@ func (coord *Coordinator) CreateIBCProfilesChannels( connA, connB *TestConnection, order channeltypes.Order, ) (TestChannel, TestChannel) { - return coord.CreateChannel(chainA, chainB, connA, connB, IBCProfilesPort, IBCProfilesPort, order) + return coord.CreateChannel(chainA, chainB, connA, connB, profilestypes.IBCPortID, profilestypes.IBCPortID, order) } // CreateChannel constructs and executes channel handshake messages in order to create diff --git a/x/profiles/client/cli/cli_relationships.go b/x/profiles/client/cli/cli_relationships.go index d4eced6f78..bfdf2d06ec 100644 --- a/x/profiles/client/cli/cli_relationships.go +++ b/x/profiles/client/cli/cli_relationships.go @@ -160,7 +160,7 @@ func GetCmdQueryUserRelationships() *cobra.Command { } flags.AddQueryFlagsToCmd(cmd) - flags.AddPaginationFlagsToCmd(cmd, types.QueryUserRelationships) + flags.AddPaginationFlagsToCmd(cmd, "user relationships") return cmd } @@ -201,7 +201,7 @@ func GetCmdQueryUserBlocks() *cobra.Command { } flags.AddQueryFlagsToCmd(cmd) - flags.AddPaginationFlagsToCmd(cmd, types.QueryUserBlocks) + flags.AddPaginationFlagsToCmd(cmd, "user blocks") return cmd } diff --git a/x/profiles/keeper/relay_app_links_test.go b/x/profiles/keeper/relay_app_links_test.go index df8be3c917..83933b60c8 100644 --- a/x/profiles/keeper/relay_app_links_test.go +++ b/x/profiles/keeper/relay_app_links_test.go @@ -82,7 +82,7 @@ func (suite *KeeperTestSuite) TestKeeper_StartProfileConnection() { // channel references wrong ID _, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint) channelA, _ = suite.coordinator.CreateIBCProfilesChannels(suite.chainA, suite.chainB, connA, connB, channeltypes.UNORDERED) - channelA.ID = ibctesting.InvalidID + channelA.ID = "IDisInvalid" }, expPass: false, }, @@ -97,7 +97,13 @@ func (suite *KeeperTestSuite) TestKeeper_StartProfileConnection() { suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel( suite.chainA.GetContext(), channelA.PortID, channelA.ID, - channeltypes.NewChannel(channeltypes.OPEN, channeltypes.ORDERED, channeltypes.NewCounterparty(channelB.PortID, channelB.ID), []string{connA.ID}, ibctesting.DefaultChannelVersion), + channeltypes.NewChannel( + channeltypes.OPEN, + channeltypes.ORDERED, + channeltypes.NewCounterparty(channelB.PortID, channelB.ID), + []string{connA.ID}, + "ics-20", + ), ) suite.chainA.CreateChannelCapability(channelA.PortID, channelA.ID) }, diff --git a/x/profiles/module.go b/x/profiles/module.go index ddc738dd50..2098cfb79d 100644 --- a/x/profiles/module.go +++ b/x/profiles/module.go @@ -135,10 +135,10 @@ func (am AppModule) NewHandler() sdk.Handler { // QuerierRoute returns the profiles module's querier route name. func (am AppModule) QuerierRoute() string { - return types.QuerierRoute + return types.RouterKey } -// NewQuerierHandler returns the profiles module sdk.Querier. +// LegacyQuerierHandler returns the profiles module sdk.Querier. func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { return nil } diff --git a/x/profiles/module_ibc.go b/x/profiles/module_ibc.go index bc3d8d73f9..bdeac2e5a1 100644 --- a/x/profiles/module_ibc.go +++ b/x/profiles/module_ibc.go @@ -51,9 +51,6 @@ func ValidateProfilesChannelParams( return sdkerrors.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) } - if version != types.IBCVersion { - return sdkerrors.Wrapf(types.ErrInvalidVersion, "got %s, expected %s", version, types.IBCVersion) - } return nil } @@ -99,10 +96,6 @@ func (am AppModule) OnChanOpenTry( return err } - if counterpartyVersion != types.IBCVersion { - return sdkerrors.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: got: %s, expected %s", counterpartyVersion, types.IBCVersion) - } - // Module may have already claimed capability in OnChanOpenInit in the case of crossing hellos // (ie chainA and chainB both call ChanOpenInit before one of them calls ChanOpenTry) // If module can already authenticate the capability then module already owns it so we don't need to claim @@ -124,9 +117,6 @@ func (am AppModule) OnChanOpenAck( channelID string, counterpartyVersion string, ) error { - if counterpartyVersion != types.IBCVersion { - return sdkerrors.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: %s, expected %s", counterpartyVersion, types.IBCVersion) - } return nil } diff --git a/x/profiles/simulation/operations_user_blocks.go b/x/profiles/simulation/operations_user_blocks.go index 7a9fc9013c..980e7d7cad 100644 --- a/x/profiles/simulation/operations_user_blocks.go +++ b/x/profiles/simulation/operations_user_blocks.go @@ -40,7 +40,7 @@ func SimulateMsgBlockUser( ) err = simtesting.SendMsg(r, app, ak, bk, msg, ctx, chainID, DefaultGasValue, []cryptotypes.PrivKey{acc.PrivKey}) if err != nil { - return simtypes.NoOpMsg(types.QuerierRoute, types.ModuleName, ""), nil, err + return simtypes.NoOpMsg(types.RouterKey, types.ModuleName, ""), nil, err } return simtypes.NewOperationMsg(msg, true, ""), nil, nil @@ -92,7 +92,7 @@ func SimulateMsgUnblockUser( acc, userBlock, skip := randomUnblockUserFields(r, ctx, accs, k) if skip { - return simtypes.NoOpMsg(types.QuerierRoute, types.ModuleName, ""), nil, nil + return simtypes.NoOpMsg(types.RouterKey, types.ModuleName, ""), nil, nil } msg := types.NewMsgUnblockUser( @@ -102,7 +102,7 @@ func SimulateMsgUnblockUser( ) err = simtesting.SendMsg(r, app, ak, bk, msg, ctx, chainID, DefaultGasValue, []cryptotypes.PrivKey{acc.PrivKey}) if err != nil { - return simtypes.NoOpMsg(types.QuerierRoute, types.ModuleName, ""), nil, err + return simtypes.NoOpMsg(types.RouterKey, types.ModuleName, ""), nil, err } return simtypes.NewOperationMsg(msg, true, ""), nil, nil diff --git a/x/profiles/types/keys.go b/x/profiles/types/keys.go index ddfb495945..e8413dd824 100644 --- a/x/profiles/types/keys.go +++ b/x/profiles/types/keys.go @@ -9,8 +9,6 @@ const ( RouterKey = ModuleName StoreKey = ModuleName - DesmosChainName = "desmos" - ActionSaveProfile = "save_profile" ActionDeleteProfile = "delete_profile" ActionRequestDTag = "request_dtag_transfer" @@ -26,21 +24,9 @@ const ( ActionLinkApplication = "link_application" ActionUnlinkApplication = "unlink_application" - QuerierRoute = ModuleName - QueryProfile = "profile" - QueryIncomingDTagRequests = "incoming-dtag-requests" - QueryUserRelationships = "user_relationships" - QueryRelationships = "relationships" - QueryUserBlocks = "user_blocks" - QueryParams = "params" - DoNotModify = "[do-not-modify]" - // IBCVersion represents the version of the IBC specification to be used. - // Currently we use ICS20-1 because we need to communicate with Band which uses the same version. - // TODO: Explore if it's possible to support multiple specifications at once, and see if we should create our own one. - IBCVersion = "ics20-1" - IBCPortID = "ibc-profiles" + IBCPortID = "ibc-profiles" ) var ( From 3bf6d9cedd3ce00eb8333ce09f3394ffc3a4a5ed Mon Sep 17 00:00:00 2001 From: Riccardo Montagnin Date: Wed, 21 Jul 2021 18:07:58 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d43cf957d..92ff21b4d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). # Changelog ## Version 0.17.3 -* Removed the version check when creating an IBC channel +- Removed the version check when creating an IBC channel ## Version 0.17.2 - Renamed x/profiles messages response Proto definitions to match others