Skip to content

Bug: pieceStatus confuses piece ownershipΒ #296

@rvagg

Description

@rvagg

If I run StorageContext#pieceStatus(cid) for a piece that I don't own but on a data set with a storage provider that happens to have the piece, then it operates as if it's in that data set.

This comes from the use of findPiece in the wrong place. findPiece can only tell us if the provider has the piece, in fact, it's only good uses are for (1) checking before upload whether we need to bother uploading (if they have it, no need to re-upload), and (2) for retrieval, to ping them to see if they have it, but even in this case we could just do a HEAD /piece/bagafoo.. and find out that way, in fact that works for either case too.

The use of findPiece as an exists check is wrong.

I think this argues for the data-from-chain thing I was discussing in #249 (comment), we should ask the SP for as little as possible, that should be on chain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🐱 Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions