Skip to content

fix(CallBatchLayer): don't batch if single request - #2397

Merged
DaniPopes merged 15 commits into
alloy-rs:mainfrom
Ayushdubey86:feat-No-batching-for-single-request
Aug 19, 2025
Merged

fix(CallBatchLayer): don't batch if single request#2397
DaniPopes merged 15 commits into
alloy-rs:mainfrom
Ayushdubey86:feat-No-batching-for-single-request

Conversation

@Ayushdubey86

@Ayushdubey86 Ayushdubey86 commented May 5, 2025

Copy link
Copy Markdown
Contributor

Hello @mattsse @DaniPopes,

Raising a draft PR for #2386 — please let me know if the approach looks good.

I’m not converting to Multicall3 immediately upon receiving a request. Instead, I defer conversion until I’ve intercepted and counted the total number of calls. Based on that count, I either perform a normal RPC call (for a single request) or batch them using Multicall3.

I have numbed testcases as of now, if current approach is correct, I'll take on tc

Closes #2386.

@yash-atreya yash-atreya changed the title Raising Draft Pr CallBatchLayer single request fix(CallBatchLayer): don't batch if single request May 5, 2025
Comment thread crates/provider/src/layers/batch.rs Outdated
Comment thread crates/provider/src/layers/batch.rs Outdated
Comment thread crates/provider/src/layers/batch.rs Outdated
Comment thread crates/provider/src/layers/batch.rs Outdated
Comment thread crates/provider/src/layers/batch.rs
@github-project-automation github-project-automation Bot moved this to In Progress in Alloy May 7, 2025
@Ayushdubey86

Copy link
Copy Markdown
Contributor Author

Hello @DaniPopes pushed those changes, do check once free!

Comment thread crates/provider/src/layers/batch.rs Outdated
Comment thread crates/provider/src/layers/batch.rs
@Ayushdubey86

Copy link
Copy Markdown
Contributor Author

Made those changes and pushed, do check @DaniPopes !

@Ayushdubey86
Ayushdubey86 requested a review from DaniPopes May 8, 2025 22:02
Comment thread crates/provider/src/layers/batch.rs Outdated
@github-project-automation github-project-automation Bot moved this from In Progress to Reviewed in Alloy Aug 19, 2025
@DaniPopes
DaniPopes enabled auto-merge (squash) August 19, 2025 06:16
Comment thread crates/provider/src/layers/batch.rs
@DaniPopes
DaniPopes merged commit 075f0d5 into alloy-rs:main Aug 19, 2025
31 checks passed
@github-project-automation github-project-automation Bot moved this from Reviewed to Done in Alloy Aug 19, 2025
Rimeeeeee pushed a commit to Soubhik-10/alloy that referenced this pull request Aug 25, 2025
* Raising Draft pr CallBatchLayer single request

* Single Rpc Call

* numbing testcase

* numbing tc

* numbing tc + fmt

* fmt

* Refactor+ adding tc

* fmt

* fmt

* doc + removing clone

* fmt

* chore: clean up

---------

Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

CallBatchLayer: don't batch if only 1 request is received

2 participants