cosmos / cosmos-sdk

:chains: A Framework for Building High Value Public Blockchains :sparkles:
https://cosmos.network/
Apache License 2.0
6.23k stars 3.6k forks source link

proto-gen command DOES NOT working in v0.41.2 #8837

Closed readygo586 closed 3 years ago

readygo586 commented 3 years ago

when run make proto-gen command in v0.41.2, the following error happens. This error also happens in latest master branch.


Generating Protobuf files /usr/local/bin/docker run --rm -v /Users/rogan/go/src/github.com/cosmos/cosmos-sdk:/workspace --workdir /workspace tendermintdev/sdk-proto-gen:v0.1 sh ./scripts/protocgen.sh make: *** [proto-gen] Error 1


I check #8361, its modification is included in v0.41.2 and master branch. my go version is go1.15.3 darwin/amd64 Anyone can help check this problem?

alessio commented 3 years ago

I can't reproduce this on master:

alessio@phoenix:~/work/cosmos-sdk$ make proto-gen
Generating Protobuf files
/usr/bin/docker run --rm -v /home/alessio/work/cosmos-sdk:/workspace --workdir /workspace tendermintdev/sdk-proto-gen:v0.1 sh ./scripts/protocgen.sh
Unable to find image 'tendermintdev/sdk-proto-gen:v0.1' locally
v0.1: Pulling from tendermintdev/sdk-proto-gen
ba3557a56b15: Pull complete 
34a078c6c131: Pull complete 
e78f90fd1d94: Pull complete 
efdc4f024afd: Pull complete 
74b7f786c072: Pull complete 
e056034dfc96: Pull complete 
9c8b2c21c4ca: Pull complete 
ab2da8730ae7: Pull complete 
Digest: sha256:372dce7be2f465123e26459973ca798fc489ff2c75aeecd814c0ca8ced24faca
Status: Downloaded newer image for tendermintdev/sdk-proto-gen:v0.1
W0310 10:19:02.298889     606 services.go:38] No HttpRule found for method: Msg.GrantAuthorization
W0310 10:19:02.298923     606 services.go:38] No HttpRule found for method: Msg.ExecAuthorized
W0310 10:19:02.298926     606 services.go:38] No HttpRule found for method: Msg.RevokeAuthorization
W0310 10:19:02.413808     655 services.go:38] No HttpRule found for method: Msg.Send
W0310 10:19:02.413832     655 services.go:38] No HttpRule found for method: Msg.MultiSend
W0310 10:19:02.959027    1002 services.go:38] No HttpRule found for method: Msg.VerifyInvariant
W0310 10:19:03.337398    1214 services.go:38] No HttpRule found for method: Msg.SetWithdrawAddress
W0310 10:19:03.337432    1214 services.go:38] No HttpRule found for method: Msg.WithdrawDelegatorReward
W0310 10:19:03.337438    1214 services.go:38] No HttpRule found for method: Msg.WithdrawValidatorCommission
W0310 10:19:03.337443    1214 services.go:38] No HttpRule found for method: Msg.FundCommunityPool
W0310 10:19:03.429627    1258 services.go:38] No HttpRule found for method: Msg.SubmitEvidence
W0310 10:19:03.516770    1299 services.go:38] No HttpRule found for method: Msg.GrantFeeAllowance
W0310 10:19:03.516802    1299 services.go:38] No HttpRule found for method: Msg.RevokeFeeAllowance
W0310 10:19:03.692630    1375 services.go:38] No HttpRule found for method: Msg.SubmitProposal
W0310 10:19:03.692655    1375 services.go:38] No HttpRule found for method: Msg.Vote
W0310 10:19:03.692659    1375 services.go:38] No HttpRule found for method: Msg.VoteWeighted
W0310 10:19:03.692662    1375 services.go:38] No HttpRule found for method: Msg.Deposit
W0310 10:19:03.889157    1505 services.go:38] No HttpRule found for method: Msg.Unjail
W0310 10:19:04.130504    1552 services.go:38] No HttpRule found for method: Msg.CreateValidator
W0310 10:19:04.130525    1552 services.go:38] No HttpRule found for method: Msg.EditValidator
W0310 10:19:04.130528    1552 services.go:38] No HttpRule found for method: Msg.Delegate
W0310 10:19:04.130531    1552 services.go:38] No HttpRule found for method: Msg.BeginRedelegate
W0310 10:19:04.130534    1552 services.go:38] No HttpRule found for method: Msg.Undelegate
W0310 10:19:04.428403    1734 services.go:38] No HttpRule found for method: Msg.CreateVestingAccount
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/stretchr/testify v1.7.0
go: downloading github.com/spf13/cobra v1.1.3
go: downloading github.com/rakyll/statik v0.1.7
go: downloading github.com/bgentry/speakeasy v0.1.0
go: downloading github.com/grpc-ecosystem/grpc-gateway v1.16.0
go: downloading github.com/mattn/go-isatty v0.0.12
go: downloading github.com/gorilla/mux v1.8.0
go: downloading github.com/tendermint/tendermint v0.34.8
go: downloading google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f
go: downloading google.golang.org/grpc v1.33.2
go: downloading github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87
go: downloading github.com/cosmos/go-bip39 v1.0.0
go: downloading github.com/grpc-ecosystem/go-grpc-middleware v1.2.2
go: downloading github.com/tendermint/go-amino v0.16.0
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/99designs/keyring v1.1.6
go: downloading github.com/btcsuite/btcd v0.21.0-beta
go: downloading golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
go: downloading github.com/cosmos/ledger-cosmos-go v0.11.1
go: downloading github.com/btcsuite/btcutil v1.0.2
go: downloading github.com/tendermint/tm-db v0.6.4
go: downloading github.com/tendermint/btcd v0.1.1
go: downloading github.com/magiconair/properties v1.8.4
go: downloading github.com/otiai10/copy v1.5.0
go: downloading github.com/spf13/viper v1.7.1
go: downloading github.com/gogo/gateway v1.1.0
go: downloading github.com/improbable-eng/grpc-web v0.14.0
go: downloading github.com/gorilla/handlers v1.5.1
go: downloading github.com/rs/zerolog v1.20.0
go: downloading github.com/hashicorp/golang-lru v0.5.4
go: downloading github.com/spf13/cast v1.3.1
go: downloading github.com/golang/mock v1.4.4
go: downloading github.com/cosmos/iavl v0.15.3
go: downloading github.com/coinbase/rosetta-sdk-go v0.5.9
go: downloading github.com/tendermint/cosmos-rosetta-gateway v0.3.0-rc2
go: downloading github.com/confio/ics23/go v0.6.3
go: downloading github.com/armon/go-metrics v0.3.6
go: downloading github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25
go: downloading github.com/prometheus/client_golang v1.9.0
go: downloading github.com/prometheus/common v0.18.0
go: downloading github.com/google/go-cmp v0.5.2
go: downloading golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e
go: downloading github.com/inconshreveable/mousetrap v1.0.0
go: downloading golang.org/x/net v0.0.0-20201021035429-f5854403a974
go: downloading filippo.io/edwards25519 v1.0.0-beta.2
go: downloading github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d
go: downloading github.com/go-kit/kit v0.10.0
go: downloading github.com/fortytw2/leaktest v1.3.0
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
go: downloading github.com/go-logfmt/logfmt v0.5.0
go: downloading gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b
go: downloading github.com/gorilla/websocket v1.4.2
go: downloading github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa
go: downloading github.com/dgraph-io/badger/v2 v2.2007.2
go: downloading github.com/google/btree v1.0.0
go: downloading github.com/jmhodges/levigo v1.0.0
go: downloading github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca
go: downloading github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c
go: downloading go.etcd.io/bbolt v1.3.5
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading github.com/mitchellh/mapstructure v1.3.3
go: downloading github.com/pelletier/go-toml v1.8.1
go: downloading github.com/spf13/afero v1.3.4
go: downloading github.com/spf13/jwalterweatherman v1.1.0
go: downloading github.com/subosito/gotenv v1.2.0
go: downloading gopkg.in/ini.v1 v1.61.0
go: downloading github.com/felixge/httpsnoop v1.0.1
go: downloading github.com/cosmos/ledger-go v0.9.2
go: downloading github.com/danieljoos/wincred v1.0.2
go: downloading github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b
go: downloading github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2
go: downloading github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c
go: downloading github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d
go: downloading github.com/mitchellh/go-homedir v1.1.0
go: downloading github.com/mtibben/percent v0.2.1
go: downloading github.com/otiai10/mint v1.3.2
go: downloading github.com/rs/cors v1.7.0
go: downloading github.com/prometheus/client_model v0.2.0
go: downloading github.com/hashicorp/go-immutable-radix v1.0.0
go: downloading github.com/pascaldekloe/goe v0.1.0
go: downloading github.com/gtank/merlin v0.1.1
go: downloading github.com/gtank/ristretto255 v0.1.2
go: downloading github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa
go: downloading github.com/libp2p/go-buffer-pool v0.0.2
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash v1.1.0
go: downloading github.com/prometheus/procfs v0.2.0
go: downloading github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e
go: downloading github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f
go: downloading nhooyr.io/websocket v1.8.6
go: downloading github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
go: downloading github.com/go-stack/stack v1.8.0
go: downloading github.com/onsi/ginkgo v1.14.0
go: downloading github.com/onsi/gomega v1.10.1
go: downloading github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51
go: downloading github.com/dgraph-io/ristretto v0.0.3
go: downloading github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13
go: downloading github.com/dustin/go-humanize v1.0.0
go: downloading github.com/cespare/xxhash/v2 v2.1.1
go: downloading golang.org/x/term v0.0.0-20201117132131-f5c789dd3221
go: downloading golang.org/x/text v0.3.3
go: downloading github.com/Workiva/go-datastructures v1.0.52
go: downloading github.com/minio/highwayhash v1.0.1
go: downloading github.com/stretchr/objx v0.2.0
go: downloading github.com/zondax/hid v0.9.0
go: downloading github.com/smartystreets/goconvey v1.6.4
go: downloading github.com/otiai10/curr v1.0.0
go: downloading github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643
go: downloading github.com/hashicorp/go-uuid v1.0.1
go: downloading github.com/VividCortex/gohistogram v1.0.0
go: downloading github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5
go: downloading github.com/golang/snappy v0.0.2
go: downloading github.com/DataDog/zstd v1.4.5
go: downloading github.com/klauspost/compress v1.10.3
go: downloading github.com/gin-gonic/gin v1.6.3
go: downloading github.com/gobwas/ws v1.0.2
go: downloading github.com/kr/text v0.1.0
go: downloading github.com/facebookgo/stack v0.0.0-20160209184415-751773369052
go: downloading github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870
go: downloading github.com/OneOfOne/xxhash v1.2.2
go: downloading github.com/spaolacci/murmur3 v1.1.0
go: downloading github.com/jtolds/gls v4.20.0+incompatible
go: downloading github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d
go: downloading github.com/nxadm/tail v1.4.4
go: downloading github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee
go: downloading github.com/gobwas/pool v0.2.0
go: downloading github.com/gin-contrib/sse v0.1.0
go: downloading github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1
go: downloading github.com/json-iterator/go v1.1.10
go: downloading github.com/go-playground/validator/v10 v10.2.0
go: downloading github.com/ugorji/go v1.1.7
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: downloading github.com/modern-go/reflect2 v1.0.1
go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: downloading github.com/ugorji/go/codec v1.1.7
go: downloading github.com/go-playground/locales v0.13.0
go: downloading github.com/go-playground/assert/v2 v2.0.1
go: downloading github.com/go-playground/universal-translator v0.17.0
go: downloading github.com/leodido/go-urn v1.2.0
readygo586 commented 3 years ago

when I delete the "buf" in protocgen.sh


git diff diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index bd3e400971..3c564a4d43 100755 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -15,7 +15,7 @@ protoc_gen_gocosmos

proto_dirs=$(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq) for dir in $proto_dirs; do

and run ./scripts/protocgen.sh, it meets the following problem.


~/go/src/github.com/cosmos/cosmos-sdk$./scripts/protocgen.sh W0310 18:21:10.482820 2274 services.go:38] No HttpRule found for method: Msg.Send W0310 18:21:10.482919 2274 services.go:38] No HttpRule found for method: Msg.MultiSend cosmos/base/tendermint/v1beta1/query.proto:4:1: warning: Import gogoproto/gogo.proto is unused. W0310 18:21:11.359781 2314 services.go:38] No HttpRule found for method: Msg.VerifyInvariant W0310 18:21:11.826169 2334 services.go:38] No HttpRule found for method: Msg.SetWithdrawAddress W0310 18:21:11.826253 2334 services.go:38] No HttpRule found for method: Msg.WithdrawDelegatorReward W0310 18:21:11.826259 2334 services.go:38] No HttpRule found for method: Msg.WithdrawValidatorCommission W0310 18:21:11.826265 2334 services.go:38] No HttpRule found for method: Msg.FundCommunityPool W0310 18:21:11.947372 2338 services.go:38] No HttpRule found for method: Msg.SubmitEvidence W0310 18:21:12.184456 2346 services.go:38] No HttpRule found for method: Msg.SubmitProposal W0310 18:21:12.184539 2346 services.go:38] No HttpRule found for method: Msg.Vote W0310 18:21:12.184545 2346 services.go:38] No HttpRule found for method: Msg.Deposit W0310 18:21:12.498948 2358 services.go:38] No HttpRule found for method: Msg.Unjail W0310 18:21:12.786496 2362 services.go:38] No HttpRule found for method: Msg.CreateValidator W0310 18:21:12.786580 2362 services.go:38] No HttpRule found for method: Msg.EditValidator W0310 18:21:12.786586 2362 services.go:38] No HttpRule found for method: Msg.Delegate W0310 18:21:12.786590 2362 services.go:38] No HttpRule found for method: Msg.BeginRedelegate W0310 18:21:12.786595 2362 services.go:38] No HttpRule found for method: Msg.Undelegate cosmos/tx/v1beta1/service.proto:7:1: warning: Import gogoproto/gogo.proto is unused. W0310 18:21:13.236971 2379 services.go:38] No HttpRule found for method: Msg.CreateVestingAccount W0310 18:21:13.350351 2383 services.go:38] No HttpRule found for method: Msg.Transfer W0310 18:21:13.611458 2390 services.go:38] No HttpRule found for method: Msg.ChannelOpenInit W0310 18:21:13.611535 2390 services.go:38] No HttpRule found for method: Msg.ChannelOpenTry W0310 18:21:13.611541 2390 services.go:38] No HttpRule found for method: Msg.ChannelOpenAck W0310 18:21:13.611546 2390 services.go:38] No HttpRule found for method: Msg.ChannelOpenConfirm W0310 18:21:13.611551 2390 services.go:38] No HttpRule found for method: Msg.ChannelCloseInit W0310 18:21:13.611556 2390 services.go:38] No HttpRule found for method: Msg.ChannelCloseConfirm W0310 18:21:13.611560 2390 services.go:38] No HttpRule found for method: Msg.RecvPacket W0310 18:21:13.611565 2390 services.go:38] No HttpRule found for method: Msg.Timeout W0310 18:21:13.611569 2390 services.go:38] No HttpRule found for method: Msg.TimeoutOnClose W0310 18:21:13.611574 2390 services.go:38] No HttpRule found for method: Msg.Acknowledgement ibc/core/client/v1/tx.proto:8:1: warning: Import ibc/core/client/v1/client.proto is unused. W0310 18:21:13.778044 2394 services.go:38] No HttpRule found for method: Msg.CreateClient W0310 18:21:13.778116 2394 services.go:38] No HttpRule found for method: Msg.UpdateClient W0310 18:21:13.778121 2394 services.go:38] No HttpRule found for method: Msg.UpgradeClient W0310 18:21:13.778126 2394 services.go:38] No HttpRule found for method: Msg.SubmitMisbehaviour W0310 18:21:14.027709 2403 services.go:38] No HttpRule found for method: Msg.ConnectionOpenInit W0310 18:21:14.027797 2403 services.go:38] No HttpRule found for method: Msg.ConnectionOpenTry W0310 18:21:14.027803 2403 services.go:38] No HttpRule found for method: Msg.ConnectionOpenAck W0310 18:21:14.027808 2403 services.go:38] No HttpRule found for method: Msg.ConnectionOpenConfirm /Users/rogan/go/src/github.com/cosmos/cosmos-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto: File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).


