From 1c05d1044397e6095904ce160980c08116409f78 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Fri, 20 Sep 2019 10:58:36 -0400 Subject: [PATCH] Merge PR #134: v2.0.1 RC1 Cherry Picks --- .circleci/config.yml | 411 +++++++++++++++++--------------------- CHANGELOG.md | 6 + Makefile | 21 +- README.md | 2 +- contrib/devtools/Makefile | 25 ++- go.mod | 2 +- go.sum | 11 +- sims.mk | 49 ++--- 8 files changed, 246 insertions(+), 281 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d058ce7fdc..11a66e1fdcf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,198 +1,161 @@ -version: 2 +version: 2.1 -defaults: &linux_defaults - working_directory: /go/src/github.com/cosmos/gaia - docker: - - image: circleci/golang:1.12 - environment: - GO111MODULE: 'on' +executors: + golang: + docker: + - image: circleci/golang:1.13 + working_directory: /go/src/github.com/cosmos/cosmos-sdk + mac: + macos: + xcode: "10.3.0" + working_directory: /Users/distiller/project/src/github.com/cosmos/cosmos-sdk + environment: + GO_VERSION: "1.13" + docs: + docker: + - image: tendermintdev/jq_curl + environment: + AWS_REGION: us-east-1 -############ -# -# Configure macos integration tests - -macos_config: &macos_defaults - macos: - xcode: "10.1.0" - working_directory: /Users/distiller/project/src/github.com/cosmos/cosmos-sdk - environment: - GO_VERSION: "1.12.5" - -set_macos_env: &macos_env - run: - name: Set environment - command: | - echo 'export PATH=$PATH:$HOME/go/bin' >> $BASH_ENV - echo 'export GOPATH=$HOME/project' >> $BASH_ENV - echo 'export PATH=$PATH:$HOME/go/bin:$GOPATH/bin' >> $BASH_ENV - echo 'export GO111MODULE=on' - -############ -# -# Configure docs deployment - -docs_update: &docs_deploy - working_directory: ~/repo - docker: - - image: tendermintdev/jq_curl - environment: - AWS_REGION: us-east-1 - -jobs: - setup_dependencies: - <<: *linux_defaults +commands: + make: + parameters: + description: + type: string + target: + type: string steps: - - run: mkdir -p /tmp/workspace/bin - - run: mkdir -p /tmp/workspace/profiles + - attach_workspace: + at: /tmp/bin + - restore_cache: + name: "Restore source code cache" + keys: + - go-src-v1-{{ .Revision }} - checkout - restore_cache: + name: "Restore go modules cache" keys: - go-mod-v1-{{ checksum "go.sum" }} - run: - name: binaries + name: << parameters.description >> command: | - export PATH=/tmp/workspace/bin:$PATH - make go-mod-cache - make install - - save_cache: - key: go-mod-v1-{{ checksum "go.sum" }} - paths: - - "/go/pkg/mod" + export BINDIR=/tmp/bin + make << parameters.target >> + mac_set_env: + steps: - run: - name: tools + name: "Set environment" command: | - make tools TOOLS_DESTDIR=/tmp/workspace/bin - cp $GOPATH/bin/runsim /tmp/workspace/bin/ - - persist_to_workspace: - root: /tmp/workspace - paths: - - bin - - profiles + echo 'export PATH=$PATH:$HOME/go/bin' >> $BASH_ENV + echo 'export GOPATH=$HOME/project' >> $BASH_ENV + echo 'export PATH=$PATH:$HOME/go/bin:$GOPATH/bin' >> $BASH_ENV + echo 'export GO111MODULE=on' - integration_tests: - <<: *linux_defaults - parallelism: 1 +jobs: + setup-dependencies: + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - checkout - restore_cache: + name: "Restore go modules cache" keys: - go-mod-v1-{{ checksum "go.sum" }} - run: - name: Test cli + name: Cache go modules + command: make go-mod-cache + - run: + name: Build + command: make build + - run: + name: "Git garbage collection" + command: git gc + - run: + name: "Build tools binaries" command: | - export BUILDDIR=`pwd`/build - make check-build - - test_sim_gaia_nondeterminism: - <<: *linux_defaults - parallelism: 1 - steps: - - attach_workspace: - at: /tmp/workspace - - checkout - - restore_cache: - keys: - - go-mod-v1-{{ checksum "go.sum" }} + make tools + - save_cache: + name: "Save go modules cache" + key: go-mod-v1-{{ checksum "go.sum" }} + paths: + - "/go/pkg/mod" + - save_cache: + name: "Save source code cache" + key: go-src-v1-{{ .Revision }} + paths: + - ".git" - run: - name: Test individual module simulations command: | - make sim-gaia-nondeterminism + mkdir -p /tmp/bin + cp -r /go/bin/* /tmp/bin + - persist_to_workspace: + root: "/tmp/bin" + paths: + - "." - test_sim_gaia_fast: - <<: *linux_defaults - parallelism: 1 + test-sim-nondeterminism: + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - - checkout - - restore_cache: - keys: - - go-mod-v1-{{ checksum "go.sum" }} - - run: - name: Test full Gaia simulation - command: | - make sim-gaia-fast + - make: + target: test-sim-nondeterminism + description: "Test Gaia non-determinism simulations" - test_sim_gaia_import_export: - <<: *linux_defaults - parallelism: 1 + test-sim-import-export: + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - - checkout - - restore_cache: - keys: - - go-mod-v1-{{ checksum "go.sum" }} - - run: - name: Test Gaia import/export simulation - command: | - /tmp/workspace/bin/runsim -j 4 github.com/cosmos/gaia/app 50 5 TestGaiaImportExport + - make: + target: test-sim-import-export + description: "Test Gaia import/export simulation" - test_sim_gaia_simulation_after_import: - <<: *linux_defaults - parallelism: 1 + test-sim-after-import: + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - - checkout - - restore_cache: - keys: - - go-mod-v1-{{ checksum "go.sum" }} - - run: - name: Test Gaia import/export simulation - command: | - /tmp/workspace/bin/runsim -j 4 github.com/cosmos/gaia/app 50 5 TestGaiaSimulationAfterImport + - make: + target: test-sim-after-import + description: "Test Gaia simulation after importing state" - test_sim_gaia_multi_seed_long: - <<: *linux_defaults - parallelism: 1 + test-sim-multi-seed-short: + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - - checkout - - restore_cache: - keys: - - go-mod-v1-{{ checksum "go.sum" }} - - run: - name: Test multi-seed Gaia simulation long - command: | - /tmp/workspace/bin/runsim -j 4 github.com/cosmos/gaia/app 500 50 TestFullGaiaSimulation + - make: + target: test-sim-multi-seed-short + description: "Test Gaia multi-seed simulation (short-lived)" - test_sim_gaia_multi_seed: - <<: *linux_defaults - parallelism: 1 + test-sim-multi-seed-long: + executor: golang + steps: + - make: + target: test-sim-multi-seed-long + description: "Test Gaia multi-seed simulation (long-lived)" + + integration-tests: + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - checkout - restore_cache: keys: - go-mod-v1-{{ checksum "go.sum" }} - run: - name: Test multi-seed Gaia simulation short + name: Test CLI integration command: | - /tmp/workspace/bin/runsim -j 4 github.com/cosmos/gaia/app 50 10 TestFullGaiaSimulation + export BUILDDIR=`pwd`/build + make test-build - test_cover: - <<: *linux_defaults + test-cover: + executor: golang parallelism: 4 steps: - - attach_workspace: - at: /tmp/workspace - checkout - - run: mkdir -p /tmp/logs - restore_cache: keys: - go-mod-v1-{{ checksum "go.sum" }} - run: - name: Run tests + name: Run tests with coverage command: | export VERSION="$(git describe --tags --long | sed 's/v\(.*\)/\1/')" export GO111MODULE=on - for pkg in $(go list ./... | grep -v github.com/cosmos/gaia/cli_test | grep -v '/simulation' | circleci tests split --split-by=timings); do + mkdir -p /tmp/logs /tmp/workspace/profiles + for pkg in $(go list ./... | grep -v '/simulation' | circleci tests split); do id=$(echo "$pkg" | sed 's|[/.]|_|g') go test -mod=readonly -timeout 8m -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic -tags='ledger test_ledger_mock' "$pkg" | tee "/tmp/logs/$id-$RANDOM.log" done @@ -203,9 +166,8 @@ jobs: - store_artifacts: path: /tmp/logs - upload_coverage: - <<: *linux_defaults - parallelism: 1 + upload-coverage: + executor: golang steps: - attach_workspace: at: /tmp/workspace @@ -224,44 +186,45 @@ jobs: - run: name: filter out DONTCOVER command: | - excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER' | xargs realpath --relative-to=$GOPATH/src)" + excludelist="$(find . -type f -name '*.go' | xargs grep -l 'DONTCOVER')" for filename in ${excludelist}; do - echo "Excluding ${filename} ..." - sed -i "\%${filename}:%d" coverage.txt + filename=$(echo $filename | sed 's/^./github.com\/cosmos\/gaia/g') + echo "Excluding ${filename} from coverage report..." + sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt done - run: name: upload command: bash <(curl -s https://codecov.io/bash) -f coverage.txt localnet: - working_directory: /home/circleci/.go_workspace/src/github.com/cosmos/cosmos-sdk - machine: - image: circleci/classic:latest - environment: - GOPATH: /home/circleci/.go_workspace/ - GOOS: linux - GOARCH: amd64 - GO_VERSION: "1.12.5" - parallelism: 1 - steps: - - checkout - - run: - name: run localnet and exit on failure - command: | - pushd /tmp - wget https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz - sudo tar -xvf go$GO_VERSION.linux-amd64.tar.gz - sudo rm -rf /usr/local/go - sudo mv go /usr/local - popd - set -x - make tools - make build-linux - make localnet-start - ./contrib/localnet-blocks-test.sh 40 5 10 localhost + working_directory: /home/circleci/.go_workspace/src/github.com/cosmos/gaia + machine: + image: circleci/classic:latest + environment: + GOPATH: /home/circleci/.go_workspace/ + GOOS: linux + GOARCH: amd64 + GO_VERSION: "1.13" + parallelism: 1 + steps: + - checkout + - run: + name: run localnet and exit on failure + command: | + pushd /tmp + wget https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz + sudo tar -xvf go$GO_VERSION.linux-amd64.tar.gz + sudo rm -rf /usr/local/go + sudo mv go /usr/local + popd + set -x + make tools + make build-linux + make localnet-start + ./contrib/localnet-blocks-test.sh 40 5 10 localhost - deploy_docs: - <<: *docs_deploy + deploy-docs: + executor: docs steps: - checkout - run: @@ -284,10 +247,10 @@ jobs: echo "Website build started" fi - macos_ci: - <<: *macos_defaults + macos-ci: + executor: mac steps: - - *macos_env + - mac_set_env - run: name: Install go command: | @@ -305,17 +268,16 @@ jobs: make install - run: name: Integration tests - command: - source $BASH_ENV - make check-build + command: source $BASH_ENV + make test-build - run: name: Test full gaia simulation command: | source $BASH_ENV make sim-gaia-fast - docker_image: - <<: *linux_defaults + docker-image: + executor: golang steps: - attach_workspace: at: /tmp/workspace @@ -333,12 +295,12 @@ jobs: docker build . else docker build -t tendermint/gaia:$GAIAD_VERSION . - docker login --password-stdin -u $DOCKER_USER <<<$DOCKER_PASS + docker login --password-stdin -u $DOCKER_USER \<<<$DOCKER_PASS docker push tendermint/gaia:$GAIAD_VERSION fi - docker_tagged: - <<: *linux_defaults + docker-tagged: + executor: golang steps: - attach_workspace: at: /tmp/workspace @@ -347,11 +309,11 @@ jobs: docker_layer_caching: true - run: | docker build -t tendermint/gaia:$CIRCLE_TAG . - docker login --password-stdin -u $DOCKER_USER <<<$DOCKER_PASS + docker login --password-stdin -u $DOCKER_USER \<<$DOCKER_PASS docker push tendermint/gaia:$CIRCLE_TAG - reproducible_builds: - <<: *linux_defaults + reproducible-builds: + executor: golang steps: - attach_workspace: at: /tmp/workspace @@ -379,7 +341,7 @@ jobs: # overrides the .gaiad directory. # # contract_tests: -# <<: *linux_defaults +# executor: golang # steps: # - attach_workspace: # at: /tmp/workspace @@ -400,10 +362,10 @@ workflows: version: 2 test-suite: jobs: - - docker_image: + - docker-image: requires: - - setup_dependencies - - docker_tagged: + - setup-dependencies + - docker-tagged: filters: tags: only: @@ -412,65 +374,64 @@ workflows: ignore: - /.*/ requires: - - setup_dependencies - - macos_ci: + - setup-dependencies + - macos-ci: filters: branches: only: - master - develop - - deploy_docs: + - deploy-docs: filters: branches: only: - master - develop - - setup_dependencies: + - setup-dependencies: # filters here are needed to enable this job also for tags filters: tags: only: - /^v.*/ - - integration_tests: - requires: - - setup_dependencies - - test_sim_gaia_nondeterminism: + - integration-tests: requires: - - setup_dependencies - - test_sim_gaia_fast: + - setup-dependencies + - test-sim-nondeterminism: requires: - - setup_dependencies - - test_sim_gaia_import_export: + - setup-dependencies + - test-sim-import-export: requires: - - setup_dependencies - - test_sim_gaia_simulation_after_import: + - setup-dependencies + - test-sim-after-import: requires: - - setup_dependencies - - test_sim_gaia_multi_seed: + - setup-dependencies + - test-sim-multi-seed-short: requires: - - setup_dependencies - - test_sim_gaia_multi_seed_long: + - setup-dependencies + - test-sim-multi-seed-long: requires: - - setup_dependencies + - setup-dependencies + # These filters ensure that the long sim only runs during release filters: branches: + ignore: /.*/ + tags: only: - - master - - develop - - test_cover: + - /^v.*/ + - test-cover: requires: - - setup_dependencies + - setup-dependencies - localnet - - upload_coverage: + - upload-coverage: requires: - - test_cover - - reproducible_builds: + - test-cover + - reproducible-builds: filters: branches: only: - master requires: - - setup_dependencies + - setup-dependencies # - contract_tests: # requires: -# - setup_dependencies +# - setup-dependencies diff --git a/CHANGELOG.md b/CHANGELOG.md index 96d557b720d..6780522812b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,8 +37,14 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [v2.0.1] - 2019-09-19 +### Features + +* (gaiad) [\#119](https://github.com/cosmos/gaia/pull/119) Add support for the `--halt-time` CLI flag and configuration. + ### Improvements +* [\#119](https://github.com/cosmos/gaia/pull/119) Refactor and upgrade Circle CI +configuration. * (sdk) Update SDK version to v0.37.1 ## [v2.0.0] - 2019-08-22 diff --git a/Makefile b/Makefile index 6ad33fa5990..0df09ade34e 100644 --- a/Makefile +++ b/Makefile @@ -86,15 +86,13 @@ else go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests ./cmd/contract_tests endif -install: go.sum check-ledger +install: go.sum go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiad go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiacli install-debug: go.sum go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiadebug - - ######################################## ### Tools & dependencies @@ -121,19 +119,19 @@ distclean: clean ### Testing -check: check-unit check-build -check-all: check check-race check-cover +test: test-unit test-build +test-all: check test-race test-cover -check-unit: +test-unit: @VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock' ./... -check-race: +test-race: @VERSION=$(VERSION) go test -mod=readonly -race -tags='ledger test_ledger_mock' ./... -check-cover: +test-cover: @go test -mod=readonly -timeout 30m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock' ./... -check-build: build +test-build: build @go test -mod=readonly -p 4 `go list ./cli_test/...` -tags=cli_test -v @@ -158,7 +156,7 @@ build-docker-gaiadnode: $(MAKE) -C networks/local # Run a 4-node testnet locally -localnet-start: localnet-stop +localnet-start: build-linux localnet-stop @if ! [ -f build/node0/gaiad/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/gaiad:Z tendermint/gaiadnode testnet --v 4 -o . --starting-ip-address 192.168.10.2 ; fi docker-compose up -d @@ -195,5 +193,4 @@ include sims.mk .PHONY: all build-linux install install-debug \ go-mod-cache draw-deps clean build \ setup-transactions setup-contract-tests-data start-gaia run-lcd-contract-tests contract-tests \ - check check-all check-build check-cover check-ledger check-unit check-race - + test test-all test-build test-cover test-unit test-race diff --git a/README.md b/README.md index 3c2b82021f4..ca6dd6a8d06 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This repository hosts `Gaia`, the first implementation of the Cosmos Hub. -**Note**: Requires [Go 1.12+](https://golang.org/dl/) +**Note**: Requires [Go 1.13+](https://golang.org/dl/) **DISCLAIMER**: The current version of Gaia running the Cosmos Hub (v0.34.x) is __NOT__ maintained in this repository. Gaia and the [Cosmos SDK](https://github.com/cosmos/cosmos-sdk/) diff --git a/contrib/devtools/Makefile b/contrib/devtools/Makefile index a5a8c5ef8f6..3dad272dc8a 100644 --- a/contrib/devtools/Makefile +++ b/contrib/devtools/Makefile @@ -43,10 +43,8 @@ mkfile_dir := $(shell cd $(shell dirname $(mkfile_path)); pwd) ### TOOLS_DESTDIR ?= $(GOPATH)/bin - -GOLANGCI_LINT = $(TOOLS_DESTDIR)/golangci-lint -GOIMPORTS = $(TOOLS_DESTDIR)/goimports -RUNSIM = $(TOOLS_DESTDIR)/runsim +GOLANGCI_LINT = $(TOOLS_DESTDIR)/golangci-lint +RUNSIM = $(TOOLS_DESTDIR)/runsim all: tools @@ -55,18 +53,23 @@ tools-stamp: $(GOIMPORTS) $(RUNSIM) touch $@ $(GOLANGCI_LINT): $(mkfile_dir)/install-golangci-lint.sh - bash $(mkfile_dir)/install-golangci-lint.sh $(TOOLS_DESTDIR) $(GOLANGCI_LINT_VERSION) $(GOLANGCI_LINT_HASHSUM) - -$(GOIMPORTS): - go get golang.org/x/tools/cmd/goimports@v0.0.0-20190628034336-212fb13d595e - + @echo "Installing golangci-lint..." + @bash $(mkfile_dir)/install-golangci-lint.sh $(TOOLS_DESTDIR) $(GOLANGCI_LINT_VERSION) $(GOLANGCI_LINT_HASHSUM) + +# Install the runsim binary with a temporary workaround of entering an outside +# directory as the "go get" command ignores the -mod option and will polute the +# go.{mod, sum} files. +# +# ref: https://github.com/golang/go/issues/30515 $(RUNSIM): - go get github.com/cosmos/tools/cmd/runsim/ + @echo "Installing runsim..." + @(cd /tmp && go get github.com/cosmos/tools/cmd/runsim@v1.0.0) golangci-lint: $(GOLANGCI_LINT) tools-clean: - rm -f $(GOIMPORTS) $(GOLANGCI_LINT) + rm -f $(GOLANGCI_LINT) + rm -f $(RUNSIM) rm -f tools-stamp .PHONY: all tools tools-clean diff --git a/go.mod b/go.mod index 3794501aa7b..3f3d7763a46 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/mattn/go-isatty v0.0.8 // indirect github.com/onsi/ginkgo v1.8.0 // indirect github.com/onsi/gomega v1.5.0 // indirect - github.com/otiai10/copy v1.0.1 + github.com/otiai10/copy v1.0.2 github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776 // indirect github.com/pelletier/go-toml v1.4.0 // indirect github.com/pkg/errors v0.8.1 diff --git a/go.sum b/go.sum index 93291200727..a44d673b3e1 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,3 @@ -bou.ke/monkey v1.0.1 h1:zEMLInw9xvNakzUUPjfS4Ds6jYPqCFx3m7bRmG5NH2U= bou.ke/monkey v1.0.1/go.mod h1:FgHuK96Rv2Nlf+0u1OOVDpCMdsWyOFmeeketDHE7LIg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= @@ -104,7 +103,6 @@ github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -159,14 +157,14 @@ github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/otiai10/copy v1.0.1 h1:gtBjD8aq4nychvRZ2CyJvFWAw0aja+VHazDdruZKGZA= -github.com/otiai10/copy v1.0.1/go.mod h1:8bMCJrAqOtN/d9oyh5HR7HhLQMvcGMpGdwRDYsfOCHc= +github.com/otiai10/copy v1.0.2 h1:DDNipYy6RkIkjMwy+AWzgKiNTyj2RUI9yEMeETEpVyc= +github.com/otiai10/copy v1.0.2/go.mod h1:c7RpqBkwMom4bYTSkLSym4VSJz/XtncWRAj/J4PEIMY= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776 h1:o59bHXu8Ejas8Kq6pjoVJQ9/neN66SM8AKh6wI42BBs= github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776/go.mod h1:3HNVkVOU7vZeFXocWuvtcS0XSFLcf2XUSDHkq9t1jU4= -github.com/otiai10/mint v1.2.3/go.mod h1:YnfyPNhBvnY8bW4SGQHCs/aAFhkgySlMZbrF5U0bOVw= -github.com/otiai10/mint v1.2.4 h1:DxYL0itZyPaR5Z9HILdxSoHx+gNs6Yx+neOGS3IVUk0= github.com/otiai10/mint v1.2.4/go.mod h1:d+b7n/0R3tdyUYYylALXpWQ/kTN+QobSq/4SRGBkR3M= +github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc= +github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= @@ -253,7 +251,6 @@ github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJk github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU= github.com/tendermint/tendermint v0.32.3 h1:GEnWpGQ795h5oTFNbfBLsY0LW/CW2j6p6HtiYNfxsgg= github.com/tendermint/tendermint v0.32.3/go.mod h1:ZK2c29jl1QRYznIRyRWRDsmm1yvtPzBRT00x4t1JToY= -github.com/tendermint/tm-db v0.1.1 h1:G3Xezy3sOk9+ekhjZ/kjArYIs1SmwV+1OUgNkj7RgV0= github.com/tendermint/tm-db v0.1.1/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw= github.com/tendermint/tm-db v0.2.0 h1:rJxgdqn6fIiVJZy4zLpY1qVlyD0TU6vhkT4kEf71TQQ= github.com/tendermint/tm-db v0.2.0/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw= diff --git a/sims.mk b/sims.mk index adea39e9098..70e094833f9 100644 --- a/sims.mk +++ b/sims.mk @@ -3,41 +3,42 @@ ######################################## ### Simulations +BINDIR ?= $(GOPATH)/bin SIMAPP = github.com/cosmos/gaia/app -sim-gaia-nondeterminism: - @echo "Running nondeterminism test..." +test-sim-nondeterminism: + @echo "Running non-determinism test..." @go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \ - -NumBlocks=100 -BlockSize=200 -Commit=true -v -timeout 24h + -NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h -sim-gaia-custom-genesis-fast: +test-sim-custom-genesis-fast: @echo "Running custom genesis simulation..." @echo "By default, ${HOME}/.gaiad/config/genesis.json will be used." @go test -mod=readonly $(SIMAPP) -run TestFullGaiaSimulation -Genesis=${HOME}/.gaiad/config/genesis.json \ -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h -sim-gaia-fast: - @echo "Running quick Gaia simulation. This may take several minutes..." - @go test -mod=readonly $(SIMAPP) -run TestFullGaiaSimulation -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h - -sim-gaia-import-export: runsim +test-sim-import-export: runsim @echo "Running Gaia import/export simulation. This may take several minutes..." - $(GOPATH)/bin/runsim $(SIMAPP) 25 5 TestGaiaImportExport + @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestGaiaImportExport -sim-gaia-simulation-after-import: runsim +test-sim-after-import: runsim @echo "Running Gaia simulation-after-import. This may take several minutes..." - $(GOPATH)/bin/runsim $(SIMAPP) 25 5 TestGaiaSimulationAfterImport + @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestGaiaSimulationAfterImport -sim-gaia-custom-genesis-multi-seed: runsim +test-sim-custom-genesis-multi-seed: runsim @echo "Running multi-seed custom genesis simulation..." @echo "By default, ${HOME}/.gaiad/config/genesis.json will be used." - $(GOPATH)/bin/runsim $(SIMAPP) -g ${HOME}/.gaiad/config/genesis.json 400 5 TestFullGaiaSimulation + @$(BINDIR)/runsim -Jobs=4 -Genesis=${HOME}/.gaiad/config/genesis.json 400 5 TestFullGaiaSimulation + +test-sim-multi-seed-long: runsim + @echo "Running multi-seed application simulation. This may take awhile!" + @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 500 50 TestFullAppSimulation -sim-gaia-multi-seed: runsim - @echo "Running multi-seed Gaia simulation. This may take awhile!" - $(GOPATH)/bin/runsim $(SIMAPP) 400 5 TestFullGaiaSimulation +test-sim-multi-seed-short: runsim + @echo "Running multi-seed application simulation. This may take awhile!" + @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 50 10 TestFullAppSimulation -sim-benchmark-invariants: +test-sim-benchmark-invariants: @echo "Running simulation invariant benchmarks..." @go test -mod=readonly $(SIMAPP) -benchmem -bench=BenchmarkInvariants -run=^$ \ -Enabled=true -NumBlocks=1000 -BlockSize=200 \ @@ -46,17 +47,17 @@ sim-benchmark-invariants: SIM_NUM_BLOCKS ?= 500 SIM_BLOCK_SIZE ?= 200 SIM_COMMIT ?= true -sim-gaia-benchmark: + +test-sim-gaia-benchmark: @echo "Running Gaia benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" @go test -mod=readonly -benchmem -run=^$$ $(SIMAPP) -bench ^BenchmarkFullGaiaSimulation$$ \ -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h -sim-gaia-profile: +test-sim-gaia-profile: @echo "Running Gaia benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" @go test -mod=readonly -benchmem -run=^$$ $(SIMAPP) -bench ^BenchmarkFullGaiaSimulation$$ \ -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h -cpuprofile cpu.out -memprofile mem.out - -.PHONY: runsim sim-gaia-nondeterminism sim-gaia-custom-genesis-fast sim-gaia-fast sim-gaia-import-export \ - sim-gaia-simulation-after-import sim-gaia-custom-genesis-multi-seed sim-gaia-multi-seed \ - sim-benchmark-invariants sim-gaia-benchmark sim-gaia-profile +.PHONY: runsim test-sim-gaia-nondeterminism test-sim-gaia-custom-genesis-fast test-sim-gaia-fast sim-gaia-import-export \ + test-sim-gaia-simulation-after-import test-sim-gaia-custom-genesis-multi-seed test-sim-gaia-multi-seed \ + test-sim-benchmark-invariants test-sim-gaia-benchmark test-sim-gaia-profile