Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statesync #444

Merged
merged 22 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this trying to state sync against mainnet?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way that I'm looking at this is we can use this as an indicator of changes that would cause differences in the app hash, and of changes that might break state sync itself.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will currently fail in the master branch but we can tag it with that one setting that causes it to continue on error.


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