-
Notifications
You must be signed in to change notification settings - Fork 152
Migrate CurrentBlockWatcher to alloy
#3832
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
Conversation
CurrentBlockWatcher to alloy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the CurrentBlockWatcher's transport from web3 to alloy, introducing an unbuffered transport implementation to avoid latency issues on high-frequency chains. The migration maintains parallel batch execution while leveraging alloy's default behavior of fetching blocks without transaction details.
Key Changes:
- Introduces
unbuffered_provider()in alloy module to avoid batching delays - Migrates block fetching logic from web3's batched RPC calls to alloy's
get_block()with parallel futures - Updates
BlockInfoconversion to work with alloy's block types instead of web3
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
crates/ethrpc/src/block_stream/mod.rs |
Replaces web3 batch transport with alloy provider calls, updates BlockInfo conversion, and migrates block range fetching to use parallel futures |
crates/ethrpc/src/alloy/mod.rs |
Adds unbuffered_rpc() and unbuffered_provider() functions to create alloy providers without BatchCallLayer |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
# Conflicts: # crates/autopilot/src/database/onchain_order_events/ethflow_events.rs # crates/autopilot/src/run.rs # crates/cow-amm/src/registry.rs # crates/shared/src/event_handling.rs
MartinquaXD
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for migrating the whole thing at once. 👍
jmg-duarte
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Migrates the CurrentBlockWatcher's transport to alloy.
Changes
How to test
Existing tests + mainnet shadow.
Further implementation
It should be safe to migrate to WS using alloy's WsConnect, which implements a reconnection logic internally. That should reduce the RPC load.