Conversation
There was a problem hiding this comment.
Pull request overview
Fixes an edge case in RPCFreeSectors where swap-and-truncate deletion could produce incorrect sector-root sets when deletion indices overlap with the tail replacement zone.
Changes:
- Normalize
RPCFreeSectorsindices client-side by sorting descending and deduplicating before sending/verification. - Update/add tests to compute expected roots using the same normalized swap behavior and add a regression suite covering overlap cases.
- Add a changeset entry documenting the fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
rhp/v4/rpc.go |
Normalizes free-sector indices (descending sort + dedupe) to avoid incorrect swaps and proof mismatches. |
rhp/v4/rpc_test.go |
Adds assertSectorsFreed helper and a table-driven regression test for overlap scenarios; updates existing test to use the helper. |
.changeset/...rpcfreesectors...md |
Adds a patch-level changelog entry for the fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
..._and_truncate_deletion_logic_could_preserve_a_sector_root_that_was_supposed_to_be_deleted.md
Show resolved
Hide resolved
ChrisSchinnerl
approved these changes
Mar 11, 2026
peterjan
reviewed
Mar 11, 2026
peterjan
approved these changes
Mar 11, 2026
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.
Fixes an edge case in RPCFreeSectors where the swap-and-truncate deletion logic could keep a deleted sector root and lose a kept one when indices overlap with the replacement zone at the tail of the slice. The client now sorts indices descending and deduplicates before sending.