Merge pull request #2 from tig-pool-nk/test

Test
This commit is contained in:
vodhash 2025-01-11 23:56:31 +01:00 committed by GitHub
commit da7e6ffba2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 64 additions and 43 deletions

BIN
bin/bench

Binary file not shown.

Binary file not shown.

BIN
bin/slave Normal file

Binary file not shown.

View File

@ -1,40 +1,66 @@
#!/bin/bash
if [ "$#" -ne 7 ] && [ "$#" -ne 8 ]; then
# Vérification du nombre d'arguments
if [ "$#" -ne 6 ] && [ "$#" -ne 7 ]; then
echo "wrong parameters"
exit 1
fi
# Affectation des paramètres
slave_id=$1
slave_name=$2
server_url=$3
port=$4
login=$5
private_key=$6
client_version=$7
login=$4
private_key=$5
client_version=$6
# Définir la branche par défaut sur "main"
branch="main"
if [ "$#" -eq 8 ] && [ "$mode" = "testnet" ]; then
# Vérifier si un 8ème argument est passé et correspond à "testnet"
if [ "$#" -eq 7 ] && [ "$7" = "testnet" ]; then
branch="test"
fi
# Remove existing directory and recreate
if [ -z "$branch" ]; then
echo "Error: Branch not defined."
exit 1
fi
# Affichage des paramètres pour debug
echo "Slave ID: $slave_id"
echo "Slave Name: $slave_name"
echo "Server URL: $server_url"
echo "Login: $login"
echo "Private Key: $private_key"
echo "Client Version: $client_version"
echo "Branch: $branch"
# Suppression et recréation du répertoire
rm -rf "tig_pool_$branch"
mkdir "tig_pool_$branch"
cd "tig_pool_$branch" || exit 1
# Kill any existing screens named pool_tig
# Arrêter les écrans nommés pool_tig existants
screen -ls | grep pool_tig | awk '{print $1}' | xargs -I {} screen -S {} -X kill
# Download and run the updated script
wget --no-cache "https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/scripts/tig_pool_master.sh"
# Télécharger et exécuter le script mis à jour
script_url="https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/scripts/tig_pool_master.sh"
echo "Downloading script from: $script_url"
wget --no-cache "$script_url"
if [ $? -ne 0 ]; then
echo "Error downloading script. Please check the branch and URL."
exit 1
fi
sudo chmod +x tig_pool_master.sh
# Exécuter le script téléchargé avec les paramètres appropriés
./tig_pool_master.sh \
-id_slave "$slave_id" \
-nom_slave "$slave_name" \
-ip "$server_url" \
-port "$port" \
-login "$login" \
-tok "$private_key" \
-url "$server_url" \

View File

@ -2,20 +2,28 @@
# Function to display usage
usage() {
echo "Usage: $0 -id_slave <id_slave> -nom_slave <nom_slave> -ip <ip> -port <port> -login <login_discord> -tok <private_key> -url <URL_SERVER> -b <branch>"
echo "Usage: $0 -id_slave <id_slave> -nom_slave <nom_slave> -ip <ip> -login <login_discord> -tok <private_key> -url <URL_SERVER> -b <branch>"
exit 1
}
# Check if the total number of arguments ok
if [ "$#" -ne 18 ]; then
if [ "$#" -ne 16 ]; then
usage
fi
# Check the number of processor threads
# cpu_threads=$(grep -c ^processor /proc/cpuinfo)
# if [ "$cpu_threads" -lt 24 ]; then
# echo "Error: Your system has less than 24 threads ($cpu_threads detected). Installation aborted your not able to Mine on TIGPool."
# exit 1
# fi
# Initialize variables for parameters
id_slave=""
nom_slave=""
ip=""
port=""
v=""
login_discord=""
private_key=""
@ -37,10 +45,6 @@ while [[ "$#" -gt 0 ]]; do
ip="$2"
shift 2
;;
-port)
port="$2"
shift 2
;;
-v)
v="$2"
shift 2
@ -69,7 +73,7 @@ while [[ "$#" -gt 0 ]]; do
done
# Ensure variables are not empty
if [ -z "$id_slave" ] || [ -z "$nom_slave" ] || [ -z "$ip" ] || [ -z "$port" ] || [ -z "$login_discord" ] || [ -z "$private_key" ] || [ -z "$URL_SERVER" ]|| [ -z "$branch" ]; then
if [ -z "$id_slave" ] || [ -z "$nom_slave" ] || [ -z "$ip" ] || [ -z "$login_discord" ] || [ -z "$private_key" ] || [ -z "$URL_SERVER" ]|| [ -z "$branch" ]; then
usage
fi
@ -85,7 +89,6 @@ current_path=$(pwd)
echo "ID Slave: $id_slave"
echo "Slave Name: $nom_slave"
echo "IP: $ip"
echo "Port: $port"
echo "Login: $login_discord"
echo "Private Key: $private_key"
echo "URL Server: $URL_SERVER"
@ -121,20 +124,6 @@ cd $current_path
python3 -m venv venv
mkdir -p tig-benchmarker
cd tig-benchmarker
wget --no-cache https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/tig-benchmarker/slave.py -O slave.py
wget --no-cache https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/tig-benchmarker/requirements.txt -O requirements.txt
mkdir -p common
cd common
wget --no-cache https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/tig-benchmarker/common/__init__.py -O __init__.py
wget --no-cache https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/tig-benchmarker/common/merkle_tree.py -O merkle_tree.py
wget --no-cache https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/tig-benchmarker/common/structs.py -O structs.py
wget --no-cache https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/tig-benchmarker/common/utils.py -O utils.py
cd $current_path
./venv/bin/pip3 install -r tig-benchmarker/requirements.txt
@ -149,7 +138,13 @@ if [ $? -ne 0 ]; then
exit 1
fi
wget --no-cache https://github.com/tig-pool-nk/client/raw/refs/heads/$branch/bin/bench -O bench
wget https://github.com/tig-pool-nk/client/raw/refs/heads/$branch/bin/slave -O slave
if [ $? -ne 0 ]; then
echo "Error downloading slave"
exit 1
fi
wget https://github.com/tig-pool-nk/client/raw/refs/heads/$branch/bin/bench -O bench
if [ $? -ne 0 ]; then
echo "Error downloading bench"
exit 1
@ -166,6 +161,7 @@ fi
chmod +x client_tig_pool
chmod +x bench
chmod +x tig_idle
chmod +x slave
cd $current_path
@ -178,8 +174,7 @@ sed -i "s|@login@|$login_discord|g" pool_tig_launch_${id_slave}_${nom_slave}.sh
sed -i "s|@tok@|$private_key|g" pool_tig_launch_${id_slave}_${nom_slave}.sh
sed -i "s|@worker@|$nom_slave|g" pool_tig_launch_${id_slave}_${nom_slave}.sh
sed -i "s|@ip@|$ip|g" pool_tig_launch_${id_slave}_${nom_slave}.sh
sed -i "s|@port@|$port|g" pool_tig_launch_${id_slave}_${nom_slave}.sh
sed -i "s|@url@|http://$URL_SERVER|g" pool_tig_launch_${id_slave}_${nom_slave}.sh
sed -i "s|@url@|https://$URL_SERVER|g" pool_tig_launch_${id_slave}_${nom_slave}.sh
sed -i "s|@version@|$v|g" pool_tig_launch_${id_slave}_${nom_slave}.sh
# Grant execution permissions to the launch file

BIN
tig-benchmarker/slave Normal file

Binary file not shown.

View File

@ -123,8 +123,8 @@ def send_results(session, master_ip, master_port, tig_worker_path, download_wasm
with open(f"{output_folder}/result.json") as f:
result = json.load(f)
submit_url = f"http://{master_ip}:{master_port}/submit-batch-root/{batch_id}"
logger.info(f"posting root to {submit_url}")
submit_url = f"https://{master_ip}/submit-batch-root/{batch_id}"
logger.info(f"posting root to master")
resp = session.post(submit_url, json=result)
if resp.status_code == 200:
FINISHED_BATCH_IDS[batch_id] = now()
@ -155,8 +155,8 @@ def send_results(session, master_ip, master_port, tig_worker_path, download_wasm
for n in batch["sampled_nonces"]
]
submit_url = f"http://{master_ip}:{master_port}/submit-batch-proofs/{batch_id}"
logger.info(f"posting proofs to {submit_url}")
submit_url = f"https://{master_ip}/submit-batch-proofs/{batch_id}"
logger.info(f"posting proofs ")
resp = session.post(submit_url, json={"merkle_proofs": proofs_to_submit})
if resp.status_code == 200:
FINISHED_BATCH_IDS[batch_id] = now()
@ -197,8 +197,8 @@ def process_batch(session, tig_worker_path, download_wasms_folder, num_workers,
def poll_batches(session, master_ip, master_port, output_path):
get_batches_url = f"http://{master_ip}:{master_port}/get-batches"
logger.info(f"fetching batches from {get_batches_url}")
get_batches_url = f"https://{master_ip}/get-batches"
logger.info(f"fetching batches ")
resp = session.get(get_batches_url)
if resp.status_code == 200: