waitForBlock never syncs: syncStateWithTimeout doesn't exist and the TypeError is swallowed
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 21
- Avg merge
- 12h 14m
- Merged PRs (30d)
- 41
Description
## Symptom
`Transactions.#waitForBlock` polls without ever syncing: its `await this.#inner.syncStateWithTimeout(0)` (crates/web-client/js/resources/transactions.js:680) is a call to a method that is not defined anywhere in the package — every invocation throws `TypeError` and the `catch {}` right under it swallows it.
## Evidence
- `grep -rn syncStateWithTimeout crates/web-client/js` → the call site, two "Caveat" comments, and the unit test — no definition. Same in the shipped `@miden-sdk/miden-sdk@0.16.0-rc.3` dist (`dist/st/index.js:1224`).
- The unit test passes because it mocks `syncStateWithTimeout: vi.fn()` onto the fake inner client (`__tests__/resources/transactions.test.js:2143`), i.e. it tests a method the real object doesn't have.
## Expected
The wait loop drives a real sync per poll (or deliberately doesn't, without the dead call).
## Impact
Batch confirmation waits only make progress if something else happens to advance the sync height; on a client where nothing else syncs, `#waitForBlock` burns its whole timeout and throws. Found while investigating 0xMiden/wallet#777.
Contributor guide
Research direction
The bug is in crates/web-client/js/resources/transactions.js at line 680, where syncStateWithTimeout is called but not defined. Start by examining the inner client object to see what sync methods are actually available. The unit test at __tests__/resources/transactions.test.js:2143 mocks this method, so check if the real implementation should be added or the call replaced. Run the existing tests to verify the fix, and ensure waitForBlock properly syncs state without swallowing errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- backend-api-design, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100