Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support batch JsonRPC requests for Websockets #1324

Closed
Miyou opened this issue Mar 12, 2021 · 4 comments
Closed

Support batch JsonRPC requests for Websockets #1324

Miyou opened this issue Mar 12, 2021 · 4 comments
Labels
status:ready This issue is ready to be worked on type:feature Feature request

Comments

@Miyou
Copy link

Miyou commented Mar 12, 2021

Hi. I noticed that batch requests seem to only be supported when using http and not websockets. Looking at handler.ts it seems like a trivial fix. Since I need this for my project I will fork hardhat and implement it. Are you interested in a PR for this?

Search terms: BatchRequest

@fvictorio
Copy link
Member

Hi @Miyou, thanks for letting us know about this. I think a PR would be great, especially if it's not a huge change 🙂 If you do it, please include a way to try it out manually

@Miyou
Copy link
Author

Miyou commented Mar 15, 2021

Hi @fvictorio. I made a quick and dirty edit that seems to work for at least receiving and executing the array of transactions, but to get them to execute in parallell we would also have to update the EIP1193Provider to also support batch transactions. Here's the edit. It can be tested with the following snippet which works after the edit is applied, but not before: npx wscat -c 127.0.0.1:8545 -x '[{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"},{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}]'.

Since this works for now I'll continue with other tasks on my project, but if you are interested I could clean the code up a bit and submit a PR?

@fvictorio
Copy link
Member

Ugh, I totally missed your response. Sorry about that @Miyou. I can't look at the code in depth right now, but I skimmed it and it looks good.

I also tried the command you shared with geth and it worked fine, so I think this is something we want to support too.

Feel free to send a PR if you want and have the time!

@fvictorio fvictorio added priority:low status:ready This issue is ready to be worked on and removed package:hardhat-core labels Dec 22, 2022
tenbits added a commit to tenbits/hardhat that referenced this issue Jan 13, 2023
tenbits added a commit to tenbits/hardhat that referenced this issue Jan 13, 2023
fvictorio added a commit that referenced this issue Jan 16, 2023
Fix #1324 (WebSocket BatchRequest) supports Batch requests via WebSockets
@alcuadrado
Copy link
Member

We just released this. Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:ready This issue is ready to be worked on type:feature Feature request
Projects
Archived in project
Development

No branches or pull requests

3 participants