Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version v0.17.3 #564

Merged
merged 3 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 95 additions & 92 deletions CHANGELOG.md

Large diffs are not rendered by default.

39 changes: 9 additions & 30 deletions testutil/ibctesting/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -390,7 +369,7 @@ func (chain *TestChain) ConstructNextTestConnection(clientID, counterpartyClient
return &TestConnection{
ID: connectionID,
ClientID: clientID,
NextChannelVersion: DefaultChannelVersion,
NextChannelVersion: "ics-20",
CounterpartyClientID: counterpartyClientID,
}
}
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions testutil/ibctesting/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -148,15 +150,15 @@ 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(
chainA, chainB *TestChain,
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
Expand Down
4 changes: 2 additions & 2 deletions x/profiles/client/cli/cli_relationships.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func GetCmdQueryUserRelationships() *cobra.Command {
}

flags.AddQueryFlagsToCmd(cmd)
flags.AddPaginationFlagsToCmd(cmd, types.QueryUserRelationships)
flags.AddPaginationFlagsToCmd(cmd, "user relationships")

return cmd
}
Expand Down Expand Up @@ -201,7 +201,7 @@ func GetCmdQueryUserBlocks() *cobra.Command {
}

flags.AddQueryFlagsToCmd(cmd)
flags.AddPaginationFlagsToCmd(cmd, types.QueryUserBlocks)
flags.AddPaginationFlagsToCmd(cmd, "user blocks")

return cmd
}
10 changes: 8 additions & 2 deletions x/profiles/keeper/relay_app_links_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand All @@ -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)
},
Expand Down
4 changes: 2 additions & 2 deletions x/profiles/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 0 additions & 10 deletions x/profiles/module_ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand All @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions x/profiles/simulation/operations_user_blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -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
Expand Down
16 changes: 1 addition & 15 deletions x/profiles/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ const (
RouterKey = ModuleName
StoreKey = ModuleName

DesmosChainName = "desmos"

ActionSaveProfile = "save_profile"
ActionDeleteProfile = "delete_profile"
ActionRequestDTag = "request_dtag_transfer"
Expand All @@ -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 (
Expand Down