Hi, I ran into a weird problem. I am using ipfs-lite in a distributed database project. The nodes in the ipfs network are using ipfs-lite to store and fetch json data structures. Each cluster is isolated in a private libp2p network using a PSK. A MongoDB collection is used as key-value storage.
Things are generally working very smoothly, but recently I noticed a newly spun node is not picking up data from the ipfs network (and it is supposed to replicate whatever the network has). After a week of digging, I found out that some dags are stored without the /blocks prefix, so instead of
/blocks/CIQDACE5RYSBN36AFODMQM6JQ7EITZ3GXYC32H5CVR2IM562R3WVTYY
I am finding
/CIQDACE5RYSBN36AFODMQM6JQ7EITZ3GXYC32H5CVR2IM562R3WVTYY
Otherwise, the dag data is ok.
The whole problem seems to originate from a while back (anywhere between 2 and 12 months ago). I only ran into it because accidentally many nodes in one of my networks died, and this was the only node left standing. So this node became an accidental "source of truth" for all content. And the content was there, however ipfs-lite was not able to load it because of the malformed keys. And it was also not able to fetch it via bitswap because no other nodes with content existed at the time. Working in a private libp2p network seems to be quite dangerous in this regard.
To confirm the bug, I checked out nodes on the other networks I have running, and indeed all the older nodes have a number of these malformed keys. Some have a set of correct keys, then a set of malformed keys, then again a set of normal keys. Since I was upgrading and fixing the executable over time, my theory is that at some point my executables were writing dags with faulty keys, and the behavior stopped after an update. But I have no way of knowing exactly when any of this happened.
My question is - would you happen to have any idea on why the keys were malformed? I see that ipfs-lite is actually not implementing dag.Get() and dag.Put() method, and is instead using the default implementation. So whatever happened must have been in a related package, not in ipfs-lite as such. But you're my best starting point :)
I am fully aware the problem is complex and not easy to explain, so if you need any further info, I'll be more than happy to provide it. Thank you in advance.