Skip to content

fix MinerGetBaseInfo returns the correct BeaconEntries - #7427

Merged
LesnyRumcajs merged 13 commits into
mainfrom
fix/beacon-entries-after-null-rounds
Aug 5, 2026
Merged

fix MinerGetBaseInfo returns the correct BeaconEntries#7427
LesnyRumcajs merged 13 commits into
mainfrom
fix/beacon-entries-after-null-rounds

Conversation

@EclesioMeloJunior

@EclesioMeloJunior EclesioMeloJunior commented Jul 30, 2026

Copy link
Copy Markdown
Member

Summary of changes

After the quicknet upgrade Forest was returning the incorrect set of BeaconEntries as it was hard-coded to return a single entry, while when a null-round happens a Filecoin block should be able to cover every epoch since its parent and one beacon entry per covered epoch

Changes introduced in this pull request:

  • src/beacon/drand.rs: basicaly on the quicknet "unchained" branch fetch the max_beacon_round from (parent_epoch + 1) till epoch

Reference issue to close (if applicable)

Closes #7412

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

  • This pull request is based on an issue that a maintainer has accepted (see Before Opening a Pull Request).
  • 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 Quicknet beacon handling across multiple Filecoin epochs, including epochs containing null beacon rounds.
    • Ensured beacon entries are generated correctly for every covered epoch.
    • Improved consistency when processing beacon data across supported network configurations.
  • Tests

    • Added coverage for Quicknet scenarios with and without null beacon rounds.
  • Documentation

    • Updated the unreleased changelog with details of the Quicknet beacon handling improvement.

@EclesioMeloJunior
EclesioMeloJunior requested a review from a team as a code owner July 30, 2026 13:13
@EclesioMeloJunior
EclesioMeloJunior requested review from akaladarshi and hanabi1224 and removed request for a team July 30, 2026 13:13
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Quicknet beacon entry generation now returns one entry for each epoch from the parent epoch through the current epoch. A regression test verifies per-epoch rounds when null beacon rounds occur.

Changes

Beacon entry coverage

Layer / File(s) Summary
Per-epoch entries and regression coverage
src/beacon/drand.rs, src/beacon/tests/drand.rs, CHANGELOG.md
Unchained networks now fetch one beacon entry per covered epoch. Chained retrieval preserves round traversal and reversal. Tests verify Quicknet rounds with and without null rounds. The changelog records the change.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • #7413: The per-epoch beacon entry fix supplies the entries required for per-epoch round validation.

Suggested reviewers: hanabi1224, akaladarshi

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation returns one per-epoch beacon entry for unchained blocks and adds tests for Quicknet null-round cases, satisfying issue #7412.
Out of Scope Changes check ✅ Passed The code, tests, and changelog changes directly support the beacon-entry fix described in issue #7412.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the primary fix: returning the correct BeaconEntries from MinerGetBaseInfo.
✨ 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 fix/beacon-entries-after-null-rounds
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/beacon-entries-after-null-rounds

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.

❤️ Share

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

@EclesioMeloJunior EclesioMeloJunior added the RPC requires calibnet RPC checks to run on CI label Jul 30, 2026
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 40.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.06%. Comparing base (81f6cba) to head (0493d1b).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/beacon/drand.rs 40.00% 5 Missing and 1 partial ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/beacon/drand.rs 78.30% <40.00%> (+3.44%) ⬆️

... and 12 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 81f6cba...0493d1b. 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.

@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.

🧹 Nitpick comments (1)
src/beacon/drand.rs (1)

117-120: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Preserve epoch and round context when fetching entries.

The new per-epoch fetch propagates entry errors without identifying which covered epoch failed. Add context before ? so null-round failures remain diagnosable.

Proposed fix
-                out.push(curr_beacon.entry(round).await?);
+                out.push(
+                    curr_beacon
+                        .entry(round)
+                        .await
+                        .context(format!(
+                            "failed to fetch beacon entry for epoch {covered_epoch}, round {round}"
+                        ))?,
+                );

As per coding guidelines, Rust operations should use anyhow::Result<T> for most operations and add context with .context() when errors occur.

🤖 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/beacon/drand.rs` around lines 117 - 120, Update the per-epoch fetch loop
in the drand flow to add anyhow context to the `curr_beacon.entry(round)`
operation before propagating its error. Include both the `covered_epoch` and
resolved `round` in the context so null-round failures identify the exact epoch
and round that failed, while preserving the existing `out.push` behavior.

Source: Coding guidelines

🤖 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.

Nitpick comments:
In `@src/beacon/drand.rs`:
- Around line 117-120: Update the per-epoch fetch loop in the drand flow to add
anyhow context to the `curr_beacon.entry(round)` operation before propagating
its error. Include both the `covered_epoch` and resolved `round` in the context
so null-round failures identify the exact epoch and round that failed, while
preserving the existing `out.push` behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d8a326c6-9c36-43a3-8c0d-c4cb35cd9434

📥 Commits

Reviewing files that changed from the base of the PR and between 165e30e and ea57e0c.

📒 Files selected for processing (2)
  • src/beacon/drand.rs
  • src/beacon/tests/drand.rs
🔗 Linked repositories identified

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

  • filecoin-project/lotus (manual)

Comment thread src/beacon/drand.rs Outdated
Comment thread src/beacon/tests/drand.rs Outdated

@LesnyRumcajs LesnyRumcajs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Aside from some nits, looks good! Let's have a changelog entry. This is not a transparent change.

@LesnyRumcajs

LesnyRumcajs commented Aug 3, 2026

Copy link
Copy Markdown
Member

@EclesioMeloJunior There's also another thing that'd be great to tackle, basically answering a question "why wasn't it caught before"; the RPC parity tests should've eventually caught it. Perhaps we're missing some test cases there?

RpcTest::identity(MinerGetBaseInfo::request((
block.miner_address,
block.epoch,
tipset.key().into(),
))?),

Comment thread src/beacon/drand.rs Outdated
Comment thread src/beacon/drand.rs Outdated
Comment thread src/beacon/drand.rs Outdated
Comment thread src/beacon/tests/drand.rs Outdated
Comment thread CHANGELOG.md Outdated
Comment thread src/beacon/drand.rs Outdated
Comment thread src/beacon/drand.rs Outdated
@LesnyRumcajs
LesnyRumcajs added this pull request to the merge queue Aug 5, 2026
Merged via the queue into main with commit 3dd4b60 Aug 5, 2026
43 checks passed
@LesnyRumcajs
LesnyRumcajs deleted the fix/beacon-entries-after-null-rounds branch August 5, 2026 09:18
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.

MinerGetBaseInfo returns too few beacon entries after a null round

2 participants