Skip to content

Commit

Permalink
gRPC gateway issue with colons in the account url path (#8649)
Browse files Browse the repository at this point in the history
* add allow_colon_final_segments flag

* add test

* Update x/auth/client/rest/rest_test.go

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Feb 22, 2021
1 parent 7b52767 commit 81cc5c1
Show file tree
Hide file tree
Showing 21 changed files with 107 additions and 95 deletions.
4 changes: 2 additions & 2 deletions client/grpc/reflection/reflection.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions client/grpc/tmservice/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/protocgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ for dir in $proto_dirs; do
-I "third_party/proto" \
--gocosmos_out=plugins=interfacetype+grpc,\
Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \
--grpc-gateway_out=logtostderr=true:. \
--grpc-gateway_out=logtostderr=true,allow_colon_final_segments=true:. \
$(find "${dir}" -maxdepth 1 -name '*.proto')

done
Expand Down
8 changes: 4 additions & 4 deletions types/tx/service.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions x/auth/client/rest/rest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@ func (s *IntegrationTestSuite) TestEncodeDecode() {
require.Equal(stdTx, legacytx.StdTx(decodeResp))
}

func (s *IntegrationTestSuite) TestQueryAccountWithColon() {
val := s.network.Validators[0]
// This address is not a valid simapp address! It is only used to test that addresses with
// colon don't 501. See
// https://github.com/cosmos/cosmos-sdk/issues/8650
addrWithColon := "cosmos:1m4f6lwd9eh8e5nxt0h00d46d3fr03apfh8qf4g"

res, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/auth/v1beta1/accounts/%s", val.APIAddress, addrWithColon))
s.Require().NoError(err)
s.Require().Contains(string(res), "decoding bech32 failed")
}

func (s *IntegrationTestSuite) TestEncodeIBCTx() {
val := s.network.Validators[0]

Expand Down
4 changes: 2 additions & 2 deletions x/auth/types/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions x/authz/types/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions x/bank/types/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions x/distribution/types/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions x/evidence/types/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions x/feegrant/types/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 81cc5c1

Please sign in to comment.