Commit Graph

128 Commits

Author SHA1 Message Date
fryorcraken.eth c2cef9a319
chore: run `npm update` 2023-02-10 08:32:41 +11:00
fryorcraken.eth 719ec8e2e7
chore: fix dev dependencies for tests package 2023-02-09 19:31:12 +11:00
fryorcraken.eth 803ae7bd8e
chore!: bump libp2p dependencies 2023-02-09 19:30:59 +11:00
Danish Arora 2a7d72be14
chore: decrease delay on the peer-exchange tests (#1141)
* decrease timeouts for peer-exchange tests

* reset dns test timeout
2023-02-08 11:09:52 +05:30
Danish Arora b33306655a
chore: move libp2p and byte utils to a single `utils` package (#1149)
* move libp2p and byte utils to a single `utils`
package

* set package version to 0.0.1
2023-02-06 11:22:36 +05:30
Danish Arora 8910a6d76a
chore: move args for `createEncoder` into non-repeating `options` & fix typedoc (#1146)
* move args for `createEncoder` into non-repeating `options` & fix typedoc

* update tests with new API
2023-02-02 11:37:28 +05:30
Danish Arora 10b3898762
chore: move protocols `CreateOptions` into interfaces (#1145)
* move protocols `CreateOptions` into interfaces and
add possible TODO

* remove: createOptions for PeerExchange

* update test with new API
2023-02-02 08:02:06 +05:30
Danish Arora 11819fc7b1
feat: DNS discovery as default bootstrap discovery (#1114)
* use DNS discovery as default bootstrap discovery

* fix: failing CI

* fix: typo

* introduce tagging, components & explicit tests

    libp2p wasn't by default tagging peers with dns-discovery as
"bootstrap"
    -- we are manually now tagging peers with "dns-discovery", and then
    running tests according to that

* fix: package installs

* fix: typedoc CI

* change tag name from dns-discovery to bootstrap

* update tag name in test

* fix CI

* address review

* add: prod enrtree and use as default
2023-01-31 19:47:46 +05:30
fryorcraken.eth afa7262604
test: replace nwaku ip with local ip 2023-01-30 20:08:04 +11:00
fryorcraken.eth c8fa8ea20e
chore: remove unnecessary compilation flag for nwaku 2023-01-30 20:08:04 +11:00
fryorcraken.eth 171fd1e6df
fix: randomize the first port tried by portfinder 2023-01-30 20:07:46 +11:00
Danish Arora 380ba6987a
disable tests connecting to test fleet on the CI (#1138) 2023-01-30 11:29:12 +05:30
Danish Arora cc1d8bb3d5
feat: change DoH DNS provider (#1131)
* fix: change DoH DNS provider
opendns did not support CORS -- switched it with AhaDNS that does not
persist logs

* Update packages/dns-discovery/src/dns_over_https.ts

Co-authored-by: fryorcraken.eth <110212804+fryorcraken@users.noreply.github.com>

* add ahadns to cspell

* increase timeout on compliance test
possibly the new dns provider we use is taking longer than
opendns to resolve is why the test did not pass with
5000ms

Co-authored-by: fryorcraken.eth <110212804+fryorcraken@users.noreply.github.com>
2023-01-24 23:42:21 +05:30
Danish Arora 5fae073ebd
fix: edge case with peer-exchange (#1125)
* address comments

* rename to maxRetries

* use timeout instead of interval

* remove: only from test
2023-01-24 22:50:16 +05:30
weboko 913573a25a
remove no-extraneous-dependencies lint options, move packages to devDep section 2023-01-19 22:14:17 +01:00
Danish Arora 0b083201c6
chore: refactor dns-discovery & add tests (#1084)
* temp-add: debugging

* fix: ENR root signature verification

the nodes in the TXT/fleet were updated causing the publicKey to change
and verification to fail

* add: libp2p compliance tests

* fix: bind function
`bind` was being passed an empty object reference

* fix: tests

* merge with master

* chore: address review
- move compliance test to dev dependency
- move global mocha timeout to test specific timeout

* chore: update enrtree pubkey and fqdn
ref: https://github.com/status-im/infra-nim-waku/issues/64

* chore: update libp2p-peer-discovery-compliance-tests
ref: https://github.com/libp2p/js-libp2p-interfaces/pull/328

* chore: fix typedoc errors

* add: dns-discovery to dependencies
2023-01-06 12:30:06 +05:30
danisharora099 93b12e59c9
fix: failing CI check
add `@waku/peer-exchange` as a dependency to `tests`
2023-01-05 12:54:29 +05:30
weboko bcc7c451ed
Merge branch 'master' of github.com:waku-org/js-waku into weboko/missing-dep 2023-01-04 21:51:37 +01:00
Danish Arora e0e8e655f8
chore: fix peer discovery peer-exchange (#1069)
* fix: discovery for peer-exchange

use the bootstrap node as a starter to send a
peer-exchange query to, and emit the response
peers received from it for further connection to
libp2p using the peer-discovery interface

* init: test for libp2p bootstrap/discovery for
peer-exchange

* temp-add: console.logs for easier debugging

* add: peer discovery test & rm: console.logs

* chore: rm  and redundant spec test

* add: interval for peer exchange queries
we set an interval to query a peer every 5 minutes
for peer exchange, and add new peers if found

* address: reviews
- add `type` for imports not using values
- better handling for peer-exchange query interval

* chore: fix tsc for peer-exchange
use node16 for module resolution

* chore: add extra exports to fix typedoc warnings
ref: https://github.com/TypeStrong/typedoc/issues/1739
2023-01-04 14:35:44 +05:30
weboko fb9bb35042
fix: move deps from dev deps 2022-12-23 00:24:38 +01:00
weboko ae764bc31e
add missing deps to workspaces 2022-12-23 00:18:16 +01:00
fryorcraken.eth edf5d438cb
test: remove `--nat` option when starting nwaku 2022-12-15 13:54:07 +11:00
dependabot[bot] 872c9cd0df
build(deps-dev): bump cspell from 5.21.2 to 6.17.0
Bumps [cspell](https://github.com/streetsidesoftware/cspell) from 5.21.2 to 6.17.0.
- [Release notes](https://github.com/streetsidesoftware/cspell/releases)
- [Changelog](https://github.com/streetsidesoftware/cspell/blob/main/CHANGELOG.md)
- [Commits](https://github.com/streetsidesoftware/cspell/compare/v5.21.2...v6.17.0)

---
updated-dependencies:
- dependency-name: cspell
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-13 13:46:02 +11:00
fryorcraken.eth 9ac92ef99d
test: use LightNode interface 2022-12-13 10:58:07 +11:00
fryorcraken.eth f743cfd1ca
chore: rename node interfaces to include `Node` in name
Also rename node with only relay to `RelayNode`.
2022-12-12 22:36:14 +11:00
fryorcraken.eth 8f01a453f7
test: usage of `DecodedMessage` class is preferred
This is because `IDecodedMessage` does not include all possible field of
messages from a specific decoder (ie, signature public key, etc) so
usage of the `DecodedMessage` class associated with the used decoder is
preferred.
2022-12-12 22:13:47 +11:00
fryorcraken.eth cc691e26ce
feat: added `I` prefix to message/codec interfaces
To make it easier to differentiate with their implementations.
2022-12-12 22:13:46 +11:00
Danish Arora d6de62a391
chore: remove relay as default when starting nwaku for tests (#1044)
* chore: redeploy

* remove: relay as default for nwaku

* address: comments

* remove relay as default and add where needed

* Update packages/tests/tests/light_push.node.spec.ts

Co-authored-by: fryorcraken.eth <110212804+fryorcraken@users.noreply.github.com>

Co-authored-by: fryorcraken.eth <110212804+fryorcraken@users.noreply.github.com>
2022-12-12 11:08:08 +05:30
Danish Arora eecdb6aeeb
chore: upgrade to node 18 (#1061)
* chore: change `localhost` -> `127.0.0.1`

There is a change in how Node does DNS resolution in Node 18 vs
16 -- `localhost` resolves to `::1`, which is the equivalent of
`127.0.0.1` but in IPv6 instead of IPv4. The server however is
only listening on IPv4.
Reference:
https://github.com/nodejs/node/issues/40702#issuecomment-958143154

* refactor: change node version on CI from 16 to 18
2022-12-12 10:52:17 +05:30
Danish Arora 6e4ff0f2b8
fix: revert timeout on test (#1059) 2022-12-07 20:37:10 +05:30
Danish Arora 0ca7fd790c
feat!: implement peer exchange (#1027)
* wip -- yet to test

* update: draft

* wip

* support passing flags manually to nwaku node

* refactor peer-exchange test

* switch response from uint8array to ENR

* rm: unnecesary logs

* implement clas

* fix: for loop

* init-wip: directories

* setup: new package & fix circular deps

* bind a response handler

* wip: refactor & update test

* test logs

* wip code - debugging

* address: comments

* Update packages/core/src/lib/waku_peer_exchange/peer_discovery.ts

Co-authored-by: fryorcraken.eth <110212804+fryorcraken@users.noreply.github.com>

* Update packages/core/src/lib/waku_peer_exchange/peer_discovery.ts

Co-authored-by: fryorcraken.eth <110212804+fryorcraken@users.noreply.github.com>

* address: comments

* address: comments

* address: comments

* address: comments

* address: comments

* fix: test build

* refactor

* fix: build

* comply with API

* numPeers: use number instead of bigint

* fix: build

* Update packages/peer-exchange/package.json

Co-authored-by: fryorcraken.eth <110212804+fryorcraken@users.noreply.github.com>

* Update packages/peer-exchange/src/waku_peer_exchange.ts

Co-authored-by: fryorcraken.eth <110212804+fryorcraken@users.noreply.github.com>

* Update packages/peer-exchange/src/waku_peer_exchange.ts

Co-authored-by: fryorcraken.eth <110212804+fryorcraken@users.noreply.github.com>

* Update packages/peer-exchange/src/waku_peer_exchange.ts

Co-authored-by: fryorcraken.eth <110212804+fryorcraken@users.noreply.github.com>

* address: comments, add eslint config

* Update packages/peer-exchange/.eslintrc.cjs

Co-authored-by: fryorcraken.eth <110212804+fryorcraken@users.noreply.github.com>

* Update packages/peer-exchange/src/index.ts

Co-authored-by: fryorcraken.eth <110212804+fryorcraken@users.noreply.github.com>

* address comments

* test works with test fleet

* rm: only for px test => run all tests

* fix: tests

* reorder packages for build, and fix imports

* remove: px test doesnt work with local nodes

* chore: move proto into a separate package

* fix: proto dir

* fix: build

* fix: ci

* add: index for proto

* fix: ci

* Update packages/proto/package.json

Co-authored-by: fryorcraken.eth <110212804+fryorcraken@users.noreply.github.com>

* address comments

* chore: run failing test with higher timeout

* chore: run failing test with higher timeout

* fix: ci

Co-authored-by: fryorcraken.eth <110212804+fryorcraken@users.noreply.github.com>
2022-12-07 11:35:30 +05:30
fryorcraken.eth 33ed43c068
feat: `waitForRemotePeer` can now be directly imported from `@waku/core` 2022-12-05 15:14:51 +11:00
fryorcraken.eth f7fabec8b3
feat: easy import by having an export map for each type of encryption 2022-12-05 15:14:17 +11:00
fryorcraken.eth e8efd5e962
feat!: export user functions from package root
`createEncoder`, `createDecoder` and `DecodedMessage` are function/types
useful to the user so they should have easy access to it.

We still export `Decoder` and `Encoder` but in a path so it cam be
re-used by `@waku/message-encryption`.
2022-12-05 09:34:17 +11:00
fryorcraken.eth ad15f861c3
feat!: hide `Decoder`/`Encoder` classes to user
Reasoning: by exposing the `Decoder` and `Encoder` classes to the user,
the user may care about them, try to use the method etc.

By "hiding" them away and providing `create*` help, the aim is for the
user to just call a function instead of instantiating a class.

Also, `V0` does not provide much information to the user so removing it.
2022-12-05 09:34:17 +11:00
fryorcraken.eth 88c6ec6ef4
chore: add '.js' extensions to local import
As per ESM standard.
2022-12-02 15:54:30 +11:00
fryorcraken.eth 2dddaa193a
chore: merge tsconfig
No need to duplicate the config.
2022-12-02 15:54:30 +11:00
fryorcraken.eth 2a0b06f361
test: use `createLightNode` instead of a full node
As full node was only necessary due to an issue nwaku v0.11.

Ref: https://github.com/status-im/nwaku/pull/1090
2022-11-21 10:52:33 +11:00
danisharora099 100eb4c4b4
Merge branch 'master' into danisharora/cursor-support-store 2022-11-17 13:00:48 +05:30
fryorcraken.eth ee009742c3
Merge branch 'master' of github.com:waku-org/js-waku into danisharora/add-user-agent 2022-11-17 14:41:01 +11:00
fryorcraken.eth a8ab53a6c5
tests: Use in-memory DB instead of sqlite (in memory) 2022-11-17 14:28:01 +11:00
fryorcraken.eth c8e286a42a
test: Fix flaky ephemeral test and general improvement
The messages were sent at the same time over light push so there was
no strong order preservation from the behaviour.
Correction: order does not matter, just check that messages aren't
present.

Messages were only checked for `ephemeral` being false + one test was
doing several checks.
Correction: split the test and use light push + filter to check
ephemeral field value preservation.
2022-11-17 12:31:33 +11:00
fryorcraken.eth b6faebc422
test: fix flaky test 2022-11-17 12:31:32 +11:00
fryorcraken.eth 909a8f94c2
test: set nwaku logs to trace
Can now be done via command line argument.
2022-11-17 12:07:53 +11:00
fryorcraken.eth c7920f09f3
test: check both custom and default agents 2022-11-17 11:29:34 +11:00
danisharora099 1cfba385c9
rn persist 2022-11-17 01:34:49 +05:30
Danish Arora 708d48a914
Merge branch 'master' into danisharora/add-user-agent 2022-11-17 01:21:46 +05:30
danisharora099 0e0660f5b1
revert: timeout 2022-11-16 19:06:32 +05:30
danisharora099 5c4118041e
fix: cursor 2022-11-16 18:57:46 +05:30
fryorcraken.eth 8dfb133cd7
fix: libp2p upgrade (no more autodial + constructor dependency injection) 2022-11-16 21:27:33 +11:00
fryorcraken.eth 9d2df1d620
chore: bump libp2p to 0.40.0 2022-11-16 21:27:32 +11:00
Danish Arora 9613e9c41d
Merge branch 'master' into danisharora/cursor-support-store 2022-11-16 13:26:35 +05:30
fryorcraken.eth 59992832fe
feat!: add Waku Message ephemeral support 2022-11-16 11:00:43 +11:00
danisharora099 f3575afdfd
add: test case 2022-11-16 00:57:42 +05:30
danisharora099 8f243eb325
fix: git diff 2022-11-15 18:07:29 +05:30
danisharora099 1a5a57f756
fix: git diff 2022-11-15 18:06:59 +05:30
danisharora099 f3635f1fe8
address comments 2022-11-15 18:06:33 +05:30
danisharora099 69b64af548
add: tests 2022-11-15 17:30:35 +05:30
fryorcraken.eth 1b85373472
test: use `esnext` for NodeJS tests 2022-11-15 22:01:27 +11:00
fryorcraken.eth 74d7bb90c7
test: compare all messages at once
Makes it easier to understand the order mismatch.
2022-11-15 22:01:27 +11:00
fryorcraken.eth 11c9823a9d
test: use byte payload to more easily read nwaku's logs 2022-11-15 22:01:27 +11:00
fryorcraken.eth c3c3833b1b
test: nwaku's store now reject messages older than 20s 2022-11-15 22:01:27 +11:00
fryorcraken.eth 862a33f239
test: reduce log verbosity 2022-11-15 22:01:27 +11:00
fryorcraken.eth 66270836f8
test: need to specify in memory sqlite
So that messages are not persisted between tests.
2022-11-15 22:01:26 +11:00
fryorcraken.eth 9cdc9f96ac
test: nwaku's --persist-message is now deprecated
`--store=true` is enough to enable message persist for waku store.
2022-11-15 22:01:26 +11:00
danisharora099 0169a0ccb1
functionality works! test wip 2022-11-15 05:17:24 +05:30
fryorcraken.eth a60f2e529c
test: remove todo now that @multiformats/multiaddr@11 is used by all deps 2022-11-09 14:47:13 +11:00
fryorcraken.eth 2be2718531
chore: `check:tsc` needs to check test files too 2022-11-04 14:31:15 +11:00
fryorcraken.eth 8aa9b43f61
feat!: split outgoing and incoming message interface
While the data structure are similar, they serve different purposes.
Having the same type has show to confuse API consumers

Resolves #979
2022-11-04 14:30:59 +11:00
fryorcraken.eth 1a09aa18d5
chore: fix tests 2022-11-04 11:45:15 +11:00
fryorcraken.eth 55192a2774
chore: fix tests test + karma tests 2022-11-03 22:40:42 +11:00
fryorcraken.eth e901e7f69d
chore: fix tests build 2022-11-03 21:48:04 +11:00
fryorcraken.eth 69c94db23a
chore: fix doc 2022-11-02 15:05:12 +11:00
fryorcraken.eth 6d717f2e55
tests: all files in `tests` are actually node only
Except for a live test that always fails.
2022-11-02 14:08:32 +11:00
fryorcraken.eth 5ba1ee12c7
test: re-introduce build 2022-11-02 13:53:26 +11:00
fryorcraken.eth b11d465a9d
chore: move tests to remove circular dep 2022-11-01 21:31:53 +11:00
fryorcraken.eth 3d08cb28c8
chore: move tests to separate package 2022-11-01 20:13:09 +11:00
fryorcraken.eth ce9938e464
chore: move tests to separate package 2022-11-01 19:57:19 +11:00