-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a56f6cc
commit e437a96
Showing
614 changed files
with
257,645 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,258 @@ | ||
PACKAGES=$(shell go list ./... | grep -v '/simulation') | ||
PACKAGE_NAME:=github.com/vidulum/testvidulum | ||
GOLANG_CROSS_VERSION = v1.16.7 | ||
|
||
|
||
VERSION := $(shell echo $(shell git describe --tags 2>/dev/null ) | sed 's/^v//') | ||
COMMIT := $(shell git log -1 --format='%H') | ||
NETWORK ?= mainnet | ||
COVERAGE ?= coverage.txt | ||
BUILDDIR ?= $(CURDIR)/build | ||
LEDGER_ENABLED ?= true | ||
|
||
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=testvidulum-1 \ | ||
-X github.com/cosmos/cosmos-sdk/version.ServerName=testvidulumd \ | ||
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ | ||
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) | ||
|
||
BUILD_FLAGS := -ldflags '$(ldflags)' | ||
TESTNET_FLAGS ?= | ||
|
||
ledger ?= HID | ||
ifeq ($(LEDGER_ENABLED),true) | ||
BUILD_TAGS := -tags cgo,ledger,!test_ledger_mock,!ledger_mock | ||
ifeq ($(ledger), ZEMU) | ||
BUILD_TAGS := $(BUILD_TAGS),ledger_zemu | ||
else | ||
BUILD_TAGS := $(BUILD_TAGS),!ledger_zemu | ||
endif | ||
endif | ||
|
||
ifeq ($(NETWORK),testnet) | ||
BUILD_TAGS := $(BUILD_TAGS),testnet | ||
TEST_TAGS := "--tags=testnet" | ||
endif | ||
|
||
SIMAPP = github.com/vidulum/testvidulum/v1/app | ||
BINDIR ?= ~/go/bin | ||
|
||
OS := $(shell uname) | ||
|
||
all: download install | ||
|
||
download: | ||
git submodule update --init --recursive | ||
|
||
install: check-network go.sum | ||
go install -mod=readonly $(BUILD_FLAGS) $(BUILD_TAGS) ./cmd/testvidulumd | ||
|
||
build: check-network go.sum | ||
go build -mod=readonly $(BUILD_FLAGS) $(BUILD_TAGS) -o $(BUILDDIR)/testvidulumd ./cmd/testvidulumd | ||
|
||
buildwindows: check-network go.sum | ||
go build -buildmode=exe -mod=readonly $(BUILD_FLAGS) $(BUILD_TAGS) -o $(BUILDDIR)/testvidulumd.exe ./cmd/testvidulumd | ||
|
||
|
||
.PHONY: build | ||
|
||
build-linux: go.sum | ||
ifeq ($(OS), Linux) | ||
GOOS=linux GOARCH=amd64 $(MAKE) build | ||
else | ||
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build | ||
endif | ||
|
||
build-mac: go.sum | ||
ifeq ($(OS), Darwin) | ||
GOOS=darwin GOARCH=amd64 $(MAKE) build | ||
else | ||
LEDGER_ENABLED=false GOOS=darwin GOARCH=amd64 $(MAKE) build | ||
endif | ||
|
||
go.sum: go.mod | ||
@echo "--> Ensure dependencies have not been modified" | ||
GO111MODULE=on go mod verify | ||
|
||
test: check-network | ||
@go test $(TEST_TAGS) -v -mod=readonly $(PACKAGES) -coverprofile=$(COVERAGE) -covermode=atomic | ||
.PHONY: test | ||
|
||
# look into .golangci.yml for enabling / disabling linters | ||
lint: | ||
@echo "--> Running linter" | ||
@golangci-lint run | ||
@go mod verify | ||
@flake8 --show-source --count --statistics | ||
@find . -name "*.nix" -type f | xargs nixpkgs-fmt --check | ||
|
||
# a trick to make all the lint commands execute, return error when at least one fails. | ||
# golangci-lint is run in standalone job in ci | ||
lint-ci: | ||
@echo "--> Running linter for CI" | ||
@nix run -f ./. lint-env -c lint-ci | ||
|
||
test-sim-nondeterminism: check-network | ||
@echo "Running non-determinism test..." | ||
@go test $(TEST_TAGS) -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \ | ||
-NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h | ||
|
||
test-sim-custom-genesis-fast: check-network | ||
@echo "Running custom genesis simulation..." | ||
@echo "By default, ${HOME}/.testvidulum/config/genesis.json will be used." | ||
@go test $(TEST_TAGS) -mod=readonly $(SIMAPP) -run TestFullAppSimulation -Genesis=${HOME}/.testvidulum/config/genesis.json \ | ||
-Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h | ||
|
||
test-sim-import-export: | ||
@echo "Running Chain import/export simulation. This may take several minutes..." | ||
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestAppImportExport | ||
|
||
test-sim-after-import: | ||
@echo "Running application simulation-after-import. This may take several minutes..." | ||
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 50 5 TestAppSimulationAfterImport | ||
|
||
############################################################################### | ||
### Localnet ### | ||
############################################################################### | ||
|
||
build-docker-testvidulumdnode: | ||
$(MAKE) -C check-networks/local | ||
|
||
# Run a 4-node testnet locally | ||
localnet-start: build-linux build-docker-testvidulumdnode localnet-stop | ||
@if ! [ -f $(BUILDDIR)/node0/.testvidulum/config/genesis.json ]; \ | ||
then docker run --rm -v $(BUILDDIR):/testvidulumd:Z vidulum/testvidulumdnode testnet --v 4 -o . --starting-ip-address 192.168.10.2 $(TESTNET_FLAGS); \ | ||
fi | ||
BUILDDIR=$(BUILDDIR) docker-compose up -d | ||
|
||
# Stop testnet | ||
localnet-stop: | ||
docker-compose down | ||
docker check-network prune -f | ||
|
||
# local build pystarport | ||
build-pystarport: | ||
pip install ./pystarport | ||
|
||
# Run a local testnet by pystarport | ||
localnet-pystartport: build-pystarport | ||
pystarport serve | ||
|
||
clean: | ||
rm -rf $(BUILDDIR)/ | ||
|
||
clean-docker-compose: localnet-stop | ||
rm -rf $(BUILDDIR)/node* $(BUILDDIR)/gentxs | ||
|
||
create-systemd: | ||
./networks/create-service.sh | ||
|
||
make-proto: | ||
./makeproto.sh | ||
############################################################################### | ||
### Nix ### | ||
############################################################################### | ||
# nix installation: https://nixos.org/download.html | ||
nix-integration-test: check-network make-proto | ||
nix run -f ./default.nix run-integration-tests -c run-integration-tests | ||
|
||
nix-integration-test-upgrade: check-network | ||
nix run -f ./default.nix run-integration-tests -c run-integration-tests "pytest -v -m upgrade" | ||
|
||
nix-integration-test-ledger: check-network | ||
nix run -f ./default.nix run-integration-tests-zemu -c run-integration-tests "pytest -v -m ledger" | ||
|
||
nix-integration-test-slow: check-network | ||
nix run -f ./default.nix run-integration-tests -c run-integration-tests "pytest -v -m slow" | ||
|
||
nix-integration-test-ibc: check-network | ||
nix run -f ./default.nix run-integration-tests -c run-integration-tests "pytest -v -m ibc" | ||
|
||
nix-integration-test-byzantine: check-network | ||
nix run -f ./default.nix run-integration-tests -c run-integration-tests "pytest -v -m byzantine" | ||
|
||
nix-integration-test-gov: check-network | ||
nix run -f ./default.nix run-integration-tests -c run-integration-tests "pytest -v -m gov" | ||
|
||
nix-integration-test-grpc: check-network make-proto | ||
nix run -f ./default.nix run-integration-tests -c run-integration-tests "pytest -v -m grpc" | ||
|
||
nix-integration-test-all: check-network make-proto | ||
nix run -f ./default.nix run-integration-tests -c run-integration-tests "pytest -v" | ||
|
||
|
||
nix-build-%: check-network check-os | ||
@if [ -e ~/.nix/remote-build-env ]; then \ | ||
. ~/.nix/remote-build-env; \ | ||
fi && \ | ||
nix-build -o $* -A $* docker.nix; | ||
docker load < $*; | ||
|
||
chaindImage: nix-build-chaindImage | ||
pystarportImage: nix-build-pystarportImage | ||
|
||
check-network: | ||
ifeq ($(NETWORK),mainnet) | ||
else ifeq ($(NETWORK),testnet) | ||
else | ||
@echo "Unrecognized network: ${NETWORK}" | ||
endif | ||
@echo "building network: ${NETWORK}" | ||
|
||
check-os: | ||
ifeq ($(OS), Darwin) | ||
ifneq ("$(wildcard ~/.nix/remote-build-env))","") | ||
@echo "installed nix-remote-builder before" && \ | ||
docker run --restart always --name nix-docker -d -p 3022:22 lnl7/nix:ssh 2> /dev/null || echo "nix-docker is already running" | ||
else | ||
@echo install nix-remote-builder | ||
git clone https://github.com/holidaycheck/nix-remote-builder.git | ||
cd nix-remote-builder && ./init.sh | ||
rm -rf nix-remote-builder | ||
endif | ||
endif | ||
|
||
############################################################################### | ||
### Release ### | ||
############################################################################### | ||
.PHONY: release-dry-run | ||
release-dry-run: | ||
docker run \ | ||
--rm \ | ||
--privileged \ | ||
-e CGO_ENABLED=1 \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v `pwd`:/go/src/$(PACKAGE_NAME) \ | ||
-v ${GOPATH}/pkg:/go/pkg \ | ||
-w /go/src/$(PACKAGE_NAME) \ | ||
troian/golang-cross:${GOLANG_CROSS_VERSION} \ | ||
--rm-dist --skip-validate --skip-publish | ||
|
||
.PHONY: release | ||
release: | ||
@if [ ! -f ".release-env" ]; then \ | ||
echo "\033[91m.release-env is required for release\033[0m";\ | ||
exit 1;\ | ||
fi | ||
docker run \ | ||
--rm \ | ||
--privileged \ | ||
-e CGO_ENABLED=1 \ | ||
--env-file .release-env \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v `pwd`:/go/src/$(PACKAGE_NAME) \ | ||
-w /go/src/$(PACKAGE_NAME) \ | ||
troian/golang-cross:${GOLANG_CROSS_VERSION} \ | ||
release --rm-dist --skip-validate | ||
|
||
############################################################################### | ||
### Documentation ### | ||
############################################################################### | ||
|
||
# generate api swagger document | ||
document: | ||
make all -f MakefileDoc | ||
|
||
# generate protobuf files | ||
# ./proto -> ./x | ||
proto-all: | ||
make proto-all -f MakefileDoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
# testvidulum | ||
# testvidulum | ||
|
||
**testvidulum** is a blockchain built using Cosmos SDK and Tendermint and created with [Starport](https://github.com/tendermint/starport). | ||
|
||
## Get started | ||
|
||
## Release | ||
|
||
To release a new version of your blockchain, create and push a new tag with `v` prefix. A new draft release with the configured targets will be created. | ||
|
||
``` | ||
git tag v0.1 | ||
git push origin v0.1 | ||
``` | ||
|
||
After a draft release is created, make your final changes from the release page and publish it. | ||
|
||
### Install | ||
|
||
To install the latest version of your blockchain node's binary, execute the following command on your machine: | ||
|
||
``` | ||
curl https://get.starport.network/vidulum/testvidulum@latest! | sudo bash | ||
``` | ||
|
||
`vidulum/testvidulum` should match the `username` and `repo_name` of the Github repository to which the source code was pushed. Learn more about [the install process](https://github.com/allinbits/starport-installer). | ||
|
||
## Learn more | ||
|
||
- [Starport](https://github.com/tendermint/starport) | ||
- [Starport Docs](https://docs.starport.network) | ||
- [Cosmos SDK documentation](https://docs.cosmos.network) | ||
- [Cosmos SDK Tutorials](https://tutorials.cosmos.network) | ||
- [Discord](https://discord.gg/cosmosnetwork) |
Oops, something went wrong.