Difficulty: Intermediate
Type: Feature
Recommended labels (if available in this repo): enhancement, reliability, sdk
Background
src/contracts/providers/jsonRpcProvider.ts and webSocketProvider.ts wrap the underlying RPC transports, but neither currently exposes a configurable per-request timeout — a hung RPC connection can block an access check indefinitely.
Problem
Without a timeout, a slow or unresponsive RPC endpoint causes access checks to hang rather than failing fast (which would allow the adaptive provider or caller to fail over or surface a clear error).
Expected Outcome
Both providers accept a requestTimeoutMs config option; requests exceeding the timeout are aborted and rejected with a typed TimeoutError.
Suggested Implementation
Use AbortController (or the transport library's native timeout support) to enforce the timeout in both providers. Ensure the WebSocket provider's timeout doesn't tear down the underlying persistent connection, only the individual pending request. Surface timeouts through healthTracker.ts so the adaptive provider can factor timeout frequency into its health scoring.
Acceptance Criteria
requestTimeoutMs is configurable via networkConfig.ts / sdkConfig.ts, with a sensible default
- Timed-out requests reject with a typed
TimeoutError, not a generic error
- WebSocket provider timeout does not close the underlying socket connection
- Unit tests simulate a hung request and verify timeout behavior for both providers
pnpm test:run passes
Likely Affected Files/Directories
src/contracts/providers/jsonRpcProvider.ts
src/contracts/providers/webSocketProvider.ts
src/contracts/providers/healthTracker.ts
src/config/networkConfig.ts
Difficulty: Intermediate
Type: Feature
Recommended labels (if available in this repo):
enhancement,reliability,sdkBackground
src/contracts/providers/jsonRpcProvider.tsandwebSocketProvider.tswrap the underlying RPC transports, but neither currently exposes a configurable per-request timeout — a hung RPC connection can block an access check indefinitely.Problem
Without a timeout, a slow or unresponsive RPC endpoint causes access checks to hang rather than failing fast (which would allow the adaptive provider or caller to fail over or surface a clear error).
Expected Outcome
Both providers accept a
requestTimeoutMsconfig option; requests exceeding the timeout are aborted and rejected with a typedTimeoutError.Suggested Implementation
Use
AbortController(or the transport library's native timeout support) to enforce the timeout in both providers. Ensure the WebSocket provider's timeout doesn't tear down the underlying persistent connection, only the individual pending request. Surface timeouts throughhealthTracker.tsso the adaptive provider can factor timeout frequency into its health scoring.Acceptance Criteria
requestTimeoutMsis configurable vianetworkConfig.ts/sdkConfig.ts, with a sensible defaultTimeoutError, not a generic errorpnpm test:runpassesLikely Affected Files/Directories
src/contracts/providers/jsonRpcProvider.tssrc/contracts/providers/webSocketProvider.tssrc/contracts/providers/healthTracker.tssrc/config/networkConfig.ts