Add resumable scheduled piece deletion - #297
Conversation
|
What happens if the removed pieces are part of the current challenge? |
You raise a very good point that I haven't considered yet because I focused only on the first skim. |
Unfortunately These two things cancel out. Because of the way things are structured I think the only way to determine if proof has already been submitted is by inspecting listener state. So we'll need to callback to check this for us. |
AFAIK, |
Unfortunately from verifier perspective nextProvingPeriod only bumps up the challenge sampling epoch by the finality number. This is decoupled from the challenge window and proving period parameters which are listener recorded and enforced. Verifier does track the epoch of last proving but without knowing proving period and challenge window params that is not sufficient for figuring out whether we have proven "this period". Verifier doesn't understand that concept. It will be simplest and in line with existing solutions to similar problems to use a listener callback to decided if scheduling is ok. The closest to a verifier-only solution we have is to inspect nextChallengeEpoch in Verifier state and assert it is in the future, i.e. allow removals after nextProvingPeriod. If we modify proving set before challenge sampling then we still prevent grinding. But grinding becomes more effective the closer we get to the challenge sampling epoch because of L1 forking so any solution would necessarily degrade grinding security and I wouldn't want to do that. For what it's worth as time has gone on this design choice was more and more obviously wrong. We should have had proving period and challenge window params set per dataset in create message. |
|
You are right, I thought we were bounding the window. Alternatively, what if we invalidate the challenge sampling epoch when removal happens? |
447cb5b to
e97561e
Compare
|
The latest commits introduce the mechanism I mentioned here: #297 (comment) |
0f6da2a to
bba8694
Compare
bba8694 to
7dd439b
Compare
Co-authored-by: Jakub Sztandera <oss@kubuxu.com>
Kubuxu
left a comment
There was a problem hiding this comment.
SGTM I'm going to do one more pass tomorrow on fresh mind
Co-authored-by: Jakub Sztandera <oss@kubuxu.com>
Summary
Fixes #283.
Moves scheduled piece deletion out of
nextProvingPeriod()and into explicit, resumable storage-provider transactions.Changes
processPieceDeletions(uint256 setId, uint256 removalCount).removalCountentries from the tail of the verifier’s scheduled-removal queue.PieceV2removal markers.piecesRemoved(uint256 dataSetId, uint256 removedPieceCount)after PDP state is internally consistent.PiecesRemoved, split into chunks of at most 100 IDs.nextProvingPeriod()revert with the pending deletion count until the queue is empty.SimplePDPService.REMOVE_PROCESSEDtoPDPRecordKeeper.OperationType.This adds no per-call protocol batch cap or new storage fields.
MAX_ENQUEUED_REMOVALSremains unchanged.Tests
Added coverage for:
challengeRangeonly during rollover;SimplePDPServiceproof/deadline timing rules.Follow-up
FilecoinWarmStorageServicemust implementpiecesRemoved(uint256,uint256)and move its bounded metadata cleanup out ofnextProvingPeriod()in the correspondingfilecoin-serviceschange.Curio must call
processPieceDeletions()with a suitable removal count and retry with smaller counts when necessary. Those changes are outside this PR.