Skip to content

Conversation

@hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Jan 9, 2026

Summary of changes

(Part of F3 reset on calibnet)
To avoid importing old/wrong F3 data without initial power table check

Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes

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.

Summary by CodeRabbit

  • Chores

    • Updated go-jsonrpc dependency to latest version
  • Bug Fixes

    • Improved F3 snapshot import to gracefully handle edge cases

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 9, 2026

Walkthrough

This PR updates the go-jsonrpc dependency from v0.9.0 to v0.10.0 and adds a conditional guard in the F3 snapshot import logic that checks for the presence of initial_power_table in the manifest before proceeding with the import.

Changes

Cohort / File(s) Summary
Dependency Updates
f3-sidecar/go.mod
Version bump for github.com/filecoin-project/go-jsonrpc from v0.9.0 to v0.10.0
F3 Import Logic
src/daemon/db_util.rs
Added conditional guard on initial_power_table presence; skips F3 import path and logs warning if absent, otherwise executes existing import logic

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • LesnyRumcajs
  • akaladarshi
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a check to skip F3 data import when initial_power_table is absent, which aligns with the primary modification in src/daemon/db_util.rs.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.5.0)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies"


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

@hanabi1224 hanabi1224 marked this pull request as ready for review January 9, 2026 09:19
@hanabi1224 hanabi1224 requested a review from a team as a code owner January 9, 2026 09:19
@hanabi1224 hanabi1224 requested review from LesnyRumcajs and akaladarshi and removed request for a team January 9, 2026 09:19
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/daemon/db_util.rs (1)

251-254: Consider logging the F3 CID for better traceability.

The warning message clearly explains why the import is skipped. For debugging and audit purposes, consider including the f3_cid in the log message to provide complete context about which F3 data is being skipped.

📝 Optional enhancement to include F3 CID in warning
         {
-            // To avoid importing old/wrong F3 data without initial power table check
             tracing::warn!(
-                "skipped importing F3 data as the initial power table CID is not set in the current manifest"
+                "Skipped importing F3 data (CID: {}) as the initial power table CID is not set in the current manifest",
+                f3_cid
             );
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2bd2f58 and a8377bc.

⛔ Files ignored due to path filters (1)
  • f3-sidecar/go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • f3-sidecar/go.mod
  • src/daemon/db_util.rs
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5886
File: src/daemon/db_util.rs:236-259
Timestamp: 2025-08-11T14:00:47.060Z
Learning: In Forest's snapshot import (`src/daemon/db_util.rs`), when F3 CID is present in snapshot metadata but the actual F3 data is missing, this should cause a hard error as it indicates snapshot corruption. Only errors during the F3 import process itself (after data is successfully retrieved) should be non-fatal and logged.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5930
File: build.rs:64-77
Timestamp: 2025-08-13T09:43:20.301Z
Learning: hanabi1224 prefers hard compile-time errors in build scripts rather than runtime safeguards or collision detection, believing it's better to fail fast and fix root causes of issues like malformed snapshot names.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6057
File: src/cli/subcommands/f3_cmd.rs:0-0
Timestamp: 2025-09-09T10:37:17.947Z
Learning: hanabi1224 prefers having default timeouts (like 10m for --no-progress-timeout) to prevent commands from hanging indefinitely, even when the timeout flag isn't explicitly provided by users. This fail-fast approach is preferred over requiring explicit flag usage.
📚 Learning: 2025-08-11T14:00:47.060Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5886
File: src/daemon/db_util.rs:236-259
Timestamp: 2025-08-11T14:00:47.060Z
Learning: In Forest's snapshot import (`src/daemon/db_util.rs`), when F3 CID is present in snapshot metadata but the actual F3 data is missing, this should cause a hard error as it indicates snapshot corruption. Only errors during the F3 import process itself (after data is successfully retrieved) should be non-fatal and logged.

Applied to files:

  • src/daemon/db_util.rs
📚 Learning: 2025-10-17T14:24:47.046Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6167
File: src/tool/subcommands/state_compute_cmd.rs:89-91
Timestamp: 2025-10-17T14:24:47.046Z
Learning: In `src/tool/subcommands/state_compute_cmd.rs`, when using `ReadOpsTrackingStore` to generate minimal snapshots, `HEAD_KEY` should be written to `db.tracker` (not `db` itself) before calling `export_forest_car()`, because the export reads from the tracker MemoryDB which accumulates only the accessed data during computation.

Applied to files:

  • src/daemon/db_util.rs
📚 Learning: 2025-08-06T14:36:08.654Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5886
File: src/daemon/db_util.rs:244-259
Timestamp: 2025-08-06T14:36:08.654Z
Learning: The `import_f3_snapshot` function already prints success messages internally, so additional success logging at the call site is not needed.

Applied to files:

  • src/daemon/db_util.rs
📚 Learning: 2026-01-05T12:54:40.850Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6381
File: src/lotus_json/actors/states/cron_state.rs:8-8
Timestamp: 2026-01-05T12:54:40.850Z
Learning: In Rust code reviews, do not derive Eq for a struct if any field does not implement Eq (e.g., types from external dependencies). If a type like CronStateLotusJson includes fields wrapping external dependencies that lack Eq, derive PartialEq (or implement PartialEq manually) but avoid deriving Eq. This ensures comparisons compile and reflect actual equivalence semantics. When needed, consider implementing custom PartialEq (and possibly Eq) only after ensuring all fields (or wrappers) implement Eq, or keep PartialEq-only if full equality semantics cannot be expressed.

Applied to files:

  • src/daemon/db_util.rs
📚 Learning: 2026-01-05T12:56:13.802Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6381
File: src/lotus_json/actors/states/evm_state.rs:41-44
Timestamp: 2026-01-05T12:56:13.802Z
Learning: In Rust codebases (e.g., Forest), do not add #[cfg(test)] to functions already annotated with #[test]. The #[test] attribute ensures the function is compiled only for tests, so a separate #[cfg(test)] is redundant and can be removed if present. Apply this check to all Rust files that contain #[test] functions.

Applied to files:

  • src/daemon/db_util.rs
🧬 Code graph analysis (1)
src/daemon/db_util.rs (1)
src/f3/mod.rs (2)
  • get_f3_sidecar_params (37-89)
  • import_f3_snapshot (120-144)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: Coverage
  • GitHub Check: tests-release
  • GitHub Check: All lint checks
  • GitHub Check: Build MacOS
  • GitHub Check: Build Ubuntu
  • GitHub Check: cargo-publish-dry-run
🔇 Additional comments (3)
src/daemon/db_util.rs (2)

247-249: LGTM: Conditional guard aligns with PR objectives.

The check correctly determines whether the initial power table is configured before proceeding with F3 import. This prevents importing potentially stale or incorrect F3 data during the calibnet F3 reset.


255-276: LGTM: Existing F3 import logic preserved with correct error handling.

The F3 import flow maintains the established error handling patterns:

  • Hard error if F3 data is missing despite CID being present (Line 258), indicating snapshot corruption
  • Non-fatal error logging if the import process fails (Line 273-274), allowing the snapshot import to proceed

Based on learnings, this error handling strategy is correct and intentional.

f3-sidecar/go.mod (1)

7-7: No blocking issues identified with the version upgrade.

The go-jsonrpc v0.10.0 release (Jan 8, 2026) is a feature addition that introduces a method name formatter option for client handlers. No breaking changes or security advisories were found for this version, making it a straightforward upgrade.

@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

❌ Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.50%. Comparing base (e47b875) to head (a8377bc).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/daemon/db_util.rs 0.00% 22 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/daemon/db_util.rs 52.70% <0.00%> (-0.77%) ⬇️

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2bd2f58...a8377bc. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LesnyRumcajs LesnyRumcajs added this pull request to the merge queue Jan 9, 2026
Merged via the queue into main with commit 9beeb4a Jan 9, 2026
49 checks passed
@LesnyRumcajs LesnyRumcajs deleted the hm/f3-import-enforce-initial-power-table-check branch January 9, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants