Merge branch 'main' into test
This commit is contained in:
commit
590c200bb9
@ -48,7 +48,7 @@ screen -ls | grep pool_tig | awk '{print $1}' | xargs -I {} screen -S {} -X kill
|
||||
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 "$script_url"
|
||||
wget --no-cache "$script_url"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error downloading script. Please check the branch and URL."
|
||||
exit 1
|
||||
|
||||
@ -132,7 +132,7 @@ mkdir -p bin
|
||||
cd bin
|
||||
|
||||
# Download the files and check if the download was successful
|
||||
wget https://github.com/tig-pool-nk/client/raw/refs/heads/$branch/bin/client -O client_tig_pool
|
||||
wget --no-cache https://github.com/tig-pool-nk/client/raw/refs/heads/$branch/bin/client -O client_tig_pool
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error downloading client_tig_pool"
|
||||
exit 1
|
||||
@ -151,7 +151,7 @@ if [ $? -ne 0 ]; then
|
||||
fi
|
||||
|
||||
|
||||
wget https://github.com/tig-pool-nk/client/raw/refs/heads/$branch/bin/tig_idle -O tig_idle
|
||||
wget --no-cache https://github.com/tig-pool-nk/client/raw/refs/heads/$branch/bin/tig_idle -O tig_idle
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error downloading tig_idle"
|
||||
exit 1
|
||||
@ -166,7 +166,7 @@ chmod +x slave
|
||||
cd $current_path
|
||||
|
||||
# Download the launch file and rename it according to the provided parameters
|
||||
wget -O pool_tig_launch_${id_slave}_${nom_slave}.sh https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/test/scripts/pool_tig_launch_master.sh
|
||||
wget --no-cache -O pool_tig_launch_${id_slave}_${nom_slave}.sh https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/test/scripts/pool_tig_launch_master.sh
|
||||
|
||||
# Replace placeholders with variable values
|
||||
sed -i "s|@id@|$id_slave|g" pool_tig_launch_${id_slave}_${nom_slave}.sh
|
||||
@ -194,7 +194,7 @@ screen -dmL -Logfile "$current_path/logs/pool_tig.log" -S pool_tig bash -c "cd \
|
||||
cd $current_path
|
||||
mkdir game
|
||||
cd game
|
||||
wget https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/scripts/snake.sh -O snake.sh
|
||||
wget --no-cache https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/scripts/snake.sh -O snake.sh
|
||||
cd $current_path
|
||||
|
||||
set +H
|
||||
@ -215,13 +215,13 @@ echo ""
|
||||
echo "To follow the benchmarker, use the commands below:"
|
||||
echo
|
||||
echo " 1. Follow pool:"
|
||||
echo " tail -f logs/pool_tig"
|
||||
echo " tail -f ~/tig_pool_main/logs/pool_tig.log"
|
||||
echo
|
||||
echo " 2. Follow slave:"
|
||||
echo " tail -f logs/slave_tig"
|
||||
echo " tail -f ~/tig_pool_main/logs/slave_tig.log"
|
||||
echo
|
||||
echo " 3. Have some time to lose :)"
|
||||
echo " bash game/snake.sh"
|
||||
echo " bash ~/tig_pool_main/game/snake.sh"
|
||||
echo
|
||||
echo -e "\e[33mGood mining and happy benchmarking!\e[0m"
|
||||
|
||||
|
||||
@ -161,8 +161,8 @@ class BlockDetails(FromDict):
|
||||
|
||||
@dataclass
|
||||
class BlockData(FromDict):
|
||||
confirmed_ids: Dict[str, Set[int]]
|
||||
active_ids: Dict[str, Set[int]]
|
||||
confirmed_ids: Dict[str, Set[str]]
|
||||
active_ids: Dict[str, Set[str]]
|
||||
|
||||
@dataclass
|
||||
class Block(FromDict):
|
||||
|
||||
@ -10,7 +10,7 @@ import time
|
||||
import zlib
|
||||
from threading import Thread
|
||||
from common.structs import OutputData, MerkleProof
|
||||
from common.merkle_tree import MerkleTree
|
||||
from common.merkle_tree import MerkleTree, MerkleHash
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
logger = logging.getLogger(os.path.splitext(os.path.basename(__file__))[0])
|
||||
@ -97,7 +97,11 @@ def send_results(session, master_ip, master_port, tig_worker_path, download_wasm
|
||||
try:
|
||||
batch_id = READY_BATCH_IDS.pop()
|
||||
except KeyError:
|
||||
logger.debug("No pending batches")
|
||||
logger.debug("No batches to send")
|
||||
return
|
||||
|
||||
if now() - FINISHED_BATCH_IDS.get(batch_id, 0) < 10000:
|
||||
logger.debug(f"Batch {batch_id} submitted recently")
|
||||
return
|
||||
|
||||
output_folder = f"{output_path}/{batch_id}"
|
||||
@ -107,6 +111,7 @@ def send_results(session, master_ip, master_port, tig_worker_path, download_wasm
|
||||
if (
|
||||
not os.path.exists(f"{output_folder}/result.json")
|
||||
or not os.path.exists(f"{output_folder}/data.zlib")
|
||||
or not os.path.exists(f"{output_folder}/hashes.zlib")
|
||||
):
|
||||
if os.path.exists(f"{output_folder}/result.json"):
|
||||
os.remove(f"{output_folder}/result.json")
|
||||
@ -132,22 +137,21 @@ def send_results(session, master_ip, master_port, tig_worker_path, download_wasm
|
||||
READY_BATCH_IDS.add(batch_id) # requeue
|
||||
|
||||
else:
|
||||
with open(f"{output_folder}/hashes.zlib", "rb") as f:
|
||||
hashes = json.loads(zlib.decompress(f.read()).decode())
|
||||
with open(f"{output_folder}/data.zlib", "rb") as f:
|
||||
leafs = [
|
||||
OutputData.from_dict(x)
|
||||
for x in json.loads(zlib.decompress(f.read()).decode())
|
||||
]
|
||||
leafs = json.loads(zlib.decompress(f.read()).decode())
|
||||
|
||||
merkle_tree = MerkleTree(
|
||||
[x.to_merkle_hash() for x in leafs],
|
||||
[MerkleHash.from_str(x) for x in hashes],
|
||||
batch["batch_size"]
|
||||
)
|
||||
|
||||
proofs_to_submit = [
|
||||
MerkleProof(
|
||||
dict(
|
||||
leaf=leafs[n - batch["start_nonce"]],
|
||||
branch=merkle_tree.calc_merkle_branch(branch_idx=n - batch["start_nonce"])
|
||||
).to_dict()
|
||||
branch=merkle_tree.calc_merkle_branch(branch_idx=n - batch["start_nonce"]).to_str()
|
||||
)
|
||||
for n in batch["sampled_nonces"]
|
||||
]
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user