From 686e90d30602fa0f380a1ec153612160506cf917 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 20 Jun 2024 17:08:58 -0400 Subject: [PATCH] add upgrade test --- Makefile | 6 +- .../docker-compose-import-upgrade.yml | 55 +++++++++++++++++++ .../scripts/start-upgrade-orchestrator.sh | 2 +- contrib/localnet/scripts/start-zetacored.sh | 3 +- 4 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 contrib/localnet/docker-compose-import-upgrade.yml diff --git a/Makefile b/Makefile index 0c3e17b293..0bd157a3bc 100644 --- a/Makefile +++ b/Makefile @@ -236,7 +236,7 @@ start-stress-test: zetanode #TODO: replace OLD_VERSION with v16 tag once its available zetanode-upgrade: zetanode @echo "Building zetanode-upgrade" - $(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime --build-arg OLD_VERSION='release/v16' . + $(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime --build-arg OLD_VERSION='release/v17' . $(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile.fastbuild . .PHONY: zetanode-upgrade @@ -256,6 +256,10 @@ 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 +start-e2e-import-mainnet-upgrade: zetanode-upgrade + @echo "--> Starting upgrade test" + cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-import-upgrade.yml up -d + stop-test: cd contrib/localnet/ && $(DOCKER) compose down --remove-orphans diff --git a/contrib/localnet/docker-compose-import-upgrade.yml b/contrib/localnet/docker-compose-import-upgrade.yml new file mode 100644 index 0000000000..5595ec261a --- /dev/null +++ b/contrib/localnet/docker-compose-import-upgrade.yml @@ -0,0 +1,55 @@ +version: "3" + +# This docker-compose redefine the services: +# - ZetaChain with 2 nodes (zetacore0, zetacore1) using the upgrade option for cosmovisor +# - ZetaChain observer set with 2 clients (zetaclient0, zetaclient1) using the background option +# - Orchestrator with upgrade option + +services: + zetacore0: + image: zetanode:old + entrypoint: ["/root/start-zetacored.sh", "2","import-data"] + volumes: + - ~/genesis_export/:/root/genesis_data + + zetacore1: + image: zetanode:old + entrypoint: ["/root/start-zetacored.sh", "2","import-data"] + + zetaclient0: + entrypoint: ["/root/start-zetaclientd.sh"] + image: zetanode:old + + zetaclient1: + entrypoint: ["/root/start-zetaclientd.sh"] + image: zetanode:old + + orchestrator: + entrypoint: ["/work/start-zetae2e.sh", "local", "upgrade"] + image: orchestrator + + upgrade-host: + image: zetanode:latest + container_name: upgrade-host + hostname: upgrade-host + entrypoint: ["/root/start-upgrade-host.sh"] + networks: + mynetwork: + ipv4_address: 172.20.0.250 + volumes: + - ssh:/root/.ssh + + upgrade-orchestrator: + # must run from old node for api compatibility + image: zetanode:old + container_name: upgrade-orchestrator + hostname: upgrade-orchestrator + entrypoint: ["/root/start-upgrade-orchestrator.sh", "225"] + networks: + mynetwork: + ipv4_address: 172.20.0.251 + depends_on: + - zetacore0 + - upgrade-host + volumes: + - ssh:/root/.ssh \ No newline at end of file diff --git a/contrib/localnet/scripts/start-upgrade-orchestrator.sh b/contrib/localnet/scripts/start-upgrade-orchestrator.sh index a2e8ec68fd..81c6f8b367 100755 --- a/contrib/localnet/scripts/start-upgrade-orchestrator.sh +++ b/contrib/localnet/scripts/start-upgrade-orchestrator.sh @@ -65,7 +65,7 @@ cat > upgrade.json < $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json cat $HOME/.zetacored/config/genesis.json | jq '.app_state["evm"]["params"]["evm_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json cat $HOME/.zetacored/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="500000000"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json - cat $HOME/.zetacored/config/genesis.json | jq '.app_state["gov"]["voting_params"]["voting_period"]="100s"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json cat $HOME/.zetacored/config/genesis.json | jq '.app_state["feemarket"]["params"]["min_gas_price"]="10000000000.0000"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json # set governance parameters in new params module for sdk v0.47+ @@ -262,6 +261,8 @@ then zetacored parse-genesis-file /root/genesis_data/exported-genesis.json fi + cat $HOME/.zetacored/config/genesis.json | jq '.app_state["gov"]["voting_params"]["voting_period"]="100s"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json + # 4. Collect all the gentx files in zetacore0 and create the final genesis.json zetacored collect-gentxs zetacored validate-genesis