Skip to content

Conversation

ZenGround0
Copy link
Collaborator

Backporting the indexing and ipni tasks from mkv2 to the pdpv0 branch.

Code is at least not obviously broken but testing is a work in progress.

@rjan90 rjan90 added the team/fs-wg Items being worked on or tracked by the "FS Working Group". See FilOzone/github-mgmt #10 label Oct 1, 2025
@FilOzzy FilOzzy added this to FS Oct 1, 2025
@github-project-automation github-project-automation bot moved this to 📌 Triage in FS Oct 1, 2025
@rjan90 rjan90 moved this from 📌 Triage to ⌨️ In Progress in FS Oct 1, 2025
@rjan90 rjan90 requested a review from LexLuthr October 1, 2025 15:02
Copy link
Contributor

@LexLuthr LexLuthr left a comment

Choose a reason for hiding this comment

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

Some DB changes are required to make this work

Comment on lines 8 to 15
-- To enable separation of access based on storage service we create a separate provider identity
-- for PDP IPNI requests. This is a practical concern for current IPNI operations with limited resources.
CREATE TABLE ipni_pdp_peerid (
singleton BOOLEAN NOT NULL DEFAULT TRUE PRIMARY KEY CHECK (singleton = TRUE),
priv_key BYTEA NOT NULL,
peer_id TEXT NOT NULL UNIQUE
);

Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to go in a new file. My suggestion would be not create a new table. MK2.0 also uses the existing table.

Comment on lines 61 to 64
ALTER TABLE pdp_piecerefs ADD COLUMN indexing_task_id BIGINT DEFAULT NULL;
ALTER TABLE pdp_piecerefs ADD COLUMN needs_indexing BOOLEAN DEFAULT FALSE;
ALTER TABLE pdp_piecerefs ADD COLUMN ipni_task_id BIGINT DEFAULT NULL;
ALTER TABLE pdp_piecerefs ADD COLUMN needs_ipni BOOLEAN DEFAULT FALSE;
Copy link
Contributor

Choose a reason for hiding this comment

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

This would need to go into a new file. Always expect the existing SQL files are executed and will not be executed again.

Copy link
Contributor

Choose a reason for hiding this comment

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

This task will only produce IPFS style ads. So, there would be no IPNI lookup path for pieces. Which was a requirement confirmed by Jen and Miro both in Dubai.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

+1 That's fine for now. I just want to get ipfs adds working first.

Copy link
Member

Choose a reason for hiding this comment

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

piece CIDs into IPNI is lower priority; if it can be bundled into the same work without too much effort then that's great, but it doesn't buy us very much so it can be treated as a stretch goal

}

pi := &PdpIpniContext{
PieceCID: pcid,
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be pieceCID v2?

// The ipni provider key for pdp is at spid = 0
func (P *PDPIPNITask) initProvider(tx *harmonydb.Tx) error {
var privKey []byte
err := tx.QueryRow(`SELECT priv_key FROM ipni_peerid WHERE spid = 0`).Scan(&privKey)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not use sp_id 0 for consistency, we are keeping negative IDs for all non PoRep stuff. V2 has taken -1, so let's go with -2 here so we don't end up mixing 2 ad chains later when SP upgrade.

@BigLep
Copy link
Member

BigLep commented Oct 6, 2025

@ZenGround0 : will https://github.com/filecoin-project/curio/blob/feat/index-and-ipni/deps/config/types.go#L116 be updated to include filecoinpin.contact, or will that be somewhere else?

select {
case recs <- indexstore.Record{
Cid: blockMetadata.Cid,
Offset: blockMetadata.Offset,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Offset: blockMetadata.Offset,
Offset: blockMetadata.SourceOffset,

See https://pkg.go.dev/github.com/ipld/go-car/v2#BlockMetadata, this is important to support CARv2 which has a header before the internal CARv1 container.

But I see this is just copied straight from tasks/indexing/task_indexing.go and the same use exists above in tasks/indexing/task_pdp_ipni.go and where it's copied from in tasks/indexing/task_ipni.go. So @LexLuthr you're going to need to fix them too.

The Boost version of this is a good reference fwiw, (that you were responsible for @LexLuthr): filecoin-project/boost#1739 (see piecedirectory/piecedirectory.go parseRecordsFromCar).

I also note that we're not supporting PoDSI here; something to look into later maybe.

Copy link
Contributor

Choose a reason for hiding this comment

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

#681 fixes it for main.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we filter out cid.contract for anything not mainnet. We should remove that check as well.

@rjan90 rjan90 mentioned this pull request Oct 7, 2025
5 tasks
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.

FS: IPNI advertisements for CIDs in PDP pieces in the "PDP node w/ mkv1" branch
5 participants