Skip to content

Commit

Permalink
add upgrade test
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Jun 20, 2024
1 parent c91ffeb commit 686e90d
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
55 changes: 55 additions & 0 deletions contrib/localnet/docker-compose-import-upgrade.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion contrib/localnet/scripts/start-upgrade-orchestrator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ cat > upgrade.json <<EOF
}
],
"metadata": "",
"deposit": "100000000azeta",
"deposit": "1000000000000000000000azeta",
"title": "${UPGRADE_NAME}",
"summary": "${UPGRADE_NAME}"
}
Expand Down
3 changes: 2 additions & 1 deletion contrib/localnet/scripts/start-zetacored.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ then
cat $HOME/.zetacored/config/genesis.json | jq '.app_state["mint"]["params"]["mint_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 '.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+
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 686e90d

Please sign in to comment.