From 8e67a5d23b9784363eb41e1920ba42b945e2abbb Mon Sep 17 00:00:00 2001 From: dauTT Date: Fri, 31 Jul 2020 20:18:05 +0200 Subject: [PATCH] Allow empty version strings (#6904) * Allow empty version strings * Restore empty version.Identifier check * Fix test Co-authored-by: colin axner <25233464+colin-axner@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- go.sum | 2 -- x/ibc/04-channel/types/channel.go | 5 ----- x/ibc/04-channel/types/msgs_test.go | 4 ++-- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/go.sum b/go.sum index 6bcabd5a72..f7a9295981 100644 --- a/go.sum +++ b/go.sum @@ -725,8 +725,6 @@ google.golang.org/grpc v1.28.0 h1:bO/TA4OxCOummhSf10siHuG7vJOiwh7SpRpFZDkOgl4= google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.28.1 h1:C1QC6KzgSiLyBabDi87BbjaGreoRgGUF5nOyvfrAZ1k= google.golang.org/grpc v1.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.30.0 h1:M5a8xTlYTxwMn5ZFkwhRabsygDY5G8TYLyQDBxJNAxE= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0 h1:T7P4R73V3SSDPhH7WW7ATbfViLtmamH0DKrP3f9AuDI= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/x/ibc/04-channel/types/channel.go b/x/ibc/04-channel/types/channel.go index b4b7228b0b..8bfc8581ae 100644 --- a/x/ibc/04-channel/types/channel.go +++ b/x/ibc/04-channel/types/channel.go @@ -1,8 +1,6 @@ package types import ( - "strings" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported" host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" @@ -69,9 +67,6 @@ func (ch Channel) ValidateBasic() error { if err := host.ConnectionIdentifierValidator(ch.ConnectionHops[0]); err != nil { return sdkerrors.Wrap(err, "invalid connection hop ID") } - if strings.TrimSpace(ch.Version) == "" { - return sdkerrors.Wrap(sdkerrors.ErrInvalidVersion, "channel version can't be blank") - } return ch.Counterparty.ValidateBasic() } diff --git a/x/ibc/04-channel/types/msgs_test.go b/x/ibc/04-channel/types/msgs_test.go index 341df45624..2244e8f7db 100644 --- a/x/ibc/04-channel/types/msgs_test.go +++ b/x/ibc/04-channel/types/msgs_test.go @@ -138,7 +138,7 @@ func (suite *MsgTestSuite) TestMsgChannelOpenInit() { {testMsgs[9], false, "too short connection id"}, {testMsgs[10], false, "too long connection id"}, {testMsgs[11], false, "connection id contains non-alpha"}, - {testMsgs[12], false, "empty channel version"}, + {testMsgs[12], true, ""}, {testMsgs[13], false, "invalid counterparty port id"}, {testMsgs[14], false, "invalid counterparty channel id"}, } @@ -195,7 +195,7 @@ func (suite *MsgTestSuite) TestMsgChannelOpenTry() { {testMsgs[11], false, "too short connection id"}, {testMsgs[12], false, "too long connection id"}, {testMsgs[13], false, "connection id contains non-alpha"}, - {testMsgs[14], false, "empty channel version"}, + {testMsgs[14], true, "empty channel version"}, {testMsgs[15], false, "invalid counterparty port id"}, {testMsgs[16], false, "invalid counterparty channel id"}, {testMsgs[17], false, "empty proof"},