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

Loosen proc-macro2 version selection #1351

Closed
wants to merge 6 commits into from

Conversation

salaheldinsoliman
Copy link

@salaheldinsoliman salaheldinsoliman commented Feb 18, 2024

What

1-Bump and loosen crates proc-macro2 and quote

Why

To solve a dependancy error while building Solang, when adding soroban-env-host to its Cargo.toml:
error: failed to select a version for proc-macro2.
... required by package soroban-builtin-sdk-macros v20.2.2
... which satisfies dependency soroban-builtin-sdk-macros = "=20.2.2" of package soroban-env-host v20.2.2
... which satisfies dependency soroban-env-host = "^20.2.2" of package solang v0.3.3
versions that meet the requirements =1.0.69 are: 1.0.69

all possible versions conflict with previously selected packages.

previously selected package proc-macro2 v1.0.78
... which satisfies dependency proc-macro2 = "^1.0.78" of package parse-display-derive v0.9.0
... which satisfies dependency parse-display-derive = "=0.9.0" of package parse-display v0.9.0
... which satisfies dependency parse-display = "^0.9" of package solang v0.3.3

failed to select a version for proc-macro2 which could resolve this conflict

Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
@salaheldinsoliman salaheldinsoliman requested a review from a team as a code owner February 18, 2024 23:46
@leighmcculloch
Copy link
Member

leighmcculloch commented Feb 19, 2024

Sorry, I think I made a mistake in the previous PR where I commented about the lock file. We need to keep Cargo.lock, and not have it in the gitignore.

While there is a historical recommendation to not commit lock files in Rust libraries, we don't follow it because it is safer for developers working on the library if a lock file is present, otherwise fresh clones of the repo download new versions of crates outside the control of the developer, and for good security, developers should always be in control of what is installed/built/run on their systems.

Could we keep the Cargo.lock file? It shouldn't need modifying as part of this change.

@leighmcculloch leighmcculloch mentioned this pull request Feb 19, 2024
@@ -15,7 +15,7 @@ proc-macro = true
[dependencies]
syn = {version="=2.0.39",features=["full"]}
quote = "=1.0.33"
proc-macro2 = "=1.0.69"
proc-macro2 = "1.0.69"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, this is equivalent as saying >=1.0.69, <2.0.0.

@leighmcculloch leighmcculloch changed the title bump proc-macro2 Loosen proc-macro2 version selection Feb 28, 2024
Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@graydon Wdyt? I think it's pretty tough for these libs to be pinning these deps, which makes it very incompatible with something requiring a newer version by happenstance via another dependency.

Very likely we should make the same changes to syn, quote, and itertools too.

Not merging this until we have more consensus.

Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@graydon Wdyt? I think it's pretty tough for these libs to be pinning these deps, which makes it very incompatible with something requiring a newer version by happenstance via another dependency.

Very likely we should make the same changes to syn, quote, and itertools too.

Not merging this until we have more consensus.

@leighmcculloch
Copy link
Member

@leighmcculloch
Copy link
Member

@salaheldinsoliman
Copy link
Author

salaheldinsoliman commented May 6, 2024

Related internal discussion: https://stellarfoundation.slack.com/archives/C030Z9EHVQE/p1713745643062029

@leighmcculloch Is there a way to have a peek on this discussion, as I don't have access to it?

@leighmcculloch
Copy link
Member

We have some things to nut internally about how different projects depend on dependency consistency.

But I see @dmkozh approved already, so possibly we could merge this now.

@dmkozh Is this mergeable?

@salaheldinsoliman
Copy link
Author

We have some things to nut internally about how different projects depend on dependency consistency.

But I see @dmkozh approved already, so possibly we could merge this now.

@dmkozh Is this mergeable?

I think I should close this, and instead merge #1415 as it bumps both proc-macro2 and quote

@graydon
Copy link
Contributor

graydon commented May 7, 2024

I think we're going to do this (in preference to #1415) but before we do, we'll write a tool that checks that the lockfile on the stellar-core repo is the same (at least on any package in common) with the lockfile in this repo. That ought to address the concern that the two might be testing / releasing different versions. I'll update here when I have such a thing ready.

@leighmcculloch
Copy link
Member

@salaheldinsoliman Since we're going to relax the version requirements rather than pin, did you want to also relax the version requirement of quote in this PR?

@graydon
Copy link
Contributor

graydon commented May 7, 2024

here's an initial sketch of such a tool: https://github.com/graydon/check-lockfile-intersection
output looks like so: https://gist.github.com/graydon/3856f26fe34bb695316f795cf04462c9
I'll work on this more tomorrow, out of time for tonight.

Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
@leighmcculloch
Copy link
Member

👋🏻 What's the status of the check-lockfile-intersection tool?

@leighmcculloch
Copy link
Member

leighmcculloch commented Aug 15, 2024

I'm opening the following change instead that will unpin most of the deps and supersedes this change:

github-merge-queue bot pushed a commit that referenced this pull request Aug 16, 2024
### What
Unpin all non-stellar dependencies.

### Why
We have had reports that the libs are difficult to integrate into other
projects due to the rigid dependency requirements.

We ultimately need the dependencies to be pinned in stellar-core.

There's benefit to the tests in this repo running with the same
dependencies as what core pins to.

There's benefits to stellar-rpc also using the same dependencies so as
to decrease the chance that simulation runs with different behavior.
Also, the same applies to the SDK for test behavior.

Pinning the deps were an easy way to keep the dependencies consistent
everywhere, but it also makes it difficult for folks to use the env
libraries.

Close #1351

### Other things that need to happen

@graydon is making a tool to check that Cargo.lock files are using
consistent versions where possible across the env repo, core repo, and
we can also use that in the rpc repo. It won't be practical to expect
contract devs to use it on their contract projects, so contract devs
will be able to use whatever combination of dependencies and that's just
a limitation.

### Why not

We could say again that not doing this has greater benefits than
allowing folks to more easily use the libraries in their own projects.
leighmcculloch added a commit that referenced this pull request Aug 20, 2024
### What
Unpin all non-stellar dependencies.

### Why
We have had reports that the libs are difficult to integrate into other
projects due to the rigid dependency requirements.

We ultimately need the dependencies to be pinned in stellar-core.

There's benefit to the tests in this repo running with the same
dependencies as what core pins to.

There's benefits to stellar-rpc also using the same dependencies so as
to decrease the chance that simulation runs with different behavior.
Also, the same applies to the SDK for test behavior.

Pinning the deps were an easy way to keep the dependencies consistent
everywhere, but it also makes it difficult for folks to use the env
libraries.

Close #1351

### Other things that need to happen

@graydon is making a tool to check that Cargo.lock files are using
consistent versions where possible across the env repo, core repo, and
we can also use that in the rpc repo. It won't be practical to expect
contract devs to use it on their contract projects, so contract devs
will be able to use whatever combination of dependencies and that's just
a limitation.

### Why not

We could say again that not doing this has greater benefits than
allowing folks to more easily use the libraries in their own projects.

(cherry picked from commit a54d997)
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

Successfully merging this pull request may close these issues.

None yet

4 participants