fix(aztec.js): give waitForNode a bounded default timeout#24627
Merged
Conversation
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.
36bbf36 to
482a6b8
Compare
Thunkar
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #24602.
Problem
waitForNodepollsgetNodeInfo()forever when the node is unreachable, with no way for the caller to bound the wait:retryUntil(fn, 'RPC Get Node Info')— passing notimeout.retryUntildefaultstimeout = 0, and0is the documented "never time out" sentinel, so the timeout branch is dead.waitForNodeexposed 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
waitForTxin the same file, which forwardsopts?.timeout ?? DefaultWaitOpts.timeout(300s).Fix
Add an optional
{ timeout, interval }argument towaitForNodeand default it toDefaultWaitOpts(300s / 1s), mirroringwaitForTx. An unreachable node now rejects with aTimeoutError.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 existingwaitForTx/DefaultWaitOptsdefault.Tests
Added to
node.test.ts(reusing the existingjest-mock-extendedstyle):TimeoutErrorwhen the node stays unreachable (bounded)