mirror of
https://github.com/tig-foundation/tig-monorepo.git
synced 2026-02-23 19:37:48 +08:00
| .. | ||
| src | ||
| Cargo.toml | ||
| README.md | ||
tig-worker
A Rust crate for verifying and computing solutions.
Solutions are computed by executing an algorithm in a WASM virtual machine (TIG's fork of wasmi).
Testing Performance of Algorithms
Performance testing is done in a sandboxed WASM Virtual Machine.
IMPORTANT: You can compile / test existing algorithms as binary executables, but be sure to throughly vet the code beforehand for malicious routines!
-
Pull an existing algorithm or compile your own algorithm to WASM
-
Set environment variables to match the algorithm you are testing:
export CHALLENGE=<challenge_name> export ALGORITHM=<algorithm_name> -
Pick a difficulty & create
settings.json:- Difficulty for Satisfiability. Recommend
[50, 300]for initial tests - Difficulty for Vehicle Routing. Recommend
[40, 250]for initial tests - Difficulty for Knapsack. Recommend
[50, 10]for initial tests
{ "block_id": "", "algorithm_id": "", "challenge_id": "", "player_id": "", "difficulty": <your difficulty> } - Difficulty for Satisfiability. Recommend
-
Test the algorithm:
cargo run -p tig-worker --release -- settings.json tig-algorithms/wasm/${CHALLENGE}/${ALGORITHM}.wasm
Notes:
- You can query the latest difficulty ranges via TIG's API:
query https://api.tig.foundation/play/get-block for <block_id> query https://api.tig.foundation/play/get-challenges?block_id=<block_id> for qualifier_difficulties