Skip to content

JSON RPC/arguments: Discrepancies with nwaku #247

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

Closed
D4nte opened this issue May 27, 2022 · 2 comments · Fixed by #252
Closed

JSON RPC/arguments: Discrepancies with nwaku #247

D4nte opened this issue May 27, 2022 · 2 comments · Fixed by #252
Labels
bug Something isn't working

Comments

@D4nte
Copy link
Contributor

D4nte commented May 27, 2022

Running the js-waku test suite with go-waku, here are some errors encountered:

Log format:

waku:nwaku RPC Query:  <method> <params>
waku:nwaku RPC Response:  <response headers> <response content>

get_waku_v2_relay_v1_messages

 waku:nwaku RPC Query:  get_waku_v2_relay_v1_messages [ '/waku/2/default-waku/proto' ] +1s
  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: 'json: cannot unmarshal string into Go value of type rpc.TopicArgs',
  id: 1
}

get_waku_v2_debug_v1_info

enrUri is missing

post_waku_v2_private_v1_asymmetric_message

  waku:nwaku RPC Query:  post_waku_v2_private_v1_asymmetric_message [
  '/waku/2/default-waku/proto',
  {
    contentTopic: '/test/1/waku-message/utf8',
    payload: '4865726520697320616e20656e63727970746564206d6573736167652e'
  },
  '0x04e944b7578272f771b121410e92be5add484b66bc620068e5e208fa54291379d2a53472c5f286da08982145d6514b1a17e144b1fa4962b9c050d76303735f591e'
] +556ms
  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:8000/',
    status: 400,
    statusText: 'Bad Request',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
} {
  result: null,
  error: 'json: cannot unmarshal string into Go value of type rpc.AsymmetricMessageArgs',
  id: 1
} +1ms

post_waku_v2_private_v1_symmetric_message

waku:nwaku RPC Query:  post_waku_v2_private_v1_symmetric_message [
  '/waku/2/default-waku/proto',
  {
    contentTopic: '/test/1/waku-message/utf8',
    payload: '486572652069732061206d65737361676520656e6372797074656420696e20612073796d6d6574726963206d616e6e65722e'
  },
  '0xae0bbbe7a7eef7a4d95c6610824a9402c1f9a2a47f0f1daac72a4edcb7aede20'
] +543ms
  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:8000/',
    status: 400,
    statusText: 'Bad Request',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
} {
  result: null,
  error: 'json: cannot unmarshal string into Go value of type rpc.SymmetricMessageArgs',
  id: 1
} +2ms

post_waku_v2_relay_v1_message

  waku:nwaku RPC Query:  post_waku_v2_relay_v1_message [
  '/waku/2/default-waku/proto',
  {
    payload: '4865726520697320616e6f74686572206d6573736167652e',
    contentTopic: '/test/1/waku-relay/utf8',
    timestamp: 1653652735961000000
  }
] +236ms
  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:8000/',
    status: 400,
    statusText: 'Bad Request',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
} {
  result: null,
  error: 'json: cannot unmarshal string into Go value of type rpc.RelayMessageArgs',
  id: 1
} +2ms

--persist-messages

Incorrect Usage. flag provided but not defined: -persist-messages
@richard-ramos
Copy link
Member

Most of the issues should be fixed in #252, but the following tests still fail:

1) Discovery [live data]
       Check pre-defined nodes against hosted JSON [live data]:

Test must be updated with new values from fleet.status.im


  2) Waku Filter
       creates a subscription:
     Error: Timeout of 10000ms exceeded. 

  3) Waku Filter
       handles multiple messages:
     Error: Timeout of 10000ms exceeded. 

  4) Waku Filter
       unsubscribes:
      AssertionError: expected +0 to equal 1

It seems that Filter tests are flaky. I've been able to get positive results randomly


  5) Waku Light Push [node only]
       Push successfully:
      AssertionError: expected false to be true

  6) Waku Light Push [node only]
       Push on custom pubsub topic:
      AssertionError: expected false to be true

Go-waku lightpush nodes expect to have at least 1 relay peer to publish a message, otherwise it wont broadcast the message. This is a difference compared to nim-waku where it will ignore the number of peers. I suggest improving the test by adding a relay peer, since IMO the behavior of go-waku here is an improvement over nwaku's behavior.


  7) Waku Message [node only]
       Interop: nwaku
         Encrypts message for nwaku [asymmetric, no signature]:
     Error: Unknown type, must be binary type
      at Encoder.encode (node_modules/multiformats/cjs/src/bases/base.js:18:13)
      at toString (node_modules/uint8arrays/cjs/src/to-string.js:12:23)
      at bytesToHex (src/lib/utils.ts:8:132)
      at Nwaku.getAsymmetricMessages (src/test_utils/nwaku.ts:11:30)
      at Context.<anonymous> (src/lib/waku_message/index.node.spec.ts:5:2913)

As described here: vacp2p/rfc#507 The KeyPair fields are called in privateKey and publicKey in the RFC, but seckey and pubkey in the implementation. Go-waku implements this correctly according to the spec


  8) Waku Relay [node only]
       Interop: nwaku
         Nwaku publishes:
     AssertionError: expected undefined to equal +0

It seems that this is expecting the message to have a version? I'm not sure what's the cause of the issue, so help is appreciated verifying this.

  9) Waku Store
       Retrieves history:
     AssertionError: expected { Object (error) } to be true

  10) Waku Store
       Retrieves history using callback:
     AssertionError: expected { Object (error) } to be true

  11) Waku Store
       Retrieval aborts when callback returns true:
     AssertionError: expected { Object (error) } to be true

  12) Waku Store
       Retrieves all historical elements in chronological order through paging:
     AssertionError: expected { Object (error) } to be true

  13) Waku Store
       Retrieves history using custom pubsub topic:
     AssertionError: expected { Object (error) } to be true

  14) Waku Store
       Retrieves history with asymmetric & symmetric encrypted messages:
     Error: the string "Failed to find known peer that registers waku store protocol" was thrown, throw an Error :)

  15) Waku Store
       Retrieves history with asymmetric & symmetric encrypted messages on different content topics:
     Error: the string "Failed to find known peer that registers waku store protocol" was thrown, throw an Error :)

  16) Waku Store
       Retrieves history using start and end time:
     AssertionError: expected { Object (error) } to be true

No relay peer is available, so attempting to send a message will fail. Also, looks like store protocol is not being started?
await nwaku.start({ persistMessages: true }); is missing store: true


  17) Wait for remote peer / get peers
       Store - dialed first:
      AssertionError: expected false to be true
      + expected - actual

  18) Wait for remote peer / get peers
       Store - dialed after - with timeout:
      AssertionError: expected false to be true
      + expected - actual

Looks like store protocol is not being started. await nwaku.start({ persistMessages: true }); is missing store: true

@richard-ramos
Copy link
Member

The issue was closed since I merged PR#252. Feel free to reopen or create a new one for the tests that are still failing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants