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

Add p2p protocol support #76

Merged
merged 2 commits into from
Dec 17, 2018
Merged

Add p2p protocol support #76

merged 2 commits into from
Dec 17, 2018

Conversation

jacobheun
Copy link
Contributor

This is needed so that we can switch to using p2p instead of ipfs by default.

Replaces #69, this just rebases that and updates tests from the latest master changes.
Closes #68.

@ghost ghost assigned jacobheun Dec 6, 2018
@ghost ghost added the status/in-progress In progress label Dec 6, 2018
@jacobheun jacobheun requested review from vmx and victorb December 6, 2018 21:08
@jacobheun
Copy link
Contributor Author

The old PR has been sitting for a while, it would be great to get this merged and released soon @victorb @vmx.

@jacobheun
Copy link
Contributor Author

@victorb @vmx any update on getting this released soon? Can I help with anything to get this done?

@vmx vmx merged commit 9c0139e into master Dec 17, 2018
@vmx vmx deleted the feat/p2p-proto branch December 17, 2018 14:47
@ghost ghost removed the status/in-progress In progress label Dec 17, 2018
@vmx
Copy link
Member

vmx commented Dec 17, 2018

Thanks for pinging. I was waiting for @victorb. But as he seems busy and I found out that I also can do releases I'll just do it.

@vmx
Copy link
Member

vmx commented Dec 17, 2018

I've done a release. It should probably have been a 6.1.0 and not a 6.0.1, but as it's already out now, there's not really a point doing another one.

@jacobheun
Copy link
Contributor Author

Woo, thank you!

@alanshaw
Copy link
Member

Oh no, I think this might have broken all the js-ipfs browser tests 😱

@jacobheun
Copy link
Contributor Author

@alanshaw I think the transports are doing filtering badly, they're looking specifically for /ipfs/ which is causing issues. I'm looking at getting them all upgraded to multiaddr 6.

This may cause an issue fragmenting the network though, as old nodes won't be able to interpret the p2p addresses. I'm looking into how we can make this graceful.

@alanshaw
Copy link
Member

I will double check and I'm available if you need any reviews, or want to split the load...

@vmx
Copy link
Member

vmx commented Dec 17, 2018

I know too little about this. If there's a revert needed, let me know.

@jacobheun
Copy link
Contributor Author

I hit this testing the daemon too, the node couldnt start because tcp filtered out the p2p addresses.

@alanshaw
Copy link
Member

It's weird I'm only seeing this in the browser tests for js-ipfs...

@alanshaw
Copy link
Member

Ok so in js-ipfs tests, libp2p-websocket-star is only being asked to filter out:

['/ip4/127.0.0.1/tcp/0/p2p/QmRdfAJKnQUQZkUe7UDgJVBLbepwSnZNF96ER3ahr2iio1']

Which doesn't match WebSocketStar in mafmt. I had originally figured it was an issue here so updated to read:

const WebSocketStar = or(
  and(WebSockets, base('p2p-websocket-star'), base('p2p')),
  and(WebSocketsSecure, base('p2p-websocket-star'), base('p2p')),
  and(WebSockets, base('p2p-websocket-star'), base('ipfs')),
  and(WebSocketsSecure, base('p2p-websocket-star'), base('ipfs')),
  and(WebSockets, base('p2p-websocket-star')),
  and(WebSocketsSecure, base('p2p-websocket-star'))
)

...which may still be necessary, but isn't the only problem.

Anyway, I need to head home and get some food, but back on it later.


We really need to get better at understanding the potential repercussions of releases especially at this fundamental level.

@vmx I think in this case we might be ok and not need a rollback. Looking at the dependency list for js-ipfs right now:

screenshot 2018-12-17 at 19 21 56

All still <=5.

@jacobheun
Copy link
Contributor Author

I think one of the big problems is that the /ipfs/ proto is hardcoded in a lot of the transport logic. So if it gets an address with /p2p/ it doesn't do anything with it, or does the wrong thing (peer discovery in websocket-star is an example where this would break). The migration path for this is messy. I think ideally we'd be able to handle /p2p/ but expose /ipfs/ to give nodes some time to upgrade. Then switch over to exposing /p2p/ at a specified date.

I think right now the best thing to do is to rollback the change. This will give us time to think through the right way to handle this change without risking any unnecessary issues. Right now a lot of the js-ipfs 0.34 release dependencies are starting to move to multiaddr 6, so it will create problems there.

@alanshaw if you agree, I think we should go ahead and rollback. I can put together a better impact assessment for the change and plan for getting this out.

@jacobheun
Copy link
Contributor Author

The protocol table order is currently the big issue, I believe. Right now p2p is set as the preferred because it comes later. This causes the addresses to get turned into p2p addresses. Flipping those would allow us to support p2p, but still expose ipfs as our primary, so it's more backwards compatible.

  [421, Protocols.lengthPrefixedVarSize, 'ipfs'],
  // preferred name for 421 (added below ipfs, p2p takes precedence during table population)
  [421, Protocols.lengthPrefixedVarSize, 'p2p'],

The transports should likely be updated to check for the code rather than the proto name.

@alanshaw
Copy link
Member

I can confirm swapping these around fixes the browser tests

@jacobheun
Copy link
Contributor Author

I'll get a PR for this change and will continue looking into the upgrade path for the transports.

@jacobheun
Copy link
Contributor Author

jacobheun commented Dec 17, 2018

Created #77 to resolve this.

thomaseizinger added a commit to thomaseizinger/js-libp2p that referenced this pull request Feb 1, 2019
multiformats/js-multiaddr#76 changed the
default protocol from ipfs to p2p.

js-multiaddr is a transitive dependency of peer-info, so in order
to get this change, we had to bump the version of peer-info.
thomaseizinger added a commit to thomaseizinger/js-libp2p that referenced this pull request Feb 1, 2019
multiformats/js-multiaddr#76 changed the
default protocol from ipfs to p2p.

js-multiaddr is a transitive dependency of peer-info, so in order
to get this change, we had to bump the version of peer-info.
jacobheun pushed a commit to libp2p/js-libp2p that referenced this pull request Feb 5, 2019
multiformats/js-multiaddr#76 changed the
default protocol from ipfs to p2p.

js-multiaddr is a transitive dependency of peer-info, so in order
to get this change, we had to bump the version of peer-info.

* fix: revert ipfs -> p2p change for some tests

As per PR feedback. Needed for backwards-compatibility.
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