fix: charge RPC batches by operation cost - #728
Conversation
Bound expensive RPC parameters and account for method and request complexity before forwarding to the upstream provider.
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 11 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository: euler-xyz/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
🚅 Deployed to the euler-lite-pr-728 environment in euler-lite(dev,PR previews)
|
LeonardEulerXYZ
left a comment
There was a problem hiding this comment.
Reviewed at 8d707f6025ed73eb9bb9895477a1cc0e02097f4e.
Verdict: changes requested — batch aggregation, parameter bounds, state-override accounting, bounded log filters, and fee-history limits are well covered, but eth_call can bypass the gas-cost modifier by omitting the optional gas field. That preserves the expensive upstream execution while receiving only the cheapest call charge; see the inline finding.
Validation:
- focused RPC route tests: 37 passed
- Nuxt typecheck: passed
- focused ESLint: passed
git diff --check: passed- repository CI and preview deployment: green
The 100-operation batch is now charged operation-by-operation, malformed/oversized inputs are rejected before limiter consumption/upstream fetch, and the abstraction remains centralized. Browser screenshots are not applicable to this server/API cost-accounting change.
| } | ||
|
|
||
| let cost = steppedModifier(calldataBytes, CALLDATA_COST_CHUNK_BYTES) | ||
| if (transaction.gas !== undefined) { |
There was a problem hiding this comment.
Medium — omitting gas bypasses the execution-cost charge. gas is optional for eth_call; when absent, the RPC node still executes with its configured/default call gas cap, which can be as expensive as the maximum allowed explicit gas. Here the modifier only runs when the client supplies transaction.gas, so an adversary can remove that field and reduce a potentially max-cost call to the base cost of 2. Please conservatively charge omitted gas against an appropriate default/cap (or otherwise bound the upstream execution), and add a regression test proving that removing gas cannot make the same expensive call materially cheaper.
Summary
Changes
Test plan