feat: adds actual parent_blockhash to ReplicaBlockInfoV4#1358
Conversation
|
Warning Review limit reached
More reviews will be available in 28 minutes and 21 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe PR propagates real parent block hashes through the validator stack. Suggested reviewers
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
magicblock-processor/src/scheduler/mod.rs (1)
589-592: 🩺 Stability & Availability | 🟠 MajorRemove panic-on-time-source failure from production block preparation.
Using
.unwrap()onduration_since(UNIX_EPOCH)can crash the scheduler thread. Replace with explicit error handling or a safe fallback. Per coding guidelines,.unwrap()in production Rust code within this file path is a major issue that requires proper error handling with logging or a sensible fallback for system time failures.🤖 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 `@magicblock-processor/src/scheduler/mod.rs` around lines 589 - 592, The `.unwrap()` call on `duration_since(UNIX_EPOCH)` in the timestamp assignment can cause the scheduler thread to panic if system time is before UNIX_EPOCH. Replace the unwrap() with proper error handling by either using a match statement or unwrap_or() with a sensible fallback value (such as a default timestamp of 0 or the current system time clamped to UNIX_EPOCH). Include appropriate logging if an error occurs to help with debugging system time issues.Source: Path instructions
🤖 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 `@magicblock-processor/src/scheduler/mod.rs`:
- Around line 395-396: The parent_blockhash derivation at line 395 uses only
ledger.latest_block().load().blockhash, but this can diverge from the
scheduler's actual chain seed which uses fallback logic to SlotHashes when the
ledger hash is default in initial_blockhash(...). To fix this, refactor the
parent_blockhash assignment to use the same fallback logic pattern as
initial_blockhash(...), checking whether the ledger hash is default and falling
back to SlotHashes accordingly. Apply this same fix to the other occurrence
mentioned at lines 585-586 to ensure consistency across all parent_blockhash
derivations.
---
Outside diff comments:
In `@magicblock-processor/src/scheduler/mod.rs`:
- Around line 589-592: The `.unwrap()` call on `duration_since(UNIX_EPOCH)` in
the timestamp assignment can cause the scheduler thread to panic if system time
is before UNIX_EPOCH. Replace the unwrap() with proper error handling by either
using a match statement or unwrap_or() with a sensible fallback value (such as a
default timestamp of 0 or the current system time clamped to UNIX_EPOCH).
Include appropriate logging if an error occurs to help with debugging system
time issues.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: db6be923-e6c5-4ea1-802c-45ddcd49a2f4
📒 Files selected for processing (6)
magicblock-aperture/src/geyser.rsmagicblock-ledger/src/lib.rsmagicblock-ledger/tests/get_block.rsmagicblock-processor/src/scheduler/mod.rsmagicblock-processor/tests/replica_ordering.rsmagicblock-processor/tests/scheduling.rs
|
@GabrielePicco @bmuddha thoughts on the PR? |
Summary
Adds actual
parent_blockhashinReplicaBlockInfoV4in stead of a dummy valueChanges
LatestBlockInner::new_with_parent()that takes a parent_blockhash(to avoid breaking existing tests) and a new fieldLatestBlockInner::parent_blockhashparent_blockhashfromapply_replayed_blockandprepare_block_as_primarybefore it's updated to the latest blockhashparent_blockhashinsidenotify_blockinstead of a dummy placeholderBreaking Changes
Test Plan
Extended existing tests and added new tests to verify the changes. You can run the new tests using:
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests