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

Peggy Stargate migration and code clean up #115

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b2dfacd
WIP Stargate migration
jackzampolin Nov 16, 2020
be5bdd3
go test ./x/peggy/types/... compiling
jackzampolin Nov 16, 2020
88c9043
Only failing tests left in types and keeper
jackzampolin Nov 17, 2020
b11251b
WIP module interfaces
jackzampolin Nov 17, 2020
f2ed83a
All tests in ./x/peggy/... running, many failing :speak_no_evil:
jackzampolin Nov 17, 2020
78687b1
app builds
jackzampolin Nov 17, 2020
436a879
WIP building binaries
jackzampolin Nov 17, 2020
b3c24ac
Building binaries
jackzampolin Nov 17, 2020
e68c5cd
Broken, just updated proto files, correcting types throughout codebase
jackzampolin Nov 18, 2020
593d3b5
Broken, just updated proto files, correcting types throughout codebase
jackzampolin Nov 18, 2020
16d86d9
Many more tests passing now :sunglasses:
jackzampolin Nov 18, 2020
38271b8
Fixed querier test
jackzampolin Nov 18, 2020
f7a006e
Fixed querier test
jackzampolin Nov 18, 2020
3205f82
Tests passing :tada:
jackzampolin Nov 18, 2020
aec6ab6
Merge PR #116: Remove BridgeDenominator, VoucherDenom types
jackzampolin Nov 18, 2020
391ca45
Remove usage of UInt64Nonce
jackzampolin Nov 18, 2020
aa87959
transition out of EthereumAddress usage in keeper
jackzampolin Nov 19, 2020
d665249
custom eth addr type removal
jackzampolin Nov 19, 2020
2b40f57
Removed the EthereumAddress type
jackzampolin Nov 19, 2020
c5c2eed
Additional code cleanup and deletion
jackzampolin Nov 19, 2020
cb7b04f
Prep for checkpoint refactor
jackzampolin Nov 19, 2020
3c6a6f3
Update peggyid to string in params and thread into getcheckpoint
jackzampolin Nov 19, 2020
772a4cd
GRPC query impl
jackzampolin Nov 19, 2020
1d1328c
Stub out msgserver and wire up grpc stuffs to module
jackzampolin Nov 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
165 changes: 157 additions & 8 deletions module/Makefile
@@ -1,22 +1,54 @@
PACKAGES=$(shell go list ./... | grep -v '/simulation')

VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')

# TODO: Update the ldflags with the app, client & server names
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=Peggy \
-X github.com/cosmos/cosmos-sdk/version.ServerName=peggyd \
-X github.com/cosmos/cosmos-sdk/version.ClientName=peggycli \
build_tags = netgo
ifeq ($(LEDGER_ENABLED),true)
ifeq ($(OS),Windows_NT)
GCCEXE = $(shell where gcc.exe 2> NUL)
ifeq ($(GCCEXE),)
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),OpenBSD)
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
else
GCC = $(shell command -v gcc 2> /dev/null)
ifeq ($(GCC),)
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
endif
endif
endif

ifeq (cleveldb,$(findstring cleveldb,$(GAIA_BUILD_OPTIONS)))
build_tags += gcc
endif
build_tags += $(BUILD_TAGS)
build_tags := $(strip $(build_tags))

whitespace :=
whitespace += $(whitespace)
comma := ,
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=peggy \
-X github.com/cosmos/cosmos-sdk/version.AppName=peggy \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT)
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \

BUILD_FLAGS := -ldflags '$(ldflags)' -gcflags="all=-N -l"

all: install

install: go.sum
go install $(BUILD_FLAGS) ./cmd/peggyd
go install $(BUILD_FLAGS) ./cmd/peggycli
go install $(BUILD_FLAGS) ./cmd/peggy

go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
Expand All @@ -30,3 +62,120 @@ lint:
@echo "--> Running linter"
@golangci-lint run
@go mod verify

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

proto-gen:
./contrib/local/protocgen.sh

proto-lint:
buf check lint --error-format=json

proto-check-breaking:
buf check breaking --against-input '.git#branch=master'

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
# - google/api/http.proto
# - google/api/httpbody.proto
# - google/protobuf/any.proto
mkdir -p $(GOGO_PROTO_TYPES)
curl -sSL $(GOGO_PROTO_URL)/gogoproto/gogo.proto > $(GOGO_PROTO_TYPES)/gogo.proto

mkdir -p $(COSMOS_PROTO_TYPES)
curl -sSL $(COSMOS_PROTO_URL)/cosmos.proto > $(COSMOS_PROTO_TYPES)/cosmos.proto

mkdir -p $(TM_ABCI_TYPES)
curl -sSL $(TM_URL)/abci/types.proto > $(TM_ABCI_TYPES)/types.proto

mkdir -p $(TM_VERSION)
curl -sSL $(TM_URL)/version/types.proto > $(TM_VERSION)/types.proto

mkdir -p $(TM_TYPES)
curl -sSL $(TM_URL)/types/types.proto > $(TM_TYPES)/types.proto
curl -sSL $(TM_URL)/types/evidence.proto > $(TM_TYPES)/evidence.proto
curl -sSL $(TM_URL)/types/params.proto > $(TM_TYPES)/params.proto

mkdir -p $(TM_CRYPTO_TYPES)
curl -sSL $(TM_URL)/crypto/proof.proto > $(TM_CRYPTO_TYPES)/proof.proto
curl -sSL $(TM_URL)/crypto/keys.proto > $(TM_CRYPTO_TYPES)/keys.proto

mkdir -p $(TM_LIBS)
curl -sSL $(TM_URL)/libs/bits/types.proto > $(TM_LIBS)/types.proto

mkdir -p $(SDK_ABCI_TYPES)
curl -sSL $(COSMOS_SDK_PROTO_URL)/abci/v1beta1/abci.proto > $(SDK_ABCI_TYPES)/abci.proto

mkdir -p $(SDK_QUERY_TYPES)
curl -sSL $(COSMOS_SDK_PROTO_URL)/query/v1beta1/pagination.proto > $(SDK_QUERY_TYPES)/pagination.proto

mkdir -p $(SDK_COIN_TYPES)
curl -sSL $(COSMOS_SDK_PROTO_URL)/v1beta1/coin.proto > $(SDK_COIN_TYPES)/coin.proto

PREFIX ?= /usr/local
BIN ?= $(PREFIX)/bin
UNAME_S ?= $(shell uname -s)
UNAME_M ?= $(shell uname -m)

BUF_VERSION ?= 0.11.0

PROTOC_VERSION ?= 3.11.2
ifeq ($(UNAME_S),Linux)
PROTOC_ZIP ?= protoc-${PROTOC_VERSION}-linux-x86_64.zip
endif
ifeq ($(UNAME_S),Darwin)
PROTOC_ZIP ?= protoc-${PROTOC_VERSION}-osx-x86_64.zip
endif

proto-tools: proto-tools-stamp buf

proto-tools-stamp:
echo "Installing protoc compiler..."
(cd /tmp; \
curl -OL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}"; \
unzip -o ${PROTOC_ZIP} -d $(PREFIX) bin/protoc; \
unzip -o ${PROTOC_ZIP} -d $(PREFIX) 'include/*'; \
rm -f ${PROTOC_ZIP})

echo "Installing protoc-gen-gocosmos..."
go install github.com/regen-network/cosmos-proto/protoc-gen-gocosmos

# Create dummy file to satisfy dependency and avoid
# rebuilding when this Makefile target is hit twice
# in a row
touch $@

buf: buf-stamp

buf-stamp:
echo "Installing buf..."
curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-${UNAME_S}-${UNAME_M}" \
-o "${BIN}/buf" && \
chmod +x "${BIN}/buf"

touch $@

tools-clean:
rm -f proto-tools-stamp buf-stamp