-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to validate CID matches block #123
Comments
Thinking about this more, what would be really nice is a wrapper, that could either live in js-multiformats or in its own package, that did this verification regardless of underlying source of blocks. Then we'd be forced to standardise on a basic blockstore interface. You'd load up all your supported hashers into this wrapper, then plug in the backing blockstore, and then have all your blocks validated on the way out. You could even use it to come up with alternative strategies for various edge cases - like what to do if you don't have a hasher for a given CID, perhaps you don't error but shunt it onto an alternative call that collects them for sending a warning to the user. I'm hesitant to try and shove this into js-car because of the hasher complexities, unless we can come up with a neat and somewhat generic solution we can reuse anywhere there's a source of blocks. The approach we've taken in Go is to always validate blocks but you can turn on a /cc @alanshaw @hugomrdias |
I like it 😀, but it seems more like a plugin no? Car reader implements that interface and optionally runs plugins available while streaming blocks. Or are you thinking more wrapper takes implementations of interface and runs logic? After reading this again looks more like the second. Either way basic blockstore interface is a win for everyone. /Cc @achingbrain |
🤷 we don't have consistent blockstore interfaces across the ipld libraries .. I prefer the wrapper style but it may not make sense for the various pieces we'd want to use it on |
I have wrote up proposal to introduce That way it would use safe defaults as opposed to requiring extra steps to ensure safety. |
Of course this requires having the right hashers available to do the validation, which might be a problem.
Ref: #121 (comment)
The text was updated successfully, but these errors were encountered: