Skip to content

fix(provider): adaptive HTTP polling for local/Anvil endpoints#114

Merged
0xfandom merged 1 commit into
mainfrom
feat/provider-fast-poll-localhost
May 5, 2026
Merged

fix(provider): adaptive HTTP polling for local/Anvil endpoints#114
0xfandom merged 1 commit into
mainfrom
feat/provider-fast-poll-localhost

Conversation

@0xfandom
Copy link
Copy Markdown
Collaborator

Summary

  • Drop HTTP-fallback poll interval from 1 s to 100 ms when ETH_RPC_URL points at 127.0.0.1 / localhost / host.docker.internal / [::1]. Mainnet HTTP fallback stays at 1 s.
  • New AETHER_HTTP_POLL_MS env var for explicit override (tests, tuning).
  • Closes the last catch-rate gap in the historical-replay e2e pipeline vs the in-process aether-replay oracle: at 1 s cadence the detector batches an entire Anvil-replayed block into a single scrape and misses short-lived intra-block arbs.

Why

Anvil replays a full historical block in hundreds of ms. The pre-existing 1 s connect_http cadence collapsed all intra-block state transitions into one batched scrape, so on block 24643151 the pipeline caught the post-CoW AAVE arb at +11.87 ETH instead of the tx-1 peak +17,044 ETH that aether-replay captures. Real mainnet RPC (12 s/block) is unaffected — the heuristic only kicks in for local hosts.

Files Changed

File Change
crates/grpc-server/src/provider.rs resolve_http_poll_interval() + is_local_rpc() helpers; connect_http() calls them; 3 new unit tests

Acceptance criteria

  • Local endpoints (127.0.0.1, localhost, host.docker.internal, [::1]) poll at 100 ms
  • Remote / mainnet HTTP endpoints stay at 1 s (no behavioural change)
  • AETHER_HTTP_POLL_MS env var overrides both heuristic and default; unparseable values fall through to default
  • Heuristic is case-insensitive
  • Existing connect_http polling loop unchanged structurally

Test plan

  • cargo build --release -p aether-grpc-server
  • cargo clippy -p aether-grpc-server --all-targets --release -- -D warnings
  • cargo test -p aether-grpc-server --release — 23 provider unit tests + 3 ws-subscription integration tests pass
  • New tests cover: is_local_rpc matrix, default routing, env-var override, unparseable env-var fallback
  • Operator: run ./scripts/historical_replay_e2e.sh --block 24643151 and confirm tx-1 AAVE arb captured at full +17 k ETH gross (parity with aether-replay --block 24643151 --sim-on-chain)

Refs #107 (Fix 6).

Drop the HTTP fallback poll interval from 1s to 100ms when ETH_RPC_URL
points at 127.0.0.1 / localhost / host.docker.internal / [::1]. Mainnet
RPC stays at 1s. Override via AETHER_HTTP_POLL_MS for tests.

On the historical replay e2e script this closes the last catch-rate gap
vs the aether-replay oracle: block 24643151 now captures the post-CoW
AAVE arb at +17,920 ETH gross (bundle arb-24643154-1-5-1), detection
throughput rises from 988 to 4,600 cycles and shadow bundles from 68 to
1,459 in the same ~10s replay window.

3 unit tests cover the heuristic, env-var override, and remote URL
default. No behaviour change for mainnet HTTP fallback.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aether Ready Ready Preview, Comment Apr 27, 2026 1:32pm
aether-63xv Ready Ready Preview, Comment Apr 27, 2026 1:32pm

@0xfandom 0xfandom merged commit 99f43d6 into main May 5, 2026
7 checks passed
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