readygo586 commented 3 years ago

I reclone the project and the problem still remains


git clone https://github.com/cosmos/cosmos-sdk.git Cloning into 'cosmos-sdk'... remote: Enumerating objects: 3232, done. remote: Counting objects: 100% (3232/3232), done. remote: Compressing objects: 100% (796/796), done. remote: Total 292516 (delta 2630), reused 2918 (delta 2352), pack-reused 289284 Receiving objects: 100% (292516/292516), 443.79 MiB | 5.69 MiB/s, done. Resolving deltas: 100% (216140/216140), done. roganMacBook-Pro-6:~/go/src/github.com/cosmos$cd cosmos-sdk/ roganMacBook-Pro-6:~/go/src/github.com/cosmos/cosmos-sdk$ls CHANGELOG.md README.md codec go.mod simapp testutil CODE_OF_CONDUCT.md SECURITY.md contrib go.sum snapshots third_party CONTRIBUTING.md STABLE_RELEASES.md cosmovisor internal std types Dockerfile baseapp crypto proto store version LICENSE buf.yaml docker-compose.yml scripts telemetry x Makefile client docs server tests

roganMacBook-Pro-6:~/go/src/github.com/cosmos/cosmos-sdk$git branch

roganMacBook-Pro-6:~/go/src/github.com/cosmos/cosmos-sdk$make proto-gen Generating Protobuf files /usr/local/bin/docker run --rm -v /Users/rogan/go/src/github.com/cosmos/cosmos-sdk:/workspace --workdir /workspace tendermintdev/sdk-proto-gen:v0.1 sh ./scripts/protocgen.sh make: *** [proto-gen] Error 1


