Skip to content

Commit

Permalink
using proto from go sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
tubackkhoa committed Jan 7, 2023
1 parent 6a3e980 commit 215c526
Show file tree
Hide file tree
Showing 41 changed files with 68 additions and 3,310 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,3 @@ jobs:
- name: lint
run: cd module && make proto-lint
if: env.GIT_DIFF

breakage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: technote-space/get-diff-action@v4
with:
PATTERNS: |
**/**.proto
- name: check-breakage
run: cd module && make proto-check-breaking
if: env.GIT_DIFF
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"protoc": {
"compile_on_save": false,
"options": [
"--proto_path=${workspaceFolder}/module/proto",
"--proto_path=${workspaceFolder}/module/third_party/proto"
"--proto_path=${workspaceFolder}/module/proto"
]
}
}
43 changes: 19 additions & 24 deletions module/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
linters:
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- goconst
- gocritic
- gocyclo
- gofmt
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- goconst
- gocritic
- gocyclo
- gofmt
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck

- exhaustruct
- errcheck
- exhaustruct
- errcheck
# - gosec
# - goimports


linters-settings:
govet:
check-shadowing: false
Expand Down Expand Up @@ -56,10 +55,6 @@ issues:
linters:
- exhaustruct
- errcheck
- path: third_party/
linters:
- exhaustruct
- errcheck
- path: x/
linters:
- exhaustruct
Expand Down
21 changes: 0 additions & 21 deletions module/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,27 +88,6 @@ proto-gen:
proto-lint:
@$(DOCKER_BUF) lint --error-format=json

proto-check-breaking:
@$(DOCKER_BUF) breaking --against "https://github.com/Gravity-Bridge/Gravity-Bridge.git#branch=main,subdir=module"

TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.34.0-rc3/proto/tendermint
GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos
COSMOS_PROTO_URL = https://raw.githubusercontent.com/regen-network/cosmos-proto/master
COSMOS_SDK_PROTO_URL = https://raw.githubusercontent.com/cosmos/cosmos-sdk/master/proto/cosmos/base

TM_CRYPTO_TYPES = third_party/proto/tendermint/crypto
TM_ABCI_TYPES = third_party/proto/tendermint/abci
TM_TYPES = third_party/proto/tendermint/types
TM_VERSION = third_party/proto/tendermint/version
TM_LIBS = third_party/proto/tendermint/libs/bits

GOGO_PROTO_TYPES = third_party/proto/gogoproto
COSMOS_PROTO_TYPES = third_party/proto/cosmos_proto

SDK_ABCI_TYPES = third_party/proto/cosmos/base/abci/v1beta1
SDK_QUERY_TYPES = third_party/proto/cosmos/base/query/v1beta1
SDK_COIN_TYPES = third_party/proto/cosmos/base/v1beta1

proto-update-deps:
# TODO: also download
# - google/api/annotations.proto
Expand Down
1 change: 0 additions & 1 deletion module/buf.work.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@
version: v1
directories:
- proto
- third_party/proto
3 changes: 0 additions & 3 deletions module/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ version: v1beta1
build:
roots:
- proto
- third_party/proto
lint:
allow_comment_ignores: true
use:
Expand All @@ -26,7 +25,6 @@ lint:
- gogoproto
- cosmos_proto
- google
- third_party
breaking:
use:
- FILE
Expand All @@ -37,4 +35,3 @@ breaking:
- gogoproto
- cosmos_proto
- google
- third_party
8 changes: 6 additions & 2 deletions module/contrib/local/protocgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,23 @@ if [[ $PATH != *"$GOPATH/bin"* ]]; then
exit 1
fi

COSMOS_SDK_DIR=${COSMOS_SDK_DIR:-$(go list -f "{{ .Dir }}" -m github.com/cosmos/cosmos-sdk)}

proto_dirs=$(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
for dir in $proto_dirs; do
buf alpha protoc \
-I "proto" \
-I "third_party/proto" \
-I="$COSMOS_SDK_DIR/third_party/proto" \
-I="$COSMOS_SDK_DIR/proto" \
--gocosmos_out=plugins=interfacetype+grpc,\
Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \
$(find "${dir}" -maxdepth 1 -name '*.proto')

# # command to generate gRPC gateway (*.pb.gw.go in respective modules) files
buf alpha protoc \
-I "proto" \
-I "third_party/proto" \
-I="$COSMOS_SDK_DIR/third_party/proto" \
-I="$COSMOS_SDK_DIR/proto" \
--grpc-gateway_out=logtostderr=true,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \
$(find "${dir}" -maxdepth 1 -name '*.proto')

Expand Down
4 changes: 2 additions & 2 deletions module/proto/buf.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by "buf config migrate-v1beta1". Edit as necessary, and
# remove this comment when you're finished.
#
# This module represents the "third_party/proto" root found in
# This module represents the "proto" root found in
# the previous configuration.
version: v1
build:
Expand Down Expand Up @@ -34,4 +34,4 @@ lint:
- proofs.proto # confio/ics23
- gogoproto
- google
- tendermint
- tendermint
40 changes: 0 additions & 40 deletions module/third_party/proto/buf.yaml

This file was deleted.

92 changes: 0 additions & 92 deletions module/third_party/proto/cosmos/bank/v1beta1/bank.proto

This file was deleted.

Loading

0 comments on commit 215c526

Please sign in to comment.