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

[identify] Handling of asymetrical protocols #324

Closed
D4nte opened this issue May 4, 2021 · 3 comments
Closed

[identify] Handling of asymetrical protocols #324

D4nte opened this issue May 4, 2021 · 3 comments

Comments

@D4nte
Copy link

D4nte commented May 4, 2021

Given an asymmetrical protocol foo/bar where Alice only supports initiating a query to Bob and Bob only supports responding to a request of said protocol.

Currently, the identify protocol does not include valuable information. Indeed, the specs reads:

protocols
This is a list of protocols supported by the peer.

In the case of Carole, who only support initiating query of foo/bar protocol. Once she finishes the identify protocol with Alice, both Carole and Alice may think they can initiate the query with the other, when it is not the fact.

One idea I had was simply for Alice and Carole to not include foo/bar in the Identify message they send. I am not sure of the ramifications of such design.

What are your thoughts on the matter?

@mxinden mxinden self-assigned this May 4, 2021
@mxinden
Copy link
Member

mxinden commented May 4, 2021

One idea I had was simply for Alice and Carole to not include foo/bar in the Identify message they send. I am not sure of the ramifications of such design.

Yes, this is the libp2p best practice. Implementations doing this today:

  • The (go-)libp2p Kademlia implementation differentiates in client mode and server mode. In client mode a node sends queries but does not answer them. In client mode the node would not include /ipfs/kad/1.0.0 in its identify protocol list nor its ls multistream-select responses. See also protocols/kad: Support client mode rust-libp2p#2032.

  • The circuit relay v2 protocol differentiates nodes in two roles: clients which are at either end of a relayed connection and relays which are in-between relaying the data between two clients. The two clients would advertise the /libp2p/circuit/relay/0.2.0/stop protocol, the relay would advertise the /libp2p/circuit/relay/0.2.0/hop protocol in the identify protocol.

Does the above make sense to you @D4nte? If so, would you mind sending in a patch to update the identify protocol specification in this repository?

@mxinden mxinden removed their assignment May 4, 2021
@D4nte
Copy link
Author

D4nte commented May 5, 2021

Great answer, thank you very much.

@D4nte
Copy link
Author

D4nte commented May 5, 2021

Closing, will reopen if further questions arise.

@D4nte D4nte closed this as completed May 5, 2021
mxinden added a commit to mxinden/specs that referenced this issue May 14, 2021
> Note on asymmetrical protocols: Assume an asymmetrical
request-response style protocol `foo` where some clients only support
initiating requests while some servers (only) support responding to
requests. To prevent clients from initiating requests to other clients,
which given them being clients they fail to respond, clients should not
list `foo` in their `protocols` list.

Question emerged in libp2p#324.
mxinden added a commit that referenced this issue May 25, 2021
* identify: Document identify behavior for asymetrical protocols

> Note on asymmetrical protocols: Assume an asymmetrical
request-response style protocol `foo` where some clients only support
initiating requests while some servers (only) support responding to
requests. To prevent clients from initiating requests to other clients,
which given them being clients they fail to respond, clients should not
list `foo` in their `protocols` list.

Question emerged in #324.

* identify/README: Reword to inbound substreams
mxinden added a commit to mxinden/specs that referenced this issue Jul 1, 2021
…p#327)

* identify: Document identify behavior for asymetrical protocols

> Note on asymmetrical protocols: Assume an asymmetrical
request-response style protocol `foo` where some clients only support
initiating requests while some servers (only) support responding to
requests. To prevent clients from initiating requests to other clients,
which given them being clients they fail to respond, clients should not
list `foo` in their `protocols` list.

Question emerged in libp2p#324.

* identify/README: Reword to inbound substreams
mxinden added a commit to mxinden/specs that referenced this issue Jul 1, 2021
…p#327)

* identify: Document identify behavior for asymetrical protocols

> Note on asymmetrical protocols: Assume an asymmetrical
request-response style protocol `foo` where some clients only support
initiating requests while some servers (only) support responding to
requests. To prevent clients from initiating requests to other clients,
which given them being clients they fail to respond, clients should not
list `foo` in their `protocols` list.

Question emerged in libp2p#324.

* identify/README: Reword to inbound substreams
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

No branches or pull requests

2 participants