Skip to content

fix(rpc): require non-empty tipset key in MinerGetBaseInfo - #7438

Merged
sudo-shashank merged 2 commits into
ChainSafe:mainfrom
0xDevNinja:0xdevninja/issue-7422-minergetbaseinfo-require-tipset
Aug 6, 2026
Merged

fix(rpc): require non-empty tipset key in MinerGetBaseInfo#7438
sudo-shashank merged 2 commits into
ChainSafe:mainfrom
0xDevNinja:0xdevninja/issue-7422-minergetbaseinfo-require-tipset

Conversation

@0xDevNinja

@0xDevNinja 0xDevNinja commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

Filecoin.MinerGetBaseInfo accepted a null or empty tipset key and silently fell back to the heaviest tipset. Lotus instead treats the tipset key as required and rejects an empty one with failed to load tipset for mining base: NewTipSet called with zero length array of blocks. This aligns Forest with Lotus.

Changes introduced in this pull request:

  • MinerGetBaseInfo now returns an invalid params error when the tipset key is null or empty, instead of defaulting to the heaviest tipset.
  • Added an RPC conformance test asserting both Forest and Lotus reject the empty tipset key case.
  • Added a CHANGELOG entry under Breaking.

Reference issue to close (if applicable)

Closes #7422

Other information and links

Behaviour mapped against Lotus, where MinerGetBaseInfo takes a required types.TipSetKey and errors on an empty key rather than defaulting to the chain head.

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

    • MinerGetBaseInfo now rejects requests with missing or empty tipset keys instead of defaulting to the heaviest tipset.
    • Invalid requests consistently return an invalid-parameters error.
  • Documentation

    • Added a changelog entry documenting this breaking behavior change.

Filecoin.MinerGetBaseInfo accepted a null or empty tipset key and
silently fell back to the heaviest tipset, while Lotus rejects it with
"NewTipSet called with zero length array of blocks". Reject the empty
key with an invalid-params error so the method matches Lotus.

Closes ChainSafe#7422
Assert both Forest and Lotus reject a MinerGetBaseInfo request with an
empty tipset key in the RPC conformance suite.
@0xDevNinja
0xDevNinja requested a review from a team as a code owner August 4, 2026 10:25
@0xDevNinja
0xDevNinja requested review from hanabi1224 and sudo-shashank and removed request for a team August 4, 2026 10:25
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 78df3dcc-3eda-4bc6-97d2-20b51349cdbf

📥 Commits

Reviewing files that changed from the base of the PR and between 43dd059 and 299968f.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/rpc/methods/miner.rs
  • src/tool/subcommands/api_cmd/api_compare_tests.rs
🔗 Linked repositories identified

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

  • filecoin-project/lotus (manual)

Walkthrough

MinerGetBaseInfo::handle now rejects null or empty tipset keys with an invalid-parameters error instead of defaulting to the heaviest tipset. An API compare test verifies the rejection, and the changelog documents this breaking change.

Changes

MinerGetBaseInfo tipset key validation

Layer / File(s) Summary
Reject empty tipset key in handler
src/rpc/methods/miner.rs
The handler requires a non-empty tipset key. It returns an invalid-parameters error when the key is missing or empty.
Test and changelog for rejection behavior
src/tool/subcommands/api_cmd/api_compare_tests.rs, CHANGELOG.md
A new test sends ApiTipsetKey(None) and expects both nodes to reject the request. The changelog records the breaking change for Filecoin.MinerGetBaseInfo.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested labels: RPC

Suggested reviewers: hanabi1224, sudo-shashank

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the primary change: requiring a non-empty tipset key in MinerGetBaseInfo.
Linked Issues check ✅ Passed The implementation satisfies issue #7422 by rejecting null or empty tipset keys and adding a conformance test.
Out of Scope Changes check ✅ Passed The code, test, and changelog changes directly support the requirements in issue #7422.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

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.

@hanabi1224 hanabi1224 added the RPC requires calibnet RPC checks to run on CI label Aug 4, 2026
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.12%. Comparing base (81f6cba) to head (299968f).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/rpc/methods/miner.rs 0.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/rpc/methods/miner.rs 6.39% <0.00%> (-0.12%) ⬇️

... and 10 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...299968f. 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.

Comment thread src/tool/subcommands/api_cmd/api_compare_tests.rs
@sudo-shashank
sudo-shashank added this pull request to the merge queue Aug 6, 2026
Merged via the queue into ChainSafe:main with commit 3853f58 Aug 6, 2026
66 of 69 checks passed
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 on Lotus requires a non-empty tipset key

3 participants