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

enable rsa feature for libp2p #3996

Merged
merged 2 commits into from
Feb 27, 2024
Merged

enable rsa feature for libp2p #3996

merged 2 commits into from
Feb 27, 2024

Conversation

LesnyRumcajs
Copy link
Member

@LesnyRumcajs LesnyRumcajs commented Feb 27, 2024

Summary of changes

Changes introduced in this pull request:

  • Forest fails to connect to more strict bootstrap peers. This change permits upgrading the connections to encrypted ones (to my understanding):
2024-02-27T12:11:47.625785Z DEBUG Transport::dial{address=/dns4/bootstrap-venus.mainnet.filincubator.com/tcp/8888/p2p/QmQu8C6deXwKvJP2D8B6QGyhngc3ZiDnFzEHBDx8yeBXST}: multistream_select::dialer_select: Dialer: Received confirmation for protocol: /noise
2024-02-27T12:11:47.894584Z DEBUG Transport::dial{address=/dns4/bootstrap-venus.mainnet.filincubator.com/tcp/8888/p2p/QmQu8C6deXwKvJP2D8B6QGyhngc3ZiDnFzEHBDx8yeBXST}: libp2p_identity::keypair: support for RSA was disabled at compile-time
2024-02-27T12:11:47.894605Z DEBUG Transport::dial{address=/dns4/bootstrap-venus.mainnet.filincubator.com/tcp/8888/p2p/QmQu8C6deXwKvJP2D8B6QGyhngc3ZiDnFzEHBDx8yeBXST}: libp2p_core::upgrade::apply: Failed to upgrade outbound stream upgrade=/noise
2024-02-27T12:11:47.894638Z DEBUG Swarm::poll: libp2p_kad::behaviour: Last remaining address of peer is unreachable. peer=QmQu8C6deXwKvJP2D8B6QGyhngc3ZiDnFzEHBDx8yeBXST address=/dns4/bootstrap-venus.mainnet.filincubator.com/tcp/8888/p2p/QmQu8C6deXwKvJP2D8B6QGyhngc3ZiDnFzEHBDx8yeBXST
2024-02-27T12:11:47.894652Z DEBUG Swarm::poll: libp2p_swarm: Connection attempt to peer failed with Transport([("/dns4/bootstrap-venus.mainnet.filincubator.com/tcp/8888/p2p/QmQu8C6deXwKvJP2D8B6QGyhngc3ZiDnFzEHBDx8yeBXST", Other(Custom { kind: Other, error: Other(Left(Right(Apply(InvalidKey(DecodingError { msg: "cargo feature `rsa` is not enabled", source: None }))))) }))]). peer=QmQu8C6deXwKvJP2D8B6QGyhngc3ZiDnFzEHBDx8yeBXST

Reference issue to close (if applicable)

Closes #3990

Other information and links

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 (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@@ -118,6 +118,7 @@ libp2p = { version = "0.53", default-features = false, features = [
'tokio',
'macros',
'serde',
'rsa',
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we explicitly enable all of secp256k1, ecdsa, rsa and ed25519?

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's add them. I'll ask around to ensure it's ultimately what we need.

Copy link
Contributor

Choose a reason for hiding this comment

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

As per the code, the list should be exhaustive

#[derive(Debug, Clone)]
#[allow(clippy::large_enum_variant)]
enum KeyPairInner {
    /// An Ed25519 keypair.
    #[cfg(feature = "ed25519")]
    Ed25519(ed25519::Keypair),
    /// An RSA keypair.
    #[cfg(all(feature = "rsa", not(target_arch = "wasm32")))]
    Rsa(rsa::Keypair),
    /// A Secp256k1 keypair.
    #[cfg(feature = "secp256k1")]
    Secp256k1(secp256k1::Keypair),
    /// An ECDSA keypair.
    #[cfg(feature = "ecdsa")]
    Ecdsa(ecdsa::Keypair),
}

Copy link
Contributor

@lemmih lemmih left a comment

Choose a reason for hiding this comment

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

What does enabling rsa do?

@LesnyRumcajs
Copy link
Member Author

What does enabling rsa do?

2024-02-27T12:11:47.625785Z DEBUG Transport::dial{address=/dns4/bootstrap-venus.mainnet.filincubator.com/tcp/8888/p2p/QmQu8C6deXwKvJP2D8B6QGyhngc3ZiDnFzEHBDx8yeBXST}: multistream_select::dialer_select: Dialer: Received confirmation for protocol: /noise
2024-02-27T12:11:47.894584Z DEBUG Transport::dial{address=/dns4/bootstrap-venus.mainnet.filincubator.com/tcp/8888/p2p/QmQu8C6deXwKvJP2D8B6QGyhngc3ZiDnFzEHBDx8yeBXST}: libp2p_identity::keypair: support for RSA was disabled at compile-time
2024-02-27T12:11:47.894605Z DEBUG Transport::dial{address=/dns4/bootstrap-venus.mainnet.filincubator.com/tcp/8888/p2p/QmQu8C6deXwKvJP2D8B6QGyhngc3ZiDnFzEHBDx8yeBXST}: libp2p_core::upgrade::apply: Failed to upgrade outbound stream upgrade=/noise
2024-02-27T12:11:47.894638Z DEBUG Swarm::poll: libp2p_kad::behaviour: Last remaining address of peer is unreachable. peer=QmQu8C6deXwKvJP2D8B6QGyhngc3ZiDnFzEHBDx8yeBXST address=/dns4/bootstrap-venus.mainnet.filincubator.com/tcp/8888/p2p/QmQu8C6deXwKvJP2D8B6QGyhngc3ZiDnFzEHBDx8yeBXST
2024-02-27T12:11:47.894652Z DEBUG Swarm::poll: libp2p_swarm: Connection attempt to peer failed with Transport([("/dns4/bootstrap-venus.mainnet.filincubator.com/tcp/8888/p2p/QmQu8C6deXwKvJP2D8B6QGyhngc3ZiDnFzEHBDx8yeBXST", Other(Custom { kind: Other, error: Other(Left(Right(Apply(InvalidKey(DecodingError { msg: "cargo feature `rsa` is not enabled", source: None }))))) }))]). peer=QmQu8C6deXwKvJP2D8B6QGyhngc3ZiDnFzEHBDx8yeBXST

To my understanding, it allows upgrading the connection to an encrypted one.

@LesnyRumcajs LesnyRumcajs marked this pull request as ready for review February 27, 2024 12:31
@LesnyRumcajs LesnyRumcajs requested a review from a team as a code owner February 27, 2024 12:31
@LesnyRumcajs LesnyRumcajs requested review from aatifsyed and sudo-shashank and removed request for a team February 27, 2024 12:31
@LesnyRumcajs LesnyRumcajs added this pull request to the merge queue Feb 27, 2024
Merged via the queue into main with commit bcea6be Feb 27, 2024
29 of 30 checks passed
@LesnyRumcajs LesnyRumcajs deleted the enable-rsa-feature-libp2p branch February 27, 2024 13:14
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.

Forest is getting stuck during sync
3 participants