Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

chore: update proto make commands #1471

Merged
merged 11 commits into from
Nov 20, 2022
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
38 changes: 26 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ SIMAPP = ./app
HTTPS_GIT := https://github.com/evmos/ethermint.git
PROJECT_NAME = $(shell git remote get-url origin | xargs basename -s .git)
DOCKER := $(shell which docker)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf:1.0.0-rc8
# RocksDB is a native dependency, so we don't assume the library is installed.
# Instead, it must be explicitly enabled and we warn when it is not.
ENABLE_ROCKSDB ?= false
Expand Down Expand Up @@ -422,33 +421,48 @@ format-fix:
### Protobuf ###
###############################################################################

protoVer=v0.2
# ------
# NOTE: Link to the tendermintdev/sdk-proto-gen docker images:
# https://hub.docker.com/r/tendermintdev/sdk-proto-gen/tags
#
protoVer=v0.7
protoImageName=tendermintdev/sdk-proto-gen:$(protoVer)
containerProtoGen=$(PROJECT_NAME)-proto-gen-$(protoVer)
containerProtoGenAny=$(PROJECT_NAME)-proto-gen-any-$(protoVer)
containerProtoGenSwagger=$(PROJECT_NAME)-proto-gen-swagger-$(protoVer)
containerProtoFmt=$(PROJECT_NAME)-proto-fmt-$(protoVer)
protoImage=$(DOCKER) run --network host --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)
# ------
# NOTE: cosmos/proto-builder image is needed because clang-format is not installed
# on the tendermintdev/sdk-proto-gen docker image.
# Link to the cosmos/proto-builder docker images:
# https://github.com/cosmos/cosmos-sdk/pkgs/container/proto-builder
#
protoCosmosVer=0.11.2
protoCosmosName=ghcr.io/cosmos/proto-builder:$(protoCosmosVer)
protoCosmosImage=$(DOCKER) run --network host --rm -v $(CURDIR):/workspace --workdir /workspace $(protoCosmosName)

# ------
# NOTE: If you are experiencing problems running these commands, try deleting
# the docker images and execute the desired command again.
#
proto-all: proto-format proto-lint proto-gen

proto-gen:
@echo "Generating Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protocgen.sh
$(protoImage) sh ./scripts/protocgen.sh

proto-swagger-gen:
@echo "Generating Protobuf Swagger"
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protoc-swagger-gen.sh
$(protoImage) sh ./scripts/protoc-swagger-gen.sh

proto-format:
@echo "Formatting Protobuf files"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoFmt}$$"; then docker start -a $(containerProtoFmt); else docker run --name $(containerProtoFmt) -v $(CURDIR):/workspace --workdir /workspace tendermintdev/docker-build-proto \
find ./ -not -path "./third_party/*" -name "*.proto" -exec clang-format -i {} \; ; fi
$(protoCosmosImage) find ./ -name "*.proto" -exec clang-format -i {} \;

proto-lint:
@$(DOCKER_BUF) lint --error-format=json
@echo "Linting Protobuf files"
$(protoImage) buf lint --error-format=json

proto-check-breaking:
@$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main
@echo "Checking Protobuf files for breaking changes"
$(protoImage) buf breaking --against $(HTTPS_GIT)#branch=main


.PHONY: proto-all proto-gen proto-gen-any proto-swagger-gen proto-format proto-lint proto-check-breaking
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2550,6 +2550,11 @@ paths:
in: query
required: false
type: boolean
- name: trace_config.tracer_json_config
description: tracer config.
in: query
required: false
type: string
- name: block_number
description: block number.
in: query
Expand Down Expand Up @@ -3010,6 +3015,11 @@ paths:
in: query
required: false
type: boolean
- name: trace_config.tracer_json_config
description: tracer config.
in: query
required: false
type: string
- name: block_number
description: block number of requested transaction.
in: query
Expand Down Expand Up @@ -4083,6 +4093,9 @@ definitions:
enable_return_data:
type: boolean
title: enable return data capture
tracer_json_config:
type: string
title: tracer config
description: TraceConfig holds extra parameters to trace functions.
google.protobuf.Any:
type: object
Expand Down
4 changes: 2 additions & 2 deletions proto/ethermint/evm/v1/evm.proto
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ message TraceConfig {
// enable memory capture
bool enable_memory = 11 [(gogoproto.jsontag) = "enableMemory"];
// enable return data capture
bool enable_return_data = 12 [ (gogoproto.jsontag) = "enableReturnData" ];
bool enable_return_data = 12 [(gogoproto.jsontag) = "enableReturnData"];
// tracer config
string tracer_json_config = 13 [ (gogoproto.jsontag) = "tracerConfig" ];
string tracer_json_config = 13 [(gogoproto.jsontag) = "tracerConfig"];
}
7 changes: 4 additions & 3 deletions scripts/protocgen.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env bash

# --------------
# Commands to run locally
# docker run --network host --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen:v0.7 sh ./protocgen.sh
#
set -eo pipefail

# get protoc executions
go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos 2>/dev/null

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