Skip to content

Commit 4111097

Browse files
committed
fix(tools): send chain metadata url from upgrade testing
Signed-off-by: Artur Troian <[email protected]>
1 parent b756ba4 commit 4111097

File tree

2 files changed

+38
-14
lines changed

2 files changed

+38
-14
lines changed

make/test-upgrade.mk

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ SNAPSHOT_SOURCE ?= sandbox
2525

2626
ifeq ($(SNAPSHOT_SOURCE),mainnet)
2727
SNAPSHOT_NETWORK := akashnet-2
28+
CHAIN_METADATA_URL := https://raw.githubusercontent.com/akash-network/net/master/mainnet/meta.json
2829
else
2930
ifeq ($(SNAPSHOT_SOURCE),sandbox)
3031
SNAPSHOT_NETWORK := sandbox-01
32+
CHAIN_METADATA_URL := https://raw.githubusercontent.com/akash-network/net/master/sandbox/meta.json
3133
else
3234
$(error "invalid snapshot source $(SNAPSHOT_SOURCE)")
3335
endif
@@ -44,6 +46,7 @@ $(AKASH_INIT):
4446
--ufrom=$(UPGRADE_FROM) \
4547
--uto=$(UPGRADE_TO) \
4648
--config="$(PWD)/config.json" \
49+
--chain-meta=$(CHAIN_METADATA_URL) \
4750
--state-config=$(STATE_CONFIG) \
4851
--snapshot-url=$(SNAPSHOT_URL) init
4952
touch $@
@@ -66,20 +69,20 @@ test: init
6669

6770
.PHONY: test-reset
6871
test-reset:
69-
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --uto=$(UPGRADE_TO) --snapshot-url=$(SNAPSHOT_URL) clean
70-
#$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --uto=$(UPGRADE_TO) --snapshot-url=$(SNAPSHOT_URL) --gbv=$(GENESIS_BINARY_VERSION) bins
71-
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --uto=$(UPGRADE_TO) --snapshot-url=$(SNAPSHOT_URL) keys
72-
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --state-config=$(STATE_CONFIG) --snapshot-url=$(SNAPSHOT_URL) prepare-state
72+
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --uto=$(UPGRADE_TO) --snapshot-url=$(SNAPSHOT_URL) --chain-meta=$(CHAIN_METADATA_URL) clean
73+
#$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --uto=$(UPGRADE_TO) --snapshot-url=$(SNAPSHOT_URL) --gbv=$(GENESIS_BINARY_VERSION) --chain-meta=$(CHAIN_METADATA_URL) bins
74+
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --uto=$(UPGRADE_TO) --snapshot-url=$(SNAPSHOT_URL) --chain-meta=$(CHAIN_METADATA_URL) keys
75+
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --state-config=$(STATE_CONFIG) --snapshot-url=$(SNAPSHOT_URL) --chain-meta=$(CHAIN_METADATA_URL) prepare-state
7376

7477
.PHONY: prepare-state
7578
prepare-state:
76-
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --state-config=$(STATE_CONFIG) prepare-state
79+
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --state-config=$(STATE_CONFIG) --chain-meta=$(CHAIN_METADATA_URL) prepare-state
7780

7881
.PHONY: bins
7982
bins:
8083
ifneq ($(findstring build,$(SKIP)),build)
8184
bins:
82-
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --uto=$(UPGRADE_TO) bins
85+
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --uto=$(UPGRADE_TO) --chain-meta=$(CHAIN_METADATA_URL) bins
8386
endif
8487

8588
.PHONY: clean

script/upgrades.sh

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -439,21 +439,45 @@ function prepare_state() {
439439
rm -f upgrade-info.json
440440

441441
popd
442+
else
443+
pushd "$(pwd)"
444+
cd "${valdir}"
445+
446+
mkdir -p "data"
447+
448+
echo '{"height": "0", "round": 0, "step": 0}' > data/priv_validator_state.json
449+
450+
popd
451+
fi
452+
453+
((cnt++)) || true
454+
done
455+
456+
cnt=0
442457

458+
for val in $(jq -c '.validators[]' <<<"$config"); do
459+
local valdir
460+
461+
valdir=$validators_dir/.akash${cnt}
462+
463+
if [[ $cnt -eq 0 ]]; then
443464
$AKASH testnetify --home="$valdir" --testnet-rootdir="$validators_dir" --testnet-config="${STATE_CONFIG}" --yes || true
444465
else
445466
pushd "$(pwd)"
467+
446468
cd "${valdir}"
447469

448-
cp -r "${validators_dir}/.akash0/data" ./
470+
rm -f "config/genesis.json"
449471

450-
pushd "$(pwd)"
472+
cp -r "${validators_dir}/.akash0/config/genesis.json" "config/genesis.json"
451473

452-
cd "config"
474+
local state
475+
state=$(cat data/priv_validator_state.json)
453476

454-
ln -snf "../../.akash0/config/genesis.json" "genesis.json"
477+
rm -rf "data"
478+
cp -r "${validators_dir}/.akash0/data" ./
455479

456-
popd
480+
echo "$state" > data/priv_validator_state.json
457481
popd
458482
fi
459483

@@ -485,9 +509,6 @@ function clean() {
485509
rm -rf "$cosmovisor_dir/current"
486510
rm -rf "$cosmovisor_dir/upgrades/${UPGRADE_TO}/upgrade-info.json"
487511

488-
# mkdir -p "$valdir/data"
489-
# echo '{"height":"0","round": 0,"step": 0}' | jq > "$valdir/data/priv_validator_state.json"
490-
491512
((cnt++)) || true
492513
done
493514
}

0 commit comments

Comments
 (0)