Skip to content

refactor: make MessagePool address resolution at finality non-blocking#7334

Open
sudo-shashank wants to merge 3 commits into
mainfrom
shashank/refactor-messagepool
Open

refactor: make MessagePool address resolution at finality non-blocking#7334
sudo-shashank wants to merge 3 commits into
mainfrom
shashank/refactor-messagepool

Conversation

@sudo-shashank

@sudo-shashank sudo-shashank commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes #7308

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

  • Bug Fixes

    • Improved nonce and pending-message handling so requests now wait for the latest available state before responding.
    • RPC responses for nonce-related and gas-estimation paths are now more reliable during asynchronous processing.
    • Added retry behavior for selected wallet/test command network calls, reducing failures from temporary missing results.
  • New Features

    • Updated message pool operations to support asynchronous lookups and processing, improving responsiveness under load.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

MessagePool address resolution, insertion, sequence lookup, and reorg handling now use async calls to finality-based address resolution. RPC handlers, nonce tracking, and chain-sync call sites await the updated mempool APIs, and dev test RPC helpers add retry handling for missing JSON-RPC results.

Changes

Async MessagePool and RPC helper updates

Layer / File(s) Summary
ProviderExt cleanup
src/message_pool/msgpool/provider.rs
Removes the dead-code allow attribute before ProviderExt.
Async resolve_to_key and pool flow
src/message_pool/msgpool/msg_pool.rs
MessagePool resolution, insertion, validation, sequence lookup, and pending lookup become async and await finality-based resolution and state-sequence queries.
Async reorg handling
src/message_pool/msgpool/reorg.rs
MessagePool bounds are tightened and head-change processing awaits message removal, reinsertion, and address resolution.
Async nonce lookup
src/message_pool/nonce_tracker.rs
NonceTracker::sign_and_push adds a 'static bound and awaits mempool sequence lookup.
RPC and chain follower call sites
src/rpc/methods/eth.rs, src/rpc/methods/mpool.rs, src/rpc/methods/gas.rs, src/chain_sync/chain_follower.rs
RPC handlers and the chain follower await the async mempool sequence and add APIs.
Retrying RPC helper
src/dev/subcommands/tests_cmd/helpers.rs, src/dev/subcommands/tests_cmd/wallet.rs
A retrying JSON-RPC helper is added and used by test command call sites.
Message-pool test updates
src/message_pool/msgpool/mod.rs, src/message_pool/msgpool/selection.rs
Message-pool tests switch to awaiting async add, get_sequence, pending_for, resolve_to_key, and add_to_pool_unchecked calls.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related PRs

Suggested labels: RPC

Suggested reviewers: hanabi1224, LesnyRumcajs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The RPC retry helper and wallet test-command changes appear unrelated to MessagePool finality resolution and go beyond the linked issue scope. Move the retry-helper and wallet RPC changes into a separate PR unless they are required for this MessagePool refactor.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: making MessagePool address resolution at finality non-blocking.
Linked Issues check ✅ Passed The MessagePool async refactor and call-site updates match #7308’s requirement to replace blocking finality resolution with the async variant.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ 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/refactor-messagepool
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch shashank/refactor-messagepool

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

@sudo-shashank sudo-shashank changed the title Refactor MessagePool to use non-blocking resolve_to_deterministic_address_at_finality_async refactor: make MessagePool address resolution at finality non-blocking Jul 9, 2026
@sudo-shashank sudo-shashank added the Wallet Trigger wallet test on Calibnet label Jul 9, 2026
@sudo-shashank sudo-shashank marked this pull request as ready for review July 9, 2026 21:27
@sudo-shashank sudo-shashank requested a review from a team as a code owner July 9, 2026 21:27
@sudo-shashank sudo-shashank requested review from LesnyRumcajs, akaladarshi and hanabi1224 and removed request for a team July 9, 2026 21:27

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/dev/subcommands/tests_cmd/helpers.rs`:
- Around line 306-324: `rpc_call_with_retry` is being used for a non-idempotent
write RPC, which can duplicate state changes on retry. Update the helper usage
in `rpc_call_with_retry`/`wallet.rs` so mutating calls like
`Filecoin.MarketAddBalance` use `rpc_call` instead of the retrying wrapper, or
split the helper so only safe read-only calls like `MpoolPending` and
`FilecoinAddressToEthAddress` use retries. If you keep the helper generic, add a
clear doc note on `rpc_call_with_retry` warning that it must not be used for
state-mutating RPCs.
🪄 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: 03e5925e-78fe-4760-8d2f-3bdc6681fb43

📥 Commits

Reviewing files that changed from the base of the PR and between 5b4c969 and 9583c1f.

📒 Files selected for processing (3)
  • src/dev/subcommands/tests_cmd/helpers.rs
  • src/dev/subcommands/tests_cmd/wallet.rs
  • src/message_pool/msgpool/msg_pool.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • filecoin-project/lotus (manual)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/message_pool/msgpool/msg_pool.rs

Comment thread src/dev/subcommands/tests_cmd/helpers.rs
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.63158% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.48%. Comparing base (b4e5736) to head (9583c1f).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/dev/subcommands/tests_cmd/helpers.rs 0.00% 14 Missing ⚠️
src/message_pool/msgpool/msg_pool.rs 89.42% 4 Missing and 7 partials ⚠️
src/message_pool/msgpool/reorg.rs 69.23% 2 Missing and 2 partials ⚠️
src/chain_sync/chain_follower.rs 0.00% 1 Missing ⚠️
src/dev/subcommands/tests_cmd/wallet.rs 0.00% 1 Missing ⚠️
src/message_pool/nonce_tracker.rs 50.00% 0 Missing and 1 partial ⚠️
src/rpc/methods/eth.rs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/message_pool/msgpool/mod.rs 97.91% <100.00%> (+<0.01%) ⬆️
src/message_pool/msgpool/provider.rs 67.94% <ø> (+14.10%) ⬆️
src/message_pool/msgpool/selection.rs 86.98% <100.00%> (-0.48%) ⬇️
src/rpc/methods/gas.rs 86.59% <100.00%> (ø)
src/rpc/methods/mpool.rs 14.47% <100.00%> (ø)
src/chain_sync/chain_follower.rs 31.53% <0.00%> (ø)
src/dev/subcommands/tests_cmd/wallet.rs 0.00% <0.00%> (ø)
src/message_pool/nonce_tracker.rs 96.77% <50.00%> (ø)
src/rpc/methods/eth.rs 66.71% <0.00%> (ø)
src/message_pool/msgpool/reorg.rs 66.26% <69.23%> (+0.44%) ⬆️
... and 2 more

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b4e5736...9583c1f. 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.

@sudo-shashank sudo-shashank enabled auto-merge July 9, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Wallet Trigger wallet test on Calibnet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor MessagePool to use non-blocking resolve_to_deterministic_address_at_finality_async

1 participant