Skip to content

refactor: extract SOCKS proxy resolution into a cache - #11619

Merged
schneiderstefan merged 5 commits into
masterfrom
stschnei/socks-proxy
Sep 28, 2026
Merged

schneiderstefan merged 5 commits into
masterfrom
stschnei/socks-proxy

Conversation

@schneiderstefan

Copy link
Copy Markdown
Contributor

CanisterHttpPoolManagerImpl::get_socks_proxy_addrs resolved the API boundary nodes that outcalls may be proxied through. That is registry policy rather than consensus logic, and an upcoming second caller (HTTP outcalls from composite queries) needs the same answer.

Move it into a new ic-https-outcalls-socks-proxy crate as a SocksProxyCache. In addition to the refactor, this commit also introduces caching for repeated lookups under the same registry version.

The pool manager builds its own provider from the registry_client and subnet_type it already receives, so its constructor is unchanged, and it resolves the same addresses as before. Only the logging thins out: the per-node warnings now appear once per registry version rather than on every on_state_change. The failure metrics still tick on every call, which is why the resolution hands its failures back to the caller instead of recording them itself.

`CanisterHttpPoolManagerImpl::get_socks_proxy_addrs` resolved the API
boundary nodes that outcalls may be proxied through. That is registry
policy rather than consensus logic, and an upcoming second caller (HTTP
outcalls from composite queries) needs the same answer.

Move it into a new `ic-https-outcalls-socks-proxy` crate as a
`SocksProxyCache`. In addition to the refactor, this commit also
introduces caching for repeated lookups under the same registry version.

The pool manager builds its own provider from the `registry_client` and
`subnet_type` it already receives, so its constructor is unchanged, and it
resolves the same addresses as before. Only the logging thins out: the
per-node warnings now appear once per registry version rather than on every
`on_state_change`. The failure metrics still tick on every call, which is
why the resolution hands its failures back to the caller instead of
recording them itself.
@schneiderstefan
schneiderstefan requested a review from a team as a code owner September 18, 2026 11:15
@zeropath-ai

zeropath-ai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to fe7b991.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/https_outcalls/socks_proxy/Cargo.toml
&& ic-https-outcalls-socks-proxy dependency configuration updates
► rs/https_outcalls/socks_proxy/BUILD.bazel
► rs/https_outcalls/socks_proxy/src/lib.rs
► rs/https_outcalls/consensus/src/pool_manager.rs
► rs/https_outcalls/consensus/src/metrics.rs
► rs/https_outcalls/consensus/BUILD.bazel
► rs/https_outcalls/consensus/Cargo.toml
► rs/test_utilities/registry/src/lib.rs
► rs/https_outcalls/socks_proxy/tests (test additions and modifications in related files)
Refactor ► rs/https_outcalls/consensus/src/pool_manager.rs
- Introduces SocksProxyCache usage and replaces direct socks_proxy_addrs logic
- Adds new field socks_proxy and integrates SocksProxyCache into initialization
Bug Fix ► rs/https_outcalls/socks_proxy/src/lib.rs
- Implemented SocksProxyCache with memoization and error observation
- Added socks_proxy_addr calculation and boundary node resolution logic
- Handles unresolved/ unreadable registry scenarios without failing calls
Enhancement ► rs/https_outcalls/socks_proxy/src/lib.rs
- Added tests module for socks proxy resolution behavior (boundary node selection by subnet type, skipping unresolved nodes, memoization, and version advancement)
Configuration changes ► rs/https_outcalls/socks_proxy/BUILD.bazel
► rs/https_outcalls/socks_proxy/Cargo.toml
► rs/https_outcalls/consensus/BUILD.bazel
► rs/https_outcalls/consensus/Cargo.toml
► Cargo.lock (dependency addition of ic-https-outcalls-socks-proxy)

@schneiderstefan
schneiderstefan added this pull request to the merge queue Sep 28, 2026
Merged via the queue into master with commit b563579 Sep 28, 2026
38 checks passed
@schneiderstefan
schneiderstefan deleted the stschnei/socks-proxy branch September 28, 2026 08:53
basvandijk added a commit that referenced this pull request Sep 28, 2026
Conflicts in `rs/https_outcalls/consensus/BUILD.bazel` and `Cargo.lock`:
this branch dropped `slog` from the crate's test deps while master (#11619)
dropped `strum`. Neither is used by the crate anymore, so both are removed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
basvandijk added a commit that referenced this pull request Sep 28, 2026
The crate added on master in #11619 only logs through ic_logger's macros,
which this branch changed to expand to `$crate::slog`, so the direct slog
dependency is no longer needed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants