feat(starknet): honor HTTP(S)_PROXY env vars in outbound JSON-RPC clients#643
Merged
Conversation
…ents Replace the jsonrpsee hyper-based HTTP transport with a reqwest-backed implementation of jsonrpsee's ClientT trait. reqwest natively supports the standard HTTP_PROXY/HTTPS_PROXY/NO_PROXY environment variables (including CONNECT tunneling for HTTPS targets), so every client built on StarknetRpcClient — forking, full-node sync, messaging, TEE, bootstrap — and the RPC server's paymaster proxy now work behind a forward proxy. Loopback targets always bypass the proxy so local sidecars and dev/test flows keep working without requiring a NO_PROXY entry. The WebSocket client and localhost-only helpers (paymaster sidecar health poll, test runner) intentionally stay on jsonrpsee. Co-Authored-By: Claude Fable 5 <[email protected]>
HTTP(S)_PROXY env vars in outbound JSON-RPC clients
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.
| Benchmark suite | Current: 600f431 | Previous: 3d856a6 | Ratio |
|---|---|---|---|
ContractClassChange/compress |
183 ns/iter (± 2) |
139 ns/iter (± 2) |
1.32 |
GenericContractInfo/decompress |
102 ns/iter (± 3) |
78 ns/iter (± 2) |
1.31 |
FinalityStatus/compress |
1 ns/iter (± 0) |
0 ns/iter (± 0) |
+∞ |
VersionedContractClass/compress |
377 ns/iter (± 5) |
282 ns/iter (± 6) |
1.34 |
TrieHistoryEntry/decompress |
260 ns/iter (± 10) |
190 ns/iter (± 4) |
1.37 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @kariy
Codec benchmark diff vs
|
| Benchmark | Baseline (ns) | Current (ns) | Δ |
|---|---|---|---|
CompiledClass(fixture)/compress |
2172076 | 2760487 | +27.09% |
CompiledClass(fixture)/decompress |
2544155 | 2814941 | +10.64% |
ExecutionCheckpoint/compress |
28 | 33 | +17.86% |
ExecutionCheckpoint/decompress |
21 | 24 | +14.29% |
PruningCheckpoint/compress |
28 | 32 | +14.29% |
PruningCheckpoint/decompress |
21 | 24 | +14.29% |
VersionedHeader/compress |
574 | 652 | +13.59% |
VersionedHeader/decompress |
655 | 825 | +25.95% |
StoredBlockBodyIndices/compress |
64 | 75 | +17.19% |
StoredBlockBodyIndices/decompress |
34 | 35 | +2.94% |
StorageEntry/compress |
108 | 134 | +24.07% |
StorageEntry/decompress |
112 | 137 | +22.32% |
ContractNonceChange/compress |
108 | 138 | +27.78% |
ContractNonceChange/decompress |
185 | 235 | +27.03% |
ContractClassChange/compress |
139 | 183 | +31.65% |
ContractClassChange/decompress |
196 | 250 | +27.55% |
ContractStorageEntry/compress |
119 | 147 | +23.53% |
ContractStorageEntry/decompress |
254 | 311 | +22.44% |
GenericContractInfo/compress |
106 | 131 | +23.58% |
GenericContractInfo/decompress |
78 | 102 | +30.77% |
Felt/compress |
55 | 68 | +23.64% |
Felt/decompress |
45 | 51 | +13.33% |
BlockHash/compress |
55 | 68 | +23.64% |
BlockHash/decompress |
45 | 51 | +13.33% |
TxHash/compress |
55 | 68 | +23.64% |
TxHash/decompress |
46 | 51 | +10.87% |
ClassHash/compress |
55 | 68 | +23.64% |
ClassHash/decompress |
45 | 51 | +13.33% |
CompiledClassHash/compress |
55 | 67 | +21.82% |
CompiledClassHash/decompress |
46 | 51 | +10.87% |
BlockNumber/compress |
28 | 30 | +7.14% |
BlockNumber/decompress |
21 | 24 | +14.29% |
TxNumber/compress |
28 | 30 | +7.14% |
TxNumber/decompress |
21 | 24 | +14.29% |
FinalityStatus/compress |
0 | 1 | +Infinity% |
FinalityStatus/decompress |
8 | 10 | +25.00% |
TypedTransactionExecutionInfo/compress |
31280 | 16211 | -48.17% |
TypedTransactionExecutionInfo/decompress |
3195 | 3567 | +11.64% |
VersionedContractClass/compress |
282 | 377 | +33.69% |
VersionedContractClass/decompress |
655 | 772 | +17.86% |
MigratedCompiledClassHash/compress |
109 | 136 | +24.77% |
MigratedCompiledClassHash/decompress |
110 | 142 | +29.09% |
ContractInfoChangeList/compress |
1346 | 1406 | +4.46% |
ContractInfoChangeList/decompress |
1990 | 2180 | +9.55% |
BlockChangeList/compress |
540 | 610 | +12.96% |
BlockChangeList/decompress |
798 | 853 | +6.89% |
ReceiptEnvelope/compress |
26970 | 27859 | +3.30% |
ReceiptEnvelope/decompress |
5497 | 5930 | +7.88% |
TrieDatabaseValue/compress |
140 | 165 | +17.86% |
TrieDatabaseValue/decompress |
250 | 234 | -6.40% |
TrieHistoryEntry/compress |
266 | 286 | +7.52% |
TrieHistoryEntry/decompress |
190 | 260 | +36.84% |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #643 +/- ##
==========================================
- Coverage 73.32% 68.44% -4.88%
==========================================
Files 209 336 +127
Lines 23132 47368 +24236
==========================================
+ Hits 16961 32422 +15461
- Misses 6171 14946 +8775 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Adds a reqwest-backed implementation of jsonrpsee's
ClientTtrait (katana_starknet::http::HttpClient) and makes it the default transport forStarknetRpcClientand the RPC server'sPaymasterProxy, so all outbound JSON-RPC connections (forking, full-node sync, messaging, TEE, bootstrap, paymaster forwarding) honor the standard proxy environment variables like the rest of katana's reqwest/alloy clients already do.Proxy environment variables
HTTPS_PROXYis the de-facto standard way to route a process's outbound traffic through a forward proxy — needed in environments without direct egress, e.g. corporate networks or sandboxed/TEE VMs. Katana now reads:HTTPS_PROXYhttps://targets. The client opens an HTTPCONNECTtunnel through the proxy and runs TLS end-to-end inside it, so the proxy never sees plaintext.HTTP_PROXYhttp://targets (requests are forwarded in absolute-form).NO_PROXYLowercase variants (
https_proxy, …) are also recognized. Values are read when a client is constructed, i.e. at node startup. Example:Loopback bypass: targets on
localhost/127.0.0.1/::1always connect directly, even with a proxy configured — local sidecars (paymaster, VRF) and dev/test flows keep working without users having to maintain aNO_PROXYentry.Not covered: SOCKS proxies and OS-level proxy settings (macOS System Settings / Windows registry); only the environment variables are read. See
docs/proxy.mdfor the full write-up.Why a new transport
jsonrpsee's hyper-based
HttpClienthardcodes its connector and has no proxy support, so the jsonrpsee-built clients were the only ones in katana that ignored these variables. The new transport mirrors jsonrpsee's wire format, request-id checking, and error-variant semantics, soStarknetApiErrormapping and retry classification are unchanged; the WebSocket client and localhost-only helpers stay on jsonrpsee.Covered by 9 new tests, including proxy routing through a mock forward proxy (asserting absolute-form forwarding) and loopback bypass.
🤖 Generated with Claude Code