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

chore: protobuf migration #436

Merged
merged 4 commits into from
Sep 1, 2023
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ format:
###############################################################################
### Protobuf ###
###############################################################################
PROTO_BUILDER_IMAGE=tendermintdev/sdk-proto-gen@sha256:372dce7be2f465123e26459973ca798fc489ff2c75aeecd814c0ca8ced24faca
PROTO_BUILDER_IMAGE=ghcr.io/cosmos/proto-builder:0.14.0
PROTO_FORMATTER_IMAGE=tendermintdev/docker-build-proto@sha256:aabcfe2fc19c31c0f198d4cd26393f5e5ca9502d7ea3feafbfe972448fee7cae

proto-all: proto-format proto-lint proto-gen
Expand Down
3 changes: 0 additions & 3 deletions buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ version: v1
build:
roots:
- proto
- third_party/proto
excludes:
- third_party/proto/google/protobuf
lint:
use:
- DEFAULT
Expand Down
6 changes: 1 addition & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/cosmos/cosmos-sdk v0.47.4
github.com/cosmos/ibc-go/v7 v7.2.0
github.com/dvsekhvalnov/jose2go v1.5.0
github.com/gogo/protobuf v1.3.3
github.com/cosmos/gogoproto v1.4.11
github.com/golang/protobuf v1.5.3
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
Expand Down Expand Up @@ -153,10 +153,6 @@ require (
nhooyr.io/websocket v1.8.7 // indirect
)

replace google.golang.org/grpc => google.golang.org/grpc v1.33.2

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

replace github.com/CosmWasm/wasmd => github.com/archway-network/archway-wasmd v0.41.0-archway

replace github.com/archway-network/voter => ./contracts/go/voter
Expand Down
2 changes: 1 addition & 1 deletion proto/archway/rewards/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ message MsgWithdrawRewards {
message RecordsLimit { uint64 limit = 1; }

message RecordIDs {
repeated uint64 ids = 1 [ (gogoproto.nullable) = false ];
repeated uint64 ids = 1;
}

// rewards_address is the address to distribute rewards to (bech32 encoded).
Expand Down
8 changes: 8 additions & 0 deletions proto/buf.gen.gogo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: v1
plugins:
- name: gocosmos
out: ..
opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types
- name: grpc-gateway
out: ..
opt: logtostderr=true,allow_colon_final_segments=true
33 changes: 33 additions & 0 deletions proto/buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: cosmos
repository: cosmos-proto
commit: 1935555c206d4afb9e94615dfd0fad31
digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377
- remote: buf.build
owner: cosmos
repository: cosmos-sdk
commit: 954f7b05f38440fc8250134b15adec47
digest: shake256:2ab4404fd04a7d1d52df0e2d0f2d477a3d83ffd88d876957bf3fedfd702c8e52833d65b3ce1d89a3c5adf2aab512616b0e4f51d8463f07eda9a8a3317ee3ac54
- remote: buf.build
owner: cosmos
repository: gogo-proto
commit: 5e5b9fdd01804356895f8f79a6f1ddc1
digest: shake256:0b85da49e2e5f9ebc4806eae058e2f56096ff3b1c59d1fb7c190413dd15f45dd456f0b69ced9059341c80795d2b6c943de15b120a9e0308b499e43e4b5fc2952
- remote: buf.build
owner: cosmos
repository: ibc
commit: fbb44f5ad3194450af479a615fa715d9
digest: shake256:3fbf41c96089017ebf3b5143f78de0d531f604cb11da1bc98b2104eb6dd295b8a49f5f35c60b8389ba50bfa08959da905109324099e75ece9afd8e4087b14019
- remote: buf.build
owner: cosmos
repository: ics23
commit: 55085f7c710a45f58fa09947208eb70b
digest: shake256:9bf0bc495b5a11c88d163d39ef521bc4b00bc1374a05758c91d82821bdc61f09e8c2c51dda8452529bf80137f34d852561eacbe9550a59015d51cecb0dacb628
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 28151c0d0a1641bf938a7672c500e01d
digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de
24 changes: 24 additions & 0 deletions proto/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: v1
name: buf.build/archway-network/archway
deps:
- buf.build/cosmos/gogo-proto
- buf.build/cosmos/cosmos-sdk:v0.47.0
- buf.build/cosmos/ibc:fbb44f5ad3194450af479a615fa715d9
- buf.build/googleapis/googleapis
- buf.build/cosmos/ics23:b1abd8678aab07165efd453c96796a179eb3131f
breaking:
use:
- FILE
lint:
use:
- DEFAULT
- COMMENTS
- FILE_LOWER_SNAKE_CASE
except:
- UNARY_RPC
- COMMENT_FIELD
- SERVICE_SUFFIX
- PACKAGE_VERSION_SUFFIX
- RPC_REQUEST_STANDARD_NAME
ignore:
- tendermint
37 changes: 9 additions & 28 deletions scripts/protocgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,17 @@

set -eo pipefail

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
}

protoc_gen_gocosmos

proto_dirs=$(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
echo "Generating gogo proto code"
cd proto
proto_dirs=$(find ./archway -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
for dir in $proto_dirs; do
buf protoc \
-I "proto" \
-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:. \
$(find "${dir}" -maxdepth 5 -name '*.proto')

for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do
if grep "option go_package" $file &> /dev/null ; then
buf generate --template buf.gen.gogo.yaml $file
fi
done
done
#
## command to generate docs using protoc-gen-doc
buf protoc \
-I "proto" \
-I "third_party/proto" \
--doc_out=./docs/proto \
--doc_opt=./docs/proto/protodoc-markdown.tmpl,proto-docs.md \
$(find "$(pwd)/proto" -maxdepth 5 -name '*.proto')
cd ..

# move proto files to the right places
cp -r github.com/archway-network/archway/* ./
Expand Down
8 changes: 0 additions & 8 deletions third_party/README.md

This file was deleted.

201 changes: 0 additions & 201 deletions third_party/proto/confio/LICENSE

This file was deleted.

Loading
Loading