erigon-pulse/Makefile

218 lines
7.6 KiB
Makefile
Raw Normal View History

2020-09-30 09:28:36 +00:00
GOBIN = $(CURDIR)/build/bin
2021-05-20 16:46:12 +00:00
GOTEST = go test ./... -p 1 --tags 'mdbx'
GIT_COMMIT ?= $(shell git rev-list -1 HEAD)
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
GOBUILD = env GO111MODULE=on go build -trimpath -tags=mdbx -ldflags "-X main.gitCommit=${GIT_COMMIT} -X main.gitBranch=${GIT_BRANCH}"
GO_DBG_BUILD = env CGO_CFLAGS='-O0 -g -DMDBX_BUILD_FLAGS_CONFIG="config.h"' go build -trimpath -tags=mdbx,debug -ldflags "-X main.gitCommit=${GIT_COMMIT} -X main.gitBranch=${GIT_BRANCH}" -gcflags=all="-N -l" # see delve docs
2021-04-19 10:54:56 +00:00
GO_MAJOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
GO_MINOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
OS = $(shell uname -s)
ARCH = $(shell uname -m)
ifeq ($(OS),Darwin)
PROTOC_OS := osx
endif
ifeq ($(OS),Linux)
PROTOC_OS = linux
endif
all: erigon hack rpctest state pics rpcdaemon integration db-tools
2020-08-21 12:38:11 +00:00
2021-04-19 10:54:56 +00:00
go-version:
@if [ $(GO_MINOR_VERSION) -lt 16 ]; then \
echo "minimum required Golang version is 1.16"; \
exit 1 ;\
fi
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
# debug build allows see C stack traces, run it with GOTRACEBACK=crash. You don't need debug build for C pit for profiling. To profile C code use SETCGOTRCKEBACK=1
dbg: mdbx-dbg
$(GO_DBG_BUILD) -o $(GOBIN)/ ./cmd/...
geth: mdbx
$(GOBUILD) -o $(GOBIN)/erigon ./cmd/erigon
@echo "Done building."
@echo "Run \"$(GOBIN)/erigon\" to launch Erigon."
erigon: go-version mdbx
@echo "Building Erigon"
rm -f $(GOBIN)/tg # Remove old binary to prevent confusion where users still use it because of the scripts
$(GOBUILD) -o $(GOBIN)/erigon ./cmd/erigon
@echo "Done building."
@echo "Run \"$(GOBIN)/erigon\" to launch Erigon."
hack:
2021-03-01 04:02:06 +00:00
$(GOBUILD) -o $(GOBIN)/hack ./cmd/hack
@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
@echo "Done building."
@echo "Run \"$(GOBIN)/rpctest\" to launch rpctest."
state:
$(GOBUILD) -o $(GOBIN)/state ./cmd/state
@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
pics:
2021-03-01 04:02:06 +00:00
$(GOBUILD) -o $(GOBIN)/pics ./cmd/pics
@echo "Done building."
@echo "Run \"$(GOBIN)/pics\" to launch pics."
rpcdaemon:
2021-03-01 04:02:06 +00:00
$(GOBUILD) -o $(GOBIN)/rpcdaemon ./cmd/rpcdaemon
@echo "Done building."
@echo "Run \"$(GOBIN)/rpcdaemon\" to launch rpcdaemon."
integration:
2021-03-01 04:02:06 +00:00
$(GOBUILD) -o $(GOBIN)/integration ./cmd/integration
@echo "Done building."
@echo "Run \"$(GOBIN)/integration\" to launch integration tests."
headers:
2021-03-01 04:02:06 +00:00
$(GOBUILD) -o $(GOBIN)/headers ./cmd/headers
@echo "Done building."
@echo "Run \"$(GOBIN)/headers\" to run headers download PoC."
cons:
$(GOBUILD) -o $(GOBIN)/cons ./cmd/cons
@echo "Done building."
@echo "Run \"$(GOBIN)/cons\" to run consensus engine PoC."
evm:
$(GOBUILD) -o $(GOBIN)/evm ./cmd/evm
@echo "Done building."
@echo "Run \"$(GOBIN)/evm\" to run EVM"
seeder:
$(GOBUILD) -o $(GOBIN)/seeder ./cmd/snapshots/seeder
@echo "Done building."
@echo "Run \"$(GOBIN)/seeder\" to seed snapshots."
sndownloader:
$(GOBUILD) -o $(GOBIN)/sndownloader ./cmd/snapshots/downloader
@echo "Done building."
@echo "Run \"$(GOBIN)/sndownloader\" to seed snapshots."
tracker:
$(GOBUILD) -o $(GOBIN)/tracker ./cmd/snapshots/tracker
@echo "Done building."
@echo "Run \"$(GOBIN)/tracker\" to run snapshots tracker."
db-tools: mdbx
2021-03-31 01:26:01 +00:00
@echo "Building bb-tools"
2021-04-10 08:38:02 +00:00
go mod vendor; cd vendor/github.com/ledgerwatch/lmdb-go/dist; make clean mdb_stat mdb_copy mdb_dump mdb_drop mdb_load; cp mdb_stat $(GOBIN); cp mdb_copy $(GOBIN); cp mdb_dump $(GOBIN); cp mdb_drop $(GOBIN); cp mdb_load $(GOBIN); cd ../../../../..; rm -rf vendor
2020-10-28 03:18:10 +00:00
cd ethdb/mdbx/dist/ && make tools
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)
2021-04-10 08:38:02 +00:00
cp ethdb/mdbx/dist/mdbx_drop $(GOBIN)
2020-10-28 03:18:10 +00:00
cp ethdb/mdbx/dist/mdbx_load $(GOBIN)
cp ethdb/mdbx/dist/mdbx_stat $(GOBIN)
2020-10-08 07:11:36 +00:00
@echo "Run \"$(GOBIN)/lmdb_stat -h\" to get info about lmdb file."
mdbx:
2021-03-31 01:26:01 +00:00
@echo "Building mdbx"
@cd ethdb/mdbx/dist/ \
&& make clean && make config.h \
&& echo '#define MDBX_DEBUG 0' >> config.h \
&& echo '#define MDBX_FORCE_ASSERTIONS 0' >> config.h \
&& CFLAGS_EXTRA="-Wno-deprecated-declarations" make mdbx-static.o
2020-10-28 03:18:10 +00:00
mdbx-dbg:
@echo "Building mdbx"
@cd ethdb/mdbx/dist/ \
&& make clean && make config.h \
&& echo '#define MDBX_DEBUG 1' >> config.h \
&& echo '#define MDBX_FORCE_ASSERTIONS 1' >> config.h \
&& CFLAGS_EXTRA="-Wno-deprecated-declarations" CFLAGS='-O0 -g -Wall -Werror -Wextra -Wpedantic -ffunction-sections -fPIC -fvisibility=hidden -std=gnu11 -pthread -Wno-error=attributes' make mdbx-static.o
test: mdbx
2021-04-21 13:03:08 +00:00
TEST_DB=mdbx $(GOTEST) --timeout 15m
test-lmdb:
2020-08-21 12:38:11 +00:00
TEST_DB=lmdb $(GOTEST)
2021-05-20 16:46:12 +00:00
test-mdbx:
TEST_DB=mdbx $(GOTEST) --timeout 20m
lint:
@./build/bin/golangci-lint run --build-tags="mdbx" --config ./.golangci.yml
lintci: mdbx
2021-03-29 23:17:19 +00:00
@echo "--> Running linter for code"
@./build/bin/golangci-lint run --build-tags="mdbx" --config ./.golangci.yml
lintci-deps:
2019-11-06 12:34:35 +00:00
rm -f ./build/bin/golangci-lint
2021-05-17 02:42:24 +00:00
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b ./build/bin v1.40.0
clean:
env GO111MODULE=on go clean -cache
2020-10-28 03:18:10 +00:00
rm -fr build/*
cd ethdb/mdbx/dist/ && make clean
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
@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
bindings:
2020-10-02 03:56:13 +00:00
PATH=$(GOBIN):$(PATH) go generate ./tests/contracts/
PATH=$(GOBIN):$(PATH) go generate ./core/state/contracts/
grpc:
# See also: ./cmd/hack/binary-deps/main.go
mkdir -p ./build/bin/
rm -f ./build/bin/protoc*
rm -rf ./build/include*
$(eval PROTOC_TMP := $(shell mktemp -d))
cd $(PROTOC_TMP); curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v3.17.0/protoc-3.17.0-$(PROTOC_OS)-$(ARCH).zip -o protoc.zip
cd $(PROTOC_TMP); unzip protoc.zip && mv bin/protoc $(GOBIN) && mv include $(GOBIN)/..
$(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
Integration tests 1 (#1793) * Initial commit * Add sentry gRPC interface * p2psentry directory * Update README.md * Update README.md * Update README.md * Add go package * Correct syntax * add external downloader interface (#2) * Add txpool (#3) * Add private API (#4) * Invert control.proto, add PeerMinBlock, Separare incoming Tx message into a separate stream (#5) Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> * Separate upload messages into its own stream (#6) Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> * Only send changed accounts to listeners (#7) * Txpool interface doc (#9) * Add architecture diagram source and picture (#10) * Typed hashes (#11) * Typed hashes * Fix PeerId * 64-bit tx nonce * Add proper golang packages, max_block into p2p sentry Status (#12) * Add proper golang packages, max_block into p2p sentry Status * Change EtherReply to address Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> * Add Rust infrastructure (#13) * DB stats methods removed by https://github.com/ledgerwatch/turbo-geth/pull/1665 * more p2p methods (#15) * add mining methods (#16) * First draft of Consensus gRPC interface (#14) * Update Rust build * Fix interfaces in architecture diagram (#17) * Fix KV interface provider * Fix Consensus interface provider * drop java attributes (#18) * tx pool remove unused import (#19) * ethbackend: add protocol version and client version (#20) * Add missing ethbackend I/F (#21) * Add interface versioning mechanism (#23) Add versioning in KV interface Co-authored-by: Artem Vorotnikov <artem@vorotnikov.me> * spec of tx pool method (#24) * spec of tx pool method (#25) * Update version.proto * Refactor interface versioning * Refactor interface versioning * Testing interface * Remove tree * Fix * Build testing protos * Fix * Fix * Update to the newer interfaces * Add ProtocolVersion and ClientVersion stubs * Hook up ProtocolVersion and ClientVersion * Remove service * Add compatibility checks for RPC daemon * Fix typos * Properly update DB schema version * Fix test * Add test for KV compatibility| * Info messages about compability for RPC daemon * DB schema version to be one key * Update release intructions Co-authored-by: Artem Vorotnikov <artem@vorotnikov.me> Co-authored-by: b00ris <b00ris@mail.ru> Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com> Co-authored-by: canepat <16927169+canepat@users.noreply.github.com> Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com> Co-authored-by: canepat <tullio.canepa@gmail.com> Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2021-04-24 15:46:29 +00:00
PATH=$(GOBIN):$(PATH) protoc --proto_path=interfaces --go_out=gointerfaces -I=build/include/google \
types/types.proto
More updates to downloader, new p2psentry protocol (#1559) * Initial commit * Add sentry gRPC interface * p2psentry directory * Update README.md * Update README.md * Update README.md * Add go package * Correct syntax * add external downloader interface (#2) * Add txpool (#3) * Add private API (#4) * Invert control.proto, add PeerMinBlock, Separare incoming Tx message into a separate stream (#5) Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> * Separate upload messages into its own stream (#6) Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> * Only send changed accounts to listeners (#7) * Txpool interface doc (#9) * More additions * More additions * Fix locking * Intermediate * Fix separation of phases * Intermediate * Fix test * More transformations * New simplified way of downloading headers * Fix hard-coded header sync * Fixed syncing near the tip of the chain * Add architecture diagram source and picture (#10) * More fixes * rename tip to link * Use preverified hashes instead of preverified headers * Fix preverified hashes generation * more parametrisation * Continue parametrisation * Fix grpc data limit, interruption of headers stage * Add ropsten preverified hashes * Typed hashes (#11) * Typed hashes * Fix PeerId * 64-bit tx nonce * Disable penalties * Add goerli settings, bootstrap nodes * Try to fix goerly sync * Remove interfaces * Add proper golang packages, max_block into p2p sentry Status * Prepare for proto overhaul * Squashed 'interfaces/' content from commit ce36053c2 git-subtree-dir: interfaces git-subtree-split: ce36053c24db2f56e48ac752808de60afa1dfb4b * Change EtherReply to address * Adaptations to new types * Switch to new types * Fixes * Fix formatting * Fix lint * Lint fixes, reverse order in types * Fix lint * Fix lint * Fix lint * Fix test * Not supporting eth/66 yet * Fix shutdown * Fix lint * Fix lint * Fix lint * return stopped check Co-authored-by: Artem Vorotnikov <artem@vorotnikov.me> Co-authored-by: b00ris <b00ris@mail.ru> Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com> Co-authored-by: canepat <16927169+canepat@users.noreply.github.com>
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/erigon/gointerfaces/types \
--go-grpc_opt=Mtypes/types.proto=github.com/ledgerwatch/erigon/gointerfaces/types \
More updates to downloader, new p2psentry protocol (#1559) * Initial commit * Add sentry gRPC interface * p2psentry directory * Update README.md * Update README.md * Update README.md * Add go package * Correct syntax * add external downloader interface (#2) * Add txpool (#3) * Add private API (#4) * Invert control.proto, add PeerMinBlock, Separare incoming Tx message into a separate stream (#5) Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> * Separate upload messages into its own stream (#6) Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> * Only send changed accounts to listeners (#7) * Txpool interface doc (#9) * More additions * More additions * Fix locking * Intermediate * Fix separation of phases * Intermediate * Fix test * More transformations * New simplified way of downloading headers * Fix hard-coded header sync * Fixed syncing near the tip of the chain * Add architecture diagram source and picture (#10) * More fixes * rename tip to link * Use preverified hashes instead of preverified headers * Fix preverified hashes generation * more parametrisation * Continue parametrisation * Fix grpc data limit, interruption of headers stage * Add ropsten preverified hashes * Typed hashes (#11) * Typed hashes * Fix PeerId * 64-bit tx nonce * Disable penalties * Add goerli settings, bootstrap nodes * Try to fix goerly sync * Remove interfaces * Add proper golang packages, max_block into p2p sentry Status * Prepare for proto overhaul * Squashed 'interfaces/' content from commit ce36053c2 git-subtree-dir: interfaces git-subtree-split: ce36053c24db2f56e48ac752808de60afa1dfb4b * Change EtherReply to address * Adaptations to new types * Switch to new types * Fixes * Fix formatting * Fix lint * Lint fixes, reverse order in types * Fix lint * Fix lint * Fix lint * Fix test * Not supporting eth/66 yet * Fix shutdown * Fix lint * Fix lint * Fix lint * return stopped check Co-authored-by: Artem Vorotnikov <artem@vorotnikov.me> Co-authored-by: b00ris <b00ris@mail.ru> Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com> Co-authored-by: canepat <16927169+canepat@users.noreply.github.com>
2021-03-19 21:24:49 +00:00
p2psentry/sentry.proto \
2021-04-03 03:30:28 +00:00
remote/kv.proto remote/ethbackend.proto \
2021-04-15 10:06:05 +00:00
snapshot_downloader/external_downloader.proto \
consensus_engine/consensus.proto \
testing/testing.proto \
txpool/txpool.proto txpool/mining.proto
2020-04-29 10:51:07 +00:00
prometheus:
2020-08-01 15:05:48 +00:00
docker-compose up prometheus grafana
escape:
2020-06-15 16:39:34 +00:00
cd $(path) && go test -gcflags "-m -m" -run none -bench=BenchmarkJumpdest* -benchmem -memprofile mem.out