-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENG-375 akash-node: introduce state-sync feature (#59)
* ENG-375 akash-node: move start script to standalone file fixes #18 * ENG-375 akash-node: avoid unnecessary config overwrite fixes #19 * ENG-375 akash-node: remove nonsense AKASH_P2P_PRIVATE_PEER_IDS is comma separated list of peer IDs to keep private (will not be gossiped to othe r peers) which does not make any sense as we aren't using private peers nor does it make sense to nmap through whole list of (25 as of now) peers to just pick a single working one. It just slows down the bootstrap. and we already use akash_node.peers, which go to AKASH_P2P_PERSISTENT_PEERS and should be more than enough. * ENG-375 akash-node: validate-genesis does not do anything and akash validate-genesis fails after 0.16.3 upgrade https://github.com/ovrclk/akash/issues/1565 * ENG-375 akash-node: introduce state-sync feature * ENG-375 akash-provider: explicitly set bid deposit to 5 AKT it looks like that when running a provider against state-synced RPC node it would default to 50 AKT for bid deposit. Despite that state-synced RPC node returns 5 AKT for "akash query params subspace market BidMinDeposit" command.
- Loading branch information
Showing
8 changed files
with
93 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
if [ ! -d "$AKASH_HOME/data" ] | ||
then | ||
/bin/akash init --chain-id "$AKASH_CHAIN_ID" "$AKASH_MONIKER" | ||
fi | ||
|
||
apt update && apt -y --no-install-recommends install ca-certificates curl jq > /dev/null 2>&1 | ||
curl -s "$AKASH_NET/genesis.json" > "$AKASH_HOME/config/genesis.json" | ||
|
||
mkdir -p $AKASH_HOME/data | ||
cd $AKASH_HOME/data | ||
|
||
if [ "$AKASH_STATESYNC_ENABLE" == true ]; then | ||
echo "state-sync is enabled, figure the right trust height & derive its hash" | ||
|
||
SNAP_RPC1="{{ .Values.state_sync.rpc1 }}" | ||
SNAP_RPC2="{{ .Values.state_sync.rpc2 }}" | ||
|
||
echo "update AKASH_P2P_PERSISTENT_PEERS with the state-sync hosts: $SNAP_RPC1, $SNAP_RPC2 ..." | ||
SNAP_RPC1_ID=$(curl -s ${SNAP_RPC1}/status | jq -r '.result.node_info.id') | ||
SNAP_RPC2_ID=$(curl -s ${SNAP_RPC2}/status | jq -r '.result.node_info.id') | ||
|
||
SNAP_RPC1_ADDR=$(curl -s ${SNAP_RPC1}/status | jq -r '.result.node_info.other.rpc_address') | ||
SNAP_RPC2_ADDR=$(curl -s ${SNAP_RPC2}/status | jq -r '.result.node_info.other.rpc_address') | ||
|
||
SNAP_RPC1_PORT=${SNAP_RPC1_ADDR##*:} | ||
SNAP_RPC2_PORT=${SNAP_RPC2_ADDR##*:} | ||
|
||
T=${SNAP_RPC1#*//} | ||
SNAP_RPC1_HOST=${T%:*} | ||
|
||
T=${SNAP_RPC2#*//} | ||
SNAP_RPC2_HOST=${T%:*} | ||
|
||
if [ $SNAP_RPC1_ID == $SNAP_RPC2_ID ]; then | ||
T="${SNAP_RPC1_ID}@${SNAP_RPC1_HOST}:${SNAP_RPC1_PORT}" | ||
else | ||
T="${SNAP_RPC1_ID}@${SNAP_RPC1_HOST}:${SNAP_RPC1_PORT},${SNAP_RPC2_ID}@${SNAP_RPC2_HOST}:${SNAP_RPC2_PORT}" | ||
fi | ||
AKASH_P2P_PERSISTENT_PEERS="$AKASH_P2P_PERSISTENT_PEERS,$T" | ||
export AKASH_P2P_PERSISTENT_PEERS | ||
echo "AKASH_P2P_PERSISTENT_PEERS: $AKASH_P2P_PERSISTENT_PEERS" | ||
|
||
LATEST_HEIGHT=$(curl -s $SNAP_RPC1/block | jq -r .result.block.header.height) | ||
HEIGHT_OFFSET={{ .Values.state_sync.height_offset }} | ||
BLOCK_HEIGHT=$((LATEST_HEIGHT - HEIGHT_OFFSET)) | ||
TRUST_HASH=$(curl -s "$SNAP_RPC1/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash) | ||
|
||
echo "TRUST HEIGHT: $BLOCK_HEIGHT" | ||
echo "TRUST HASH: $TRUST_HASH" | ||
|
||
export AKASH_STATESYNC_TRUST_HEIGHT=$BLOCK_HEIGHT | ||
export AKASH_STATESYNC_TRUST_HASH=$TRUST_HASH | ||
|
||
else | ||
|
||
apt -y --no-install-recommends install aria2 > /dev/null 2>&1 | ||
SNAPSHOT_URL=$(curl https://cosmos-snapshots.s3.filebase.com/akash/pruned/snapshot.json | jq -r .latest) | ||
echo "Using latest blockchain snapshot, $SNAPSHOT_URL" | ||
aria2c --out=snapshot.tar.gz --summary-interval 15 --check-certificate=false --max-tries=99 --retry-wait=5 --always-resume=true --max-file-not-found=99 --conditional-get=true -s 16 -x 16 -k 1M -j 1 $SNAPSHOT_URL | ||
tar -zxvf snapshot.tar.gz | ||
rm -f snapshot.tar.gz | ||
fi | ||
|
||
/bin/akash start | ||
if $AKASH_DEBUG == "true"; then sleep 5000; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,15 @@ akash_node: | |
net: https://raw.githubusercontent.com/ovrclk/net/master/mainnet | ||
peers: [email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656 | ||
|
||
# If your node gets connection troubles to Polkachu, | ||
# make sure to get through the trouble-shooting section at | ||
# https://www.polkachu.com/state_sync/akash | ||
state_sync: | ||
enabled: false | ||
rpc1: "https://akash-rpc.polkachu.com:443" | ||
rpc2: "https://akash-rpc.polkachu.com:443" | ||
height_offset: 2000 | ||
|
||
persistent_storage: | ||
enabled: false | ||
capacity: 100Gi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters