Skip to content

Conversation

Chaitu-Tatipamula
Copy link
Contributor

Description

This PR implements the feature described in #171 at filecoin-services to merge createDataset and addPieces operations for a streamlined user experience.

Changes

PDP Verifier Updates

  • Enhanced addPieces function: Now accepts (datasetID, listenerAddress, pieces, extraData) parameters
  • New dataset creation: Use datasetID = NEW_DATA_SET_SENTINEL (type(uint256).max) with a valid listenerAddress to create a new dataset and add pieces in a single transaction
  • Existing dataset updates: Use listenerAddress = 0 with an existing datasetID to add pieces to existing datasets
  • Removed createDataset method: No longer needed as functionality is merged into addPieces

Test Improvements

  • Added comprehensive test coverage for the combined create-and-add flow
  • Fixed listener initialization issues across test contracts
  • Added TestConstants.sol for shared constants like NEW_DATA_SET_SENTINEL
  • Updated all test contracts to use the new streamlined approach

Benefits

  • Single transaction: Users can create datasets and add pieces in one operation
  • Reduced wait times: No need to wait for dataset creation confirmation before adding pieces
  • Simplified UX: One client signing operation instead of two
  • Backward compatibility: Existing functionality for adding to existing datasets preserved

Testing

  • All existing tests pass
  • New tests cover the combined create-and-add flow
  • Listener initialization issues resolved
  • Event emission verified for both dataset creation and piece addition

Related Issue

Closes #171 at filecoin-services

@rjan90 rjan90 moved this to 🔎 Awaiting review in PDP Sep 18, 2025
@rjan90 rjan90 requested review from Copilot, ZenGround0, Kubuxu and aarshkshah1992 and removed request for Copilot September 18, 2025 12:20
@Chaitu-Tatipamula Chaitu-Tatipamula force-pushed the feature/merge-create-dataset-add-pieces branch 2 times, most recently from 53eb289 to 162dc83 Compare September 18, 2025 17:03
@Chaitu-Tatipamula Chaitu-Tatipamula force-pushed the feature/merge-create-dataset-add-pieces branch 2 times, most recently from 1ea1008 to c007669 Compare September 26, 2025 20:26
@Chaitu-Tatipamula Chaitu-Tatipamula force-pushed the feature/merge-create-dataset-add-pieces branch from b2cadb9 to 8819635 Compare September 29, 2025 13:17
uint256 firstAdded = nextPieceId[setId];

firstAdded = nextPieceId[setId];
uint256[] memory pieceIds = new uint256[](pieceData.length);
Copy link
Contributor

Choose a reason for hiding this comment

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

use nPieces here too, and also in the line below.

@wjmelements wjmelements changed the title feat: Merge createDataset and addPieces for streamlined dataset creation feat!: Merge createDataset and addPieces for streamlined dataset creation Sep 29, 2025
@wjmelements wjmelements merged commit e8d3145 into FilOzone:main Sep 29, 2025
3 checks passed
@github-project-automation github-project-automation bot moved this from 🔎 Awaiting review to 🎉 Done in PDP Sep 29, 2025
@Chaitu-Tatipamula Chaitu-Tatipamula deleted the feature/merge-create-dataset-add-pieces branch September 29, 2025 18:03
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.

Merge createDataset and addPiece for streamlined dataset creation and piece addition
3 participants