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

build(deps): Bump rand to 0.8 and quickcheck to 1 #2857

Merged
merged 37 commits into from
Sep 22, 2022

Conversation

kpp
Copy link
Contributor

@kpp kpp commented Aug 30, 2022

Fixes #2847
Fixes #2732

It would be nice if you can help me with or at least give an advise:

  • Some tests fail
  • I didn't implement my own gen_range but used modulus instead
  • There is a lot of leaky abstractions of rand in kad

@kpp kpp marked this pull request as draft August 30, 2022 14:38
@kpp kpp changed the title Upgrade rand to 0.8 Upgrade rand to 0.8, quickcheck to 1 Aug 30, 2022
@kpp kpp marked this pull request as ready for review August 31, 2022 12:08
Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

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

Thank you! This is something that has been overdue for a while!

Cargo.toml Outdated Show resolved Hide resolved
protocols/kad/src/kbucket.rs Outdated Show resolved Hide resolved
protocols/kad/src/kbucket.rs Outdated Show resolved Hide resolved
protocols/kad/src/query/peers/closest/disjoint.rs Outdated Show resolved Hide resolved
protocols/kad/src/query/peers/closest/disjoint.rs Outdated Show resolved Hide resolved
swarm/src/registry.rs Outdated Show resolved Hide resolved
@kpp
Copy link
Contributor Author

kpp commented Sep 2, 2022

Ready for review! @thomaseizinger thank you for helping me with this.

Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

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

Thank you for pushing this forward!

protocols/kad/src/kbucket.rs Show resolved Hide resolved
protocols/kad/src/kbucket.rs Show resolved Hide resolved
protocols/kad/src/query/peers/closest/disjoint.rs Outdated Show resolved Hide resolved
@kpp
Copy link
Contributor Author

kpp commented Sep 6, 2022

So I added an implementation of gen_range, however it is too generic and <T> sometimes is treated as integer which is then substituted as i32, so I have to fix T with something like:

-            match g.gen_range(0..5) {
+            match g.gen_range(0..5u8) {
                 0 => Message::Header(HeaderLine::V1),
                 1 => Message::NotAvailable,
                 2 => Message::ListProtocols,

I added a T: Unsigned bound to catch this kind of errors at compile time.

@kpp
Copy link
Contributor Author

kpp commented Sep 6, 2022

Also this is a very strange failed test https://github.com/libp2p/rust-libp2p/runs/8207467155?check_suite_focus=true, issued in #2874.

Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

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

LGTM!

@mxinden Can you have a look at this too?

core/Cargo.toml Show resolved Hide resolved
@thomaseizinger thomaseizinger changed the title Upgrade rand to 0.8, quickcheck to 1 build(deps): Upgrade rand to 0.8 and quickcheck to 1 Sep 8, 2022
@thomaseizinger thomaseizinger changed the title build(deps): Upgrade rand to 0.8 and quickcheck to 1 build(deps): Bump rand to 0.8 and quickcheck to 1 Sep 8, 2022
@thomaseizinger
Copy link
Contributor

Excuse the bad merge commit, I've fixed the build error in 25f87c5.

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Solid work. Thanks @kpp for solving this long standing issue in such a clean way.

muxers/mplex/Cargo.toml Show resolved Hide resolved
protocols/kad/Cargo.toml Show resolved Hide resolved
protocols/kad/src/query/peers/closest/disjoint.rs Outdated Show resolved Hide resolved
protocols/ping/Cargo.toml Show resolved Hide resolved
protocols/request-response/Cargo.toml Show resolved Hide resolved
swarm/Cargo.toml Show resolved Hide resolved
transports/pnet/Cargo.toml Show resolved Hide resolved
@kpp
Copy link
Contributor Author

kpp commented Sep 12, 2022

@mxinden I bumped the versions of crates and added CHANGELOG entries. pnet changelog should reflect the date of publishing.

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Thanks for the follow ups. Still a couple of comments. Keeping the libp2p-kad tests deterministic would ease debugging in the future by a lot.

muxers/mplex/CHANGELOG.md Outdated Show resolved Hide resolved
protocols/floodsub/Cargo.toml Show resolved Hide resolved
protocols/gossipsub/Cargo.toml Show resolved Hide resolved
protocols/kad/CHANGELOG.md Outdated Show resolved Hide resolved
protocols/kad/src/kbucket.rs Outdated Show resolved Hide resolved
protocols/kad/src/query/peers/closest/disjoint.rs Outdated Show resolved Hide resolved
protocols/ping/CHANGELOG.md Outdated Show resolved Hide resolved
protocols/request-response/CHANGELOG.md Outdated Show resolved Hide resolved
swarm/CHANGELOG.md Outdated Show resolved Hide resolved
transports/pnet/CHANGELOG.md Outdated Show resolved Hide resolved
@kpp
Copy link
Contributor Author

kpp commented Sep 15, 2022

@mxinden I made kad tests deterministic.

Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

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

LGTM!

protocols/floodsub/CHANGELOG.md Show resolved Hide resolved
protocols/kad/src/query/peers/closest/disjoint.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

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

This is good to merge from my side. Thank you @kpp!

I think the only open point is #2857 (comment), plus there is now a merge conflict with master.

@thomaseizinger
Copy link
Contributor

All comments are resolved and tests are passing. Going ahead with merging this. Interoperability tests fail because of libp2p/test-plans#41.

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.

rand:wasm-bindgen missing feature Consider replacing quickcheck with an alternative
3 participants