Skip to content

fix: bound CCIP-Read gateway fetches - #5364

Merged
jxom merged 5 commits into
mainfrom
fix/ccip-read-limits
Nov 1, 2026
Merged

jxom merged 5 commits into
mainfrom
fix/ccip-read-limits

Conversation

@jxom

@jxom jxom commented Nov 1, 2026

Copy link
Copy Markdown
Member

Supersedes #5351 by @mortezashojaei, keeping its gateway hardening and addressing review feedback.

Summary

CCIP-Read gateway URLs are chosen by the contract, so each fetch now gets the same limits as the HTTP transport, and one lookup's fan-out is capped.

  • Timeout and response cap: each gateway request, including its body, uses the transport timeout (default 10s) and reads at most 10 MiB.
  • HTTP(S) only: other schemes are refused. data: URLs, which used to work, are now refused too, and the changeset says so.
  • One budget per lookup: at most 4 nested callbacks, 4 nested local batches, 256 gateway requests in total and 16 concurrent requests, shared across callbacks and nested x-batch-gateway:true batches. Requests over the budget come back as batch failures, so the response list keeps its length.

Changes from #5351:

  • Restored the AGENTS.md rule to cap total queries, nesting and concurrent requests (fix: bound CCIP-Read gateway fetches #5351 rewrote it to cap depth only).
  • Callback depth is passed explicitly. The callback call runs with ccipRead: false and a nested OffchainLookup revert returns to offchainLookup with depth + 1 and the same budget. This replaces the module-level WeakMap keyed on cloned requestOptions, which also changed the callback's multicall batch key.
  • anySignal and readResponseBody moved to src/utils/internal/http.ts and are shared by the HTTP transport and CCIP.

Test plan

  • src/utils/ccip.test.ts, src/utils/ens, src/actions/ens, src/actions/public/call.test.ts against Anvil: 303 passed
  • New tests: query limit (256 fetched, the rest refused), concurrency limit (peak 16), batch depth, budget shared across callbacks
  • pnpm check:types, Biome

@vercel

vercel Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
viem Ready Ready Preview Nov 1, 2026 10:26am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b13377c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T10:23:18.087248Z b13377c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jxom jxom mentioned this pull request Nov 1, 2026
1 of 2 tasks

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2904f4083b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/utils/ccip.ts Resolved
Comment thread src/utils/ccip.ts Resolved
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Published viem@0.0.0-pr-5364-b13377c under the pr-5364 dist-tag, which follows this pull request until it closes.

pnpm add viem@pr-5364
pnpm add viem@0.0.0-pr-5364-b13377c

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a753e1cb02

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/utils/ccip.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d6914081de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/utils/ccip.ts Resolved
@jxom
jxom merged commit 8f2a79b into main Nov 1, 2026
41 checks passed
@jxom
jxom deleted the fix/ccip-read-limits branch November 1, 2026 21:37
This was referenced Nov 1, 2026

This branch was successfully deployed

1 active deployment
Preview — b13377c4 Deployed Nov 1, 2026 by vercel[bot]
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