Skip to content

fix(aztec.js): give waitForNode a bounded default timeout#24627

Merged
aminsammara merged 1 commit into
merge-train/fairies-v5from
as/fix-wait-for-node-timeout
Jul 9, 2026
Merged

fix(aztec.js): give waitForNode a bounded default timeout#24627
aminsammara merged 1 commit into
merge-train/fairies-v5from
as/fix-wait-for-node-timeout

Conversation

@aminsammara

Copy link
Copy Markdown
Contributor

Fixes #24602.

Problem

waitForNode polls getNodeInfo() forever when the node is unreachable, with no way for the caller to bound the wait:

  • It calls retryUntil(fn, 'RPC Get Node Info') — passing no timeout.
  • retryUntil defaults timeout = 0, and 0 is the documented "never time out" sentinel, so the timeout branch is dead.
  • waitForNode exposed no parameter to override this, so a caller could not cap the wait at all.

The result: a dApp/CLI/service pointed at a wrong URL or a down node hangs silently at startup, indistinguishable from "node still starting." This is also inconsistent with the sibling waitForTx in the same file, which forwards opts?.timeout ?? DefaultWaitOpts.timeout (300s).

Fix

Add an optional { timeout, interval } argument to waitForNode and default it to DefaultWaitOpts (300s / 1s), mirroring waitForTx. An unreachable node now rejects with a TimeoutError.

Behavioral change

The default wait changes from infinite to 300s. Callers that relied on waiting indefinitely can restore the old behavior by passing { timeout: 0 }. 300s is generous for a reachable node and matches the existing waitForTx / DefaultWaitOpts default.

Tests

Added to node.test.ts (reusing the existing jest-mock-extended style):

  • resolves once the node becomes reachable
  • rejects with a TimeoutError when the node stays unreachable (bounded)

waitForNode called retryUntil without a timeout, and retryUntil treats a
zero timeout as the never-time-out sentinel, so an unreachable node caused
the call to poll getNodeInfo forever with no way for the caller to bound it.

Add an optional { timeout, interval } argument and default it to
DefaultWaitOpts (300s / 1s), matching the sibling waitForTx. An unreachable
node now rejects with a TimeoutError; pass timeout: 0 to opt into the
previous infinite-wait behavior.
@aminsammara aminsammara force-pushed the as/fix-wait-for-node-timeout branch from 36bbf36 to 482a6b8 Compare July 9, 2026 09:50
@aminsammara aminsammara changed the base branch from merge-train/spartan-v5 to merge-train/fairies-v5 July 9, 2026 09:50
@aminsammara aminsammara merged commit 00fae63 into merge-train/fairies-v5 Jul 9, 2026
15 checks passed
@aminsammara aminsammara deleted the as/fix-wait-for-node-timeout branch July 9, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants