{"id":"XE-12969","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":2305,"title":"SDK: `solvePow` hangs forever on the WASM path when `progressInterval` is a multiple of 2^32 (i32 batch-count truncation)","area":"sdk-docs-web","claimed_tier":"minor","assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":null,"status":"triaging","closed_reason":null,"github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-14T14:51:11.913625+00:00","updated_at":"2026-11-20T19:46:43.762226+00:00","source_created_at":null,"told_at":"2026-11-20T19:45:48.282560+00:00","status_changed_at":"2026-11-20T19:45:43.794218+00:00","url":"https://bounty.xe.network/XE-12969","body":"## Summary\n\n`solveWasm` (`sdk/src/pow.ts`) computes `batch = Math.max(interval, 1 << 16)`\nand passes it as the WASM `search` function's i32 `count`. For\n`progressInterval = 4294967296` (2^32), ToInt32 yields 0: `search` returns 0\nimmediately without testing any nonce, the loop advances the nonce by 2^32,\nyields, and repeats forever. It never tests a nonce even at difficulty 0.\n\nSame root cause, adjacent shapes: fractional intervals > 65536, `NaN`, and\n`Infinity` reach `BigInt(batch)` and throw `RangeError` after the first failed\nbatch (fail-loud, wrong error type, after burning a batch). Interval 2^31\nmakes `count` negative (−2^31), i.e. a ~2^31-iteration synchronous batch\n(reasoned from the WAT, not wall-clock observed — abort is unchecked during\nit).\n\n## Reproduction (sdk @ 116f4b7, built dist/)\n\nEdge harness `wasm-edge-child.mjs` (subprocess, 8 s timeout):\n\n- `wasm diff=0 interval=4294967296` → TIMEOUT (8 s, still unresolved).\n- Control `wasm diff=0 interval=8192` → returns immediately with a validating\n  nonce (`RETURN nonce=12826776539434328988 validates=true`).\n- `NaN`/`Infinity` → `RangeError: cannot be converted to a BigInt`;\n  `70000.5` at default difficulty → `RangeError` after the first batch\n  (`wasm-frac-probe.mjs` / `wasm-frac2.mjs`).\n\n## Impact\n\nLocal self-DoS / hang in a public API: a caller passing a 2^32-multiple\ninterval (e.g. computed from a time budget, or `1 << 32` as a \"huge batch\"\nsentinel) gets a promise that never resolves, hanging send/lease flows that\nPoW every block. No funds move; the node backstop is untouched. Minor (same\nbar as XE-1786).\n\n## Duplicate check (neighbour bodies read in full)\n\n- XE-1786 covers `progressInterval: 0` on the **JS** path only, and explicitly\n  states \"The WASM path clamps via Math.max(interval, 1<<16), so only the JS\n  path hangs.\" The WASM 2^32 hang is the inverse case (WASM hangs where JS\n  progresses) via a different mechanism (i32 truncation, not an empty inner\n  loop). Not covered.\n- XE-1850 covers out-of-range **difficulty** and **short hashes** only; its\n  only `progressInterval` mention is a dedup-note citation of XE-1786.\n- XE-7846 covers hardcoded difficulty in `#finish`; different.\n- Searches: `progressInterval` (4 hits, all considered), `solvePow` (7 hits,\n  all considered). Nothing title-only.\n\n## Suggested fix\n\nClamp/validate `interval` to a sane positive i32 range (e.g. `(0, 2^31)`) and\nreject non-integers/NaN/Infinity up front, in both paths; or mask the batch to\nthe i32 range before passing it to the WASM `search` function.","patch_refs":[],"thread":[{"id":15164,"source":"desk","source_ref":"reply:13055","author":"Joseph Denne","team":true,"body":"Thank you for this report. We have read it against the current tree and it is being handled. The assessment and any award follow the fix.","created_at":"2026-11-20T19:45:48.274560+00:00"}]}