-
Notifications
You must be signed in to change notification settings - Fork 41
Create statesync.bash #264
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,49 @@ | ||||||
#!/bin/bash | ||||||
# microtick and bitcanna contributed significantly here. | ||||||
# Pebbledb state sync script for evmos | ||||||
set -uxe | ||||||
|
||||||
# Set Golang environment variables. | ||||||
export GOPATH=~/go | ||||||
export PATH=$PATH:~/go/bin | ||||||
|
||||||
# Install Juno with pebbledb | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is pebbledb? I don't think it's required to have it but curious of its advantages over default db |
||||||
go mod edit -replace github.com/tendermint/tm-db=github.com/notional-labs/tm-db@136c7b6 | ||||||
go mod tidy | ||||||
go install -ldflags '-w -s -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb' -tags pebbledb ./... | ||||||
|
||||||
# NOTE: ABOVE YOU CAN USE ALTERNATIVE DATABASES, HERE ARE THE EXACT COMMANDS | ||||||
# go install -ldflags '-w -s -X github.com/cosmos/cosmos-sdk/types.DBBackend=rocksdb' -tags rocksdb ./... | ||||||
# go install -ldflags '-w -s -X github.com/cosmos/cosmos-sdk/types.DBBackend=badgerdb' -tags badgerdb ./... | ||||||
# go install -ldflags '-w -s -X github.com/cosmos/cosmos-sdk/types.DBBackend=boltdb' -tags boltdb ./... | ||||||
|
||||||
# Initialize chain. | ||||||
fetchd init test | ||||||
|
||||||
# Get Genesis | ||||||
wget https://storage.googleapis.com/fetch-ai-mainnet-v2-genesis/genesis-fetchhub4.json | ||||||
mv genesis-fetchhub4.json ~/.fetchd/config/genesis.json | ||||||
|
||||||
# Get "trust_hash" and "trust_height". | ||||||
INTERVAL=1000 | ||||||
LATEST_HEIGHT="$(curl -s https://evmos-rpc.polkachu.com/block | jq -r .result.block.header.height)" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
BLOCK_HEIGHT="$((LATEST_HEIGHT-INTERVAL))" | ||||||
TRUST_HASH="$(curl -s "https://evmos-rpc.polkachu.com/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
# Print out block and transaction hash from which to sync state. | ||||||
echo "trust_height: $BLOCK_HEIGHT" | ||||||
echo "trust_hash: $TRUST_HASH" | ||||||
|
||||||
# Export state sync variables. | ||||||
export FETCHD_STATESYNC_ENABLE=true | ||||||
export FETCHD_P2P_MAX_NUM_OUTBOUND_PEERS=200 | ||||||
export FETCHD_STATESYNC_RPC_SERVERS="https://rpc-juno-ia.notional.ventures:443,https://juno-rpc.polkachu.com:443" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we can discover these the same way we pull seeds below?
Suggested change
|
||||||
export FETCHD_STATESYNC_TRUST_HEIGHT=$BLOCK_HEIGHT | ||||||
export FETCHD_STATESYNC_TRUST_HASH=$TRUST_HASH | ||||||
|
||||||
# Fetch and set list of seeds from chain registry. | ||||||
FETCHD_P2P_SEEDS="$(curl -s https://raw.githubusercontent.com/cosmos/chain-registry/master/fetchhub/chain.json | jq -r '[foreach .peers.seeds[] as $item (""; "\($item.id)@\($item.address)")] | join(",")')" | ||||||
export FETCHD_P2P_SEEDS | ||||||
|
||||||
# Start chain. | ||||||
fetchd start --x-crisis-skip-assert-invariants --db_backend pebbledb | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. slow but safe?
Suggested change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.