Skip to content

Pinning a unixfs path doesn't pin the required blocks. #8663

@Jorropo

Description

@Jorropo

Checklist

Installation method

built from source

Version

go-ipfs version: 0.12.0-rc1-8a88718ea
Repo version: 12
System version: amd64/linux
Golang version: go1.17.5

Config

N/A

Description

If you do:

ipfs pin add Qmfoo/a.txt

I belive you are safe to assume that the path Qmfoo/a.txt is always gonna work.
However that not true because what happen in practice is that it resolves Qmfoo/a.txt at pinning time to a.txt's root and pin a's root recursively.
That mean the block (or blocks if that a sharded directory) Qmfoo can be lost, meaning you can never do Qmfoo/a.txt to a's root path anymore.

I belive this should pin a minimal provable traversal from Qmfoo to a's root, including the Qmfoo blocks. In case of Qmfoo/b/a.txt, it would select Qmfoo and Qmfoo/b. And then blew up to recursive pinning until the last path item is reached.

Note this minimal provable then recursive traversal is usefull in many other situations, such as gateways that would serve .car files and clients trustlessly verifying the gateway response (note in this example the gateway could still censor files, but at least not change them).

Altho I've not tested it, I belive very likely that this also applies to other things that resolve the true root and then follow recursively such as ipfs dag export Qmfoo/a.txt (and if ipfs dag export only accepts direct CIDs, I belive minimal provable traversal of paths should be a feature supported).

Reported by:

This has been reported by someone on the IPFS discord which I forgot about (sorry).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium: Good to have, but can wait until someone steps upkind/featureA new feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions