Skip to content

Commit

Permalink
Statesync CI process (#444)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
faddat and ValarDragon authored Oct 7, 2021
1 parent 9f1e0c7 commit 17eda92
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/statesync.yml
Original file line number Diff line number Diff line change
@@ -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
37 changes: 37 additions & 0 deletions scripts/statesync.sh
Original file line number Diff line number Diff line change
@@ -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="[email protected]:2000"

osmosisd unsafe-reset-all
osmosisd start

0 comments on commit 17eda92

Please sign in to comment.