alessio commented 3 years ago

/Users/rogan/go/src/github.com/cosmos/cosmos-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto:

Please don't clone the repo in your GOPATH. Cosmos SDK uses Go modules and the project should be cloned outside of the GOPATH.

Furthermore, please replace this line in the proto-gen target:

$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen:v0.1 sh ./scripts/protocgen.sh

with the following:

$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen:v0.1 sh -x ./scripts/protocgen.sh

Try again.

readygo586 commented 3 years ago

@alessio very thanks for your information, after following your instructions, more info are disclosed, looks like below.


roganMacBook-Pro-6:~/cosmos/cosmos-sdk$make proto-gen Generating Protobuf files /usr/local/bin/docker run --rm -v /Users/rogan/cosmos/cosmos-sdk:/workspace --workdir /workspace tendermintdev/sdk-proto-gen:v0.1 sh -x ./scripts/protocgen.sh

  1. Without GOPROXY, fail to get the file


    (roganMacBook-Pro-6: ~ /cosmos/cosmos-sdk$go env -w GOPROXY=direct roganMacBook-Pro-6:~ /cosmos/cosmos-sdk$go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest: module github.com/regen-network/cosmos-proto/protoc-gen-gocosmos: git ls-remote -q origin in /Users/rogan/go/pkg/mod/cache/vcs/37084c7fb837eb3482f1d2a4420b3b6cdbb90164b7cd3520e8a9ed727e1dd534: exit status 128: fatal: unable to access 'https://github.com/regen-network/cosmos-proto/': Failed to connect to github.com port 443: Operation timed out)


  2. With GOPROXY, success to get the file


    roganMacBook-Pro-6:~ /cosmos/cosmos-sdk$go env -w GOPROXY=https://goproxy.cn,direct roganMacBook-Pro-6:~ /cosmos/cosmos-sdk$go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest go: found github.com/regen-network/cosmos-proto/protoc-gen-gocosmos in github.com/regen-network/cosmos-proto v0.3.1


So I think I need to setup GOPROXY somewhere to fix this problem.

alessio commented 3 years ago

Thanks.

This issue seems caused by the user's configuration and is not a bug. Hence closing.

readygo586 commented 3 years ago

My solution is add GOPROXY in proto-gen.sh, and it works.


!/usr/bin/env bash

set -eo pipefail export GOPROXY="https://goproxy.cn,direct"

protoc_gen_gocosmos() { if ! grep "github.com/gogo/protobuf => github.com/regen-network/protobuf" go.mod &>/dev/null ; then echo -e "\tPlease run this command from somewhere inside the cosmos-sdk folder." return 1 fi

go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest 2>/dev/null }