<!-- XE-12969 · SDK: `solvePow` hangs forever on the WASM path when `progressInterval` is a multiple of 2^32 (i32 batch-count truncation) · testnet -->
*Markdown view of <https://bounty.xe.network/XE-12969>. The page is the record; this is the same page for reading.*

XE-12969 · Bounty

# SDK: \`solvePow\` hangs forever on the WASM path when \`progressInterval\` is a multiple of 2^32 (i32 batch-count truncation)

Triaging
claimed Minor
web
filed 2026-11-14 14:51 UTC
by xe:b4c356d4

Verdict
:   published when the fix ships

Tier
:   published when the fix ships

Claimed
:   Minor

Area
:   SDK / docs / web

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 19:46 UTC

Told
:   2026-11-20 19:45 UTC

### Patches

None linked.

### History

- [627206](https://bounty.xe.network/log/627206) 2026-11-20 19:46 UTC proposal.adopted
- [627205](https://bounty.xe.network/log/627205) 2026-11-20 19:46 UTC ticket.award
- [625796](https://bounty.xe.network/log/625796) 2026-11-20 19:45 UTC proposal.adopted
- [625795](https://bounty.xe.network/log/625795) 2026-11-20 19:45 UTC reply.sent
- [625438](https://bounty.xe.network/log/625438) 2026-11-20 19:45 UTC proposal.adopted
- [625437](https://bounty.xe.network/log/625437) 2026-11-20 19:45 UTC ticket.status new → triaging
- [623920](https://bounty.xe.network/log/623920) 2026-11-20 19:45 UTC proposal.adopted
- [623918](https://bounty.xe.network/log/623918) 2026-11-20 19:45 UTC proposal.adopted
- [623917](https://bounty.xe.network/log/623917) 2026-11-20 19:45 UTC ticket.facts
- [623914](https://bounty.xe.network/log/623914) 2026-11-20 19:45 UTC proposal.adopted
- [623913](https://bounty.xe.network/log/623913) 2026-11-20 19:45 UTC ticket.facts
- [623908](https://bounty.xe.network/log/623908) 2026-11-20 19:45 UTC proposal.adopted

[Full history](https://bounty.xe.network/log?ref=XE-12969) · [JSON](https://bounty.xe.network/v1/tickets/XE-12969) · [markdown](https://bounty.xe.network/XE-12969.md)

### Report

## Summary

`solveWasm` (`sdk/src/pow.ts`) computes `batch = Math.max(interval, 1 << 16)`
and passes it as the WASM `search` function's i32 `count`. For
`progressInterval = 4294967296` (2^32), ToInt32 yields 0: `search` returns 0
immediately without testing any nonce, the loop advances the nonce by 2^32,
yields, and repeats forever. It never tests a nonce even at difficulty 0\.

Same root cause, adjacent shapes: fractional intervals \> 65536, `NaN`, and
`Infinity` reach `BigInt(batch)` and throw `RangeError` after the first failed
batch (fail-loud, wrong error type, after burning a batch). Interval 2^31
makes `count` negative (−2^31), i.e. a \~2^31-iteration synchronous batch
(reasoned from the WAT, not wall-clock observed — abort is unchecked during
it).

## Reproduction (sdk @ 116f4b7, built dist/)

Edge harness `wasm-edge-child.mjs` (subprocess, 8 s timeout):

- `wasm diff=0 interval=4294967296` → TIMEOUT (8 s, still unresolved).
- Control `wasm diff=0 interval=8192` → returns immediately with a validating
  nonce (`RETURN nonce=12826776539434328988 validates=true`).
- `NaN`/`Infinity` → `RangeError: cannot be converted to a BigInt`;
  `70000.5` at default difficulty → `RangeError` after the first batch
  (`wasm-frac-probe.mjs` / `wasm-frac2.mjs`).

## Impact

Local self-DoS / hang in a public API: a caller passing a 2^32-multiple
interval (e.g. computed from a time budget, or `1 << 32` as a "huge batch"
sentinel) gets a promise that never resolves, hanging send/lease flows that
PoW every block. No funds move; the node backstop is untouched. Minor (same
bar as XE-1786).

## Duplicate check (neighbour bodies read in full)

- XE-1786 covers `progressInterval: 0` on the **JS** path only, and explicitly
  states "The WASM path clamps via Math.max(interval, 1\<\<16), so only the JS
  path hangs." The WASM 2^32 hang is the inverse case (WASM hangs where JS
  progresses) via a different mechanism (i32 truncation, not an empty inner
  loop). Not covered.
- XE-1850 covers out-of-range **difficulty** and **short hashes** only; its
  only `progressInterval` mention is a dedup-note citation of XE-1786.
- XE-7846 covers hardcoded difficulty in `#finish`; different.
- Searches: `progressInterval` (4 hits, all considered), `solvePow` (7 hits,
  all considered). Nothing title-only.

## Suggested fix

Clamp/validate `interval` to a sane positive i32 range (e.g. `(0, 2^31)`) and
reject non-integers/NaN/Infinity up front, in both paths; or mask the batch to
the i32 range before passing it to the WASM `search` function.

### Thread

**Joseph Denne**team2026-11-20 19:45 UTCdesk

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.
