feat: automatic createRateLimitedFetch wrapper#270
Open
andrevmatos wants to merge 8 commits into
Open
Conversation
Move fetch rate-limiting out of utils into a dedicated fetch.ts and make it adaptive: runs at full speed by default, throttling only when an endpoint actually rate-limits it. - per-endpoint AIMD concurrency cap (default 5; halves to 1 on a 429, ramps back on sustained success) — collapses a 429 storm into one patient retry - per-(endpoint,method) rate pacer: paces only when the server gives an explicit reset window (Retry-After/RateLimit-Reset); header-less 429s (e.g. Solana) use jittered exponential backoff instead - standard + de-facto rate-limit header parsing (Retry-After, RateLimit-*, X-RateLimit-*, Solana x-ratelimit-method-*) - web fetch-contract semantics (returns non-ok responses, throws only on network/abort); per-endpoint state shared across instances Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wire the default rate-limited fetch into every fromUrl constructor, with a ctx.fetch opt-out: a caller-supplied fetch is used verbatim (unwrapped). - ChainContext.fetch opt-out - EVM via ethers FetchRequest adapter; Solana via ConnectionConfig.fetch; Sui via JsonRpcHTTPTransport - TON + Canton via shared createAxiosFetchAdapter (Canton only when ctx.fetch is given, preserving its native HTTP/2 default) - Aptos custom Client shim, applied in fromUrl/fromAptosConfig only (never fromProvider) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Detect "block range too large" RPC errors (Alchemy/Infura/QuickNode/erpc and a generic block-range matcher), learn the max range per endpoint, and transparently re-chunk — removing the need for the manual --page CLI flag. - CCIPLogRangeTooLargeError + parseLogRangeError (extracts max/suggested range) - per-endpoint learned range shared across getLogs calls - remove ccip-cli --page option (LogFilter.page kept as an optional override) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
👋 andrevmatos, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
…ecovery hint
endpointKey() now wraps new URL() in try/catch so block tags ('safe', 'latest')
and other non-URL strings don't throw when passed as endpoint identifiers.
Adds missing DEFAULT_RECOVERY_HINTS entry for LOG_RANGE_TOO_LARGE — the
recovery.ts exhaustiveness check was failing CI.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Coverage Report |
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.
fetchpassthrough, full-speedChainContext.fetchto opt-outEVMChain.getLogscan catchblock range too largeerrors and auto-adaptpagesizecli --pageoption (not needed anymore, auto-detected and retried)