Skip to content
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

Fixed blst version #46

Closed
aakoshh opened this issue Aug 19, 2022 · 10 comments
Closed

Fixed blst version #46

aakoshh opened this issue Aug 19, 2022 · 10 comments

Comments

@aakoshh
Copy link

aakoshh commented Aug 19, 2022

The version of the blst dependency is always fixed to exactly match a specific version, like here.

Is that a true requirement, or was the = left in by accident? It makes it difficult to use libraries built on this one with something else that requires a higher patch version. For example v0.5.0 wants =0.3.9, but another dependency I have wants 0.3.10 of blst. If blstrs was happy with 0.3.9 without = the cargo should be able to pick the higher version.

@dignifiedquire
Copy link
Contributor

this is on purpose, as blst releases sometimes contain breaking changes in patch releases and we have been burnt by this before

@aakoshh
Copy link
Author

aakoshh commented Aug 20, 2022

Thanks. Then I guess I will have to fork this or that dependency and try to patch it. It might work but it's a bit of a maintenance nightmare, and I can miss crucial updates.

Perhaps, since v0.6.0 depends on =0.3.10, it would be possible to also release a newer version v0.5.1 that allows a range you are comfortable with, say, between 0.3.9-0.3.10, so anything that depends on 0.5.0 can be safely upgraded to 0.5.1 and allow cargo to resolve the dependency hell?

@aakoshh
Copy link
Author

aakoshh commented Aug 23, 2022

I forked the projects and made new branches to try until I found a combo that worked (with my current dependencies at least).

I would open PRs but there are no 0.4.x and 0.5.x branches to open them against:

And similarly in bls-signatures:

For me it looks like blstrs:v0.4.3 with bls-signatures:v0.11.4 works against a dependency that needs blst:0.3.10

@vmx
Copy link
Contributor

vmx commented Aug 23, 2022

@aakoshh sorry, I forgot to open filecoin-project/bls-signatures#55. With this PR you should be able to update everything to their latest versions.

@aakoshh
Copy link
Author

aakoshh commented Aug 23, 2022

Thanks @vmx! I checked and at least one more domino that I see you kindly maintain is bellperson, which still depends on blstrs 0.5.0

@aakoshh
Copy link
Author

aakoshh commented Aug 23, 2022

And probably the filecoin-proofs-api as well.

This is the chain I get when I tried to upgrade Forest from 11.0 to 12.0 (which I don't know if it's safe to do as it's a major version change):

error: failed to select a version for `blst`.
    ... required by package `blstrs v0.5.0`
    ... which satisfies dependency `blstrs = "^0.5.0"` of package `bellperson v0.22.0`
    ... which satisfies dependency `bellperson = "^0.22"` of package `filecoin-proofs-api v12.0.0`
    ... which satisfies dependency `filecoin-proofs-api = "^12.0"` of package `forest_fil_types v0.2.2 (/home/aakoshh/projects/consensuslab/forest/types)`
    ... which satisfies dependency `forest_fil_types = "^0.2"` (locked to 0.2.2) of package `forest v0.2.2 (/home/aakoshh/projects/consensuslab/forest/forest)`
versions that meet the requirements `=0.3.9` are: 0.3.9

I can't just patch blstrs and bls-signatures to their latest because cargo can't upgrades something from depending on 0.4 to 0.6 as they are not compatible 🤷

@vmx
Copy link
Contributor

vmx commented Aug 23, 2022

@aakoshh do you need to upgrade to the latest blstrs version? If not, I'd suggest to stay on 0.5.0 for now. Updating the whole dependency chain is a WIP and it will take a while.

@aakoshh
Copy link
Author

aakoshh commented Aug 23, 2022

In my case I couldn't use blstrs 0.5.0 because it required =0.3.9 of blst and something I also wanted to use wanted ^0.3.10. I could have used 0.6.0 but like you said it's a whole dependency chain, and I am unable to use the [patch.crates-io] mechanism to force a dependency like bellperson to go from 0.5.0 to 0.6.0.

Instead what I did was to go back to the earliest blstrs version, which is 0.4.0 required by filecoin-proofs-api 11.0 in use and relax the constraint there to allow 0.3.10, thinking that if blstrs 0.6.0 is happy with it, then it must be all right. And I can use [patch.crates-io] to upgrade 0.4.x to 0.4.3. This is the lightest touch that allows me to do what I need as I'm not a Forest core dev, so I don't want to go updating all kinds of dependencies for them.

But I do wonder if these =0.3.9 style constraints would be better pushed to the applications' root Cargo.toml files rather than in base libraries. I'm also not sure why libraries are not more permissive and just depend on 0.3, allowing any patch version, trusting that the application developer will want to use the newest they can get their hands on with cargo update, or the newest they trust, or the newest another more cautious library like yours allows them to do.

Anyway, I'm unblocked now, although probably this will happen again and again.

@vmx
Copy link
Contributor

vmx commented Aug 23, 2022

Thanks for the explanation! At least it's good to hear that the upgrade to blst 0.3.10 might be worth it, as it sounds like you'll need it. I already though that it would've been better if I wouldn't have upgraded it.

Though usually, things should work out, which is the reason I do breaking releases. Usually all Filecoin related dependencies are taken care of and should end up with the same blst version (once all releases are done). Until then old versions should be used. Though I see how this is a problem that you cannot easily [patch] things, that's really sometimes a pain.

@vmx
Copy link
Contributor

vmx commented Apr 14, 2023

All dependencies should be on blst v0.3.10 by now. I think it is no longer an issue. If it is, please re-open.

@vmx vmx closed this as completed Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants