Uh oh!
There was an error while loading. Please reload this page.
fix(mpool): MempoolFilter returns the pending transactions - #7250
Conversation
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
🚧 Files skipped from review as they are similar to previous changes (6)
WalkthroughPending-transaction filtering now uses a subscriber-backed mempool stream, buffers hashes per filter, and drains them through the Ethereum RPC path. Handler construction passes chain id and mempool subscriber through daemon and offline-server wiring. Pubsub and stateful tests are updated to match the new hash flow. ChangesPending transaction hash flow
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/rpc/methods/eth/filter/mempool.rs`:
- Around line 256-258: The async test in the mempool filter flow should not rely
on a single tokio::task::yield_now() to let the fan-out task deliver the
broadcast event. Update the test around the filter subscription/drain logic in
the mempool.rs path to poll with a small timeout until both filters have
received the hash, using the existing filter/broadcast setup instead of assuming
one scheduler yield is sufficient.
- Around line 119-128: The fan-out task startup in ensure_fanout_task currently
calls tokio::spawn unconditionally, which can panic if there is no active Tokio
runtime. Update the install path that reaches ensure_fanout_task to check for a
runtime first and return an installation error instead of spawning blindly, and
make sure the caller of ensure_fanout_task propagates that Result so the
existing error handling is preserved.
In `@src/rpc/methods/eth/filter/mod.rs`:
- Around line 142-146: `EthEventHandler::new()` is wiring pending-filter RPCs to
`MpoolSubscriber::dummy()`, so `eth_newPendingTransactionFilter` never receives
mempool adds in states built from it. Update the RPC state constructors that use
pending filters, especially the snapshot/test paths in `generate_test_snapshot`
and `test_snapshot`, to pass a real `MessagePool` subscriber
(`mpool.subscriber()`) into `EthEventHandler::from_config(...)` instead of
relying on the dummy subscriber. Make sure the `EthEventHandler` and related
`RPCState` setup still use the same `EventsConfig` and chain ID, but are
connected to the live mempool bus.
In `@src/tool/subcommands/api_cmd/stateful_tests.rs`:
- Around line 1041-1044: The pending-tx assertions are still happening after
chain inclusion because wait_pending_message() continues into StateWaitMsg, so
the tests do not actually verify pre-mining mempool behavior. Update the
stateful tests to inspect the filter immediately after the first MpoolPending
observation, or split wait_pending_message() into a helper that returns once the
CID appears so the test can stop before StateWaitMsg. Apply the same fix in both
affected test sections that use wait_pending_message() and
poll_pending_filter_until().
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b1fab06a-d564-4511-ba0e-b6e9944153cd
📒 Files selected for processing (14)
CHANGELOG.mdsrc/daemon/mod.rssrc/message_pool/msgpool/events.rssrc/message_pool/msgpool/mod.rssrc/message_pool/msgpool/msg_pool.rssrc/message_pool/msgpool/pending_store.rssrc/message_pool/msgpool/selection.rssrc/rpc/methods/eth.rssrc/rpc/methods/eth/filter/mempool.rssrc/rpc/methods/eth/filter/mod.rssrc/rpc/methods/eth/pubsub.rssrc/tool/offline_server/server.rssrc/tool/subcommands/api_cmd/stateful_tests.rssrc/utils/task/mod.rs
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
filecoin-project/lotus(manual)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes
Other information and links
Change checklist
Outside contributions
Summary by CodeRabbit
New Features
Bug Fixes
eth_newPendingTransactionFilternow reports hashes only for transactions that are actually pending in the mempool (not already executed on-chain).eth_getFilterChangesnow returns only newly observed pending tx hashes per poll, without repeating previously delivered results.