Skip to content

Test with minimal dependency versions#1764

Merged
apoelstra merged 2 commits intorust-bitcoin:masterfrom
tcharding:03-30-commit-lock-files
May 3, 2023
Merged

Test with minimal dependency versions#1764
apoelstra merged 2 commits intorust-bitcoin:masterfrom
tcharding:03-30-commit-lock-files

Conversation

@tcharding
Copy link
Copy Markdown
Member

@tcharding tcharding commented Mar 29, 2023

This is work originally done by Kixunil in #1272, I picked it up to help out. The only changes I made were rebasingg, updating the recent lock file, adding --locked to hashes contrib file, and adding a co-developed-by tag for accountability.

It could happen that we unknowingly depend on a new version of a crate without updating Cargo.toml. This could cause resolution issues for downstream users. It's also unclear for outsiders to know with which dependencies did we test the crate.

This change commits two lock files: minimal and recent. minimal contains minimal dependency versions, while recent contains dependency versions at the time of making the change.

Further, this adds CI jobs to test with both lock files, CI job for internals crate, removes old serde pinning and prints a warning if recent is no longer up to date. (We may have to override it somehow if any crate breaks MSRV.)

The documentation is also updated accordingly.

Closes #1230

@tcharding tcharding force-pushed the 03-30-commit-lock-files branch 3 times, most recently from 561d424 to cff6c38 Compare March 30, 2023 22:11
@tcharding tcharding marked this pull request as draft March 31, 2023 00:35
apoelstra added a commit that referenced this pull request Apr 19, 2023
6c61e10 Fix pinning (schemars and MSRV) (Tobin C. Harding)
c8e38d6 hashes: Implement JsonSchema for sha256t::Hash<T> (Tobin C. Harding)

Pull request description:

  This has grown due to now including pinning work also done in #1736, I decided to do this because the PRs conflict and doing it all here saves accidentally getting out of sync. And  #1764 requires this PR.

  - Patch 1 is unchanged
  - Patch 2 now fixes pinning in bitcoin and hashes CI scripts and in the docs of both as well as the manifest stuff relating to `schemars` - phew.

  Fix: #1687

ACKs for top commit:
  Kixunil:
    ACK 6c61e10
  apoelstra:
    ACK 6c61e10

Tree-SHA512: eae4aa9700817bab6ad444e07709e8b1a4ffb1625e08be6ba399abde38bf6f8e5ea216a0836e2e26dfaddc76c392802cd016738ea6e753a1bca2584d9d2a9796
@tcharding tcharding force-pushed the 03-30-commit-lock-files branch 2 times, most recently from d3399e0 to 5a6332d Compare April 19, 2023 23:46
@tcharding tcharding marked this pull request as ready for review April 19, 2023 23:46
apoelstra
apoelstra previously approved these changes Apr 20, 2023
Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 5a6332d5dfd4733dd0390e26de88d81c69772e99

@apoelstra
Copy link
Copy Markdown
Member

In my local scripts, I have a comment that says "no-std does not work on 1.48" and I test with 1.50 instead. @tcharding that may be what you need to do here.

@tcharding
Copy link
Copy Markdown
Member Author

I don't understand why this is showing up in this PR? If we cannot build "no-std" with 1.48 why is CI ok for current master?

@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented Apr 20, 2023

I think this is caused by old core2? We should probably bump its version. (IDK to which number)

@apoelstra
Copy link
Copy Markdown
Member

Neat. Apparently core2 0.3.2 works. I guess we need to set our minimal version to that.

@tcharding
Copy link
Copy Markdown
Member Author

Changes in force push

  • Added a patch to the front of the PR to set core2 dependency to 0.3.2
  • Updated the Cargo-minimal.lock file after building with the new core2 dependency

@tcharding tcharding mentioned this pull request Apr 20, 2023
@tcharding tcharding added the P-high High priority label Apr 21, 2023
@tcharding
Copy link
Copy Markdown
Member Author

This is blocking hex crate work.

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK c129eb6d0016ddf110c9ed72300eee53a7ca769d

@stevenroose
Copy link
Copy Markdown
Collaborator

I haven't followed the details of this MR, but would it be hard to have support for this in the github CI matrix thing? So specify different versions to test for certain deps and then use update --precise for those in the CI script?

I'm asking because in dependent crates it'd be nice to have easy access to ways to support multiple rust-bitcoin versions as well.

Ofc this would be a great tool for the rust ecosystem as a whole, but as we know I don't think many other projects care enough about msrv and dep mgmt that this kind of thing would already exist in the CI tooling.

contrib/test.sh Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this like a format that GitHub CI will pick up and somehow make visible?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is some github syntax that gives color in their logs, @Kixunil found it but I didn't look up the docs when he told me about it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

IIRC it's visible when you open the lock file from the PR. It was long time since I looked into it.

