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>
This commit is contained in:
dauTT 2020-07-31 20:18:05 +02:00 committed by GitHub
parent 9a3fd7cac5
commit 8e67a5d23b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 9 deletions

2
go.sum
View File

@ -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=

View File

@ -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()
}

View File

@ -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"},