Skip to content

Conversation

@rjan90
Copy link
Collaborator

@rjan90 rjan90 commented Oct 22, 2025

Implements simplified dataset status system as specified in issue #169, replacing the 3-state system with a clearer 2-state system.

Summary

This PR introduces a two-state dataset lifecycle system (Inactive/Active) to make dataset status easier to understand and use across clients, SDKs, and smart contracts.

Key Concept: Status reflects data existence, not operational state.

  • Inactive = Dataset doesn't exist or has no pieces
  • Active = Dataset has data and proving history (including terminated datasets)

Changes

Smart Contracts

1. Updated DataSetStatus Enum

  • Changed from 3 states (NotFound, Active, Terminating) to 2 states (Inactive, Active)
  • File: service_contracts/src/FilecoinWarmStorageService.sol
enum DataSetStatus {
    Inactive,  // non-existent or no pieces
    Active     // has pieces (including terminated)
}

Breaking Changes

⚠️ This is a breaking change

Enum Changes

Old Status Old Value New Status New Value Notes
NotFound 0 Inactive 0 Non-existent datasets
Active 1 Active 1 Operational datasets (no change)
Terminating 2 Active 1 Terminated datasets with pieces

Key Semantic Changes

  1. Terminated datasets are now Active (not Inactive or Terminating)

    • They still have data and proving history
    • Use pdpEndEpoch or isTerminated to check operational state
  2. Status reflects data existence, not operational state

    • Active = "has data"
    • Inactive = "doesn't exist or no data"

Closes #169

@FilOzzy FilOzzy added this to FS Oct 22, 2025
@github-project-automation github-project-automation bot moved this to 📌 Triage in FS Oct 22, 2025
@rjan90 rjan90 moved this from 📌 Triage to ⌨️ In Progress in FS Oct 22, 2025
@rjan90 rjan90 moved this from ⌨️ In Progress to 🔎 Awaiting review in FS Oct 23, 2025
@rjan90 rjan90 marked this pull request as ready for review October 23, 2025 11:17
@rjan90 rjan90 requested a review from Kubuxu October 23, 2025 15:34
@@ -0,0 +1,942 @@
# Dataset Status Integration Guide
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not reviewing this or the other .md file unless someone explicitly tells me to. It is probably best to either remove it or have someone rewrite it into a few paragraphs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed the added .md-files in the PR here: 6408bdc. Will open a draft-PR with those, so that we can get proper review and edit of those

// Event for dataset status changes
event DataSetStatusChanged(
uint256 indexed dataSetId, DataSetStatus indexed oldStatus, DataSetStatus indexed newStatus, uint256 epoch
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we adding an event? It is the first time I'm hearing about it.
Also, newStatus almost for sure should not be indexed, it just isn't worth indexing.

// Dataset is inactive: non-existent (pdpRailId==0) or no pieces added yet (rate==0, no proving)
Inactive,
// Dataset has pieces and proving history (includes terminated datasets)
// Note: Terminated datasets remain Active - use pdpEndEpoch to check termination status
Copy link
Contributor

@Kubuxu Kubuxu Oct 23, 2025

Choose a reason for hiding this comment

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

This comment is wrong. The datasets in the process of being terminated remain Active, but Terminated datasets will become Inactive as their data will be wiped when provider deletes the dataset from PDP side.

*/
function isDataSetActive(FilecoinWarmStorageService service, uint256 dataSetId) internal view returns (bool) {
return getDataSetStatus(service, dataSetId) == FilecoinWarmStorageService.DataSetStatus.Active;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This getter serves no purpose

hasProving = activationEpoch != 0;

// Check if terminated
isTerminated = info.pdpEndEpoch != 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

this is terminating not terminated

* @return hasProving Whether proving is activated
* @return isTerminated Whether the rail is terminated
*/
function getDataSetStatusDetails(FilecoinWarmStorageService service, uint256 dataSetId)
Copy link
Contributor

Choose a reason for hiding this comment

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

This method seems counter to the whole PR. We decide to reduce the fidelity of status, but now this exposes even more internal detail.

Copy link
Contributor

Choose a reason for hiding this comment

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

@rjan90 are you sure we want to keep this?

Copy link
Collaborator Author

@rjan90 rjan90 Oct 24, 2025

Choose a reason for hiding this comment

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

Removed in the latest commit: 6408bdc


// Inactive only if no proving has started
// Everything else is Active (including terminated datasets)
if (!hasProving) {
Copy link
Contributor

Choose a reason for hiding this comment

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

combine this with the line above, as the layer of indirection just makes it more confusing

@Kubuxu
Copy link
Contributor

Kubuxu commented Oct 24, 2025

If we remove getDataSetStatusDetails and the unreviewed markdown documents (which I'm quite sure will require many changes), it would be good to merge.
IDK what the idea is behind getDataSetStatusDetails and why we would expose it.

Implement simplified dataset status system as specified in issue #169.
Replaces the 3-state system (NotFound/Active/Terminating) with a clearer
2-state system (Inactive/Active).

Key changes:
- Updated DataSetStatus enum from 3 states to 2 states (Inactive/Active)
- Status now reflects data existence, not operational state
- Inactive = Dataset doesn't exist or has no pieces
- Active = Dataset has data and proving history (including terminated)
- Updated contract logic, tests, subgraph, and documentation

BREAKING CHANGE: DataSetStatus enum values changed. Terminated datasets
are now Active (not Terminating). Check operational state using
pdpEndEpoch or isTerminated() instead.
@rjan90 rjan90 force-pushed the phi/dataset-lifecycle branch from 522ae83 to ddd6ccd Compare October 24, 2025 16:34
fix: update ABIs
@github-project-automation github-project-automation bot moved this from 🔎 Awaiting review to ✔️ Approved by reviewer in FS Oct 24, 2025
@rjan90 rjan90 merged commit 8399813 into main Oct 24, 2025
6 checks passed
@github-project-automation github-project-automation bot moved this from ✔️ Approved by reviewer to 🎉 Done in FS Oct 24, 2025
@rjan90 rjan90 deleted the phi/dataset-lifecycle branch October 24, 2025 18:29
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.

Feature & Documentation Request: Dataset Status Exposure & Lifecycle in FWSS

3 participants