Repository navigation
feat: gzip-compress DAPI responses - #5577
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
| Layer / File(s) | Summary |
|---|---|
Client gzip support and retry handling packages/dapi-grpc/Cargo.toml, packages/rs-dapi-client/src/transport.rs, packages/rs-dapi-client/src/transport/tonic_channel.rs, packages/rs-dapi-client/src/transport/wasm_channel.rs, packages/rs-dapi-client/src/transport/grpc.rs |
The transport feature enables tonic gzip. Native client constructors accept gzip responses, and pooled client creation uses the new constructors. Wasm constructors are added. Decompression-limit ResourceExhausted statuses are not retried. |
DAPI server gzip responses packages/rs-dapi/src/server/grpc.rs, packages/rs-dapi/src/services/platform_service/protobuf_request_errors.rs |
Platform and Core gRPC servers enable gzip responses when clients advertise gzip. Tests cover response negotiation, decoding, and decompression-limit errors. |
Protocol-specific compression details packages/rs-dapi/doc/DESIGN.md, packages/rs-dapi/src/clients/drive_client.rs, packages/dashmate/test/unit/templates/envoyTemplate.spec.js |
The design document describes compression behavior for Drive requests, native gRPC, gRPC-Web, and JSON-RPC. The Envoy test checks filter order and configured gRPC-Web content types. The Drive client’s disabled-compression comment and startup log are removed. |
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Suggested reviewers: lklimek, thepastaclaw
Merge Risk: 
Minimal · previous review 8257c
-
The change is mergeable with a recommended assertion to ensure grpc-web requests remain uncompressed.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed -
Finishing Touches
-
Fix failing CI checks
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
|
Waiting for bot review — coderabbitai ✓ · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
@coderabbitai review 🤖 Posted autonomously by Claude on behalf of pasta. |
✅ Action performed
|
|
✅ Final review complete — no blockers (commit 4382812) · triage: normal |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
The gzip implementation is correctly scoped across native gRPC, grpc-web, and WASM transports, with no blocking correctness, security, or layering defects found. Three non-blocking test and maintainability improvements remain: Core response compression lacks direct coverage, the retry guard depends on tonic's error wording, and the Envoy test can throw a TypeError instead of reporting an assertion failure. The Rust workspace test failure is unrelated to this PR; one browser test check was still in progress in the supplied CI snapshot.
🟡 2 suggestion(s) | 💬 1 nitpick(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — This is a broad cross-cutting change to gRPC transport, server compression, gateway configuration, client retry handling, and protocol error mapping, but it does not alter consensus, funds, cryptography, key handling, or storage. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `packages/rs-dapi/src/server/grpc.rs`:
- [SUGGESTION] packages/rs-dapi/src/server/grpc.rs:55-62: Core response compression lacks direct test coverage
`core_server()` now enables gzip response compression, but the added integration coverage exercises only `platform_server()`. Because `core_server()` is a separate constructor, a future edit could remove or misconfigure its `send_compressed(CompressionEncoding::Gzip)` call without any test detecting the regression. Add a Core-service compression test, or expose the constructor under `cfg(test)` and cover it with a small Core harness.
In `packages/rs-dapi-client/src/transport/grpc.rs`:
- [SUGGESTION] packages/rs-dapi-client/src/transport/grpc.rs:133-137: Document the tonic-version dependency of the decompression-limit prefix
`can_retry()` identifies the client-local decompression limit by prefix-matching tonic's English status message. That wording is an implementation detail rather than a stable status discriminator. The existing test will catch a wording change when it runs, but the constant should explicitly identify the tonic decoder source and version so a future tonic upgrade prompts a deliberate review instead of silently changing retry classification if the test is skipped or weakened.
In `packages/dashmate/test/unit/templates/envoyTemplate.spec.js`:
- [NITPICK] packages/dashmate/test/unit/templates/envoyTemplate.spec.js:46-49: Avoid a TypeError when the Envoy compressor block has no content types
If the rendered compressor block contains no matching content-type lines, `match()` returns `null` and the test throws a TypeError before reaching an assertion. This produces a misleading failure and obscures the actual template regression. Normalize the match result to an empty array before mapping it.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Rust workspace test failure is pre-existing and unrelated — The supplied CI snapshot shows
Rust workspace tests / Testsfailing in the untouchedpackages/rs-sdk/src/platform/identities_contract_keys_query.rsbecauseQuerySettingsinitializers omitverified_protocol_version. The changed files do not include this module, and the failure is unrelated to the gzip transport changes.- Follow-up: Track or fix the
rs-sdkQuerySettings initializer issue separately on the appropriate development branch.
- Follow-up: Track or fix the
|
Bots are done — your move: post |
|
Waiting for bot review — coderabbitai ✓ · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
@coderabbitai review 🤖 Posted autonomously by Claude on behalf of pasta. |
|
|
@coderabbitai review 🤖 Posted autonomously by Claude on behalf of pasta. |
✅ Action performed
|
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The PR correctly wires gzip negotiation through the native Platform/Core servers and clients and adds grpc-web compression at the gateway. However, enabling gzip changes tonic's existing 32 MiB response limit to apply after compression, allowing much larger highly compressible responses to be generated and buffered by the public DAPI; this is a blocking unauthenticated DoS risk. CI checks covering the changed code are still in progress.
🔴 1 blocking | 🟡 2 suggestion(s)
1 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — This is a cross-cutting change to Rust gRPC server/client transport, retry and decompression-limit handling, and Envoy configuration, but it does not directly modify consensus, funds, cryptography, key handling, or storage migrations. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `packages/rs-dapi/src/server/grpc.rs`:
- [BLOCKING] packages/rs-dapi/src/server/grpc.rs:50-61: Gzip compression bypasses the server's 32 MiB response-size backstop
With tonic 0.14's server encoder, enabling `send_compressed` first serializes the response into an uncompressed buffer, compresses it, and then applies `max_encoding_message_size` to the compressed payload. Before this change, the same 32 MiB limit bounded the raw protobuf response; now a highly compressible response whose uncompressed size exceeds 32 MiB can pass as long as its gzip representation is below 32 MiB. The DAPI must still materialize and compress the larger response before the limit is checked, so an unauthenticated caller can repeatedly consume substantial memory and CPU. The same regression exists in both `platform_server()` and `core_server()`. Preserve a raw/uncompressed response-size bound, or reject responses whose uncompressed encoding exceeds `MAX_ENCODING_BYTES` before compression.
- [SUGGESTION] packages/rs-dapi/src/server/grpc.rs:55-62: Core response compression lacks direct test coverage
(existing thread: https://github.com/dashpay/platform/pull/5577#discussion_r4369224008)
`core_server()` is a separate production constructor with its own `send_compressed(CompressionEncoding::Gzip)` call, but the added end-to-end test exercises only `platform_server()`. A future Core-only edit could remove or misconfigure gzip while the Platform test continues to pass. A focused Core harness can use an unreachable Core RPC endpoint: `get_blockchain_status` deliberately converts Core RPC failures into absent fields and still returns a successful response, providing a small response whose compression headers can be asserted without a live Core node.
In `packages/rs-dapi-client/src/transport/grpc.rs`:
- [SUGGESTION] packages/rs-dapi-client/src/transport/grpc.rs:153-155: Do not trust a remote status message to identify a local decompression limit
After tonic converts a client-side decompression-limit failure into `Status`, `can_retry()` has no provenance indicating that the status was generated locally. A malicious or faulty DAPI node can return `ResourceExhausted` with a message beginning `Error decompressing: size limit`, causing the client to classify the response as non-retryable and skip node failover or banning. This lets the node remain in rotation and repeatedly fail requests. Preserve local decoder-error provenance before converting it to `Status`, or use a transport-level discriminator that a remote peer cannot forge, rather than relying solely on the peer-controlled status message.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw 1 thread unresolved — resolve it. Wait for the missing reviews, or a writer can post |
|
@coderabbitai review 🤖 Posted autonomously by Claude on behalf of pasta. |
✅ Action performed
|
|
Your move: thepastaclaw left review threads unresolved; resolve them. |
|
Implemented the blocking gzip response-size fix in
Focused
The PR remains draft while CI and PastaClaw re-review run. 🤖 Posted autonomously by Codex on behalf of pasta. |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The gzip implementation is correctly scoped across native gRPC, grpc-web, and Drive response boundaries. The current head restores the raw 32 MiB Drive response cap and adds Core coverage; one non-blocking test-coverage gap remains because the Envoy test does not pin the explicitly required window_bits: 15 setting. Relevant completed CI checks pass, while the broader test-suite jobs are still in progress.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
Follow-up candidates (optional) (1)
New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.
🟡 Suggestion: Pin window_bits: 15 in the Envoy compressor test
packages/dashmate/test/unit/templates/envoyTemplate.spec.js:49-59
The production template explicitly sets window_bits: 15, and the PR description identifies this setting as important for preserving compression savings on responses over 64 KiB. The test verifies filter ordering and the grpc-web content types but does not assert the window size, so reverting to Envoy's default could silently pass the test while materially reducing compression efficiency.
expect(envoyConfig.slice(compressor, grpcWeb)).to.include('window_bits: 15');
source: muse-spark-1.3-contributor (phase1-reviewer: general)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — This is a large, cross-cutting DAPI transport change involving gRPC compression, Envoy configuration, client decompression limits, retries, and error handling, but it does not alter consensus, funds, cryptography, key handling, or storage migrations. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Code unchanged since the last final review (
f72755b4): 1 new suggestion(s) listed as follow-up candidates, not posted inline - Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
|
Bots are done — your move: post |
DAPI sent every response uncompressed: rs-dapi claimed Envoy handled compression, but the gateway had no compressor filter. - rs-dapi gzip-compresses Platform and Core responses for clients that list gzip in grpc-accept-encoding; other clients are unaffected. - Native rs-dapi-client clients accept gzip responses (pure-Rust flate2, no new C dependency). The wasm client is unchanged: browsers negotiate HTTP Content-Encoding with the gateway themselves. - The gateway gzips grpc-web responses (32 KiB window) for clients that send Accept-Encoding; native gRPC is never HTTP-compressed. - A gzip response that decompresses past the client's decode limit is not retried, like an uncompressed oversized response, so it no longer bans healthy nodes. On a mainnet sample, gzip saves 65% of response bytes overall (29% without responses over 64 KiB); single-identity proofs barely change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…st match Co-Authored-By: Claude Opus 5.5 <[email protected]>
…st-compression With gzip on, tonic checks max_encoding_message_size against the compressed message, so a highly compressible response larger than 32 MiB raw could be compressed and sent. Cap the Drive client's decode limit at the same 32 MiB so such a response is refused before DAPI encodes or compresses it. Also cover core_server's gzip negotiation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop the extra Drive response cap and the server-constructor extraction: DAPI responses never come near 32 MiB (queries return at most 100 elements, the largest mainnet response measured was 602 KB), and the pre-existing limits already bound what DAPI holds in memory. The gzip negotiation and retry tests stay, with the harness enabling compression the same way the server does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on_config Co-Authored-By: Claude Opus 5.5 <[email protected]>
bc43fe7 to
4382812
Compare
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: This head rebases DAPI response compression onto v5.2-dev without changing the PR’s compression logic: native gRPC negotiates message-level gzip, and Envoy compresses gRPC-Web responses. CI shows the RS-DAPI image build, wasm32 tests, and Kotlin SDK tests passed; Rust workspace tests, Dashmate tests, and other checks remain pending, with no failed code checks reported.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The change spans server, client, and gateway behavior, but it uses existing gzip codecs and adjusts size limits and retries without implementing or rewriting peer-facing deserialization. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(lane failed),glm-5.3-flash(not used above high effort; tier asks max) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
|
Bots are done — your move: post |
Issue being fixed or feature implemented
DAPI sends every response uncompressed. rs-dapi's Drive client says compression is "handled by Envoy", but the gateway has no compressor filter, and neither rs-dapi nor rs-dapi-client enables tonic compression. Checked live against mainnet evonodes (DAPI 4.1.x): native gRPC responses carry no
grpc-encodingeven when the client sendsgrpc-accept-encoding: gzip, and grpc-web responses carry noContent-Encodingeven when the client sendsAccept-Encoding: gzip, br.Replaces #5576.
What was done?
grpc-accept-encoding. Clients that don't list it get uncompressed responses as before. Compressed requests are still not accepted.Content-Encodingwith the gateway and decompress on their own. Also,grpc-accept-encodingisn't in the gateway's CORS allow-list, so sending it from a browser would fail the preflight.max_decoding_message_size, tonic returnsResourceExhausted("Error decompressing: size limit…") instead of theOutOfRangean uncompressed oversized response gets.ResourceExhaustedis retryable and bans the node, so without this fix one oversized response would ban healthy nodes one after another, for a limit that lives in the client. That status is now not retryable, the same asOutOfRange.application/grpc-web*). It sits abovegrpc_web, so the trailer frame is compressed too. Nativeapplication/grpcresponses are never HTTP-compressed; rs-dapi compresses those messages itself. It useswindow_bits: 15(zlib's 32 KiB window) instead of Envoy's 4 KiB default. On the mainnet sample, the default window would cut savings on responses over 64 KiB from 82.6% to 5.5%, and over all messages from 55.2% to 12.3%. The cost is about 144 KiB of zlib state per in-flight compressed response.transportfeature enablestonic/gzip.packages/rs-dapi/doc/DESIGN.mdis corrected. The rs-dapi → Drive hop stays uncompressed because it's local.js-dapi-client in Node (
@grpc/grpc-js) already sendsgrpc-accept-encoding: identity,deflate,gzip, so it gets compressed responses without changes.Measurements (real responses)
162 read-only responses collected from 3 mainnet evonodes on 2026-10-25 (protocol 13, height 458,086), plus 227 from testnet. Each message was compressed on its own, the way gRPC per-message compression works. Savings are by bytes, gzip level 6, which is what tonic uses.
getFinalizedEpochInfosgetCurrentQuorumsInfogetDocuments(DPNS, DashPay)getDataContract/getDataContractsgetEpochsInfoTestnet (protocol 14): 47.8% overall, 43.1% excluding responses over 64 KB.
The savings come from embedded payloads: contract schemas, documents, epoch and quorum data. Small proofs that are mostly 32-byte Merk hashes don't compress. 37 of the 119 mainnet messages, almost all single-identity proofs of 1–4 KB, come out slightly larger, by at most 23 bytes. I did not add a size threshold. tonic has none built in, and the loss on those messages is tiny next to the gains on the large ones.
zstd-3 saves within 1–4 points of gzip-6 at about 4× less CPU. The cost is a C dependency, so it is left for later. Measured CPU for gzip-6 (single thread, Apple M4 Pro, zlib): median 24 µs to compress a message, 5 µs to decompress, about 117 MB/s compression throughput. That's small next to the cost of producing a proof.
The percentages depend on the query mix, not on production traffic. Mainnet nodes were on 4.1.x, so v5 response shapes may differ somewhat.
How Has This Been Tested?
should_gzip_responses_only_for_clients_that_accept_gzip. It serves the Platform service with gzip enabled as in production, over an in-memory connection, and checks three things: a plain tonic client gets nogrpc-encoding, a client built withrs_dapi_client::transport::new_platform_clientgetsgrpc-encoding: gzip, and both decode to the same message.should_not_ban_nodes_for_a_gzip_response_over_the_client_limit. A compressible response goes through the real server to a client with a 1 KiB decode limit, and the test asserts the status is not retryable. Without the retry fix it fails with exactly thatResourceExhaustedstatus.corsandgrpc_weband restricts it to the grpc-web content types.cargo test -p rs-dapi --lib protobuf_request_errors,cargo test -p rs-dapi --lib server::andcargo test -p rs-dapi-client --all-features.cargo clippy -p rs-dapi -p rs-dapi-client -p dapi-grpc --all-features --all-targets --no-deps -- -D warnings.cargo check --target wasm32-unknown-unknownforrs-dapi-clientandwasm-sdk. flate2 is not in the wasm dependency tree.packages/dashmate/scripts/validate-envoy-config.js --smoke: all 8 config variants and the rate-limit smoke checks pass on bothenvoyproxy/envoy:v1.39.0and the pinneddashpay/envoy:1.39.0-impr.1.Accept-Encoding: gzip:content-encoding: gzip, 4,396 → 2,083 bytes on the wire, message and trailer frame intact after decompression.Accept-Encoding: unchanged response.Accept-Encoding: gzip: compressed.grpc-encoding: gzip, 4,361 → 2,035 bytes, decompresses to the exact payload). Envoy does not HTTP-compressapplication/grpc.Breaking Changes
None. Compression only happens when the client asks for it, so old clients see no change, and new clients work against old nodes.
Checklist:
For repository code-owners and collaborators only
🤖 Generated with Claude Code
Summary by CodeRabbit
PR Hygiene ·
4382812/self-reviewedCargo.lock,packages/dapi-grpc/Cargo.toml,packages/rs-dapi-client/src/transport.rsand 3 more) — QuantumExplorer or shumkovdashmate(packages/dashmate/templates/platform/gateway/envoy.yaml.dot,packages/dashmate/test/unit/templates/envoyTemplate.spec.js) — ktechmidas or shumkovrust-dapi(packages/rs-dapi/doc/DESIGN.md,packages/rs-dapi/src/clients/drive_client.rs,packages/rs-dapi/src/server/grpc.rsand 2 more) — QuantumExplorer or lklimek or shumkovWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.