Uh oh!
There was an error while loading. Please reload this page.
feat: prefill RPC caches for new validated tipsets - #7068
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds a validated-tipset broadcast channel in the sync state machine, refactors ETH block conversion to accept ChangesValidated Tipset Broadcast and RPC Cache Warming
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/chain_sync/chain_follower.rs (1)
631-637:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winUse
broadcast::channelinstead ofSender::newfor Tokio broadcast initialization.Line 636 uses
tokio::sync::broadcast::Sender::new(1024), which is not part of Tokio 1.x's public API. The correct approach istokio::sync::broadcast::channel(capacity), which returns a tuple of(Sender, Receiver).Proposed fix
impl SyncStateMachine { pub fn new( cs: ChainStore, bad_block_cache: Option<BadBlockCache>, stateless_mode: bool, ) -> Self { + let (validated_tipset_broadcast_tx, _) = tokio::sync::broadcast::channel(1024); Self { cs, bad_block_cache, tipsets: HashMap::default(), stateless_mode, - validated_tipset_broadcast_tx: tokio::sync::broadcast::Sender::new(1024),+ validated_tipset_broadcast_tx, } }🤖 Prompt for 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. In `@src/chain_sync/chain_follower.rs` around lines 631 - 637, The initialization uses tokio::sync::broadcast::Sender::new which doesn't exist in Tokio 1.x; replace it by calling tokio::sync::broadcast::channel(capacity) and assign the returned Sender to validated_tipset_broadcast_tx (e.g., let (validated_tipset_broadcast_tx, _rx) = tokio::sync::broadcast::channel(1024) before constructing Self), keeping the symbol validated_tipset_broadcast_tx as the Sender used in the struct and ensuring any needed Receiver is retained or discarded appropriately.
🤖 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/daemon/mod.rs`:
- Around line 350-383: The loop prefetches tipsets and calls
crate::rpc::eth::Block::from_filecoin_tipset even when RPC is disabled; guard
this work with the RPC flag by checking enable_rpc (or the equivalent config
passed in) before entering the spawn or before handling Ok(tsk) so that when
enable_rpc is false you skip loading from validated_tipset_rx and the
Block::from_filecoin_tipset calls. Locate the validated_tipset_rx handling in
the service spawn and short-circuit using the enable_rpc boolean (or avoid
spawning the inner tokio::spawn that uses state_manager.chain_index() and
Block::from_filecoin_tipset) to prevent unnecessary CPU/IO when RPC is disabled.
- Around line 360-375: The spawned task currently uses the `?` operator on
`state_manager.chain_index().load_required_tipset(&tsk)?`, which will silently
propagate errors; change this to explicitly handle the Result: call
`state_manager.chain_index().load_required_tipset(&tsk)`, match on Err/Ok, and
on Err log a warning (including `tsk` and the error) and return early from the
task (e.g., via `return`/`anyhow::Ok(())`) so the subsequent
`Block::from_filecoin_tipset` calls only run when the tipset loaded
successfully; reference `state_manager.chain_index().load_required_tipset(&tsk)`
and the cache warmup loop invoking
`crate::rpc::eth::Block::from_filecoin_tipset`.
---
Outside diff comments:
In `@src/chain_sync/chain_follower.rs`:
- Around line 631-637: The initialization uses
tokio::sync::broadcast::Sender::new which doesn't exist in Tokio 1.x; replace it
by calling tokio::sync::broadcast::channel(capacity) and assign the returned
Sender to validated_tipset_broadcast_tx (e.g., let
(validated_tipset_broadcast_tx, _rx) = tokio::sync::broadcast::channel(1024)
before constructing Self), keeping the symbol validated_tipset_broadcast_tx as
the Sender used in the struct and ensuring any needed Receiver is retained or
discarded appropriately.
🪄 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: a8bf0584-72dc-4011-844e-4225fbdc22ff
📒 Files selected for processing (4)
src/chain_sync/chain_follower.rssrc/daemon/mod.rssrc/rpc/methods/chain.rssrc/rpc/methods/eth.rs
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is Additional details and impacted files
... and 5 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
LesnyRumcajs
commented
May 15, 2026
no green checkmark, no review |
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
Performance
Bug Fixes
Refactor