Skip to content

fix(mpool): fix flaky eth_newPendingTransactionFilter test#6946

Merged
LesnyRumcajs merged 5 commits intomainfrom
shashank/fix-flaky-test
Apr 22, 2026
Merged

fix(mpool): fix flaky eth_newPendingTransactionFilter test#6946
LesnyRumcajs merged 5 commits intomainfrom
shashank/fix-flaky-test

Conversation

@sudo-shashank
Copy link
Copy Markdown
Contributor

@sudo-shashank sudo-shashank commented Apr 21, 2026

Summary of changes

Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • Refactor
    • Simplified the pending message retrieval API by removing error handling from the method signature and updating all dependent calls accordingly.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

Walkthrough

The MessagePool::pending() method signature changed from returning Result<(Vec<SignedMessage>, Tipset), Error> to returning (Vec<SignedMessage>, Tipset) directly. The implementation was refactored to aggregate all pending messages by iterating over the internal map and sorting by message sequence, removing the per-address pending_for() invocation pattern and associated error handling. Callsites updated to reflect the non-Result return type.

Changes

Cohort / File(s) Summary
MessagePool pending() signature change
src/message_pool/msgpool/msg_pool.rs
Changed pending() return type from Result<(Vec<SignedMessage>, Tipset), Error> to (Vec<SignedMessage>, Tipset). Implementation refactored to directly aggregate messages from the pending map and sort by sequence, eliminating per-address pending_for() calls and InvalidFromAddr error propagation.
RPC and test callsites
src/message_pool/msgpool/mod.rs, src/rpc/methods/eth.rs, src/rpc/methods/mpool.rs
Updated calls to mpool.pending() to remove error propagation operators (?) and .unwrap() to align with new non-Result return signature.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Suggested reviewers

  • LesnyRumcajs
  • akaladarshi
  • elmattic
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title claims to fix a flaky test, but the actual changes modify the MessagePool::pending() API signature to remove error handling, affecting multiple RPC methods and test code throughout the codebase. Update the title to accurately reflect the main change: e.g., 'refactor(mpool): remove Result wrapper from pending() method' or similar to describe the API signature change.
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch shashank/fix-flaky-test
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch shashank/fix-flaky-test

Comment @coderabbitai help to get the list of available commands and usage tips.

@sudo-shashank sudo-shashank added the RPC requires calibnet RPC checks to run on CI label Apr 21, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/message_pool/msgpool/msg_pool.rs`:
- Around line 593-595: The loop currently calls self.pending_for(&addr) for each
addr from the cloned pending snapshot, which can return None due to a race and
silently drop messages; modify the loop in pending() to iterate the cloned
pending snapshot directly and extend out with the messages already captured in
that snapshot (use the values from the pending variable rather than calling
pending_for), ensuring None is handled explicitly (e.g., treat as empty or log)
so messages aren't silently omitted; update the loop around pending, out,
pending_for and pending() accordingly.
🪄 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: 6bb3cd8f-313d-4d2f-9387-e57328345033

📥 Commits

Reviewing files that changed from the base of the PR and between 462e824 and f291282.

📒 Files selected for processing (1)
  • src/message_pool/msgpool/msg_pool.rs

Comment thread src/message_pool/msgpool/msg_pool.rs Outdated
@sudo-shashank sudo-shashank force-pushed the shashank/fix-flaky-test branch from f291282 to 1ba5f99 Compare April 21, 2026 04:21
@sudo-shashank sudo-shashank marked this pull request as ready for review April 21, 2026 05:09
@sudo-shashank sudo-shashank requested a review from a team as a code owner April 21, 2026 05:09
@sudo-shashank sudo-shashank requested review from LesnyRumcajs and akaladarshi and removed request for a team April 21, 2026 05:09
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.04%. Comparing base (3dcb3e4) to head (76ac184).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/rpc/methods/eth.rs 0.00% 1 Missing ⚠️
src/rpc/methods/mpool.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/message_pool/msgpool/mod.rs 91.21% <100.00%> (ø)
src/message_pool/msgpool/msg_pool.rs 88.77% <100.00%> (+0.11%) ⬆️
src/rpc/methods/eth.rs 65.26% <0.00%> (ø)
src/rpc/methods/mpool.rs 4.89% <0.00%> (ø)

... and 16 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3dcb3e4...76ac184. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

hanabi1224
hanabi1224 previously approved these changes Apr 21, 2026
@sudo-shashank sudo-shashank marked this pull request as draft April 21, 2026 06:56
@sudo-shashank sudo-shashank marked this pull request as ready for review April 21, 2026 06:56
@sudo-shashank sudo-shashank enabled auto-merge April 21, 2026 07:54
@sudo-shashank sudo-shashank disabled auto-merge April 21, 2026 08:01
Comment thread src/message_pool/msgpool/msg_pool.rs Outdated
Comment thread src/message_pool/msgpool/msg_pool.rs
Comment thread src/message_pool/msgpool/msg_pool.rs Outdated
@sudo-shashank sudo-shashank marked this pull request as draft April 21, 2026 13:53
@sudo-shashank sudo-shashank marked this pull request as ready for review April 22, 2026 01:29
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/message_pool/msgpool/mod.rs (1)

618-619: Strengthen this regression assertion.

assert_eq!(p.len(), 3) will still pass if the wrong three messages come back. Please assert the expected sequences or CIDs as well so the test guards the actual revert behavior.

🧪 Suggested assertion tightening
         let (p, _) = mpool.pending();
-        assert_eq!(p.len(), 3);
+        let sequences = p.into_iter().map(|m| m.sequence()).collect::<Vec<_>>();
+        assert_eq!(sequences, vec![1, 2, 3]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/message_pool/msgpool/mod.rs` around lines 618 - 619, The test currently
only checks count with let (p, _) = mpool.pending(); assert_eq!(p.len(), 3); —
strengthen it by asserting the actual messages/CIDs and order returned by
mpool.pending(). For example, collect the returned entries from p (e.g.,
p.iter().map(|e| e.key.cid.clone()) or p.iter().map(|e| e.message.sequence()))
and compare to the expected vector of CIDs or sequence numbers (the known
CIDs/sequence values created earlier in this test) so the assertion verifies the
exact three messages and their order that should remain after the revert.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/message_pool/msgpool/mod.rs`:
- Around line 618-619: The test currently only checks count with let (p, _) =
mpool.pending(); assert_eq!(p.len(), 3); — strengthen it by asserting the actual
messages/CIDs and order returned by mpool.pending(). For example, collect the
returned entries from p (e.g., p.iter().map(|e| e.key.cid.clone()) or
p.iter().map(|e| e.message.sequence())) and compare to the expected vector of
CIDs or sequence numbers (the known CIDs/sequence values created earlier in this
test) so the assertion verifies the exact three messages and their order that
should remain after the revert.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a70768f1-8fa1-4e7e-a90b-06f52f78ff9d

📥 Commits

Reviewing files that changed from the base of the PR and between 1ba5f99 and 76ac184.

📒 Files selected for processing (4)
  • src/message_pool/msgpool/mod.rs
  • src/message_pool/msgpool/msg_pool.rs
  • src/rpc/methods/eth.rs
  • src/rpc/methods/mpool.rs

@LesnyRumcajs LesnyRumcajs added this pull request to the merge queue Apr 22, 2026
Merged via the queue into main with commit 9756cca Apr 22, 2026
40 checks passed
@LesnyRumcajs LesnyRumcajs deleted the shashank/fix-flaky-test branch April 22, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RPC requires calibnet RPC checks to run on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants