Skip to content

Add 30-Second Request Timeout to Subsquid Indexer Client - #164

Open
magqqgq wants to merge 2 commits into
Quantus-Network:mainfrom
magqqgq:magqqgq-patch-1
Open

magqqgq wants to merge 2 commits into
Quantus-Network:mainfrom
magqqgq:magqqgq-patch-1

Conversation

@magqqgq

@magqqgq magqqgq commented Sep 14, 2026

Copy link
Copy Markdown

Description

This pull request addresses a medium-severity network reliability finding in quantus-cli identified during the Quantus workspace security audit (FM-11).

Previously, SubsquidClient::new instantiated reqwest::Client using default settings without an explicit request timeout. Because reqwest has no default timeout, a stalled or non-responsive Subsquid GraphQL indexer endpoint would block calling tasks indefinitely, locking reward-collection and privacy-preserving transfer query CLI operations without recovery paths or errors.

Key Changes & Remediations

Bound Indexer HTTP Transport (FM-11 - src/subsquid/client.rs)

  • Configured Request Timeout: Configured Client::builder().timeout(std::time::Duration::from_secs(30)) during SubsquidClient initialization.
  • Consistency Across Clients: Aligns the HTTP indexer timeout contract with the 30-second timeout already utilized by the WebSocket chain client.
  • Graceful Degradation: Ensures network interruptions and hung indexer connections fail-fast with a typed error rather than blocking the CLI indefinitely.

How to Review

  1. Inspect SubsquidClient::new in src/subsquid/client.rs to verify that Client::builder().timeout(...) is configured with a 30-second duration.
  2. Verify existing unit tests (test_transfer_query_params_builder, pagination tests) continue to pass without timeout disruptions.

### Description
This pull request addresses a medium-severity network reliability finding in `quantus-cli` identified during the Quantus workspace security audit (**FM-11**).

Previously, `SubsquidClient::new` instantiated `reqwest::Client` using default settings without an explicit request timeout. Because reqwest has no default timeout, a stalled or non-responsive Subsquid GraphQL indexer endpoint would block calling tasks indefinitely, locking reward-collection and privacy-preserving transfer query CLI operations without recovery paths or errors.

### Key Changes & Remediations

#### Bound Indexer HTTP Transport (FM-11 - `src/subsquid/client.rs`)
* **Configured Request Timeout:** Configured `Client::builder().timeout(std::time::Duration::from_secs(30))` during `SubsquidClient` initialization.
* **Consistency Across Clients:** Aligns the HTTP indexer timeout contract with the 30-second timeout already utilized by the WebSocket chain client.
* **Graceful Degradation:** Ensures network interruptions and hung indexer connections fail-fast with a typed error rather than blocking the CLI indefinitely.

### How to Review
1. Inspect `SubsquidClient::new` in `src/subsquid/client.rs` to verify that `Client::builder().timeout(...)` is configured with a 30-second duration.
2. Verify existing unit tests (`test_transfer_query_params_builder`, pagination tests) continue to pass without timeout disruptions.
@n13

n13 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

I think this has the wrong formatting, use our formatter then the code changes will look clean

@magqqgq

magqqgq commented Sep 18, 2026

Copy link
Copy Markdown
Author

Thanks @n13. The line endings/formatting noise has been cleaned up using the project's cargo fmt configuration. The diff is now minimal and highlights only the timeout configuration change.

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