-
Notifications
You must be signed in to change notification settings - Fork 59
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
Merging work from yatima-inc/sp-multihash #144
Comments
A small (ish) note for part 1: |
(writing my opinions on this here so they're public)
|
|
Yep, that's what I was thinking. |
Okay, it's sounding like we should focus on sending PRs for ByteCursor and Nix, and waiting on
To clarify the double negative, you mean we should depend on sp-std or we should not, and use core, alloc, etc directly instead?
Doing the |
I mean we can depend on it. I'd slightly prefer to depend on core/alloc directly, but I'm not familiar enough with the ergonomics of either to make a call. My only real concern here is not forcing downstream crates from using sp_std. But far as I can tell, they can choose to depend on std/core/alloc directly and simply ignore the fact that this crate uses sp, right? |
@johnchandlerburnham first of all. Thanks for opening this issue. I'm currently the maintainer of the library, though sadly spent too little time on it. Last year I've spent a lot of time consolidating existing (forked) rust-multihash implementations into a single one. The reason is, that for me this is the core of open source. Trying to collaborate where possible and building things together. This means I'd like to keep forking to a minimum where possible. So I'm happy to work together on this. Luckily others already jumped in on this issue, so i sounds like we already have a good plan (thanks @mriise and @Stebalien). I don't know if it's possible, but perhaps we can port as many things as possible to rust-multihash (which will depend in Rust stable) and sp-multihash is an API compatible (where possible) drop-in replacement that is using const generics and need Rust nightly.
This depends on the upstream users. When I merged the available forks and the API changed a lot, I tried hard to get agreement from the biggest upstream users I know of (back then /~https://github.com/libp2p/rust-libp2p/ and /~https://github.com/ChainSafe/forest/) that they will be OK to upgrade to that version, so that I don't end up with new forks. |
Looking at both forest and rust libp2p, both of them seem to be using fixed sized CIDs anyways. |
@johnchandlerburnham have you considered making |
I think it might be good to use an implementation already made for using read/write in no_std enviornments this one seems goood and has const generic support |
I wonder what other projects are using. Neither of those crates seems to have that many users (although core2 looks like it might have a future), and they're both pretty "heavy" (likely high maintenance). I'm also seeing https://crates.io/crates/byteio as a more general bytecursor, but it's still not as general as the core io traits. |
Hi all, I'm the co-author of the sp-multihash fork. I agree with the above concerns over adding the bytecursor dependency, since the ideal solution would be a drop-in replacement that implements The |
@johnchandlerburnham @samuelburnham just curious since I haven't actually needed to use Write for anything, what is the the driving force behind this effort? |
Read/Write traits allow serializing/deserializing to/from a stream (or byte buffer) without additional allocations. That's the main point, at least. |
@samuelburnham that approach looks nice and clean. In the future, we could look into depending directly on core2 (it provides an std shim) but making it optional is probably the better choice for now. |
@mriise the main use case for Write in Yatima is to serialize language terms and definitions via DAG-CBOR or other codec, and then storing this data on IPFS for reproducible programming. The encoding process in libipld uses Write, so it would be nice to be able to use that when we generate Cids for definitions, as seen here:
This all has to be done in |
@Stebalien thanks! I was running into some error conversion issues with depending on core2 directly, but I agree probably better as a next step effort. |
@samuelburnham I think with the 0.16 release we have incorporated everything from your work on sp-multihash. If something is missing, please open an issue or re-open this one. |
Hi, I talked briefly to @Stebalien about merging some of the work from our /~https://github.com/yatima-inc/sp-multihash no_std fork. Happy to send PRs, but wanted to ask a few questions first:
sp-multihash
is on rust 1.54-nightly, so we were able to adapt @mriise's excellent const generics #116. It looks like you guys are waiting on 🔬 Tracking issue for generic associated types (GAT) rust-lang/rust#44265 hitting stable Rust first before merging const generics #116. To me, the usability regression reported in this comment seems acceptable compared to the usability gains from not having to drag typenums around everywhere. Plus,const-generics
also opens up some really exciting refactoring possiblities, like @Stebalien's neat idea for using DSTs to erase the size-info here: Unsized Cids argumentcomputer/sp-cid#5. Since waiting some weeks/months for stable GATs seems not ideal, I'm wondering if we can figure out some way around this:rust-multihash
branch/release so that development here isn't impacted by rustc as much?const-generics
?no_std
work removesstd::io
functions for reading/writing in favor of our bytecursor library. This can be added independently of Const-Generics.sp-std
?std::io
, functions gated behind thestd
feature via pragmas? If so, shouldstd
still be default?sp-multihash
, and can PR (independently of the above) to add one here (preview: /~https://github.com/yatima-inc/rust-multihash/pull/1/files), if that's of interest.The text was updated successfully, but these errors were encountered: