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

chore(deps)!: bump @libp2p deps #289

Closed
wants to merge 1 commit into from

Conversation

D4nte
Copy link
Contributor

@D4nte D4nte commented Jun 28, 2022

Bump enough @libp2p deps to fix master.

@codecov-commenter
Copy link

codecov-commenter commented Jun 28, 2022

Codecov Report

Merging #289 (2a055c8) into master (475c861) will decrease coverage by 0.02%.
The diff coverage is 77.77%.

@@            Coverage Diff             @@
##           master     #289      +/-   ##
==========================================
- Coverage   80.46%   80.44%   -0.03%     
==========================================
  Files          42       42              
  Lines        9102     9111       +9     
  Branches      826      828       +2     
==========================================
+ Hits         7324     7329       +5     
- Misses       1778     1782       +4     
Impacted Files Coverage Δ
src/index.ts 69.37% <77.77%> (-0.05%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 475c861...2a055c8. Read the comment docs.

@achingbrain
Copy link
Collaborator

achingbrain commented Jun 28, 2022

When a stream is created by the muxer, it has no protocol, it's just a simple data channel. The stream is returned to the upgrader, which runs the protocol negotiation algorithm (currently multistream-select but there will be others in future), after which the protocol will be set. It's then handed back to the user.

This is all internal to libp2p so maybe it needs an interim type for the muxer to return which has no protocol, then the upgrader can convert it to the type with a protocol so the types will be nicer to use.

Effectively though, there will be a protocol set on the stream that is returned from connection.newStream since if protocol negotiation fails an error will be thrown.

the protocol was moved from the Connection to the Stream

Not exactly - Connection instances don't have protocols - the connection has a muxer, which has lots of muxed streams, each of which have a protocol.

If you have a connection instance without a multiplexer, I guess you could could negotiate a protocol over it manually, but this is of little practical use because muxing is cheap and connections are expensive.

Anyway previously we had the negotiated protocol being returned alongside the stream which made it finicky to track, now it's a property of the stream itself.

@D4nte
Copy link
Contributor Author

D4nte commented Jun 28, 2022

Thanks for the detailed explanation! Very much appreciated.

This is all internal to libp2p so maybe it needs an interim type for the muxer to return which has no protocol, then the upgrader can convert it to the type with a protocol so the types will be nicer to use.

Noted.

Effectively though, there will be a protocol set on the stream that is returned from connection.newStream since if protocol negotiation fails an error will be thrown.

I had a hunch this is what would happen. Does it mean the current logic is acceptable? Do we want to add a log if protocol is not set? (which should not happen).

@achingbrain
Copy link
Collaborator

I think the current logic is fine, but if you're null-guarding on .protocol then adding a log line for the case where it's not set is probably good from a debugging point of view, even if it's unlikely to get hit in practice.

@D4nte D4nte force-pushed the upgrade-libp2p-components branch from 9ac7dab to 4800d77 Compare June 29, 2022 05:24
@D4nte D4nte changed the title [wip] chores(deps)!: Bump @libp2p deps chores(deps)!: Bump @libp2p deps Jun 29, 2022
@D4nte D4nte marked this pull request as ready for review June 29, 2022 05:25
@D4nte D4nte requested a review from a team as a code owner June 29, 2022 05:25
@D4nte D4nte changed the title chores(deps)!: Bump @libp2p deps chores(deps)!: bump @libp2p deps Jun 29, 2022
@D4nte D4nte force-pushed the upgrade-libp2p-components branch 2 times, most recently from fb678ec to 2e44042 Compare June 29, 2022 05:27
@D4nte D4nte changed the title chores(deps)!: bump @libp2p deps chore(deps)!: bump @libp2p deps Jun 29, 2022
@D4nte D4nte force-pushed the upgrade-libp2p-components branch from 2e44042 to 2a055c8 Compare June 29, 2022 07:06
@wemeetagain
Copy link
Member

@D4nte sorry just saw this PR. I just merged #291 which does the same.

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.

4 participants