Skip to content

Piece deletion - #1453

Open
LexLuthr wants to merge 9 commits into
mainfrom
piece-deletion
Open

Piece deletion#1453
LexLuthr wants to merge 9 commits into
mainfrom
piece-deletion

Conversation

@LexLuthr

Copy link
Copy Markdown
Collaborator

No description provided.

@FilOzzy FilOzzy added the team/fs-wg Items being worked on or tracked by the "FS Working Group". See FilOzone/github-mgmt #10 label Aug 24, 2026
@FilOzzy FilOzzy added this to FOC Aug 24, 2026
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Aug 24, 2026
],
"outputs": [],
"stateMutability": "nonpayable"
},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Note: when we rebase on latest main this should go away since @snadrus 's PR included all of this

const provingPeriodReconcileBatchLimit = 128

// NewProvingPeriodWatcher reconciles confirmed proving-period side effects
// before the prove watcher runs. nextProvingPeriod is what finally applies

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Lets update this comment

Comment thread tasks/pdpv0/task_next_pp.go Outdated
// watcher runs in an earlier phase; complete here and let the next tipset
// re-schedule this task. A queue with no drain in flight is handled by the
// PendingPieceDeletions revert instead.
draining, err := hasDrainInFlight(ctx, n.db, dataSetId)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't want to handle it in this ad hoc way when this is really the core scheduling flow of the whole proving mechanism. I want to only schedule nextProvingPeriod tasks when there is no record of us needing to processRemovals.

AND rm_message_hash = $3
AND removed = FALSE
`, piece.DataSetID, piece.PieceID, piece.TxHash)
func enqueueDeletionDrainFromProvingWatcher(ctx context.Context, db *harmonydb.DB, dataSetID int64) error {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This function wrapper can be dropped and the body can be inlined into the only callsite

Comment thread tasks/pdpv0/task_process_deletions.go Outdated
SELECT data_set
FROM pdpv0_deletion_drain
WHERE task_id IS NULL
AND msg_hash IS NULL

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems wrong.

Right now the proving period watcher enqueus these rows immediately if the dataset has any pieces to delete. This task then immediately processes them. This will happen before proving essentially every time. Because of our approach clearing out the challenge epoch on chain this means that every scheduled removal leads to a failed proof.

We need to run this between proving and nextProvingPeriod. IMO the right way to do this is to

  1. schedule this after the challenge window has passed for the dataset in question
  2. only schedule nextProvingPeriod task after any rows in this table have been removed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Addressed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One thing to note is that every nextPP is going to have to wait for process deletions upon startup because we are migrating every dataset to check for its removals after upgrade.

Comment thread tasks/pdpv0/task_next_pp.go
@ZenGround0
ZenGround0 marked this pull request as ready for review August 25, 2026 01:09
@ZenGround0
ZenGround0 requested a review from a team as a code owner August 25, 2026 01:09
// schedulePieceDeletions transaction only records delete intent; the piece
// should not be marked removed locally while PDPVerifier still reports it as
// scheduled or live.
func processPendingPieceDeletes(ctx context.Context, db *harmonydb.DB, ethClient ethchain.EthClient, dataSets []int64) error {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am somewhat concerned about piece deletions that happen on the non-upgraded smart contract before the smart contract is upgraded to 3.5.0 with this version of curio software. It looks like we are not going to track them properly.

@FilOzzy FilOzzy moved this from 📌 Triage to 🔎 Awaiting review in FOC Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team/fs-wg Items being worked on or tracked by the "FS Working Group". See FilOzone/github-mgmt #10

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PDP: integrate new processRemovals function into pdp tasks

3 participants