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

feat(core): make the upgrade module an implementation detail #3915

Merged
merged 18 commits into from
May 15, 2023

Conversation

thomaseizinger
Copy link
Contributor

@thomaseizinger thomaseizinger commented May 12, 2023

Description

Resolves: #3748.

Notes & open questions

Draft because stacked.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

core/CHANGELOG.md Outdated Show resolved Hide resolved
@thomaseizinger
Copy link
Contributor Author

In a later step, we can simplify some of this code down to use boxed futures which should save us quite a bit of code!

Base automatically changed from feat/swarm/decouple-mss to master May 12, 2023 06:19
@thomaseizinger thomaseizinger marked this pull request as ready for review May 12, 2023 06:21
@mxinden
Copy link
Member

mxinden commented May 14, 2023

Can you remove the usage in libp2p-plaintext @thomaseizinger?

See CI failure:

---- src/lib.rs - PlainText1Config (line 58) stdout ----
error[E0603]: function `apply` is private
error: doctest failed, to rerun pass `-p libp2p-plaintext --doc`
Error:   --> src/lib.rs:64:27
   |
9  |     libp2p_core::upgrade::apply(
   |                           ^^^^^ private function
   |
note: the function `apply` is defined here
  --> /home/runner/work/rust-libp2p/rust-libp2p/core/src/upgrade.rs:70:5
   |
70 |     apply, apply_inbound, apply_outbound, InboundUpgradeApply, OutboundUpgradeApply,
   |     ^^^^^

error: aborting due to previous error

@thomaseizinger
Copy link
Contributor Author

Can you remove the usage in libp2p-plaintext @thomaseizinger?

I thought I had removed all usages before! Fixed now :)

@mxinden
Copy link
Member

mxinden commented May 15, 2023

@thomaseizinger libp2p-plaintext tests still failing:

---- src/lib.rs - PlainText1Config (line 58) stdout ----
error[E0271]: type mismatch resolving `<PlainText1Config as InboundUpgrade<Negotiated<RwStreamSink<Chan>>>>::Output == (PeerId, _)`
Error:    --> src/lib.rs:64:17
    |
9   |   .authenticate(PlainText1Config {})
    |    ------------ ^^^^^^^^^^^^^^^^^^^ expected `(PeerId, _)`, found `Negotiated<RwStreamSink<Chan>>`
    |    |
    |    required by a bound introduced by this call
    |
    = note: expected tuple `(libp2p_identity::peer_id::PeerId, _)`
              found struct `multistream_select::negotiated::Negotiated<rw_stream_sink::RwStreamSink<Chan>>`
note: required by a bound in `libp2p_core::transport::upgrade::Builder::<T>::authenticate`
   --> /home/runner/work/rust-libp2p/rust-libp2p/core/src/transport/upgrade.rs:104:42
    |
104 |         U: InboundUpgrade<Negotiated<C>, Output = (PeerId, D), Error = E>,
    |                                          ^^^^^^^^^^^^^^^^^^^^ required by this bound in `Builder::<T>::authenticate`

error[E0271]: type mismatch resolving `<PlainText1Config as OutboundUpgrade<Negotiated<RwStreamSink<Chan>>>>::Output == (PeerId, _)`

@thomaseizinger
Copy link
Contributor Author

Yeah I noticed. Should we just bin Plaintext1Config? It is not compatible with the upgrade API so why would anyone use that at all?

@mxinden
Copy link
Member

mxinden commented May 15, 2023

Removing Plaintext1Config sounds good to me. I don't see a use-case where Plaintext2Config is not enough.

@thomaseizinger thomaseizinger changed the base branch from master to fix/remove-plaintext1 May 15, 2023 11:08
@mergify

This comment was marked as resolved.

@thomaseizinger
Copy link
Contributor Author

Removing Plaintext1Config sounds good to me. I don't see a use-case where Plaintext2Config is not enough.

Opened a PR here: #3940

@thomaseizinger thomaseizinger marked this pull request as draft May 15, 2023 11:26
Base automatically changed from fix/remove-plaintext1 to master May 15, 2023 12:38
mergify bot pushed a commit that referenced this pull request May 15, 2023
`Plaintext2Config` works with the upgrade infrastructure and is thus preferable.

Related: #3915.

Pull-Request: #3940.
@thomaseizinger thomaseizinger marked this pull request as ready for review May 15, 2023 13:04
@mergify mergify bot merged commit 08f0b5e into master May 15, 2023
@mergify mergify bot deleted the feat/make-apply-impl-detail branch May 15, 2023 13:24
mergify bot pushed a commit that referenced this pull request Jun 5, 2023
Not making this private was an oversight from an earlier refactoring.

Related: #3915.

Pull-Request: #4012.
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.

core: make upgrade::apply an implementation detail of transport upgrades
2 participants