From 0564c4f95ce30e4bc8aa566395c4c3fdfade4104 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Tue, 14 Jun 2022 16:49:41 +1000 Subject: [PATCH 1/9] test: Increase timeout go-waku takes 9s to start, partially because nat cannot be deactivated. --- src/lib/waku_filter/index.node.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/waku_filter/index.node.spec.ts b/src/lib/waku_filter/index.node.spec.ts index 75a766253c..25bf8d1707 100644 --- a/src/lib/waku_filter/index.node.spec.ts +++ b/src/lib/waku_filter/index.node.spec.ts @@ -22,7 +22,7 @@ describe("Waku Filter", () => { }); beforeEach(async function () { - this.timeout(10000); + this.timeout(15000); nwaku = new Nwaku(makeLogFileName(this)); await nwaku.start({ filter: true, lightpush: true }); waku = await createWaku({ From 10c32c84c86232d346c2e98b87de1289accbf91a Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Tue, 14 Jun 2022 17:04:40 +1000 Subject: [PATCH 2/9] test: add delay for filter un/subscribe --- src/lib/waku_filter/index.node.spec.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/waku_filter/index.node.spec.ts b/src/lib/waku_filter/index.node.spec.ts index 25bf8d1707..f02949e018 100644 --- a/src/lib/waku_filter/index.node.spec.ts +++ b/src/lib/waku_filter/index.node.spec.ts @@ -46,6 +46,10 @@ describe("Waku Filter", () => { expect(msg.payloadAsUtf8).to.eq(messageText); }; await waku.filter.subscribe(callback, [TestContentTopic]); + // As the filter protocol does not cater for a ack of subscription + // we cannot know whether the subscription happened. Something we want to + // correct in future versions of the protocol. + await delay(200); const message = await WakuMessage.fromUtf8String( messageText, TestContentTopic @@ -66,6 +70,7 @@ describe("Waku Filter", () => { expect(msg.contentTopic).to.eq(TestContentTopic); }; await waku.filter.subscribe(callback, [TestContentTopic]); + await delay(200); await waku.lightPush.push( await WakuMessage.fromUtf8String("Filtering works!", TestContentTopic) ); @@ -89,6 +94,7 @@ describe("Waku Filter", () => { const unsubscribe = await waku.filter.subscribe(callback, [ TestContentTopic, ]); + await delay(200); await waku.lightPush.push( await WakuMessage.fromUtf8String( "This should be received", @@ -97,6 +103,7 @@ describe("Waku Filter", () => { ); await delay(100); await unsubscribe(); + await delay(200); await waku.lightPush.push( await WakuMessage.fromUtf8String( "This should not be received", From a7dc6936bcc7d8ced88e06f0f310b093f0d07845 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Wed, 15 Jun 2022 14:22:10 +1000 Subject: [PATCH 3/9] fix: nwaku's response differs from RFC but go-waku does not --- src/test_utils/nwaku.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/test_utils/nwaku.ts b/src/test_utils/nwaku.ts index 2f70cce648..cba55b4bb4 100644 --- a/src/test_utils/nwaku.ts +++ b/src/test_utils/nwaku.ts @@ -249,12 +249,19 @@ export class Nwaku { async getAsymmetricKeyPair(): Promise { this.checkProcess(); - const { seckey, pubkey } = await this.rpcCall<{ + const { privateKey, publicKey, seckey, pubkey } = await this.rpcCall<{ seckey: string; pubkey: string; + privateKey: string; + publicKey: string; }>("get_waku_v2_private_v1_asymmetric_keypair", []); - return { privateKey: seckey, publicKey: pubkey }; + // To be removed once https://github.com/vacp2p/rfc/issues/507 is fixed + if (seckey) { + return { privateKey: seckey, publicKey: pubkey }; + } else { + return { privateKey, publicKey }; + } } async postAsymmetricMessage( From e1bb2b351cde0285bf8f43cae7ad6c455e723ce7 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Fri, 27 May 2022 21:18:36 +1000 Subject: [PATCH 4/9] ci: run with go-waku --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3c4161be2..c983a1e00d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,6 +97,52 @@ jobs: name: nwaku-logs path: log/ + node_with_go_waku: + runs-on: ubuntu-latest + env: + GO_WAKU_VERSION: "0.2.1" + WAKU_SERVICE_NODE_DIR: ./go-waku + WAKU_SERVICE_NODE_BIN: ./go-waku/waku + WAKU_SERVICE_NODE_PARAMS: "--min-relay-peers-to-publish=0" # Can be removed once https://github.com/status-im/nwaku/issues/1004 is done + DEBUG: "waku*" + steps: + - uses: actions/checkout@v3 + + - name: Get go-waku + shell: bash + run: | + pwd + mkdir -p go-waku/ + cd go-waku + wget "https://github.com/status-im/go-waku/releases/download/v${GO_WAKU_VERSION}/gowaku-${GO_WAKU_VERSION}-x86_64.deb" + sudo apt install ./gowaku-${GO_WAKU_VERSION}-x86_64.deb + cp $(which waku) ./ + + - name: Ensure go-waku is ready + shell: bash + run: | + uname -a + cd go-waku + ./waku --help + + - name: Install NodeJS + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + + - uses: bahmutov/npm-install@v1 + + - run: npm run test:node + env: + DEBUG: "waku:nwaku*,waku:test*" + + - name: Upload logs on failure + uses: actions/upload-artifact@v2 + if: failure() + with: + name: go-waku-logs + path: log/ + release_next: runs-on: ubuntu-latest if: github.event_name == 'push' && github.ref == 'refs/heads/master' From 61701f0086f66f1d15ac4dff13673c01b07096a4 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Thu, 25 Aug 2022 12:28:36 +1000 Subject: [PATCH 5/9] feat: improve log format for DNS discovery peers --- src/lib/peer_discovery_dns/dns.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/peer_discovery_dns/dns.ts b/src/lib/peer_discovery_dns/dns.ts index 27a528efee..c8a15178ae 100644 --- a/src/lib/peer_discovery_dns/dns.ts +++ b/src/lib/peer_discovery_dns/dns.ts @@ -64,7 +64,15 @@ export class DnsNodeDiscovery { this._errorTolerance, () => this._search(domain, context) ); - dbg("retrieved peers: ", peers); + dbg( + "retrieved peers: ", + peers.map((peer) => { + return { + id: peer.peerId?.toString(), + multiaddrs: peer.multiaddrs?.map((ma) => ma.toString()), + }; + }) + ); return peers; } From 9feef9367ce8abc44c800b090eb7839cd04cc448 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Thu, 25 Aug 2022 12:29:24 +1000 Subject: [PATCH 6/9] test: go-waku needs --persist-messages to enable store ref: https://github.com/status-im/go-waku/issues/292 --- src/lib/wait_for_remote_peer.node.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/wait_for_remote_peer.node.spec.ts b/src/lib/wait_for_remote_peer.node.spec.ts index 859ea36244..c48bef1fbb 100644 --- a/src/lib/wait_for_remote_peer.node.spec.ts +++ b/src/lib/wait_for_remote_peer.node.spec.ts @@ -99,6 +99,7 @@ describe("Wait for remote peer", function () { relay: false, lightpush: false, filter: false, + persistMessages: true, }); const multiAddrWithId = await nwaku.getMultiaddrWithId(); @@ -125,6 +126,7 @@ describe("Wait for remote peer", function () { relay: false, lightpush: false, filter: false, + persistMessages: true, }); const multiAddrWithId = await nwaku.getMultiaddrWithId(); From 3bbdb9d98de48ab760337715e4ec00221d3768e2 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Thu, 25 Aug 2022 14:22:25 +1000 Subject: [PATCH 7/9] ci: print go-waku version when testing --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c983a1e00d..7d160da536 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,7 +123,7 @@ jobs: run: | uname -a cd go-waku - ./waku --help + ./waku --version - name: Install NodeJS uses: actions/setup-node@v3 From 2cb46b99244e974e17784bf41d2e0795044f3d4e Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Thu, 25 Aug 2022 14:26:47 +1000 Subject: [PATCH 8/9] ci: fix relative path of waku bin --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d160da536..2dfc3c2417 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,7 +102,7 @@ jobs: env: GO_WAKU_VERSION: "0.2.1" WAKU_SERVICE_NODE_DIR: ./go-waku - WAKU_SERVICE_NODE_BIN: ./go-waku/waku + WAKU_SERVICE_NODE_BIN: ./waku WAKU_SERVICE_NODE_PARAMS: "--min-relay-peers-to-publish=0" # Can be removed once https://github.com/status-im/nwaku/issues/1004 is done DEBUG: "waku*" steps: @@ -122,8 +122,8 @@ jobs: shell: bash run: | uname -a - cd go-waku - ./waku --version + cd "${WAKU_SERVICE_NODE_DIR}" + "${WAKU_SERVICE_NODE_BIN}" --version - name: Install NodeJS uses: actions/setup-node@v3 From def951e4aceb9bf4087695b06cea2a650f7a8b25 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Thu, 25 Aug 2022 14:40:25 +1000 Subject: [PATCH 9/9] ci: wait 100ms after go-waku seems ready as it is sometimes not --- src/test_utils/nwaku.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test_utils/nwaku.ts b/src/test_utils/nwaku.ts index cba55b4bb4..4cbffc3019 100644 --- a/src/test_utils/nwaku.ts +++ b/src/test_utils/nwaku.ts @@ -18,6 +18,7 @@ import { WakuMessage } from "../lib/waku_message"; import * as proto from "../proto/message"; import { existsAsync, mkdirAsync, openAsync } from "./async_fs"; +import { delay } from "./delay"; import waitForLine from "./log_file"; const dbg = debug("waku:nwaku"); @@ -181,6 +182,7 @@ export class Nwaku { dbg(`Waiting to see '${NODE_READY_LOG_LINE}' in nwaku logs`); await this.waitForLog(NODE_READY_LOG_LINE, 15000); + if (process.env.CI) await delay(100); dbg("nwaku node has been started"); }