Skip to content

fix: drain F3 data reader when skipping F3 import during snapshot import#13491

Merged
rjan90 merged 3 commits intomasterfrom
fix/snapshot-import-skip-f3-data
Feb 6, 2026
Merged

fix: drain F3 data reader when skipping F3 import during snapshot import#13491
rjan90 merged 3 commits intomasterfrom
fix/snapshot-import-skip-f3-data

Conversation

@rjan90
Copy link
Copy Markdown
Contributor

@rjan90 rjan90 commented Feb 6, 2026

Related Issues

When a snapshot contains F3 data but the F3 manifest is unavailable or InitialPowerTable is undefined, the import code skips F3 processing but fails to consume the f3Reader. Since the CAR block reader returned this reader from NextReader(), the underlying stream position only advances when the reader is fully consumed. The next br.Next() call then misinterprets F3 payload bytes as CID bytes, causing:

"invalid cid: expected 1 as the cid version number, got: 132"

I got the above error, when trying to start a node on Calibnet with the F3 Calibnet restart changes in #13469

Proposed Changes

Drain the reader with io.Copy(io.Discard, f3Reader) in both skip branches so the CAR stream correctly advances past the F3 data block.

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

When a snapshot contains F3 data but the F3 manifest is unavailable or
InitialPowerTable is undefined, the import code skips F3 processing but
fails to consume the f3Reader. Since the CAR block reader returned this
reader from NextReader(), the underlying stream position only advances
when the reader is fully consumed. The next br.Next() call then
misinterprets F3 payload bytes as CID bytes, causing:

  "invalid cid: expected 1 as the cid version number, got: 132"

Drain the reader with io.Copy(io.Discard, f3Reader) in both skip
branches so the CAR stream correctly advances past the F3 data block.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-project-automation github-project-automation bot moved this to Todo in F3 Feb 6, 2026
@github-project-automation github-project-automation bot moved this to 📌 Triage in FilOz Feb 6, 2026
@rjan90 rjan90 moved this from Todo to In progress in F3 Feb 6, 2026
@rjan90 rjan90 moved this from 📌 Triage to 🔎 Awaiting Review in FilOz Feb 6, 2026
@rjan90 rjan90 moved this from In progress to In review in F3 Feb 6, 2026
@rjan90 rjan90 requested a review from Kubuxu February 6, 2026 07:51
@rjan90 rjan90 self-assigned this Feb 6, 2026
@rjan90 rjan90 marked this pull request as ready for review February 6, 2026 08:03
Consolidate the F3 data import checks to improve readability and maintainability. The code now first checks if the F3 manifest is available and if the InitialPowerTable is defined before proceeding with the import. If either condition fails, a warning is logged, and the F3 data reader is properly drained to ensure the stream advances correctly. This change enhances the clarity of the import process and ensures that the reader is always consumed when skipping F3 data.
chore: update changelog
@github-project-automation github-project-automation bot moved this from 🔎 Awaiting Review to ✔️ Approved by reviewer in FilOz Feb 6, 2026
@rjan90 rjan90 merged commit e2427da into master Feb 6, 2026
98 checks passed
@github-project-automation github-project-automation bot moved this from ✔️ Approved by reviewer to 🎉 Done in FilOz Feb 6, 2026
@rjan90 rjan90 deleted the fix/snapshot-import-skip-f3-data branch February 6, 2026 13:14
@github-project-automation github-project-automation bot moved this from In review to Done in F3 Feb 6, 2026
rjan90 added a commit that referenced this pull request Feb 6, 2026
fix: drain F3 data reader when skipping F3 import during snapshot import (#13491)
rjan90 added a commit that referenced this pull request Feb 9, 2026
* build: release Lotus Node and Miner v1.34.4

build: release Lotus Node and Miner v1.34.4

* chore: update changelog for v1.34.4 release

chore: update changelog for v1.34.4 release

* chore: backport #13491 to the `release/v1.34.4` branch (#13492)

fix: drain F3 data reader when skipping F3 import during snapshot import (#13491)

* build: release Lotus Node and Miner v1.34.4

build: release Lotus Node and Miner v1.34.4

* chore: update changelog for v1.34.4 release

chore: update changelog for v1.34.4 release

* chore: update changelog

chore: update changelog
rjan90 added a commit that referenced this pull request Feb 9, 2026
* build: release Lotus Node and Miner v1.34.4

build: release Lotus Node and Miner v1.34.4

* chore: update changelog for v1.34.4 release

chore: update changelog for v1.34.4 release

* chore: backport #13491 to the `release/v1.34.4` branch (#13492)

fix: drain F3 data reader when skipping F3 import during snapshot import (#13491)

* build: release Lotus Node and Miner v1.34.4

build: release Lotus Node and Miner v1.34.4

* chore: update changelog for v1.34.4 release

chore: update changelog for v1.34.4 release

* chore: update changelog

chore: update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done
Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

3 participants