diff --git a/Makefile b/Makefile index 8e6b6a1b99..306c0e7027 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,7 @@ export DOCKER_BUILDKIT := 1 export LOCALNET_MODE export E2E_ARGS := $(E2E_ARGS) export UPGRADE_HEIGHT +export ZETACORED_IMPORT_GENESIS_DATA export ZETACORED_START_PERIOD := 30s clean: clean-binaries clean-dir clean-test-dir clean-coverage @@ -266,12 +267,13 @@ start-localnet-skip-build: export LOCALNET_MODE=setup-only && \ cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml up -d -stop-localnet: start-e2e-import-mainnet-test: zetanode @echo "--> Starting e2e import-data test" - cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER) compose -f docker-compose.yml -f docker-compose-import-data.yml up -d + export ZETACORED_IMPORT_GENESIS_DATA=true && \ + export ZETACORED_START_PERIOD=10m && \ + cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER) compose -f docker-compose.yml up -d -stop-test: +stop-localnet: cd contrib/localnet/ && $(DOCKER) compose down --remove-orphans ############################################################################### diff --git a/contrib/localnet/docker-compose-import-data.yml b/contrib/localnet/docker-compose-import-data.yml deleted file mode 100644 index 19f4068ad5..0000000000 --- a/contrib/localnet/docker-compose-import-data.yml +++ /dev/null @@ -1,30 +0,0 @@ -version: "3" - -# This docker-compose file configures the localnet environment -# it contains the following services: -# - ZetaChain with 2 nodes (zetacore0, zetacore1) -# - A observer set with 2 clients (zetaclient0, zetaclient1) -# - An Ethereum node (eth) -# - A Bitcoin node (bitcoin) -# - A Rosetta API (rosetta) -# - An orchestrator to manage interaction with the localnet (orchestrator) -services: - rosetta: - entrypoint: ["/root/start-rosetta.sh"] - - zetacore0: - entrypoint: ["/root/start-zetacored.sh", "2","import-data"] - volumes: - - ~/genesis_export/:/root/genesis_data - - zetacore1: - entrypoint: ["/root/start-zetacored.sh", "2","import-data"] - - zetaclient0: - entrypoint: ["/root/start-zetaclientd.sh"] - - zetaclient1: - entrypoint: ["/root/start-zetaclientd.sh"] - - orchestrator: - entrypoint: ["/work/start-zetae2e.sh", "local"] \ No newline at end of file diff --git a/contrib/localnet/docker-compose.yml b/contrib/localnet/docker-compose.yml index 5474dd66a7..1a59202d0d 100644 --- a/contrib/localnet/docker-compose.yml +++ b/contrib/localnet/docker-compose.yml @@ -54,8 +54,10 @@ services: - HOTKEY_BACKEND=file - HOTKEY_PASSWORD=password # test purposes only - ZETACORED_REPLICAS=2 + - ZETACORED_IMPORT_GENESIS_DATA=${ZETACORED_IMPORT_GENESIS_DATA} volumes: - ssh:/root/.ssh + - ~/.zetacored/genesis_data:/root/genesis_data zetacore1: image: zetanode:latest diff --git a/contrib/localnet/scripts/import-data.sh b/contrib/localnet/scripts/import-data.sh index d71d5c3656..3d53077d63 100644 --- a/contrib/localnet/scripts/import-data.sh +++ b/contrib/localnet/scripts/import-data.sh @@ -7,9 +7,9 @@ fi NETWORK=$1 echo "NETWORK: ${NETWORK}" -rm -rf ~/genesis_export/ -mkdir ~/genesis_export/ +rm -rf ~/.zetacored/genesis_data +mkdir ~/.zetacored/genesis_data echo "Download Latest State Export" LATEST_EXPORT_URL=$(curl https://snapshots.zetachain.com/latest-state-export | jq -r ."${NETWORK}") echo "LATEST EXPORT URL: ${LATEST_EXPORT_URL}" -wget -q ${LATEST_EXPORT_URL} -O ~/genesis_export/exported-genesis.json \ No newline at end of file +wget -q ${LATEST_EXPORT_URL} -O ~/.zetacored/genesis_data/exported-genesis.json \ No newline at end of file diff --git a/contrib/localnet/scripts/start-zetacored.sh b/contrib/localnet/scripts/start-zetacored.sh index fb89c5b0fc..dd8509847f 100755 --- a/contrib/localnet/scripts/start-zetacored.sh +++ b/contrib/localnet/scripts/start-zetacored.sh @@ -249,7 +249,7 @@ then scp $NODE:~/.zetacored/config/gentx/* ~/.zetacored/config/gentx/z2gentx/ done - if [[ "$OPTION" == "import-data" || "$OPTION" == "import-data-upgrade" ]]; then + if [[ -n "$ZETACORED_IMPORT_GENESIS_DATA" ]]; then echo "Importing data" zetacored parse-genesis-file /root/genesis_data/exported-genesis.json fi