Skip to content

Wrong PieceCID format in ContextID of IPNI advertisements for PDP deals #735

@bajtos

Description

@bajtos

Checklist

  • This is not a question or a support request. If you have any Curio related questions, please ask in the discussion forum.
  • This is not a new feature request. If it is, please file a feature request instead.
  • This is not an enhancement request. If it is, please file a improvement suggestion instead.
  • I have searched on the issue tracker and the discussion forum, and there is no existing related issue or discussion.
  • I am running the Latest release, or the most recent RC(release candidate) for the upcoming release or the dev branch(master), or have an issue updating to any of these.
  • I did not make any code changes to curio.

Curio component

  • PoRep Pipeline
  • Snap Deals
  • Market
  • IPNI provider
  • Curio UI
  • Other

Curio Version

curio version 1.27.0+calibnet+git_1c28e2d4_2025-10-24T09:11:50+02:00

Describe the Bug

PDP smart contracts (e.g. Filecoin Warm Storage Service) use the CommPv2 format for all Piece CID values.

When Curio advertises content from PDP deals to IPNI, it constructs the ContextID as base64(type || cid), where type is one byte set to 0 for Piece retrievals and 1 for IPFS block retrievals.

In the current implementation, the ContextID values are constructed using CommPv1 format:

ContextID (base64-encoded):
AQGB4gOSICB/hhBdaUlS3hBWSJYRu0fkl5oMhAMNR1bQiuwuYOuROg==


Parsed:
  Flag: 1 
  CID: baga6ea4seaqh7bqqlvuusuw6cblerfqrxnd6jf42bscagdkhk3iiv3bomdvzcoq

This makes it challenging to match IPNI provider records against PDP storage deals.

Curio should use CommPv2 CID format instead.

Expected value:

ContextID (base64-encoded):
AQFVkSAljv3jARJ/hhBdaUlS3hBWSJYRu0fkl5oMhAMNR1bQiuwuYOuROg==

Parsed:
  Flag: 1
  CID: bafkzcibfr366gaisp6dbaxljjfjn4ecwjclbdo2h4slzudeeamguovwqrlwc4yhlse5a

Logging Information

n/a

Repo Steps

  1. Store a file using filecoin-pin
  2. (Wait until Curio announces the file to IPNI)
  3. Ask IPNI for retrieval providers for the uploaded file (GET https://cid.contact/cid/{ipfsRootCid}
  4. Check the ContextID value in the response.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions