-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d7a9fa
commit a58d9c3
Showing
7 changed files
with
179 additions
and
25 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
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
redis==5.0.1 | ||
loguru>=0.6.0 | ||
fastapi==0.90.0 | ||
fastapi<0.100.0 | ||
pydantic>=1.2.0,<2.0.0 | ||
requests>=2.28.0 | ||
requests>=2.31.0 | ||
ring==0.10.1 | ||
uvicorn>=0.17.6 | ||
gunicorn>=20.1.0 | ||
pytonlib>=0.0.50 | ||
uvicorn>=0.29.0 | ||
gunicorn>=22.0.0 | ||
pytonlib==0.0.63 | ||
tvm_valuetypes==0.0.12 | ||
inject>=4.3.1 |
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,67 @@ | ||
#!/bin/bash | ||
|
||
ENDPOINT=https://toncenter.com/api/v2 | ||
|
||
|
||
function usage() { | ||
echo 'required 1 positional argument: name of config file' | ||
echo 'Supported argumets:' | ||
echo ' -h --help Show this message' | ||
echo ' --testnet Use testnet endpoint' | ||
exit | ||
} | ||
|
||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
-h|--help) | ||
usage | ||
exit 1 | ||
;; | ||
--testnet) | ||
ENDPOINT=https://testnet.toncenter.com/api/v2 | ||
shift | ||
;; | ||
-*|--*) | ||
echo "Error: unknown option $1" | ||
usage | ||
exit 1 | ||
;; | ||
*) | ||
POSITIONAL_ARGS+=("$1") # save positional arg | ||
shift # past argument | ||
;; | ||
esac | ||
done | ||
|
||
set -- "${POSITIONAL_ARGS[@]}" | ||
|
||
# main logic | ||
LAST_SEQNO=$(curl -s ${ENDPOINT}/getMasterchainInfo | jq ".result.last.seqno") | ||
echo "Last seqno is $LAST_SEQNO" | ||
|
||
sleep 1 | ||
LAST_KEYBLOCK_SEQNO=$(curl -s "${ENDPOINT}/getBlockHeader?workchain=-1&shard=-9223372036854775808&seqno=${LAST_SEQNO}" | jq .result.prev_key_block_seqno) | ||
echo "Last keyblock seqno is $LAST_KEYBLOCK_SEQNO" | ||
|
||
sleep 1 | ||
RES=$(curl -s "${ENDPOINT}/lookupBlock?workchain=-1&shard=-9223372036854775808&seqno=${LAST_KEYBLOCK_SEQNO}" | jq .result ) | ||
|
||
SEQNO=$(echo "$RES" | jq '.seqno') | ||
FILEHASH=$(echo "$RES" | jq '.file_hash') | ||
ROOTHASH=$(echo "$RES" | jq '.root_hash') | ||
|
||
FILENAME=$1 | ||
|
||
cp $FILENAME $FILENAME.bk || echo "Failed to backup the config" | ||
python3 <<EOF | ||
import json | ||
with open("$FILENAME", 'r') as f: | ||
data = json.load(f) | ||
data['validator']['init_block']['seqno'] = $SEQNO | ||
data['validator']['init_block']['file_hash'] = $FILEHASH | ||
data['validator']['init_block']['root_hash'] = $ROOTHASH | ||
with open("$FILENAME", 'w') as f: | ||
json.dump(data, f, indent=4) | ||
EOF | ||
echo "Init block updated" |