fix: add multicall batching to viem client#2254
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
|
Warning Review limit reached
More reviews will be available in 52 minutes and 25 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA new utility module ChangesPublic client builder extraction and DI integration
🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryEnables viem multicall batching on the ENS root chain
Confidence Score: 5/5Safe to merge — the change is a focused, additive configuration tweak with a clean extraction refactor. The diff is small and self-contained: multicall batching is opt-in at the viem client level and degrades gracefully (viem falls back to individual calls if the multicall contract isn't available). The new explicit chain setting is a correctness improvement needed for viem to locate the right multicall3 contract. No logic paths are altered in di.ts beyond delegating to the new helper. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant DI as EnsApiDiContainer
participant Builder as buildRootChainPublicClient
participant Viem as viem PublicClient
participant MC as Multicall3 Contract (on-chain)
participant RPC as Fallback HTTP RPCs
DI->>Builder: buildRootChainPublicClient(rootChainRpcConfig, namespace)
Builder->>Viem: "createPublicClient({ chain, batch.multicall, transport: fallback([...]) })"
Viem-->>DI: PublicClient instance
note over Viem,MC: On contract reads
DI->>Viem: readContract / call (N calls in same tick)
Viem->>MC: aggregate3 batch (≤2048 bytes calldata)
MC-->>RPC: single eth_call
RPC-->>MC: aggregated results
MC-->>Viem: decoded results[]
Viem-->>DI: results
Reviews (4): Last reviewed commit: "rename build function" | Re-trigger Greptile |
|
@greptile review |
closes #2237
Summary
Enabling multicall batchin in viem: https://viem.sh/docs/clients/public#batchmulticall-optional
Why
Viem doesnt support
eth_callbatching by default!Testing
Notes for Reviewer (Optional)
Pre-Review Checklist (Blocking)