Skip to content

BUG: Does not work with no_std under 1.29 (MSRV)#690

Merged
apoelstra merged 1 commit intorust-bitcoin:masterfrom
mcroad:master
Apr 30, 2022
Merged

BUG: Does not work with no_std under 1.29 (MSRV)#690
apoelstra merged 1 commit intorust-bitcoin:masterfrom
mcroad:master

Conversation

@mcroad
Copy link
Copy Markdown
Contributor

@mcroad mcroad commented Nov 6, 2021

rust-bitcoin does not work with rust 1.29 under a no_std environment. This could be considered a bug. However, no_std support is a recent addition and this is likely not breaking anyone's builds.

A decision needs to be made, either no_std MSRV is the current stable version while keeping the std MSRV as 1.29, or it needs to be fixed.

This pr adds no_std to the 1.29 test suite.

This came as I try to get rust-bitcoin/rust-miniscript#277 working and got stuck on the issue of testing no_std under 1.29.

@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented Nov 8, 2021

I believe it's intentional as no_std is generally not well-supportd in old versions of Rust. But indeed, it does conflict with:

This library should always compile with any combination of features on Rust 1.29.

In README.md

mcroad added a commit to mcroad/rust-miniscript that referenced this pull request Nov 12, 2021
@Kixunil Kixunil added the waiting for author This can only progress if the author responds to a request. label Dec 2, 2021
@mcroad mcroad changed the title Add test with no_std under 1.29 BUG: Does not work with no_std under 1.29 (MSRV) Dec 16, 2021
@mcroad
Copy link
Copy Markdown
Contributor Author

mcroad commented Dec 16, 2021

@Kixunil Maybe my first report was not clear enough. As it stands, rust-bitcoin is broken because it does not compile under Rust 1.29 with no_std enabled.

My suggestion to fix it is to maintain 2 different MSRVs: 1.29 for std and the current stable version (1.57) for no_std.

@Kixunil Kixunil removed the waiting for author This can only progress if the author responds to a request. label Dec 16, 2021
@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented Dec 16, 2021

As it stands, rust-bitcoin is broken because it does not compile under Rust 1.29 with no_std enabled.

That's exactly what I said. However it also may be that the documentation is outdated and it was intended to be an exception.

My suggestion to fix it is to maintain 2 different MSRVs: 1.29 for std and the current stable version (1.57) for no_std.

I agree. However we plan to switch to 1.36 after the Taproot release. Maybe it'll be enough? Could you check?

@apoelstra what do you think about an exception from MSRV for no_std stuff?

@mcroad
Copy link
Copy Markdown
Contributor Author

mcroad commented Dec 16, 2021

https://github.com/mcroad/rust-bitcoin/runs/4553927944

Still broken under Rust 1.36.

@TheBlueMatt
Copy link
Copy Markdown
Member

rust-lightning's no-std MSRV is 1.47. It would be nice if rust-bitcoin could match that (that is also core2's MSRV).

@apoelstra
Copy link
Copy Markdown
Member

Oops, yes, we should have an exception. I didn't realize there wasn't already one. (I'm sure if you read the initial no_std PRs you will find some agreement on this.)

Targeting 1.47 sounds good to me. I believe the current situation is "no MSRV for nostd" which isn't great.

@mcroad
Copy link
Copy Markdown
Contributor Author

mcroad commented Dec 23, 2021

All tests pass under 1.47. PR is ready to be merged.

https://github.com/mcroad/rust-bitcoin/runs/4613143768?check_suite_focus=true

While I have your attention: any idea when a new version will be released? I am waiting on #637 to be relased to finalize rust-bitcoin/rust-miniscript#277.

Thanks for the input everyone.

@apoelstra
Copy link
Copy Markdown
Member

@mcroad we'll have a release once #503 is done

@mcroad
Copy link
Copy Markdown
Contributor Author

mcroad commented Feb 8, 2022

Can this PR be merged to formalize 1.47 as the no-std MSRV?

@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented Feb 8, 2022

I think it's appropriate. Doesn't fundamentally change the code so no problem for RC.

@apoelstra
Copy link
Copy Markdown
Member

@mcroad the overall diff looks great. Can you squash all the commits, or otherwise clean them up?

@mcroad
Copy link
Copy Markdown
Contributor Author

mcroad commented Feb 11, 2022

Cleaned up commit history. PR is ready.

Kixunil
Kixunil previously approved these changes Feb 11, 2022
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 4588f5bc8ab628961d1e019ff93100d11523a184

@mcroad
Copy link
Copy Markdown
Contributor Author

mcroad commented Feb 24, 2022

Is there anything else I need to do on my end to get the PR merged?

@apoelstra
Copy link
Copy Markdown
Member

It looks like CI is failing -- it looks like #590 broke the 1.47 MSRV.

I guess we should just merge this and fix the MSRV in a separate PR.

apoelstra
apoelstra previously approved these changes Feb 24, 2022
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 4588f5bc8ab628961d1e019ff93100d11523a184

@tcharding
Copy link
Copy Markdown
Member

tcharding commented Feb 28, 2022

If you decide to remove the trailing whitespace @mcroad perhaps rebase on master at the same time and see if it fixes the CI fail?

@mcroad mcroad dismissed stale reviews from apoelstra and Kixunil via 7890e76 April 9, 2022 03:04
@tcharding
Copy link
Copy Markdown
Member

Thanks for your patience @mcroad, this still has PIN_VERSIONS env var being set in the CI job, can you remove that please as the variable is longer used now it got removed from test.sh in #964. Cheers

@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented Apr 25, 2022

Unneeded PIN_VERSIONS var is the only issue I can see.

@Kixunil Kixunil added this to the 0.29.0 milestone Apr 25, 2022
@mcroad
Copy link
Copy Markdown
Contributor Author

mcroad commented Apr 25, 2022

Fixed PIN_VERSIONS issue.

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 7854bd7

@Kixunil Kixunil added the one ack PRs that have one ACK, so one more can progress them label Apr 25, 2022
@Kixunil Kixunil requested review from apoelstra and tcharding April 25, 2022 19:28
Copy link
Copy Markdown
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

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

ACK 7854bd7


## Minimum Supported Rust Version (MSRV)

This library should always compile with any combination of features on **Rust 1.29**.
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.

We forgot to update other references to 1.29 but let's do it in a followup PR.

Copy link
Copy Markdown
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

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

ACK 7854bd7

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 7854bd7

Thanks for doing so many iterations!

@apoelstra apoelstra closed this in 7854bd7 Apr 30, 2022
@apoelstra apoelstra merged commit ff6dc61 into rust-bitcoin:master Apr 30, 2022
@devrandom
Copy link
Copy Markdown
Contributor

would be nice for this to be included in a point release (0.28.1), so that dependent projects can upgrade to the 0.28 API ASAP

@apoelstra
Copy link
Copy Markdown
Member

Sure, though we'll need to do a backport already.

tcharding pushed a commit to tcharding/rust-bitcoin that referenced this pull request May 3, 2022
@apoelstra
Copy link
Copy Markdown
Member

#986

apoelstra added a commit that referenced this pull request May 4, 2022
e45f6c7 bump version to 0.28.1 (Andrew Poelstra)
eaaa3d0 [backport] Fix `no_std` MSRV (mcroad)

Pull request description:

  Backport of #690 to 0.28

ACKs for top commit:
  tcharding:
    ACK e45f6c7

Tree-SHA512: 5e1459b83044acb2a628e612a45f5be5b05067429fcc7b4c4c46713bd61ee43032bbe52a80a2fc9a3ebe7cb649c2554c6500e7f7d6ea3da35e97150ca6431fc1
sanket1729 added a commit to rust-bitcoin/rust-miniscript that referenced this pull request Jun 5, 2022
ac16e05 Add no_std support (mcroad)

Pull request description:

  Closes #201. Related to bitcoindevkit/bdk#205

  Not ready.

  - [x] `no_std` example
  - [x] updated readme with instructions
  - [x] tests pass
  - [x] rust-bitcoin/rust-bitcoin#637 includes `secp256k1/alloc` feature in `bitcoin/no-std`. Released on `0.28.0`
  - [x] rust-bitcoin/rust-bitcoin#690 Rust `1.47` set as `no_std` MSRV. Released in `0.28.1`.

  Maintains backward compatibility. To use it in a `no_std` context set `default-features = false` and enable the `no-std` feature.

  ~~To the maintainers: I added the `no-std-compat` crate. It wraps `core` and `hashbrown` and makes them look like `std`. This is a different than what `rust-bitcoin` did. They use `core` and `hashbrown` directly. I believe using `no-std-compat` makes the code more readable. I'd like to hear your thoughts on this.~~ Now using `hashbrown` and `core` directly.

ACKs for top commit:
  sanket1729:
    ACK ac16e05

Tree-SHA512: 5c26cb50374b7844acbcc5a7607f5710ce19ec0aff4caed1346ed4a2fb708a909205a7d87cc27a773624f43b2a99a71c3ba4bb1cdf2dfec0584833df00b9f032
ChallengeDev210 pushed a commit to ChallengeDev210/rust-bitcoin that referenced this pull request Aug 1, 2022
… under 1.29 (MSRV)

7854bd7 Fix `no_std` MSRV Fixes #690, #947 (mcroad)

Pull request description:

  `rust-bitcoin` does not work with rust 1.29 under a `no_std` environment. This could be considered a bug. However, `no_std` support is a recent addition and this is likely not breaking anyone's builds.

  A decision needs to be made, either `no_std` MSRV is the current stable version while keeping the `std` MSRV as 1.29, or it needs to be fixed.

  This pr adds `no_std` to the 1.29 test suite.

  This came as I try to get rust-bitcoin/rust-miniscript#277 working and got stuck on the issue of testing `no_std` under 1.29.

ACKs for top commit:
  Kixunil:
    ACK 7854bd7
  tcharding:
    ACK 7854bd7
  sanket1729:
    ACK 7854bd7
  apoelstra:
    ACK 7854bd7

Tree-SHA512: 1614fb2193f760ed340592bdb94d076066f6f783bc1dc2b145d97f7151a28316e56b1975f1ad948460eb26db04e7e9382e60076686a681e46dcf33521fda5fca
heap-coder added a commit to heap-coder/rust-miniscript that referenced this pull request Sep 27, 2025
ac16e05aa9943152e4235b490fd4ad03a496a7c1 Add no_std support (mcroad)

Pull request description:

  Closes #201. Related to bitcoindevkit/bdk#205

  Not ready.

  - [x] `no_std` example
  - [x] updated readme with instructions
  - [x] tests pass
  - [x] rust-bitcoin/rust-bitcoin#637 includes `secp256k1/alloc` feature in `bitcoin/no-std`. Released on `0.28.0`
  - [x] rust-bitcoin/rust-bitcoin#690 Rust `1.47` set as `no_std` MSRV. Released in `0.28.1`.

  Maintains backward compatibility. To use it in a `no_std` context set `default-features = false` and enable the `no-std` feature.

  ~~To the maintainers: I added the `no-std-compat` crate. It wraps `core` and `hashbrown` and makes them look like `std`. This is a different than what `rust-bitcoin` did. They use `core` and `hashbrown` directly. I believe using `no-std-compat` makes the code more readable. I'd like to hear your thoughts on this.~~ Now using `hashbrown` and `core` directly.

ACKs for top commit:
  sanket1729:
    ACK ac16e05aa9943152e4235b490fd4ad03a496a7c1

Tree-SHA512: 5c26cb50374b7844acbcc5a7607f5710ce19ec0aff4caed1346ed4a2fb708a909205a7d87cc27a773624f43b2a99a71c3ba4bb1cdf2dfec0584833df00b9f032
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug ci one ack PRs that have one ACK, so one more can progress them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants