Skip to content

feat: add ws filtering by addresses and topics with configurable match logic #281

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

Closed
wants to merge 5 commits into from

Conversation

tobidae-cb
Copy link

@tobidae-cb tobidae-cb commented Jun 4, 2025

New Features

  • Address filtering: Filter messages by addresses
  • Topic filtering: Filter messages by event topics
  • Combined filtering: Use both addresses and topics with configurable logic
  • Match modes: match=any (OR logic, default) or match=all (AND logic)

API Endpoints

# Address filtering
/ws/filter?addresses=0x123,0x456

# Topic filtering  
/ws/filter?topics=0xabc,0xdef

# Combined with OR logic (default)
/ws/filter?addresses=0x123&topics=0xabc&match=any

# Combined with AND logic
/ws/filter?addresses=0x123&topics=0xabc&match=all

Usage Examples

# OR logic - matches transactions involving ANY specified address OR topic
websocat "ws://localhost:8545/ws/filter?addresses=0x4532e1cE563f4bA6d8ba0D5967f85F54063801ed,0x48659ab7f847887a819031a66daaca74ea85b3a9&topics=0xb0444523268717a02698be47d0803aa7468c00acbed2f8bd93a0459cde61dd89&match=any"

# AND logic - matches only transactions involving BOTH specified addresses AND topics  
websocat "ws://localhost:8545/ws/filter?addresses=0x4532e1cE563f4bA6d8ba0D5967f85F54063801ed&topics=0xb0444523268717a02698be47d0803aa7468c00acbed2f8bd93a0459cde61dd89&match=all"

# Address-only filtering
websocat "ws://localhost:8545/ws/filter?addresses=0x4532e1cE563f4bA6d8ba0D5967f85F54063801ed,0x48659ab7f847887a819031a66daaca74ea85b3a9"

Unit tests for all filter combinations and match modes

Integration tests with WebSocket connections
Manual testing with live blockchain data
Verified performance with multiple concurrent filters

Copy link

vercel bot commented Jun 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
rollup-boost ⬜️ Ignored (Inspect) Visit Preview Jun 10, 2025 5:55pm

@tobidae-cb tobidae-cb force-pushed the filter-address-topic branch 2 times, most recently from 7afe99f to c54df3f Compare June 4, 2025 20:39
@ferranbt ferranbt self-requested a review June 5, 2025 16:35
@ferranbt
Copy link
Collaborator

ferranbt commented Jun 5, 2025

Hey, what would be the motivation behind this change? The reverse proxy is meant to be just a proxy that it is not aware of any communication protocol behind it.

@tobidae-cb tobidae-cb force-pushed the filter-address-topic branch from d90fabd to 9a827a7 Compare June 10, 2025 17:55
@tobidae-cb
Copy link
Author

@ferranbt We've elected to move this logic to the reth node client layer. Originally the goal was to give downstream apps the ability to filter flashblocks for addresses and topics that are relevant to those apps. This would reduce the data transfer overhead at the proxy layer.

@ferranbt
Copy link
Collaborator

Nice, closing the issue then.

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.

2 participants