fix: drain F3 data reader when skipping F3 import during snapshot import#13491
Merged
fix: drain F3 data reader when skipping F3 import during snapshot import#13491
Conversation
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>
rvagg
reviewed
Feb 6, 2026
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
Kubuxu
approved these changes
Feb 6, 2026
rjan90
added a commit
that referenced
this pull request
Feb 6, 2026
8 tasks
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: