2020-09-30 09:28:36 +00:00
|
|
|
GOBIN = $(CURDIR)/build/bin
|
2020-10-28 12:17:18 +00:00
|
|
|
GOTEST = go test ./... -p 1 --tags 'mdbx'
|
2015-11-20 14:06:35 +00:00
|
|
|
|
2019-05-27 13:51:49 +00:00
|
|
|
LATEST_COMMIT ?= $(shell git log -n 1 origin/master --pretty=format:"%H")
|
|
|
|
ifeq ($(LATEST_COMMIT),)
|
|
|
|
LATEST_COMMIT := $(shell git log -n 1 HEAD~1 --pretty=format:"%H")
|
|
|
|
endif
|
|
|
|
|
2020-10-30 08:43:24 +00:00
|
|
|
GIT_COMMIT ?= $(shell git rev-list -1 HEAD)
|
2021-03-01 04:02:06 +00:00
|
|
|
GIT_BRANCH ?= $(shell git branch --show-current)
|
|
|
|
GOBUILD = env GO111MODULE=on go build -trimpath -tags "mdbx" -ldflags "-X main.gitCommit=${GIT_COMMIT} -X main.gitBranch=${GIT_BRANCH}"
|
2020-09-06 11:35:32 +00:00
|
|
|
|
2020-09-29 14:09:50 +00:00
|
|
|
OS = $(shell uname -s)
|
|
|
|
ARCH = $(shell uname -m)
|
|
|
|
|
|
|
|
ifeq ($(OS),Darwin)
|
|
|
|
PROTOC_OS := osx
|
|
|
|
endif
|
|
|
|
ifeq ($(OS),Linux)
|
|
|
|
PROTOC_OS = linux
|
|
|
|
endif
|
|
|
|
|
2021-03-14 19:07:19 +00:00
|
|
|
all: tg hack rpctest state pics rpcdaemon integration db-tools
|
2020-08-21 12:38:11 +00:00
|
|
|
|
|
|
|
docker:
|
2021-03-01 04:02:06 +00:00
|
|
|
docker build -t turbo-geth:latest --build-arg git_commit='${GIT_COMMIT}' --build-arg git_branch='${GIT_BRANCH}' .
|
2020-08-21 12:38:11 +00:00
|
|
|
|
|
|
|
docker-compose:
|
|
|
|
docker-compose up
|
2019-05-27 13:51:49 +00:00
|
|
|
|
2015-04-18 21:21:45 +00:00
|
|
|
geth:
|
2021-03-01 04:02:06 +00:00
|
|
|
$(GOBUILD) -o $(GOBIN)/tg ./cmd/tg
|
2015-04-18 21:21:45 +00:00
|
|
|
@echo "Done building."
|
2020-07-29 20:53:16 +00:00
|
|
|
@echo "Run \"$(GOBIN)/tg\" to launch turbo-geth."
|
2015-04-18 21:21:45 +00:00
|
|
|
|
2021-02-28 04:11:28 +00:00
|
|
|
tg: mdbx
|
2021-03-01 04:02:06 +00:00
|
|
|
$(GOBUILD) -o $(GOBIN)/tg ./cmd/tg
|
2020-07-30 15:37:46 +00:00
|
|
|
@echo "Done building."
|
|
|
|
@echo "Run \"$(GOBIN)/tg\" to launch turbo-geth."
|
|
|
|
|
2019-05-27 13:51:49 +00:00
|
|
|
hack:
|
2021-03-01 04:02:06 +00:00
|
|
|
$(GOBUILD) -o $(GOBIN)/hack ./cmd/hack
|
2019-05-27 13:51:49 +00:00
|
|
|
@echo "Done building."
|
|
|
|
@echo "Run \"$(GOBIN)/hack\" to launch hack."
|
|
|
|
|
|
|
|
rpctest:
|
2021-03-01 04:02:06 +00:00
|
|
|
$(GOBUILD) -o $(GOBIN)/rpctest ./cmd/rpctest
|
2019-05-27 13:51:49 +00:00
|
|
|
@echo "Done building."
|
|
|
|
@echo "Run \"$(GOBIN)/rpctest\" to launch rpctest."
|
|
|
|
|
|
|
|
state:
|
2021-03-15 17:21:41 +00:00
|
|
|
$(GOBUILD) -o $(GOBIN)/state ./cmd/state
|
2019-05-27 13:51:49 +00:00
|
|
|
@echo "Done building."
|
|
|
|
@echo "Run \"$(GOBIN)/state\" to launch state."
|
2020-02-09 10:31:52 +00:00
|
|
|
|
2020-10-28 03:18:10 +00:00
|
|
|
|
2019-05-27 13:51:49 +00:00
|
|
|
pics:
|
2021-03-01 04:02:06 +00:00
|
|
|
$(GOBUILD) -o $(GOBIN)/pics ./cmd/pics
|
2019-05-27 13:51:49 +00:00
|
|
|
@echo "Done building."
|
|
|
|
@echo "Run \"$(GOBIN)/pics\" to launch pics."
|
|
|
|
|
2019-12-02 13:47:00 +00:00
|
|
|
rpcdaemon:
|
2021-03-01 04:02:06 +00:00
|
|
|
$(GOBUILD) -o $(GOBIN)/rpcdaemon ./cmd/rpcdaemon
|
2019-12-02 13:47:00 +00:00
|
|
|
@echo "Done building."
|
|
|
|
@echo "Run \"$(GOBIN)/rpcdaemon\" to launch rpcdaemon."
|
|
|
|
|
2020-07-10 06:03:18 +00:00
|
|
|
integration:
|
2021-03-01 04:02:06 +00:00
|
|
|
$(GOBUILD) -o $(GOBIN)/integration ./cmd/integration
|
2020-07-10 06:03:18 +00:00
|
|
|
@echo "Done building."
|
|
|
|
@echo "Run \"$(GOBIN)/integration\" to launch integration tests."
|
|
|
|
|
2020-09-07 06:03:12 +00:00
|
|
|
headers:
|
2021-03-01 04:02:06 +00:00
|
|
|
$(GOBUILD) -o $(GOBIN)/headers ./cmd/headers
|
2020-09-07 06:03:12 +00:00
|
|
|
@echo "Done building."
|
2021-02-15 18:54:45 +00:00
|
|
|
@echo "Run \"$(GOBIN)/headers\" to run headers download PoC."
|
2016-11-25 10:34:19 +00:00
|
|
|
|
2021-02-28 04:11:28 +00:00
|
|
|
db-tools: mdbx
|
2020-11-03 07:19:57 +00:00
|
|
|
go mod vendor; cd vendor/github.com/ledgerwatch/lmdb-go/dist; make clean mdb_stat mdb_copy mdb_dump mdb_load; cp mdb_stat $(GOBIN); cp mdb_copy $(GOBIN); cp mdb_dump $(GOBIN); cp mdb_load $(GOBIN); cd ../../../../..; rm -rf vendor
|
|
|
|
$(GOBUILD) -o $(GOBIN)/lmdbgo_copy github.com/ledgerwatch/lmdb-go/cmd/lmdb_copy
|
|
|
|
$(GOBUILD) -o $(GOBIN)/lmdbgo_stat github.com/ledgerwatch/lmdb-go/cmd/lmdb_stat
|
2020-10-28 03:18:10 +00:00
|
|
|
|
|
|
|
cd ethdb/mdbx/dist/ && make tools
|
2020-10-29 13:19:46 +00:00
|
|
|
cp ethdb/mdbx/dist/mdbx_chk $(GOBIN)
|
2020-10-28 03:18:10 +00:00
|
|
|
cp ethdb/mdbx/dist/mdbx_copy $(GOBIN)
|
|
|
|
cp ethdb/mdbx/dist/mdbx_dump $(GOBIN)
|
|
|
|
cp ethdb/mdbx/dist/mdbx_load $(GOBIN)
|
2020-10-29 13:19:46 +00:00
|
|
|
cp ethdb/mdbx/dist/mdbx_stat $(GOBIN)
|
2021-03-15 02:41:02 +00:00
|
|
|
cp ethdb/mdbx/dist/mdbx_drop $(GOBIN)
|
2020-10-08 07:11:36 +00:00
|
|
|
@echo "Run \"$(GOBIN)/lmdb_stat -h\" to get info about lmdb file."
|
|
|
|
|
2021-02-28 04:11:28 +00:00
|
|
|
mdbx:
|
2020-10-28 03:18:10 +00:00
|
|
|
echo "Building mdbx"
|
2020-11-28 14:26:28 +00:00
|
|
|
cd ethdb/mdbx/dist/ \
|
|
|
|
&& make clean && make config.h \
|
2020-12-16 14:35:14 +00:00
|
|
|
&& echo '#define MDBX_DEBUG 0' >> config.h \
|
|
|
|
&& echo '#define MDBX_FORCE_ASSERTIONS 0' >> config.h \
|
2021-02-08 04:35:02 +00:00
|
|
|
&& echo '#define MDBX_TXN_CHECKOWNER 1' >> config.h \
|
2021-02-21 18:41:59 +00:00
|
|
|
&& echo '#define MDBX_ENV_CHECKPID 1' >> config.h \
|
2021-02-08 04:35:02 +00:00
|
|
|
&& echo '#define MDBX_DISABLE_PAGECHECKS 0' >> config.h \
|
2020-12-16 14:35:14 +00:00
|
|
|
&& CFLAGS_EXTRA="-Wno-deprecated-declarations" make mdbx-static.o
|
2020-10-28 03:18:10 +00:00
|
|
|
|
2021-02-28 04:11:28 +00:00
|
|
|
test: mdbx
|
2020-08-21 12:38:11 +00:00
|
|
|
$(GOTEST)
|
2020-06-05 09:25:33 +00:00
|
|
|
|
2020-10-28 17:52:00 +00:00
|
|
|
test-lmdb:
|
2020-08-21 12:38:11 +00:00
|
|
|
TEST_DB=lmdb $(GOTEST)
|
2020-06-05 09:25:33 +00:00
|
|
|
|
2020-12-16 14:35:14 +00:00
|
|
|
|
2021-02-28 04:11:28 +00:00
|
|
|
test-mdbx: mdbx
|
2020-11-28 14:26:28 +00:00
|
|
|
TEST_DB=mdbx $(GOTEST)
|
2020-06-12 09:31:21 +00:00
|
|
|
|
2019-05-27 13:51:49 +00:00
|
|
|
lint: lintci
|
|
|
|
|
2021-02-28 04:11:28 +00:00
|
|
|
lintci: mdbx
|
2019-05-27 13:51:49 +00:00
|
|
|
@echo "--> Running linter for code diff versus commit $(LATEST_COMMIT)"
|
2019-11-05 08:12:49 +00:00
|
|
|
@./build/bin/golangci-lint run \
|
|
|
|
--new-from-rev=$(LATEST_COMMIT) \
|
2020-10-28 12:17:18 +00:00
|
|
|
--build-tags="mdbx" \
|
2019-11-05 08:12:49 +00:00
|
|
|
--config ./.golangci/step1.yml \
|
|
|
|
--exclude "which can be annoying to use"
|
|
|
|
|
|
|
|
@./build/bin/golangci-lint run \
|
|
|
|
--new-from-rev=$(LATEST_COMMIT) \
|
2020-10-28 12:17:18 +00:00
|
|
|
--build-tags="mdbx" \
|
2019-11-05 08:12:49 +00:00
|
|
|
--config ./.golangci/step2.yml
|
|
|
|
|
|
|
|
@./build/bin/golangci-lint run \
|
|
|
|
--new-from-rev=$(LATEST_COMMIT) \
|
2020-10-28 12:17:18 +00:00
|
|
|
--build-tags="mdbx" \
|
2019-11-05 08:12:49 +00:00
|
|
|
--config ./.golangci/step3.yml
|
|
|
|
|
|
|
|
@./build/bin/golangci-lint run \
|
|
|
|
--new-from-rev=$(LATEST_COMMIT) \
|
2020-10-28 12:17:18 +00:00
|
|
|
--build-tags="mdbx" \
|
2019-11-05 08:12:49 +00:00
|
|
|
--config ./.golangci/step4.yml
|
2019-05-27 13:51:49 +00:00
|
|
|
|
|
|
|
lintci-deps:
|
2019-11-06 12:34:35 +00:00
|
|
|
rm -f ./build/bin/golangci-lint
|
2021-02-28 04:11:28 +00:00
|
|
|
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b ./build/bin v1.37.1
|
2018-04-17 22:53:50 +00:00
|
|
|
|
2016-05-25 12:07:57 +00:00
|
|
|
clean:
|
2020-01-14 12:13:14 +00:00
|
|
|
env GO111MODULE=on go clean -cache
|
2020-10-28 03:18:10 +00:00
|
|
|
rm -fr build/*
|
|
|
|
rm -f semantics/z3/build/libz3.a
|
|
|
|
cd ethdb/mdbx/dist/ && make clean
|
2016-05-25 12:07:57 +00:00
|
|
|
|
2017-02-26 22:52:10 +00:00
|
|
|
# The devtools target installs tools required for 'go generate'.
|
|
|
|
# You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'.
|
|
|
|
|
|
|
|
devtools:
|
2020-10-02 03:56:13 +00:00
|
|
|
# Notice! If you adding new binary - add it also to cmd/hack/binary-deps/main.go file
|
|
|
|
$(GOBUILD) -o $(GOBIN)/stringer golang.org/x/tools/cmd/stringer
|
|
|
|
$(GOBUILD) -o $(GOBIN)/go-bindata github.com/kevinburke/go-bindata/go-bindata
|
|
|
|
$(GOBUILD) -o $(GOBIN)/gencodec github.com/fjl/gencodec
|
|
|
|
$(GOBUILD) -o $(GOBIN)/codecgen github.com/ugorji/go/codec/codecgen
|
|
|
|
$(GOBUILD) -o $(GOBIN)/abigen ./cmd/abigen
|
|
|
|
PATH=$(GOBIN):$(PATH) go generate ./common
|
|
|
|
PATH=$(GOBIN):$(PATH) go generate ./core/types
|
|
|
|
PATH=$(GOBIN):$(PATH) go generate ./ethdb/typedbucket
|
2018-01-08 12:15:57 +00:00
|
|
|
@type "npm" 2> /dev/null || echo 'Please install node.js and npm'
|
|
|
|
@type "solc" 2> /dev/null || echo 'Please install solc'
|
|
|
|
@type "protoc" 2> /dev/null || echo 'Please install protoc'
|
2017-02-26 22:52:10 +00:00
|
|
|
|
2019-05-27 13:51:49 +00:00
|
|
|
bindings:
|
2020-10-02 03:56:13 +00:00
|
|
|
PATH=$(GOBIN):$(PATH) go generate ./tests/contracts/
|
|
|
|
PATH=$(GOBIN):$(PATH) go generate ./core/state/contracts/
|
2020-09-03 07:51:19 +00:00
|
|
|
|
|
|
|
grpc:
|
|
|
|
# See also: ./cmd/hack/binary-deps/main.go
|
2020-11-17 19:13:41 +00:00
|
|
|
mkdir -p ./build/bin/
|
2020-09-29 14:09:50 +00:00
|
|
|
rm -f ./build/bin/protoc*
|
|
|
|
rm -rf ./build/include*
|
|
|
|
|
|
|
|
$(eval PROTOC_TMP := $(shell mktemp -d))
|
2021-01-15 09:38:09 +00:00
|
|
|
cd $(PROTOC_TMP); curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protoc-3.14.0-$(PROTOC_OS)-$(ARCH).zip -o protoc.zip
|
2020-09-29 14:09:50 +00:00
|
|
|
cd $(PROTOC_TMP); unzip protoc.zip && mv bin/protoc $(GOBIN) && mv include $(GOBIN)/..
|
|
|
|
|
2020-09-29 09:55:41 +00:00
|
|
|
$(GOBUILD) -o $(GOBIN)/protoc-gen-go google.golang.org/protobuf/cmd/protoc-gen-go # generates proto messages
|
|
|
|
$(GOBUILD) -o $(GOBIN)/protoc-gen-go-grpc google.golang.org/grpc/cmd/protoc-gen-go-grpc # generates grpc services
|
2021-03-19 21:24:49 +00:00
|
|
|
PATH=$(GOBIN):$(PATH) protoc --proto_path=interfaces --go_out=gointerfaces --go-grpc_out=gointerfaces -I=build/include/google \
|
|
|
|
--go_opt=Mtypes/types.proto=github.com/ledgerwatch/turbo-geth/gointerfaces/types \
|
|
|
|
types/types.proto \
|
|
|
|
p2psentry/sentry.proto \
|
|
|
|
remote/kv.proto remote/db.proto remote/ethbackend.proto \
|
|
|
|
snapshot_downloader/external_downloader.proto
|
2020-11-13 16:16:47 +00:00
|
|
|
|
2020-04-29 10:51:07 +00:00
|
|
|
prometheus:
|
2020-08-01 15:05:48 +00:00
|
|
|
docker-compose up prometheus grafana
|
2020-06-05 16:46:34 +00:00
|
|
|
|
2021-02-28 04:11:28 +00:00
|
|
|
|
2020-06-05 16:46:34 +00:00
|
|
|
escape:
|
2020-06-15 16:39:34 +00:00
|
|
|
cd $(path) && go test -gcflags "-m -m" -run none -bench=BenchmarkJumpdest* -benchmem -memprofile mem.out
|