Skip to content

feat: emit PiecesScheduledForRemoval when scheduling piece deletions - #287

Merged
wjmelements merged 2 commits into
FilOzone:mainfrom
nishant-uxs:feat/pieces-scheduled-for-removal-event
Aug 4, 2026
Merged

wjmelements merged 2 commits into
FilOzone:mainfrom
nishant-uxs:feat/pieces-scheduled-for-removal-event

Conversation

@nishant-uxs

Copy link
Copy Markdown
Contributor

Summary

  • Emit PiecesScheduledForRemoval(setId, pieceIds) from schedulePieceDeletions so indexers can observe scheduled removals immediately, without waiting for PiecesRemoved at the next proving boundary.
  • Declare the event in IPDPEvents alongside the existing piece lifecycle events.

Closes #281

Files Changed

  • src/interfaces/IPDPEvents.sol
  • src/PDPVerifier.sol
  • test/PDPVerifier.t.sol

Testing Performed

  • forge build --via-ir
  • forge test --via-ir (187 passed)

Known Limitations

  • Does not change listener/piecesScheduledRemove behavior; event is for log-driven consumers.

Risk Assessment

  • Low: additive event only; no storage layout or ABI-breaking logic changes beyond a new event topic.

Make scheduled deletions observable to event-driven indexers before
nextProvingPeriod processes removals.
Comment thread src/PDPVerifier.sol Outdated
scheduledRemovals[setId].push(pieceId);
}

emit PiecesScheduledForRemoval(setId, pieceIds);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

emit after listener instead of before, in case listener rejects

@nishant-uxs

Copy link
Copy Markdown
Contributor Author

Addressed in 8aba46b — emit now happens after the listener call, matching the other listener/emit sequences in PDPVerifier (e.g. _createDataSet, deleteDataSet, nextProvingPeriod), so a rejecting listener reverts before the event is recorded.

@rvagg

rvagg commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

thanks @nishant-uxs, this is going to need an abi update, make update-abi should do it

@nishant-uxs

nishant-uxs commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @rvagg — addressed.

make update-abi lives in FilOzone/filecoin-services (not this repo), so I opened a companion draft PR that adds PiecesScheduledForRemoval to the checked-in PDPVerifier ABI:

FilOzone/filecoin-services#566

Once this PR merges, we can bump service_contracts/lib/pdp to the merge commit and re-run make -C service_contracts update-abi so check-abi matches source.

@wjmelements
wjmelements merged commit 8f5821a into FilOzone:main Aug 4, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this to 🎉 Done in PDP Aug 4, 2026
@Kubuxu

Kubuxu commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator

This PR limits the number of scheduled pieces per transaction to about ~254 due to the 8KiB event size limit.
As far as I can see, this hasn't landed in a release, so we can remediate.
We could emit event PiecesScheduledForRemoval(uint256 indexed setId, uint64[] pieceIds);, which would bump it to ~511, or we could split the event at some boundary to keep the size in check.
With #283, we can allow for larger removals.

I detected this while running a benchmark sweep.

@rvagg

rvagg commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

👍 my preference would be to do it in chunks, at some boundary like 100, but doing it by ID I guess could be fine too since indexers would have the original mapping of cid to id; or at least they'll have to

@wjmelements

Copy link
Copy Markdown
Contributor

uint64[] pieceIds

These are still 32 bytes in solidity.

@Kubuxu

Kubuxu commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator

These are still 32 bytes in solidity.

You are right, interesting that that is the definition of alignment rules.

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

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

Emit an event when pieces are scheduled for removal (schedulePieceDeletions)

4 participants