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

fix: build .proto files like any cosmos project #2462

Closed
wants to merge 57 commits into from
Closed
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
2573951
add liquidity module for future removal
faddat Apr 20, 2023
7bbbfbe
add the liquidity module to the cosmos hub repo
faddat Apr 20, 2023
467055c
lint unused parameters
faddat Apr 20, 2023
d803572
ineffectual assignments
faddat Apr 20, 2023
4c695a0
ineffetual assignments
faddat Apr 20, 2023
5f34fa2
correct variable names
faddat Apr 20, 2023
e57bfc8
lint
faddat Apr 20, 2023
6e0beaa
lint the swap test
faddat Apr 20, 2023
2b49566
Merge branch 'main' into botique-modules-go-in-x
faddat Apr 20, 2023
418a5f4
Merge branch 'main' into botique-modules-go-in-x
faddat Apr 21, 2023
054c9ec
Merge remote-tracking branch 'origin/main' into botique-modules-go-in-x
faddat Apr 25, 2023
2e67308
fix redefinition of builtin types
faddat Apr 25, 2023
0905653
convert if-else to switch
faddat Apr 25, 2023
a597fc5
fix if-else chains
faddat Apr 25, 2023
2f31077
resolve empty block and additional testing improvements
faddat Apr 25, 2023
13d82df
fix protos
faddat Apr 25, 2023
2bbf3f3
update proto builder to v9
faddat Apr 28, 2023
f6f6568
make proto-gen
faddat May 3, 2023
cf0911b
build .proto files like most Cosmos projects
faddat May 3, 2023
430633f
eliminate the difference in the .pb.go file
faddat May 3, 2023
c1dd04c
Merge branch 'main' into use-ibc-proto-build
faddat May 6, 2023
66d59a2
Merge remote-tracking branch 'origin/main' into botique-modules-go-in-x
faddat May 3, 2023
f310dd5
Merge branch 'main' into use-ibc-proto-build
faddat May 6, 2023
4bcdc8e
make proto build stuff match main
faddat May 6, 2023
f71d499
Merge remote-tracking branch 'origin/main' into botique-modules-go-in-x
faddat May 8, 2023
3848dbb
build .proto files like most Cosmos projects
faddat May 3, 2023
77faa08
add the liquidity module to the cosmos hub, reducing the scope for error
faddat May 8, 2023
afb86c8
fix lint
faddat May 8, 2023
ce4eada
fix by using fixes from the liquidity module branch
faddat May 8, 2023
0d94d80
tidy
faddat May 8, 2023
7f5e56d
Merge branch 'main' into botique-modules-go-in-x
faddat May 9, 2023
dad7b07
Merge branch 'main' into botique-modules-go-in-x
faddat May 9, 2023
bb3d319
Merge branch 'main' into use-ibc-proto-build
faddat May 9, 2023
7c50703
tidy
faddat May 9, 2023
a8c4ae8
fix
pysel May 10, 2023
288cfd1
Merge remote-tracking branch 'notional/ruslan/tests-fix' into use-ibc…
faddat May 10, 2023
b71aea9
Revert "Merge remote-tracking branch 'notional/ruslan/tests-fix' into…
faddat May 10, 2023
e366f27
Merge branch 'main' into use-ibc-proto-build
faddat May 10, 2023
ca618d5
Merge branch 'main' into use-ibc-proto-build
faddat May 11, 2023
582d2a6
remove the absolute flub of including the liquidity protos here
faddat May 13, 2023
006d5aa
Merge remote-tracking branch 'origin/main' into use-ibc-proto-build
faddat May 13, 2023
bf27c66
tidy and update proto builder
faddat May 13, 2023
7924482
remove an unneeded proto command
faddat May 14, 2023
3fc31ec
Merge remote-tracking branch 'origin/main' into use-ibc-proto-build
faddat May 17, 2023
90193be
Merge branch 'main' into use-ibc-proto-build
faddat May 23, 2023
2d049ea
tidy
faddat May 23, 2023
a3e84bf
Merge branch 'main' into use-ibc-proto-build
faddat May 29, 2023
dbe0782
Merge remote-tracking branch 'origin/main' into use-ibc-proto-build
faddat Jun 14, 2023
e367b26
Merge remote-tracking branch 'origin/main' into use-ibc-proto-build
faddat Jul 3, 2023
b248cea
tidy
faddat Jul 3, 2023
b5148c5
Merge remote-tracking branch 'origin/main' into use-ibc-proto-build
faddat Jul 9, 2023
4d3fd18
make proto-gen
faddat Jul 9, 2023
00cbb25
update go.sum
faddat Jul 9, 2023
2e14a89
update go.sum
faddat Jul 9, 2023
c3ffd35
Merge branch 'main' into use-ibc-proto-build
faddat Aug 20, 2023
73eafab
tidy
faddat Aug 20, 2023
1cdb8d2
Merge branch 'main' into use-ibc-proto-build
faddat Aug 29, 2023
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
52 changes: 25 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ DOCKER := $(shell which docker)
BUILDDIR ?= $(CURDIR)/build
TEST_DOCKER_REPO=cosmos/contrib-gaiatest

GO_SYSTEM_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1-2)
REQUIRE_GO_VERSION = 1.20


export GO111MODULE = on

Expand Down Expand Up @@ -95,19 +94,15 @@ include contrib/devtools/Makefile
### Build ###
###############################################################################

check_version:
ifneq ($(GO_SYSTEM_VERSION), $(REQUIRE_GO_VERSION))
@echo "ERROR: Go version 1.20 is required for $(VERSION) of Gaia."
exit 1
endif


all: install lint run-tests test-e2e vulncheck

BUILD_TARGETS := build install

build: BUILD_ARGS=-o $(BUILDDIR)/

$(BUILD_TARGETS): check_version go.sum $(BUILDDIR)/
$(BUILD_TARGETS): go.sum $(BUILDDIR)/
go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./...

$(BUILDDIR)/:
Expand Down Expand Up @@ -241,24 +236,14 @@ docker-build-all: docker-build-debug docker-build-hermes
###############################################################################
### Linting ###
###############################################################################
golangci_lint_cmd=golangci-lint
golangci_version=v1.52.2

lint:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run --timeout=10m

lint-fix:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run --fix --out-format=tab --issues-exit-code=0
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run --timeout=10m

format:
@go install mvdan.cc/gofumpt@latest
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -path "./tests/mocks/*" -not -name "*.pb.go" -not -name "*.pb.gw.go" -not -name "*.pulsar.go" -not -path "./crypto/keys/secp256k1/*" | xargs gofumpt -w -l
$(golangci_lint_cmd) run --fix
golangci-lint run --fix
.PHONY: format

###############################################################################
Expand Down Expand Up @@ -297,19 +282,32 @@ test-docker-push: test-docker
docker-build-debug docker-build-hermes docker-build-all




###############################################################################
### Protobuf ###
###############################################################################

protoImageName=ghcr.io/faddat/proto-builder:latest
faddat marked this conversation as resolved.
Show resolved Hide resolved
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)

proto-all: proto-format proto-lint proto-gen

proto-gen:
@echo "Generating Protobuf files"
@sh ./proto/scripts/protocgen.sh

proto-doc:
@echo "Generating Protoc docs"
@sh ./proto/scripts/protoc-doc-gen.sh
@$(protoImage) sh ./scripts/protocgen.sh

proto-swagger-gen:
@echo "Generating Protobuf Swagger"
@sh ./proto/scripts/protoc-swagger-gen.sh
@$(protoImage) sh ./scripts/protoc-swagger-gen.sh

proto-format:
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;

proto-lint:
@$(protoImage) buf lint --error-format=json

proto-check-breaking:
@$(protoImage) buf breaking --against $(HTTPS_GIT)#branch=main

.PHONY: proto-gen proto-doc proto-swagger-gen
.PHONY: proto-all proto-gen proto-gen-any proto-swagger-gen proto-format proto-lint proto-check-breaking
9 changes: 9 additions & 0 deletions buf.work.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Generated by "buf config migrate-v1beta1". Edit as necessary, and
# remove this comment when you're finished.
#
# This workspace file points to the roots found in your
# previous "buf.yaml" configuration.
version: v1
directories:
- proto
- third_party/proto
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
cosmossdk.io/math v1.0.1
github.com/cosmos/cosmos-sdk v0.45.16-ics
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.4.3
github.com/cosmos/ibc-go/v4 v4.4.2
github.com/cosmos/interchain-security/v2 v2.0.0
github.com/gogo/protobuf v1.3.3
Expand Down Expand Up @@ -159,7 +160,7 @@ require (
github.com/zondax/ledger-go v0.14.1 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/exp v0.0.0-20221205204356-47842c84f3db // indirect
golang.org/x/exp v0.0.0-20230131160201-f062dba9d201 // indirect
golang.org/x/mod v0.9.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ github.com/cosmos/cosmos-sdk v0.45.16-ics/go.mod h1:bScuNwWAP0TZJpUf+SHXRU3xGoUP
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
github.com/cosmos/gogoproto v1.4.3 h1:RP3yyVREh9snv/lsOvmsAPQt8f44LgL281X0IOIhhcI=
github.com/cosmos/gogoproto v1.4.3/go.mod h1:0hLIG5TR7IvV1fme1HCFKjfzW9X2x0Mo+RooWXCnOWU=
github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y=
github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw=
github.com/cosmos/iavl v0.19.5 h1:rGA3hOrgNxgRM5wYcSCxgQBap7fW82WZgY78V9po/iY=
Expand Down Expand Up @@ -1157,8 +1159,8 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw=
golang.org/x/exp v0.0.0-20200513190911-00229845015e/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw=
golang.org/x/exp v0.0.0-20221205204356-47842c84f3db h1:D/cFflL63o2KSLJIwjlcIt8PR064j/xsmdEJL/YvY/o=
golang.org/x/exp v0.0.0-20221205204356-47842c84f3db/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp v0.0.0-20230131160201-f062dba9d201 h1:BEABXpNXLEz0WxtA+6CQIz2xkg80e+1zrhWyMcq8VzE=
golang.org/x/exp v0.0.0-20230131160201-f062dba9d201/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
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: v1beta1
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
18 changes: 18 additions & 0 deletions proto/buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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: gogo-proto
commit: 34d970b699f84aa382f3c29773a60836
digest: shake256:3d3bee5229ba579e7d19ffe6e140986a228b48a8c7fe74348f308537ab95e9135210e81812489d42cd8941d33ff71f11583174ccc5972e86e6112924b6ce9f04
- remote: buf.build
owner: googleapis
repository: googleapis
commit: cc916c31859748a68fd229a3c8d7a2e8
digest: shake256:469b049d0eb04203d5272062636c078decefc96fec69739159c25d85349c50c34c7706918a8b216c5c27f76939df48452148cff8c5c3ae77fa6ba5c25c1b8bf8
25 changes: 25 additions & 0 deletions proto/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by "buf config migrate-v1beta1". Edit as necessary, and
# remove this comment when you're finished.
#
# This module represents the "proto" root found in
# the previous configuration.
version: v1beta1
deps:
- buf.build/googleapis/googleapis
- buf.build/cosmos/cosmos-proto
- buf.build/cosmos/gogo-proto

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
30 changes: 0 additions & 30 deletions proto/scripts/protocgen.sh

This file was deleted.

File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions scripts/protocgen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

set -eo pipefail

echo "Generating gogo proto code"
cd proto

buf generate --template buf.gen.gogo.yaml $file

cd ..


# move proto files to the right places
cp -r github.com/cosmos/gaia/x/* x/
rm -rf github.com

go mod tidy

16 changes: 0 additions & 16 deletions third_party/proto/cosmos_proto/cosmos.proto

This file was deleted.

Loading
Loading