Skip to content

feat: use PDPVerifier.findPieceIdsByCid for efficient CID→ID lookups#718

Open
Chaitu-Tatipamula wants to merge 2 commits intoFilOzone:masterfrom
Chaitu-Tatipamula:find-piece-ids-by-cid
Open

feat: use PDPVerifier.findPieceIdsByCid for efficient CID→ID lookups#718
Chaitu-Tatipamula wants to merge 2 commits intoFilOzone:masterfrom
Chaitu-Tatipamula:find-piece-ids-by-cid

Conversation

@Chaitu-Tatipamula
Copy link
Copy Markdown
Contributor

Closes #667

Summary

Replaces expensive full-piece-list fetches with the new PDPVerifier.findPieceIdsByCid contract method for direct CID→ID lookups.

Changes

synapse-core

  • New: findPieceIdsByCid + findPieceIdsByCidCall in pdp-verifier/
  • Mocks: Added findPieceIdsByCid handler and default preset

synapse-sdk

  • pieceStatus(): Replaced getActivePieces() + .find() with single findPieceIdsByCid() call
  • _getPieceIdByCID(): Replaced SP API getDataSet() + .find() with findPieceIdsByCid() call

Tests

  • New unit tests for findPieceIdsByCid call builder and mocked RPC
  • Updated pieceStatus test for "piece not found" scenario

Why

Previously pieceStatus() fetched all active pieces then searched linearly — O(n) and potentially fails on large datasets. Now it's a single targeted contract call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📌 Triage

Development

Successfully merging this pull request may close these issues.

Use PDPVerifier#findPieceIdsByCid to avoid piece ID lookup by search

1 participant