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

fix(bindings): Specify correct minimum versions #5028

Merged
merged 7 commits into from
Jan 16, 2025

Conversation

goatgoose
Copy link
Contributor

@goatgoose goatgoose commented Jan 13, 2025

Description of changes:

There are currently dependency versions in the s2n-tls rust bindings that are specified as acceptable but are impossible to actually use. For example, we specify "1" as an acceptable aws-lc-rs version, but versions before 1.6.4 result in a build failure. This PR updates these dependency versions to the correct minimum versions

This issue was discovered when adding s2n-tls as a dependency of smithy-rs. smithy-rs has a test which tries to build their crates with the minimum versions of all dependencies, which breaks for s2n-tls. I added a similar test to our CI.

Call-outs:

In our test, I added the --direct flag, which uses the direct-minimal-versions variant to only use minimum versions of direct dependencies rather than all transitive dependencies. This is because I'm not sure what we would do about a transitive dependency that failed to properly specify a minimum version, so it didn't seem right to block CI on this. The Rust documentation also doesn't recommend the transitive variant for this reason.

However, smithy-rs doesn't specify the --direct flag in their test, which is how this issue was observed when adding s2n-tls as a dependency. Should we be checking minimal versions in all transitive dependencies too?

Testing:

Tested via the new minimal-versions job in CI.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added the s2n-core team label Jan 13, 2025
@goatgoose goatgoose force-pushed the minimal-versions branch 2 times, most recently from 9225d39 to b2ccb43 Compare January 13, 2025 19:29
@@ -36,8 +36,8 @@ stacktrace = []
# unstable-foo = []

[dependencies]
aws-lc-rs = { version = "1" }
libc = "0.2"
aws-lc-rs = { version = "1.6.4" }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

aws-lc-rs = { version = "1" }
libc = "0.2"
aws-lc-rs = { version = "1.6.4" }
libc = "0.2.121"
Copy link
Contributor Author

@goatgoose goatgoose Jan 13, 2025

Choose a reason for hiding this comment

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

libc 0.2.121 is needed because aws-lc-sys versions before 0.24.0 required libc 0.2.121. aws-lc-sys 0.24.0 removed the libc dependency, so libc 0.2.62 should be acceptable for aws-lc-sys >= 0.24.0. However, I'm not aware of a way to specify a different minimum version depending on the version of another dependency in a build.

We could alternatively specify a higher minimum version for aws-lc-rs, so that aws-lc-sys doesn't specify any libc requirement.

@@ -2,6 +2,7 @@
name = "bench"
version = "0.1.0"
edition = "2021"
publish = false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

publish was set to false in bench so that the --ignore-private flag would skip minimum version checks for it.

hyper = { version = "1" }
hyper-util = { version = "0.1", features = ["client-legacy", "tokio", "http1", "http2"] }
hyper = { version = "1.4" }
hyper-util = { version = "0.1.4", features = ["client-legacy", "tokio", "http1", "http2"] }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hyper-util 0.1.4 is needed because we rely on Connection being implemented for TokioIo, which was implemented in 0.1.4.

@goatgoose goatgoose marked this pull request as ready for review January 13, 2025 20:44
Copy link
Contributor

@jmayclin jmayclin left a comment

Choose a reason for hiding this comment

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

Cool test!

All of the comments you added to this PR are super useful. I'm slightly skewing towards adding them to the codebase. Any thoughts on that?

Comment on lines 17 to 18
# A minimum hyper version of 1.3 is required by hyper-util 0.1.4.
hyper = { version = "1.3" }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@goatgoose goatgoose requested a review from lrstewart January 15, 2025 21:34
Copy link
Contributor

@lrstewart lrstewart left a comment

Choose a reason for hiding this comment

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

I agree with James: I think a one-line explanation for some/all of these minimums like you have in your comments will help future devs.

@goatgoose
Copy link
Contributor Author

I added a bit more detail to the inline comments, let me know if they can be improved more!

@goatgoose goatgoose requested a review from lrstewart January 15, 2025 23:05
@goatgoose goatgoose enabled auto-merge January 15, 2025 23:09
@goatgoose goatgoose added this pull request to the merge queue Jan 15, 2025
Merged via the queue into aws:main with commit 6fbe506 Jan 16, 2025
44 checks passed
@goatgoose goatgoose deleted the minimal-versions branch January 16, 2025 00:14
johubertj pushed a commit to johubertj/s2n-tls that referenced this pull request Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants