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

Rust 2018 & MSRV bump 1.41.1 tracking issue #510

Closed
20 tasks done
dr-orlovsky opened this issue Oct 28, 2020 · 62 comments
Closed
20 tasks done

Rust 2018 & MSRV bump 1.41.1 tracking issue #510

dr-orlovsky opened this issue Oct 28, 2020 · 62 comments
Labels
1.0 Issues and PRs required or helping to stabilize the API epic Tracking issues for epic tasks
Projects
Milestone

Comments

@dr-orlovsky
Copy link
Collaborator

dr-orlovsky commented Oct 28, 2020

    I wonder if we should have a Rust 2018 tracking issue and start tagging things that are blocked on it. 
    Would be good to have a clear picture of what we're missing by being on 1.29.

@apoelstra #373 (comment)

Checklist

non_exhaustive types:

PR list:

@apoelstra
Copy link
Member

apoelstra commented Dec 3, 2020

@RCasatta
Copy link
Collaborator

RCasatta commented Dec 3, 2020

@dr-orlovsky
Copy link
Collaborator Author

@stevenroose
Copy link
Collaborator

@apoelstra
Copy link
Member

1.36 is also the (current, may change without major version bump) MSRV of rand 0.8, whose non-optional dep tree now consists of rand-core and nothing else.

@apoelstra
Copy link
Member

Possibly this crate could be interesting for us https://crates.io/crates/standback

@dpc
Copy link
Contributor

dpc commented Apr 4, 2021

mrust can compile rustc 1.39 now. https://www.reddit.com/r/rust/comments/mjxbaz/mrustc_upgrade_rustc_1390/

@elichai
Copy link
Member

elichai commented Apr 5, 2021

mrust can compile rustc 1.39 now. https://www.reddit.com/r/rust/comments/mjxbaz/mrustc_upgrade_rustc_1390/

Nice!

@dr-orlovsky dr-orlovsky pinned this issue Apr 6, 2021
@apoelstra
Copy link
Member

Any opposition to moving to 1.39 then for rust-bitcoin 0.27? I can open another discussion issue. cc @TheBlueMatt 1.29 is really old now and is causing us a lot of grief especially with respect to nostd/alloc.

@TheBlueMatt
Copy link
Member

Hmm, in general I think I'm fine with 1.39. It is less than two years old, though, so not sure if we don't want to use 1.34 (which is about two years old) or 1.36 (for alloc). I do admit it would be cool to go right to 1.39 and use async in a few places.

@apoelstra
Copy link
Member

I think we could wait for the beginning of July and then jump to 1.36 (which aside from being "the one with alloc" also felt to me like a more important/well-tested release than 1.34 or 1.39).

@apoelstra
Copy link
Member

As for using async I think that'd be a major change, though I guess if it were localized maybe not. And the upcoming API overhaul + transition to Rust 2018 would already be major changes, and it might be good to stagger them.

@TheBlueMatt
Copy link
Member

Right, I was mostly thinking of (optionally) using async in rust-bitcoincore-rpc by porting the lightning-block-sync stuff to there.

@elichai
Copy link
Member

elichai commented Apr 22, 2021

yeah I don't think rust-bitcoin itself should be async, maybe when we have AsyncRead/AsyncWrite in libstd then we might want to add support for these in the Encode/Decode traits

@elichai
Copy link
Member

elichai commented Apr 22, 2021

As for bumping, I can come up with a summary of what features we might want and what versions they exists in,
the first things that come to my mind are mostly dependencies (latest rand: 1.36, cc: 1.34, serde_derive: 1.31)

@TheBlueMatt
Copy link
Member

Alright, lets plan on 1.36 Soon (tm), then. We may actually go ahead and do it in RL because we're already at 1.30 (due to cargo bug that prevented us from using 1.29) and I'm tired of trying to make cc work right.

TheBlueMatt added a commit to TheBlueMatt/rust-lightning that referenced this issue Apr 26, 2021
Debian is shipping 1.41 on oldstable and rust-bitcoin will likely
move to 1.36 over the coming months, so there's little reason to
wait on this.

cc rust-bitcoin/rust-bitcoin#510
TheBlueMatt added a commit to TheBlueMatt/rust-lightning that referenced this issue Apr 27, 2021
Debian is shipping 1.41 on oldstable and rust-bitcoin will likely
move to 1.36 over the coming months, so there's little reason to
wait on this.

cc rust-bitcoin/rust-bitcoin#510
@dr-orlovsky
Copy link
Collaborator Author

Upgrade to 1.36 actually means we can use syn with its MSRV 0.31, and finally do derives instead of macros for many occasions.

I just completed development of a 1.31-compatible library simplifying creation of complex derivation macros to a big degree: https://docs.rs/amplify_syn/. You can see a sample of what it can be done with it here: https://github.com/LNP-BP/rust-amplify/blob/master/derive/src/lib.rs#L480-L553

Upon MSRV increase I will be happy to refactor rust-bitcoin code to introduce derivation macros using it (we already had one attempt in the past by @elichai, but then we were blocked by MSRV requirement).

@TheBlueMatt
Copy link
Member

As of July 4 1.36 was two years old, so I think we can do this whenever now. https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html

sanket1729 added a commit to rust-bitcoin/rust-miniscript that referenced this issue May 2, 2022
c60bf1e Fix edition-idioms (Tobin C. Harding)
08bce7a Update to use edition 2018 (Tobin C. Harding)
2a83fa0 Update MSRV in CI and Readme from 1.29 to 1.41.1 (Tobin C. Harding)
2b73bb2 integration_test: Use latest bitcoin release (Tobin C. Harding)

Pull request description:

  Update the MSRV to Rust 1.41.1 and enable edition 2018.

  I'm not sure how we want to merge these MSRV PRs across the stack but here is the `rust-miniscript` one.

  Discussion: rust-bitcoin/rust-bitcoin#510 (comment)

ACKs for top commit:
  sanket1729:
    ACK c60bf1e. redid the entire process to match the diff.

Tree-SHA512: 353cd793df4ba91b897e0dc58547b074ade7c23e7d75447c957ba947a12ff72c4504cb46036fdffea1591e429ee9eb056182dcffc89e301c72e3c5c433e8de16
apoelstra added a commit to rust-bitcoin/bitcoin_hashes that referenced this issue May 3, 2022
abb7c80 Bump version 0.10.0 -> 0.11.0 (Tobin Harding)
b270023 Update to use edition 2018 (Tobin Harding)
e762962 Update MSRV in CI and Readme from 1.29 to 1.41.1 (Tobin Harding)
3602c75 Remove trailing whitespace (Tobin Harding)

Pull request description:

  Update the MSRV to Rustn 1.41.1 and enable edition 2018.

  Should not be merged without rust-bitcoin organization-wide planning on how to go about this upgrade.

  Discussion: rust-bitcoin/rust-bitcoin#510 (comment)

  This one is a bit more involved than the same PRs for [rust-bech32](rust-bitcoin/rust-bech32#57) or [rust-bitcoinconcensus](rust-bitcoin/rust-bitcoinconsensus#34).

  The commit message of patch 3:
  ```
  Update to use edition 2018

  Add `edition = "2018"` to the minifest file. In order to get the
  codebase to build cleanly do:

  - Remove usage of `use Hash as HashTrait`, instead use `impl crate::Hash for Hash` and `use Hash as _`.
  - Same for HashEngine (remove EngineTrait).
  - Add `crate::` to import statements and group same level (only did this for crate imports, the rest can wait for rustfmt :)
  - Make test imports uniform, elect to _not_ use `super::*` because it seems cleaner, we are always importing the module we are testing and the same set of traits in each `test` module. Can change if requested.
  ```

  Thanks

ACKs for top commit:
  apoelstra:
    ACK abb7c80

Tree-SHA512: 6e99235075a12a82bc2bb032411eb7d022c650e5288bd1a2891b3d863e093ad9398525c1fba41d5e3fdcb194fcf93b00c6f59ad7681f5404eaeae73f08af2278
tcharding added a commit to tcharding/rust-bitcoinconsensus that referenced this issue May 15, 2022
Done in preparation for updating the MSRV across all the rust-bitcoin
crates.

For discussion see:

 rust-bitcoin/rust-bitcoin#510 (comment)
tcharding added a commit to tcharding/rust-bitcoinconsensus that referenced this issue May 15, 2022
Done in preparation for updating the MSRV across all the rust-bitcoin
crates.

For discussion see:

 rust-bitcoin/rust-bitcoin#510 (comment)
tcharding added a commit to rust-bitcoin/rust-bitcoinconsensus that referenced this issue May 18, 2022
ec6459e Bump version 0.19.0-3 -> 0.19.0-0.4.0 (Tobin Harding)
31c695f Update to use edition 2018 (Tobin Harding)
4be3bf2 Update MSRV in CI and Readme from 1.29 to 1.41.1 (Tobin Harding)

Pull request description:

  Update the MSRV to Rust 1.41.1 and enable edition 2018.

  Should not be merged without rust-bitcoin organization-wide planning on how to go about this upgrade.

  ~Leaving as draft until rust-bitcoin Taproot release is done.~

  Discussion: rust-bitcoin/rust-bitcoin#510 (comment)

Top commit has no ACKs.

Tree-SHA512: bf38d3884ccf5c151ee2956e4ee285ec778602792752fe696a2b56b5cbcb2d3e13b7eaed42517f6b1fb49a0db90ea946d58c124532f596e1f8ad649c61730f78
@tcharding
Copy link
Member

I've checked off all the basic ones crew, many of the others I either do not understand how to do or I do not understand the motivation behind doing them. If you put one on the list, and would like to see it implemented without having to do it yourself, please throw a comment here with a bit more context and I'm happy to do it. Thanks.

@Kixunil
Copy link
Collaborator

Kixunil commented May 25, 2022

Adding #[non_exhaustive] attribute to the listed types would be great. It ensures forward compatibility.

$(,)? in macros is cosmetic.

@tcharding
Copy link
Member

I had a think about the non_exhaustive task. I have a question: Why only do Error, if we are justified in doing one error why not do all of the error types?

@tcharding
Copy link
Member

Does anyone remember where Infallible was supposed to be used?

@tcharding
Copy link
Member

I scratched alloc from the list, flagging it here because I'm not 100% sure that is correct.

@Kixunil
Copy link
Collaborator

Kixunil commented May 27, 2022

@tcharding I think by Error I meant all error types. :)

$ rg --multiline 'enum.*\{[ \t\n]*\}'
src/blockdata/script.rs
173:enum Uninhabited {}

Uninhabited should be removed and replaced with Infallible

We can skip alloc because the library is mostly useless without it and it'd be easier to do with Amount & co in a separate crate.

apoelstra added a commit that referenced this issue May 27, 2022
88ce8fe Match against an optional single trailing colon (Tobin C. Harding)

Pull request description:

  Currently we allow multiple trailing colons when matching within the
  `check_format_non_negative` macro. We can be more restrictive with no
  loss of usability.

  Use `$(;)?` instead of `$(;)*` to match against 0 or 1 semi-colons
  instead of 0 or more.

  Done as part of the [edition 2018 checklist](#510).

ACKs for top commit:
  Kixunil:
    ACK 88ce8fe
  apoelstra:
    ACK 88ce8fe

Tree-SHA512: 4409c094f6a0aa49ddebdad850fd1d5a31a57dae8828f5a1db0ee5a855e1bce9e43aea69fa0b4d132068c3a43f1f62d35409b9ac5b32ed876e4dd586829e8e68
@tcharding
Copy link
Member

Cool, cheers.

apoelstra added a commit to rust-bitcoin/rust-secp256k1 that referenced this issue Jun 8, 2022
5d2f1ce Fix WASM build (Elichai Turkel)
39aaac6 Use new trait TryFrom and do small refactoring (Elichai Turkel)
7d3a149 Move more things from the std feature to the alloc feature (Elichai Turkel)
bc8c713 Replace c_void with core::ffi::c_void (Elichai Turkel)
26a52bc Update secp256k1-sys to edition 2018 and fix imports (Elichai Turkel)
ebe46a4 Update rand to 0.8 and replace CounterRng with mock::StepRng (Elichai Turkel)
626835f Update secp256k1 to edition 2018 and fix imports (Elichai Turkel)
67c0922 Update MSRV in CI and Readme from 1.29 to 1.41 (Elichai Turkel)

Pull request description:

  As proposed in rust-bitcoin/rust-bitcoin#510 (comment) this PR raises the MSRV to 1.41.1 it also changes the code to be Edition 2018.

  The PR contains a few things:
  * Moving to edition 2018 and fixing the imports
  * Sorting and combining imports to make them more concise
  * Replacing our c_void with `core::ffi::c_void`
  * Bumping the `rand` version to latest and modifying our `RngCore` implementations accordingly
  * Doing some small refactoring and using the new `TryInto` trait where it makes the code nicer

  If people prefer I can split this PR into multiple and/or drop some commits

ACKs for top commit:
  tcharding:
    ACK 5d2f1ce
  apoelstra:
    ACK 5d2f1ce

Tree-SHA512: 5bf84e7ebb6286d59f8cada0bb712c46336f0dd6c35b67e6f4ba323b5484ad925b99b73e778ae4608f123938e7ee8705a0aec576cd9c065072c4ecf1248e3470
@tcharding
Copy link
Member

tcharding commented Jun 24, 2022

There are only a few things to go on the list.

  • The Infallible/Uninhabited thing
  • The two checklist items at the top that do not have PRs, neither of which I'm know if we still want, anyone?
    • "async - probably only for Read and Write async equivalents"
    • "use amplify_derive? note that this will blow up compile times for non-serde uses"

@dr-orlovsky
Copy link
Collaborator Author

dr-orlovsky commented Jun 24, 2022

amplify_derive is a crate which I did to simplify deriving Errors, Froms and Displays all around, which may be useful here. That crate has very few dependencies (comparing to other error/display derive crates), and matches MSRV after its bump. So it's up to rust-bitcoin maintainers to decide whether to use it here or continue maintaining larger codebase for each error.

Me and @Kixunil are maintainers of that repo hosted in a dedicated github org (@Kixunil contributed to other parts of the amplify lib family) and I can add more maintainers from here to ensure safety of the use of the library & reviews requirement for any codebase changes.

@dr-orlovsky
Copy link
Collaborator Author

async - that was about adding support to async functions, for instance for implementing non-blocking consensus encoding/decoding with io::Read/Write - this may be useful, for instance when they are used in serializing large structures (blocks) to files by projects like electrum server (personally I do not need it, since I am using different approach to a non-blocking architecture with ZMQ and microservices - and not rust async which I do not like).

@Kixunil
Copy link
Collaborator

Kixunil commented Jun 26, 2022

Exactly what @dr-orlovsky said. Those two are definitely not required for the issue to be complete and are more "nice to have" things that could be added at any time in the future. IMO it's even better to skip them to release more quickly.

@tcharding I belive we already did Infallible. I checked also wrong uses of () and while there is one in AddressType it's not infallible, just a bad error type.

@tcharding
Copy link
Member

tcharding commented Jun 27, 2022

Thanks fellas, Uninhabited still exits and my memory fails me right now, its tied in with non_exhaustive, I meant to come back and work it out but now you've comment I'll just own up and say I can't remember :)

The long and the short of it is then, to sum up, checklist is done after:

  • merge open PRs
  • Tobin to investigate Uninhabited Done

@Kixunil
Copy link
Collaborator

Kixunil commented Jun 29, 2022

Ah, I got confused because I remembered that the PR was opened but forgot it was closed without replacement.

@tcharding
Copy link
Member

My bad.

@tcharding
Copy link
Member

The checklist is complete - closing.

Refactoring automation moved this from In progress to Done Jul 18, 2022
@tcharding tcharding unpinned this issue Jul 19, 2022
ChallengeDev210 pushed a commit to ChallengeDev210/rust-bitcoin that referenced this issue Aug 1, 2022
…e trailing colon

88ce8fe Match against an optional single trailing colon (Tobin C. Harding)

Pull request description:

  Currently we allow multiple trailing colons when matching within the
  `check_format_non_negative` macro. We can be more restrictive with no
  loss of usability.

  Use `$(;)?` instead of `$(;)*` to match against 0 or 1 semi-colons
  instead of 0 or more.

  Done as part of the [edition 2018 checklist](rust-bitcoin/rust-bitcoin#510).

ACKs for top commit:
  Kixunil:
    ACK 88ce8fe
  apoelstra:
    ACK 88ce8fe

Tree-SHA512: 4409c094f6a0aa49ddebdad850fd1d5a31a57dae8828f5a1db0ee5a855e1bce9e43aea69fa0b4d132068c3a43f1f62d35409b9ac5b32ed876e4dd586829e8e68
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0 Issues and PRs required or helping to stabilize the API epic Tracking issues for epic tasks
Projects
Development

No branches or pull requests