From 17eda921af737b8745590b1fea788d3f58b3ebbc Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Thu, 7 Oct 2021 07:20:52 +0700 Subject: [PATCH] Statesync CI process (#444) * Workflow testing for state sync * Added state sync script * State sync script (WIP) * Update statesync.yml * Update statesync.yml * Update statesync.sh * Update statesync.yml * Update statesync.sh * Update statesync.sh * Update statesync.sh * Update statesync.sh * Update statesync.sh * Update statesync.sh * Update statesync.sh * Update statesync.sh * Update statesync.sh * Update statesync.sh * Update statesync.sh * Update statesync.sh * Update .github/workflows/statesync.yml Co-authored-by: Dev Ojha --- .github/workflows/statesync.yml | 19 +++++++++++++++++ scripts/statesync.sh | 37 +++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/statesync.yml create mode 100644 scripts/statesync.sh diff --git a/.github/workflows/statesync.yml b/.github/workflows/statesync.yml new file mode 100644 index 00000000000..71642ab7c16 --- /dev/null +++ b/.github/workflows/statesync.yml @@ -0,0 +1,19 @@ +# This is a basic workflow that is manually triggered + +name: State Sync + +# Controls when the action will run. Workflow runs when manually triggered using the UI +# or API. +on: [workflow_dispatch] + +# This workflow makes x86_64 binaries for mac, windows, and linux. + +jobs: + build: + runs-on: ubuntu-latest + name: osmosis state sync + steps: + - uses: actions/checkout@v2 + + - name: state sync + run: bash scripts/statesync.sh diff --git a/scripts/statesync.sh b/scripts/statesync.sh new file mode 100644 index 00000000000..3c71cfd9393 --- /dev/null +++ b/scripts/statesync.sh @@ -0,0 +1,37 @@ + +#!/bin/bash +# microtick and bitcanna contributed significantly here. +set -e + +export GOPATH=~/go +export PATH=$PATH:~/go/bin +go install ./... + + +# MAKE HOME FOLDER AND GET GENESIS +osmosisd init test +wget -O ~/.osmosisd/config/genesis.json https://cloudflare-ipfs.com/ipfs/QmXRvBT3hgoXwwPqbK6a2sXUuArGM8wPyo1ybskyyUwUxs + +INTERVAL=1500 + +# GET TRUST HASH AND TRUST HEIGHT + +LATEST_HEIGHT=$(curl -s 162.55.132.230:2001/block | jq -r .result.block.header.height); +BLOCK_HEIGHT=$(($LATEST_HEIGHT-$INTERVAL)) +TRUST_HASH=$(curl -s "162.55.132.230:2001/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash) + + +# TELL USER WHAT WE ARE DOING +echo "TRUST HEIGHT: $BLOCK_HEIGHT" +echo "TRUST HASH: $TRUST_HASH" + + +# export state sync vars +export OSMOSISD_STATESYNC_ENABLE=true +export OSMOSISD_STATESYNC_RPC_SERVERS="162.55.132.230:2001,162.55.132.230:2001" +export OSMOSISD_STATESYNC_TRUST_HEIGHT=$BLOCK_HEIGHT +export OSMOSISD_STATESYNC_TRUST_HASH=$TRUST_HASH +export OSMOSISD_P2P_PERSISTENT_PEERS="40aafcd9b6959d58dd1c567d9daf2a82a23311cf@162.55.132.230:2000" + +osmosisd unsafe-reset-all +osmosisd start