Skip to content

fix(cleanup): anchor cleanupPieces gate to last proving activity#279

Merged
wjmelements merged 2 commits into
mainfrom
rvagg/cleanupPieces-nowait
Jun 5, 2026
Merged

fix(cleanup): anchor cleanupPieces gate to last proving activity#279
wjmelements merged 2 commits into
mainfrom
rvagg/cleanupPieces-nowait

Conversation

@rvagg
Copy link
Copy Markdown
Contributor

@rvagg rvagg commented Jun 5, 2026

The permissionless gate was anchored to cleanup-mode entry, so the abandonment path took two INACTIVITY_WINDOWs (~60 days): a third party could delete an abandoned data set after 30 days but had to wait another 30 to clean up and collect the deposit. Both gates now share _withinActivityWindow, making delete and cleanup permissionless at the same moment. Deprecates the now-unused cleanupModeEpoch in place.


deleteDataSet becomes permissionless after INACTIVITY_WINDOW (~30 days) without proving activity, but cleanupPieces restarted that clock from the delete itself. The abandonment path therefore took ~60 days, and the cleanup deposit, meant as the bounty for whoever tears down an abandoned data set, was unclaimable by the deleter for a month and then up for grabs by anyone, breaking the incentive to do the (expensive) permissionless delete at all.

Fix: both functions now share one gate, _withinActivityWindow(), anchored to dataSetLastProvenEpoch (legacy fallback to LEGACY_ACTIVITY_EPOCH). That epoch is frozen once a data set enters cleanup mode (provePossession/nextProvingPeriod/addPieces all revert on deleted data sets), so a data set abandoned enough to delete is immediately cleanable by the same caller, while an actively-proving SP keeps its ~30-day exclusive cleanup window after a voluntary delete. The call ordering (delete, then cleanup) is unchanged: it's enforced by the CLEANUP_MODE_SENTINEL, which never depended on the removed anchor. cleanupModeEpoch is deprecated in place; _finalizeCleanup still clears v3.4.0 residue.

The permissionless gate was anchored to cleanup-mode entry, so the
abandonment path took two INACTIVITY_WINDOWs (~60 days): a third party
could delete an abandoned data set after 30 days but had to wait
another 30 to clean up and collect the deposit. Both gates now share
_withinActivityWindow, making delete and cleanup permissionless at the
same moment. Deprecates the now-unused cleanupModeEpoch in place.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the cleanup incentive/abandonment flow by aligning the permissionless gate for cleanupPieces() with deleteDataSet(), both anchored to last proving activity rather than cleanup-mode entry. This ensures an abandoned data set can be deleted and cleaned up in the same sequence by the same caller, allowing the cleanup deposit bounty to be claimed immediately when appropriate.

Changes:

  • Introduces _withinActivityWindow(setId) and reuses it for both deleteDataSet() and cleanupPieces() permission gating.
  • Deprecates the old cleanup-mode anchor storage (cleanupModeEpoch) in-place (renamed to deprecatedCleanupModeEpoch) and clears any legacy residue during finalization.
  • Expands cleanup-related test coverage to cover abandoned/active/legacy scenarios and storage-residue clearing.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/CleanupPieces.t.sol Adds targeted tests verifying the new shared activity-anchored permission gate and legacy/residue behavior.
src/PDPVerifierLayout.sol Renames the slot constant to reflect deprecated cleanup-mode epoch storage (same slot preserved).
src/PDPVerifierLayout.json Renames the storage layout label to deprecatedCleanupModeEpoch to match the deprecation.
src/PDPVerifier.sol Implements _withinActivityWindow and applies it to delete/cleanup gating; deprecates and clears the old gate anchor storage.
CHANGELOG.md Documents the behavioral fix and the deprecation of cleanupModeEpoch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-project-automation github-project-automation Bot moved this from 📌 Triage to ✔️ Approved by reviewer in FOC Jun 5, 2026
… block

Assisted-by: Claude:claude-sonnet-4-6
@wjmelements
Copy link
Copy Markdown
Contributor

Nice. Too bad we already deployed the cleanupModeEpoch.

@wjmelements wjmelements merged commit d193e2e into main Jun 5, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC Jun 5, 2026
@wjmelements wjmelements deleted the rvagg/cleanupPieces-nowait branch June 5, 2026 20:37
@github-project-automation github-project-automation Bot moved this to 🎉 Done in PDP Jun 5, 2026
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.

4 participants