-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Checklist
- This is a bug report, not a question. Ask questions on discuss.ipfs.io.
- I have searched on the issue tracker for my bug.
- I am running the latest go-ipfs version or have an issue updating.
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/ADescription
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).