net-ipfs-http-client icon indicating copy to clipboard operation
net-ipfs-http-client copied to clipboard

Talking to js-ipfs

Open richardschneider opened this issue 8 years ago • 17 comments

All testing has been done against go-ipfs. js-ipfs is a new javasvript implementation of the IPFS server. Let's see how we play with it.

The code is being pushed to the js-ipfs branch.

richardschneider avatar Nov 10 '17 10:11 richardschneider

js-ipfs server listens on port 5002 not 5001

richardschneider avatar Nov 10 '17 10:11 richardschneider

Need to recognize new network protocols

Message: Test method Ipfs.Api.GenericApiTest.Mars_Node_Info threw exception: 
System.AggregateException: One or more errors occurred. 
---> Newtonsoft.Json.JsonSerializationException: Error converting value "/p2p-circuit/ip4/0.0.0.0/tcp/4002/ipfs/QmV7Nosg5JQPSunFLc2NR4RKRkNzFmMXPw9VtHUx4qsz7i" to type 'Ipfs.MultiAddress'. Path 'Addresses[3]', line 1, position 812. 
---> System.FormatException: The IPFS network protocol 'p2p-circuit' is unknown.

richardschneider avatar Nov 10 '17 10:11 richardschneider

Added the new network protocols to net-ipfs-core v0.10.0

richardschneider avatar Nov 11 '17 00:11 richardschneider

Latency can have a value of "unknown". It was "n/a" on go-ipfs.

richardschneider avatar Nov 11 '17 00:11 richardschneider

54 tests are green and 15 red; not bad for alpha software. Many of the failed tests can be attributed to the following issues

  • pin add/ls NYI
  • file ls NYI
  • dht findprovs NYI
  • pubsub failures

@diasdavid FYI

richardschneider avatar Nov 11 '17 02:11 richardschneider

An interesting test failure is FindPeer. It appears that the mars node likes to change it's ID.

The requested peer ID is QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3. But the returned ID is QmZLWJesud9er9iQZuJiitsDN2fTLKLn4pWwpkKk4CFYmv.

Test Name:	FindPeer
Test Outcome:	Failed
Result Message:	Assert.AreEqual failed. Expected:<QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3>. Actual:<QmZLWJesud9er9iQZuJiitsDN2fTLKLn4pWwpkKk4CFYmv>.
Result StandardOutput:	
2017/11/11 14:49:45:425 [DEBUG] Ipfs.Api.IpfsClient - GET http://localhost:5002/api/v0/id?arg=QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3
2017/11/11 14:49:45:428 [DEBUG] Ipfs.Api.IpfsClient - RSP {"ID":"QmZLWJesud9er9iQZuJiitsDN2fTLKLn4pWwpkKk4CFYmv","PublicKey":"CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCwb1DldHz0lJM6ox/l7ISPeNaf0s61kH+l2CwH2WY8x2oJm56pA4Big9SSx6YDW8nJU44tnlSo4E7KJvmpMEE4DQkatZcRLjxi2ujTEAx21CRSJIcBgbSAaB/ofo1UdIyGjaoUO7U8a8pAC1yJE9sh0MebOXgI8EMY5uKfyTCAUsznQdz+JN4AI4xP+Dv9ruLQuioJYpti2DeSrW+TIUFWW1Y4HSsT9Pv7ars0davPqXEmnAE633vnepe+K9MUJxqakgnHMEpq5w2HOW5kznSBAzhutMUHfa16Ky02slY0JgxOoLa9fr/YSsRlJMsrMoLZA2b8r+8kaimyMVtT/Uv3AgMBAAE=","Addresses":["/ip4/127.0.0.1/tcp/4002/ipfs/QmZLWJesud9er9iQZuJiitsDN2fTLKLn4pWwpkKk4CFYmv","/ip4/127.0.0.1/tcp/4003/ws/ipfs/QmZLWJesud9er9iQZuJiitsDN2fTLKLn4pWwpkKk4CFYmv","/ip4/192.168.178.21/tcp/4002/ipfs/QmZLWJesud9er9iQZuJiitsDN2fTLKLn4pWwpkKk4CFYmv","/p2p-circuit/ip4/0.0.0.0/tcp/4002/ipfs/QmZLWJesud9er9iQZuJiitsDN2fTLKLn4pWwpkKk4CFYmv","/p2p-circuit/ip4/127.0.0.1/tcp/4003/ws/ipfs/QmZLWJesud9er9iQZuJiitsDN2fTLKLn4pWwpkKk4CFYmv","/p2p-circuit/ipfs/QmZLWJesud9er9iQZuJiitsDN2fTLKLn4pWwpkKk4CFYmv"],"AgentVersion":"js-ipfs","ProtocolVersion":"9000"}

richardschneider avatar Nov 11 '17 02:11 richardschneider

Woot! Nice report @richardschneider, thank you for sharing this. Some of the failures will be fixed with:

  • Implementing the Pin API https://github.com/ipfs/js-ipfs/pull/1045
  • Implementing .ls https://github.com/ipfs/js-ipfs/pull/940
  • Turning on the experimental DHT on https://github.com/ipfs/js-ipfs#advanced-options-when-creating-an-ipfs-node
  • Finishing the DHT implementation https://github.com/ipfs/js-ipfs/pull/856

I'm intrigued why PubSub failed, it should work the same way, unless your PubSub tests rely on the DHT.

As for:

The requested peer ID is QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3. But the returned ID is QmZLWJesud9er9iQZuJiitsDN2fTLKLn4pWwpkKk4CFYmv.

This is because the way a DHT works is by giving you the closest peers and since it doesn't find Mars, it gives you something different

daviddias avatar Nov 11 '17 06:11 daviddias

Getting files ls working is high on my list. With this, I should be able to mount IPFS on a windows machine with js-ipfs, see net-ipfs-mount.

richardschneider avatar Nov 11 '17 06:11 richardschneider

Cool DHT feature, will change my test case.

Learn something new every day.

richardschneider avatar Nov 11 '17 06:11 richardschneider

@pgte is almost finishing files ls https://github.com/ipfs/js-ipfs-unixfs-engine/pull/197 \o/

Wanna help finish the Pin API? The PR is pretty advanced https://github.com/ipfs/js-ipfs/pull/1045 and we already have interface tests https://github.com/ipfs/interface-ipfs-core/blob/master/src/pin.js that are used to test js-ipfs-api with go-ipfs too

daviddias avatar Nov 11 '17 07:11 daviddias

I forgot to run js-ipfs with --enable-pubsub-experiment. But still getting some test failures,

richardschneider avatar Nov 11 '17 07:11 richardschneider

There are differences in the PublishedMessage from go and js; see https://github.com/ipfs/js-ipfs/issues/1068.

richardschneider avatar Nov 11 '17 09:11 richardschneider

Port 5001 vs 5002 is getting annoying. Let's make IpfsClient use environment variable IpfsHttpApi which contains the URL to server.

richardschneider avatar Nov 11 '17 23:11 richardschneider

PublishedMessage differences are being resolved in https://github.com/ipfs/js-ipfs/issues/1068

richardschneider avatar Nov 14 '17 23:11 richardschneider

@diasdavid I'm looking for support of file ls

NOT files ls

richardschneider avatar Nov 15 '17 05:11 richardschneider

https://github.com/ipfs/js-ipfs/pull/1078 implements files ls API

richardschneider avatar Nov 16 '17 08:11 richardschneider

The Pin API and DHT FindProviders are the only tests failing. All are returning Invalid IPFS command, which mean the API is not implemented.

richardschneider avatar Dec 28 '17 01:12 richardschneider