Open
Conversation
Implement eth_subscribe('logs', filter) as described in a16z#741.
Each log subscriber gets its own broadcast channel with a stored
filter. When a new block arrives, logs are fetched using the
existing get_logs() pipeline (which verifies logs against receipts)
and sent to matching subscribers.
Changes:
- Add Logs(Log) variant to SubscriptionEvent
- Add optional Filter param to subscribe() across the API trait,
Node impl, JSON-RPC layer, and WASM bindings
- Store per-subscriber (Filter, Sender) pairs in Node
- On each new block, fetch and distribute logs to subscribers
- Update rpc.md docs
Closes a16z#741
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
eth_subscribe('logs', filter)per the Ethereum JSON-RPC specget_logs()pipeline and sent to matching subscribersDesign
broadcast::Sendersince each subscriber has unique filter criteriaget_logs()so logs go through the same receipt verification aseth_getLogsnewHeadssubscriptions already workFiles changed (9)
common/src/types.rs— addedLogs(Log)variant toSubscriptionEventcore/src/client/api.rs— addedfilter: Option<Filter>tosubscribe()core/src/client/node.rs— log subscriber storage and block-level log distributioncore/src/jsonrpc/mod.rs— accept filter param in RPC subscriptionhelios-ts/src/{ethereum,opstack,linea}.rs— pass filter in WASM bindingshelios-ts/lib.ts— passparams[1]as filterrpc.mdNot included
removed: truefor reorged logs (not handled fornewHeadseither, can be a follow-up)newPendingTransactionssubscription (separate scope)Closes #741