feat: cleanup deposits#270
Conversation
Assisted-by: Claude:claude-sonnet-4-6
… PDPVerifier setup to setUp() Assisted-by: Claude:claude-sonnet-4-6
…eces Assisted-by: Claude:claude-sonnet-4-6
…a sets Assisted-by: Claude:claude-sonnet-4-6
…4 bytes Assisted-by: Claude:claude-sonnet-4-6
…{value}
Assisted-by: Claude:claude-sonnet-4-6
Assisted-by: Claude:claude-sonnet-4-6
There was a problem hiding this comment.
Pull request overview
This PR implements dataset cleanup finalization via a FIL “cleanup deposit” and a new cleanupPieces() flow, removing the prior sybil-fee/USDFC enforcement logic and updating/adding tests to validate the new termination + cleanup behavior (including legacy-deleted datasets).
Changes:
- Replace sybil fee logic with a per-dataset FIL cleanup deposit (
PDPFees.cleanupDeposit()), refunded to whoever completes cleanup. - Add cleanup mode +
cleanupPieces(setId, maxPieces)to allow incremental storage teardown afterdeleteDataSet(), with permissionless cleanup after an inactivity window. - Update existing Foundry tests and add a new cleanup-focused test suite.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/PDPVerifier.sol |
Adds cleanup mode/deposit accounting and cleanupPieces(), removes prior sybil enforcement code paths. |
src/Fees.sol |
Renames sybil fee to cleanup deposit and updates constants/helpers accordingly. |
src/interfaces/IPDPVerifier.sol |
Exposes cleanupPieces() and updates fee-related getters to the new model. |
src/PDPVerifierLayout.sol / src/PDPVerifierLayout.json |
Extends storage layout with cleanup deposit + cleanup mode epoch mappings. |
test/CleanupPieces.t.sol |
New test coverage for incremental cleanup, permission gates, and deposit payout behavior. |
test/PDPVerifier.t.sol / test/PDPVerifierProofTest.t.sol / test/ERC1967Proxy.t.sol |
Updates tests for new constructor + fee model and new error selectors/constants. |
test/Fees.t.sol |
Removes sybil fee test (but does not add a cleanup deposit constant test). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Assisted-by: Claude:claude-sonnet-4-6
Assisted-by: Claude:claude-sonnet-4-6
…constructor arg, add MAX_FINALITY upper bound Assisted-by: Claude:claude-sonnet-4-6
…reation, last-piece removal, and post-upgrade Assisted-by: Claude:claude-sonnet-4-6
Assisted-by: Claude:claude-sonnet-4-6
Assisted-by: Claude:claude-sonnet-4-6
rvagg
left a comment
There was a problem hiding this comment.
approving in expectation of resolution of the bash script fixups, and an eye to the underflow panic vs proper error
otherwise lgtm!
Kubuxu
left a comment
There was a problem hiding this comment.
Looks good
One nit that is probably not worth fixing:
dataSetLastProvenEpoch became something else, something closer to lastModified.
Maybe a comment on its actual uses would be useful.
…y scripts Assisted-by: Claude:claude-sonnet-4-6
Assisted-by: Claude:claude-sonnet-4-6
…eposit PDPVerifier v3.4.0 (announced 2026-05-24, calibration upgrade early next week, mainnet gated on calibration smoke) introduces a 0.1 FIL cleanup deposit on new dataset creation: - createDataSet() requires msg.value >= FIL_CLEANUP_DEPOSIT() - addPieces(NEW_DATA_SET_SENTINEL, ...) same requirement - USDFC sybil-fee path removed entirely Excess msg.value is refunded by the contract. The 0.1 FIL value matches the existing contract.SybilFee() helper (same numerical value, different on-chain semantics: was a burn fee, now a refundable deposit paid to whoever completes cleanup after deletion). Safe to ship before the upgrade lands: v3.2.0 deployments ignore msg.value silently on these paths, so this change is a no-op until the new implementation is wired in behind the proxy. Both call sites covered: - handleCreateDataSetAndAddPieces (line 115) - handleCreateDataSet (line 281) addPieces to an existing dataset (handlers_add.go) is unaffected; cleanup deposit applies only to NEW dataset creation, not to adding pieces to a live one. Refs: FilOzone/pdp CHANGELOG v3.4.0, FilOzone/pdp#270, FilOzone/pdp#271
Reviewer @rvagg
Closes #269
Spec
It is important that cleanup also works for existing datasets.
Changes