Skip to content

Conversation

@squadgazzz
Copy link
Contributor

@squadgazzz squadgazzz commented Oct 28, 2025

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.

@squadgazzz squadgazzz changed the title Migrate CurrentBlockWatcher to alloy Migrate CurrentBlockWatcher to alloy Oct 28, 2025
@squadgazzz squadgazzz marked this pull request as ready for review October 28, 2025 10:22
@squadgazzz squadgazzz requested a review from a team as a code owner October 28, 2025 10:22
Copilot AI review requested due to automatic review settings October 28, 2025 10:22
Copy link
Contributor

Copilot AI left a 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 BlockInfo conversion 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.

@squadgazzz squadgazzz marked this pull request as draft October 28, 2025 10:29
@squadgazzz squadgazzz marked this pull request as ready for review October 28, 2025 12:41
@squadgazzz squadgazzz marked this pull request as draft October 28, 2025 19:40
# 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
@squadgazzz squadgazzz marked this pull request as ready for review October 28, 2025 20:22
Copy link
Contributor

@MartinquaXD MartinquaXD left a 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. 👍

Copy link
Contributor

@jmg-duarte jmg-duarte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@squadgazzz squadgazzz enabled auto-merge (squash) October 30, 2025 12:18
@squadgazzz squadgazzz disabled auto-merge October 30, 2025 12:18
@squadgazzz squadgazzz enabled auto-merge (squash) October 30, 2025 13:29
@squadgazzz squadgazzz merged commit 5bbffc5 into main Oct 30, 2025
17 checks passed
@squadgazzz squadgazzz deleted the alloy/current-block-watcher branch October 30, 2025 13:34
@github-actions github-actions bot locked and limited conversation to collaborators Oct 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants