This repository has been archived by the owner on Nov 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 160
Local Testnet command #378
Merged
Merged
Changes from 42 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
f481ff6
evm: fix non-determinism
fedekunze e139d96
fixes
fedekunze 9601ed1
typo
fedekunze 1a5991c
Merge branch 'development' of github.com:ChainSafe/ethermint into fix…
fedekunze a64afb6
fix tests
fedekunze cacc374
local testnet command
fedekunze 9d35880
fix testnet cmd (#383)
776fc27
merge development
fedekunze 8f4fc91
Merge branch 'fix-non-determinism' of github.com:ChainSafe/ethermint …
fedekunze f50b833
Merge branch 'testnet' of github.com:ChainSafe/ethermint into testnet
fedekunze f21b88e
fixes
fedekunze c36f498
update docker
fedekunze caa492a
merge development
fedekunze 3e1b09b
minor changes
fedekunze b4c20e1
fix build-docker-local-ethermint
fedekunze f004dc9
fix dockerfile
fedekunze 0392949
update Makefile
fedekunze cf3d14a
update denoms
fedekunze 0495592
update genesis file
fedekunze 1fc38d6
Merge branch 'development' of github.com:ChainSafe/ethermint into tes…
fedekunze b8545e6
Merge branch 'development' into testnet
fedekunze a22f4bb
Merge branch 'testnet' of github.com:ChainSafe/ethermint into testnet
fedekunze ab6c564
update makefile
fedekunze 592dde7
fix docker-compose.yml images
fedekunze de3f05d
fix localnet execution (#398)
alessio ff3060c
Merge branch 'development' into testnet
fedekunze 81e95cd
fix conflicts
fedekunze 184c9ab
finish documentation
fedekunze 505c17b
changelog and comment rpc tests workflow
fedekunze fe11029
update codecov
fedekunze ed72b0d
Merge branch 'development' into testnet
fedekunze 7b573e5
update testnet docs
fedekunze 8efa6ba
Merge branch 'testnet' of github.com:ChainSafe/ethermint into testnet
fedekunze d7bea0d
fix docker-compose execution
fedekunze 79fd45d
update docs
fedekunze a9983c3
fix errors and make testnet work (#403)
araskachoi b7eb14d
Merge branch 'development' into testnet
fedekunze ced5dc9
update entrypoint and docs
araskachoi e196178
fix conflicts
fedekunze 5b3236d
Merge branch 'testnet' of github.com:ChainSafe/ethermint into testnet
fedekunze 43f396e
update logs
fedekunze 1a220c4
try fix rpc
fedekunze 28442ee
build docker image
araskachoi 0d886c5
Merge branch 'testnet' of github.com:ChainSafe/ethermint into testnet
araskachoi 0f776c0
Update Dockerfile
fedekunze File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,30 +1,32 @@ | ||
FROM golang:alpine AS build-env | ||
FROM golang:stretch as build-env | ||
|
||
# Set up dependencies | ||
ENV PACKAGES git build-base | ||
# Install minimum necessary dependencies | ||
ENV PACKAGES curl make git libc-dev bash gcc | ||
RUN apt-get update && apt-get upgrade -y && \ | ||
apt-get install -y $PACKAGES | ||
|
||
# Set working directory for the build | ||
WORKDIR /go/src/github.com/Chainsafe/ethermint | ||
|
||
# Install dependencies | ||
RUN apk add --update $PACKAGES | ||
WORKDIR /go/src/github.com/ChainSafe/ethermint | ||
|
||
# Add source files | ||
COPY . . | ||
|
||
# Make the binary | ||
RUN make build | ||
# build Ethermint | ||
RUN make build-ethermint-linux | ||
|
||
# Final image | ||
FROM alpine | ||
FROM golang:1.14 as final | ||
|
||
WORKDIR / | ||
|
||
# Install ca-certificates | ||
RUN apk add --update ca-certificates | ||
WORKDIR /root | ||
RUN apt-get update | ||
|
||
# Copy over binaries from the build-env | ||
COPY --from=build-env /go/src/github.com/Chainsafe/ethermint/build/emintd /usr/bin/emintd | ||
COPY --from=build-env /go/src/github.com/Chainsafe/ethermint/build/emintcli /usr/bin/emintcli | ||
COPY --from=build-env /go/src/github.com/ChainSafe/ethermint/build/emintd /usr/bin/emintd | ||
COPY --from=build-env /go/src/github.com/ChainSafe/ethermint/build/emintcli /usr/bin/emintcli | ||
COPY --from=build-env /go/src/github.com/ChainSafe/ethermint/scripts/start.sh / | ||
|
||
EXPOSE 26656 26657 1317 8545 | ||
|
||
# Run emintd by default | ||
CMD ["emintd"] | ||
# Run emintd by default, omit entrypoint to ease using container with emintcli | ||
ENTRYPOINT ["/bin/bash", "-c"] |
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 |
---|---|---|
|
@@ -21,27 +21,32 @@ ETHERMINT_DAEMON_BINARY = emintd | |
ETHERMINT_CLI_BINARY = emintcli | ||
GO_MOD=GO111MODULE=on | ||
BINDIR ?= $(GOPATH)/bin | ||
BUILDDIR ?= $(CURDIR)/build | ||
SIMAPP = github.com/cosmos/ethermint/app | ||
RUNSIM = $(BINDIR)/runsim | ||
|
||
all: tools verify install | ||
|
||
####################### | ||
### Build / Install ### | ||
####################### | ||
############################################################################### | ||
### Build ### | ||
############################################################################### | ||
|
||
build: go.sum | ||
go build -mod=readonly ./... | ||
|
||
build-ethermint: go.sum | ||
mkdir -p $(BUILDDIR) | ||
go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR) ./cmd/$(ETHERMINT_DAEMON_BINARY) | ||
go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR) ./cmd/$(ETHERMINT_CLI_BINARY) | ||
|
||
build: | ||
ifeq ($(OS),Windows_NT) | ||
${GO_MOD} go build $(BUILD_FLAGS) -o build/$(ETHERMINT_DAEMON_BINARY).exe ./cmd/emintd | ||
${GO_MOD} go build $(BUILD_FLAGS) -o build/$(ETHERMINT_CLI_BINARY).exe ./cmd/emintcli | ||
else | ||
${GO_MOD} go build $(BUILD_FLAGS) -o build/$(ETHERMINT_DAEMON_BINARY) ./cmd/emintd/ | ||
${GO_MOD} go build $(BUILD_FLAGS) -o build/$(ETHERMINT_CLI_BINARY) ./cmd/emintcli/ | ||
endif | ||
build-ethermint-linux: go.sum | ||
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 $(MAKE) build-ethermint | ||
|
||
.PHONY: build build-ethermint build-ethermint-linux | ||
|
||
install: | ||
${GO_MOD} go install $(BUILD_FLAGS) ./cmd/emintd | ||
${GO_MOD} go install $(BUILD_FLAGS) ./cmd/emintcli | ||
${GO_MOD} go install $(BUILD_FLAGS) ./cmd/$(ETHERMINT_DAEMON_BINARY) | ||
${GO_MOD} go install $(BUILD_FLAGS) ./cmd/$(ETHERMINT_CLI_BINARY) | ||
|
||
clean: | ||
@rm -rf ./build ./vendor | ||
|
@@ -55,31 +60,23 @@ verify: | |
@echo "--> Verifying dependencies have not been modified" | ||
${GO_MOD} go mod verify | ||
|
||
docker: | ||
docker build -t ${DOCKER_IMAGE}:${DOCKER_TAG} . | ||
docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:latest | ||
docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:${COMMIT_HASH} | ||
# update old container | ||
docker rm ethermint | ||
# create a new container from the latest image | ||
docker create --name ethermint -t -i cosmos/ethermint:latest ethermint | ||
# move the binaries to the ./build directory | ||
mkdir -p ./build/ | ||
docker cp ethermint:/usr/bin/emintd ./build/ ; \ | ||
docker cp ethermint:/usr/bin/emintcli ./build/ | ||
Comment on lines
+63
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @araskachoi this could possibly be improved |
||
|
||
############################ | ||
### Tools / Dependencies ### | ||
############################ | ||
|
||
########################################################## | ||
### TODO: Move tool depedencies to a separate makefile ### | ||
########################################################## | ||
|
||
GOLINT = github.com/tendermint/lint/golint | ||
GOCILINT = github.com/golangci/golangci-lint/cmd/golangci-lint | ||
UNCONVERT = github.com/mdempsky/unconvert | ||
INEFFASSIGN = github.com/gordonklaus/ineffassign | ||
MISSPELL = github.com/client9/misspell/cmd/misspell | ||
ERRCHECK = github.com/kisielk/errcheck | ||
UNPARAM = mvdan.cc/unparam | ||
|
||
GOLINT_CHECK := $(shell command -v golint 2> /dev/null) | ||
GOCILINT_CHECK := $(shell command -v golangci-lint 2> /dev/null) | ||
UNCONVERT_CHECK := $(shell command -v unconvert 2> /dev/null) | ||
INEFFASSIGN_CHECK := $(shell command -v ineffassign 2> /dev/null) | ||
MISSPELL_CHECK := $(shell command -v misspell 2> /dev/null) | ||
ERRCHECK_CHECK := $(shell command -v errcheck 2> /dev/null) | ||
UNPARAM_CHECK := $(shell command -v unparam 2> /dev/null) | ||
|
||
############################################################################### | ||
### Tools & Dependencies ### | ||
############################################################################### | ||
|
||
# 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 | ||
|
@@ -91,53 +88,10 @@ $(RUNSIM): | |
@(cd /tmp && go get github.com/cosmos/tools/cmd/runsim@v1.0.0) | ||
|
||
tools: $(RUNSIM) | ||
ifdef GOLINT_CHECK | ||
@echo "Golint is already installed. Run 'make update-tools' to update." | ||
else | ||
@echo "--> Installing golint" | ||
${GO_MOD} go get -v $(GOLINT) | ||
endif | ||
ifdef GOCILINT_CHECK | ||
@echo "golangci-lint is already installed. Run 'make update-tools' to update." | ||
else | ||
@echo "--> Installing golangci-lint" | ||
${GO_MOD} go get -v $(GOCILINT) | ||
endif | ||
ifdef UNCONVERT_CHECK | ||
@echo "Unconvert is already installed. Run 'make update-tools' to update." | ||
else | ||
@echo "--> Installing unconvert" | ||
${GO_MOD} go get -v $(UNCONVERT) | ||
endif | ||
ifdef INEFFASSIGN_CHECK | ||
@echo "Ineffassign is already installed. Run 'make update-tools' to update." | ||
else | ||
@echo "--> Installing ineffassign" | ||
${GO_MOD} go get -v $(INEFFASSIGN) | ||
endif | ||
ifdef MISSPELL_CHECK | ||
@echo "misspell is already installed. Run 'make update-tools' to update." | ||
else | ||
@echo "--> Installing misspell" | ||
${GO_MOD} go get -v $(MISSPELL) | ||
endif | ||
ifdef ERRCHECK_CHECK | ||
@echo "errcheck is already installed. Run 'make update-tools' to update." | ||
else | ||
@echo "--> Installing errcheck" | ||
${GO_MOD} go get -v $(ERRCHECK) | ||
endif | ||
ifdef UNPARAM_CHECK | ||
@echo "unparam is already installed. Run 'make update-tools' to update." | ||
else | ||
@echo "--> Installing unparam" | ||
${GO_MOD} go get -v $(UNPARAM) | ||
endif | ||
|
||
|
||
####################### | ||
### Testing / Misc. ### | ||
####################### | ||
|
||
############################################################################### | ||
### Tests & Simulation ### | ||
############################################################################### | ||
|
||
test: test-unit | ||
|
||
|
@@ -155,15 +109,40 @@ test-import: | |
test-rpc: | ||
./scripts/integration-test-all.sh -q 1 -z 1 -s 2 | ||
|
||
godocs: | ||
@echo "--> Wait a few seconds and visit http://localhost:6060/pkg/github.com/cosmos/ethermint" | ||
godoc -http=:6060 | ||
test-sim-nondeterminism: | ||
@echo "Running non-determinism test..." | ||
@go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \ | ||
-NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h | ||
|
||
docker: | ||
docker build -t ${DOCKER_IMAGE}:${DOCKER_TAG} . | ||
docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:latest | ||
docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:${COMMIT_HASH} | ||
test-sim-custom-genesis-fast: | ||
@echo "Running custom genesis simulation..." | ||
@echo "By default, ${HOME}/.$(ETHERMINT_DAEMON_BINARY)/config/genesis.json will be used." | ||
@go test -mod=readonly $(SIMAPP) -run TestFullAppSimulation -Genesis=${HOME}/.$(ETHERMINT_DAEMON_BINARY)/config/genesis.json \ | ||
-Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h | ||
|
||
test-sim-import-export: runsim | ||
@echo "Running Ethermint import/export simulation. This may take several minutes..." | ||
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestAppImportExport | ||
|
||
test-sim-after-import: runsim | ||
@echo "Running Ethermint simulation-after-import. This may take several minutes..." | ||
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestAppSimulationAfterImport | ||
|
||
test-sim-custom-genesis-multi-seed: runsim | ||
@echo "Running multi-seed custom genesis simulation..." | ||
@echo "By default, ${HOME}/.$(ETHERMINT_DAEMON_BINARY)/config/genesis.json will be used." | ||
@$(BINDIR)/runsim -Jobs=4 -Genesis=${HOME}/.$(ETHERMINT_DAEMON_BINARY)/config/genesis.json 400 5 TestFullAppSimulation | ||
|
||
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 | ||
|
||
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 | ||
|
||
.PHONY: runsim test-sim-nondeterminism test-sim-custom-genesis-fast test-sim-fast sim-import-export \ | ||
test-sim-simulation-after-import test-sim-custom-genesis-multi-seed test-sim-multi-seed | ||
|
||
.PHONY: build install update-tools tools godocs clean format lint \ | ||
test-cli test-race test-unit test test-import | ||
|
@@ -256,50 +235,10 @@ proto-update-deps: | |
|
||
.PHONY: proto-all proto-gen proto-lint proto-check-breaking proto-update-deps | ||
|
||
####################### | ||
### Simulations ### | ||
####################### | ||
|
||
test-sim-nondeterminism: | ||
@echo "Running non-determinism test..." | ||
@go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \ | ||
-NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h | ||
|
||
test-sim-custom-genesis-fast: | ||
@echo "Running custom genesis simulation..." | ||
@echo "By default, ${HOME}/.emintd/config/genesis.json will be used." | ||
@go test -mod=readonly $(SIMAPP) -run TestFullAppSimulation -Genesis=${HOME}/.emintd/config/genesis.json \ | ||
-Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h | ||
|
||
test-sim-import-export: runsim | ||
@echo "Running Ethermint import/export simulation. This may take several minutes..." | ||
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestAppImportExport | ||
|
||
test-sim-after-import: runsim | ||
@echo "Running Ethermint simulation-after-import. This may take several minutes..." | ||
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestAppSimulationAfterImport | ||
|
||
test-sim-custom-genesis-multi-seed: runsim | ||
@echo "Running multi-seed custom genesis simulation..." | ||
@echo "By default, ${HOME}/.emintd/config/genesis.json will be used." | ||
@$(BINDIR)/runsim -Jobs=4 -Genesis=${HOME}/.emintd/config/genesis.json 400 5 TestFullAppSimulation | ||
|
||
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 | ||
|
||
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 | ||
|
||
.PHONY: runsim test-sim-nondeterminism test-sim-custom-genesis-fast test-sim-fast sim-import-export \ | ||
test-sim-simulation-after-import test-sim-custom-genesis-multi-seed test-sim-multi-seed \ | ||
|
||
|
||
|
||
####################### | ||
### Documentation ### | ||
####################### | ||
############################################################################### | ||
### Documentation ### | ||
############################################################################### | ||
|
||
# Start docs site at localhost:8080 | ||
docs-serve: | ||
|
@@ -311,4 +250,31 @@ docs-serve: | |
docs-build: | ||
@cd docs && \ | ||
npm install && \ | ||
npm run build | ||
npm run build | ||
|
||
godocs: | ||
@echo "--> Wait a few seconds and visit http://localhost:6060/pkg/github.com/cosmos/ethermint" | ||
godoc -http=:6060 | ||
|
||
############################################################################### | ||
### Localnet ### | ||
############################################################################### | ||
|
||
build-docker-local-ethermint: | ||
@$(MAKE) -C networks/local | ||
|
||
# Run a 4-node testnet locally | ||
localnet-start: localnet-stop | ||
mkdir -p ./build/ | ||
docker rmi -f ethermint-build-linux | ||
docker build --rm -t ethermint-build-linux . ; \ | ||
container_id=$$(docker create ethermint-build-linux) ; \ | ||
docker container start $${container_id} ; | ||
|
||
if ! [ -f build/node0/$(ETHERMINT_DAEMON_BINARY)/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/ethermint:Z ethermint-build-linux "emintd testnet --v 4 -o /ethermint --starting-ip-address 192.168.10.2 --keyring-backend=test"; fi | ||
docker-compose up -d | ||
|
||
localnet-stop: | ||
docker-compose down | ||
|
||
.PHONY: build-docker-local-ethermint localnet-start localnet-stop |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@J-Thompson12 can you test these commands on your machine? 🙏