codex-storage / nim-codex

Decentralized Durability Engine
https://codex.storage
Apache License 2.0
69 stars 25 forks source link

[BUG] Check: Requesting storage for already-encoded CID #1005

Open benbierens opened 2 days ago

benbierens commented 2 days ago

When I request storage for a basic (unprotected) CID:

What is the expected flow when I request storage for an already-encoded (protected) CID? Should it be double-encoded? Should it be used as-is? What if the new EC params are different? Should it be decoded and re-encoded?

Quick look at current implementation: double-encoding.

gmega commented 2 days ago

I don't think I see a use case where it'd make sense to request storage for an already-encoded CID, unless you're trying to "renew" an old storage request or extend a current one, in which case I'd argue you should not be allowed to change EC parameters, or any parameters, and should probably have a way to communicate via API that this is what you want to do (renew/extend).

benbierens commented 2 days ago

I'm convinced the root of this issue is: our current API call to request storage is in fact encode-this-dataset-and-request-storage. If we had a call to encode/decode separately, and we could request storage separately (returning an error when called on unencoded datasets) then there would be no problem.

dryajov commented 2 days ago

This isn't going to be a problem once encryption is added, every persistent dataset will be unique.