Skip to content

fix: use zstd instead of gzip for data source requests#61

Merged
mo4islona merged 1 commit intomasterfrom
fix/zstd-data-client
Mar 25, 2026
Merged

fix: use zstd instead of gzip for data source requests#61
mo4islona merged 1 commit intomasterfrom
fix/zstd-data-client

Conversation

@mo4islona
Copy link
Copy Markdown
Contributor

@mo4islona mo4islona commented Mar 25, 2026

Summary

  • Switch reqwest client from gzip to zstd for data source ingestion
  • Data services already respond with content-encoding: zstd
  • Better compression ratio and faster decompression

Changes

  • crates/data-client/Cargo.toml: gzip feature → zstd
  • crates/data-client/src/reqwest/client.rs: .gzip(true).zstd(true)

Verified

  • Tested against evm-dwellir-arbitrum-one-hotblocks-service in cluster
  • Data service responds with content-encoding: zstd when Accept-Encoding: zstd is sent

🤖 Generated with Claude Code

Data services already respond with content-encoding: zstd.
Switch reqwest client from gzip to zstd for better compression
ratio and faster decompression.
Copilot AI review requested due to automatic review settings March 25, 2026 07:49
@mo4islona
Copy link
Copy Markdown
Contributor Author

Related: subsquid/squid-sdk#456

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Switches the sqd-data-client reqwest configuration to prefer Zstandard compression for data source ingestion requests, aligning the client with data services that return content-encoding: zstd.

Changes:

  • Enable reqwest’s zstd feature in sqd-data-client (replacing gzip).
  • Update the default reqwest client builder to enable zstd decoding/advertising (.zstd(true)).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/data-client/src/reqwest/client.rs Updates the default reqwest Client builder to use zstd.
crates/data-client/Cargo.toml Switches reqwest features from gzip to zstd.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -19,7 +19,7 @@ pub fn default_http_client() -> Client {
Client::builder()
.read_timeout(Duration::from_secs(20))
.connect_timeout(Duration::from_secs(20))
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching the client to only advertise/handle zstd means data sources that don't support content-encoding: zstd (or that ignore Accept-Encoding and respond with gzip) will fail to decode. Since DatasetConfig.data_sources accepts arbitrary URLs, consider enabling both gzip and zstd support (keep the gzip feature and also call .gzip(true) alongside .zstd(true)), or make the encoding configurable if zstd-only is a hard requirement.

Suggested change
.connect_timeout(Duration::from_secs(20))
.connect_timeout(Duration::from_secs(20))
.gzip(true)

Copilot uses AI. Check for mistakes.
bytes = { workspace = true }
futures = { workspace = true }
reqwest = { workspace = true, features = ["gzip", "json", "stream"] }
reqwest = { workspace = true, features = ["zstd", "json", "stream"] }
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropping the gzip feature here removes gzip decompression support for this client. If data_sources can point to services that only support gzip (or return it despite Accept-Encoding), requests may start failing. Consider keeping both gzip and zstd features enabled for backward compatibility, unless all supported data sources are guaranteed to support zstd.

Suggested change
reqwest = { workspace = true, features = ["zstd", "json", "stream"] }
reqwest = { workspace = true, features = ["gzip", "zstd", "json", "stream"] }

Copilot uses AI. Check for mistakes.
@mo4islona mo4islona merged commit 2824168 into master Mar 25, 2026
5 checks passed
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.

3 participants