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

fix: js-waku / nwaku interop #252

Merged
merged 9 commits into from
Jun 13, 2022
Merged

fix: js-waku / nwaku interop #252

merged 9 commits into from
Jun 13, 2022

Conversation

richard-ramos
Copy link
Member

Fixes #244
Fixes #247
Partially fixes #214

@richard-ramos richard-ramos requested a review from alaibe June 1, 2022 19:38
@lgtm-com
Copy link

lgtm-com bot commented Jun 1, 2022

This pull request fixes 1 alert when merging 01f220e into 3847bca - view on LGTM.com

fixed alerts:

  • 1 for Incorrect conversion between integer types

@D4nte
Copy link
Contributor

D4nte commented Jun 2, 2022

I tested 01f220e with js-waku:
I am getting

   Error: protocol selection failed
        at select (/home/fryorcraken/src/status-im/js-waku/node_modules/multistream-select/src/select.js:72:17)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at async Upgrader._multiplexOutbound (/home/fryorcraken/src/status-im/js-waku/node_modules/libp2p/src/upgrader.js:459:36)
        at async Upgrader.upgradeOutbound (/home/fryorcraken/src/status-im/js-waku/node_modules/libp2p/src/upgrader.js:204:44)
        at async ClassIsWrapper.dial (/home/fryorcraken/src/status-im/js-waku/node_modules/libp2p-websockets/src/index.js:54:18)
        at async TransportManager.dial (/home/fryorcraken/src/status-im/js-waku/node_modules/libp2p/src/transport-manager.js:111:14)
        at async /home/fryorcraken/src/status-im/js-waku/node_modules/libp2p/src/dialer/dial-request.js:81:18
        at async /home/fryorcraken/src/status-im/js-waku/node_modules/p-some/index.js:53:19
AggregateError: 
    Error: protocol selection failed
        at select (node_modules/multistream-select/src/select.js:72:17)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at async Upgrader._multiplexOutbound (node_modules/libp2p/src/upgrader.js:459:36)
        at async Upgrader.upgradeOutbound (node_modules/libp2p/src/upgrader.js:204:44)
        at async ClassIsWrapper.dial (node_modules/libp2p-websockets/src/index.js:54:18)
        at async TransportManager.dial (node_modules/libp2p/src/transport-manager.js:111:14)
        at async /home/fryorcraken/src/status-im/js-waku/node_modules/libp2p/src/dialer/dial-request.js:81:18
        at async /home/fryorcraken/src/status-im/js-waku/node_modules/p-some/index.js:53:19
    at maybeSettle (node_modules/p-some/index.js:31:11)
    at /home/fryorcraken/src/status-im/js-waku/node_modules/p-some/index.js:69:23

I am dialing with the following protocols:

  "/vac/waku/relay/2.0.0-beta2",
  "/vac/waku/relay/2.0.0",

What protocols are supported? I'd expect at least one to be selected.

I am also getting some socket hang up issues:

  waku:nwaku nwaku args: --listen-address=127.0.0.1 --relay=true --rpc=true --rpc-admin=true --websocket-support=true --log-level=debug --tcp-port=8001 --rpc-port=8000 --websocket-port=8002 --store=false --filter=false --lightpush=false +0ms
  waku:nwaku nwaku 359751 started at 3:11:07 pm +32ms
  waku:nwaku Waiting to see 'Node setup complete' in nwaku logs +0ms
  waku:nwaku nwaku node has been started +35ms
  waku:nwaku RPC Query:  get_waku_v2_debug_v1_info [] +0ms
  waku:nwaku nwaku 359751 getting SIGINT at 3:11:07 pm +6ms
  waku:nwaku nwaku 359751 interrupted: true +0ms

FetchError: request to http://localhost:8000/ failed, reason: socket hang up
    at ClientRequest.<anonymous> (node_modules/node-fetch/lib/index.js:1461:11)
    at ClientRequest.emit (node:events:520:28)
    at ClientRequest.emit (node:domain:475:12)
    at Socket.socketOnEnd (node:_http_client:466:9)
    at Socket.emit (node:events:532:35)
    at Socket.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1346:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Port 8000 is rpc as you can see for the parameters.

Also getting other errors:

  waku:nwaku nwaku args: --listen-address=127.0.0.1 --relay=true --rpc=true --rpc-admin=true --websocket-support=true --log-level=debug --tcp-port=8004 --rpc-port=8003 --websocket-port=8005 --persist-messages=true +7ms
  waku:nwaku nwaku 360231 started at 3:11:24 pm +12ms
  waku:nwaku Waiting to see 'Node setup complete' in nwaku logs +0ms
  waku:nwaku nwaku 360215 process exited with 0 at 3:11:24 pm +1ms
  waku:nwaku nwaku node has been started +37ms
  waku:nwaku RPC Query:  post_waku_v2_relay_v1_message [
  '/waku/2/default-waku/proto',
  {
    payload: '4d6573736167652030',
    contentTopic: '/test/1/waku-store/utf8',
    timestamp: 1654146684088000000
  }
] +0ms
  waku:nwaku RPC Response:  Response {
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: PassThrough {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 4,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: true,
      [Symbol(kCapture)]: false,
      [Symbol(kCallback)]: null
    },
    disturbed: true,
    error: null
  },
  [Symbol(Response internals)]: {
    url: 'http://localhost:8003/',
    status: 400,
    statusText: 'Bad Request',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
} { result: null, error: 'illegal base64 data at input byte 16', id: 1 } +3ms
  waku:nwaku nwaku 360231 getting SIGINT at 3:11:24 pm +2ms
  waku:nwaku nwaku 360231 interrupted: true +0ms

AssertionError: expected null to be true
Expected :true
Actual   :[null]
<Click to see difference>

    at Context.<anonymous> (src/lib/waku_store/index.node.spec.ts:46:14)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

@D4nte
Copy link
Contributor

D4nte commented Jun 2, 2022

Feel free to test yourself:

  1. checkout the js-waku go-waku-drop-in branch
  2. Set some env variable:
export DEBUG=waku* # To get the JSON query/response for debugging
export WAKU_SERVICE_NODE_BIN=/home/fryorcraken/src/status-im/go-waku/build/waku # Point the go-waku bin
export WAKU_SERVICE_NODE_DIR=/home/fryorcraken/src/status-im/go-waku/build # May not be needed, folder where the go-waku bin will be executed
  1. run the tests: npm run test:unit

@richard-ramos
Copy link
Member Author

richard-ramos commented Jun 2, 2022

Error: protocol selection failed
        at select (node_modules/multistream-select/src/select.js:72:17)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at async Upgrader._multiplexOutbound (node_modules/libp2p/src/upgrader.js:459:36)
        at async Upgrader.upgradeOutbound (node_modules/libp2p/src/upgrader.js:204:44)
        at async ClassIsWrapper.dial (node_modules/libp2p-websockets/src/index.js:54:18)
        at async TransportManager.dial (node_modules/libp2p/src/transport-manager.js:111:14)
        at async /home/fryorcraken/src/status-im/js-waku/node_modules/libp2p/src/dialer/dial-request.js:81:18
        at async /home/fryorcraken/src/status-im/js-waku/node_modules/p-some/index.js:53:19

This error happened because go-libp2p v0.19.0 removed mplex from the list of default muxers (which is what nim-libp2p and js-libp2p support at the moment). I added it back in master but forgot to rebase this branch. See libp2p/specs#402 and libp2p/go-libp2p#1344


FetchError: request to http://localhost:8000/ failed, reason: socket hang up

Fixed!


We're getting better results now :)

  107 passing (1m)
  1 pending
  24 failing

I'll have a look at the illegal base64 data at input byte 16 error, but there are others that I need some help understanding them: https://gist.github.com/richard-ramos/147ac70ff0ec80dcfaf101eb2a198db6

@lgtm-com
Copy link

lgtm-com bot commented Jun 2, 2022

This pull request fixes 1 alert when merging 67e3732 into ca59527 - view on LGTM.com

fixed alerts:

  • 1 for Incorrect conversion between integer types

@richard-ramos
Copy link
Member Author

 7) Waku Light Push [node only]
       Push on custom pubsub topic:

      AssertionError: expected false to be true
      + expected - actual

Looking at the logs, go-waku does not have a peer with relay capabilities to publish the message, so it fails due to this condition:

if !w.EnoughPeersToPublishToTopic(topic) {
	return nil, errors.New("not enough peers to publish")
}

@lgtm-com
Copy link

lgtm-com bot commented Jun 2, 2022

This pull request fixes 1 alert when merging 7b13d64 into ca59527 - view on LGTM.com

fixed alerts:

  • 1 for Incorrect conversion between integer types

Copy link
Collaborator

@alaibe alaibe left a comment

Choose a reason for hiding this comment

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

code LGTM

waku.go Outdated
},
&cli.StringFlag{
Name: "nat",
Usage: "TODO",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add a better description even if todo?

@lgtm-com
Copy link

lgtm-com bot commented Jun 9, 2022

This pull request fixes 1 alert when merging ef88904 into c93cda7 - view on LGTM.com

fixed alerts:

  • 1 for Incorrect conversion between integer types

@lgtm-com
Copy link

lgtm-com bot commented Jun 13, 2022

This pull request fixes 1 alert when merging 4c4fcca into 73af200 - view on LGTM.com

fixed alerts:

  • 1 for Incorrect conversion between integer types

@lgtm-com
Copy link

lgtm-com bot commented Jun 13, 2022

This pull request introduces 1 alert and fixes 1 when merging 6385647 into 73af200 - view on LGTM.com

new alerts:

  • 1 for Missing error check

fixed alerts:

  • 1 for Incorrect conversion between integer types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants