perf: enable gzip/brotli on witness/data HTTP transport#147
Merged
Conversation
The witness/data RPC client uses alloy-provider's HTTP transport, backed by reqwest 0.12, which had no compression features enabled — so the validator fetched responses uncompressed and paid the full base64(zstd) witness size on the wire (mega_getBlockWitness returns "v0:"+base64(zstd), ~33% larger than raw zstd). Add a direct reqwest 0.12 dependency in stateless-common with the gzip and brotli features; via Cargo feature unification this enables compression on the reqwest 0.12.24 that alloy shares, so reqwest now auto-sends Accept-Encoding: gzip, br and transparently decompresses. Cloudflare serves the witness Worker response Brotli-compressed, recovering the base64 overhead (~25% less witness bandwidth in testing: 30095B -> 22672B). No code or wire-format change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
Author
验证器栈实测(reqwest 0.12 + PR 开的 gzip/brotli)对 6906400–6906404 这 5 个块,用 validator 实际的 reqwest 栈各发三种请求:
after-PR 比 before-PR 省 25.1% 线上带宽。 三点结论
一句话PR #147 对官方端点(它本身就 gzip 压缩响应)带来 ~25% 的 witness 带宽下降,witness 越大绝对节省越多;收益完全在传输层,应用语义/数据零变化。这个探针是临时的,已删除,不进 PR。 |
Troublor
approved these changes
Jun 24, 2026
vincent-k2026
approved these changes
Jun 24, 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.
Summary
The witness/data RPC client uses alloy-provider's HTTP transport, backed by reqwest 0.12, which had no compression features enabled — so the validator fetched responses uncompressed and paid the full base64(zstd) witness size on the wire (
mega_getBlockWitnessreturns"v0:" + base64(zstd), ~33% larger than raw zstd).This adds a direct
reqwest = "0.12"dependency instateless-commonwith thegzipandbrotlifeatures. Via Cargo feature unification it enables compression on thereqwest 0.12.24that alloy-provider shares, so reqwest auto-sendsAccept-Encoding: gzip, brand transparently decompresses. The crate is intentionally not referenced in code.Once the client advertises support, Cloudflare serves the witness Worker response Brotli-compressed, recovering the base64 overhead: in testing one witness dropped from 30095 B (identity) to 22672 B (
content-encoding: br), ~25% less wire bandwidth (larger witnesses save more).No code or wire-format change;
cargo check -p stateless-commonpasses andCargo.lockwas regenerated by cargo.