Skip to content

Commit

Permalink
Extract new snapshots using lz4
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Rubino committed Nov 7, 2024
1 parent 13bea6f commit a719d48
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ elif [[ "$ZETACHAIN_NETWORK" == "testnet" || "$ZETACHAIN_NETWORK" == "athens3" ]
ZETACHAIN_INIT_API_URL=${ZETACHAIN_INIT_API_URL:-"https://zetachain-athens.g.allthatnode.com/archive/rest"}
ZETACHAIN_SNAPSHOT_METADATA_URL=${ZETACHAIN_SNAPSHOT_METADATA_URL:-"https://snapshots.rpc.zetachain.com/testnet/${ZETACHAIN_SNAPSHOT_TYPE}/latest.json"}
ZETACHAIN_NETWORK_CONFIG_URL_BASE=${ZETACHAIN_NETWORK_CONFIG_URL_BASE:-"https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3"}
else
else
echo "Invalid network"
exit 1
fi
Expand Down Expand Up @@ -81,7 +81,7 @@ install_genesis_zetacored() {
.proposals[] |
select(.status == "PROPOSAL_STATUS_PASSED") |
.messages[] |
select(."@type" == "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade" and (.plan.height |
select(."@type" == "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade" and (.plan.height |
tonumber < $max_height))' | jq -s '.[0]' | tee /tmp/init-upgrade-plan.json

ZETACORED_BINARY_URL=$(jq -r '.plan.info' /tmp/init-upgrade-plan.json | jq -r ".binaries[\"linux/$GOARCH\"]")
Expand All @@ -100,7 +100,7 @@ restore_snapshot() {
snapshot_md5=$(echo "$snapshot" | jq -r '.checksums.md5')
echo "Restoring snapshot from ${snapshot_link}"
# https://github.com/zeta-chain/dl-pipe
dl-pipe -hash "md5:${snapshot_md5}" "$snapshot_link" | tar x -C $HOME/.zetacored
dl-pipe -hash "md5:${snapshot_md5}" "$snapshot_link" | tar -I lz4 -x -C $HOME/.zetacored
}

cd $HOME
Expand All @@ -117,9 +117,9 @@ if [[ ! -f /root/init_completed ]]; then
install_genesis_zetacored
restore_snapshot
touch /root/init_completed
else
else
echo "Initialization already completed"
fi

# always set IP address as it may change after restart
sed -i -e "s/^external_address = .*/external_address = \"${MY_IP}:26656\"/" .zetacored/config/config.toml
sed -i -e "s/^external_address = .*/external_address = \"${MY_IP}:26656\"/" .zetacored/config/config.toml

0 comments on commit a719d48

Please sign in to comment.