Skip to content

perf: eliminate redundant read_dispair calls in try_into_call#2793

Open
thedavidmeister wants to merge 2 commits into
mainfrom
2026-06-29-issue-2776-dispair-cache
Open

perf: eliminate redundant read_dispair calls in try_into_call#2793
thedavidmeister wants to merge 2 commits into
mainfrom
2026-06-29-issue-2776-dispair-cache

Conversation

@thedavidmeister

Copy link
Copy Markdown
Contributor

Summary

try_into_call previously called read_dispair three times — once inline and once inside each try_parse_rainlang call — totalling 12 sequential RPC round-trips just to read 4 immutable deployer addresses. At 300ms RTT (remote RPC) that is ~3.6s of avoidable latency.

Changes

  • Add parse_bytecode_with_dispair: the parsing body extracted from try_parse_rainlang, takes a pre-fetched DISPaiR (no additional dispair reads).
  • try_parse_rainlang is now a thin wrapper: read_dispair + parse_bytecode_with_dispair. All existing tests remain unchanged.
  • try_into_call calls read_dispair once, clones for the first parse, moves for the second parse, and extracts interpreter/store upfront.

Result

RPC calls per generate_deposit_and_add_order_calldatas (dispair portion):

Before After
12 (3× read_dispair) 4 (1× read_dispair)

Total for a single deposit+addOrder: 14 → 6 sequential eth_call round-trips, saving ~2.4s at 300ms RTT.

Test

Adds assertions to test_into_add_order_call verifying both config.evaluable.interpreter/store and tasks[0].evaluable.interpreter/store match the expected interpreter/store addresses (and match each other). This mutation-validates that both evaluables receive the correct dispair from the single shared read.

Closes #2776

Co-Authored-By: Claude noreply@anthropic.com

try_into_call previously called read_dispair 3 times (once directly and
once inside each try_parse_rainlang call), totalling 12 sequential RPC
round-trips just to read 4 immutable deployer addresses.

Add parse_bytecode_with_dispair, which takes a pre-fetched DISPaiR and
skips the read_dispair step. try_parse_rainlang becomes a wrapper around
read_dispair + parse_bytecode_with_dispair. try_into_call now calls
read_dispair once and passes the result to both parse calls via clone/move.

RPC calls for a single deposit+addOrder submission: 14 → 6 (saves 8
sequential round-trips, ~2.4s at 300ms RTT).

Adds assertions to test_into_add_order_call verifying both config.evaluable
and tasks[0].evaluable carry the correct interpreter and store addresses
from the single shared dispair read.

Closes #2776

Co-Authored-By: Claude <noreply@anthropic.com>
@thedavidmeister thedavidmeister self-assigned this Jun 29, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@thedavidmeister, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 18 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4080815a-60cf-469b-a838-48ec1ca5fd2a

📥 Commits

Reviewing files that changed from the base of the PR and between 8e382f8 and 85559f5.

📒 Files selected for processing (1)
  • crates/common/src/add_order.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-06-29-issue-2776-dispair-cache

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Mark try_parse_rainlang as #[cfg(test)] — after the try_into_call
refactor it is only called from tests, so the production build flags
it as dead code under -D warnings.

Co-Authored-By: Claude <noreply@anthropic.com>
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.

RaindexOrderBuilder: sequential RPC round-trips inflate order prep

1 participant