stevenroose
stevenroose previously approved these changes Apr 24, 2023
Copy link
Copy Markdown
Collaborator

@stevenroose stevenroose left a comment

Choose a reason for hiding this comment

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

utACK e6dc6f48da7e79a3c2a188ad69ef8a9d8d799ad7

@apoelstra
Copy link
Copy Markdown
Member

Would like an ack from @Kixunil as well since this is based on his work.

@stevenroose yeah, I think this would be generally useful. This PR does introduce CI support for this (in contrib/test.sh) though in a little bit of a hacky way. I think we should merge this and then see what kind of problems we run into before cleaning it up and maybe trying to do a more general thing. I am curious what kind of support you'd like for downstream crates....I guess, ideally your downstream projects could "merge" these lockfiles from rust-bitcoin into their own. I'm not sure if there's any tool that can do that.

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

Needs rebase after #1732 since the included lockfiles now need to include honggfuzz.

BTW in #1732 I set the wrong honggfuzz version. It is at 0.5 but it needs to be 0.5.55 (or possibly lower....but certainly 0.5.0 is too low).

Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

Looks reasonable, will wait until rebase with proper review. Unfortunately despite having more time I find it harder to get myself into reviewing large PRs. (Yes Tobin, it could be WOE-related, still debugging.)

contrib/test.sh Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

IIRC it's visible when you open the lock file from the PR. It was long time since I looked into it.

@tcharding
Copy link
Copy Markdown
Member Author

(Yes Tobin, it could be WOE-related, still debugging.)

What does WOE mean, Way Of Eating?

`core2` versions 0.3.0 and 0.3.1 do not work with Rust 1.48.0, set
minimum version to 0.3.2 in the `bitcoin` manifest.
@tcharding
Copy link
Copy Markdown
Member Author

tcharding commented May 1, 2023

I couldn't get a minimal honggfuzz dep because where ever I put --locked running ./fuzz.sh still updated the lock file. Does the Cargo-minimal.lock file have to commit to a minimal dependency version for honggfuzz?

@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented May 1, 2023

Does the Cargo-minimal.lock file have to commit to a minimal dependency version for honggfuzz?

Probably, but I'm not sure if we need to test with minimal dev dependencies.

@apoelstra
Copy link
Copy Markdown
Member

@tcharding I have had no problem with a minimal version of 0.5.55.

@tcharding tcharding requested review from Kixunil and apoelstra May 1, 2023 21:42
@apoelstra
Copy link
Copy Markdown
Member

Note that #1821 actually changes fuzz/Cargo.toml to have the correct minimal honggfuzz reason. So I think it's fine that this PR merely includes it in the Cargo.lock.

@tcharding
Copy link
Copy Markdown
Member Author

Note that #1821 actually changes fuzz/Cargo.toml to have the correct minimal honggfuzz reason. So I think it's fine that this PR merely includes it in the Cargo.lock.

Yep, sweet. I think you are right, we can merge these in any order.

Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

Looks like there's a bug, the rest should be fine.

contrib/test.sh Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

$deps is not defined.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

face palm, thanks man. I added DEPS="recent minimal", and put quotes around $dep everywhere as suggested by shellcheck.

It could happen that we unknowingly depend on a new version of a crate
without updating `Cargo.toml`. This could cause resolution issues for
downstream users. It's also unclear for outsiders to see which
dependencies we tested the crate with.

This change commits two lock files: `minimal` and `recent`. `minimal`
contains minimal depdendency versions, while `recent` contains
dependency versions at the time of making the change.

Further, this adds CI jobs to test with both lock files, CI job for
`internals` crate, removes old `serde` pinning and prints a warning if
`recent` is no longer up to date. (We may have to override it somehow if
any crate breaks MSRV.)

The documentation is also updated accordingly.

Co-developed-by: Tobin C. Harding <me@tobin.cc>

Closes rust-bitcoin#1230
@tcharding tcharding force-pushed the 03-30-commit-lock-files branch from 485dcc5 to c4c64c0 Compare May 2, 2023 22:08
@tcharding tcharding requested a review from Kixunil May 2, 2023 22:09
Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK c4c64c0

Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

ACK c4c64c0

@apoelstra apoelstra merged commit 23d80bf into rust-bitcoin:master May 3, 2023
@tcharding tcharding deleted the 03-30-commit-lock-files branch May 4, 2023 22:06
DanGould added a commit to payjoin/rust-payjoin that referenced this pull request Sep 19, 2024
This replaces manual pins in the README and CI workflow.

Close #337 
based on rust-bitcoin/rust-bitcoin#1764
node-smithxby72w added a commit to node-smithxby72w/rust-payjoin that referenced this pull request Sep 28, 2025
This replaces manual pins in the README and CI workflow.

Close #337 
based on rust-bitcoin/rust-bitcoin#1764
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P-high High priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cargo.lock strategy

4 participants