Skip to content

feat(starknet): honor HTTP(S)_PROXY env vars in outbound JSON-RPC clients#643

Merged
kariy merged 2 commits into
mainfrom
refactor/https-proxy-env-var
Jul 21, 2026
Merged

feat(starknet): honor HTTP(S)_PROXY env vars in outbound JSON-RPC clients#643
kariy merged 2 commits into
mainfrom
refactor/https-proxy-env-var

Conversation

@kariy

@kariy kariy commented Jul 21, 2026

Copy link
Copy Markdown
Member

Adds a reqwest-backed implementation of jsonrpsee's ClientT trait (katana_starknet::http::HttpClient) and makes it the default transport for StarknetRpcClient and the RPC server's PaymasterProxy, 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_PROXY is 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:

Variable Effect
HTTPS_PROXY Proxy for https:// targets. The client opens an HTTP CONNECT tunnel through the proxy and runs TLS end-to-end inside it, so the proxy never sees plaintext.
HTTP_PROXY Proxy for plain http:// targets (requests are forwarded in absolute-form).
NO_PROXY Comma-separated hosts/domains/CIDRs that must connect directly.

Lowercase variants (https_proxy, …) are also recognized. Values are read when a client is constructed, i.e. at node startup. Example:

HTTPS_PROXY=http://proxy.internal:3128 katana --forking.provider https://api.cartridge.gg/x/starknet/mainnet

Loopback bypass: targets on localhost/127.0.0.1/::1 always connect directly, even with a proxy configured — local sidecars (paymaster, VRF) and dev/test flows keep working without users having to maintain a NO_PROXY entry.

Not covered: SOCKS proxies and OS-level proxy settings (macOS System Settings / Windows registry); only the environment variables are read. See docs/proxy.md for the full write-up.

Why a new transport

jsonrpsee's hyper-based HttpClient hardcodes 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, so StarknetApiError mapping 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

…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]>
@kariy kariy changed the title feat(starknet): honor HTTP(S)_PROXY env vars in outbound JSON-RPC clients feat(starknet): honor HTTP(S)_PROXY env vars in outbound JSON-RPC clients Jul 21, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ 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

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codec benchmark diff vs main

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%

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

Runner: AMD EPYC 7763 64-Core Processor (4 cores) · 15Gi RAM

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.55128% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.44%. Comparing base (9bde0ae) to head (600f431).
⚠️ Report is 501 commits behind head on main.

Files with missing lines Patch % Lines
crates/starknet/src/http.rs 94.49% 17 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kariy
kariy merged commit 678ba9d into main Jul 21, 2026
20 of 21 checks passed
@kariy
kariy deleted the refactor/https-proxy-env-var branch July 21, 2026 18:44
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.

1 participant