Skip to content

Commit cf11063

Browse files
committed
second commit
1 parent 4dcbaa5 commit cf11063

15 files changed

+250
-301
lines changed

lib/fantom/README.md

Lines changed: 40 additions & 54 deletions
Large diffs are not rendered by default.

lib/fantom/lib/assets/download-snapshot.sh

Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,18 @@ set +e
33

44
source /etc/environment
55

6-
echo "Downloading FANTOM snapshot from 46Club."
6+
echo "Downloading FANTOM snapshot."
77

88
cd /data
99

10-
FANTOM_SNAPSHOTS_FILE_NAME=geth.tar.zst
11-
FANTOM_SNAPSHOTS_DIR=/data/
12-
FANTOM_SNAPSHOTS_DOWNLOAD_STATUS=-1
13-
14-
if [ "$FANTOM_SNAPSHOTS_URI" == "none" ]; then
15-
FANTOM_SNAPSHOTS_URI=$(curl https://raw.githubusercontent.com/48Club/fantom-snapshots/main/data.json | jq -r .hash.local.link)
16-
fi
17-
18-
# take about 1 hour to download the fantom snapshot
19-
while (( FANTOM_SNAPSHOTS_DOWNLOAD_STATUS != 0 ))
20-
do
21-
PIDS=$(pgrep aria2c)
22-
if [ -z "$PIDS" ]; then
23-
aria2c -s14 -x14 -k100M $FANTOM_SNAPSHOTS_URI -d $FANTOM_SNAPSHOTS_DIR -o $FANTOM_SNAPSHOTS_FILE_NAME
24-
fi
25-
FANTOM_SNAPSHOTS_DOWNLOAD_STATUS=$?
26-
pid=$(pidof aria2c)
27-
wait $pid
28-
echo "aria2c exit."
29-
case $FANTOM_SNAPSHOTS_DOWNLOAD_STATUS in
30-
3)
31-
echo "file not exist."
32-
exit 3
33-
;;
34-
9)
35-
echo "No space left on device."
36-
exit 9
37-
;;
38-
*)
39-
continue
40-
;;
41-
esac
10+
for FILE in `curl https://snapshot.fantom.network/files/snapsync/latest/listtgzfiles.txt`; do
11+
echo $FILE;
12+
axel -n 20 https://snapshot.fantom.network/files/snapsync/$FILE && \
13+
tar --use-compress-program="pigz -d" -xvf ${FILE##*/} && \
14+
rm ${FILE##*/} || \
15+
echo "Problem with downloading or expanding file $FILE"
4216
done
43-
echo "Downloading FANTOM snapshot from 46Club succeed"
44-
45-
sleep 60
46-
# take about 2 hours to decompression the fantom snapshot
47-
echo "Decompression FANTOM snapshot start ..."
48-
49-
zstd -cd geth.tar.zst | pv | tar xvf - 2>&1 | tee unzip.log && echo "decompression success..." || echo "decompression failed..." >> fantom-snapshots-decompression.log
50-
echo "Decompression FANTOM snapshot success ..."
5117

52-
mv /data/geth.full/geth /data/
53-
sudo rm -rf /data/geth.full
54-
sudo rm -rf /data/geth.tar.zst
18+
echo "Downloading FANTOM snapshot finished"
5519

5620
echo "FANTOM snapshot is ready !!!"

lib/fantom/lib/assets/fantom-checker/syncchecker-fantom.sh

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,31 @@
11
#!/bin/bash
22

3-
FANTOM_SYNC_STATS=$(curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' http://localhost:8545 | jq -r ".result")
3+
#FANTOM_SYNC_STATS=$(curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"ftm_syncing","params":[],"id":1}' http://localhost:18545 | jq -r ".result")
44

5-
if [[ "$FANTOM_SYNC_STATS" == "false" ]]; then
6-
FANTOM_SYNC_BLOCK_HEX=$(curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:8545 | jq -r ".result")
7-
FANTOM_HIGHEST_BLOCK_HEX=$FANTOM_SYNC_BLOCK_HEX
8-
else
9-
FANTOM_SYNC_BLOCK_HEX=$(echo $FANTOM_SYNC_STATS | jq -r ".currentBlock")
10-
FANTOM_HIGHEST_BLOCK_HEX=$(echo $FANTOM_SYNC_STATS | jq -r ".highestBlock")
11-
fi
5+
FANTOM_SYNC_STATS=$(su bcuser -c '/home/bcuser/go-opera/build/opera attach --datadir=/data --exec "ftm.syncing"')
6+
# { currentBlock: 37676547,
7+
# currentBlockHash: "0x0001ab120000187fd8069d3a4f6501d48ad4800778f40a76d79cf02469272a43",
8+
# currentBlockTime: "0x16ec7a4b9a82ebfe",
9+
# currentEpoch: "0x1ab13",
10+
# highestBlock: 80196141,
11+
# highestEpoch: "0x44343",
12+
# knownStates: 0,
13+
# pulledStates: 0,
14+
# startingBlock: 0 }
1215

13-
FANTOM_HIGHEST_BLOCK=$(echo $((${FANTOM_HIGHEST_BLOCK_HEX})))
14-
FANTOM_SYNC_BLOCK=$(echo $((${FANTOM_SYNC_BLOCK_HEX})))
16+
17+
# if [[ "$FANTOM_SYNC_STATS" == "false" ]]; then
18+
# FANTOM_SYNC_BLOCK_HEX=$(curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:18545 | jq -r ".result")
19+
# FANTOM_HIGHEST_BLOCK_HEX=$FANTOM_SYNC_BLOCK_HEX
20+
# else
21+
# FANTOM_SYNC_BLOCK_HEX=$(echo $FANTOM_SYNC_STATS | jq -r ".currentBlock")
22+
# FANTOM_HIGHEST_BLOCK_HEX=$(echo $FANTOM_SYNC_STATS | jq -r ".highestBlock")
23+
# fi
24+
FANTOM_SYNC_BLOCK=$(echo $FANTOM_SYNC_STATS | jq -r ".currentBlock")
25+
FANTOM_HIGHEST_BLOCK=$(echo $FANTOM_SYNC_STATS | jq -r ".highestBlock")
26+
27+
# FANTOM_HIGHEST_BLOCK=$(echo $((${FANTOM_HIGHEST_BLOCK_HEX})))
28+
# FANTOM_SYNC_BLOCK=$(echo $((${FANTOM_SYNC_BLOCK_HEX})))
1529
FANTOM_BLOCKS_BEHIND="$((FANTOM_HIGHEST_BLOCK-FANTOM_SYNC_BLOCK))"
1630

1731
# Sending data to CloudWatch

lib/fantom/lib/assets/fantom/rpc-template.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

lib/fantom/lib/assets/node-cw-dashboard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export const SyncNodeCWDashboardJSON = {
221221
"type": "metric",
222222
"properties": {
223223
"metrics": [
224-
[ "CWAgent", "disk_used_percent", "path", "/data", "InstanceId", "${INSTANCE_ID}", "device", "nvme1n1", "fstype", "xfs", { "region": "${REGION}", "label": "/data" } ]
224+
[ "CWAgent", "disk_used_percent", "path", "/data", "InstanceId", "${INSTANCE_ID}", "device", "nvme1n1", "fstype", "ext4", { "region": "${REGION}", "label": "/data" } ]
225225
],
226226
"sparkline": true,
227227
"view": "singleValue",

0 commit comments

Comments
 (0)